mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-09 11:13:57 +08:00
Merge remote-tracking branch 'upstream/master'
This commit is contained in:
+25
-1
@@ -1,4 +1,4 @@
|
||||
# Contributors
|
||||
# Contributors
|
||||
|
||||
This is a non-exhaustive list of definitions and their creators. If you created a definition but are not listed then feel free to send a pull request on this file with your name and url.
|
||||
|
||||
@@ -13,6 +13,7 @@ All definitions files include a header with the author and editors, so at some p
|
||||
* [AngularFire](https://www.firebase.com/docs/angular/reference.html) (by [Dénes Harmath](https://github.com/thSoft))
|
||||
* [AngularJS](http://angularjs.org) (by [Diego Vilar](https://github.com/diegovilar)) ([wiki](https://github.com/borisyankov/DefinitelyTyped/wiki/AngularJS-Definitions-Usage-Notes))
|
||||
* [angularLocalStorage](https://github.com/agrublev/angularLocalStorage) (by [Hiroki Horiuchi](https://github.com/horiuchi/))
|
||||
* [angular-spinner](https://github.com/urish/angular-spinner) (by [Marcin Biegała](https://github.com/Biegal))
|
||||
* [AngularUI](http://angular-ui.github.io/) (by [Michel Salib](https://github.com/michelsalib))
|
||||
* [Angular Hotkeys](https://github.com/chieffancypants/angular-hotkeys/) (by [Jason Zhao](https://github.com/jlz27))
|
||||
* [Angular Protractor](https://github.com/angular/protractor) (by [Bill Armstrong](https://github.com/BillArmstrong))
|
||||
@@ -46,6 +47,7 @@ All definitions files include a header with the author and editors, so at some p
|
||||
* [CasperJS](http://casperjs.org) (by [Jed Hunsaker](https://github.com/jedhunsaker))
|
||||
* [Cheerio](https://github.com/MatthewMueller/cheerio) (by [Bret Little](https://github.com/blittle))
|
||||
* [Chosen](http://harvesthq.github.com/chosen/) (by [Boris Yankov](https://github.com/borisyankov))
|
||||
* [Chroma.js](https://github.com/gka/chroma.js) (by [Sebastian Brückner](https://github.com/invliD))
|
||||
* [Chrome](http://developer.chrome.com/extensions/) (by [Matthew Kimber](https://github.com/matthewkimber) and [otiai10](https://github.com/otiai10))
|
||||
* [Chrome App](http://developer.chrome.com/apps/) (by [Adam Lay](https://github.com/AdamLay))
|
||||
* [CKEditor](https://github.com/ckeditor/ckeditor-dev) (by [Ondrej Sevcik](https://github.com/ondrejsevcik))
|
||||
@@ -72,12 +74,14 @@ All definitions files include a header with the author and editors, so at some p
|
||||
* [Elm](http://elm-lang.org) (by [Dénes Harmath](https://github.com/thSoft))
|
||||
* [ember.js](http://emberjs.com/) (by [Boris Yankov](https://github.com/borisyankov))
|
||||
* [emissary](https://github.com/atom/emissary) (by [vvakame](https://github.com/vvakame))
|
||||
* [Emscripten](http://kripken.github.io/emscripten-site/) (by [Kensuke MATSUZAKI](https://github.com/zakki))
|
||||
* [EpicEditor](http://epiceditor.com/) (by [Boris Yankov](https://github.com/borisyankov))
|
||||
* [ES6-Promises](https://github.com/jakearchibald/ES6-Promises) (by [François de Campredon](https://github.com/fdecampredon/))
|
||||
* [Esprima](http://esprima.org/) (by [Teppei Sato](https://github.com/teppeis))
|
||||
* [expect.js](https://github.com/LearnBoost/expect.js) (by [Teppei Sato](https://github.com/teppeis))
|
||||
* [expectations](https://github.com/spmason/expectations) (by [vvakame](https://github.com/vvakame))
|
||||
* [Express](http://expressjs.com/) (by [Boris Yankov](https://github.com/borisyankov))
|
||||
* [express-session](https://www.npmjs.org/package/express-session) (by [Hiroki Horiuchi](https://github.com/horiuchi/))
|
||||
* [Ext JS](http://www.sencha.com/products/extjs/) (by [Brian Kotek](https://github.com/brian428))
|
||||
* [Fabric.js](http://fabricjs.com/) (by [Oliver Klemencic](https://github.com/oklemencic/))
|
||||
* [Fancybox](http://fancybox.net/) (by [Boris Yankov](https://github.com/borisyankov))
|
||||
@@ -115,6 +119,7 @@ All definitions files include a header with the author and editors, so at some p
|
||||
* [Google Translate API](https://developers.google.com/translate/) (by [Frank M](https://github.com/sgtfrankieboy))
|
||||
* [Google Url Shortener](https://developers.google.com/url-shortener/) (by [Frank M](https://github.com/sgtfrankieboy))
|
||||
* [Hammer.js](http://eightmedia.github.com/hammer.js/) (by [Boris Yankov](https://github.com/borisyankov))
|
||||
* [Hapi](http://github.com/spumko/hapi) (by [Hakubo](http://github.com/hakubo))
|
||||
* [Handlebars](http://handlebarsjs.com/) (by [Boris Yankov](https://github.com/borisyankov))
|
||||
* [HashMap](https://github.com/flesler/hashmap) (by [Rafał Wrzeszcz](https://wrzasq.pl))
|
||||
* [HashSet](http://www.timdown.co.uk/jshashtable/jshashset.html) (by [Sergey Gerasimov](https://github.com/gerich-home))
|
||||
@@ -125,6 +130,8 @@ 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))
|
||||
* [iCheck](http://damirfoy.com/iCheck/) (by [Dániel Tar](https://github.com/qcz))
|
||||
@@ -137,6 +144,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))
|
||||
@@ -153,6 +161,7 @@ All definitions files include a header with the author and editors, so at some p
|
||||
* [jQuery.Colorbox](http://www.jacklmoore.com/colorbox/) (by [Gidon Junge](https://github.com/gjunge))
|
||||
* [jQuery.contextMenu](http://medialize.github.com/jQuery-contextMenu/) (by [Natan Vivo](https://github.com/nvivo/))
|
||||
* [jQuery.Cookie](https://github.com/carhartl/jquery-cookie) (by [Roy Goode](https://github.com/RoyGoode))
|
||||
* [jQuery.customSelect](https://github.com/adamcoulombe/jquery.customSelect) (by [tomato360](https://github.com/tomato360))
|
||||
* [jQuery.Cycle](http://jquery.malsup.com/cycle/) (by [François Guillot](http://fguillot.developpez.com/))
|
||||
* [jQuery.Cycle2](http://jquery.malsup.com/cycle2/) (by [Donny Nadolny](https://github.com/dnadolny))
|
||||
* [jQuery.dataTables](http://www.datatables.net) (by [Armin Sander](https://github.com/pragmatrix))
|
||||
@@ -167,6 +176,7 @@ All definitions files include a header with the author and editors, so at some p
|
||||
* [jQuery.jNotify](http://jnotify.codeplex.com) (by [James Curran](https://github.com/jamescurran/))
|
||||
* [jQuery.joyride](http://zurb.com/playground/jquery-joyride-feature-tour-plugin) (by [Vincent Bortone](https://github.com/vbortone))
|
||||
* [jQuery.jSignature](https://github.com/willowsystems/jSignature) (by [Patrick Magee](https://github.com/pjmagee))
|
||||
* [jQuery.leanModal](http://leanmodal.finelysliced.com.au/)(by [tomato360](https://github.com/tomato360))
|
||||
* [jQuery.notifyBar](http://www.whoop.ee/posts/2013-04-05-the-resurrection-of-jquery-notify-bar/) (by [Shunsuke Ohtani](https://github.com/zaneli))
|
||||
* [jQuery.noty](http://needim.github.io/noty/) (by [Aaron King](https://github.com/kingdango/))
|
||||
* [jQuery.payment](http://needim.github.io/noty/) (by [Eric J. Smith](https://github.com/ejsmith/))
|
||||
@@ -191,9 +201,11 @@ All definitions files include a header with the author and editors, so at some p
|
||||
* [jQuery.Validation](http://bassistance.de/jquery-plugins/jquery-plugin-validation/) (by [Boris Yankov](https://github.com/borisyankov))
|
||||
* [jQuery.Watermark](http://jquery-watermark.googlecode.com) (by [Anwar Javed](https://github.com/anwarjaved))
|
||||
* [jQuery.base64](https://github.com/yatt/jquery.base64) (by [Shinya Mochizuki](https://github.com/enrapt-mochizuki))
|
||||
* [jquery-handsontable](https://github.com/handsontable/jquery-handsontable) (by [Ted John](https://github.com/intelorca))
|
||||
* [js-git](https://github.com/creationix/js-git) (by [Bart van der Schoor](https://github.com/Bartvds))
|
||||
* [js-url](https://github.com/websanova/js-url) (by [MIZUNE Pine](https://github.com/pine613))
|
||||
* [js-yaml](https://github.com/nodeca/js-yaml) (by [Bart van der Schoor](https://github.com/Bartvds/))
|
||||
* [jsbn](http://www-cs-students.stanford.edu/%7Etjw/jsbn/) (by [Eugene Chernyshov](https://github.com/Evgenus))
|
||||
* [jScrollPane](http://jscrollpane.kelvinluck.com) (by [Dániel Tar](https://github.com/qcz))
|
||||
* [JSDeferred](http://cho45.stfuawsc.com/jsdeferred/) (by [Daisuke Mino](https://github.com/minodisk))
|
||||
* [JSONEditorOnline](https://github.com/josdejong/jsoneditoronline) (by [Vincent Bortone](https://github.com/vbortone/))
|
||||
@@ -235,6 +247,7 @@ All definitions files include a header with the author and editors, so at some p
|
||||
* [MathJax](https://github.com/mathjax/MathJax) (by [Roland Zwaga](https://github.com/rolandzwaga))
|
||||
* [mCustomScrollbar](https://github.com/malihu/malihu-custom-scrollbar-plugin) (by [Sarah Williams](https://github.com/flurg))
|
||||
* [Meteor](https://www.meteor.com) (by [Dave Allen](https://github.com/fullflavedave))
|
||||
* [md5.js](http://labs.cybozu.co.jp/blog/mitsunari/2007/07/md5js_1.html) (by [MIZUNE Pine](https://github.com/pine613))
|
||||
* [Microsoft Ajax](http://msdn.microsoft.com/en-us/library/ee341002(v=vs.100).aspx) (by [Patrick Magee](https://github.com/pjmagee))
|
||||
* [Microsoft Live Connect](http://msdn.microsoft.com/en-us/library/live/hh243643.aspx) (by [John Vilk](https://github.com/jvilk))
|
||||
* [Minimatch](https://github.com/isaacs/minimatch) (by [vvakame](https://github.com/vvakame))
|
||||
@@ -245,10 +258,13 @@ 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))
|
||||
* [mysql](https://github.com/felixge/node-mysql) (by [William Johnston](https://github.com/wjohnsto))
|
||||
* [nconf](https://github.com/flatiron/nconf) (by [Jeff Goddard](https://github.com/jedigo))
|
||||
* [needle](https://github.com/tomas/needle) (by [San Chen](https://github.com/bigsan))
|
||||
* [noble](https://github.com/sandeepmistry/noble) (by [Seon-Wook Park](https://github.com/swook))
|
||||
* [nock](https://github.com/pgte/nock) (by [bonnici](https://github.com/bonnici))
|
||||
* [Node.js](http://nodejs.org/) (from TypeScript samples)
|
||||
@@ -268,6 +284,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))
|
||||
@@ -277,13 +294,16 @@ All definitions files include a header with the author and editors, so at some p
|
||||
* [Persona](http://www.mozilla.org/en-US/persona) (by [James Frasca](https://github.com/Nycto))
|
||||
* [PhantomJS](http://phantomjs.org) (by [Jed Hunsaker](https://github.com/jedhunsaker))
|
||||
* [PhoneGap](http://phonegap.com) (by [Boris Yankov](https://github.com/borisyankov))
|
||||
* [Physijs](http://chandlerprall.github.io/Physijs/) (by [gyoh_k](https://github.com/gyohk))
|
||||
* [PixiJS](https://github.com/GoodBoyDigital/pixi.js) (by [Pedro Casaubon](https://github.com/xperiments))
|
||||
* [Platform](https://github.com/bestiejs/platform.js) (by [Jake Hickman](https://github.com/JakeH))
|
||||
* [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))
|
||||
@@ -304,9 +324,11 @@ All definitions files include a header with the author and editors, so at some p
|
||||
* [Semver](https://github.com/isaacs/node-semver) (by [Bart van der Schoor](https://github.com/Bartvds))
|
||||
* [Sencha Touch](http://www.sencha.com/products/touch/) (by [Brian Kotek](https://github.com/brian428))
|
||||
* [SharePoint](http://sptypescript.codeplex.com) (by [Stanislav Vyshchepan](http://gandjustas.blogspot.ru) and [Andrey Markeev](http://markeev.com))
|
||||
* [ShellJS](http://shelljs.org) (by [Niklas Mollenhauer](https://github.com/nikeee))
|
||||
* [SignalR](http://www.asp.net/signalr) (by [Boris Yankov](https://github.com/borisyankov))
|
||||
* [simple-cw-node](https://github.com/astronaughts/simple-cw-node) (by [vvakame](https://github.com/vvakame))
|
||||
* [Sinon](http://sinonjs.org/) (by [William Sears](https://github.com/mrbigdog2u))
|
||||
* [SIPml](http://sipml5.org/) (by [Adriaan Groenenboom](https://github.com/chookies))
|
||||
* [sjcl](http://crypto.stanford.edu/sjcl/) (by [Eugene Chernyshov](https://github.com/Evgenus))
|
||||
* [SlickGrid](https://github.com/mleibman/SlickGrid) (by [Josh Baldwin](https://github.com/jbaldwin))
|
||||
* [smoothie](https://github.com/joewalnes/smoothie) (by [Mike H. Hawley](https://github.com/mikehhawley) and [Drew Noakes](https://drewnoakes.com))
|
||||
@@ -315,6 +337,7 @@ All definitions files include a header with the author and editors, so at some p
|
||||
* [SockJS](https://github.com/sockjs/sockjs-client) (by [Emil Ivanov](https://github.com/vladev))
|
||||
* [sockjs-node](https://github.com/sockjs/sockjs-node) (by [Phil McCloghry-Laing](https://github.com/pmccloghrylaing))
|
||||
* [SoundJS](http://www.createjs.com/#!/SoundJS) (by [Pedro Ferreira](https://bitbucket.org/drk4))
|
||||
* [source-map](https://github.com/mozilla/source-map) (by [Morten Houston Ludvigsen](https://github.com/MortenHoustonLudvigsen))
|
||||
* [Spin](http://fgnass.github.com/spin.js/) (by [Boris Yankov](https://github.com/borisyankov))
|
||||
* [sqlite3](https://github.com/mapbox/node-sqlite3) (by [Nick Malaguti](https://github.com/nmalaguti))
|
||||
* [status-bar](https://github.com/atom/status-bar) (by [vvakame](https://github.com/vvakame))
|
||||
@@ -360,6 +383,7 @@ All definitions files include a header with the author and editors, so at some p
|
||||
* [ws](http://einaros.github.io/ws/) (by [Paul Loyd](https://github.com/loyd))
|
||||
* [x2js](https://code.google.com/p/x2js/) (by [Hiroki Horiuchi](https://github.com/horiuchi/))
|
||||
* [xml2js](https://github.com/Leonidas-from-XIV/node-xml2js) (by [Michel Salib](https://github.com/michelsalib))
|
||||
* [xpath](https://github.com/goto100/xpath) (by [Andrew Bradley](https://github.com/cspotcode))
|
||||
* [XRegExp](http://xregexp.com/) (by [Bart van der Schoor](https://github.com/Bartvds))
|
||||
* [YouTube](https://developers.google.com/youtube/) (by [Daz Wilkin](https://github.com/DazWilkin/))
|
||||
* [YouTube Analytics API](https://developers.google.com/youtube/analytics/) (by [Frank M](https://github.com/sgtfrankieboy))
|
||||
|
||||
@@ -1 +1 @@
|
||||
""
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
""
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
""
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
""
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
""
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
""
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
""
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
""
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
""
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
""
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
""
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
""
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
""
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
""
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
""
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
""
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
""
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
""
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
""
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
""
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
""
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
""
|
||||
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
/// <reference path="angular-spinner.d.ts" />
|
||||
|
||||
var myApp = angular.module('testModule');
|
||||
|
||||
module AngularSpinnerTest {
|
||||
var app = angular.module("angularSpinnerTest", ["angular-spinner"]);
|
||||
|
||||
app.config(['usSpinnerService', function(usSpinnerService: ISpinnerService) {
|
||||
usSpinnerService.spin('key1');
|
||||
usSpinnerService.stop('key2');
|
||||
}]);
|
||||
}
|
||||
Vendored
+26
@@ -0,0 +1,26 @@
|
||||
// Type definitions for angular-spinner.js 0.5.1
|
||||
// Project: https://github.com/urish/angular-spinner
|
||||
// Definitions by: Marcin Biegała <https://github.com/Biegal>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../angularjs/angular.d.ts" />
|
||||
|
||||
/**
|
||||
* SpinnerService
|
||||
* see https://github.com/urish/angular-spinner
|
||||
*/
|
||||
interface ISpinnerService {
|
||||
/**
|
||||
* Start selected spinner
|
||||
*
|
||||
* @param spinner key
|
||||
*/
|
||||
spin(key: string): void;
|
||||
|
||||
/**
|
||||
* Stop selected spinner
|
||||
*
|
||||
* @param spinner key
|
||||
*/
|
||||
stop(key: string): void;
|
||||
}
|
||||
+3
-2
@@ -33,13 +33,14 @@ declare module ng.translate {
|
||||
}
|
||||
|
||||
interface ITranslateService {
|
||||
(key: string, ...params: string[]): ng.IPromise<string>;
|
||||
(translationId: string, interpolateParams?: any, interpolationId?: string): ng.IPromise<string>;
|
||||
(translationId: string[], interpolateParams?: any, interpolationId?: string): ng.IPromise<{ [key: string]: string }>;
|
||||
cloakClassName(): string;
|
||||
cloakClassName(name: string): ITranslateProvider;
|
||||
fallbackLanguage(langKey?: string): string;
|
||||
fallbackLanguage(langKey?: string[]): string;
|
||||
instant(translationId: string, interpolateParams?: any, interpolationId?: string): string;
|
||||
instant(translationId: string[], interpolateParams?: any, interpolationId?: string): string;
|
||||
instant(translationId: string[], interpolateParams?: any, interpolationId?: string): { [key: string]: string };
|
||||
isPostCompilingEnabled(): boolean;
|
||||
preferredLanguage(): string;
|
||||
proposedLanguage(): string;
|
||||
|
||||
@@ -118,7 +118,7 @@ testApp.config((
|
||||
});
|
||||
|
||||
testApp.controller('TestCtrl', (
|
||||
$scope: ng.IScope,
|
||||
$scope: ng.ui.bootstrap.IModalScope,
|
||||
$log: ng.ILogService,
|
||||
$modal: ng.ui.bootstrap.IModalService,
|
||||
$modalStack: ng.ui.bootstrap.IModalStackService,
|
||||
@@ -147,9 +147,9 @@ testApp.controller('TestCtrl', (
|
||||
$log.log('modal opened');
|
||||
});
|
||||
|
||||
modalInstance.result.then(closeResult=> {
|
||||
modalInstance.result.then((closeResult:any)=> {
|
||||
$log.log('modal closed', closeResult);
|
||||
}, dismissResult=> {
|
||||
}, (dismissResult:any)=> {
|
||||
$log.log('modal dismissed', dismissResult);
|
||||
});
|
||||
|
||||
|
||||
+29
-3
@@ -1,4 +1,4 @@
|
||||
// Type definitions for Angular UI Bootstrap 0.10.0
|
||||
// Type definitions for Angular UI Bootstrap 0.11.0
|
||||
// Project: https://github.com/angular-ui/bootstrap
|
||||
// Definitions by: Brian Surowiec <https://github.com/xt0rted>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
@@ -198,6 +198,22 @@ declare module ng.ui.bootstrap {
|
||||
opened: ng.IPromise<any>;
|
||||
}
|
||||
|
||||
interface IModalScope extends ng.IScope {
|
||||
/**
|
||||
* Those methods make it easy to close a modal window without a need to create a dedicated controller
|
||||
*/
|
||||
|
||||
/**
|
||||
* Dismiss the dialog without assigning a value to the promise output
|
||||
*/
|
||||
$dismiss(reason?: any): void;
|
||||
|
||||
/**
|
||||
* Close the dialog resolving the promise to the given value
|
||||
*/
|
||||
$close(result?: any): void;
|
||||
}
|
||||
|
||||
interface IModalSettings {
|
||||
/**
|
||||
* a path to a template representing modal's content
|
||||
@@ -211,9 +227,9 @@ declare module ng.ui.bootstrap {
|
||||
|
||||
/**
|
||||
* a scope instance to be used for the modal's content (actually the $modal service is going to create a child scope of a provided scope).
|
||||
* Defaults to `$rootScope`
|
||||
* Defaults to `$rootScope`.
|
||||
*/
|
||||
scope?: any;
|
||||
scope?: IModalScope;
|
||||
|
||||
/**
|
||||
* a controller for a modal instance - it can initialize scope used by modal.
|
||||
@@ -246,6 +262,16 @@ declare module ng.ui.bootstrap {
|
||||
* additional CSS class(es) to be added to a modal window template
|
||||
*/
|
||||
windowClass?: string;
|
||||
|
||||
/**
|
||||
* optional size of modal window. Allowed values: 'sm' (small) or 'lg' (large). Requires Bootstrap 3.1.0 or later
|
||||
*/
|
||||
size?: string;
|
||||
|
||||
/**
|
||||
* a path to a template overriding modal's window template
|
||||
*/
|
||||
windowTemplateUrl?: string;
|
||||
}
|
||||
|
||||
interface IModalStackService {
|
||||
|
||||
Vendored
+2
-1
@@ -11,8 +11,9 @@ declare module ng.ui {
|
||||
name?: string;
|
||||
template?: any;
|
||||
templateUrl?: any;
|
||||
templateProvider?: () => string;
|
||||
templateProvider?: any;
|
||||
controller?: any;
|
||||
controllerAs?: string;
|
||||
controllerProvider?: any;
|
||||
resolve?: {};
|
||||
url?: string;
|
||||
|
||||
+340
-217
@@ -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<number>;
|
||||
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,375 @@ 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'
|
||||
};
|
||||
});
|
||||
|
||||
interface copyExampleUser {
|
||||
name?: string;
|
||||
email?: string;
|
||||
gender?: string;
|
||||
}
|
||||
|
||||
interface copyExampleScope {
|
||||
|
||||
user: copyExampleUser;
|
||||
master: copyExampleUser;
|
||||
update: (copyExampleUser: copyExampleUser) => any;
|
||||
reset: () => any;
|
||||
}
|
||||
|
||||
angular.module('copyExample', [])
|
||||
.controller('ExampleController', ['$scope', function ($scope: copyExampleScope) {
|
||||
$scope.master = { };
|
||||
|
||||
$scope.update = function (user) {
|
||||
// Example with 1 argument
|
||||
$scope.master = angular.copy(user);
|
||||
};
|
||||
|
||||
$scope.reset = function () {
|
||||
// Example with 2 arguments
|
||||
angular.copy($scope.master, $scope.user);
|
||||
};
|
||||
|
||||
$scope.reset();
|
||||
}]);
|
||||
|
||||
module locationTests {
|
||||
|
||||
var $location: ng.ILocationService;
|
||||
|
||||
/*
|
||||
* From https://docs.angularjs.org/api/ng/service/$location
|
||||
*/
|
||||
|
||||
// given url http://example.com/#/some/path?foo=bar&baz=xoxo
|
||||
var searchObject = $location.search();
|
||||
// => {foo: 'bar', baz: 'xoxo'}
|
||||
|
||||
|
||||
// set foo to 'yipee'
|
||||
$location.search('foo', 'yipee');
|
||||
// => $location
|
||||
|
||||
// set foo to 5
|
||||
$location.search('foo', 5);
|
||||
// => $location
|
||||
|
||||
/*
|
||||
* From: https://docs.angularjs.org/guide/$location
|
||||
*/
|
||||
|
||||
// in browser with HTML5 history support:
|
||||
// open http://example.com/#!/a -> rewrite to http://example.com/a
|
||||
// (replacing the http://example.com/#!/a history record)
|
||||
$location.path() == '/a'
|
||||
|
||||
$location.path('/foo');
|
||||
$location.absUrl() == 'http://example.com/foo'
|
||||
|
||||
$location.search() == {}
|
||||
$location.search({ a: 'b', c: true });
|
||||
$location.absUrl() == 'http://example.com/foo?a=b&c'
|
||||
|
||||
$location.path('/new').search('x=y');
|
||||
$location.url() == 'new?x=y'
|
||||
$location.absUrl() == 'http://example.com/new?x=y'
|
||||
|
||||
// in browser without html5 history support:
|
||||
// open http://example.com/new?x=y -> redirect to http://example.com/#!/new?x=y
|
||||
// (again replacing the http://example.com/new?x=y history item)
|
||||
$location.path() == '/new'
|
||||
$location.search() == { x: 'y' }
|
||||
|
||||
$location.path('/foo/bar');
|
||||
$location.path() == '/foo/bar'
|
||||
$location.url() == '/foo/bar?x=y'
|
||||
$location.absUrl() == 'http://example.com/#!/foo/bar?x=y'
|
||||
}
|
||||
Vendored
+340
-67
@@ -1,4 +1,4 @@
|
||||
// Type definitions for Angular JS 1.2+
|
||||
// Type definitions for Angular JS 1.3+
|
||||
// Project: http://angularjs.org
|
||||
// Definitions by: Diego Vilar <http://github.com/diegovilar>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
@@ -20,7 +20,7 @@ declare module ng {
|
||||
|
||||
// not directly implemented, but ensures that constructed class implements $get
|
||||
interface IServiceProviderClass {
|
||||
new(...args: any[]): IServiceProvider;
|
||||
new (...args: any[]): IServiceProvider;
|
||||
}
|
||||
|
||||
interface IServiceProviderFactory {
|
||||
@@ -38,11 +38,134 @@ declare module ng {
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
interface IAngularStatic {
|
||||
bind(context: any, fn: Function, ...args: any[]): Function;
|
||||
bootstrap(element: string, modules?: any[]): auto.IInjectorService;
|
||||
bootstrap(element: JQuery, modules?: any[]): auto.IInjectorService;
|
||||
bootstrap(element: Element, modules?: any[]): auto.IInjectorService;
|
||||
bootstrap(element: Document, modules?: any[]): auto.IInjectorService;
|
||||
copy(source: any, destination?: any): any;
|
||||
|
||||
/**
|
||||
* Use this function to manually start up angular application.
|
||||
*
|
||||
* @param element DOM element which is the root of angular application.
|
||||
* @param modules An array of modules to load into the application.
|
||||
* Each item in the array should be the name of a predefined module or a (DI annotated)
|
||||
* function that will be invoked by the injector as a run block.
|
||||
*/
|
||||
bootstrap(element: string, modules?: string): auto.IInjectorService;
|
||||
/**
|
||||
* Use this function to manually start up angular application.
|
||||
*
|
||||
* @param element DOM element which is the root of angular application.
|
||||
* @param modules An array of modules to load into the application.
|
||||
* Each item in the array should be the name of a predefined module or a (DI annotated)
|
||||
* function that will be invoked by the injector as a run block.
|
||||
*/
|
||||
bootstrap(element: string, modules?: Function): auto.IInjectorService;
|
||||
/**
|
||||
* Use this function to manually start up angular application.
|
||||
*
|
||||
* @param element DOM element which is the root of angular application.
|
||||
* @param modules An array of modules to load into the application.
|
||||
* Each item in the array should be the name of a predefined module or a (DI annotated)
|
||||
* function that will be invoked by the injector as a run block.
|
||||
*/
|
||||
bootstrap(element: string, modules?: string[]): auto.IInjectorService;
|
||||
/**
|
||||
* Use this function to manually start up angular application.
|
||||
*
|
||||
* @param element DOM element which is the root of angular application.
|
||||
* @param modules An array of modules to load into the application.
|
||||
* Each item in the array should be the name of a predefined module or a (DI annotated)
|
||||
* function that will be invoked by the injector as a run block.
|
||||
*/
|
||||
bootstrap(element: JQuery, modules?: string): auto.IInjectorService;
|
||||
/**
|
||||
* Use this function to manually start up angular application.
|
||||
*
|
||||
* @param element DOM element which is the root of angular application.
|
||||
* @param modules An array of modules to load into the application.
|
||||
* Each item in the array should be the name of a predefined module or a (DI annotated)
|
||||
* function that will be invoked by the injector as a run block.
|
||||
*/
|
||||
bootstrap(element: JQuery, modules?: Function): auto.IInjectorService;
|
||||
/**
|
||||
* Use this function to manually start up angular application.
|
||||
*
|
||||
* @param element DOM element which is the root of angular application.
|
||||
* @param modules An array of modules to load into the application.
|
||||
* Each item in the array should be the name of a predefined module or a (DI annotated)
|
||||
* function that will be invoked by the injector as a run block.
|
||||
*/
|
||||
bootstrap(element: JQuery, modules?: string[]): auto.IInjectorService;
|
||||
/**
|
||||
* Use this function to manually start up angular application.
|
||||
*
|
||||
* @param element DOM element which is the root of angular application.
|
||||
* @param modules An array of modules to load into the application.
|
||||
* Each item in the array should be the name of a predefined module or a (DI annotated)
|
||||
* function that will be invoked by the injector as a run block.
|
||||
*/
|
||||
bootstrap(element: Element, modules?: string): auto.IInjectorService;
|
||||
/**
|
||||
* Use this function to manually start up angular application.
|
||||
*
|
||||
* @param element DOM element which is the root of angular application.
|
||||
* @param modules An array of modules to load into the application.
|
||||
* Each item in the array should be the name of a predefined module or a (DI annotated)
|
||||
* function that will be invoked by the injector as a run block.
|
||||
*/
|
||||
bootstrap(element: Element, modules?: Function): auto.IInjectorService;
|
||||
/**
|
||||
* Use this function to manually start up angular application.
|
||||
*
|
||||
* @param element DOM element which is the root of angular application.
|
||||
* @param modules An array of modules to load into the application.
|
||||
* Each item in the array should be the name of a predefined module or a (DI annotated)
|
||||
* function that will be invoked by the injector as a run block.
|
||||
*/
|
||||
bootstrap(element: Element, modules?: string[]): auto.IInjectorService;
|
||||
/**
|
||||
* Use this function to manually start up angular application.
|
||||
*
|
||||
* @param element DOM element which is the root of angular application.
|
||||
* @param modules An array of modules to load into the application.
|
||||
* Each item in the array should be the name of a predefined module or a (DI annotated)
|
||||
* function that will be invoked by the injector as a run block.
|
||||
*/
|
||||
bootstrap(element: Document, modules?: string): auto.IInjectorService;
|
||||
/**
|
||||
* Use this function to manually start up angular application.
|
||||
*
|
||||
* @param element DOM element which is the root of angular application.
|
||||
* @param modules An array of modules to load into the application.
|
||||
* Each item in the array should be the name of a predefined module or a (DI annotated)
|
||||
* function that will be invoked by the injector as a run block.
|
||||
*/
|
||||
bootstrap(element: Document, modules?: Function): auto.IInjectorService;
|
||||
/**
|
||||
* Use this function to manually start up angular application.
|
||||
*
|
||||
* @param element DOM element which is the root of angular application.
|
||||
* @param modules An array of modules to load into the application.
|
||||
* Each item in the array should be the name of a predefined module or a (DI annotated)
|
||||
* function that will be invoked by the injector as a run block.
|
||||
*/
|
||||
bootstrap(element: Document, modules?: string[]): auto.IInjectorService;
|
||||
|
||||
/**
|
||||
* Creates a deep copy of source, which should be an object or an array.
|
||||
*
|
||||
* - If no destination is supplied, a copy of the object or array is created.
|
||||
* - If a destination is provided, all of its elements (for array) or properties (for objects) are deleted and then all elements/properties from the source are copied to it.
|
||||
* - If source is not an object or array (inc. null and undefined), source is returned.
|
||||
* - If source is identical to 'destination' an exception will be thrown.
|
||||
*
|
||||
* @param source The source that will be used to make a copy. Can be any type, including primitives, null, and undefined.
|
||||
* @param destination Destination into which the source is copied. If provided, must be of the same type as source.
|
||||
*/
|
||||
copy<T>(source: T, destination?: T): T;
|
||||
|
||||
/**
|
||||
* Wraps a raw DOM element or HTML string as a jQuery element.
|
||||
*
|
||||
* If jQuery is available, angular.element is an alias for the jQuery function. If jQuery is not available, angular.element delegates to Angular's built-in subset of jQuery, called "jQuery lite" or "jqLite."
|
||||
*/
|
||||
element: IAugmentedJQueryStatic;
|
||||
equals(value1: any, value2: any): boolean;
|
||||
extend(destination: any, ...sources: any[]): any;
|
||||
@@ -164,8 +287,20 @@ declare module ng {
|
||||
* @param controllerConstructor Controller constructor fn (optionally decorated with DI annotations in the array notation).
|
||||
*/
|
||||
controller(name: string, inlineAnnotatedConstructor: any[]): IModule;
|
||||
controller(object : Object): IModule;
|
||||
controller(object: Object): IModule;
|
||||
/**
|
||||
* Register a new directive with the compiler.
|
||||
*
|
||||
* @param name Name of the directive in camel-case (i.e. ngBind which will match as ng-bind)
|
||||
* @param directiveFactory An injectable directive factory function.
|
||||
*/
|
||||
directive(name: string, directiveFactory: IDirectiveFactory): IModule;
|
||||
/**
|
||||
* Register a new directive with the compiler.
|
||||
*
|
||||
* @param name Name of the directive in camel-case (i.e. ngBind which will match as ng-bind)
|
||||
* @param directiveFactory An injectable directive factory function.
|
||||
*/
|
||||
directive(name: string, inlineAnnotatedFunction: any[]): IModule;
|
||||
directive(object: Object): IModule;
|
||||
/**
|
||||
@@ -245,7 +380,7 @@ declare module ng {
|
||||
// The observer function will be invoked once during the next $digest
|
||||
// following compilation. The observer is then invoked whenever the
|
||||
// interpolated value changes.
|
||||
$observe(name: string, fn:(value?:any)=>any): Function;
|
||||
$observe(name: string, fn: (value?: any) => any): Function;
|
||||
|
||||
// A map of DOM element attribute names to the normalized name. This is needed
|
||||
// to do reverse lookup from normalized name back to actual name.
|
||||
@@ -267,12 +402,16 @@ declare module ng {
|
||||
$dirty: boolean;
|
||||
$valid: boolean;
|
||||
$invalid: boolean;
|
||||
$submitted: boolean;
|
||||
$error: any;
|
||||
$addControl(control: ng.INgModelController): void;
|
||||
$removeControl(control: ng.INgModelController): void;
|
||||
$setValidity(validationErrorKey: string, isValid: boolean, control: ng.INgModelController): void;
|
||||
$setDirty(): void;
|
||||
$setPristine(): void;
|
||||
$commitViewValue(): void;
|
||||
$rollbackViewValue(): void;
|
||||
$setSubmitted(): void;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
@@ -285,6 +424,13 @@ declare module ng {
|
||||
// Documentation states viewValue and modelValue to be a string but other
|
||||
// types do work and it's common to use them.
|
||||
$setViewValue(value: any): void;
|
||||
$validate(): void;
|
||||
$setTouched(): void;
|
||||
$setUntouched(): void;
|
||||
$rollbackViewValue(): void;
|
||||
$commitViewValue(revalidate?: boolean): void;
|
||||
$isEmpty(value: any): boolean;
|
||||
|
||||
$viewValue: any;
|
||||
|
||||
$modelValue: any;
|
||||
@@ -293,12 +439,24 @@ declare module ng {
|
||||
$formatters: IModelFormatter[];
|
||||
$viewChangeListeners: IModelViewChangeListener[];
|
||||
$error: any;
|
||||
$name: string;
|
||||
|
||||
$touched: boolean;
|
||||
$untouched: boolean;
|
||||
|
||||
$validators: IModelValidators;
|
||||
$asyncValidators: IModelValidators;
|
||||
|
||||
$pristine: boolean;
|
||||
$dirty: boolean;
|
||||
$valid: boolean;
|
||||
$invalid: boolean;
|
||||
}
|
||||
|
||||
interface IModelValidators {
|
||||
[index: string]: (...args: any[]) => boolean;
|
||||
}
|
||||
|
||||
interface IModelParser {
|
||||
(value: any): any;
|
||||
}
|
||||
@@ -311,11 +469,11 @@ declare module ng {
|
||||
(): void;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Scope
|
||||
// see http://docs.angularjs.org/api/ng.$rootScope.Scope
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
interface IScope {
|
||||
/**
|
||||
* $rootScope - $rootScopeProvider - service in module ng
|
||||
* see https://docs.angularjs.org/api/ng/type/$rootScope.Scope and https://docs.angularjs.org/api/ng/service/$rootScope
|
||||
*/
|
||||
interface IRootScopeService {
|
||||
$apply(): any;
|
||||
$apply(exp: string): any;
|
||||
$apply(exp: (scope: IScope) => any): any;
|
||||
@@ -325,17 +483,23 @@ declare module ng {
|
||||
$digest(): void;
|
||||
$emit(name: string, ...args: any[]): IAngularEvent;
|
||||
|
||||
// Documentation says exp is optional, but actual implementaton counts on it
|
||||
$eval(expression: string, args?: Object): any;
|
||||
$eval(expression: (scope: IScope) => any, args?: Object): any;
|
||||
$eval(expression?: string, args?: Object): any;
|
||||
$eval(expression?: (scope: IScope) => any, args?: Object): any;
|
||||
|
||||
// Documentation says exp is optional, but actual implementaton counts on it
|
||||
$evalAsync(expression: string): void;
|
||||
$evalAsync(expression: (scope: IScope) => any): void;
|
||||
$evalAsync(expression?: string): void;
|
||||
$evalAsync(expression?: (scope: IScope) => any): void;
|
||||
|
||||
// Defaults to false by the implementation checking strategy
|
||||
$new(isolate?: boolean): IScope;
|
||||
|
||||
/**
|
||||
* Listens on events of a given type. See $emit for discussion of event life cycle.
|
||||
*
|
||||
* The event listener function format is: function(event, args...).
|
||||
*
|
||||
* @param name Event name to listen on.
|
||||
* @param listener Function to call when the event is emitted.
|
||||
*/
|
||||
$on(name: string, listener: (event: IAngularEvent, ...args: any[]) => any): Function;
|
||||
|
||||
$watch(watchExpression: string, listener?: string, objectEquality?: boolean): Function;
|
||||
@@ -347,28 +511,49 @@ declare module ng {
|
||||
$watchCollection(watchExpression: (scope: IScope) => any, listener: (newValue: any, oldValue: any, scope: IScope) => any): Function;
|
||||
|
||||
$watchGroup(watchExpressions: any[], listener: (newValue: any, oldValue: any, scope: IScope) => any): Function;
|
||||
$watchGroup(watchExpressions: {(scope: IScope) : any}[], listener: (newValue: any, oldValue: any, scope: IScope) => any): Function;
|
||||
$watchGroup(watchExpressions: { (scope: IScope): any }[], listener: (newValue: any, oldValue: any, scope: IScope) => any): Function;
|
||||
|
||||
$parent: IScope;
|
||||
|
||||
$root: IRootScopeService;
|
||||
this: IRootScopeService;
|
||||
|
||||
$id: string;
|
||||
$id: number;
|
||||
|
||||
// Hidden members
|
||||
$$isolateBindings: any;
|
||||
$$phase: any;
|
||||
}
|
||||
|
||||
interface IAngularEvent {
|
||||
targetScope: IScope;
|
||||
currentScope: IScope;
|
||||
name: string;
|
||||
preventDefault: Function;
|
||||
defaultPrevented: boolean;
|
||||
interface IScope extends IRootScopeService {
|
||||
[index: string]: any;
|
||||
}
|
||||
|
||||
// Available only events that were $emit-ted
|
||||
interface IAngularEvent {
|
||||
/**
|
||||
* the scope on which the event was $emit-ed or $broadcast-ed.
|
||||
*/
|
||||
targetScope: IScope;
|
||||
/**
|
||||
* the scope that is currently handling the event. Once the event propagates through the scope hierarchy, this property is set to null.
|
||||
*/
|
||||
currentScope: IScope;
|
||||
/**
|
||||
* name of the event.
|
||||
*/
|
||||
name: string;
|
||||
/**
|
||||
* calling stopPropagation function will cancel further event propagation (available only for events that were $emit-ed).
|
||||
*/
|
||||
stopPropagation?: Function;
|
||||
/**
|
||||
* calling preventDefault sets defaultPrevented flag to true.
|
||||
*/
|
||||
preventDefault: Function;
|
||||
/**
|
||||
* true if preventDefault was called.
|
||||
*/
|
||||
defaultPrevented: boolean;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
@@ -517,25 +702,79 @@ declare module ng {
|
||||
assign(context: any, value: any): any;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// LocationService
|
||||
// see http://docs.angularjs.org/api/ng.$location
|
||||
// see http://docs.angularjs.org/api/ng.$locationProvider
|
||||
// see http://docs.angularjs.org/guide/dev_guide.services.$location
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
/**
|
||||
* $location - $locationProvider - service in module ng
|
||||
* see https://docs.angularjs.org/api/ng/service/$location
|
||||
*/
|
||||
interface ILocationService {
|
||||
absUrl(): string;
|
||||
hash(): string;
|
||||
hash(newHash: string): ILocationService;
|
||||
host(): string;
|
||||
|
||||
/**
|
||||
* Return path of current url
|
||||
*/
|
||||
path(): string;
|
||||
path(newPath: string): ILocationService;
|
||||
|
||||
/**
|
||||
* Change path when called with parameter and return $location.
|
||||
* Note: Path should always begin with forward slash (/), this method will add the forward slash if it is missing.
|
||||
*
|
||||
* @param path New path
|
||||
*/
|
||||
path(path: string): ILocationService;
|
||||
|
||||
port(): number;
|
||||
protocol(): string;
|
||||
replace(): ILocationService;
|
||||
|
||||
/**
|
||||
* Return search part (as object) of current url
|
||||
*/
|
||||
search(): any;
|
||||
search(parametersMap: any): ILocationService;
|
||||
search(parameter: string, parameterValue: any): ILocationService;
|
||||
|
||||
/**
|
||||
* Change search part when called with parameter and return $location.
|
||||
*
|
||||
* @param search When called with a single argument the method acts as a setter, setting the search component of $location to the specified value.
|
||||
*
|
||||
* If the argument is a hash object containing an array of values, these values will be encoded as duplicate search parameters in the url.
|
||||
*/
|
||||
search(search: any): ILocationService;
|
||||
|
||||
/**
|
||||
* Change search part when called with parameter and return $location.
|
||||
*
|
||||
* @param search New search params
|
||||
* @param paramValue If search is a string or a Number, then paramValue will override only a single search property. If paramValue is null, the property specified via the first argument will be deleted.
|
||||
*/
|
||||
search(search: string, paramValue: string): ILocationService;
|
||||
|
||||
/**
|
||||
* Change search part when called with parameter and return $location.
|
||||
*
|
||||
* @param search New search params
|
||||
* @param paramValue If search is a string or a Number, then paramValue will override only a single search property. If paramValue is null, the property specified via the first argument will be deleted.
|
||||
*/
|
||||
search(search: string, paramValue: number): ILocationService;
|
||||
|
||||
/**
|
||||
* Change search part when called with parameter and return $location.
|
||||
*
|
||||
* @param search New search params
|
||||
* @param paramValue If paramValue is an array, it will override the property of the search component of $location specified via the first argument.
|
||||
*/
|
||||
search(search: string, paramValue: string[]): ILocationService;
|
||||
|
||||
/**
|
||||
* Change search part when called with parameter and return $location.
|
||||
*
|
||||
* @param search New search params
|
||||
* @param paramValue If paramValue is true, the property specified via the first argument will be added with no value nor trailing equal sign.
|
||||
*/
|
||||
search(search: string, paramValue: boolean): ILocationService;
|
||||
|
||||
url(): string;
|
||||
url(url: string): ILocationService;
|
||||
}
|
||||
@@ -626,22 +865,50 @@ declare module ng {
|
||||
}
|
||||
|
||||
interface IPromise<T> {
|
||||
/**
|
||||
* Regardless of when the promise was or will be resolved or rejected, then calls one of the success or error callbacks asynchronously as soon as the result is available. The callbacks are called with a single argument: the result or rejection reason. Additionally, the notify callback may be called zero or more times to provide a progress indication, before the promise is resolved or rejected.
|
||||
*
|
||||
* This method returns a new promise which is resolved or rejected via the return value of the successCallback, errorCallback. It also notifies via the return value of the notifyCallback method. The promise can not be resolved or rejected from the notifyCallback method.
|
||||
*/
|
||||
then<TResult>(successCallback: (promiseValue: T) => IHttpPromise<TResult>, errorCallback?: (reason: any) => any, notifyCallback?: (state: any) => any): IPromise<TResult>;
|
||||
/**
|
||||
* Regardless of when the promise was or will be resolved or rejected, then calls one of the success or error callbacks asynchronously as soon as the result is available. The callbacks are called with a single argument: the result or rejection reason. Additionally, the notify callback may be called zero or more times to provide a progress indication, before the promise is resolved or rejected.
|
||||
*
|
||||
* This method returns a new promise which is resolved or rejected via the return value of the successCallback, errorCallback. It also notifies via the return value of the notifyCallback method. The promise can not be resolved or rejected from the notifyCallback method.
|
||||
*/
|
||||
then<TResult>(successCallback: (promiseValue: T) => IPromise<TResult>, errorCallback?: (reason: any) => any, notifyCallback?: (state: any) => any): IPromise<TResult>;
|
||||
/**
|
||||
* Regardless of when the promise was or will be resolved or rejected, then calls one of the success or error callbacks asynchronously as soon as the result is available. The callbacks are called with a single argument: the result or rejection reason. Additionally, the notify callback may be called zero or more times to provide a progress indication, before the promise is resolved or rejected.
|
||||
*
|
||||
* This method returns a new promise which is resolved or rejected via the return value of the successCallback, errorCallback. It also notifies via the return value of the notifyCallback method. The promise can not be resolved or rejected from the notifyCallback method.
|
||||
*/
|
||||
then<TResult>(successCallback: (promiseValue: T) => TResult, errorCallback?: (reason: any) => TResult, notifyCallback?: (state: any) => any): IPromise<TResult>;
|
||||
|
||||
|
||||
/**
|
||||
* Shorthand for promise.then(null, errorCallback)
|
||||
*/
|
||||
catch<TResult>(onRejected: (reason: any) => IHttpPromise<TResult>): IPromise<TResult>;
|
||||
/**
|
||||
* Shorthand for promise.then(null, errorCallback)
|
||||
*/
|
||||
catch<TResult>(onRejected: (reason: any) => IPromise<TResult>): IPromise<TResult>;
|
||||
/**
|
||||
* Shorthand for promise.then(null, errorCallback)
|
||||
*/
|
||||
catch<TResult>(onRejected: (reason: any) => TResult): IPromise<TResult>;
|
||||
|
||||
finally<TResult>(finallyCallback: ()=>any):IPromise<TResult>;
|
||||
/**
|
||||
* Allows you to observe either the fulfillment or rejection of a promise, but to do so without modifying the final value. This is useful to release resources or do some clean-up that needs to be done whether the promise was rejected or resolved. See the full specification for more information.
|
||||
*
|
||||
* Because finally is a reserved word in JavaScript and reserved keywords are not supported as property names by ES3, you'll need to invoke the method like promise['finally'](callback) to make your code IE8 and Android 2.x compatible.
|
||||
*/
|
||||
finally<TResult>(finallyCallback: () => any): IPromise<TResult>;
|
||||
}
|
||||
|
||||
interface IDeferred<T> {
|
||||
resolve(value?: T): void;
|
||||
reject(reason?: any): void;
|
||||
notify(state?:any): void;
|
||||
notify(state?: any): void;
|
||||
promise: IPromise<T>;
|
||||
}
|
||||
|
||||
@@ -670,7 +937,7 @@ declare module ng {
|
||||
|
||||
// Methods bellow are not documented
|
||||
info(): any;
|
||||
get (cacheId: string): ICacheObject;
|
||||
get(cacheId: string): ICacheObject;
|
||||
}
|
||||
|
||||
interface ICacheObject {
|
||||
@@ -682,7 +949,7 @@ declare module ng {
|
||||
//capacity: number;
|
||||
};
|
||||
put(key: string, value?: any): void;
|
||||
get (key: string): any;
|
||||
get(key: string): any;
|
||||
remove(key: string): void;
|
||||
removeAll(): void;
|
||||
destroy(): void;
|
||||
@@ -962,12 +1229,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 +1292,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;
|
||||
@@ -1059,12 +1332,12 @@ declare module ng {
|
||||
transclude?: any;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// angular.element
|
||||
// when calling angular.element, angular returns a jQuery object,
|
||||
// augmented with additional methods like e.g. scope.
|
||||
// see: http://docs.angularjs.org/api/angular.element
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
/**
|
||||
* angular.element
|
||||
* when calling angular.element, angular returns a jQuery object,
|
||||
* augmented with additional methods like e.g. scope.
|
||||
* see: http://docs.angularjs.org/api/angular.element
|
||||
*/
|
||||
interface IAugmentedJQueryStatic extends JQueryStatic {
|
||||
(selector: string, context?: any): IAugmentedJQuery;
|
||||
(element: Element): IAugmentedJQuery;
|
||||
|
||||
@@ -1 +1 @@
|
||||
""
|
||||
|
||||
|
||||
@@ -0,0 +1,571 @@
|
||||
/// <reference path="angular-1.2.d.ts" />
|
||||
|
||||
// issue: https://github.com/borisyankov/DefinitelyTyped/issues/369
|
||||
// https://github.com/witoldsz/angular-http-auth/blob/master/src/angular-http-auth.js
|
||||
/**
|
||||
* @license HTTP Auth Interceptor Module for AngularJS
|
||||
* (c) 2012 Witold Szczerba
|
||||
* License: MIT
|
||||
*/
|
||||
|
||||
class AuthService {
|
||||
/**
|
||||
* Holds all the requests which failed due to 401 response,
|
||||
* so they can be re-requested in future, once login is completed.
|
||||
*/
|
||||
buffer: { config: ng.IRequestConfig; deferred: ng.IDeferred<any>; }[] = [];
|
||||
|
||||
/**
|
||||
* Required by HTTP interceptor.
|
||||
* Function is attached to provider to be invisible for regular users of this service.
|
||||
*/
|
||||
pushToBuffer = function(config: ng.IRequestConfig, deferred: ng.IDeferred<any>) {
|
||||
this.buffer.push({
|
||||
config: config,
|
||||
deferred: deferred
|
||||
});
|
||||
}
|
||||
|
||||
$get = [
|
||||
'$rootScope', '$injector', <any>function($rootScope: ng.IScope, $injector: ng.auto.IInjectorService) {
|
||||
var $http: ng.IHttpService; //initialized later because of circular dependency problem
|
||||
function retry(config: ng.IRequestConfig, deferred: ng.IDeferred<any>) {
|
||||
$http = $http || $injector.get('$http');
|
||||
$http(config).then(function (response) {
|
||||
deferred.resolve(response);
|
||||
});
|
||||
}
|
||||
function retryAll() {
|
||||
for (var i = 0; i < this.buffer.length; ++i) {
|
||||
retry(this.buffer[i].config, this.buffer[i].deferred);
|
||||
}
|
||||
this.buffer = [];
|
||||
}
|
||||
|
||||
return {
|
||||
loginConfirmed: function () {
|
||||
$rootScope.$broadcast('event:auth-loginConfirmed');
|
||||
retryAll();
|
||||
}
|
||||
}
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
angular.module('http-auth-interceptor', [])
|
||||
|
||||
.provider('authService', AuthService)
|
||||
|
||||
/**
|
||||
* $http interceptor.
|
||||
* On 401 response - it stores the request and broadcasts 'event:angular-auth-loginRequired'.
|
||||
*/
|
||||
.config(['$httpProvider', 'authServiceProvider', <any>function ($httpProvider: ng.IHttpProvider, authServiceProvider: any) {
|
||||
|
||||
var interceptor = ['$rootScope', '$q', <any>function ($rootScope: ng.IScope, $q: ng.IQService) {
|
||||
function success(response: ng.IHttpPromiseCallbackArg<any>) {
|
||||
return response;
|
||||
}
|
||||
|
||||
function error(response: ng.IHttpPromiseCallbackArg<any>) {
|
||||
if (response.status === 401) {
|
||||
var deferred = $q.defer<void>();
|
||||
authServiceProvider.pushToBuffer(response.config, deferred);
|
||||
$rootScope.$broadcast('event:auth-loginRequired');
|
||||
return deferred.promise;
|
||||
}
|
||||
// otherwise
|
||||
return $q.reject(response);
|
||||
}
|
||||
|
||||
return function (promise: ng.IHttpPromise<any>) {
|
||||
return promise.then(success, error);
|
||||
}
|
||||
|
||||
}];
|
||||
$httpProvider.responseInterceptors.push(interceptor);
|
||||
}]);
|
||||
|
||||
|
||||
module HttpAndRegularPromiseTests {
|
||||
interface Person {
|
||||
firstName: string;
|
||||
lastName: string;
|
||||
}
|
||||
|
||||
interface ExpectedResponse extends Person { }
|
||||
|
||||
interface SomeControllerScope extends ng.IScope {
|
||||
person: Person;
|
||||
theAnswer: number;
|
||||
letters: string[];
|
||||
snack: string;
|
||||
nothing?: string;
|
||||
}
|
||||
|
||||
var someController: Function = ($scope: SomeControllerScope, $http: ng.IHttpService, $q: ng.IQService) => {
|
||||
$http.get<ExpectedResponse>("http://somewhere/some/resource")
|
||||
.success((data: ExpectedResponse) => {
|
||||
$scope.person = data;
|
||||
});
|
||||
|
||||
$http.get<ExpectedResponse>("http://somewhere/some/resource")
|
||||
.then((response: ng.IHttpPromiseCallbackArg<ExpectedResponse>) => {
|
||||
// typing lost, so something like
|
||||
// var i: number = response.data
|
||||
// would type check
|
||||
$scope.person = response.data;
|
||||
});
|
||||
|
||||
$http.get<ExpectedResponse>("http://somewhere/some/resource")
|
||||
.then((response: ng.IHttpPromiseCallbackArg<ExpectedResponse>) => {
|
||||
// typing lost, so something like
|
||||
// var i: number = response.data
|
||||
// would NOT type check
|
||||
$scope.person = response.data;
|
||||
});
|
||||
|
||||
var aPromise: ng.IPromise<Person> = $q.when({ firstName: "Jack", lastName: "Sparrow" });
|
||||
aPromise.then((person: Person) => {
|
||||
$scope.person = person;
|
||||
});
|
||||
|
||||
var bPromise: ng.IPromise<number> = $q.when(42);
|
||||
bPromise.then((answer: number) => {
|
||||
$scope.theAnswer = answer;
|
||||
});
|
||||
|
||||
var cPromise: ng.IPromise<string[]> = $q.when(["a", "b", "c"]);
|
||||
cPromise.then((letters: string[]) => {
|
||||
$scope.letters = letters;
|
||||
});
|
||||
|
||||
// When $q.when is passed an IPromise<T>, it returns an IPromise<T>
|
||||
var dPromise: ng.IPromise<string> = $q.when($q.when("ALBATROSS!"));
|
||||
dPromise.then((snack: string) => {
|
||||
$scope.snack = snack;
|
||||
});
|
||||
|
||||
// $q.when may be called without arguments
|
||||
var ePromise: ng.IPromise<void> = $q.when();
|
||||
ePromise.then(() => {
|
||||
$scope.nothing = "really nothing";
|
||||
});
|
||||
}
|
||||
|
||||
// Test that we can pass around a type-checked success/error Promise Callback
|
||||
var anotherController: Function = ($scope: SomeControllerScope, $http:
|
||||
ng.IHttpService, $q: ng.IQService) => {
|
||||
|
||||
var buildFooData: Function = () => 42;
|
||||
|
||||
var doFoo: Function = (callback: ng.IHttpPromiseCallback<ExpectedResponse>) => {
|
||||
$http.get<ExpectedResponse>('/foo', buildFooData())
|
||||
.success(callback);
|
||||
}
|
||||
|
||||
doFoo((data: any) => console.log(data));
|
||||
}
|
||||
}
|
||||
|
||||
// Test for AngularJS Syntax
|
||||
|
||||
module My.Namespace {
|
||||
export var x: any; // need to export something for module to kick in
|
||||
}
|
||||
|
||||
// IModule Registering Test
|
||||
var mod = angular.module('tests', []);
|
||||
mod.controller('name', function ($scope: ng.IScope) { })
|
||||
mod.controller('name', ['$scope', <any>function ($scope: ng.IScope) { }])
|
||||
mod.controller(My.Namespace);
|
||||
mod.directive('name', <any>function ($scope: ng.IScope) { })
|
||||
mod.directive('name', ['$scope', <any>function ($scope: ng.IScope) { }])
|
||||
mod.directive(My.Namespace);
|
||||
mod.factory('name', function ($scope: ng.IScope) { })
|
||||
mod.factory('name', ['$scope', <any>function ($scope: ng.IScope) { }])
|
||||
mod.factory(My.Namespace);
|
||||
mod.filter('name', function ($scope: ng.IScope) { })
|
||||
mod.filter('name', ['$scope', <any>function ($scope: ng.IScope) { }])
|
||||
mod.filter(My.Namespace);
|
||||
mod.provider('name', function ($scope: ng.IScope) { return { $get: () => { } } })
|
||||
mod.provider('name', TestProvider);
|
||||
mod.provider('name', ['$scope', <any>function ($scope: ng.IScope) { }])
|
||||
mod.provider(My.Namespace);
|
||||
mod.service('name', function ($scope: ng.IScope) { })
|
||||
mod.service('name', ['$scope', <any>function ($scope: ng.IScope) { }])
|
||||
mod.service(My.Namespace);
|
||||
mod.constant('name', 23);
|
||||
mod.constant('name', "23");
|
||||
mod.constant(My.Namespace);
|
||||
mod.value('name', 23);
|
||||
mod.value('name', "23");
|
||||
mod.value(My.Namespace);
|
||||
|
||||
class TestProvider implements ng.IServiceProvider {
|
||||
constructor(private $scope: ng.IScope) {
|
||||
}
|
||||
|
||||
$get() {
|
||||
}
|
||||
}
|
||||
|
||||
// Promise signature tests
|
||||
var foo: ng.IPromise<number>;
|
||||
foo.then((x) => {
|
||||
// x is inferred to be a number
|
||||
return "asdf";
|
||||
}).then((x) => {
|
||||
// x is inferred to be string
|
||||
x.length;
|
||||
return 123;
|
||||
}).then((x) => {
|
||||
// x is infered to be a number
|
||||
x.toFixed();
|
||||
return;
|
||||
}).then((x) => {
|
||||
// x is infered to be void
|
||||
// Typescript will prevent you to actually use x as a local variable
|
||||
// Try object:
|
||||
return { a: 123 };
|
||||
}).then((x) => {
|
||||
// Object is inferred here
|
||||
x.a = 123;
|
||||
//Try a promise
|
||||
var y: ng.IPromise<number>;
|
||||
return y;
|
||||
}).then((x) => {
|
||||
// x is infered to be a number, which is the resolved value of a promise
|
||||
x.toFixed();
|
||||
});
|
||||
|
||||
|
||||
var httpFoo: ng.IHttpPromise<number>;
|
||||
httpFoo.then((x) => {
|
||||
// When returning a promise the generic type must be inferred.
|
||||
var innerPromise : ng.IPromise<number>;
|
||||
return innerPromise;
|
||||
}).then((x) => {
|
||||
// must still be number.
|
||||
x.toFixed();
|
||||
});
|
||||
|
||||
|
||||
function test_angular_forEach() {
|
||||
var values: { [key: string]: string } = { name: 'misko', gender: 'male' };
|
||||
var log: string[] = [];
|
||||
angular.forEach(values, function (value, key) {
|
||||
this.push(key + ': ' + value);
|
||||
}, log);
|
||||
//expect(log).toEqual(['name: misko', 'gender: male']);
|
||||
}
|
||||
|
||||
// angular.element() tests
|
||||
var element = angular.element("div.myApp");
|
||||
var scope: ng.IScope = element.scope();
|
||||
var isolateScope: ng.IScope = element.isolateScope();
|
||||
|
||||
|
||||
|
||||
function test_IAttributes(attributes: ng.IAttributes){
|
||||
return attributes;
|
||||
}
|
||||
|
||||
test_IAttributes({
|
||||
$addClass: function (classVal){},
|
||||
$removeClass: function(classVal){},
|
||||
$set: function(key, value){},
|
||||
$observe: function(name, fn){
|
||||
return fn;
|
||||
},
|
||||
$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}}'
|
||||
};
|
||||
});
|
||||
|
||||
angular.module('docsTemplateUrlDirective', [])
|
||||
.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'
|
||||
};
|
||||
});
|
||||
|
||||
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'
|
||||
};
|
||||
});
|
||||
|
||||
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'
|
||||
};
|
||||
});
|
||||
|
||||
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'
|
||||
};
|
||||
});
|
||||
|
||||
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) {
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
scope.$watch(attrs['myCurrentTime'], function (value: any) {
|
||||
format = value;
|
||||
updateTime();
|
||||
});
|
||||
|
||||
element.on('$destroy', function () {
|
||||
$interval.cancel(timeoutId);
|
||||
});
|
||||
|
||||
// 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'
|
||||
};
|
||||
});
|
||||
|
||||
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: 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'
|
||||
};
|
||||
});
|
||||
|
||||
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;
|
||||
|
||||
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);
|
||||
});
|
||||
|
||||
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);
|
||||
}
|
||||
};
|
||||
}]);
|
||||
|
||||
angular.module('docsTabsExample', [])
|
||||
.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;
|
||||
};
|
||||
|
||||
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'
|
||||
};
|
||||
});
|
||||
Vendored
+1182
File diff suppressed because it is too large
Load Diff
@@ -1 +1 @@
|
||||
""
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
"--noImplicitAny --module commonjs"
|
||||
--noImplicitAny --module commonjs
|
||||
|
||||
@@ -26,10 +26,11 @@ async.map(data, asyncProcess, function (err, results) {
|
||||
|
||||
var openFiles = ['file1', 'file2'];
|
||||
var saveFile = function () { }
|
||||
async.forEach(openFiles, saveFile, function (err) { });
|
||||
async.each(openFiles, saveFile, function (err) { });
|
||||
async.eachSeries(openFiles, saveFile, function (err) { });
|
||||
|
||||
var documents, requestApi;
|
||||
async.forEachLimit(documents, 20, requestApi, function (err) { });
|
||||
async.eachLimit(documents, 20, requestApi, function (err) { });
|
||||
|
||||
async.map(['file1', 'file2', 'file3'], fs.stat, function (err, results) { });
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
""
|
||||
|
||||
|
||||
Vendored
+3
-3
@@ -34,9 +34,9 @@ interface AsyncQueue<T> {
|
||||
interface Async {
|
||||
|
||||
// Collections
|
||||
forEach<T,R>(arr: T[], iterator: AsyncIterator<T, R>, callback: AsyncMultipleResultsCallback<R>): void;
|
||||
forEachSeries<T, R>(arr: T[], iterator: AsyncIterator<T, R>, callback: AsyncMultipleResultsCallback<R>): void;
|
||||
forEachLimit<T, R>(arr: T[], limit: number, iterator: AsyncIterator<T, R>, callback: AsyncMultipleResultsCallback<R>): void;
|
||||
each<T,R>(arr: T[], iterator: AsyncIterator<T, R>, callback: AsyncMultipleResultsCallback<R>): void;
|
||||
eachSeries<T, R>(arr: T[], iterator: AsyncIterator<T, R>, callback: AsyncMultipleResultsCallback<R>): void;
|
||||
eachLimit<T, R>(arr: T[], limit: number, iterator: AsyncIterator<T, R>, callback: AsyncMultipleResultsCallback<R>): void;
|
||||
map<T, R>(arr: T[], iterator: AsyncIterator<T, R>, callback: AsyncMultipleResultsCallback<R>): any;
|
||||
mapSeries<T, R>(arr: T[], iterator: AsyncIterator<T, R>, callback: AsyncMultipleResultsCallback<R>): any;
|
||||
filter<T>(arr: T[], iterator: AsyncIterator<T, boolean>, callback: AsyncMultipleResultsCallback<T>): any;
|
||||
|
||||
@@ -1 +1 @@
|
||||
--noImplicitAny --module commonjs --target es5
|
||||
--noImplicitAny --module commonjs --target es5
|
||||
|
||||
Vendored
+108
-8
@@ -497,6 +497,35 @@ declare module AtomCore {
|
||||
screenRangeChanged():any;
|
||||
}
|
||||
|
||||
interface IDecorationParams {
|
||||
id?: number;
|
||||
class: string;
|
||||
type: any /* string or string[] */;
|
||||
}
|
||||
|
||||
interface IDecorationStatic {
|
||||
isType(decorationParams:IDecorationParams, type:any /* string or string[] */):boolean;
|
||||
new (marker:IDisplayBufferMarker, displayBuffer:IDisplayBuffer, params: IDecorationParams): IDecoration;
|
||||
}
|
||||
|
||||
interface IDecoration extends Emissary.IEmitter {
|
||||
marker: IDisplayBufferMarker;
|
||||
displayBuffer: IDisplayBuffer;
|
||||
params: IDecorationParams
|
||||
id: number;
|
||||
flashQueue: any[];
|
||||
isDestroyed: boolean;
|
||||
|
||||
destroy():void;
|
||||
update(newParams:IDecorationParams):void;
|
||||
getMarker():IDisplayBufferMarker;
|
||||
getParams():IDecorationParams;
|
||||
isType(type:string):boolean;
|
||||
matchesPattern(decorationPattern:{[key:string]:IDecorationParams;}):boolean;
|
||||
flash(klass:string, duration?:number):void;
|
||||
consumeNextFlash():any;
|
||||
}
|
||||
|
||||
interface IEditor {
|
||||
// Serializable.includeInto(Editor);
|
||||
// Delegator.includeInto(Editor);
|
||||
@@ -509,6 +538,8 @@ declare module AtomCore {
|
||||
cursors:ICursor[];
|
||||
selections: ISelection[];
|
||||
suppressSelectionMerging:boolean;
|
||||
updateBatchDepth: number;
|
||||
selectionFlashDuration: number;
|
||||
softTabs: boolean;
|
||||
displayBuffer: IDisplayBuffer;
|
||||
|
||||
@@ -522,6 +553,8 @@ declare module AtomCore {
|
||||
subscriptionsByObject: any; /* WeakMap */
|
||||
subscriptions: Emissary.ISubscription[];
|
||||
|
||||
mini: any;
|
||||
|
||||
serializeParams():{id:number; softTabs:boolean; scrollTop:number; scrollLeft:number; displayBuffer:any;};
|
||||
deserializeParams(params:any):any;
|
||||
subscribeToBuffer():void;
|
||||
@@ -532,10 +565,7 @@ declare module AtomCore {
|
||||
getTitle():string;
|
||||
getLongTitle():string;
|
||||
setVisible(visible:boolean):void;
|
||||
setScrollTop(scrollTop:any):void;
|
||||
getScrollTop():number;
|
||||
setScrollLeft(scrollLeft:any):void;
|
||||
getScrollLeft():number;
|
||||
setMini(mini:any):void;
|
||||
setEditorWidthInChars(editorWidthInChars:any):void;
|
||||
getSoftWrapColumn():number;
|
||||
getSoftTabs():boolean;
|
||||
@@ -545,6 +575,7 @@ declare module AtomCore {
|
||||
getTabText():string;
|
||||
getTabLength():number;
|
||||
setTabLength(tabLength:any):void;
|
||||
usesSoftTabs():boolean;
|
||||
clipBufferPosition(bufferPosition:any):void;
|
||||
clipBufferRange(range:any):void;
|
||||
indentationForBufferRow(bufferRow:any):void;
|
||||
@@ -553,6 +584,7 @@ declare module AtomCore {
|
||||
buildIndentString(number:any):string;
|
||||
save():void;
|
||||
saveAs(filePath:any):void;
|
||||
copyPathToClipboard():void;
|
||||
getPath():string;
|
||||
getText():string;
|
||||
setText(text:any):void;
|
||||
@@ -572,6 +604,7 @@ declare module AtomCore {
|
||||
scanInBufferRange():any;
|
||||
backwardsScanInBufferRange():any;
|
||||
isModified():boolean;
|
||||
isEmpty():boolean;
|
||||
shouldPromptToSave():boolean;
|
||||
screenPositionForBufferPosition(bufferPosition:any, options?:any):TextBuffer.IPoint;
|
||||
bufferPositionForScreenPosition(screenPosition:any, options?:any):TextBuffer.IPoint;
|
||||
@@ -589,15 +622,19 @@ declare module AtomCore {
|
||||
bufferRangeForScopeAtCursor(selector:string):any;
|
||||
tokenForBufferPosition(bufferPosition:any):IToken;
|
||||
getCursorScopes():string[];
|
||||
logCursorScope():void;
|
||||
insertText(text:string, options?:any):TextBuffer.IRange[];
|
||||
insertNewline():TextBuffer.IRange[];
|
||||
insertNewlineBelow():TextBuffer.IRange[];
|
||||
insertNewlineAbove():any;
|
||||
indent(options?:any):any;
|
||||
backspace():any[];
|
||||
backspaceToBeginningOfWord():any[];
|
||||
backspaceToBeginningOfLine():any[];
|
||||
// deprecated backspaceToBeginningOfWord():any[];
|
||||
// deprecated backspaceToBeginningOfLine():any[];
|
||||
deleteToBeginningOfWord():any[];
|
||||
deleteToBeginningOfLine():any[];
|
||||
delete():any[];
|
||||
deleteToEndOfLine():any[];
|
||||
deleteToEndOfWord():any[];
|
||||
deleteLine():TextBuffer.IRange[];
|
||||
indentSelectedRows():TextBuffer.IRange[][];
|
||||
@@ -620,6 +657,7 @@ declare module AtomCore {
|
||||
foldBufferRow(bufferRow:any):any;
|
||||
unfoldBufferRow(bufferRow:any):any;
|
||||
isFoldableAtBufferRow(bufferRow:any):boolean;
|
||||
isFoldableAtScreenRow(screenRow:any):boolean;
|
||||
createFold(startRow:any, endRow:any):IFold;
|
||||
destroyFoldWithId(id:any):any;
|
||||
destroyFoldsIntersectingBufferRange(bufferRange:any):any;
|
||||
@@ -633,9 +671,12 @@ declare module AtomCore {
|
||||
moveLineUp():ISelection[];
|
||||
moveLineDown():ISelection[];
|
||||
duplicateLines():any[][];
|
||||
duplicateLine():any[][];
|
||||
// duprecated duplicateLine():any[][];
|
||||
mutateSelectedText(fn:(selection:ISelection)=>any):any;
|
||||
replaceSelectedText(options:any, fn:(selection:string)=>any):any;
|
||||
decorationsForScreenRowRange(startScreenRow:any, endScreenRow:any):{[id:number]: IDecoration[]};
|
||||
decorateMarker(marker:IDisplayBufferMarker, decorationParams: {type:string; class: string;}):IDecoration;
|
||||
decorationForId(id:number):IDecoration;
|
||||
getMarker(id:number):IDisplayBufferMarker;
|
||||
getMarkers():IDisplayBufferMarker[];
|
||||
findMarkers(...args:any[]):IDisplayBufferMarker[];
|
||||
@@ -659,6 +700,7 @@ declare module AtomCore {
|
||||
removeSelection(selection:ISelection):any;
|
||||
clearSelections():boolean;
|
||||
consolidateSelections():boolean;
|
||||
selectionScreenRangeChanged(selection:any):void;
|
||||
getSelections():ISelection[];
|
||||
getSelection(index?:number):ISelection;
|
||||
getLastSelection():ISelection;
|
||||
@@ -694,7 +736,16 @@ declare module AtomCore {
|
||||
moveCursorToBeginningOfNextWord():void;
|
||||
moveCursorToPreviousWordBoundary():void;
|
||||
moveCursorToNextWordBoundary():void;
|
||||
moveCursorToBeginningOfNextParagraph():void;
|
||||
moveCursorToBeginningOfPreviousParagraph():void;
|
||||
scrollToCursorPosition(options:any):any;
|
||||
pageUp():void;
|
||||
pageDown():void;
|
||||
selectPageUp():void;
|
||||
selectPageDown():void;
|
||||
getRowsPerPage():number;
|
||||
moveCursors(fn:(cursor:ICursor)=>any):any;
|
||||
cursorMoved(event:any):void;
|
||||
selectToScreenPosition(position:TextBuffer.IPoint):any;
|
||||
selectRight():ISelection[];
|
||||
selectLeft():ISelection[];
|
||||
@@ -720,6 +771,8 @@ declare module AtomCore {
|
||||
selectToEndOfWord():ISelection[];
|
||||
selectToBeginningOfNextWord():ISelection[];
|
||||
selectWord():ISelection[];
|
||||
selectToBeginningOfNextParagraph():ISelection[];
|
||||
selectToBeginningOfPreviousParagraph():ISelection[];
|
||||
selectMarker(marker:any):any;
|
||||
mergeCursors():number[];
|
||||
expandSelectionsForward():any;
|
||||
@@ -731,16 +784,63 @@ declare module AtomCore {
|
||||
setGrammar(grammer:IGrammar):void;
|
||||
reloadGrammar():any;
|
||||
shouldAutoIndent():boolean;
|
||||
shouldShowInvisibles():boolean;
|
||||
updateInvisibles():void;
|
||||
transact(fn:Function):any;
|
||||
beginTransaction():ITransaction;
|
||||
commitTransaction():any;
|
||||
abortTransaction():any[];
|
||||
inspect():string;
|
||||
logScreenLines(start:number, end:number):any[];
|
||||
handleTokenization():void;
|
||||
handleGrammarChange():void;
|
||||
handleMarkerCreated(marker:any):any;
|
||||
getSelectionMarkerAttributes():{type: string; editorId: number; invalidate: string; };
|
||||
// joinLine():any; // deprecated
|
||||
getVerticalScrollMargin():number;
|
||||
setVerticalScrollMargin(verticalScrollMargin:number):void;
|
||||
getHorizontalScrollMargin():number;
|
||||
setHorizontalScrollMargin(horizontalScrollMargin:number):void;
|
||||
getLineHeightInPixels():number;
|
||||
setLineHeightInPixels(lineHeightInPixels:number):void;
|
||||
batchCharacterMeasurement(fn:Function):void;
|
||||
getScopedCharWidth(scopeNames:any, char:any):any;
|
||||
setScopedCharWidth(scopeNames:any, char:any, width:any):any;
|
||||
getScopedCharWidths(scopeNames:any):any;
|
||||
clearScopedCharWidths():any;
|
||||
getDefaultCharWidth():number;
|
||||
setDefaultCharWidth(defaultCharWidth:number):void;
|
||||
setHeight(height:number):void;
|
||||
getHeight():number;
|
||||
getClientHeight():number;
|
||||
setWidth(width:number):void;
|
||||
getWidth():number;
|
||||
getScrollTop():number;
|
||||
setScrollTop(scrollTop:number):void;
|
||||
getScrollBottom():number;
|
||||
setScrollBottom(scrollBottom:number):void;
|
||||
getScrollLeft():number;
|
||||
setScrollLeft(scrollLeft:number):void;
|
||||
getScrollRight():number;
|
||||
setScrollRight(scrollRight:number):void;
|
||||
getScrollHeight():number;
|
||||
getScrollWidth():number;
|
||||
getVisibleRowRange():number;
|
||||
intersectsVisibleRowRange(startRow:any, endRow:any):any;
|
||||
selectionIntersectsVisibleRowRange(selection:any):any;
|
||||
pixelPositionForScreenPosition(screenPosition:any):any;
|
||||
pixelPositionForBufferPosition(bufferPosition:any):any;
|
||||
screenPositionForPixelPosition(pixelPosition:any):any;
|
||||
pixelRectForScreenRange(screenRange:any):any;
|
||||
scrollToScreenRange(screenRange:any, options:any):any;
|
||||
scrollToScreenPosition(screenPosition:any, options:any):any;
|
||||
scrollToBufferPosition(bufferPosition:any, options:any):any;
|
||||
horizontallyScrollable():any;
|
||||
verticallyScrollable():any;
|
||||
getHorizontalScrollbarHeight():any;
|
||||
setHorizontalScrollbarHeight(height:any):any;
|
||||
getVerticalScrollbarWidth():any;
|
||||
setVerticalScrollbarWidth(width:any):any;
|
||||
// deprecated joinLine():any;
|
||||
}
|
||||
|
||||
interface IGrammar {
|
||||
|
||||
@@ -1 +1 @@
|
||||
""
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
""
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
""
|
||||
|
||||
|
||||
Vendored
-11
@@ -215,12 +215,10 @@ declare module Backbone {
|
||||
any(iterator: (element: TModel, index: number) => boolean, context?: any): boolean;
|
||||
collect(iterator: (element: TModel, index: number, context?: any) => any[], context?: any): any[];
|
||||
chain(): any;
|
||||
compact(): TModel[];
|
||||
contains(value: any): boolean;
|
||||
countBy(iterator: (element: TModel, index: number) => any): _.Dictionary<number>;
|
||||
countBy(attribute: string): _.Dictionary<number>;
|
||||
detect(iterator: (item: any) => boolean, context?: any): any; // ???
|
||||
difference(...model: TModel[]): TModel[];
|
||||
drop(): TModel;
|
||||
drop(n: number): TModel[];
|
||||
each(iterator: (element: TModel, index: number, list?: any) => void, context?: any): any;
|
||||
@@ -229,7 +227,6 @@ declare module Backbone {
|
||||
find(iterator: (element: TModel, index: number) => boolean, context?: any): TModel;
|
||||
first(): TModel;
|
||||
first(n: number): TModel[];
|
||||
flatten(shallow?: boolean): TModel[];
|
||||
foldl(iterator: (memo: any, element: TModel, index: number) => any, initialMemo: any, context?: any): any;
|
||||
forEach(iterator: (element: TModel, index: number, list?: any) => void, context?: any): any;
|
||||
groupBy(iterator: (element: TModel, index: number) => string, context?: any): _.Dictionary<TModel[]>;
|
||||
@@ -239,7 +236,6 @@ declare module Backbone {
|
||||
initial(): TModel;
|
||||
initial(n: number): TModel[];
|
||||
inject(iterator: (memo: any, element: TModel, index: number) => any, initialMemo: any, context?: any): any;
|
||||
intersection(...model: TModel[]): TModel[];
|
||||
isEmpty(object: any): boolean;
|
||||
invoke(methodName: string, arguments?: any[]): any;
|
||||
last(): TModel;
|
||||
@@ -248,7 +244,6 @@ declare module Backbone {
|
||||
map(iterator: (element: TModel, index: number, context?: any) => any[], context?: any): any[];
|
||||
max(iterator?: (element: TModel, index: number) => any, context?: any): TModel;
|
||||
min(iterator?: (element: TModel, index: number) => any, context?: any): TModel;
|
||||
object(...values: any[]): any[];
|
||||
reduce(iterator: (memo: any, element: TModel, index: number) => any, initialMemo: any, context?: any): any;
|
||||
select(iterator: any, context?: any): any[];
|
||||
size(): number;
|
||||
@@ -257,8 +252,6 @@ declare module Backbone {
|
||||
sortBy(iterator: (element: TModel, index: number) => number, context?: any): TModel[];
|
||||
sortBy(attribute: string, context?: any): TModel[];
|
||||
sortedIndex(element: TModel, iterator?: (element: TModel, index: number) => number): number;
|
||||
range(stop: number, step?: number): any;
|
||||
range(start: number, stop: number, step?: number): any;
|
||||
reduceRight(iterator: (memo: any, element: TModel, index: number) => any, initialMemo: any, context?: any): any[];
|
||||
reject(iterator: (element: TModel, index: number) => boolean, context?: any): TModel[];
|
||||
rest(): TModel;
|
||||
@@ -266,10 +259,7 @@ declare module Backbone {
|
||||
tail(): TModel;
|
||||
tail(n: number): TModel[];
|
||||
toArray(): any[];
|
||||
union(...model: TModel[]): TModel[];
|
||||
uniq(isSorted?: boolean, iterator?: (element: TModel, index: number) => boolean): TModel[];
|
||||
without(...values: any[]): TModel[];
|
||||
zip(...model: TModel[]): TModel[];
|
||||
}
|
||||
|
||||
class Router extends Events {
|
||||
@@ -349,7 +339,6 @@ declare module Backbone {
|
||||
model: TModel;
|
||||
collection: Collection<TModel>;
|
||||
//template: (json, options?) => string;
|
||||
make(tagName: string, attrs?: any, opts?: any): View<TModel>;
|
||||
setElement(element: HTMLElement, delegate?: boolean): View<TModel>;
|
||||
setElement(element: JQuery, delegate?: boolean): View<TModel>;
|
||||
id: string;
|
||||
|
||||
@@ -1 +1 @@
|
||||
--target ES5
|
||||
--target ES5
|
||||
|
||||
@@ -1 +1 @@
|
||||
""
|
||||
|
||||
|
||||
Vendored
+245
-119
@@ -13,233 +13,359 @@ declare module BigInt {
|
||||
|
||||
export function setRandom(random: IRandom): void;
|
||||
|
||||
// bigInt add(x,y)
|
||||
// return (x+y) for bigInts x and y.
|
||||
/**
|
||||
* bigInt add(x,y)
|
||||
* return (x+y) for bigInts x and y.
|
||||
*/
|
||||
export function add(x: BigInt, y: BigInt): BigInt;
|
||||
|
||||
// bigInt addInt(x,n)
|
||||
// return (x+n) where x is a bigInt and n is an integer.
|
||||
/**
|
||||
* bigInt addInt(x,n)
|
||||
* return (x+n) where x is a bigInt and n is an integer.
|
||||
*/
|
||||
export function addInt(x: BigInt, n: number): BigInt;
|
||||
|
||||
// string bigInt2str(x,base)
|
||||
// return a string form of bigInt x in a given base, with 2 <= base <= 95
|
||||
export function bigInt2str(x: BigInt, base: number): string;
|
||||
export function bigInt2str(x: BigInt, base: string): string;
|
||||
interface bigInt2str_T<T> {
|
||||
/**
|
||||
* string bigInt2str(x,base)
|
||||
* return a string form of bigInt x in a given base, with 2 <= base <= 95
|
||||
*/
|
||||
(x: BigInt, base: T): string;
|
||||
}
|
||||
|
||||
// int bitSize(x)
|
||||
// return how many bits long the bigInt x is, not counting leading zeros
|
||||
interface bigInt2strSignature extends bigInt2str_T<string>, bigInt2str_T<number>{
|
||||
}
|
||||
|
||||
export var bigInt2str: bigInt2strSignature;
|
||||
|
||||
/**
|
||||
* int bitSize(x)
|
||||
* return how many bits long the bigInt x is, not counting leading zeros
|
||||
*/
|
||||
export function bitSize(x: BigInt): number;
|
||||
|
||||
// bigInt dup(x)
|
||||
// return a copy of bigInt x
|
||||
/**
|
||||
* bigInt dup(x)
|
||||
* return a copy of bigInt x
|
||||
*/
|
||||
export function dup(x: BigInt): BigInt;
|
||||
|
||||
// boolean equals(x,y)
|
||||
// is the bigInt x equal to the bigint y?
|
||||
/**
|
||||
* boolean equals(x,y)
|
||||
* is the bigInt x equal to the bigint y?
|
||||
*/
|
||||
export function equals(x: BigInt, y: BigInt): boolean;
|
||||
|
||||
// boolean equalsInt(x,y)
|
||||
// is bigint x equal to integer y?
|
||||
/**
|
||||
* boolean equalsInt(x,y)
|
||||
* is bigint x equal to integer y?
|
||||
*/
|
||||
export function equalsInt(x: BigInt, y: number): boolean;
|
||||
|
||||
// bigInt expand(x,n)
|
||||
// return a copy of x with at least n elements, adding leading zeros if needed
|
||||
/**
|
||||
* bigInt expand(x,n)
|
||||
* return a copy of x with at least n elements, adding leading zeros if needed
|
||||
*/
|
||||
export function expand(value: BigInt, n: number): BigInt;
|
||||
|
||||
// Array findPrimes(n)
|
||||
// return array of all primes less than integer n
|
||||
/**
|
||||
* Array findPrimes(n)
|
||||
* return array of all primes less than integer n
|
||||
*/
|
||||
export function findPrimes(n: number): number[];
|
||||
|
||||
// bigInt GCD(x,y)
|
||||
// return greatest common divisor of bigInts x and y (each with same number of elements).
|
||||
/**
|
||||
* bigInt GCD(x,y)
|
||||
* return greatest common divisor of bigInts x and y (each with same number of elements).
|
||||
*/
|
||||
export function GCD(x: BigInt, y: BigInt): BigInt;
|
||||
|
||||
// boolean greater(x,y)
|
||||
// is x>y? (x and y are nonnegative bigInts)
|
||||
/**
|
||||
* boolean greater(x,y)
|
||||
* is x>y? (x and y are nonnegative bigInts)
|
||||
*/
|
||||
export function greater(x: BigInt, y: BigInt): boolean;
|
||||
|
||||
// boolean greaterShift(x,y,shift)
|
||||
// is (x <<(shift*bpe)) > y?
|
||||
/**
|
||||
* boolean greaterShift(x,y,shift)
|
||||
* is (x <<(shift*bpe)) > y?
|
||||
*/
|
||||
export function greaterShift(x: BigInt, y: BigInt, shift: number): boolean;
|
||||
|
||||
// bigInt int2bigInt(t,n,m)
|
||||
// return a bigInt equal to integer t, with at least n bits and m array elements
|
||||
/**
|
||||
* bigInt int2bigInt(t,n,m)
|
||||
* return a bigInt equal to integer t, with at least n bits and m array elements
|
||||
*/
|
||||
export function int2bigInt(t: number, n?: number, m?: number): BigInt;
|
||||
|
||||
// bigInt inverseMod(x,n)
|
||||
// return (x**(-1) mod n) for bigInts x and n. If no inverse exists, it returns null
|
||||
/**
|
||||
* bigInt inverseMod(x,n)
|
||||
* return (x**(-1) mod n) for bigInts x and n. If no inverse exists, it returns null
|
||||
*/
|
||||
export function inverseMod(x: BigInt, n: BigInt): BigInt;
|
||||
|
||||
// int inverseModInt(x,n)
|
||||
// return x**(-1) mod n, for integers x and n. Return 0 if there is no inverse
|
||||
/**
|
||||
* int inverseModInt(x,n)
|
||||
* return x**(-1) mod n, for integers x and n. Return 0 if there is no inverse
|
||||
*/
|
||||
export function inverseModInt(x: number, n: number): BigInt;
|
||||
|
||||
// boolean isZero(x)
|
||||
// is the bigInt x equal to zero?
|
||||
/**
|
||||
* boolean isZero(x)
|
||||
* is the bigInt x equal to zero?
|
||||
*/
|
||||
export function isZero(x: BigInt): boolean;
|
||||
|
||||
// boolean millerRabin(x,b)
|
||||
// does one round of Miller-Rabin base integer b say that bigInt x is possibly prime? (b is bigInt, 1<b<x)
|
||||
/**
|
||||
* boolean millerRabin(x,b)
|
||||
* does one round of Miller-Rabin base integer b say that bigInt x is possibly prime? (b is bigInt, 1<b<x)
|
||||
*/
|
||||
export function millerRabin(x: BigInt, b: BigInt): boolean;
|
||||
|
||||
// boolean millerRabinInt(x,b)
|
||||
// does one round of Miller-Rabin base integer b say that bigInt x is possibly prime? (b is int, 1<b<x)
|
||||
/**
|
||||
* boolean millerRabinInt(x,b)
|
||||
* does one round of Miller-Rabin base integer b say that bigInt x is possibly prime? (b is int, 1<b<x)
|
||||
*/
|
||||
export function millerRabinInt(x: number, b: number): boolean;
|
||||
|
||||
// bigInt mod(x,n)
|
||||
// return a new bigInt equal to (x mod n) for bigInts x and n.
|
||||
/**
|
||||
* bigInt mod(x,n)
|
||||
* return a new bigInt equal to (x mod n) for bigInts x and n.
|
||||
*/
|
||||
export function mod(x: BigInt, n: BigInt): BigInt;
|
||||
|
||||
// int modInt(x,n)
|
||||
// return x mod n for bigInt x and integer n.
|
||||
/**
|
||||
* int modInt(x,n)
|
||||
* return x mod n for bigInt x and integer n.
|
||||
*/
|
||||
export function modInt(x: BigInt, n: number): number;
|
||||
|
||||
// bigInt mult(x,y)
|
||||
// return x*y for bigInts x and y. This is faster when y<x.
|
||||
/**
|
||||
* bigInt mult(x,y)
|
||||
* return x*y for bigInts x and y. This is faster when y<x.
|
||||
*/
|
||||
export function mult(x: BigInt, y: BigInt): BigInt;
|
||||
|
||||
// bigInt multMod(x,y,n)
|
||||
// return (x*y mod n) for bigInts x,y,n. For greater speed, let y<x.
|
||||
/**
|
||||
* bigInt multMod(x,y,n)
|
||||
* return (x*y mod n) for bigInts x,y,n. For greater speed, let y<x.
|
||||
*/
|
||||
export function multMod(x: BigInt, y: BigInt, n: BigInt): BigInt;
|
||||
|
||||
// boolean negative(x)
|
||||
// is bigInt x negative?
|
||||
/**
|
||||
* boolean negative(x)
|
||||
* is bigInt x negative?
|
||||
*/
|
||||
export function negative(x: BigInt): boolean;
|
||||
|
||||
// bigInt powMod(x,y,n)
|
||||
// return (x**y mod n) where x,y,n are bigInts and ** is exponentiation. 0**0=1. Faster for odd n.
|
||||
/**
|
||||
* bigInt powMod(x,y,n)
|
||||
* return (x**y mod n) where x,y,n are bigInts and ** is exponentiation. 0**0=1. Faster for odd n.
|
||||
*/
|
||||
export function powMod(x: BigInt, y: BigInt, n: BigInt): BigInt;
|
||||
|
||||
// bigInt randBigInt(n,s)
|
||||
// return an n-bit random BigInt (n>=1). If s=1, then the most significant of those n bits is set to 1.
|
||||
/**
|
||||
* bigInt randBigInt(n,s)
|
||||
* return an n-bit random BigInt (n>=1). If s=1, then the most significant of those n bits is set to 1.
|
||||
*/
|
||||
export function randBigInt(n: number, s: number): BigInt;
|
||||
|
||||
// bigInt randTruePrime(k)
|
||||
// return a new, random, k-bit, true prime bigInt using Maurer's algorithm.
|
||||
/**
|
||||
* bigInt randTruePrime(k)
|
||||
* return a new, random, k-bit, true prime bigInt using Maurer's algorithm.
|
||||
*/
|
||||
export function randTruePrime(k: number): BigInt;
|
||||
|
||||
// bigInt randProbPrime(k)
|
||||
// return a new, random, k-bit, probable prime bigInt (probability it's composite less than 2^-80).
|
||||
/**
|
||||
* bigInt randProbPrime(k)
|
||||
* return a new, random, k-bit, probable prime bigInt (probability it's composite less than 2^-80).
|
||||
*/
|
||||
export function randProbPrime(k: number): BigInt;
|
||||
|
||||
// bigInt str2bigInt(s,b,n,m)
|
||||
// return a bigInt for number represented in string s in base b with at least n bits and m array elements
|
||||
export function str2bigInt(s: string, b: number, n?: number, m?: number): BigInt;
|
||||
export function str2bigInt(s: string, b: string, n?: number, m?: number): BigInt;
|
||||
interface str2bigInt_T<T> {
|
||||
/**
|
||||
* bigInt str2bigInt(s,b,n,m)
|
||||
* return a bigInt for number represented in string s in base b with at least n bits and m array elements
|
||||
*/
|
||||
(s: string, b: T, n?: number, m?: number): BigInt;
|
||||
}
|
||||
|
||||
// bigInt sub(x,y)
|
||||
// return (x-y) for bigInts x and y. Negative answers will be 2s complement
|
||||
interface str2bigIntSignature extends str2bigInt_T<number>, str2bigInt_T<string> {
|
||||
}
|
||||
|
||||
export var str2bigInt: str2bigIntSignature;
|
||||
|
||||
/**
|
||||
* bigInt sub(x,y)
|
||||
* return (x-y) for bigInts x and y. Negative answers will be 2s complement
|
||||
*/
|
||||
export function sub(x: BigInt, y: BigInt): BigInt;
|
||||
|
||||
// bigInt trim(x,k)
|
||||
// return a copy of x with exactly k leading zero elements
|
||||
/**
|
||||
* bigInt trim(x,k)
|
||||
* return a copy of x with exactly k leading zero elements
|
||||
*/
|
||||
export function trim(x: BigInt, k: number): BigInt;
|
||||
|
||||
// void addInt_(x,n)
|
||||
// do x=x+n where x is a bigInt and n is an integer
|
||||
/**
|
||||
* void addInt_(x,n)
|
||||
* do x=x+n where x is a bigInt and n is an integer
|
||||
*/
|
||||
export function addInt_(x: BigInt, n: number): void;
|
||||
|
||||
// void add_(x,y)
|
||||
// do x=x+y for bigInts x and y
|
||||
/**
|
||||
* void add_(x,y)
|
||||
* do x=x+y for bigInts x and y
|
||||
*/
|
||||
export function add_(x: BigInt, y: BigInt): void;
|
||||
|
||||
// void copy_(x,y)
|
||||
// do x=y on bigInts x and y
|
||||
/**
|
||||
* void copy_(x,y)
|
||||
* do x=y on bigInts x and y
|
||||
*/
|
||||
export function copy_(x: BigInt, y: BigInt): void;
|
||||
|
||||
// void copyInt_(x,n)
|
||||
// do x=n on bigInt x and integer n
|
||||
/**
|
||||
* void copyInt_(x,n)
|
||||
* do x=n on bigInt x and integer n
|
||||
*/
|
||||
export function copyInt_(x: BigInt, n: number): number;
|
||||
|
||||
// void GCD_(x,y)
|
||||
// set x to the greatest common divisor of bigInts x and y, (y is destroyed). (This never overflows its array).
|
||||
/**
|
||||
* void GCD_(x,y)
|
||||
* set x to the greatest common divisor of bigInts x and y, (y is destroyed). (This never overflows its array).
|
||||
*/
|
||||
export function GCD_(x: BigInt, y: BigInt): void;
|
||||
|
||||
// boolean inverseMod_(x,n)
|
||||
// do x=x**(-1) mod n, for bigInts x and n. Returns 1 (0) if inverse does (doesn't) exist
|
||||
/**
|
||||
* boolean inverseMod_(x,n)
|
||||
* do x=x**(-1) mod n, for bigInts x and n. Returns 1 (0) if inverse does (doesn't) exist
|
||||
*/
|
||||
export function inverseMod_(x: BigInt, n: BigInt): boolean;
|
||||
|
||||
// void mod_(x,n)
|
||||
// do x=x mod n for bigInts x and n. (This never overflows its array).
|
||||
/**
|
||||
* void mod_(x,n)
|
||||
* do x=x mod n for bigInts x and n. (This never overflows its array).
|
||||
*/
|
||||
export function mod_(x: BigInt, n: BigInt): void;
|
||||
|
||||
// void mult_(x,y)
|
||||
// do x=x*y for bigInts x and y.
|
||||
/**
|
||||
* void mult_(x,y)
|
||||
* do x=x*y for bigInts x and y.
|
||||
*/
|
||||
export function mult_(x: BigInt, y: BigInt): void;
|
||||
|
||||
// void multMod_(x,y,n)
|
||||
// do x=x*y mod n for bigInts x,y,n.
|
||||
/**
|
||||
* void multMod_(x,y,n)
|
||||
* do x=x*y mod n for bigInts x,y,n.
|
||||
*/
|
||||
export function multMod_(x: BigInt, y: BigInt, n: BigInt): void;
|
||||
|
||||
// void powMod_(x,y,n)
|
||||
// do x=x**y mod n, where x,y,n are bigInts (n is odd) and ** is exponentiation. 0**0=1.
|
||||
/**
|
||||
* void powMod_(x,y,n)
|
||||
* do x=x**y mod n, where x,y,n are bigInts (n is odd) and ** is exponentiation. 0**0=1.
|
||||
*/
|
||||
export function powMod_(x: BigInt, y: BigInt, n: BigInt): void;
|
||||
|
||||
// void randBigInt_(b,n,s)
|
||||
// do b = an n-bit random BigInt. if s=1, then nth bit (most significant bit) is set to 1. n>=1.
|
||||
/**
|
||||
* void randBigInt_(b,n,s)
|
||||
* do b = an n-bit random BigInt. if s=1, then nth bit (most significant bit) is set to 1. n>=1.
|
||||
*/
|
||||
export function randBigInt_(b: BigInt, n: number, s: number): void;
|
||||
|
||||
// void randTruePrime_(ans,k)
|
||||
// do ans = a random k-bit true random prime (not just probable prime) with 1 in the msb.
|
||||
/**
|
||||
* void randTruePrime_(ans,k)
|
||||
* do ans = a random k-bit true random prime (not just probable prime) with 1 in the msb.
|
||||
*/
|
||||
export function randTruePrime_(ans: BigInt, k: number): void;
|
||||
|
||||
// void sub_(x,y)
|
||||
// do x=x-y for bigInts x and y. Negative answers will be 2s complement.
|
||||
/**
|
||||
* void sub_(x,y)
|
||||
* do x=x-y for bigInts x and y. Negative answers will be 2s complement.
|
||||
*/
|
||||
export function sub_(x: BigInt, y: BigInt): void;
|
||||
|
||||
// void addShift_(x,y,ys)
|
||||
// do x=x+(y<<(ys*bpe))
|
||||
/**
|
||||
* void addShift_(x,y,ys)
|
||||
* do x=x+(y<<(ys*bpe))
|
||||
*/
|
||||
export function addShift_(x: BigInt, y: BigInt, ys: number): void;
|
||||
|
||||
// void carry_(x)
|
||||
// do carries and borrows so each element of the bigInt x fits in bpe bits.
|
||||
/**
|
||||
* void carry_(x)
|
||||
* do carries and borrows so each element of the bigInt x fits in bpe bits.
|
||||
*/
|
||||
export function carry_(x: BigInt): void;
|
||||
|
||||
// void divide_(x,y,q,r)
|
||||
// divide x by y giving quotient q and remainder r
|
||||
/**
|
||||
* void divide_(x,y,q,r)
|
||||
* divide x by y giving quotient q and remainder r
|
||||
*/
|
||||
export function divide_(x: BigInt, y: BigInt, q: BigInt, r: BigInt): void;
|
||||
|
||||
// int divInt_(x,n)
|
||||
// do x=floor(x/n) for bigInt x and integer n, and return the remainder. (This never overflows its array).
|
||||
/**
|
||||
* int divInt_(x,n)
|
||||
* do x=floor(x/n) for bigInt x and integer n, and return the remainder. (This never overflows its array).
|
||||
*/
|
||||
export function divInt_(x: BigInt, n: number): number;
|
||||
|
||||
// void eGCD_(x,y,d,a,b)
|
||||
// sets a,b,d to positive bigInts such that d = GCD_(x,y) = a*x-b*y
|
||||
/**
|
||||
* void eGCD_(x,y,d,a,b)
|
||||
* sets a,b,d to positive bigInts such that d = GCD_(x,y) = a*x-b*y
|
||||
*/
|
||||
export function eGCD_(x: BigInt, y: BigInt, d: BigInt, a: BigInt, b: BigInt): void;
|
||||
|
||||
// void halve_(x)
|
||||
// do x=floor(|x|/2)*sgn(x) for bigInt x in 2's complement. (This never overflows its array).
|
||||
/**
|
||||
* void halve_(x)
|
||||
* do x=floor(|x|/2)*sgn(x) for bigInt x in 2's complement. (This never overflows its array).
|
||||
*/
|
||||
export function halve_(x: BigInt): void;
|
||||
|
||||
// void leftShift_(x,n)
|
||||
// left shift bigInt x by n bits. n<bpe.
|
||||
/**
|
||||
* void leftShift_(x,n)
|
||||
* left shift bigInt x by n bits. n<bpe.
|
||||
*/
|
||||
export function leftShift_(x: BigInt, n: number): void;
|
||||
|
||||
// void linComb_(x,y,a,b)
|
||||
// do x=a*x+b*y for bigInts x and y and integers a and b
|
||||
/**
|
||||
* void linComb_(x,y,a,b)
|
||||
* do x=a*x+b*y for bigInts x and y and integers a and b
|
||||
*/
|
||||
export function linComb_(x: BigInt, y: BigInt, a: number, b: number): void;
|
||||
|
||||
// void linCombShift_(x,y,b,ys)
|
||||
// do x=x+b*(y<<(ys*bpe)) for bigInts x and y, and integers b and ys
|
||||
|
||||
/**
|
||||
* void linCombShift_(x,y,b,ys)
|
||||
* do x=x+b*(y<<(ys*bpe)) for bigInts x and y, and integers b and ys
|
||||
*/
|
||||
export function linCombShift_(x: BigInt, y: BigInt, b: number, ys: number): void;
|
||||
|
||||
// void mont_(x,y,n,np)
|
||||
// Montgomery multiplication (see comments where the function is defined)
|
||||
/**
|
||||
* void mont_(x,y,n,np)
|
||||
* Montgomery multiplication (see comments where the function is defined)
|
||||
*/
|
||||
export function mont_(x: BigInt, y: BigInt, n: BigInt, np: number): void;
|
||||
|
||||
// void multInt_(x,n)
|
||||
// do x=x*n where x is a bigInt and n is an integer.
|
||||
/**
|
||||
* void multInt_(x,n)
|
||||
* do x=x*n where x is a bigInt and n is an integer.
|
||||
*/
|
||||
export function multInt_(x: BigInt, n: number): void;
|
||||
|
||||
// void rightShift_(x,n)
|
||||
// right shift bigInt x by n bits. 0 <= n < bpe. (This never overflows its array).
|
||||
/**
|
||||
* void rightShift_(x,n)
|
||||
* right shift bigInt x by n bits. 0 <= n < bpe. (This never overflows its array).
|
||||
*/
|
||||
export function rightShift_(x: BigInt, n: number): void;
|
||||
|
||||
// void squareMod_(x,n)
|
||||
// do x=x*x mod n for bigInts x,n
|
||||
/**
|
||||
* void squareMod_(x,n)
|
||||
* do x=x*x mod n for bigInts x,n
|
||||
*/
|
||||
export function squareMod_(x: BigInt, n: BigInt): void;
|
||||
|
||||
// void subShift_(x,y,ys)
|
||||
// do x=x-(y<<(ys*bpe)). Negative answers will be 2s complement.
|
||||
/**
|
||||
* void subShift_(x,y,ys)
|
||||
* do x=x-(y<<(ys*bpe)). Negative answers will be 2s complement.
|
||||
*/
|
||||
export function subShift_(x: BigInt, y: BigInt, ys: number): void;
|
||||
}
|
||||
|
||||
@@ -1 +1 @@
|
||||
""
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
""
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
""
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
""
|
||||
|
||||
|
||||
+112
@@ -0,0 +1,112 @@
|
||||
// Type definitions for business-rules-engine - v1.0.20
|
||||
// Project: https://github.com/rsamec/form
|
||||
// Definitions by: Roman Samec <https://github.com/rsamec>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../underscore/underscore.d.ts" />
|
||||
/// <reference path="../q/Q.d.ts" />
|
||||
/// <reference path="../moment/moment.d.ts" />
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
/// <reference path="business-rules-engine.d.ts" />
|
||||
declare module Validators {
|
||||
class LettersOnlyValidator implements Validation.IStringValidator {
|
||||
public isAcceptable(s: string): boolean;
|
||||
public tagName: string;
|
||||
}
|
||||
class ZipCodeValidator implements Validation.IStringValidator {
|
||||
public isAcceptable(s: string): boolean;
|
||||
public tagName: string;
|
||||
}
|
||||
class EmailValidator implements Validation.IStringValidator {
|
||||
public isAcceptable(s: string): boolean;
|
||||
public tagName: string;
|
||||
}
|
||||
class UrlValidator implements Validation.IStringValidator {
|
||||
public isAcceptable(s: string): boolean;
|
||||
public tagName: string;
|
||||
}
|
||||
class RequiredValidator implements Validation.IStringValidator {
|
||||
public isAcceptable(s: string): boolean;
|
||||
public tagName: string;
|
||||
}
|
||||
class DateValidator implements Validation.IStringValidator {
|
||||
public isAcceptable(s: string): boolean;
|
||||
public tagName: string;
|
||||
}
|
||||
class DateISOValidator implements Validation.IStringValidator {
|
||||
public isAcceptable(s: string): boolean;
|
||||
public tagName: string;
|
||||
}
|
||||
class NumberValidator implements Validation.IStringValidator {
|
||||
public isAcceptable(s: string): boolean;
|
||||
public tagName: string;
|
||||
}
|
||||
class DigitValidator implements Validation.IStringValidator {
|
||||
public isAcceptable(s: string): boolean;
|
||||
public tagName: string;
|
||||
}
|
||||
class SignedDigitValidator implements Validation.IStringValidator {
|
||||
public isAcceptable(s: string): boolean;
|
||||
public tagName: string;
|
||||
}
|
||||
class MinLengthValidator implements Validation.IStringValidator {
|
||||
public MinLength: number;
|
||||
constructor(MinLength?: number);
|
||||
public isAcceptable(s: string): boolean;
|
||||
public tagName: string;
|
||||
}
|
||||
class MaxLengthValidator implements Validation.IStringValidator {
|
||||
public MaxLength: number;
|
||||
constructor(MaxLength?: number);
|
||||
public isAcceptable(s: string): boolean;
|
||||
public tagName: string;
|
||||
}
|
||||
class RangeLengthValidator implements Validation.IStringValidator {
|
||||
public RangeLength: number[];
|
||||
constructor(RangeLength?: number[]);
|
||||
public isAcceptable(s: string): boolean;
|
||||
public MinLength : number;
|
||||
public MaxLength : number;
|
||||
public tagName: string;
|
||||
}
|
||||
class MinValidator implements Validation.IPropertyValidator {
|
||||
public Min: number;
|
||||
constructor(Min?: number);
|
||||
public isAcceptable(s: any): boolean;
|
||||
public tagName: string;
|
||||
}
|
||||
class MaxValidator implements Validation.IPropertyValidator {
|
||||
public Max: number;
|
||||
constructor(Max?: number);
|
||||
public isAcceptable(s: any): boolean;
|
||||
public tagName: string;
|
||||
}
|
||||
class RangeValidator implements Validation.IPropertyValidator {
|
||||
public Range: number[];
|
||||
constructor(Range?: number[]);
|
||||
public isAcceptable(s: any): boolean;
|
||||
public Min : number;
|
||||
public Max : number;
|
||||
public tagName: string;
|
||||
}
|
||||
class StepValidator implements Validation.IPropertyValidator {
|
||||
public Step: string;
|
||||
constructor(Step?: string);
|
||||
public isAcceptable(s: any): boolean;
|
||||
public tagName: string;
|
||||
}
|
||||
class PatternValidator implements Validation.IStringValidator {
|
||||
public Pattern: string;
|
||||
constructor(Pattern?: string);
|
||||
public isAcceptable(s: string): boolean;
|
||||
public tagName: string;
|
||||
}
|
||||
class ContainsValidator implements Validation.IAsyncPropertyValidator {
|
||||
public Options: Q.Promise<any[]>;
|
||||
constructor(Options: Q.Promise<any[]>);
|
||||
public isAcceptable(s: string): Q.Promise<boolean>;
|
||||
public isAsync: boolean;
|
||||
public tagName: string;
|
||||
}
|
||||
}
|
||||
declare module "node-validators" {export = Validators;}
|
||||
Vendored
+15
@@ -0,0 +1,15 @@
|
||||
// Type definitions for business-rules-engine - v1.0.20
|
||||
// Project: https://github.com/rsamec/form
|
||||
// Definitions by: Roman Samec <https://github.com/rsamec>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
declare module Utils {
|
||||
class StringFce {
|
||||
static format(s: string, args: any): string;
|
||||
}
|
||||
class NumberFce {
|
||||
static GetNegDigits(value: string): number;
|
||||
}
|
||||
}
|
||||
declare module "node-utils" {export = Utils;}
|
||||
+241
@@ -0,0 +1,241 @@
|
||||
// Type definitions for business-rules-engine - v1.0.20
|
||||
// Project: https://github.com/rsamec/form
|
||||
// Definitions by: Roman Samec <https://github.com/rsamec>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../q/Q.d.ts" />
|
||||
/// <reference path="../underscore/underscore.d.ts" />
|
||||
declare module Validation {
|
||||
interface IErrorCustomMessage {
|
||||
(config: any, args: any): string;
|
||||
}
|
||||
interface IPropertyValidator {
|
||||
isAcceptable(s: any): boolean;
|
||||
customMessage?: IErrorCustomMessage;
|
||||
tagName?: string;
|
||||
}
|
||||
interface IStringValidator extends IPropertyValidator {
|
||||
isAcceptable(s: string): boolean;
|
||||
}
|
||||
interface IAsyncPropertyValidator {
|
||||
isAcceptable(s: any): Q.Promise<boolean>;
|
||||
customMessage?: IErrorCustomMessage;
|
||||
isAsync: boolean;
|
||||
tagName?: string;
|
||||
}
|
||||
interface IAsyncStringPropertyValidator extends IAsyncPropertyValidator {
|
||||
isAcceptable(s: string): Q.Promise<boolean>;
|
||||
}
|
||||
enum CompareOperator {
|
||||
LessThan = 0,
|
||||
LessThanEqual = 1,
|
||||
Equal = 2,
|
||||
NotEqual = 3,
|
||||
GreaterThanEqual = 4,
|
||||
GreaterThan = 5,
|
||||
}
|
||||
interface IError {
|
||||
HasError: boolean;
|
||||
ErrorMessage: string;
|
||||
TranslateArgs?: IErrorTranslateArgs;
|
||||
}
|
||||
interface IErrorTranslateArgs {
|
||||
TranslateId: string;
|
||||
MessageArgs: any;
|
||||
CustomMessage?: IErrorCustomMessage;
|
||||
}
|
||||
interface IOptional {
|
||||
(): boolean;
|
||||
}
|
||||
interface IValidationFailure extends IError {
|
||||
IsAsync: boolean;
|
||||
Error: IError;
|
||||
}
|
||||
interface IValidationResult {
|
||||
Name: string;
|
||||
Add(validationResult: IValidationResult): void;
|
||||
Remove(index: number): void;
|
||||
Children: IValidationResult[];
|
||||
HasErrors: boolean;
|
||||
HasErrorsDirty: boolean;
|
||||
ErrorMessage: string;
|
||||
ErrorCount: number;
|
||||
Optional?: IOptional;
|
||||
TranslateArgs?: IErrorTranslateArgs[];
|
||||
}
|
||||
interface IValidate {
|
||||
(args: IError): void;
|
||||
}
|
||||
interface IAsyncValidate {
|
||||
(args: IError): Q.Promise<any>;
|
||||
}
|
||||
interface IValidatorFce {
|
||||
Name: string;
|
||||
ValidationFce?: IValidate;
|
||||
AsyncValidationFce?: IAsyncValidate;
|
||||
}
|
||||
interface IValidator {
|
||||
Validate(context: any): IValidationFailure;
|
||||
ValidateAsync(context: any): Q.Promise<IValidationFailure>;
|
||||
Error: IError;
|
||||
}
|
||||
interface IAbstractValidator<T> {
|
||||
RuleFor(prop: string, validator: IPropertyValidator): any;
|
||||
ValidationFor(prop: string, validatorFce: IValidatorFce): any;
|
||||
Validation(validatorFce: IValidatorFce): any;
|
||||
ValidatorFor<K>(prop: string, validator: IAbstractValidator<K>): any;
|
||||
CreateRule(name: string): IAbstractValidationRule<any>;
|
||||
CreateAbstractRule(name: string): IAbstractValidationRule<any>;
|
||||
CreateAbstractListRule(name: string): IAbstractValidationRule<any>;
|
||||
ForList: boolean;
|
||||
}
|
||||
interface IAbstractValidationRule<T> {
|
||||
Validate(context: T): IValidationResult;
|
||||
ValidateAsync(context: T): Q.Promise<IValidationResult>;
|
||||
ValidateAll(context: T): Q.Promise<IValidationResult>;
|
||||
ValidateProperty(context: T, propName: string): void;
|
||||
ValidationResult: IValidationResult;
|
||||
Rules: {
|
||||
[name: string]: IPropertyValidationRule<T>;
|
||||
};
|
||||
Validators: {
|
||||
[name: string]: IValidator;
|
||||
};
|
||||
Children: {
|
||||
[name: string]: IAbstractValidationRule<any>;
|
||||
};
|
||||
}
|
||||
interface IPropertyValidationRule<T> {
|
||||
Validators: {
|
||||
[name: string]: any;
|
||||
};
|
||||
Validate(context: IValidationContext<T>): IValidationFailure[];
|
||||
ValidateAsync(context: IValidationContext<T>): Q.Promise<IValidationFailure[]>;
|
||||
}
|
||||
interface IValidationContext<T> {
|
||||
Value: string;
|
||||
Key: string;
|
||||
Data: T;
|
||||
}
|
||||
class Error implements IError {
|
||||
public HasError: boolean;
|
||||
public ErrorMessage: string;
|
||||
constructor();
|
||||
}
|
||||
class ValidationFailure implements IError {
|
||||
public Error: IError;
|
||||
public IsAsync: boolean;
|
||||
constructor(Error: IError, IsAsync: boolean);
|
||||
public HasError : boolean;
|
||||
public ErrorMessage : string;
|
||||
public TranslateArgs : IErrorTranslateArgs;
|
||||
}
|
||||
class ValidationResult implements IValidationResult {
|
||||
public Name: string;
|
||||
constructor(Name: string);
|
||||
public IsDirty: boolean;
|
||||
public Children : IValidationResult[];
|
||||
public Add(error: IValidationResult): void;
|
||||
public Remove(index: number): void;
|
||||
public Optional: IOptional;
|
||||
public TranslateArgs: IErrorTranslateArgs[];
|
||||
public HasErrorsDirty : boolean;
|
||||
public HasErrors : boolean;
|
||||
public ErrorCount : number;
|
||||
public ErrorMessage : string;
|
||||
}
|
||||
class CompositeValidationResult implements IValidationResult {
|
||||
public Name: string;
|
||||
public Children: IValidationResult[];
|
||||
constructor(Name: string);
|
||||
public Optional: IOptional;
|
||||
public AddFirst(error: IValidationResult): void;
|
||||
public Add(error: IValidationResult): void;
|
||||
public Remove(index: number): void;
|
||||
public HasErrorsDirty : boolean;
|
||||
public HasErrors : boolean;
|
||||
public ErrorCount : number;
|
||||
public ErrorMessage : string;
|
||||
public TranslateArgs : IErrorTranslateArgs[];
|
||||
public LogErrors(headerMessage?: string): void;
|
||||
public Errors : {
|
||||
[name: string]: IValidationResult;
|
||||
};
|
||||
private FlattenErros;
|
||||
public SetDirty(): void;
|
||||
public SetPristine(): void;
|
||||
private SetDirtyEx(node, dirty);
|
||||
private flattenErrors(node, errorCollection);
|
||||
private traverse(node, indent);
|
||||
}
|
||||
class AbstractValidator<T> implements IAbstractValidator<T> {
|
||||
public Validators: {
|
||||
[name: string]: IPropertyValidator[];
|
||||
};
|
||||
public AbstractValidators: {
|
||||
[name: string]: IAbstractValidator<any>;
|
||||
};
|
||||
public ValidationFunctions: {
|
||||
[name: string]: IValidatorFce[];
|
||||
};
|
||||
public RuleFor(prop: string, validator: IPropertyValidator): void;
|
||||
public ValidationFor(prop: string, fce: IValidatorFce): void;
|
||||
public Validation(fce: IValidatorFce): void;
|
||||
public ValidatorFor<K>(prop: string, validator: IAbstractValidator<K>, forList?: boolean): void;
|
||||
public CreateAbstractRule(name: string): IAbstractValidationRule<T>;
|
||||
public CreateAbstractListRule(name: string): IAbstractValidationRule<T>;
|
||||
public CreateRule(name: string): IAbstractValidationRule<T>;
|
||||
public ForList: boolean;
|
||||
}
|
||||
class MessageLocalization {
|
||||
static customMsg: string;
|
||||
static defaultMessages: {
|
||||
"required": string;
|
||||
"remote": string;
|
||||
"email": string;
|
||||
"url": string;
|
||||
"date": string;
|
||||
"dateISO": string;
|
||||
"number": string;
|
||||
"digits": string;
|
||||
"signedDigits": string;
|
||||
"creditcard": string;
|
||||
"equalTo": string;
|
||||
"maxlength": string;
|
||||
"minlength": string;
|
||||
"rangelength": string;
|
||||
"range": string;
|
||||
"max": string;
|
||||
"min": string;
|
||||
"step": string;
|
||||
"contains": string;
|
||||
"mask": string;
|
||||
"custom": string;
|
||||
};
|
||||
static ValidationMessages: {
|
||||
"required": string;
|
||||
"remote": string;
|
||||
"email": string;
|
||||
"url": string;
|
||||
"date": string;
|
||||
"dateISO": string;
|
||||
"number": string;
|
||||
"digits": string;
|
||||
"signedDigits": string;
|
||||
"creditcard": string;
|
||||
"equalTo": string;
|
||||
"maxlength": string;
|
||||
"minlength": string;
|
||||
"rangelength": string;
|
||||
"range": string;
|
||||
"max": string;
|
||||
"min": string;
|
||||
"step": string;
|
||||
"contains": string;
|
||||
"mask": string;
|
||||
"custom": string;
|
||||
};
|
||||
static GetValidationMessage(validator: any): string;
|
||||
}
|
||||
}
|
||||
declare module "node-validation" {export = Validation;}
|
||||
@@ -0,0 +1,32 @@
|
||||
/// <reference path="business-rules-engine.d.ts" />
|
||||
/// <reference path="BasicValidators.d.ts" />
|
||||
/// <reference path="../underscore/underscore.d.ts" />
|
||||
/// <reference path="../q/Q.d.ts" />
|
||||
/// <reference path="../moment/moment.d.ts" />
|
||||
|
||||
export interface IPerson{
|
||||
Checked:boolean;
|
||||
FirstName:string;
|
||||
LastName:string;
|
||||
Email:string;
|
||||
}
|
||||
|
||||
|
||||
//create custom composite validator
|
||||
var personValidator = new Validation.AbstractValidator<IPerson>();
|
||||
|
||||
//create field validators
|
||||
var required = new Validators.RequiredValidator();
|
||||
var email = new Validators.EmailValidator();
|
||||
var maxLength = new Validators.MaxLengthValidator();
|
||||
maxLength.MaxLength = 15;
|
||||
|
||||
|
||||
personValidator.RuleFor("FirstName", required);
|
||||
personValidator.RuleFor("FirstName", maxLength);
|
||||
|
||||
personValidator.RuleFor("LastName", required);
|
||||
personValidator.RuleFor("LastName", maxLength);
|
||||
|
||||
personValidator.RuleFor("Email", required);
|
||||
personValidator.RuleFor("Email", email);
|
||||
+242
@@ -0,0 +1,242 @@
|
||||
// Type definitions for business-rules-engine - v1.0.20
|
||||
// Project: https://github.com/rsamec/form
|
||||
// Definitions by: Roman Samec <https://github.com/rsamec>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
// Source: typings/business-rules-engine/Validation.d.ts
|
||||
/// <reference path="../q/Q.d.ts" />
|
||||
/// <reference path="../underscore/underscore.d.ts" />
|
||||
declare module Validation {
|
||||
interface IErrorCustomMessage {
|
||||
(config: any, args: any): string;
|
||||
}
|
||||
interface IPropertyValidator {
|
||||
isAcceptable(s: any): boolean;
|
||||
customMessage?: IErrorCustomMessage;
|
||||
tagName?: string;
|
||||
}
|
||||
interface IStringValidator extends IPropertyValidator {
|
||||
isAcceptable(s: string): boolean;
|
||||
}
|
||||
interface IAsyncPropertyValidator {
|
||||
isAcceptable(s: any): Q.Promise<boolean>;
|
||||
customMessage?: IErrorCustomMessage;
|
||||
isAsync: boolean;
|
||||
tagName?: string;
|
||||
}
|
||||
interface IAsyncStringPropertyValidator extends IAsyncPropertyValidator {
|
||||
isAcceptable(s: string): Q.Promise<boolean>;
|
||||
}
|
||||
enum CompareOperator {
|
||||
LessThan = 0,
|
||||
LessThanEqual = 1,
|
||||
Equal = 2,
|
||||
NotEqual = 3,
|
||||
GreaterThanEqual = 4,
|
||||
GreaterThan = 5,
|
||||
}
|
||||
interface IError {
|
||||
HasError: boolean;
|
||||
ErrorMessage: string;
|
||||
TranslateArgs?: IErrorTranslateArgs;
|
||||
}
|
||||
interface IErrorTranslateArgs {
|
||||
TranslateId: string;
|
||||
MessageArgs: any;
|
||||
CustomMessage?: IErrorCustomMessage;
|
||||
}
|
||||
interface IOptional {
|
||||
(): boolean;
|
||||
}
|
||||
interface IValidationFailure extends IError {
|
||||
IsAsync: boolean;
|
||||
Error: IError;
|
||||
}
|
||||
interface IValidationResult {
|
||||
Name: string;
|
||||
Add(validationResult: IValidationResult): void;
|
||||
Remove(index: number): void;
|
||||
Children: IValidationResult[];
|
||||
HasErrors: boolean;
|
||||
HasErrorsDirty: boolean;
|
||||
ErrorMessage: string;
|
||||
ErrorCount: number;
|
||||
Optional?: IOptional;
|
||||
TranslateArgs?: IErrorTranslateArgs[];
|
||||
}
|
||||
interface IValidate {
|
||||
(args: IError): void;
|
||||
}
|
||||
interface IAsyncValidate {
|
||||
(args: IError): Q.Promise<any>;
|
||||
}
|
||||
interface IValidatorFce {
|
||||
Name: string;
|
||||
ValidationFce?: IValidate;
|
||||
AsyncValidationFce?: IAsyncValidate;
|
||||
}
|
||||
interface IValidator {
|
||||
Validate(context: any): IValidationFailure;
|
||||
ValidateAsync(context: any): Q.Promise<IValidationFailure>;
|
||||
Error: IError;
|
||||
}
|
||||
interface IAbstractValidator<T> {
|
||||
RuleFor(prop: string, validator: IPropertyValidator): any;
|
||||
ValidationFor(prop: string, validatorFce: IValidatorFce): any;
|
||||
Validation(validatorFce: IValidatorFce): any;
|
||||
ValidatorFor<K>(prop: string, validator: IAbstractValidator<K>): any;
|
||||
CreateRule(name: string): IAbstractValidationRule<any>;
|
||||
CreateAbstractRule(name: string): IAbstractValidationRule<any>;
|
||||
CreateAbstractListRule(name: string): IAbstractValidationRule<any>;
|
||||
ForList: boolean;
|
||||
}
|
||||
interface IAbstractValidationRule<T> {
|
||||
Validate(context: T): IValidationResult;
|
||||
ValidateAsync(context: T): Q.Promise<IValidationResult>;
|
||||
ValidateAll(context: T): Q.Promise<IValidationResult>;
|
||||
ValidateProperty(context: T, propName: string): void;
|
||||
ValidationResult: IValidationResult;
|
||||
Rules: {
|
||||
[name: string]: IPropertyValidationRule<T>;
|
||||
};
|
||||
Validators: {
|
||||
[name: string]: IValidator;
|
||||
};
|
||||
Children: {
|
||||
[name: string]: IAbstractValidationRule<any>;
|
||||
};
|
||||
}
|
||||
interface IPropertyValidationRule<T> {
|
||||
Validators: {
|
||||
[name: string]: any;
|
||||
};
|
||||
Validate(context: IValidationContext<T>): IValidationFailure[];
|
||||
ValidateAsync(context: IValidationContext<T>): Q.Promise<IValidationFailure[]>;
|
||||
}
|
||||
interface IValidationContext<T> {
|
||||
Value: string;
|
||||
Key: string;
|
||||
Data: T;
|
||||
}
|
||||
class Error implements IError {
|
||||
public HasError: boolean;
|
||||
public ErrorMessage: string;
|
||||
constructor();
|
||||
}
|
||||
class ValidationFailure implements IError {
|
||||
public Error: IError;
|
||||
public IsAsync: boolean;
|
||||
constructor(Error: IError, IsAsync: boolean);
|
||||
public HasError : boolean;
|
||||
public ErrorMessage : string;
|
||||
public TranslateArgs : IErrorTranslateArgs;
|
||||
}
|
||||
class ValidationResult implements IValidationResult {
|
||||
public Name: string;
|
||||
constructor(Name: string);
|
||||
public IsDirty: boolean;
|
||||
public Children : IValidationResult[];
|
||||
public Add(error: IValidationResult): void;
|
||||
public Remove(index: number): void;
|
||||
public Optional: IOptional;
|
||||
public TranslateArgs: IErrorTranslateArgs[];
|
||||
public HasErrorsDirty : boolean;
|
||||
public HasErrors : boolean;
|
||||
public ErrorCount : number;
|
||||
public ErrorMessage : string;
|
||||
}
|
||||
class CompositeValidationResult implements IValidationResult {
|
||||
public Name: string;
|
||||
public Children: IValidationResult[];
|
||||
constructor(Name: string);
|
||||
public Optional: IOptional;
|
||||
public AddFirst(error: IValidationResult): void;
|
||||
public Add(error: IValidationResult): void;
|
||||
public Remove(index: number): void;
|
||||
public HasErrorsDirty : boolean;
|
||||
public HasErrors : boolean;
|
||||
public ErrorCount : number;
|
||||
public ErrorMessage : string;
|
||||
public TranslateArgs : IErrorTranslateArgs[];
|
||||
public LogErrors(headerMessage?: string): void;
|
||||
public Errors : {
|
||||
[name: string]: IValidationResult;
|
||||
};
|
||||
private FlattenErros;
|
||||
public SetDirty(): void;
|
||||
public SetPristine(): void;
|
||||
private SetDirtyEx(node, dirty);
|
||||
private flattenErrors(node, errorCollection);
|
||||
private traverse(node, indent);
|
||||
}
|
||||
class AbstractValidator<T> implements IAbstractValidator<T> {
|
||||
public Validators: {
|
||||
[name: string]: IPropertyValidator[];
|
||||
};
|
||||
public AbstractValidators: {
|
||||
[name: string]: IAbstractValidator<any>;
|
||||
};
|
||||
public ValidationFunctions: {
|
||||
[name: string]: IValidatorFce[];
|
||||
};
|
||||
public RuleFor(prop: string, validator: IPropertyValidator): void;
|
||||
public ValidationFor(prop: string, fce: IValidatorFce): void;
|
||||
public Validation(fce: IValidatorFce): void;
|
||||
public ValidatorFor<K>(prop: string, validator: IAbstractValidator<K>, forList?: boolean): void;
|
||||
public CreateAbstractRule(name: string): IAbstractValidationRule<T>;
|
||||
public CreateAbstractListRule(name: string): IAbstractValidationRule<T>;
|
||||
public CreateRule(name: string): IAbstractValidationRule<T>;
|
||||
public ForList: boolean;
|
||||
}
|
||||
class MessageLocalization {
|
||||
static customMsg: string;
|
||||
static defaultMessages: {
|
||||
"required": string;
|
||||
"remote": string;
|
||||
"email": string;
|
||||
"url": string;
|
||||
"date": string;
|
||||
"dateISO": string;
|
||||
"number": string;
|
||||
"digits": string;
|
||||
"signedDigits": string;
|
||||
"creditcard": string;
|
||||
"equalTo": string;
|
||||
"maxlength": string;
|
||||
"minlength": string;
|
||||
"rangelength": string;
|
||||
"range": string;
|
||||
"max": string;
|
||||
"min": string;
|
||||
"step": string;
|
||||
"contains": string;
|
||||
"mask": string;
|
||||
"custom": string;
|
||||
};
|
||||
static ValidationMessages: {
|
||||
"required": string;
|
||||
"remote": string;
|
||||
"email": string;
|
||||
"url": string;
|
||||
"date": string;
|
||||
"dateISO": string;
|
||||
"number": string;
|
||||
"digits": string;
|
||||
"signedDigits": string;
|
||||
"creditcard": string;
|
||||
"equalTo": string;
|
||||
"maxlength": string;
|
||||
"minlength": string;
|
||||
"rangelength": string;
|
||||
"range": string;
|
||||
"max": string;
|
||||
"min": string;
|
||||
"step": string;
|
||||
"contains": string;
|
||||
"mask": string;
|
||||
"custom": string;
|
||||
};
|
||||
static GetValidationMessage(validator: any): string;
|
||||
}
|
||||
}
|
||||
declare module "business-rule-engine" {export = Validation;}
|
||||
@@ -1 +1 @@
|
||||
""
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
""
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
""
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
""
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
""
|
||||
|
||||
|
||||
@@ -0,0 +1,120 @@
|
||||
/// <reference path="chroma-js.d.ts" />
|
||||
|
||||
function test_chroma() {
|
||||
chroma("red");
|
||||
chroma("#ff0000");
|
||||
chroma("#f00");
|
||||
chroma("FF0000");
|
||||
chroma(255, 0, 0);
|
||||
chroma([255, 0, 0]);
|
||||
chroma(0, 1, 0.5, 'hsl');
|
||||
chroma([0, 1, 0.5], 'hsl');
|
||||
chroma(0, 1, 1, 'hsv');
|
||||
chroma("rgb(255,0,0)");
|
||||
chroma("rgb(100%,0%,0%)");
|
||||
chroma("hsl(0,100%,50%)");
|
||||
chroma(53.24, 80.09, 67.20, 'lab');
|
||||
chroma(53.24, 104.55, 40, 'lch');
|
||||
chroma(1, 0, 0, 'gl');
|
||||
|
||||
chroma.hex("#ff0000");
|
||||
chroma.hex("red");
|
||||
chroma.hex("rgb(255, 0, 0)");
|
||||
|
||||
chroma.rgb(255, 0, 0);
|
||||
chroma.hsl(0, 1, 0.5);
|
||||
chroma.hsv(120, 0.5, 0.5);
|
||||
chroma.lab(53.24, 80.09, 67.20);
|
||||
chroma.lch(53.24, 104.55, 40);
|
||||
chroma.gl(1, 0, 0);
|
||||
|
||||
chroma.interpolate('white', 'black', 0) // #ffffff
|
||||
chroma.interpolate('white', 'black', 1) // #000000
|
||||
chroma.interpolate('white', 'black', 0.5) // #7f7f7f
|
||||
chroma.interpolate('white', 'black', 0.5, 'hsv') // #808080
|
||||
chroma.interpolate('white', 'black', 0.5, 'lab') // #777777
|
||||
|
||||
chroma.interpolate('rgba(0,0,0,0)', 'rgba(255,0,0,1)', 0.5).css() //"rgba(127.5,0,0,0.5)"
|
||||
|
||||
var bezInterpolator = chroma.interpolate.bezier(['white', 'yellow', 'red', 'black']);
|
||||
bezInterpolator(0).hex() // #ffffff
|
||||
bezInterpolator(0.33).hex() // #ffcc67
|
||||
bezInterpolator(0.66).hex() // #b65f1a
|
||||
bezInterpolator(1).hex() // #000000
|
||||
|
||||
chroma.luminance('black') // 0
|
||||
chroma.luminance('white') // 1
|
||||
chroma.luminance('#ff0000') // 0.2126
|
||||
|
||||
chroma.contrast('white', 'navy') // 16.00 – ok
|
||||
chroma.contrast('white', 'yellow') // 1.07 – not ok!
|
||||
}
|
||||
|
||||
function test_color() {
|
||||
chroma('red').hex() // "#FF0000""
|
||||
chroma('red').rgb() // [255, 0, 0]
|
||||
chroma('red').hsv() // [0, 1, 1]
|
||||
chroma('red').hsl() // [0, 1, 0.5]
|
||||
chroma('red').lab() // [53.2407, 80.0924, 67.2031]
|
||||
chroma('red').lch() // [53.2407, 104.5517, 39.9990]
|
||||
chroma('red').rgba() // [255, 0, 0, 1]
|
||||
chroma('red').css() // "rgb(255,0,0)"
|
||||
chroma('red').alpha(0.7).css() // "rgba(255,0,0,0.7)"
|
||||
chroma('red').css('hsl') // "hsl(0,100%,50%)"
|
||||
chroma('red').alpha(0.7).css('hsl') // "hsla(0,100%,50%,0.7)"
|
||||
chroma('blue').css('hsla') // "hsla(240,100%,50%,1)"
|
||||
|
||||
var red = chroma('red');
|
||||
red.alpha(0.5);
|
||||
red.css(); // rgba(255,0,0,0.5);
|
||||
|
||||
chroma('red').darken().hex() // #BC0000
|
||||
chroma('red').brighten().hex() // #FF603B
|
||||
chroma('#eecc99').saturate().hex() // #fcc973
|
||||
chroma('red').desaturate().hex() // #ec3d23
|
||||
|
||||
chroma('black').luminance() // 0
|
||||
chroma('white').luminance() // 1
|
||||
chroma('red').luminance() // 0.2126
|
||||
}
|
||||
|
||||
function test_scale() {
|
||||
var scale = chroma.scale(['lightyellow', 'navy']);
|
||||
scale(0.5); // #7F7FB0
|
||||
|
||||
chroma.scale('RdYlBu');
|
||||
|
||||
var col = scale(0.5);
|
||||
col.hex(); // #7F7FB0
|
||||
col.rgb(); // [127.5, 127.5, 176]
|
||||
|
||||
scale = chroma.scale(['lightyellow', 'navy']).out('hex');
|
||||
scale(0.5); // "#7F7FB0"
|
||||
|
||||
var scale = chroma.scale(['lightyellow', 'navy']);
|
||||
scale.mode('hsv')(0.5); // #54C08A
|
||||
scale.mode('hsl')(0.5); // #31FF98
|
||||
scale.mode('lab')(0.5); // #967CB2
|
||||
scale.mode('lch')(0.5); // #D26662
|
||||
|
||||
var scale = chroma.scale(['lightyellow', 'navy']).domain([0, 400]);
|
||||
scale(200); // #7F7FB0
|
||||
|
||||
var scale = chroma.scale(['lightyellow', 'navy']).domain([0, 100, 200, 300, 400]);
|
||||
scale(98); // #7F7FB0
|
||||
scale(99); // #7F7FB0
|
||||
scale(100); // #AAAAC0
|
||||
scale(101); // #AAAAC0
|
||||
|
||||
chroma.scale(['#eee', '#900']).domain([0, 400], 7);
|
||||
chroma.scale(['#eee', '#900']).domain([1, 1000000], 7, 'log');
|
||||
chroma.scale(['#eee', '#900']).domain([1, 1000000], 5, 'quantiles');
|
||||
chroma.scale(['#eee', '#900']).domain([1, 1000000], 5, 'k-means');
|
||||
chroma.scale(['white', 'red']).domain([0, 100], 4).domain() // [0, 25, 50, 75, 100]
|
||||
|
||||
chroma.scale().range(['lightyellow', 'navy']);
|
||||
|
||||
chroma.scale(['lightyellow', 'navy']).correctLightness(true);
|
||||
|
||||
chroma.scale('RdYlGn').domain([0,1], 5).colors()
|
||||
}
|
||||
Vendored
+317
@@ -0,0 +1,317 @@
|
||||
// Type definitions for Chroma.js v0.5.6
|
||||
// Project: https://github.com/gka/chroma.js
|
||||
// Definitions by: Sebastian Brückner <https://github.com/invliD>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/**
|
||||
* Chroma.js is a tiny library for all kinds of color conversions and color scales.
|
||||
*/
|
||||
declare module Chroma {
|
||||
|
||||
export interface ChromaStatic {
|
||||
/**
|
||||
* Creates a color from a string representation (as supported in CSS).
|
||||
*
|
||||
* @param color The string to convert to a color.
|
||||
* @return the color object.
|
||||
*/
|
||||
(color: string): Color;
|
||||
|
||||
/**
|
||||
* Create a color in the specified color space using a, b and c as values.
|
||||
*
|
||||
* @param a
|
||||
* @param b
|
||||
* @param c
|
||||
* @param colorSpace The color space to use (one of "rgb", "hsl", "hsv", "lab", "lch", "gl"). Defaults to "rgb".
|
||||
* @return the color object.
|
||||
*/
|
||||
(a: number, b: number, c: number, colorSpace?: string): Color;
|
||||
|
||||
/**
|
||||
* Create a color in the specified color space using values.
|
||||
*
|
||||
* @param values An array of values (e.g. [r, g, b, a?]).
|
||||
* @param colorSpace The color space to use (one of "rgb", "hsl", "hsv", "lab", "lch", "gl"). Defaults to "rgb".
|
||||
* @return the color object.
|
||||
*/
|
||||
(values: number[], colorSpace?: string): Color;
|
||||
|
||||
/**
|
||||
* Create a color in the specified color space using a, b and c as values.
|
||||
*
|
||||
* @param a
|
||||
* @param b
|
||||
* @param c
|
||||
* @param colorSpace The color space to use (one of "rgb", "hsl", "hsv", "lab", "lch", "gl"). Defaults to "rgb".
|
||||
* @return the color object.
|
||||
*/
|
||||
color(a: number, b: number, c: number, colorSpace?: string): Color;
|
||||
|
||||
/**
|
||||
* Calculate the contrast ratio of two colors.
|
||||
*
|
||||
* @param color1 The first color.
|
||||
* @param color2 The second color.
|
||||
* @return the contrast ratio.
|
||||
*/
|
||||
contrast(color1: Color, color2: Color): number;
|
||||
/**
|
||||
* Calculate the contrast ratio of two colors.
|
||||
*
|
||||
* @param color1 The first color.
|
||||
* @param color2 The second color.
|
||||
* @return the contrast ratio.
|
||||
*/
|
||||
contrast(color1: Color, color2: string): number;
|
||||
/**
|
||||
* Calculate the contrast ratio of two colors.
|
||||
*
|
||||
* @param color1 The first color.
|
||||
* @param color2 The second color.
|
||||
* @return the contrast ratio.
|
||||
*/
|
||||
contrast(color1: string, color2: Color): number;
|
||||
/**
|
||||
* Calculate the contrast ratio of two colors.
|
||||
*
|
||||
* @param color1 The first color.
|
||||
* @param color2 The second color.
|
||||
* @return the contrast ratio.
|
||||
*/
|
||||
contrast(color1: string, color2: string): number;
|
||||
|
||||
/**
|
||||
* Create a color from a hex or string representation (as supported in CSS).
|
||||
*
|
||||
* This is an alias of chroma.hex().
|
||||
*
|
||||
* @param color The string to convert to a color.
|
||||
* @return the color object.
|
||||
*/
|
||||
css(color: string): Color;
|
||||
|
||||
/**
|
||||
* Create a color from a hex or string representation (as supported in CSS).
|
||||
*
|
||||
* This is an alias of chroma.css().
|
||||
*
|
||||
* @param color The string to convert to a color.
|
||||
* @return the color object.
|
||||
*/
|
||||
hex(color: string): Color;
|
||||
|
||||
rgb(red: number, green: number, blue: number, alpha?: number): Color;
|
||||
hsl(hue: number, saturation: number, lightness: number, alpha?: number): Color;
|
||||
hsv(hue: number, saturation: number, value: number, alpha?: number): Color;
|
||||
lab(lightness: number, a: number, b: number, alpha?: number): Color;
|
||||
lch(lightness: number, chroma: number, hue: number, alpha?: number): Color;
|
||||
gl(red: number, green: number, blue: number, alpha?: number): Color;
|
||||
|
||||
interpolate: InterpolateFunction;
|
||||
mix: InterpolateFunction;
|
||||
|
||||
luminance(color: Color): number;
|
||||
luminance(color: string): number;
|
||||
|
||||
/**
|
||||
* Creates a color scale using a pre-defined color scale.
|
||||
*
|
||||
* @param name The name of the color scale.
|
||||
* @return the resulting color scale.
|
||||
*/
|
||||
scale(name: string): Scale;
|
||||
|
||||
/**
|
||||
* Creates a color scale function from the given set of colors.
|
||||
*
|
||||
* @param colors An Array of at least two color names or hex values.
|
||||
* @return the resulting color scale.
|
||||
*/
|
||||
scale(colors?: string[]): Scale;
|
||||
|
||||
scales: PredefinedScales;
|
||||
}
|
||||
|
||||
interface InterpolateFunction {
|
||||
(color1: Color, color2: Color, f: number, mode?: string): Color;
|
||||
(color1: Color, color2: string, f: number, mode?: string): Color;
|
||||
(color1: string, color2: Color, f: number, mode?: string): Color;
|
||||
(color1: string, color2: string, f: number, mode?: string): Color;
|
||||
|
||||
bezier(colors: any[]): (t: number) => Color;
|
||||
}
|
||||
|
||||
interface PredefinedScales {
|
||||
[key: string]: Scale;
|
||||
|
||||
cool: Scale;
|
||||
hot: Scale;
|
||||
}
|
||||
|
||||
export interface Color {
|
||||
/**
|
||||
* Creates a color from a string representation (as supported in CSS).
|
||||
*
|
||||
* @param color The string to convert to a color.
|
||||
*/
|
||||
new(color: string): Color;
|
||||
|
||||
/**
|
||||
* Create a color in the specified color space using a, b and c as values.
|
||||
*
|
||||
* @param a
|
||||
* @param b
|
||||
* @param c
|
||||
* @param colorSpace The color space to use (one of "rgb", "hsl", "hsv", "lab", "lch", "gl"). Defaults to "rgb".
|
||||
*/
|
||||
new(a: number, b: number, c: number, colorSpace?: string): Color;
|
||||
|
||||
/**
|
||||
* Create a color in the specified color space using a, b and c as color values and alpha as the alpha value.
|
||||
*
|
||||
* @param a
|
||||
* @param b
|
||||
* @param c
|
||||
* @param alpha The alpha value of the color.
|
||||
* @param colorSpace The color space to use (one of "rgb", "hsl", "hsv", "lab", "lch", "gl"). Defaults to "rgb".
|
||||
*/
|
||||
new(a: number, b: number, c: number, alpha: number, colorSpace?: string): Color;
|
||||
|
||||
/**
|
||||
* Create a color in the specified color space using values.
|
||||
*
|
||||
* @param values An array of values (e.g. [r, g, b, a?]).
|
||||
* @param colorSpace The color space to use (one of "rgb", "hsl", "hsv", "lab", "lch", "gl"). Defaults to "rgb".
|
||||
*/
|
||||
new(values: number[], colorSpace: string): Color;
|
||||
|
||||
/**
|
||||
* Convert this color to CSS hex representation.
|
||||
*
|
||||
* @return this color's hex representation.
|
||||
*/
|
||||
hex(): string;
|
||||
|
||||
/**
|
||||
* @return the relative luminance of the color, which is a value between 0 (black) and 1 (white).
|
||||
*/
|
||||
luminance(): number;
|
||||
|
||||
/**
|
||||
* @return the X11 name of this color or its hex value if it does not have a name.
|
||||
*/
|
||||
name(): string;
|
||||
|
||||
/**
|
||||
* @return the alpha value of the color.
|
||||
*/
|
||||
alpha(): number;
|
||||
|
||||
/**
|
||||
* Set the alpha value.
|
||||
*
|
||||
* @param alpha The alpha value.
|
||||
* @return this
|
||||
*/
|
||||
alpha(alpha: number): Color;
|
||||
|
||||
css(mode?: string): string;
|
||||
|
||||
interpolate(color: Color, f: number, mode?: string): Color;
|
||||
interpolate(color: string, f: number, mode?: string): Color;
|
||||
|
||||
premultiply(): Color;
|
||||
|
||||
rgb(): number[];
|
||||
rgba(): number[];
|
||||
hsl(): number[];
|
||||
hsv(): number[];
|
||||
lab(): number[];
|
||||
lch(): number[];
|
||||
hsi(): number[];
|
||||
gl(): number[];
|
||||
|
||||
darken(amount?: number): Color;
|
||||
darker(amount: number): Color;
|
||||
brighten(amount?: number): Color;
|
||||
brighter(amount: number): Color;
|
||||
saturate(amount?: number): Color;
|
||||
desaturate(amount?: number): Color;
|
||||
|
||||
toString(): string;
|
||||
}
|
||||
|
||||
export interface Scale {
|
||||
/**
|
||||
* Interpolate a color using the currently set range and domain.
|
||||
*
|
||||
* @param value The value to use for interpolation.
|
||||
* @return the interpolated hex color OR a Color object (depending on the mode set on this Scale).
|
||||
*/
|
||||
(value: number): any;
|
||||
|
||||
/**
|
||||
* Retreive all possible colors generated by this scale if it has distinct classes.
|
||||
*
|
||||
* @param mode The output mode to use. Must be one of Color's getters. Defaults to "hex".
|
||||
* @return an array of colors in the type specified by mode.
|
||||
*/
|
||||
colors(mode?: string): any[];
|
||||
|
||||
correctLightness(): boolean;
|
||||
|
||||
/**
|
||||
* Enable or disable automatic lightness correction of this scale.
|
||||
*
|
||||
* @param Whether to enable or disable automatic lightness correction.
|
||||
* @return this
|
||||
*/
|
||||
correctLightness(enable: boolean): Scale;
|
||||
|
||||
/**
|
||||
* Get the current domain.
|
||||
*
|
||||
* @return The current domain.
|
||||
*/
|
||||
domain(): number[];
|
||||
|
||||
/**
|
||||
* Set the domain.
|
||||
*
|
||||
* @param domain An Array of at least two numbers (min and max).
|
||||
* @param classes The number of fixed classes to create between min and max.
|
||||
* @param mode The scale to use. Examples: log, quantiles, k-means.
|
||||
* @return this
|
||||
*/
|
||||
domain(domain: number[], classes?: number, mode?: string): Scale;
|
||||
|
||||
/**
|
||||
* Specify in which color space the colors should be interpolated. Defaults to "rgb".
|
||||
* You can use any of the following spaces: rgb, hsv, hsl, lab, lch
|
||||
*
|
||||
* @param colorSpace The color space to use for interpolation.
|
||||
* @return this
|
||||
*/
|
||||
mode(colorSpace: string): Scale;
|
||||
|
||||
/**
|
||||
* Set the output mode of this Scale.
|
||||
*
|
||||
* @param mode The output mode to use. Must be one of Color's getters.
|
||||
* @return this
|
||||
*/
|
||||
out(mode: string): Scale;
|
||||
|
||||
/**
|
||||
* Set the color range after initialization.
|
||||
*
|
||||
* @param colors An Array of at least two color names or hex values.
|
||||
* @return this
|
||||
*/
|
||||
range(colors: string[]): Scale;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
declare var chroma: Chroma.ChromaStatic;
|
||||
@@ -1 +1 @@
|
||||
""
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
""
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
""
|
||||
|
||||
|
||||
Vendored
+48
-10
@@ -3,6 +3,8 @@
|
||||
// Definitions by: Matthew Kimber <https://github.com/matthewkimber>, otiai10 <https://github.com/otiai10>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path='../webrtc/MediaStream.d.ts'/>
|
||||
|
||||
////////////////////
|
||||
// Alarms
|
||||
////////////////////
|
||||
@@ -294,6 +296,7 @@ declare module chrome.contextMenus {
|
||||
pageUrl: string;
|
||||
linkUrl?: string;
|
||||
parentMenuItemId?: any;
|
||||
srcUrl?: string;
|
||||
}
|
||||
|
||||
interface CreateProperties {
|
||||
@@ -537,6 +540,14 @@ declare module chrome.declarativeWebRequest {
|
||||
var onRequest: RequestedEvent;
|
||||
}
|
||||
|
||||
////////////////////
|
||||
// DesktopCapture
|
||||
////////////////////
|
||||
declare module chrome.desktopCapture {
|
||||
export function chooseDesktopMedia(sources: string[], targetTab?: chrome.tabs.Tab, callback?: (streamId: string) => void): void;
|
||||
export function cancelChooseDesktopMedia(desktopMediaRequestId: number): void;
|
||||
}
|
||||
|
||||
////////////////////
|
||||
// Dev Tools - Inspected Window
|
||||
////////////////////
|
||||
@@ -1745,6 +1756,27 @@ declare module chrome.socket {
|
||||
export function getNetworkList(callback: (result: NetworkInterface[]) => void): void;
|
||||
}
|
||||
|
||||
////////////////////
|
||||
// TabCapture
|
||||
////////////////////
|
||||
declare module chrome.tabCapture {
|
||||
interface CaptureInfo {
|
||||
tabId: number;
|
||||
status: string;
|
||||
fullscreen: boolean;
|
||||
}
|
||||
|
||||
interface CaptureOptions {
|
||||
audio?: boolean;
|
||||
video?: boolean;
|
||||
audioConstraints?: MediaTrackConstraints;
|
||||
videoConstraints?: MediaTrackConstraints;
|
||||
}
|
||||
|
||||
export function capture(options: CaptureOptions, callback: (stream: LocalMediaStream) => void): void;
|
||||
export function getCapturedTabs(callback: (result: CaptureInfo[]) => void): void;
|
||||
}
|
||||
|
||||
////////////////////
|
||||
// Tabs
|
||||
////////////////////
|
||||
@@ -2198,13 +2230,19 @@ declare module chrome.webRequest {
|
||||
username: string;
|
||||
password: string;
|
||||
}
|
||||
|
||||
|
||||
interface HttpHeader {
|
||||
name: string;
|
||||
value?: string;
|
||||
binaryValue?: ArrayBuffer;
|
||||
}
|
||||
|
||||
interface BlockingResponse {
|
||||
cancel?: boolean;
|
||||
redirectUrl?: string;
|
||||
responseHeaders?: Object;
|
||||
responseHeaders?: HttpHeader[];
|
||||
authCredentials?: AuthCredentials;
|
||||
requestHeaders?: Object;
|
||||
requestHeaders?: HttpHeader[];
|
||||
}
|
||||
|
||||
interface RequestFilter {
|
||||
@@ -2224,7 +2262,7 @@ declare module chrome.webRequest {
|
||||
ip?: string;
|
||||
statusLine?: string;
|
||||
frameId: number;
|
||||
responseHeaders?: Object;
|
||||
responseHeaders?: HttpHeader[];
|
||||
parentFrameId: number;
|
||||
fromCache: boolean;
|
||||
url: string;
|
||||
@@ -2243,7 +2281,7 @@ declare module chrome.webRequest {
|
||||
statusLine?: string;
|
||||
frameId: number;
|
||||
requestId: string;
|
||||
responseHeaders: Object;
|
||||
responseHeaders?: HttpHeader[];
|
||||
type: string;
|
||||
method: string;
|
||||
}
|
||||
@@ -2253,7 +2291,7 @@ declare module chrome.webRequest {
|
||||
ip?: string;
|
||||
statusLine?: string;
|
||||
frameId: number;
|
||||
responseHeaders?: Object;
|
||||
responseHeaders?: HttpHeader[];
|
||||
parentFrameId: number;
|
||||
fromCache: boolean;
|
||||
url: string;
|
||||
@@ -2275,7 +2313,7 @@ declare module chrome.webRequest {
|
||||
statusLine?: string;
|
||||
frameId: number;
|
||||
challenger: Challenger;
|
||||
responseHeaders: Object;
|
||||
responseHeaders?: HttpHeader[];
|
||||
isProxy: boolean;
|
||||
realm?: string;
|
||||
parentFrameId: number;
|
||||
@@ -2294,7 +2332,7 @@ declare module chrome.webRequest {
|
||||
timeStamp: number;
|
||||
frameId: number;
|
||||
requestId: number;
|
||||
requestHeaders?: Object;
|
||||
requestHeaders?: HttpHeader[];
|
||||
type: string;
|
||||
method: string;
|
||||
}
|
||||
@@ -2318,7 +2356,7 @@ declare module chrome.webRequest {
|
||||
ip?: string;
|
||||
statusLine?: string;
|
||||
frameId: number;
|
||||
responseHeaders?: Object;
|
||||
responseHeaders?: HttpHeader[];
|
||||
parentFrameId: number;
|
||||
fromCache: boolean;
|
||||
url: string;
|
||||
@@ -2336,7 +2374,7 @@ declare module chrome.webRequest {
|
||||
timeStamp: number;
|
||||
frameId: number;
|
||||
requestId: string;
|
||||
requestHeaders: Object;
|
||||
requestHeaders?: HttpHeader[];
|
||||
type: string;
|
||||
method: string;
|
||||
}
|
||||
|
||||
@@ -1 +1 @@
|
||||
""
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
""
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
""
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
""
|
||||
|
||||
|
||||
Vendored
+30
@@ -0,0 +1,30 @@
|
||||
// Type definitions for csurf
|
||||
// Project: https://www.npmjs.org/package/csurf
|
||||
// Definitions by: Hiroki Horiuchi <https://github.com/horiuchi/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../express/express.d.ts" />
|
||||
|
||||
declare module Express {
|
||||
export interface Request {
|
||||
csrfToken(): string;
|
||||
}
|
||||
}
|
||||
|
||||
declare module "csurf" {
|
||||
import express = require('express');
|
||||
|
||||
function csurf(options?: {
|
||||
value?: (req: express.Request) => string;
|
||||
cookie?: csurf.CookieOptions;
|
||||
}): express.RequestHandler;
|
||||
|
||||
module csurf {
|
||||
export interface CookieOptions extends express.CookieOptions {
|
||||
key: string;
|
||||
}
|
||||
}
|
||||
|
||||
export = csurf;
|
||||
}
|
||||
|
||||
@@ -1 +1 @@
|
||||
""
|
||||
|
||||
|
||||
+216
-299
@@ -243,7 +243,7 @@ declare module D3 {
|
||||
*
|
||||
* @param map Array of objects to get the values from
|
||||
*/
|
||||
values(map: any[]): any[];
|
||||
values(map: any): any[];
|
||||
/**
|
||||
* List the key-value entries of an associative array.
|
||||
*
|
||||
@@ -417,7 +417,7 @@ declare module D3 {
|
||||
/*
|
||||
* The array of built-in interpolator factories
|
||||
*/
|
||||
interpolators: Array<Transition.InterpolateFactory>;
|
||||
interpolators: Transition.InterpolateFactory[];
|
||||
/**
|
||||
* Layouts
|
||||
*/
|
||||
@@ -525,11 +525,11 @@ declare module D3 {
|
||||
/**
|
||||
* gets the mouse position relative to a specified container.
|
||||
*/
|
||||
mouse(container: any): Array<number>;
|
||||
mouse(container: any): number[];
|
||||
/**
|
||||
* gets the touch positions relative to a specified container.
|
||||
*/
|
||||
touches(container: any): Array<Array<number>>;
|
||||
touches(container: any): number[][];
|
||||
|
||||
/**
|
||||
* If the specified value is a function, returns the specified value.
|
||||
@@ -538,10 +538,12 @@ declare module D3 {
|
||||
functor<R,T>(value: (p : R) => T): (p : R) => T;
|
||||
functor<T>(value: T): (p : any) => T;
|
||||
|
||||
map(object?: any): Map;
|
||||
set(array?: Array<any>): Set;
|
||||
dispatch(...types: Array<string>): Dispatch;
|
||||
rebind(target: any, source: any, ...names: Array<any>): any;
|
||||
map(): Map<any>;
|
||||
set(): Set<any>;
|
||||
map<T>(object: {[key: string]: T; }): Map<T>;
|
||||
set<T>(array: T[]): Set<T>;
|
||||
dispatch(...types: string[]): Dispatch;
|
||||
rebind(target: any, source: any, ...names: any[]): any;
|
||||
requote(str: string): string;
|
||||
timer: {
|
||||
(funct: () => boolean, delay?: number, mark?: number): void;
|
||||
@@ -839,23 +841,27 @@ declare module D3 {
|
||||
entries(values: any[]): NestKeyValue[];
|
||||
}
|
||||
|
||||
export interface Map {
|
||||
export interface Map<T> {
|
||||
has(key: string): boolean;
|
||||
get(key: string): any;
|
||||
set<T>(key: string, value: T): T;
|
||||
get(key: string): T;
|
||||
set(key: string, value: T): T;
|
||||
remove(key: string): boolean;
|
||||
keys(): Array<string>;
|
||||
values(): Array<any>;
|
||||
entries(): Array<any>;
|
||||
forEach(func: (key: string, value: any) => void ): void;
|
||||
keys(): string[];
|
||||
values(): T[];
|
||||
entries(): any[][]; // Actually of form [key: string, val: T][], but this is inexpressible in Typescript
|
||||
forEach(func: (key: string, value: T) => void ): void;
|
||||
empty(): boolean;
|
||||
size(): number;
|
||||
}
|
||||
|
||||
export interface Set{
|
||||
has(value: any): boolean;
|
||||
add(value: any): any;
|
||||
remove(value: any): boolean;
|
||||
values(): Array<any>;
|
||||
forEach(func: (value: any) => void ): void;
|
||||
export interface Set<T> {
|
||||
has(value: T): boolean;
|
||||
add(value: T): T;
|
||||
remove(value: T): boolean;
|
||||
values(): string[];
|
||||
forEach(func: (value: string) => void ): void;
|
||||
empty(): boolean;
|
||||
size(): number;
|
||||
}
|
||||
|
||||
export interface Random {
|
||||
@@ -1096,6 +1102,9 @@ declare module D3 {
|
||||
<T>(layers: T[], index?: number): T[];
|
||||
values(accessor?: (d: any) => any): StackLayout;
|
||||
offset(offset: string): StackLayout;
|
||||
x(accessor: (d: any, i: number) => any): StackLayout;
|
||||
y(accessor: (d: any, i: number) => any): StackLayout;
|
||||
out(setter: (d: any, y0: number, y: number) => void): StackLayout;
|
||||
}
|
||||
|
||||
export interface TreeLayout {
|
||||
@@ -1128,11 +1137,11 @@ declare module D3 {
|
||||
/**
|
||||
* Runs the tree layout
|
||||
*/
|
||||
nodes(root: GraphNode): TreeLayout;
|
||||
nodes(root: GraphNode): GraphNode[];
|
||||
/**
|
||||
* Given the specified array of nodes, such as those returned by nodes, returns an array of objects representing the links from parent to child for each node
|
||||
*/
|
||||
links(nodes: Array<GraphNode>): Array<GraphLink>;
|
||||
links(nodes: GraphNode[]): GraphLink[];
|
||||
/**
|
||||
* If separation is specified, uses the specified function to compute separation between neighboring nodes. If separation is not specified, returns the current separation function
|
||||
*/
|
||||
@@ -1153,11 +1162,24 @@ declare module D3 {
|
||||
/**
|
||||
* Gets the available layout size
|
||||
*/
|
||||
(): Array<number>;
|
||||
(): number[];
|
||||
/**
|
||||
* Sets the available layout size
|
||||
*/
|
||||
(size: Array<number>): TreeLayout;
|
||||
(size: number[]): TreeLayout;
|
||||
};
|
||||
/**
|
||||
* Gets or sets the available node size
|
||||
*/
|
||||
nodeSize: {
|
||||
/**
|
||||
* Gets the available node size
|
||||
*/
|
||||
(): number[];
|
||||
/**
|
||||
* Sets the available node size
|
||||
*/
|
||||
(size: number[]): TreeLayout;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1221,6 +1243,21 @@ declare module D3 {
|
||||
target: GraphNode;
|
||||
}
|
||||
|
||||
export interface GraphNodeForce {
|
||||
index?: number;
|
||||
x?: number;
|
||||
y?: number;
|
||||
px?: number;
|
||||
py?: number;
|
||||
fixed?: boolean;
|
||||
weight?: number;
|
||||
}
|
||||
|
||||
export interface GraphLinkForce {
|
||||
source: GraphNodeForce;
|
||||
target: GraphNodeForce;
|
||||
}
|
||||
|
||||
export interface ForceLayout {
|
||||
(): ForceLayout;
|
||||
size: {
|
||||
@@ -1270,14 +1307,14 @@ declare module D3 {
|
||||
};
|
||||
|
||||
links: {
|
||||
(): GraphLink[];
|
||||
(arLinks: GraphLink[]): ForceLayout;
|
||||
(): GraphLinkForce[];
|
||||
(arLinks: GraphLinkForce[]): ForceLayout;
|
||||
|
||||
};
|
||||
nodes:
|
||||
{
|
||||
(): GraphNode[];
|
||||
(arNodes: GraphNode[]): ForceLayout;
|
||||
(): GraphNodeForce[];
|
||||
(arNodes: GraphNodeForce[]): ForceLayout;
|
||||
|
||||
};
|
||||
start(): ForceLayout;
|
||||
@@ -1289,13 +1326,13 @@ declare module D3 {
|
||||
}
|
||||
|
||||
export interface BundleLayout{
|
||||
(links: Array<GraphLink>): Array<Array<GraphNode>>;
|
||||
(links: GraphLink[]): GraphNode[][];
|
||||
}
|
||||
|
||||
export interface ChordLayout {
|
||||
matrix: {
|
||||
(): Array<Array<number>>;
|
||||
(matrix: Array<Array<number>>): ChordLayout;
|
||||
(): number[][];
|
||||
(matrix: number[][]): ChordLayout;
|
||||
}
|
||||
padding: {
|
||||
(): number;
|
||||
@@ -1313,8 +1350,8 @@ declare module D3 {
|
||||
(): (a: number, b: number) => number;
|
||||
(comparator: (a: number, b: number) => number): ChordLayout;
|
||||
}
|
||||
chords(): Array<GraphLink>;
|
||||
groups(): Array<ArcDescriptor>;
|
||||
chords(): GraphLink[];
|
||||
groups(): ArcDescriptor[];
|
||||
}
|
||||
|
||||
export interface ClusterLayout{
|
||||
@@ -1323,18 +1360,18 @@ declare module D3 {
|
||||
(comparator: (a: GraphNode, b: GraphNode) => number): ClusterLayout;
|
||||
}
|
||||
children: {
|
||||
(): (d: any, i?: number) => Array<GraphNode>;
|
||||
(children: (d: any, i?: number) => Array<GraphNode>): ClusterLayout;
|
||||
(): (d: any, i?: number) => GraphNode[];
|
||||
(children: (d: any, i?: number) => GraphNode[]): ClusterLayout;
|
||||
}
|
||||
nodes(root: GraphNode): Array<GraphNode>;
|
||||
links(nodes: Array<GraphNode>): Array<GraphLink>;
|
||||
nodes(root: GraphNode): GraphNode[];
|
||||
links(nodes: GraphNode[]): GraphLink[];
|
||||
seperation: {
|
||||
(): (a: GraphNode, b: GraphNode) => number;
|
||||
(seperation: (a: GraphNode, b: GraphNode) => number): ClusterLayout;
|
||||
}
|
||||
size: {
|
||||
(): Array<number>;
|
||||
(size: Array<number>): ClusterLayout;
|
||||
(): number[];
|
||||
(size: number[]): ClusterLayout;
|
||||
}
|
||||
value: {
|
||||
(): (node: GraphNode) => number;
|
||||
@@ -1348,11 +1385,11 @@ declare module D3 {
|
||||
(comparator: (a: GraphNode, b: GraphNode) => number): HierarchyLayout;
|
||||
}
|
||||
children: {
|
||||
(): (d: any, i?: number) => Array<GraphNode>;
|
||||
(children: (d: any, i?: number) => Array<GraphNode>): HierarchyLayout;
|
||||
(): (d: any, i?: number) => GraphNode[];
|
||||
(children: (d: any, i?: number) => GraphNode[]): HierarchyLayout;
|
||||
}
|
||||
nodes(root: GraphNode): Array<GraphNode>;
|
||||
links(nodes: Array<GraphNode>): Array<GraphLink>;
|
||||
nodes(root: GraphNode): GraphNode[];
|
||||
links(nodes: GraphNode[]): GraphLink[];
|
||||
value: {
|
||||
(): (node: GraphNode) => number;
|
||||
(value: (node: GraphNode) => number): HierarchyLayout;
|
||||
@@ -1367,21 +1404,21 @@ declare module D3 {
|
||||
}
|
||||
|
||||
export interface HistogramLayout {
|
||||
(values: Array<any>, index?: number): Array<Bin>;
|
||||
(values: any[], index?: number): Bin[];
|
||||
value: {
|
||||
(): (value: any) => any;
|
||||
(accessor: (value: any) => any): HistogramLayout
|
||||
}
|
||||
range: {
|
||||
(): (value: any, index: number) => Array<number>;
|
||||
(range: (value: any, index: number) => Array<number>): HistogramLayout;
|
||||
(range: Array<number>): HistogramLayout;
|
||||
(): (value: any, index: number) => number[];
|
||||
(range: (value: any, index: number) => number[]): HistogramLayout;
|
||||
(range: number[]): HistogramLayout;
|
||||
}
|
||||
bins: {
|
||||
(): (range: Array<any>, index: number) => Array<number>;
|
||||
(bins: (range: Array<any>, index: number) => Array<number>): HistogramLayout;
|
||||
(): (range: any[], index: number) => number[];
|
||||
(bins: (range: any[], index: number) => number[]): HistogramLayout;
|
||||
(bins: number): HistogramLayout;
|
||||
(bins: Array<number>): HistogramLayout;
|
||||
(bins: number[]): HistogramLayout;
|
||||
}
|
||||
frequency: {
|
||||
(): boolean;
|
||||
@@ -1395,18 +1432,18 @@ declare module D3 {
|
||||
(comparator: (a: GraphNode, b: GraphNode) => number): PackLayout;
|
||||
}
|
||||
children: {
|
||||
(): (d: any, i?: number) => Array<GraphNode>;
|
||||
(children: (d: any, i?: number) => Array<GraphNode>): PackLayout;
|
||||
(): (d: any, i?: number) => GraphNode[];
|
||||
(children: (d: any, i?: number) => GraphNode[]): PackLayout;
|
||||
}
|
||||
nodes(root: GraphNode): Array<GraphNode>;
|
||||
links(nodes: Array<GraphNode>): Array<GraphLink>;
|
||||
nodes(root: GraphNode): GraphNode[];
|
||||
links(nodes: GraphNode[]): GraphLink[];
|
||||
value: {
|
||||
(): (node: GraphNode) => number;
|
||||
(value: (node: GraphNode) => number): PackLayout;
|
||||
}
|
||||
size: {
|
||||
(): Array<number>;
|
||||
(size: Array<number>): PackLayout;
|
||||
(): number[];
|
||||
(size: number[]): PackLayout;
|
||||
}
|
||||
padding: {
|
||||
(): number;
|
||||
@@ -1420,18 +1457,18 @@ declare module D3 {
|
||||
(comparator: (a: GraphNode, b: GraphNode) => number): PackLayout;
|
||||
}
|
||||
children: {
|
||||
(): (d: any, i?: number) => Array<GraphNode>;
|
||||
(children: (d: any, i?: number) => Array<GraphNode>): PackLayout;
|
||||
(): (d: any, i?: number) => GraphNode[];
|
||||
(children: (d: any, i?: number) => GraphNode[]): PackLayout;
|
||||
}
|
||||
nodes(root: GraphNode): Array<GraphNode>;
|
||||
links(nodes: Array<GraphNode>): Array<GraphLink>;
|
||||
nodes(root: GraphNode): GraphNode[];
|
||||
links(nodes: GraphNode[]): GraphLink[];
|
||||
value: {
|
||||
(): (node: GraphNode) => number;
|
||||
(value: (node: GraphNode) => number): PackLayout;
|
||||
}
|
||||
size: {
|
||||
(): Array<number>;
|
||||
(size: Array<number>): PackLayout;
|
||||
(): number[];
|
||||
(size: number[]): PackLayout;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1441,18 +1478,18 @@ declare module D3 {
|
||||
(comparator: (a: GraphNode, b: GraphNode) => number): TreeMapLayout;
|
||||
}
|
||||
children: {
|
||||
(): (d: any, i?: number) => Array<GraphNode>;
|
||||
(children: (d: any, i?: number) => Array<GraphNode>): TreeMapLayout;
|
||||
(): (d: any, i?: number) => GraphNode[];
|
||||
(children: (d: any, i?: number) => GraphNode[]): TreeMapLayout;
|
||||
}
|
||||
nodes(root: GraphNode): Array<GraphNode>;
|
||||
links(nodes: Array<GraphNode>): Array<GraphLink>;
|
||||
nodes(root: GraphNode): GraphNode[];
|
||||
links(nodes: GraphNode[]): GraphLink[];
|
||||
value: {
|
||||
(): (node: GraphNode) => number;
|
||||
(value: (node: GraphNode) => number): TreeMapLayout;
|
||||
}
|
||||
size: {
|
||||
(): Array<number>;
|
||||
(size: Array<number>): TreeMapLayout;
|
||||
(): number[];
|
||||
(size: number[]): TreeMapLayout;
|
||||
}
|
||||
padding: {
|
||||
(): number;
|
||||
@@ -1479,7 +1516,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)
|
||||
*/
|
||||
@@ -1614,7 +1651,7 @@ declare module D3 {
|
||||
/**
|
||||
* The array of supported symbol types.
|
||||
*/
|
||||
symbolTypes: Array<string>;
|
||||
symbolTypes: string[];
|
||||
}
|
||||
|
||||
export interface Symbol {
|
||||
@@ -1720,10 +1757,21 @@ declare module D3 {
|
||||
(): any[];
|
||||
(values: any[]): Axis;
|
||||
};
|
||||
|
||||
tickSubdivide(count: number): Axis;
|
||||
tickSize(major?: number, minor?: number, end?: number): Axis;
|
||||
tickSize: {
|
||||
(): number;
|
||||
(inner: number, outer?: number): Axis;
|
||||
}
|
||||
innerTickSize: {
|
||||
(): number;
|
||||
(value: number): Axis;
|
||||
}
|
||||
outerTickSize: {
|
||||
(): number;
|
||||
(value: number): Axis;
|
||||
}
|
||||
tickFormat(formatter: (value: any) => string): Axis;
|
||||
nice(count?: number): Axis;
|
||||
}
|
||||
|
||||
export interface Arc {
|
||||
@@ -2418,9 +2466,9 @@ declare module D3 {
|
||||
export interface Diagonal {
|
||||
(datum: any, index?: number): string;
|
||||
projection: {
|
||||
(): (datum: any, index?: number) => Array<number>;
|
||||
(proj: (datum: any) => Array<number>): Diagonal;
|
||||
(proj: (datum: any, index: number) => Array<number>): Diagonal;
|
||||
(): (datum: any, index?: number) => number[];
|
||||
(proj: (datum: any) => number[]): Diagonal;
|
||||
(proj: (datum: any, index: number) => number[]): Diagonal;
|
||||
};
|
||||
source: {
|
||||
(): (datum: any, index?: number) => any;
|
||||
@@ -2494,21 +2542,23 @@ declare module D3 {
|
||||
threshold(): ThresholdScale;
|
||||
}
|
||||
|
||||
export interface Scale {
|
||||
export interface GenericScale<S> {
|
||||
(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<Scale> { }
|
||||
|
||||
export interface GenericQuantitativeScale<S> extends GenericScale<S> {
|
||||
/**
|
||||
* Get the range value corresponding to a given domain value.
|
||||
*
|
||||
@@ -2522,60 +2572,33 @@ 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.
|
||||
*
|
||||
* @param clamp Enable or disable
|
||||
*/
|
||||
clamp(clamp: boolean): QuantitativeScale;
|
||||
clamp: {
|
||||
(): boolean;
|
||||
(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.
|
||||
*
|
||||
@@ -2587,23 +2610,14 @@ declare module D3 {
|
||||
*
|
||||
* @param count Aproximate representative values to return
|
||||
*/
|
||||
tickFormat(count: number): (n: number) => string;
|
||||
/**
|
||||
* create a new scale from an existing scale..
|
||||
*/
|
||||
copy(): QuantitativeScale;
|
||||
tickFormat(count: number, format?: string): (n: number) => string;
|
||||
}
|
||||
|
||||
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<QuantitativeScale> { }
|
||||
|
||||
export interface IdentityScale extends Scale {
|
||||
export interface LinearScale extends GenericQuantitativeScale<LinearScale> { }
|
||||
|
||||
export interface IdentityScale extends GenericScale<IdentityScale> {
|
||||
/**
|
||||
* Get the range value corresponding to a given domain value.
|
||||
*
|
||||
@@ -2630,132 +2644,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<SqrtScale> { }
|
||||
|
||||
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<PowScale> { }
|
||||
|
||||
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<LogScale> { }
|
||||
|
||||
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<OrdinalScale> {
|
||||
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<QuantizeScale> { }
|
||||
|
||||
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<ThresholdScale> { }
|
||||
|
||||
export interface QuantileScale extends Scale {
|
||||
(value: any): any;
|
||||
domain: {
|
||||
(values: number[]): QuantileScale;
|
||||
(): any[];
|
||||
};
|
||||
range: {
|
||||
(values: any[]): QuantileScale;
|
||||
(): any[];
|
||||
};
|
||||
export interface QuantileScale extends GenericScale<QuantileScale> {
|
||||
quantiles(): any[];
|
||||
copy(): QuantileScale;
|
||||
}
|
||||
|
||||
export interface TimeScale extends Scale {
|
||||
export interface TimeScale extends GenericScale<TimeScale> {
|
||||
(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;
|
||||
@@ -2767,7 +2680,7 @@ declare module D3 {
|
||||
(range: D3.Time.Range, count: number): any[];
|
||||
};
|
||||
tickFormat(count: number): (n: number) => string;
|
||||
copy(): TimeScale;
|
||||
nice(count?: number): TimeScale;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2932,19 +2845,19 @@ declare module D3 {
|
||||
/**
|
||||
* compute the latitude-longitude bounding box for a given feature.
|
||||
*/
|
||||
bounds(feature: any): Array<Array<number>>;
|
||||
bounds(feature: any): number[][];
|
||||
/**
|
||||
* compute the spherical centroid of a given feature.
|
||||
*/
|
||||
centroid(feature: any): Array<number>;
|
||||
centroid(feature: any): number[];
|
||||
/**
|
||||
* compute the great-arc distance between two points.
|
||||
*/
|
||||
distance(a: Array<number>, b: Array<number>): number;
|
||||
distance(a: number[], b: number[]): number;
|
||||
/**
|
||||
* interpolate between two points along a great arc.
|
||||
*/
|
||||
interpolate(a: Array<number>, b: Array<number>): (t: number) => Array<number>;
|
||||
interpolate(a: number[], b: number[]): (t: number) => number[];
|
||||
/**
|
||||
* compute the length of a line string or the circumference of a polygon.
|
||||
*/
|
||||
@@ -3057,7 +2970,7 @@ declare module D3 {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
rotation(rotation: Array<number>): Rotation;
|
||||
rotation(rotation: number[]): Rotation;
|
||||
}
|
||||
|
||||
export interface Path {
|
||||
@@ -3131,11 +3044,11 @@ declare module D3 {
|
||||
}
|
||||
|
||||
export interface Circle {
|
||||
(...args: Array<any>): GeoJSON;
|
||||
(...args: any[]): GeoJSON;
|
||||
origin: {
|
||||
(): Array<number>;
|
||||
(origin: Array<number>): Circle;
|
||||
(origin: (...args: Array<any>) => Array<number>): Circle;
|
||||
(): number[];
|
||||
(origin: number[]): Circle;
|
||||
(origin: (...args: any[]) => number[]): Circle;
|
||||
}
|
||||
angle: {
|
||||
(): number;
|
||||
@@ -3149,31 +3062,31 @@ declare module D3 {
|
||||
|
||||
export interface Graticule{
|
||||
(): GeoJSON;
|
||||
lines(): Array<GeoJSON>;
|
||||
lines(): GeoJSON[];
|
||||
outline(): GeoJSON;
|
||||
extent: {
|
||||
(): Array<Array<number>>;
|
||||
(extent: Array<Array<number>>): Graticule;
|
||||
(): number[][];
|
||||
(extent: number[][]): Graticule;
|
||||
}
|
||||
minorExtent: {
|
||||
(): Array<Array<number>>;
|
||||
(extent: Array<Array<number>>): Graticule;
|
||||
(): number[][];
|
||||
(extent: number[][]): Graticule;
|
||||
}
|
||||
majorExtent: {
|
||||
(): Array<Array<number>>;
|
||||
(extent: Array<Array<number>>): Graticule;
|
||||
(): number[][];
|
||||
(extent: number[][]): Graticule;
|
||||
}
|
||||
step: {
|
||||
(): Array<Array<number>>;
|
||||
(extent: Array<Array<number>>): Graticule;
|
||||
(): number[][];
|
||||
(extent: number[][]): Graticule;
|
||||
}
|
||||
minorStep: {
|
||||
(): Array<Array<number>>;
|
||||
(extent: Array<Array<number>>): Graticule;
|
||||
(): number[][];
|
||||
(extent: number[][]): Graticule;
|
||||
}
|
||||
majorStep: {
|
||||
(): Array<Array<number>>;
|
||||
(extent: Array<Array<number>>): Graticule;
|
||||
(): number[][];
|
||||
(extent: number[][]): Graticule;
|
||||
}
|
||||
precision: {
|
||||
(): number;
|
||||
@@ -3199,33 +3112,33 @@ declare module D3 {
|
||||
}
|
||||
|
||||
export interface GeoJSON {
|
||||
coordinates: Array<Array<number>>;
|
||||
coordinates: number[][];
|
||||
type: string;
|
||||
}
|
||||
|
||||
export interface RawProjection {
|
||||
(lambda: number, phi: number): Array<number>;
|
||||
invert?(x: number, y: number): Array<number>;
|
||||
(lambda: number, phi: number): number[];
|
||||
invert?(x: number, y: number): number[];
|
||||
}
|
||||
|
||||
export interface Projection {
|
||||
(coordinates: Array<number>): Array<number>;
|
||||
invert?(point: Array<number>): Array<number>;
|
||||
(coordinates: number[]): number[];
|
||||
invert?(point: number[]): number[];
|
||||
rotate: {
|
||||
(): Array<number>;
|
||||
(rotation: Array<number>): Projection;
|
||||
(): number[];
|
||||
(rotation: number[]): Projection;
|
||||
};
|
||||
center: {
|
||||
(): Array<number>;
|
||||
(location: Array<number>): Projection;
|
||||
(): number[];
|
||||
(location: number[]): Projection;
|
||||
};
|
||||
parallels: {
|
||||
(): Array<number>;
|
||||
(location: Array<number>): Projection;
|
||||
(): number[];
|
||||
(location: number[]): Projection;
|
||||
};
|
||||
translate: {
|
||||
(): Array<number>;
|
||||
(point: Array<number>): Projection;
|
||||
(): number[];
|
||||
(point: number[]): Projection;
|
||||
};
|
||||
scale: {
|
||||
(): number;
|
||||
@@ -3236,8 +3149,8 @@ declare module D3 {
|
||||
(angle: number): Projection;
|
||||
};
|
||||
clipExtent: {
|
||||
(): Array<Array<number>>;
|
||||
(extent: Array<Array<number>>): Projection;
|
||||
(): number[][];
|
||||
(extent: number[][]): Projection;
|
||||
};
|
||||
precision: {
|
||||
(): number;
|
||||
@@ -3256,8 +3169,8 @@ declare module D3 {
|
||||
}
|
||||
|
||||
export interface Rotation extends Array<any> {
|
||||
(location: Array<number>): Rotation;
|
||||
invert(location: Array<number>): Rotation;
|
||||
(location: number[]): Rotation;
|
||||
invert(location: number[]): Rotation;
|
||||
}
|
||||
|
||||
export interface ProjectionMutator {
|
||||
@@ -3272,11 +3185,11 @@ declare module D3 {
|
||||
/**
|
||||
* compute the Voronoi diagram for the specified points.
|
||||
*/
|
||||
voronoi(vertices: Array<Vertice>): Array<Polygon>;
|
||||
voronoi(vertices: Vertice[]): Polygon[];
|
||||
/**
|
||||
* compute the Delaunay triangulation for the specified points.
|
||||
*/
|
||||
delaunay(vertices?: Array<Vertice>): Array<Polygon>;
|
||||
delaunay(vertices?: Vertice[]): Polygon[];
|
||||
/**
|
||||
* constructs a quadtree for an array of points.
|
||||
*/
|
||||
@@ -3284,21 +3197,21 @@ declare module D3 {
|
||||
/**
|
||||
* Constructs a new quadtree for the specified array of points.
|
||||
*/
|
||||
quadtree(points: Array<Point>, x1: number, y1: number, x2: number, y2: number): Quadtree;
|
||||
quadtree(points: Point[], x1: number, y1: number, x2: number, y2: number): Quadtree;
|
||||
/**
|
||||
* Constructs a new quadtree for the specified array of points.
|
||||
*/
|
||||
quadtree(points: Array<Point>, width: number, height: number): Quadtree;
|
||||
quadtree(points: Point[], width: number, height: number): Quadtree;
|
||||
/**
|
||||
* Returns the input array of vertices with additional methods attached
|
||||
*/
|
||||
polygon(vertices:Array<Vertice>): Polygon;
|
||||
polygon(vertices:Vertice[]): Polygon;
|
||||
/**
|
||||
* creates a new hull layout with the default settings.
|
||||
*/
|
||||
hull(): Hull;
|
||||
|
||||
hull(vertices:Array<Vertice>): Array<Vertice>;
|
||||
hull(vertices:Vertice[]): Vertice[];
|
||||
}
|
||||
|
||||
export interface Vertice extends Array<number> {
|
||||
@@ -3316,7 +3229,7 @@ declare module D3 {
|
||||
/**
|
||||
* Returns a two-element array representing the centroid of this polygon.
|
||||
*/
|
||||
centroid(): Array<number>;
|
||||
centroid(): number[];
|
||||
/**
|
||||
* Clips the subject polygon against this polygon
|
||||
*/
|
||||
@@ -3331,11 +3244,11 @@ declare module D3 {
|
||||
/**
|
||||
* Constructs a new quadtree for the specified array of points.
|
||||
*/
|
||||
(points: Array<Point>, x1: number, y1: number, x2: number, y2: number): Quadtree;
|
||||
(points: Point[], x1: number, y1: number, x2: number, y2: number): Quadtree;
|
||||
/**
|
||||
* Constructs a new quadtree for the specified array of points.
|
||||
*/
|
||||
(points: Array<Point>, width: number, height: number): Quadtree;
|
||||
(points: Point[], width: number, height: number): Quadtree;
|
||||
|
||||
x: {
|
||||
(): (d: any) => any;
|
||||
@@ -3347,10 +3260,10 @@ declare module D3 {
|
||||
(accesor: (d: any) => any): QuadtreeFactory;
|
||||
|
||||
}
|
||||
size(): Array<number>;
|
||||
size(size: Array<number>): QuadtreeFactory;
|
||||
extent(): Array<Array<number>>;
|
||||
extent(points: Array<Array<number>>): QuadtreeFactory;
|
||||
size(): number[];
|
||||
size(size: number[]): QuadtreeFactory;
|
||||
extent(): number[][];
|
||||
extent(points: number[][]): QuadtreeFactory;
|
||||
}
|
||||
|
||||
export interface Quadtree {
|
||||
@@ -3370,15 +3283,15 @@ declare module D3 {
|
||||
/**
|
||||
* Compute the Voronoi diagram for the specified data.
|
||||
*/
|
||||
(data: Array<T>): Array<Polygon>;
|
||||
(data: T[]): Polygon[];
|
||||
/**
|
||||
* Compute the graph links for the Voronoi diagram for the specified data.
|
||||
*/
|
||||
links(data: Array<T>): Array<Layout.GraphLink>;
|
||||
links(data: T[]): Layout.GraphLink[];
|
||||
/**
|
||||
* Compute the triangles for the Voronoi diagram for the specified data.
|
||||
*/
|
||||
triangles(data: Array<T>): Array<Array<number>>;
|
||||
triangles(data: T[]): number[][];
|
||||
x: {
|
||||
/**
|
||||
* Get the x-coordinate accessor.
|
||||
@@ -3423,30 +3336,30 @@ declare module D3 {
|
||||
/**
|
||||
* Get the clip extent.
|
||||
*/
|
||||
(): Array<Array<number>>;
|
||||
(): number[][];
|
||||
/**
|
||||
* Set the clip extent.
|
||||
*
|
||||
* @param extent The new clip extent.
|
||||
*/
|
||||
(extent: Array<Array<number>>): Voronoi<T>;
|
||||
(extent: number[][]): Voronoi<T>;
|
||||
}
|
||||
size: {
|
||||
/**
|
||||
* Get the size.
|
||||
*/
|
||||
(): Array<number>;
|
||||
(): number[];
|
||||
/**
|
||||
* Set the size, equivalent to a clip extent starting from (0,0).
|
||||
*
|
||||
* @param size The new size.
|
||||
*/
|
||||
(size: Array<number>): Voronoi<T>;
|
||||
(size: number[]): Voronoi<T>;
|
||||
}
|
||||
}
|
||||
|
||||
export interface Hull {
|
||||
(vertices: Array<Vertice>): Array<Vertice>;
|
||||
(vertices: Vertice[]): Vertice[];
|
||||
x: {
|
||||
(): (d: any) => any;
|
||||
(accesor: (d: any) => any): any;
|
||||
@@ -3460,3 +3373,7 @@ declare module D3 {
|
||||
}
|
||||
|
||||
declare var d3: D3.Base;
|
||||
|
||||
declare module "d3" {
|
||||
export = d3;
|
||||
}
|
||||
|
||||
@@ -1 +1 @@
|
||||
""
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
""
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
""
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
""
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
""
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
""
|
||||
|
||||
|
||||
@@ -2,18 +2,18 @@
|
||||
|
||||
var browserClient = new Dropbox.Client({ key: "your-key-here" });
|
||||
|
||||
browserClient.authenticate(function (error, client) {
|
||||
browserClient.authenticate((error:any, client:Dropbox.Client) => {
|
||||
if (error) {
|
||||
alert(error);
|
||||
}
|
||||
|
||||
client.onError.addListener(function (error) {
|
||||
if (window.console) { // Skip the "if" in node.js code.
|
||||
client.onError.addListener((error:any) =>{
|
||||
if (window['console']) { // Skip the "if" in node.js code.
|
||||
console.error(error);
|
||||
}
|
||||
});
|
||||
|
||||
client.getAccountInfo(function (error, accountInfo) {
|
||||
client.getAccountInfo( (error:Dropbox.ApiError, accountInfo:Dropbox.AccountInfo) => {
|
||||
if (error) {
|
||||
alert(error); // Something went wrong.
|
||||
}
|
||||
@@ -21,7 +21,7 @@ browserClient.authenticate(function (error, client) {
|
||||
alert("Hello, " + accountInfo.name + "!");
|
||||
});
|
||||
|
||||
client.writeFile("hello_world.txt", "Hello, world!\n", function (error, stat) {
|
||||
client.writeFile("hello_world.txt", "Hello, world!\n", (error:Dropbox.ApiError, stat:Dropbox.File.Stat ) => {
|
||||
if (error) {
|
||||
alert(error); // Something went wrong.
|
||||
}
|
||||
@@ -29,7 +29,7 @@ browserClient.authenticate(function (error, client) {
|
||||
alert("File saved as revision " + stat.versionTag);
|
||||
});
|
||||
|
||||
client.readFile("hello_world.txt", function (error, data) {
|
||||
client.readFile("hello_world.txt", (error:Dropbox.ApiError, data:string) => {
|
||||
if (error) {
|
||||
alert(error); // Something went wrong.
|
||||
}
|
||||
@@ -37,12 +37,12 @@ browserClient.authenticate(function (error, client) {
|
||||
alert(data); // data has the file's contents
|
||||
});
|
||||
|
||||
client.readdir("/", function (error, entries) {
|
||||
client.readdir("/", (err: Dropbox.ApiError, filenames: string[], stat: Dropbox.File.Stat, folderEntries: Dropbox.File.Stat[]) => {
|
||||
if (error) {
|
||||
alert(error); // Something went wrong.
|
||||
}
|
||||
|
||||
alert("Your Dropbox contains " + entries.join(", "));
|
||||
alert("Your Dropbox contains " + filenames.join(", "));
|
||||
});
|
||||
});
|
||||
|
||||
@@ -51,4 +51,4 @@ var serverClient = new Dropbox.Client({
|
||||
secret: "your-secret-here"
|
||||
});
|
||||
|
||||
serverClient.authDriver(new Dropbox.AuthDriver.NodeServer(8191));
|
||||
serverClient.authDriver(new Dropbox.AuthDriver.NodeServer({port:8191}));
|
||||
Vendored
+477
-70
@@ -1,15 +1,368 @@
|
||||
// Type definitions for dropbox-js
|
||||
// Project: https://github.com/dropbox/dropbox-js
|
||||
// Definitions by: Steve Fenton <https://github.com/Steve-Fenton>
|
||||
// Definitions by: Steve Fenton <https://github.com/Steve-Fenton>, Pedro Casaubon <https://github.com/xperiments>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
|
||||
declare module Dropbox {
|
||||
export interface DropboxConfig {
|
||||
|
||||
|
||||
interface QueryParams {
|
||||
[key: string]: any;
|
||||
}
|
||||
interface Credentials {
|
||||
key: string;
|
||||
secret?: string;
|
||||
token?: string;
|
||||
uid?: string;
|
||||
}
|
||||
|
||||
export interface AccountInfoData {
|
||||
|
||||
/* Callbacks */
|
||||
|
||||
interface AuthenticateCallback {
|
||||
(err: ApiError, client: Client): void;
|
||||
(err: AuthError, client: Client): void;
|
||||
}
|
||||
|
||||
interface QueryParamsCallback {
|
||||
(queryParams: QueryParams): void;
|
||||
}
|
||||
|
||||
interface ClientFileReadCallback {
|
||||
|
||||
(err: ApiError, fileContents: string, stat: File.Stat, rangeInfo: Http.RangeInfo): void;
|
||||
}
|
||||
|
||||
interface ClientFileWriteCallback {
|
||||
|
||||
(err: ApiError, stat: File.Stat): void;
|
||||
}
|
||||
|
||||
interface ResumableUploadStepCallback {
|
||||
(err: ApiError, uploadCursor: Http.UploadCursor): void;
|
||||
}
|
||||
|
||||
interface ReadThumbnailCallback {
|
||||
(err: ApiError, imageData: string, stat: File.Stat): void;
|
||||
(err: ApiError, imageData: Blob, stat: File.Stat): void;
|
||||
}
|
||||
|
||||
interface FileStatCallback {
|
||||
(err: ApiError, stat: File.Stat): void;
|
||||
}
|
||||
|
||||
/* Options */
|
||||
|
||||
interface AuthenticateOptions {
|
||||
interactive: boolean;
|
||||
}
|
||||
|
||||
interface SingOutOptions {
|
||||
mustInvalidate: boolean;
|
||||
}
|
||||
|
||||
interface AccountInfoOptions {
|
||||
httpCache: boolean;
|
||||
}
|
||||
|
||||
interface ClientFileReadOptions {
|
||||
|
||||
versionTag?: string;
|
||||
rev?: string;
|
||||
arrayBuffer?: boolean;
|
||||
blob?: boolean;
|
||||
buffer?: boolean;
|
||||
binary?: boolean;
|
||||
length?: number;
|
||||
start?: number;
|
||||
httpCache?: boolean;
|
||||
}
|
||||
|
||||
interface ClientFileWriteOptions {
|
||||
lastVersionTag?: string;
|
||||
parentRev?: string;
|
||||
noOverwrite?: boolean;
|
||||
}
|
||||
|
||||
interface ReadDirOptions {
|
||||
removed?: boolean;
|
||||
deleted?: boolean;
|
||||
limit?: any;
|
||||
versionTag?: string;
|
||||
contentHash?: string;
|
||||
httpCache?: boolean;
|
||||
}
|
||||
|
||||
interface MakeURLOptions {
|
||||
download?: boolean;
|
||||
downloadHack?: boolean;
|
||||
long?: boolean;
|
||||
longUrl?: boolean;
|
||||
}
|
||||
|
||||
interface HistoryOptions {
|
||||
limit?: number;
|
||||
httpCache?: boolean;
|
||||
|
||||
}
|
||||
|
||||
interface ThumbnailUrlOptions {
|
||||
png?: boolean;
|
||||
format?: string;
|
||||
size?: string;
|
||||
}
|
||||
|
||||
interface ReadThumbnailOptions extends ThumbnailUrlOptions {
|
||||
arrayBuffer?: boolean;
|
||||
blob?: boolean;
|
||||
buffer?: boolean;
|
||||
}
|
||||
|
||||
interface FindByNameOptions {
|
||||
limit?: number;
|
||||
removed?: boolean;
|
||||
deleted?: boolean;
|
||||
httpCache?: boolean;
|
||||
|
||||
}
|
||||
|
||||
interface RedirectOptions {
|
||||
redirectUrl?: string;
|
||||
redirectFile?: string;
|
||||
scope?: string;
|
||||
rememberUser?: boolean;
|
||||
}
|
||||
|
||||
module Util {
|
||||
|
||||
class EventSource {
|
||||
constructor(options: { cancelable: boolean });
|
||||
addListener(listener: (event: any) => void): EventSource;
|
||||
removeListener(listener: (event: any) => void): EventSource;
|
||||
dispatch(event: {}): boolean;
|
||||
}
|
||||
|
||||
class Oauth {
|
||||
static queryParamsFromUrl(url: string): QueryParams;
|
||||
static randomAuthStateParam(): string;
|
||||
checkAuthStateParam(stateParam: string): boolean;
|
||||
}
|
||||
|
||||
class Xhr {
|
||||
xhr: XMLHttpRequest;
|
||||
onError: (error: ApiError, callBack: (error: ApiError) => void) => void;
|
||||
|
||||
constructor(method: string, baseUrl: string);
|
||||
static urlEncode(obj: {}): string;
|
||||
static urlEncodeValue(obj: {}): string;
|
||||
static urlDecode(string: {}): QueryParams;
|
||||
|
||||
|
||||
setParams(params: QueryParams): Xhr;
|
||||
setCallback(callback: (err: ApiError, responseType: string, metadataHeader: {}, headers: {}) => void): Xhr;
|
||||
signWithOauth(oauth: Oauth, cacheFriendly: boolean): Xhr;
|
||||
addOauthParams(oauth: Oauth): Xhr;
|
||||
addOauthHeader(oauth: Oauth): Xhr;
|
||||
|
||||
setBody(body: string): Xhr;
|
||||
setBody(body: Blob): Xhr;
|
||||
setBody(body: ArrayBuffer): Xhr;
|
||||
|
||||
setResponseType(responseType: string): Xhr;
|
||||
setHeader(headerName: string, value: string): Xhr;
|
||||
reportResponseHeaders(): Xhr;
|
||||
setFileField(fieldName: string, fileName: string, fileData: string, contentType?: string): void;
|
||||
setFileField(fieldName: string, fileName: string, fileData: Blob, contentType?: string): void;
|
||||
setFileField(fieldName: string, fileName: string, fileData: File, contentType?: string): void;
|
||||
prepare(): Xhr;
|
||||
send(callback: (err: ApiError, responseType: string, metadataHeader: {}) => void): Xhr;
|
||||
onReadyStateChange(): void;
|
||||
onXdrLoad(): void;
|
||||
onXdrError(): void;
|
||||
}
|
||||
}
|
||||
module Http {
|
||||
class AppInfo {
|
||||
static ICON_SMALL: number;
|
||||
static ICON_LARGE: number;
|
||||
static parse(appInfo: {}, appKey?: string): AppInfo;
|
||||
name: string;
|
||||
key: string;
|
||||
canUseDatastores: boolean;
|
||||
canUseFiles: boolean;
|
||||
hasAppFolder: boolean;
|
||||
canUseFullDropbox: boolean;
|
||||
icon(width: number, height?: number): void;
|
||||
}
|
||||
|
||||
class PollResult {
|
||||
static parse(response: {}): PollResult;
|
||||
hasChanges: boolean;
|
||||
retryAfter: number;
|
||||
}
|
||||
|
||||
class PulledChanges {
|
||||
static parse(deltaInfo: {}): PulledChanges;
|
||||
blankSlate: boolean;
|
||||
cursorTag: string;
|
||||
shouldPullAgain: boolean;
|
||||
shouldBackOff: boolean;
|
||||
cursor(): string;
|
||||
}
|
||||
|
||||
class PulledChange {
|
||||
static parse(entry: {}): PulledChange;
|
||||
path: string;
|
||||
wasRemoved: boolean;
|
||||
stat: File.Stat;
|
||||
}
|
||||
|
||||
class RangeInfo {
|
||||
static parse(headerValue: string): RangeInfo;
|
||||
start: number;
|
||||
size: number;
|
||||
end: number;
|
||||
}
|
||||
|
||||
class UploadCursor {
|
||||
static parse(cursorData: string): UploadCursor;
|
||||
static parse(cursorData: {}): UploadCursor;
|
||||
constructor(cursorData: string);
|
||||
constructor(cursorData: {});
|
||||
tag: string;
|
||||
offset: number;
|
||||
expiresAt: Date;
|
||||
toJSON(): {};
|
||||
}
|
||||
}
|
||||
module File {
|
||||
|
||||
interface StatOptions {
|
||||
version: number;
|
||||
removed: boolean;
|
||||
deleted: boolean;
|
||||
readDir: boolean;
|
||||
versionTag: string;
|
||||
rev: string;
|
||||
contentHash: string;
|
||||
hash: string;
|
||||
httpCache: boolean;
|
||||
}
|
||||
|
||||
class ShareUrl {
|
||||
static parse(urlData: string, isDirect: boolean): ShareUrl;
|
||||
static parse(urlData: {}, isDirect: boolean): ShareUrl;
|
||||
url: string;
|
||||
expiresAt: Date;
|
||||
isDirect: boolean;
|
||||
isPreview: boolean;
|
||||
toJSON(): {};
|
||||
}
|
||||
|
||||
class CopyReference {
|
||||
static parse(refData: string): CopyReference;
|
||||
static parse(refData: {}): CopyReference;
|
||||
tag: string;
|
||||
expiresAt: Date;
|
||||
toJSON(): {};
|
||||
}
|
||||
|
||||
class Stat {
|
||||
static parse(metadata: {}): Stat;
|
||||
path: string;
|
||||
name: string;
|
||||
inAppFolder: boolean;
|
||||
isFolder: boolean;
|
||||
isFile: boolean;
|
||||
isRemoved: boolean;
|
||||
typeIcon: string;
|
||||
versionTag: string;
|
||||
contentHash: string;
|
||||
mimeType: string;
|
||||
size: number;
|
||||
humanSize: string;
|
||||
hasThumbnail: boolean;
|
||||
modifiedAt: Date;
|
||||
clientModifiedAt: Date;
|
||||
toJSON(): {};
|
||||
}
|
||||
}
|
||||
module AuthDriver {
|
||||
|
||||
/** Do not use class! TypeScript definition implementation detail : https://github.com/Microsoft/TypeScript/issues/371 */
|
||||
class IAuthDriver {
|
||||
doAuthorize(authUrl: string, stateParam: string, client: Client, callback?: QueryParamsCallback): void;
|
||||
}
|
||||
|
||||
class BrowserBase {
|
||||
static localStorage(): Storage;
|
||||
static currentLocation(): string;
|
||||
static cleanupLocation(): void;
|
||||
|
||||
constructor(options: { scope: string; rememberUser: boolean });
|
||||
authType(): string;
|
||||
onAuthStepChange(client: Client, callback: () => void): void;
|
||||
locationStateParam(url: string): string;
|
||||
}
|
||||
|
||||
class Redirect {
|
||||
constructor(options?: { redirectUrl: string; redirectFile: string; scope: string; rememberUser: boolean });
|
||||
url(): string;
|
||||
doAuthorize(authUrl: string, stateParam: string, client: Client): void;
|
||||
resumeAuthorize(stateParam: string, client: Client, callback: QueryParamsCallback): void;
|
||||
|
||||
}
|
||||
|
||||
class Popup extends IAuthDriver {
|
||||
static locationOrigin(location: string): string;
|
||||
static oauthReceiver(): void;
|
||||
constructor(options?: RedirectOptions);
|
||||
url(): string;
|
||||
|
||||
}
|
||||
|
||||
class ChromeApp extends IAuthDriver {
|
||||
constructor(options?: { scope: string });
|
||||
}
|
||||
|
||||
class ChromeExtension extends IAuthDriver {
|
||||
static oauthReceiver(): void;
|
||||
constructor(options?: { scope: string; receiverPath: string });
|
||||
}
|
||||
|
||||
class Cordova extends IAuthDriver {
|
||||
static oauthReceiver(): void;
|
||||
constructor(options?: { scope: string; receiverPath: string });
|
||||
url(): string;
|
||||
}
|
||||
|
||||
class NodeServer extends IAuthDriver {
|
||||
constructor(options?: { port: number; tls?: {} });
|
||||
authType(): string;
|
||||
url(): string;
|
||||
openBrowser(url: string): void;
|
||||
createApp(): void;
|
||||
closeServer(): void;
|
||||
|
||||
// TODO check request response types
|
||||
doRequest(request:any, response:any): void;
|
||||
closeBrowser(response:any): void;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class AuthDriver {
|
||||
authType(): string;
|
||||
url(): string;
|
||||
doAuthorize(authUrl: string, stateParam: string, client: Client, callback: QueryParamsCallback): void;
|
||||
getStateParam(client: Client, callback: (state: string) => void): void;
|
||||
resumeAuthorize(stateParam: string, client: Client, callback: QueryParamsCallback): void;
|
||||
onAuthStepChange(client: Client, callback: () => void): void;
|
||||
}
|
||||
|
||||
class AccountInfo {
|
||||
static parse(acountInfo: {}): AccountInfo;
|
||||
name: string;
|
||||
email: string;
|
||||
countryCode: string;
|
||||
@@ -20,82 +373,136 @@ declare module Dropbox {
|
||||
usedQuota: number;
|
||||
privateBytes: number;
|
||||
sharedBytes: number;
|
||||
json(): {};
|
||||
}
|
||||
|
||||
export interface AccountInfo extends AccountInfoData {
|
||||
parse(accountInfo: string): AccountInfo;
|
||||
json(): AccountInfoData;
|
||||
class ApiError {
|
||||
status: number;
|
||||
method: string;
|
||||
url: string;
|
||||
responseText: string;
|
||||
response: {};
|
||||
|
||||
constructor(xhr: XMLHttpRequest, method: string, url: string);
|
||||
|
||||
static NETWORK_ERROR: number;
|
||||
static NO_CONTENT: number;
|
||||
static INVALID_PARAM: number;
|
||||
static INVALID_TOKEN: number;
|
||||
static OAUTH_ERROR: number;
|
||||
static NOT_FOUND: number;
|
||||
static INVALID_METHOD: number;
|
||||
static NOT_ACCEPTABLE: number;
|
||||
static CONFLICT: number;
|
||||
static RATE_LIMITED: number;
|
||||
static SERVER_ERROR: number;
|
||||
static OVER_QUOTA: number;
|
||||
}
|
||||
|
||||
export interface ApiError {
|
||||
INVALID_TOKEN: number;
|
||||
NOT_FOUND: number;
|
||||
OVER_QUOTA: number;
|
||||
RATE_LIMITED: number;
|
||||
NETWORK_ERROR: number;
|
||||
INVALID_PARAM: number;
|
||||
OAUTH_ERROR: number;
|
||||
INVALID_METHOD: number;
|
||||
class AuthError {
|
||||
|
||||
code: string;
|
||||
description: string;
|
||||
uri: string;
|
||||
constructor(queryString: QueryParams);
|
||||
|
||||
static ACCESS_DENIED: string;
|
||||
static INVALID_REQUEST: string;
|
||||
static UNAUTHORIZED_CLIENT: string;
|
||||
static INVALID_GRANT: string;
|
||||
static INVALID_SCOPE: string;
|
||||
static UNSUPPORTED_GRANT_TYPE: string;
|
||||
static UNSUPPORTED_RESPONSE_TYPE: string;
|
||||
static SERVER_ERROR: string;
|
||||
static TEMPORARILY_UNAVAILABLE: string;
|
||||
}
|
||||
|
||||
export interface FileStatisticsData {
|
||||
path: string;
|
||||
name: string;
|
||||
inAppFolder: boolean;
|
||||
isFolder: boolean;
|
||||
isFile: boolean;
|
||||
isRemoved: boolean;
|
||||
typeIcon: string;
|
||||
versionTag: string;
|
||||
contentHash: string;
|
||||
mimeType: string;
|
||||
size: number;
|
||||
humanSize: string;
|
||||
hasThumbnail: boolean;
|
||||
modifiedAt: Date;
|
||||
clientModifiedAt: Date;
|
||||
}
|
||||
class Client {
|
||||
static ERROR: number;
|
||||
static RESET: number;
|
||||
static PARAM_SET: number;
|
||||
static PARAM_LOADED: number;
|
||||
static AUTHORIZED: number;
|
||||
static DONE: number;
|
||||
static SIGNED_OUT: number;
|
||||
|
||||
export interface FileStatistics extends FileStatisticsData {
|
||||
parse(stats: string): FileStatistics;
|
||||
json(): FileStatisticsData;
|
||||
}
|
||||
onXhr: Util.EventSource;
|
||||
onError: Util.EventSource;
|
||||
onAuthStepChange: Util.EventSource;
|
||||
authStep: number;
|
||||
|
||||
export interface ClientOnError {
|
||||
addListener(callback: (error: number) => any): void;
|
||||
}
|
||||
|
||||
export interface Client {
|
||||
new (config: DropboxConfig): Client;
|
||||
authDriver(authDriver: any): Client;
|
||||
authenticate(callback: (error: number, client: Client) => any): Client;
|
||||
credentials(): string;
|
||||
constructor(options: Credentials);
|
||||
authDriver(driver: AuthDriver.IAuthDriver): Client;
|
||||
dropboxUid(): string;
|
||||
credentials(): Credentials;
|
||||
|
||||
// TODO check the error interface
|
||||
authenticate(): Client;
|
||||
authenticate(callback: AuthenticateCallback): Client;
|
||||
authenticate(options: AuthenticateOptions): Client;
|
||||
authenticate(options: AuthenticateOptions, callback: AuthenticateCallback): Client;
|
||||
isAuthenticated(): boolean;
|
||||
onError: ClientOnError;
|
||||
getAccountInfo(callback: (error: number, accountInfo: AccountInfo) => any): XMLHttpRequest;
|
||||
getUserInfo(callback: (error: number, accountInfo: AccountInfo) => any): XMLHttpRequest;
|
||||
signOut(options: {}, callback: (error: number) => any): XMLHttpRequest;
|
||||
signOff(options: {}, callback: (error: number) => any): XMLHttpRequest;
|
||||
writeFile(fileName: string, contents: string, options: {}, callback: (error: number, stats: FileStatistics) => any): XMLHttpRequest;
|
||||
writeFile(fileName: string, contents: string, callback: (error: number, stats: FileStatistics) => any): XMLHttpRequest;
|
||||
readFile(fileName: string, options: {}, callback: (error: number, contents: string, stats: FileStatistics) => any): XMLHttpRequest;
|
||||
readFile(fileName: string, callback: (error: number, contents: string, stats: FileStatistics) => any): XMLHttpRequest;
|
||||
stat(path: string, options: {}, callback: (error: number, stats: FileStatistics) => any): XMLHttpRequest;
|
||||
stat(path: string, callback: (error: number, stats: FileStatistics) => any): XMLHttpRequest;
|
||||
metadata(path: string, options: {}, callback: (error: number, stats: FileStatistics) => any): XMLHttpRequest;
|
||||
metadata(path: string, callback: (error: number, stats: FileStatistics) => any): XMLHttpRequest;
|
||||
readdir(path: string, options: {}, callback: (error: number, entries: any[]) => any): XMLHttpRequest;
|
||||
readdir(path: string, callback: (error: number, entries: any[]) => any): XMLHttpRequest;
|
||||
signOut(callback: (err: ApiError) => void): XMLHttpRequest;
|
||||
signOut(options: SingOutOptions, callback: (err: ApiError) => void): XMLHttpRequest;
|
||||
signOff(callback: (err: ApiError) => void): void;
|
||||
signOff(options: SingOutOptions, callback: (err: ApiError) => void): void;
|
||||
getAccountInfo(callback: (err: ApiError, accountInfo: AccountInfo, AccountInfo: AccountInfo) => void): XMLHttpRequest;
|
||||
getAccountInfo(options: AccountInfoOptions, callback: (err: ApiError, accountInfo: AccountInfo, AccountInfo: AccountInfo) => void): XMLHttpRequest;
|
||||
readFile(path: string, callback: ClientFileReadCallback): XMLHttpRequest;
|
||||
readFile(path: string, options: ClientFileReadOptions, callback: ClientFileReadCallback): XMLHttpRequest;
|
||||
writeFile(path: string, data: any, callback: ClientFileWriteCallback): XMLHttpRequest;
|
||||
writeFile(path: string, data: any, options: ClientFileWriteOptions, callback: ClientFileWriteCallback): XMLHttpRequest;
|
||||
resumableUploadStep(data: any, callback: ResumableUploadStepCallback): XMLHttpRequest;
|
||||
resumableUploadStep(data: any, cursor: Http.UploadCursor, callback: ResumableUploadStepCallback): XMLHttpRequest;
|
||||
resumableUploadFinish(path: string, cursor: Http.UploadCursor, callback: ClientFileWriteCallback): XMLHttpRequest;
|
||||
resumableUploadFinish(path: string, cursor: Http.UploadCursor, options: ClientFileWriteOptions, callback: ClientFileWriteCallback): XMLHttpRequest;
|
||||
stat(path: string, callback: (err: ApiError, stat: File.Stat, folderEntries: File.Stat[]) => void): XMLHttpRequest;
|
||||
stat(path: string, options: File.StatOptions, callback: (err: ApiError, stat: File.Stat, folderEntries: File.Stat[]) => void): XMLHttpRequest;
|
||||
readdir(path: string, callback: (err: ApiError, filenames: string[], stat: File.Stat, folderEntries: File.Stat[]) => void): XMLHttpRequest;
|
||||
readdir(path: string, options: ReadDirOptions, callback: (err: ApiError, filenames: string[], stat: File.Stat, folderEntries: File.Stat[]) => void): XMLHttpRequest;
|
||||
metadata(path: string, callback: (err: ApiError, stat: File.Stat, folderEntries: File.Stat[]) => void): void;
|
||||
metadata(path: string, options: File.StatOptions, callback: (err: ApiError, stat: File.Stat, folderEntries: File.Stat[]) => void): void;
|
||||
makeUrl(path: string, callback: (err: ApiError, shareUrl: File.ShareUrl) => void): XMLHttpRequest;
|
||||
makeUrl(path: string, options: MakeURLOptions, callback: (err: ApiError, shareUrl: File.ShareUrl) => void): XMLHttpRequest;
|
||||
history(path: string, callback: (err: ApiError, fileVersions: File.Stat[]) => void): XMLHttpRequest;
|
||||
history(path: string, options: HistoryOptions, callback: (err: ApiError, fileVersions: File.Stat[]) => void): XMLHttpRequest;
|
||||
revisions(path: string, options: HistoryOptions, callback: (err: ApiError, fileVersions: File.Stat[]) => void): void;
|
||||
thumbnailUrl(path: string, options?: ThumbnailUrlOptions): string;
|
||||
readThumbnail(path: string, callback: ReadThumbnailCallback): XMLHttpRequest;
|
||||
readThumbnail(path: string, options: ReadThumbnailOptions, callback: ReadThumbnailCallback): XMLHttpRequest;
|
||||
revertFile(path: string, versionTag: string, callback: FileStatCallback): XMLHttpRequest;
|
||||
restore(path: string, versionTag: string, callback: FileStatCallback): void;
|
||||
findByName(path: string, namePattern: string, callback: (err: ApiError, resultStats: File.Stat[]) => void): XMLHttpRequest;
|
||||
findByName(path: string, namePattern: string, options: FindByNameOptions, callback: (err: ApiError, resultStats: File.Stat[]) => void): XMLHttpRequest;
|
||||
search(path: string, namePattern: string, options: FindByNameOptions, callback: (err: ApiError, resultStats: File.Stat[]) => void): void;
|
||||
makeCopyReference(path: string, callback: (err: ApiError, copyReference: File.CopyReference) => void): XMLHttpRequest;
|
||||
copyRef(path: string, callback: (err: ApiError, copyReference: File.CopyReference) => void): XMLHttpRequest;
|
||||
pullChanges(callback: (err: ApiError, changes: Http.PulledChanges) => void): XMLHttpRequest;
|
||||
pullChanges(cursor: string, callback: (err: ApiError, changes: Http.PulledChanges) => void): XMLHttpRequest;
|
||||
pullChanges(cursor: Http.PulledChanges, callback: (err: ApiError, changes: Http.PulledChanges) => void): XMLHttpRequest;
|
||||
delta(cursor: string, callback: (err: ApiError, changes: Http.PulledChanges) => void): void;
|
||||
delta(cursor: Http.PulledChanges, callback: (err: ApiError, changes: Http.PulledChanges) => void): void;
|
||||
pollForChanges(cursor: string, options: {}, callback: (err: ApiError, changes: Http.PollResult) => void): void;
|
||||
pollForChanges(cursor: Http.PulledChanges, options: {}, callback: (err: ApiError, changes: Http.PollResult) => void): void;
|
||||
mkdir(path: string, callback: FileStatCallback): XMLHttpRequest;
|
||||
remove(path: string, callback: FileStatCallback): XMLHttpRequest;
|
||||
unlink(path: string, callback: FileStatCallback): void;
|
||||
delete(path: string, callback: FileStatCallback): void;
|
||||
copy(from: string, toPath: string, callback: FileStatCallback): XMLHttpRequest;
|
||||
copy(from: File.CopyReference, toPath: string, callback: FileStatCallback): XMLHttpRequest;
|
||||
move(fromPath: string, toPath: string, callback: FileStatCallback): XMLHttpRequest;
|
||||
appInfo(callback: (err: ApiError, changes: Http.AppInfo) => void): XMLHttpRequest;
|
||||
appInfo(appKey: string, callback: (err: ApiError, changes: Http.AppInfo) => void): XMLHttpRequest;
|
||||
|
||||
// TODO check if this can better be described
|
||||
isAppDeveloper(userId:any, callbackcallback: (err: ApiError, isAppDeveloper: boolean) => void): XMLHttpRequest;
|
||||
isAppDeveloper(userId:any, appKey:any, callbackcallback: (err: ApiError, isAppDeveloper: boolean) => void): XMLHttpRequest;
|
||||
hasOauthRedirectUri(redirectUri: string, callback: (err: ApiError, hasOauthRedirectUri: boolean) => void): XMLHttpRequest;
|
||||
hasOauthRedirectUri(redirectUri: string, appKey: string, callback: (err: ApiError, hasOauthRedirectUri: boolean) => void): XMLHttpRequest;
|
||||
hasOauthRedirectUri(redirectUri: string, appKey: Http.AppInfo, callback: (err: ApiError, hasOauthRedirectUri: boolean) => void): XMLHttpRequest;
|
||||
reset(): Client;
|
||||
setCredentials(credentials: Credentials): Client;
|
||||
appHash(): string;
|
||||
|
||||
}
|
||||
|
||||
export module AuthDriver {
|
||||
export interface NodeServer {
|
||||
new (port: number): any;
|
||||
}
|
||||
|
||||
export var NodeServer: NodeServer;
|
||||
}
|
||||
|
||||
export var Client: Client;
|
||||
}
|
||||
|
||||
Vendored
+16
@@ -72,6 +72,22 @@ declare class Dropzone {
|
||||
getRejectedFiles(): DropzoneFile[];
|
||||
getQueuedFiles(): DropzoneFile[];
|
||||
getUploadingFiles(): DropzoneFile[];
|
||||
|
||||
emit(eventName: string, file: DropzoneFile, str?: string);
|
||||
emit(eventName: "thumbnail", file: DropzoneFile, path: string);
|
||||
emit(eventName: "addedfile", file: DropzoneFile);
|
||||
emit(eventName: "removedfile", file: DropzoneFile);
|
||||
emit(eventName: "processing", file: DropzoneFile);
|
||||
emit(eventName: "canceled", file: DropzoneFile);
|
||||
emit(eventName: "complete", file: DropzoneFile);
|
||||
|
||||
emit(eventName: string, e: Event);
|
||||
emit(eventName: "drop", e: Event);
|
||||
emit(eventName: "dragstart", e: Event);
|
||||
emit(eventName: "dragend", e: Event);
|
||||
emit(eventName: "dragenter", e: Event);
|
||||
emit(eventName: "dragover", e: Event);
|
||||
emit(eventName: "dragleave", e: Event);
|
||||
}
|
||||
|
||||
interface JQuery {
|
||||
|
||||
@@ -1 +1 @@
|
||||
""
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
""
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
""
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
""
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
""
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
""
|
||||
|
||||
|
||||
Vendored
+162
-159
@@ -11,12 +11,15 @@ declare var Handlebars: HandlebarsStatic;
|
||||
declare module EmberStates {
|
||||
|
||||
interface Transition {
|
||||
abort(): void;
|
||||
addInitialStates(): void;
|
||||
matchContextsToStates(contexts: any[]): void;
|
||||
normalize(manager: Ember.StateManager, contexts: any[]): void;
|
||||
removeUnchangedContexts(manager: Ember.StateManager): void;
|
||||
retry(): void;
|
||||
sendEvents(eventName: string, sendRecursiveArguments: boolean, isUnhandledPass: boolean): void;
|
||||
sendRecursively(event: string, currentState: Ember.State, isUnhandledPass: boolean): void;
|
||||
targetName: string;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -38,10 +41,10 @@ declare module EmberTesting {
|
||||
}
|
||||
|
||||
interface Function {
|
||||
observes(...string): Function;
|
||||
observesBefore(...string): Function;
|
||||
on(...string): Function;
|
||||
property(...string): Function;
|
||||
observes(...args: string[]): Function;
|
||||
observesBefore(...args: string[]): Function;
|
||||
on(...args: string[]): Function;
|
||||
property(...args: string[]): Function;
|
||||
}
|
||||
|
||||
interface String {
|
||||
@@ -50,9 +53,9 @@ interface String {
|
||||
classify(): string;
|
||||
dasherize(): string;
|
||||
decamelize(): string;
|
||||
fmt(...string): string;
|
||||
fmt(...args: string[]): string;
|
||||
htmlSafe(): typeof Handlebars.SafeString;
|
||||
loc(...string): string;
|
||||
loc(...args: string[]): string;
|
||||
underscore(): string;
|
||||
w(): string[];
|
||||
}
|
||||
@@ -70,14 +73,14 @@ interface Array<T> {
|
||||
clear(): any[];
|
||||
compact(): any[];
|
||||
contains(obj: any): boolean;
|
||||
enumerableContentDidChange(start: number, removing: number, adding: number);
|
||||
enumerableContentDidChange(start: number, removing: Ember.Enumerable, adding: number);
|
||||
enumerableContentDidChange(start: number, removing: number, adding: Ember.Enumerable);
|
||||
enumerableContentDidChange(start: number, removing: Ember.Enumerable, adding: Ember.Enumerable);
|
||||
enumerableContentDidChange(removing: number, adding: number);
|
||||
enumerableContentDidChange(removing: Ember.Enumerable, adding: number);
|
||||
enumerableContentDidChange(removing: number, adding: Ember.Enumerable);
|
||||
enumerableContentDidChange(removing: Ember.Enumerable, adding: Ember.Enumerable);
|
||||
enumerableContentDidChange(start: number, removing: number, adding: number): any;
|
||||
enumerableContentDidChange(start: number, removing: Ember.Enumerable, adding: number): any;
|
||||
enumerableContentDidChange(start: number, removing: number, adding: Ember.Enumerable): any;
|
||||
enumerableContentDidChange(start: number, removing: Ember.Enumerable, adding: Ember.Enumerable): any;
|
||||
enumerableContentDidChange(removing: number, adding: number): any;
|
||||
enumerableContentDidChange(removing: Ember.Enumerable, adding: number): any;
|
||||
enumerableContentDidChange(removing: number, adding: Ember.Enumerable): any;
|
||||
enumerableContentDidChange(removing: Ember.Enumerable, adding: Ember.Enumerable): any;
|
||||
enumerableContentWillChange(removing: number, adding: number): any[];
|
||||
enumerableContentWillChange(removing: Ember.Enumerable, adding: number): any[];
|
||||
enumerableContentWillChange(removing: number, adding: Ember.Enumerable): any[];
|
||||
@@ -93,15 +96,15 @@ interface Array<T> {
|
||||
getEach(key: string): any[];
|
||||
indexOf(object: any, startAt: number): number;
|
||||
insertAt(idx: number, object: any): any[];
|
||||
invoke(methodName: string, ...any): any[];
|
||||
invoke(methodName: string, ...args: any[]): any[];
|
||||
lastIndexOf(object: any, startAt: number): number;
|
||||
mapBy(key: string): any[];
|
||||
nextObject(index: number, previousObject: any, context: any): any;
|
||||
objectAt(idx: number): any;
|
||||
objectsAt(...number): any[];
|
||||
objectsAt(...args: number[]): any[];
|
||||
popObject(): any;
|
||||
pushObject(obj: any): any;
|
||||
pushObjects(...any): any[];
|
||||
pushObjects(...args: any[]): any[];
|
||||
reduce(callback: ReduceCallback, initialValue: any, reducerProperty: string): any;
|
||||
reject: ItemIndexEnumerableCallbackTarget;
|
||||
rejectBy(key: string, value?: string): any[];
|
||||
@@ -136,7 +139,7 @@ interface Array<T> {
|
||||
decrementProperty(keyName: string, decrement?: number): number;
|
||||
endPropertyChanges(): any[];
|
||||
get(keyName: string): any;
|
||||
getProperties(...string): {};
|
||||
getProperties(...args: string[]): {};
|
||||
getProperties(keys: string[]): {};
|
||||
getWithDefault(keyName: string, defaultValue: any): any;
|
||||
hasObserverFor(key: string): boolean;
|
||||
@@ -190,8 +193,8 @@ interface CoreObjectArguments {
|
||||
}
|
||||
|
||||
interface EnumerableConfigurationOptions {
|
||||
willChange? ;
|
||||
didChange? ;
|
||||
willChange?: boolean ;
|
||||
didChange?: boolean ;
|
||||
}
|
||||
|
||||
interface ItemIndexEnumerableCallbackTarget {
|
||||
@@ -365,14 +368,14 @@ declare module Ember {
|
||||
someProperty(key: string, value?: string): boolean;
|
||||
compact(): any[];
|
||||
contains(obj: any): boolean;
|
||||
enumerableContentDidChange(start: number, removing: number, adding: number);
|
||||
enumerableContentDidChange(start: number, removing: Enumerable, adding: number);
|
||||
enumerableContentDidChange(start: number, removing: number, adding: Enumerable);
|
||||
enumerableContentDidChange(start: number, removing: Enumerable, adding: Enumerable);
|
||||
enumerableContentDidChange(removing: number, adding: number);
|
||||
enumerableContentDidChange(removing: Enumerable, adding: number);
|
||||
enumerableContentDidChange(removing: number, adding: Enumerable);
|
||||
enumerableContentDidChange(removing: Enumerable, adding: Enumerable);
|
||||
enumerableContentDidChange(start: number, removing: number, adding: number): any;
|
||||
enumerableContentDidChange(start: number, removing: Enumerable, adding: number): any;
|
||||
enumerableContentDidChange(start: number, removing: number, adding: Enumerable): any;
|
||||
enumerableContentDidChange(start: number, removing: Enumerable, adding: Enumerable): any;
|
||||
enumerableContentDidChange(removing: number, adding: number): any;
|
||||
enumerableContentDidChange(removing: Enumerable, adding: number): any;
|
||||
enumerableContentDidChange(removing: number, adding: Enumerable): any;
|
||||
enumerableContentDidChange(removing: Enumerable, adding: Enumerable): any;
|
||||
enumerableContentWillChange(removing: number, adding: number): Enumerable;
|
||||
enumerableContentWillChange(removing: Enumerable, adding: number): Enumerable;
|
||||
enumerableContentWillChange(removing: number, adding: Enumerable): Enumerable;
|
||||
@@ -387,13 +390,13 @@ declare module Ember {
|
||||
forEach(callback: Function, target?: any): any;
|
||||
getEach(key: string): any[];
|
||||
indexOf(object: any, startAt: number): number;
|
||||
invoke(methodName: string, ...any): any[];
|
||||
invoke(methodName: string, ...args: any[]): any[];
|
||||
lastIndexOf(object: any, startAt: number): number;
|
||||
map: ItemIndexEnumerableCallbackTarget;
|
||||
mapBy(key: string): any[];
|
||||
nextObject(index: number, previousObject: any, context: any): any;
|
||||
objectAt(idx: number): any;
|
||||
objectsAt(...number): any[];
|
||||
objectsAt(...args: number[]): any[];
|
||||
reduce(callback: ReduceCallback, initialValue: any, reducerProperty: string): any;
|
||||
reject: ItemIndexEnumerableCallbackTarget;
|
||||
rejectBy(key: string, value?: string): any[];
|
||||
@@ -405,9 +408,9 @@ declare module Ember {
|
||||
toArray(): any[];
|
||||
uniq(): Enumerable;
|
||||
without(value: any): Enumerable;
|
||||
'@each': EachProxy;
|
||||
'@each': EachProxy;
|
||||
Boolean: boolean;
|
||||
'[]': any[];
|
||||
'[]': any[];
|
||||
firstObject: any;
|
||||
hasEnumerableObservers: boolean;
|
||||
lastObject: any;
|
||||
@@ -438,8 +441,8 @@ declare module Ember {
|
||||
sortAscending: boolean;
|
||||
sortFunction: Comparable;
|
||||
sortProperties: any[];
|
||||
replaceRoute(name: string, ...any);
|
||||
transitionToRoute(name: string, ...any);
|
||||
replaceRoute(name: string, ...args: any[]): void;
|
||||
transitionToRoute(name: string, ...args: any[]): void;
|
||||
controllers: {};
|
||||
needs: string[];
|
||||
target: any;
|
||||
@@ -482,14 +485,14 @@ declare module Ember {
|
||||
clear(): any[];
|
||||
compact(): any[];
|
||||
contains(obj: any): boolean;
|
||||
enumerableContentDidChange(start: number, removing: number, adding: number);
|
||||
enumerableContentDidChange(start: number, removing: Enumerable, adding: number);
|
||||
enumerableContentDidChange(start: number, removing: number, adding: Enumerable);
|
||||
enumerableContentDidChange(start: number, removing: Enumerable, adding: Enumerable);
|
||||
enumerableContentDidChange(removing: number, adding: number);
|
||||
enumerableContentDidChange(removing: Enumerable, adding: number);
|
||||
enumerableContentDidChange(removing: number, adding: Enumerable);
|
||||
enumerableContentDidChange(removing: Enumerable, adding: Enumerable);
|
||||
enumerableContentDidChange(start: number, removing: number, adding: number): any;
|
||||
enumerableContentDidChange(start: number, removing: Enumerable, adding: number): any;
|
||||
enumerableContentDidChange(start: number, removing: number, adding: Enumerable): any;
|
||||
enumerableContentDidChange(start: number, removing: Enumerable, adding: Enumerable): any;
|
||||
enumerableContentDidChange(removing: number, adding: number): any;
|
||||
enumerableContentDidChange(removing: Enumerable, adding: number): any;
|
||||
enumerableContentDidChange(removing: number, adding: Enumerable): any;
|
||||
enumerableContentDidChange(removing: Enumerable, adding: Enumerable): any;
|
||||
enumerableContentWillChange(removing: number, adding: number): any[];
|
||||
enumerableContentWillChange(removing: Enumerable, adding: number): any[];
|
||||
enumerableContentWillChange(removing: number, adding: Enumerable): any[];
|
||||
@@ -505,24 +508,24 @@ declare module Ember {
|
||||
getEach(key: string): any[];
|
||||
indexOf(object: any, startAt: number): number;
|
||||
insertAt(idx: number, object: any): any[];
|
||||
invoke(methodName: string, ...any): any[];
|
||||
invoke(methodName: string, ...args: any[]): any[];
|
||||
lastIndexOf(object: any, startAt: number): number;
|
||||
map: ItemIndexEnumerableCallbackTarget;
|
||||
mapBy(key: string): any[];
|
||||
nextObject(index: number, previousObject: any, context: any): any;
|
||||
objectAt(idx: number): any;
|
||||
objectAtContent(idx: number): any;
|
||||
objectsAt(...number): any[];
|
||||
objectsAt(...args: number[]): any[];
|
||||
popObject(): any;
|
||||
pushObject(obj: any): any;
|
||||
pushObjects(...any): any[];
|
||||
pushObjects(...args: any[]): any[];
|
||||
reduce(callback: ReduceCallback, initialValue: any, reducerProperty: string): any;
|
||||
reject: ItemIndexEnumerableCallbackTarget;
|
||||
rejectBy(key: string, value?: string): any[];
|
||||
removeArrayObserver(target: any, opts: EnumerableConfigurationOptions): any[];
|
||||
removeAt(start: number, len: number): any;
|
||||
removeEnumerableObserver(target: any, opts: EnumerableConfigurationOptions): any[];
|
||||
replace(idx: number, amt: number, objects: any[]);
|
||||
replace(idx: number, amt: number, objects: any[]): any;
|
||||
replaceContent(idx: number, amt: number, objects: any[]): void;
|
||||
reverseObjects(): any[];
|
||||
setEach(key: string, value?: any): any;
|
||||
@@ -535,8 +538,8 @@ declare module Ember {
|
||||
unshiftObject(object: any): any;
|
||||
unshiftObjects(objects: any[]): any[];
|
||||
without(value: any): any[];
|
||||
'[]': any[];
|
||||
'@each': EachProxy;
|
||||
'[]': any[];
|
||||
'@each': EachProxy;
|
||||
Boolean: boolean;
|
||||
firstObject: any;
|
||||
hasEnumerableObservers: boolean;
|
||||
@@ -657,7 +660,7 @@ declare module Ember {
|
||||
cacheable(aFlag?: boolean): ComputedProperty;
|
||||
get(keyName: string): any;
|
||||
meta(meta: {}): ComputedProperty;
|
||||
property(...string): ComputedProperty;
|
||||
property(...args: string[]): ComputedProperty;
|
||||
readOnly(): ComputedProperty;
|
||||
set(keyName: string, newValue: any, oldValue: string): any;
|
||||
// ReSharper disable UsingOfReservedWord
|
||||
@@ -721,8 +724,8 @@ declare module Ember {
|
||||
Additional methods for the ControllerMixin.
|
||||
**/
|
||||
class ControllerMixin {
|
||||
replaceRoute(name: string, ...any): void;
|
||||
transitionToRoute(name: string, ...any): void;
|
||||
replaceRoute(name: string, ...args: any[]): void;
|
||||
transitionToRoute(name: string, ...args: any[]): void;
|
||||
controllers: {};
|
||||
needs: string[];
|
||||
target: any;
|
||||
@@ -879,14 +882,14 @@ declare module Ember {
|
||||
someProperty(key: string, value?: string): boolean;
|
||||
compact(): any[];
|
||||
contains(obj: any): boolean;
|
||||
enumerableContentDidChange(start: number, removing: number, adding: number);
|
||||
enumerableContentDidChange(start: number, removing: Enumerable, adding: number);
|
||||
enumerableContentDidChange(start: number, removing: number, adding: Enumerable);
|
||||
enumerableContentDidChange(start: number, removing: Enumerable, adding: Enumerable);
|
||||
enumerableContentDidChange(removing: number, adding: number);
|
||||
enumerableContentDidChange(removing: Enumerable, adding: number);
|
||||
enumerableContentDidChange(removing: number, adding: Enumerable);
|
||||
enumerableContentDidChange(removing: Enumerable, adding: Enumerable);
|
||||
enumerableContentDidChange(start: number, removing: number, adding: number): any;
|
||||
enumerableContentDidChange(start: number, removing: Enumerable, adding: number): any;
|
||||
enumerableContentDidChange(start: number, removing: number, adding: Enumerable): any;
|
||||
enumerableContentDidChange(start: number, removing: Enumerable, adding: Enumerable): any;
|
||||
enumerableContentDidChange(removing: number, adding: number): any;
|
||||
enumerableContentDidChange(removing: Enumerable, adding: number): any;
|
||||
enumerableContentDidChange(removing: number, adding: Enumerable): any;
|
||||
enumerableContentDidChange(removing: Enumerable, adding: Enumerable): any;
|
||||
enumerableContentWillChange(removing: number, adding: number): Enumerable;
|
||||
enumerableContentWillChange(removing: Enumerable, adding: number): Enumerable;
|
||||
enumerableContentWillChange(removing: number, adding: Enumerable): Enumerable;
|
||||
@@ -900,7 +903,7 @@ declare module Ember {
|
||||
findBy(key: string, value?: string): any;
|
||||
forEach(callback: Function, target?: any): any;
|
||||
getEach(key: string): any[];
|
||||
invoke(methodName: string, ...any): any[];
|
||||
invoke(methodName: string, ...args: any[]): any[];
|
||||
map: ItemIndexEnumerableCallbackTarget;
|
||||
mapBy(key: string): any[];
|
||||
nextObject(index: number, previousObject: any, context: any): any;
|
||||
@@ -913,7 +916,7 @@ declare module Ember {
|
||||
toArray(): any[];
|
||||
uniq(): Enumerable;
|
||||
without(value: any): Enumerable;
|
||||
'[]': any[];
|
||||
'[]': any[];
|
||||
firstObject: any;
|
||||
hasEnumerableObservers: boolean;
|
||||
lastObject: any;
|
||||
@@ -954,7 +957,7 @@ declare module Ember {
|
||||
off(name: string, target: any, method: Function): Evented;
|
||||
on(name: string, target: any, method: Function): Evented;
|
||||
one(name: string, target: any, method: Function): Evented;
|
||||
trigger(name: string, ...string): void;
|
||||
trigger(name: string, ...args: string[]): void;
|
||||
}
|
||||
var FROZEN_ERROR: string;
|
||||
class Freezable {
|
||||
@@ -996,19 +999,19 @@ declare module Ember {
|
||||
class Compiler { }
|
||||
class JavaScriptCompiler { }
|
||||
function registerHelper(name: string, fn: Function, inverse?: boolean): void;
|
||||
function registerPartial(name: string, str): void;
|
||||
function K();
|
||||
function createFrame(object);
|
||||
function registerPartial(name: string, str: any): void;
|
||||
function K(): any;
|
||||
function createFrame(objec: any): any;
|
||||
function Exception(message: string): void;
|
||||
class SafeString {
|
||||
constructor(str: string);
|
||||
static toString(): string;
|
||||
}
|
||||
function parse(string: string);
|
||||
function print(ast);
|
||||
var logger;
|
||||
function log(level, str): void;
|
||||
function compile(environment, options?, context?, asObject?);
|
||||
function parse(string: string): any;
|
||||
function print(ast: any): void;
|
||||
var logger: typeof Ember.Logger;
|
||||
function log(level: string, str: string): void;
|
||||
function compile(environment: any, options?: any, context?: any, asObject?: any): any;
|
||||
}
|
||||
class HashLocation extends Object {
|
||||
static detect(obj: any): boolean;
|
||||
@@ -1046,7 +1049,7 @@ declare module Ember {
|
||||
var IS_BINDING: RegExp;
|
||||
class Instrumentation {
|
||||
getProperties(obj: any, list: any[]): {};
|
||||
getProperties(obj: any, ...string): {};
|
||||
getProperties(obj: any, ...args: string[]): {};
|
||||
instrument(name: string, payload: any, callback: Function, binding: any): void;
|
||||
reset(): void;
|
||||
subscribe(pattern: string, object: any): void;
|
||||
@@ -1094,11 +1097,11 @@ declare module Ember {
|
||||
}
|
||||
var Logger: {
|
||||
assert(param: any): void;
|
||||
debug(...any): void;
|
||||
error(...any): void;
|
||||
info(...any): void;
|
||||
log(...any): void;
|
||||
warn(...any): void;
|
||||
debug(...args: any[]): void;
|
||||
error(...args: any[]): void;
|
||||
info(...args: any[]): void;
|
||||
log(...args: any[]): void;
|
||||
warn(...args: any[]): void;
|
||||
};
|
||||
function MANDATORY_SETTER_FUNCTION(value: string): void;
|
||||
var META_KEY: string;
|
||||
@@ -1137,14 +1140,14 @@ declare module Ember {
|
||||
clear(): any[];
|
||||
compact(): any[];
|
||||
contains(obj: any): boolean;
|
||||
enumerableContentDidChange(start: number, removing: number, adding: number);
|
||||
enumerableContentDidChange(start: number, removing: Enumerable, adding: number);
|
||||
enumerableContentDidChange(start: number, removing: number, adding: Enumerable);
|
||||
enumerableContentDidChange(start: number, removing: Enumerable, adding: Enumerable);
|
||||
enumerableContentDidChange(removing: number, adding: number);
|
||||
enumerableContentDidChange(removing: Enumerable, adding: number);
|
||||
enumerableContentDidChange(removing: number, adding: Enumerable);
|
||||
enumerableContentDidChange(removing: Enumerable, adding: Enumerable);
|
||||
enumerableContentDidChange(start: number, removing: number, adding: number): any;
|
||||
enumerableContentDidChange(start: number, removing: Enumerable, adding: number): any;
|
||||
enumerableContentDidChange(start: number, removing: number, adding: Enumerable): any;
|
||||
enumerableContentDidChange(start: number, removing: Enumerable, adding: Enumerable): any;
|
||||
enumerableContentDidChange(removing: number, adding: number): any;
|
||||
enumerableContentDidChange(removing: Enumerable, adding: number): any;
|
||||
enumerableContentDidChange(removing: number, adding: Enumerable): any;
|
||||
enumerableContentDidChange(removing: Enumerable, adding: Enumerable): any;
|
||||
enumerableContentWillChange(removing: number, adding: number): Enumerable;
|
||||
enumerableContentWillChange(removing: Enumerable, adding: number): Enumerable;
|
||||
enumerableContentWillChange(removing: number, adding: Enumerable): Enumerable;
|
||||
@@ -1160,23 +1163,23 @@ declare module Ember {
|
||||
getEach(key: string): any[];
|
||||
indexOf(object: any, startAt: number): number;
|
||||
insertAt(idx: number, object: any): any[];
|
||||
invoke(methodName: string, ...any): any[];
|
||||
invoke(methodName: string, ...args: any[]): any[];
|
||||
lastIndexOf(object: any, startAt: number): number;
|
||||
map: ItemIndexEnumerableCallbackTarget;
|
||||
mapBy(key: string): any[];
|
||||
nextObject(index: number, previousObject: any, context: any): any;
|
||||
objectAt(idx: number): any;
|
||||
objectsAt(...number): any[];
|
||||
objectsAt(...args: number[]): any[];
|
||||
popObject(): any;
|
||||
pushObject(obj: any): any;
|
||||
pushObjects(...any): any[];
|
||||
pushObjects(...args: any[]): any[];
|
||||
reduce(callback: ReduceCallback, initialValue: any, reducerProperty: string): any;
|
||||
reject: ItemIndexEnumerableCallbackTarget;
|
||||
rejectBy(key: string, value?: string): any[];
|
||||
removeArrayObserver(target: any, opts: EnumerableConfigurationOptions): any[];
|
||||
removeAt(start: number, len: number): any;
|
||||
removeEnumerableObserver(target: any, opts: EnumerableConfigurationOptions): Enumerable;
|
||||
replace(idx: number, amt: number, objects: any[]);
|
||||
replace(idx: number, amt: number, objects: any[]): any;
|
||||
reverseObjects(): any[];
|
||||
setEach(key: string, value?: any): any;
|
||||
setObjects(objects: any[]): any[];
|
||||
@@ -1209,14 +1212,14 @@ declare module Ember {
|
||||
someProperty(key: string, value?: string): boolean;
|
||||
compact(): any[];
|
||||
contains(obj: any): boolean;
|
||||
enumerableContentDidChange(start: number, removing: number, adding: number);
|
||||
enumerableContentDidChange(start: number, removing: Enumerable, adding: number);
|
||||
enumerableContentDidChange(start: number, removing: number, adding: Enumerable);
|
||||
enumerableContentDidChange(start: number, removing: Enumerable, adding: Enumerable);
|
||||
enumerableContentDidChange(removing: number, adding: number);
|
||||
enumerableContentDidChange(removing: Enumerable, adding: number);
|
||||
enumerableContentDidChange(removing: number, adding: Enumerable);
|
||||
enumerableContentDidChange(removing: Enumerable, adding: Enumerable);
|
||||
enumerableContentDidChange(start: number, removing: number, adding: number): any;
|
||||
enumerableContentDidChange(start: number, removing: Enumerable, adding: number): any;
|
||||
enumerableContentDidChange(start: number, removing: number, adding: Enumerable): any;
|
||||
enumerableContentDidChange(start: number, removing: Enumerable, adding: Enumerable): any;
|
||||
enumerableContentDidChange(removing: number, adding: number): any;
|
||||
enumerableContentDidChange(removing: Enumerable, adding: number): any;
|
||||
enumerableContentDidChange(removing: number, adding: Enumerable): any;
|
||||
enumerableContentDidChange(removing: Enumerable, adding: Enumerable): any;
|
||||
enumerableContentWillChange(removing: number, adding: number): Enumerable;
|
||||
enumerableContentWillChange(removing: Enumerable, adding: number): Enumerable;
|
||||
enumerableContentWillChange(removing: number, adding: Enumerable): Enumerable;
|
||||
@@ -1230,7 +1233,7 @@ declare module Ember {
|
||||
findBy(key: string, value?: string): any;
|
||||
forEach(callback: Function, target?: any): any;
|
||||
getEach(key: string): any[];
|
||||
invoke(methodName: string, ...any): any[];
|
||||
invoke(methodName: string, ...args: any[]): any[];
|
||||
map: ItemIndexEnumerableCallbackTarget;
|
||||
mapBy(key: string): any[];
|
||||
nextObject(index: number, previousObject: any, context: any): any;
|
||||
@@ -1245,7 +1248,7 @@ declare module Ember {
|
||||
toArray(): any[];
|
||||
uniq(): Enumerable;
|
||||
without(value: any): Enumerable;
|
||||
'[]': any[];
|
||||
'[]': any[];
|
||||
firstObject: any;
|
||||
hasEnumerableObservers: boolean;
|
||||
lastObject: any;
|
||||
@@ -1280,14 +1283,14 @@ declare module Ember {
|
||||
clear(): any[];
|
||||
compact(): any[];
|
||||
contains(obj: any): boolean;
|
||||
enumerableContentDidChange(start: number, removing: number, adding: number);
|
||||
enumerableContentDidChange(start: number, removing: Enumerable, adding: number);
|
||||
enumerableContentDidChange(start: number, removing: number, adding: Enumerable);
|
||||
enumerableContentDidChange(start: number, removing: Enumerable, adding: Enumerable);
|
||||
enumerableContentDidChange(removing: number, adding: number);
|
||||
enumerableContentDidChange(removing: Enumerable, adding: number);
|
||||
enumerableContentDidChange(removing: number, adding: Enumerable);
|
||||
enumerableContentDidChange(removing: Enumerable, adding: Enumerable);
|
||||
enumerableContentDidChange(start: number, removing: number, adding: number): any;
|
||||
enumerableContentDidChange(start: number, removing: Enumerable, adding: number): any;
|
||||
enumerableContentDidChange(start: number, removing: number, adding: Enumerable): any;
|
||||
enumerableContentDidChange(start: number, removing: Enumerable, adding: Enumerable): any;
|
||||
enumerableContentDidChange(removing: number, adding: number): any;
|
||||
enumerableContentDidChange(removing: Enumerable, adding: number): any;
|
||||
enumerableContentDidChange(removing: number, adding: Enumerable): any;
|
||||
enumerableContentDidChange(removing: Enumerable, adding: Enumerable): any;
|
||||
enumerableContentWillChange(removing: number, adding: number): any[];
|
||||
enumerableContentWillChange(removing: Enumerable, adding: number): any[];
|
||||
enumerableContentWillChange(removing: number, adding: Enumerable): any[];
|
||||
@@ -1303,23 +1306,23 @@ declare module Ember {
|
||||
getEach(key: string): any[];
|
||||
indexOf(object: any, startAt: number): number;
|
||||
insertAt(idx: number, object: any): any[];
|
||||
invoke(methodName: string, ...any): any[];
|
||||
invoke(methodName: string, ...args: any[]): any[];
|
||||
lastIndexOf(object: any, startAt: number): number;
|
||||
map: ItemIndexEnumerableCallbackTarget;
|
||||
mapBy(key: string): any[];
|
||||
nextObject(index: number, previousObject: any, context: any): any;
|
||||
objectAt(idx: number): any;
|
||||
objectsAt(...number): any[];
|
||||
objectsAt(...args: number[]): any[];
|
||||
popObject(): any;
|
||||
pushObject(obj: any): any;
|
||||
pushObjects(...any): any[];
|
||||
pushObjects(...args: any[]): any[];
|
||||
reduce(callback: ReduceCallback, initialValue: any, reducerProperty: string): any;
|
||||
reject: ItemIndexEnumerableCallbackTarget;
|
||||
rejectBy(key: string, value?: string): any[];
|
||||
removeArrayObserver(target: any, opts: EnumerableConfigurationOptions): any[];
|
||||
removeAt(start: number, len: number): any;
|
||||
removeEnumerableObserver(target: any, opts: EnumerableConfigurationOptions): any[];
|
||||
replace(idx: number, amt: number, objects: any[]);
|
||||
replace(idx: number, amt: number, objects: any[]): any;
|
||||
reverseObjects(): any[];
|
||||
setEach(key: string, value?: any): any;
|
||||
setObjects(objects: any[]): any[];
|
||||
@@ -1348,7 +1351,7 @@ declare module Ember {
|
||||
decrementProperty(keyName: string, decrement?: number): number;
|
||||
endPropertyChanges(): any[];
|
||||
get(keyName: string): any;
|
||||
getProperties(...string): {};
|
||||
getProperties(...args: string[]): {};
|
||||
getProperties(keys: string[]): {};
|
||||
getWithDefault(keyName: string, defaultValue: any): any;
|
||||
hasObserverFor(key: string): boolean;
|
||||
@@ -1426,7 +1429,7 @@ declare module Ember {
|
||||
decrementProperty(keyName: string, decrement?: number): number;
|
||||
endPropertyChanges(): Observable;
|
||||
get(keyName: string): any;
|
||||
getProperties(...string): {};
|
||||
getProperties(...args: string[]): {};
|
||||
getProperties(keys: string[]): {};
|
||||
getWithDefault(keyName: string, defaultValue: any): any;
|
||||
hasObserverFor(key: string): boolean;
|
||||
@@ -1441,8 +1444,8 @@ declare module Ember {
|
||||
toggleProperty(keyName: string): any;
|
||||
}
|
||||
class ObjectController extends ObjectProxy implements ControllerMixin {
|
||||
replaceRoute(name: string, ...any): void;
|
||||
transitionToRoute(name: string, ...any): void;
|
||||
replaceRoute(name: string, ...args: any[]): void;
|
||||
transitionToRoute(name: string, ...args: any[]): void;
|
||||
controllers: Object;
|
||||
needs: string[];
|
||||
target: any;
|
||||
@@ -1474,7 +1477,7 @@ declare module Ember {
|
||||
decrementProperty(keyName: string, decrement?: number): number;
|
||||
endPropertyChanges(): Observable;
|
||||
get(keyName: string): any;
|
||||
getProperties(...string): {};
|
||||
getProperties(...args: string[]): {};
|
||||
getProperties(keys: string[]): {};
|
||||
getWithDefault(keyName: string, defaultValue: any): any;
|
||||
hasObserverFor(key: string): boolean;
|
||||
@@ -1551,12 +1554,12 @@ declare module Ember {
|
||||
render(name: string, options?: RenderOptions): void;
|
||||
renderTemplate(controller: Controller, model: {}): void;
|
||||
// ReSharper disable once InconsistentNaming
|
||||
replaceWith(name: string, ...Object): void;
|
||||
send(name: string, ...any): void;
|
||||
replaceWith(name: string, ...object: any[]): void;
|
||||
send(name: string, ...args: any[]): void;
|
||||
serialize(model: {}, params: string[]): string;
|
||||
setupController(controller: Controller, model: {}): void;
|
||||
// ReSharper disable once InconsistentNaming
|
||||
transitionTo(name: string, ...Object): void;
|
||||
transitionTo(name: string, ...object: any[]): void;
|
||||
actions: ActionsHash;
|
||||
}
|
||||
class Router extends Object {
|
||||
@@ -1634,14 +1637,14 @@ declare module Ember {
|
||||
someProperty(key: string, value?: string): boolean;
|
||||
compact(): any[];
|
||||
contains(obj: any): boolean;
|
||||
enumerableContentDidChange(start: number, removing: number, adding: number);
|
||||
enumerableContentDidChange(start: number, removing: Enumerable, adding: number);
|
||||
enumerableContentDidChange(start: number, removing: number, adding: Enumerable);
|
||||
enumerableContentDidChange(start: number, removing: Enumerable, adding: Enumerable);
|
||||
enumerableContentDidChange(removing: number, adding: number);
|
||||
enumerableContentDidChange(removing: Enumerable, adding: number);
|
||||
enumerableContentDidChange(removing: number, adding: Enumerable);
|
||||
enumerableContentDidChange(removing: Enumerable, adding: Enumerable);
|
||||
enumerableContentDidChange(start: number, removing: number, adding: number): any;
|
||||
enumerableContentDidChange(start: number, removing: Enumerable, adding: number): any;
|
||||
enumerableContentDidChange(start: number, removing: number, adding: Enumerable): any;
|
||||
enumerableContentDidChange(start: number, removing: Enumerable, adding: Enumerable): any;
|
||||
enumerableContentDidChange(removing: number, adding: number): any;
|
||||
enumerableContentDidChange(removing: Enumerable, adding: number): any;
|
||||
enumerableContentDidChange(removing: number, adding: Enumerable): any;
|
||||
enumerableContentDidChange(removing: Enumerable, adding: Enumerable): any;
|
||||
enumerableContentWillChange(removing: number, adding: number): Set;
|
||||
enumerableContentWillChange(removing: Enumerable, adding: number): Set;
|
||||
enumerableContentWillChange(removing: number, adding: Enumerable): Set;
|
||||
@@ -1655,7 +1658,7 @@ declare module Ember {
|
||||
findBy(key: string, value?: string): any;
|
||||
forEach(callback: Function, target?: any): any;
|
||||
getEach(key: string): any[];
|
||||
invoke(methodName: string, ...any): any[];
|
||||
invoke(methodName: string, ...args: any[]): any[];
|
||||
map: ItemIndexEnumerableCallbackTarget;
|
||||
mapBy(key: string): any[];
|
||||
nextObject(index: number, previousObject: any, context: any): any;
|
||||
@@ -1679,13 +1682,13 @@ declare module Ember {
|
||||
freeze(): Set;
|
||||
isFrozen: boolean;
|
||||
add(obj: any): Set;
|
||||
addEach(...any): Set;
|
||||
addEach(...args: any[]): Set;
|
||||
clear(): Set;
|
||||
isEqual(obj: Set): boolean;
|
||||
pop(): any;
|
||||
push(obj: any): Set;
|
||||
remove(obj: any): Set;
|
||||
removeEach(...any): Set;
|
||||
removeEach(...args: any[]): Set;
|
||||
shift(): any;
|
||||
unshift(obj: any): Set;
|
||||
length: number;
|
||||
@@ -1699,14 +1702,14 @@ declare module Ember {
|
||||
someProperty(key: string, value?: string): boolean;
|
||||
compact(): any[];
|
||||
contains(obj: any): boolean;
|
||||
enumerableContentDidChange(start: number, removing: number, adding: number);
|
||||
enumerableContentDidChange(start: number, removing: Enumerable, adding: number);
|
||||
enumerableContentDidChange(start: number, removing: number, adding: Enumerable);
|
||||
enumerableContentDidChange(start: number, removing: Enumerable, adding: Enumerable);
|
||||
enumerableContentDidChange(removing: number, adding: number);
|
||||
enumerableContentDidChange(removing: Enumerable, adding: number);
|
||||
enumerableContentDidChange(removing: number, adding: Enumerable);
|
||||
enumerableContentDidChange(removing: Enumerable, adding: Enumerable);
|
||||
enumerableContentDidChange(start: number, removing: number, adding: number): any;
|
||||
enumerableContentDidChange(start: number, removing: Enumerable, adding: number): any;
|
||||
enumerableContentDidChange(start: number, removing: number, adding: Enumerable): any;
|
||||
enumerableContentDidChange(start: number, removing: Enumerable, adding: Enumerable): any;
|
||||
enumerableContentDidChange(removing: number, adding: number): any;
|
||||
enumerableContentDidChange(removing: Enumerable, adding: number): any;
|
||||
enumerableContentDidChange(removing: number, adding: Enumerable): any;
|
||||
enumerableContentDidChange(removing: Enumerable, adding: Enumerable): any;
|
||||
enumerableContentWillChange(removing: number, adding: number): Enumerable;
|
||||
enumerableContentWillChange(removing: Enumerable, adding: number): Enumerable;
|
||||
enumerableContentWillChange(removing: number, adding: Enumerable): Enumerable;
|
||||
@@ -1720,7 +1723,7 @@ declare module Ember {
|
||||
findBy(key: string, value?: string): any;
|
||||
forEach(callback: Function, target?: any): any;
|
||||
getEach(key: string): any[];
|
||||
invoke(methodName: string, ...any): any[];
|
||||
invoke(methodName: string, ...args: any[]): any[];
|
||||
map: ItemIndexEnumerableCallbackTarget;
|
||||
mapBy(key: string): any[];
|
||||
nextObject(index: number, previousObject: any, context: any): any;
|
||||
@@ -1763,7 +1766,7 @@ declare module Ember {
|
||||
off(name: string, target: any, method: Function): State;
|
||||
on(name: string, target: any, method: Function): State;
|
||||
one(name: string, target: any, method: Function): State;
|
||||
trigger(name: string, ...string): void;
|
||||
trigger(name: string, ...args: string[]): void;
|
||||
getPathsCache(stateManager: {}, path: string): {};
|
||||
init(): void;
|
||||
setPathsCache(stateManager: {}, path: string, transitions: any): void;
|
||||
@@ -1804,7 +1807,7 @@ declare module Ember {
|
||||
stateMetaFor(state: State): {};
|
||||
transitionTo(path: string, context: any): void;
|
||||
triggerSetupContext(transitions: TransitionsHash): void;
|
||||
unhandledEvent(manager: StateManager, event: string);
|
||||
unhandledEvent(manager: StateManager, event: string): any;
|
||||
currentPath: string;
|
||||
currentState: State;
|
||||
errorOnUnhandledEvents: boolean;
|
||||
@@ -1816,9 +1819,9 @@ declare module Ember {
|
||||
function classify(str: string): string;
|
||||
function dasherize(str: string): string;
|
||||
function decamelize(str: string): string;
|
||||
function fmt(...string): string;
|
||||
function fmt(...args: string[]): string;
|
||||
function htmlSafe(str: string): void; // TODO: @returns Handlebars.SafeStringStatic;
|
||||
function loc(...string): string;
|
||||
function loc(...args: string[]): string;
|
||||
function underscore(str: string): string;
|
||||
function w(str: string): string[];
|
||||
}
|
||||
@@ -2001,8 +2004,8 @@ declare module Ember {
|
||||
var computed: {
|
||||
(callback: Function): ComputedProperty;
|
||||
alias(dependentKey: string): ComputedProperty;
|
||||
and(...string): ComputedProperty;
|
||||
any(...string): ComputedProperty;
|
||||
and(...args: string[]): ComputedProperty;
|
||||
any(...args: string[]): ComputedProperty;
|
||||
bool(dependentKey: string): ComputedProperty;
|
||||
defaultTo(defaultPath: string): ComputedProperty;
|
||||
empty(dependentKey: string): ComputedProperty;
|
||||
@@ -2011,13 +2014,13 @@ declare module Ember {
|
||||
gte(dependentKey: string, value: number): ComputedProperty;
|
||||
lt(dependentKey: string, value: number): ComputedProperty;
|
||||
lte(dependentKey: string, value: number): ComputedProperty;
|
||||
map(...string): ComputedProperty;
|
||||
map(...args: string[]): ComputedProperty;
|
||||
match(dependentKey: string, regexp: RegExp): ComputedProperty;
|
||||
none(dependentKey: string): ComputedProperty;
|
||||
not(dependentKey: string): ComputedProperty;
|
||||
notEmpty(dependentKey: string): ComputedProperty;
|
||||
oneWay(dependentKey: string): ComputedProperty;
|
||||
or(...string): ComputedProperty;
|
||||
or(...args: string[]): ComputedProperty;
|
||||
};
|
||||
// ReSharper disable DuplicatingLocalDeclaration
|
||||
var config: {};
|
||||
@@ -2057,7 +2060,7 @@ declare module Ember {
|
||||
function handleErrors(func: Function, context: any): any;
|
||||
function hasListeners(context: any, name: string): boolean;
|
||||
function hasOwnProperty(prop: string): boolean;
|
||||
function immediateObserver(func: Function, ...propertyNames): Function;
|
||||
function immediateObserver(func: Function, ...propertyNames: any[]): Function;
|
||||
var imports: {};
|
||||
function inspect(obj: any): string;
|
||||
function instrument(name: string, payload: any, callback: Function, binding: any): void;
|
||||
@@ -2079,13 +2082,13 @@ declare module Ember {
|
||||
function merge(original: any, updates: any): any;
|
||||
function meta(obj: any, writable?: boolean): {};
|
||||
function metaPath(obj: any, path: string, writable?: boolean): any;
|
||||
function mixin(obj: any, ...any): any;
|
||||
function mixin(obj: any, ...args: any[]): any;
|
||||
/**
|
||||
Ember.none is deprecated. Please use Ember.isNone instead.
|
||||
**/
|
||||
var none: typeof deprecateFunc;
|
||||
function normalizeTuple(target: any, path: string): any[];
|
||||
function observer(func: Function, ...string): Function;
|
||||
function observer(func: Function, ...args: string[]): Function;
|
||||
function observersFor(obj: any, path: string): any[];
|
||||
function onLoad(name: string, callback: Function): void;
|
||||
function oneWay(obj: any, to: string, from: string): Binding;
|
||||
@@ -2119,18 +2122,18 @@ declare module Ember {
|
||||
debounce(target: any, method: Function, ...args: any[]): void;
|
||||
debounce(target: any, method: string, ...args: any[]): void;
|
||||
end(): void;
|
||||
join(target: any, method: Function, ...any): any;
|
||||
join(target: any, method: string, ...any): any;
|
||||
join(target: any, method: Function, ...args: any[]): any;
|
||||
join(target: any, method: string, ...args: any[]): any;
|
||||
later(target: any, method: Function, ...args: any[]): string;
|
||||
later(target: any, method: string, ...args: any[]): string;
|
||||
next(target: any, method: Function, ...any): number;
|
||||
next(target: any, method: string, ...any): number;
|
||||
once(target: any, method: Function, ...any): number;
|
||||
once(target: any, method: string, ...any): number;
|
||||
schedule(queue: string, target: any, method: Function, ...any): void;
|
||||
schedule(queue: string, target: any, method: string, ...any): void;
|
||||
scheduleOnce(queue: string, target: any, method: Function, ...any): void;
|
||||
scheduleOnce(queue: string, target: any, method: string, ...any): void;
|
||||
next(target: any, method: Function, ...args: any[]): number;
|
||||
next(target: any, method: string, ...args: any[]): number;
|
||||
once(target: any, method: Function, ...args: any[]): number;
|
||||
once(target: any, method: string, ...args: any[]): number;
|
||||
schedule(queue: string, target: any, method: Function, ...args: any[]): void;
|
||||
schedule(queue: string, target: any, method: string, ...args: any[]): void;
|
||||
scheduleOnce(queue: string, target: any, method: Function, ...args: any[]): void;
|
||||
scheduleOnce(queue: string, target: any, method: string, ...args: any[]): void;
|
||||
sync(): void;
|
||||
throttle(target: any, method: Function, ...args: any[]): void;
|
||||
throttle(target: any, method: string, ...args: any[]): void;
|
||||
|
||||
@@ -1 +1 @@
|
||||
""
|
||||
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
/// <reference path="emscripten.d.ts" />
|
||||
|
||||
|
||||
/// Module
|
||||
function ModuleTest(): void {
|
||||
Module.print = function(text) { alert('stdout: ' + text) };
|
||||
|
||||
var int_sqrt = Module.cwrap('int_sqrt', 'number', ['number'])
|
||||
int_sqrt(12)
|
||||
int_sqrt(28)
|
||||
|
||||
var myTypedArray = new Uint8Array(10);
|
||||
var buf = Module._malloc(myTypedArray.length*myTypedArray.BYTES_PER_ELEMENT);
|
||||
Module.HEAPU8.set(myTypedArray, buf);
|
||||
Module.ccall('my_function', 'number', ['number'], [buf]);
|
||||
Module._free(buf);
|
||||
}
|
||||
|
||||
/// FS
|
||||
function FSTest(): void {
|
||||
FS.mkdir('/working');
|
||||
FS.mount(NODEFS, { root: '.' }, '/working');
|
||||
|
||||
function myAppStartup(): void {
|
||||
FS.mkdir('/data');
|
||||
FS.mount(IDBFS, {}, '/data');
|
||||
|
||||
FS.syncfs(true, function (err) {
|
||||
// handle callback
|
||||
});
|
||||
}
|
||||
|
||||
function myAppShutdown() {
|
||||
FS.syncfs(function (err) {
|
||||
// handle callback
|
||||
});
|
||||
}
|
||||
|
||||
var id = FS.makedev(64, 0);
|
||||
FS.registerDevice(id, {});
|
||||
FS.mkdev('/dummy', id);
|
||||
|
||||
FS.writeFile('file', 'foobar');
|
||||
FS.symlink('file', 'link');
|
||||
|
||||
FS.writeFile('/foobar.txt', 'Hello, world');
|
||||
FS.unlink('/foobar.txt');
|
||||
|
||||
FS.writeFile('file', 'foobar');
|
||||
FS.symlink('file', 'link');
|
||||
|
||||
FS.writeFile('forbidden', 'can\'t touch this');
|
||||
FS.chmod('forbidden', 0000);
|
||||
|
||||
FS.writeFile('file', 'foobar');
|
||||
FS.truncate('file', 3);
|
||||
|
||||
var stream = FS.open('abinaryfile', 'r');
|
||||
var buf = new Uint8Array(4);
|
||||
FS.read(stream, buf, 0, 4, 0);
|
||||
FS.close(stream);
|
||||
|
||||
var data = new Uint8Array(32);
|
||||
var stream = FS.open('dummy', 'w+');
|
||||
FS.write(stream, data, 0, data.length, 0);
|
||||
FS.close(stream);
|
||||
|
||||
var lookup = FS.lookupPath("path", { parent: true });
|
||||
}
|
||||
Vendored
+185
@@ -0,0 +1,185 @@
|
||||
// Type definitions for Emscripten
|
||||
// Project: http://kripken.github.io/emscripten-site/index.html
|
||||
// Definitions by: Kensuke Matsuzaki <https://github.com/zakki>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module Emscripten {
|
||||
interface FileSystemType {
|
||||
}
|
||||
}
|
||||
|
||||
declare module Module {
|
||||
function print(str: string): void;
|
||||
function printErr(str: string): void;
|
||||
var arguments: string[];
|
||||
var preInit: { (): void }[];
|
||||
var preRun: { (): void }[];
|
||||
var postRun: { (): void }[];
|
||||
var noExitRuntime: boolean;
|
||||
|
||||
var Runtime: any;
|
||||
|
||||
function ccall(ident: string, returnType: string, argTypes: string[], args: any[]): any;
|
||||
function cwrap(ident: string, returnType: string, argTypes: string[]): any;
|
||||
|
||||
function setValue(ptr: number, value: any, type: string, noSafe: boolean): void;
|
||||
function getValue(ptr: number, type: string, noSafe: boolean): any;
|
||||
|
||||
var ALLOC_NORMAL: number;
|
||||
var ALLOC_STACK: number;
|
||||
var ALLOC_STATIC: number;
|
||||
var ALLOC_DYNAMIC: number;
|
||||
var ALLOC_NONE: number;
|
||||
|
||||
function allocate(slab: any, types: string, allocator: number, ptr: number): number;
|
||||
function allocate(slab: any, types: string[], allocator: number, ptr: number): number;
|
||||
|
||||
function Pointer_stringify(ptr: number, length?: number): string;
|
||||
function UTF16ToString(ptr: number): string;
|
||||
function stringToUTF16(str: string, outPtr: number): void;
|
||||
function UTF32ToString(ptr: number): string;
|
||||
function stringToUTF32(str: string, outPtr: number): void;
|
||||
|
||||
// USE_TYPED_ARRAYS == 1
|
||||
var HEAP: Int32Array;
|
||||
var IHEAP: Int32Array;
|
||||
var FHEAP: Float64Array;
|
||||
|
||||
// USE_TYPED_ARRAYS == 2
|
||||
var HEAP8: Int8Array;
|
||||
var HEAP16: Int16Array;
|
||||
var HEAP32: Int32Array;
|
||||
var HEAPU8: Uint8Array;
|
||||
var HEAPU16: Uint16Array;
|
||||
var HEAPU32: Uint32Array;
|
||||
var HEAPF32: Float32Array;
|
||||
var HEAPF64: Float64Array;
|
||||
|
||||
var TOTAL_STACK: number;
|
||||
var TOTAL_MEMORY: number;
|
||||
var FAST_MEMORY: number;
|
||||
|
||||
function addOnPreRun(cb: () => any): void;
|
||||
function addOnInit(cb: () => any): void;
|
||||
function addOnPreMain(cb: () => any): void;
|
||||
function addOnExit(cb: () => any): void;
|
||||
function addOnPostRun(cb: () => any): void;
|
||||
|
||||
// Tools
|
||||
function intArrayFromString(stringy: string, dontAddNull?: boolean, length?: number): number[];
|
||||
function intArrayToString(array: number[]): string;
|
||||
function writeStringToMemory(str: string, buffer: number, dontAddNull: boolean): void;
|
||||
function writeArrayToMemory(array: number[], buffer: number): void;
|
||||
function writeAsciiToMemory(str: string, buffer: number, dontAddNull: boolean): void;
|
||||
|
||||
function addRunDependency(id: any): void;
|
||||
function removeRunDependency(id: any): void;
|
||||
|
||||
|
||||
var preloadedImages: any;
|
||||
var preloadedAudios: any;
|
||||
|
||||
function _malloc(size: number): number;
|
||||
function _free(ptr: number): void;
|
||||
}
|
||||
|
||||
declare module FS {
|
||||
interface Lookup {
|
||||
path: string;
|
||||
node: FSNode;
|
||||
}
|
||||
|
||||
interface FSStream {}
|
||||
interface FSNode {}
|
||||
interface ErrnoError {}
|
||||
|
||||
var ignorePermissions: boolean;
|
||||
var trackingDelegate: any;
|
||||
var tracking: any;
|
||||
var genericErrors: any;
|
||||
|
||||
//
|
||||
// paths
|
||||
//
|
||||
function lookupPath(path: string, opts: any): Lookup;
|
||||
function getPath(node: FSNode): string;
|
||||
|
||||
//
|
||||
// nodes
|
||||
//
|
||||
function isFile(mode: number): boolean;
|
||||
function isDir(mode: number): boolean;
|
||||
function isLink(mode: number): boolean;
|
||||
function isChrdev(mode: number): boolean;
|
||||
function isBlkdev(mode: number): boolean;
|
||||
function isFIFO(mode: number): boolean;
|
||||
function isSocket(mode: number): boolean;
|
||||
|
||||
//
|
||||
// devices
|
||||
//
|
||||
function major(dev: number): number;
|
||||
function minor(dev: number): number;
|
||||
function makedev(ma: number, mi: number): number;
|
||||
function registerDevice(dev: number, ops: any): void;
|
||||
|
||||
//
|
||||
// core
|
||||
//
|
||||
function syncfs(populate: boolean, callback: (e: any) => any): void;
|
||||
function syncfs( callback: (e: any) => any, populate?: boolean): void;
|
||||
function mount(type: Emscripten.FileSystemType, opts: any, mountpoint: string): any;
|
||||
function unmount(mountpoint: string): void;
|
||||
|
||||
function mkdir(path: string, mode?: number): any;
|
||||
function mkdev(path: string, mode?: number, dev?: number): any;
|
||||
function symlink(oldpath: string, newpath: string): any;
|
||||
function rename(old_path: string, new_path: string): void;
|
||||
function rmdir(path: string): void;
|
||||
function readdir(path: string): any;
|
||||
function unlink(path: string): void;
|
||||
function readlink(path: string): string;
|
||||
function stat(path: string, dontFollow?: boolean): any;
|
||||
function lstat(path: string): any;
|
||||
function chmod(path: string, mode: number, dontFollow?: boolean): void;
|
||||
function lchmod(path: string, mode: number): void;
|
||||
function fchmod(fd: number, mode: number): void;
|
||||
function chown(path: string, uid: number, gid: number, dontFollow?: boolean): void;
|
||||
function lchown(path: string, uid: number, gid: number): void;
|
||||
function fchown(fd: number, uid: number, gid: number): void;
|
||||
function truncate(path: string, len: number): void;
|
||||
function ftruncate(fd: number, len: number): void;
|
||||
function utime(path: string, atime: number, mtime: number): void;
|
||||
function open(path: string, flags: string, mode?: number, fd_start?: number, fd_end?: number): FSStream;
|
||||
function close(stream: FSStream): void;
|
||||
function llseek(stream: FSStream, offset: number, whence: number): any;
|
||||
function read(stream: FSStream, buffer: ArrayBufferView, offset: number, length: number, position?: number): number;
|
||||
function write(stream: FSStream, buffer: ArrayBufferView, offset: number, length: number, position?: number, canOwn?: boolean): number;
|
||||
function allocate(stream: FSStream, offset: number, length: number): void;
|
||||
function mmap(stream: FSStream, buffer: ArrayBufferView, offset: number, length: number, position: number, prot: number, flags: number): any;
|
||||
function ioctl(stream: FSStream, cmd: any, arg: any): any;
|
||||
function readFile(path: string, opts?: {encoding: string; flags: string}): any;
|
||||
function writeFile(path: string, data: ArrayBufferView, opts?: {encoding: string; flags: string}): void;
|
||||
function writeFile(path: string, data: string, opts?: {encoding: string; flags: string}): void;
|
||||
|
||||
//
|
||||
// module-level FS code
|
||||
//
|
||||
function cwd(): string;
|
||||
function chdir(path: string): void;
|
||||
function init(input: () => number, output: (c: number) => any, error: (c: number) => any): void;
|
||||
|
||||
function createLazyFile(parent: string, name: string, url: string, canRead: boolean, canWrite: boolean): FSNode;
|
||||
function createLazyFile(parent: FSNode, name: string, url: string, canRead: boolean, canWrite: boolean): FSNode;
|
||||
|
||||
function createPreloadedFile(parent: string, name: string, url: string, canRead: boolean, canWrite: boolean, onload?: ()=> void, onerror?: ()=>void, dontCreateFile?:boolean, canOwn?: boolean): void;
|
||||
function createPreloadedFile(parent: FSNode, name: string, url: string, canRead: boolean, canWrite: boolean, onload?: ()=> void, onerror?: ()=>void, dontCreateFile?:boolean, canOwn?: boolean): void;
|
||||
}
|
||||
|
||||
declare var MEMFS: Emscripten.FileSystemType;
|
||||
declare var NODEFS: Emscripten.FileSystemType;
|
||||
declare var IDBFS: Emscripten.FileSystemType;
|
||||
|
||||
interface Math {
|
||||
imul(a: number, b: number): number;
|
||||
}
|
||||
@@ -1 +1 @@
|
||||
""
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
""
|
||||
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
/// <reference path="./express-session.d.ts" />
|
||||
|
||||
import express = require('express');
|
||||
import session = require('express-session');
|
||||
|
||||
var app = express();
|
||||
|
||||
app.use(session({
|
||||
secret: 'keyboard cat'
|
||||
}));
|
||||
app.use(session({
|
||||
secret: 'keyboard cat',
|
||||
name: 'connect.sid',
|
||||
store: new session.MemoryStore(),
|
||||
cookie: { path: '/', httpOnly: true, secure: false, maxAge: null },
|
||||
genid: (req: express.Request): string => { return ''; },
|
||||
rolling: false,
|
||||
resave: true,
|
||||
proxy: true,
|
||||
saveUninitialized: true,
|
||||
unset: 'keep'
|
||||
}));
|
||||
|
||||
|
||||
interface MySession extends Express.Session {
|
||||
views: number;
|
||||
}
|
||||
app.use(function(req, res, next) {
|
||||
var sess = <MySession>req.session;
|
||||
if (sess.views) {
|
||||
sess.views++
|
||||
res.setHeader('Content-Type', 'text/html')
|
||||
res.write('<p>views: ' + sess.views + '</p>')
|
||||
res.write('<p>expires in: ' + (sess.cookie.maxAge / 1000) + 's</p>')
|
||||
res.end()
|
||||
} else {
|
||||
sess.views = 1
|
||||
res.end('welcome to the session demo. refresh!')
|
||||
}
|
||||
});
|
||||
|
||||
Vendored
+75
@@ -0,0 +1,75 @@
|
||||
// Type definitions for express-session
|
||||
// Project: https://www.npmjs.org/package/express-session
|
||||
// Definitions by: Hiroki Horiuchi <https://github.com/horiuchi/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../express/express.d.ts" />
|
||||
|
||||
declare module Express {
|
||||
|
||||
export interface Request {
|
||||
session?: Session;
|
||||
}
|
||||
|
||||
export interface Session {
|
||||
[key: string]: any;
|
||||
|
||||
regenerate: (callback: (err: any) => void) => void;
|
||||
destroy: (callback: (err: any) => void) => void;
|
||||
reload: (callback: (err: any) => void) => void;
|
||||
save: (callback: (err: any) => void) => void;
|
||||
touch: (callback: (err: any) => void) => void;
|
||||
|
||||
cookie: SessionCookie;
|
||||
}
|
||||
export interface SessionCookie {
|
||||
originalMaxAge: number;
|
||||
path: string;
|
||||
maxAge: number;
|
||||
secure?: boolean;
|
||||
httpOnly: boolean;
|
||||
domain?: string;
|
||||
expires: Date;
|
||||
serialize: (name: string, value: string) => string;
|
||||
}
|
||||
}
|
||||
|
||||
declare module "express-session" {
|
||||
import express = require('express');
|
||||
|
||||
function session(options?: session.SessionOptions): express.RequestHandler;
|
||||
|
||||
module session {
|
||||
export interface SessionOptions {
|
||||
secret: string;
|
||||
name?: string;
|
||||
store?: Store;
|
||||
cookie?: express.CookieOptions;
|
||||
genid?: (req: express.Request) => string;
|
||||
rolling?: boolean;
|
||||
resave?: boolean;
|
||||
proxy?: boolean;
|
||||
saveUninitialized?: boolean;
|
||||
unset?: string;
|
||||
}
|
||||
|
||||
export interface Store {
|
||||
get: (sid: string, callback: (err: any, session: Express.Session) => void) => void;
|
||||
set: (sid: string, session: Express.Session, callback: (err: any) => void) => void;
|
||||
destroy: (sid: string, callback: (err: any) => void) => void;
|
||||
length?: (callback: (err: any, length: number) => void) => void;
|
||||
clear?: (callback: (err: any) => void) => void;
|
||||
}
|
||||
export class MemoryStore implements Store {
|
||||
get: (sid: string, callback: (err: any, session: Express.Session) => void) => void;
|
||||
set: (sid: string, session: Express.Session, callback: (err: any) => void) => void;
|
||||
destroy: (sid: string, callback: (err: any) => void) => void;
|
||||
all: (callback: (err: any, obj: { [sid: string]: Express.Session; }) => void) => void;
|
||||
length: (callback: (err: any, length: number) => void) => void;
|
||||
clear: (callback: (err: any) => void) => void;
|
||||
}
|
||||
}
|
||||
|
||||
export = session;
|
||||
}
|
||||
|
||||
+165
-153
@@ -1,161 +1,173 @@
|
||||
// Type definitions for express-validator
|
||||
// Project: https://github.com/ctavan/express-validator
|
||||
// Definitions by: Nathan Ridley <https://github.com/axefrog/>
|
||||
// Definitions by: Nathan Ridley <https://github.com/axefrog/>, Jonathan Häberle <http://dreampulse.de>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module ExpressValidator {
|
||||
export interface ValidationError {
|
||||
msg: string;
|
||||
param: string;
|
||||
}
|
||||
/// <reference path="../express/express.d.ts" />
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user