diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 88905c88a..c2a12283a 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -13,13 +13,14 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](amqp-rpc/amqp-rpc.d.ts) [amqp-rpc](https://github.com/demchenkoe/node-amqp-rpc) by [Wonshik Kim](https://github.com/wokim) * [:link:](angular-file-upload/angular-file-upload.d.ts) [Angular File Upload](https://github.com/danialfarid/angular-file-upload) by [John Reilly](https://github.com/johnnyreilly) * [:link:](angularjs/angular.d.ts) [Angular JS](http://angularjs.org) by [Diego Vilar](http://github.com/diegovilar) -* [:link:](angularjs/angular-animate.d.ts) [Angular JS (ngAnimate module)](http://angularjs.org) by [Michel Salib](https://github.com/michelsalib), [Adi Dahiya](https://github.com/adidahiya) +* [:link:](angularjs/angular-animate.d.ts) [Angular JS (ngAnimate module)](http://angularjs.org) by [Michel Salib](https://github.com/michelsalib), [Adi Dahiya](https://github.com/adidahiya), [Raphael Schweizer](https://github.com/rasch) * [:link:](angularjs/angular-cookies.d.ts) [Angular JS (ngCookies module)](http://angularjs.org) by [Diego Vilar](http://github.com/diegovilar) * [:link:](angularjs/angular-mocks.d.ts) [Angular JS (ngMock, ngMockE2E module)](http://angularjs.org) by [Diego Vilar](http://github.com/diegovilar) * [:link:](angularjs/angular-resource.d.ts) [Angular JS (ngResource module)](http://angularjs.org) by [Diego Vilar](http://github.com/diegovilar), [Michael Jess](http://github.com/miffels) * [:link:](angularjs/angular-route.d.ts) [Angular JS (ngRoute module)](http://angularjs.org) by [Jonathan Park](https://github.com/park9140) * [:link:](angularjs/angular-sanitize.d.ts) [Angular JS (ngSanitize module)](http://angularjs.org) by [Diego Vilar](http://github.com/diegovilar) -* [:link:](angular-ui/angular-ui-router.d.ts) [Angular JS (ui.router module)](https://github.com/angular-ui/ui-router) by [Michel Salib](https://github.com/michelsalib) +* [:link:](angular-ui-router/angular-ui-router.d.ts) [Angular JS (ui.router module)](https://github.com/angular-ui/ui-router) by [Michel Salib](https://github.com/michelsalib) +* [:link:](angular-material/angular-material.d.ts) [Angular Material (ng.material module)](https://github.com/angular/material) by [Matt Traynham](https://github.com/mtraynham) * [:link:](angular-protractor/angular-protractor.d.ts) [Angular Protractor](https://github.com/angular/protractor) by [Bill Armstrong](https://github.com/BillArmstrong) * [:link:](angular-scenario/angular-scenario.d.ts) [Angular Scenario Testing (ngScenario module)](http://angularjs.org) by [RomanoLindano](https://github.com/RomanoLindano) * [:link:](angular-translate/angular-translate.d.ts) [Angular Translate (pascalprecht.translate module)](https://github.com/PascalPrecht/angular-translate) by [Michel Salib](https://github.com/michelsalib) @@ -31,6 +32,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](angular-notify/angular-notify.d.ts) [angular-notify](https://github.com/cgross/angular-notify) by [Suwato](https://github.com/Suwato/DefinitelyTyped) * [:link:](angular-scroll/angular-scroll.d.ts) [angular-scroll](https://github.com/oblador/angular-scroll) by [Sam Herrmann](https://github.com/samherrmann) * [:link:](angular-spinner/angular-spinner.d.ts) [angular-spinner.js](https://github.com/urish/angular-spinner) by [Marcin Biegała](https://github.com/Biegal) +* [:link:](angular-ui-sortable/angular-ui-sortable.d.ts) [angular.ui.sortable module](https://github.com/angular-ui/ui-sortable) by [Thodoris Greasidis](https://github.com/thgreasi) * [:link:](angular-agility/angular-agility.d.ts) [AngularAgility](https://github.com/AngularAgility/AngularAgility) by [Roland Zwaga](https://github.com/rolandzwaga) * [:link:](angularfire/angularfire.d.ts) [AngularFire](http://angularfire.com) by [Dénes Harmath](http://github.com/thSoft) * [:link:](angularLocalStorage/angularLocalStorage.d.ts) [AngularLocalStorage](https://github.com/agrublev/angularLocalStorage) by [Horiuchi_H](https://github.com/horiuchi) @@ -39,8 +41,10 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](any-db/any-db.d.ts) [any-db](https://github.com/grncdr/node-any-db) by [Rogier Schouten](https://github.com/rogierschouten) * [:link:](any-db-transaction/any-db-transaction.d.ts) [any-db-transaction](https://github.com/grncdr/node-any-db-transaction) by [Rogier Schouten](https://github.com/rogierschouten) * [:link:](cordova/cordova.d.ts) [Apache Cordova](http://cordova.apache.org) by [Microsoft Open Technologies Inc.](http://msopentech.com) +* [:link:](polymer/polymer.app-router.d.ts) [app-router](https://github.com/erikringsmuth/app-router) by [Louis Grignon](https://github.com/lgrignon) * [:link:](appframework/appframework.d.ts) [AppFramework](http://app-framework-software.intel.com) by [kyo_ago](https://github.com/kyo-ago) * [:link:](arbiter/Arbiter.d.ts) [Arbiter.js](http://arbiterjs.com) by [Arash Shakery](https://github.com/arash16) +* [:link:](arcgis-js-api/arcgis-js-api.d.ts) [ArcGIS API for JavaScript](http://js.arcgis.com) by [Esri](http://www.esri.com) * [:link:](archy/archy.d.ts) [archy](https://github.com/substack/node-archy) by [vvakame](https://github.com/vvakame) * [:link:](asciify/asciify.d.ts) [asciify](https://www.npmjs.org/package/asciify) by [Alan Norbauer](http://alan.norbauer.com) * [:link:](aspnet-identity-pw/aspnet-identity-pw.d.ts) [aspnet-identity-pw](https://github.com/Syncbak-Git/aspnet-identity-pw) by [jt000](https://github.com/jt000) @@ -53,11 +57,14 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](atpl/atpl.d.ts) [atpl](https://github.com/soywiz/atpl.js) by [Carlos Ballesteros Velasco](https://github.com/soywiz) * [:link:](auth0/auth0.d.ts) [Auth0.js](http://auth0.com) by [Robert McLaws](https://github.com/advancedrei) * [:link:](auth0.widget/auth0.widget.d.ts) [Auth0Widget.js](http://auth0.com) by [Robert McLaws](https://github.com/advancedrei) +* [:link:](autobahn/autobahn.d.ts) [AutobahnJS](http://autobahn.ws/js) by [Elad Zelingher](https://github.com/darkl) * [:link:](aws-sdk/aws-sdk.d.ts) [aws-sdk](https://github.com/aws/aws-sdk-js) by [midknight41](https://github.com/midknight41) +* [:link:](axios/axios.d.ts) [axios](https://github.com/mzabriskie/axios) by [Marcel Buesing](https://github.com/marcelbuesing) * [:link:](node-azure/azure.d.ts) [Azure SDK for Node](https://github.com/WindowsAzure/azure-sdk-for-node) by [Andrew Gaspar](https://github.com/AndrewGaspar), [Anti Veeranna](https://github.com/antiveeranna), [Maxime LUCE](https://github.com/SomaticIT) * [:link:](backbone/backbone.d.ts) [Backbone](http://backbonejs.org) by [Boris Yankov](https://github.com/borisyankov), [Natan Vivo](https://github.com/nvivo) * [:link:](backbone-relational/backbone-relational.d.ts) [Backbone-relational](http://backbonerelational.org) by [Eirik Hoem](https://github.com/eirikhm) * [:link:](backbone.layoutmanager/backbone.layoutmanager.d.ts) [Backbone.LayoutManager](http://layoutmanager.org) by [He Jiang](https://github.com/hejiang2000) +* [:link:](backbone.paginator/backbone.paginator.d.ts) [backbone.paginator](https://github.com/backbone-paginator/backbone.paginator) by [Nyamazing](https://github.com/Nyamazing) * [:link:](backbone.radio/backbone.radio.d.ts) [Backbone.Radio](https://github.com/marionettejs/backbone.radio) by [Peter Palotas](https://github.com/alphaleonis) * [:link:](backgrid/backgrid.d.ts) [Backgrid](http://backgridjs.com) by [Jeremy Lujan](https://github.com/jlujan) * [:link:](bcrypt/bcrypt.d.ts) [bcrypt](https://www.npmjs.org/package/bcrypt) by [Peter Harris](https://github.com/codeanimal) @@ -68,6 +75,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](bigscreen/bigscreen.d.ts) [BigScreen](http://brad.is/coding/BigScreen) by [Douglas Eichelberger](https://github.com/dduugg) * [:link:](bitwise-xor/bitwise-xor.d.ts) [bitwise-xor](https://github.com/czzarr/node-bitwise-xor) by [Rogier Schouten](https://github.com/rogierschouten) * [:link:](bluebird/bluebird.d.ts) [bluebird](https://github.com/petkaantonov/bluebird) by [Bart van der Schoor](https://github.com/Bartvds) +* [:link:](blueimp-md5/blueimp-md5.d.ts) [blueimp-md5](https://github.com/blueimp/JavaScript-MD5) by [Ray Martone](https://github.com/rmartone) * [:link:](body-parser/body-parser.d.ts) [body-parser](http://expressjs.com) by [Santi Albo](https://github.com/santialbo), [VILIC VANE](https://vilic.info), [Jonathan Häberle](https://github.com/dreampulse) * [:link:](boom/boom.d.ts) [boom](http://github.com/hapijs/boom) by [Igor Rogatty](http://github.com/rogatty) * [:link:](bootbox/bootbox.d.ts) [Bootbox](https://github.com/makeusabrew/bootbox) by [Vincent Bortone](https://github.com/vbortone), [Kon Pik](https://github.com/konpikwastaken) @@ -76,8 +84,8 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](bootstrap-notify/bootstrap-notify.d.ts) [bootstrap-notify](https://github.com/Nijikokun/bootstrap-notify) by [Blake Niemyjski](https://github.com/niemyjski) * [:link:](bootstrap.datepicker/bootstrap.datepicker.d.ts) [bootstrap.datepicker](https://github.com/eternicode/bootstrap-datepicker) by [Boris Yankov](https://github.com/borisyankov) * [:link:](bootstrap.paginator/bootstrap.paginator.d.ts) [bootstrap.paginator](https://github.com/lyonlai/bootstrap-paginator) by [derikwhittaker](https://github.com/derikwhittaker) -* [:link:](bootstrap.timepicker/bootstrap.timepicker.d.ts) [bootstrap.timepicker](https://github.com/jdewit/bootstrap-timepicker) by [derikwhittaker](https://github.com/derikwhittaker) * [:link:](box2d/box2dweb.d.ts) [bootstrap.timepicker](http://code.google.com/p/box2dweb) by [jbaldwin](https://github.com/jbaldwin) +* [:link:](bootstrap.timepicker/bootstrap.timepicker.d.ts) [bootstrap.timepicker](https://github.com/jdewit/bootstrap-timepicker) by [derikwhittaker](https://github.com/derikwhittaker) * [:link:](breeze/breeze.d.ts) [Breeze 1.5.x](http://www.breezejs.com) by [Boris Yankov](https://github.com/borisyankov), [IdeaBlade](https://github.com/IdeaBlade/Breeze) * [:link:](browser-harness/browser-harness.d.ts) [Browser Harness](https://github.com/scriby/browser-harness) by [Chris Scribner](https://github.com/scriby) * [:link:](browser-sync/browser-sync.d.ts) [browser-sync](http://www.browsersync.io) by [Asana](https://asana.com) @@ -130,13 +138,16 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](createjs/createjs.d.ts) [CreateJS](http://www.createjs.com) by [Pedro Ferreira](https://bitbucket.org/drk4), [Chris Smith](https://github.com/evilangelist), [Satoru Kimura](https://github.com/gyohk) * [:link:](crossfilter/crossfilter.d.ts) [CrossFilter](https://github.com/square/crossfilter) by [Schmulik Raskin](https://github.com/schmuli) * [:link:](crossroads/crossroads.d.ts) [Crossroads.js](http://millermedeiros.github.io/crossroads.js) by [Diullei Gomes](https://github.com/diullei) +* [:link:](crypto-js/crypto-js.d.ts) [crypto-js](https://github.com/evanvosberg/crypto-js) by [Michael Zabka](https://github.com/misak113) * [:link:](cryptojs/cryptojs.d.ts) [CryptoJS](https://code.google.com/p/crypto-js) by [Gia Bảo @ Sân Đình](https://github.com/giabao) * [:link:](googlemaps.infobubble/google.maps.infobubble.d.ts) [CSS3 InfoBubble with tabs for Google Maps API V3](http://google-maps-utility-library-v3.googlecode.com/svn/trunk/infobubble/src) by [Johan Nilsson](https://github.com/Dashue) * [:link:](csurf/csurf.d.ts) [csurf](https://www.npmjs.org/package/csurf) by [Hiroki Horiuchi](https://github.com/horiuchi) +* [:link:](csv-stringify/csv-stringify.d.ts) [csv-stringify](https://github.com/wdavidw/node-csv-stringify) by [Rogier Schouten](https://github.com/rogierschouten) * [:link:](md5/md5.d.ts) [CybozuLabs.MD5](http://labs.cybozu.co.jp/blog/mitsunari/2007/07/md5js_1.html) by [MIZUNE Pine](https://github.com/pine613) * [:link:](d3/d3.d.ts) [d3JS](http://d3js.org) by [Boris Yankov](https://github.com/borisyankov) * [:link:](d3.cloud.layout/d3.cloud.layout.d.ts) [d3JS cloud layout plugin by Jason Davies](https://github.com/jasondavies/d3-cloud) by [hans windhoff](https://github.com/hansrwindhoff) * [:link:](dagre/dagre.d.ts) [dagre](https://github.com/cpettitt/dagre) by [Qinfeng Chen](https://github.com/qinfchen) +* [:link:](dagre-d3/dagre-d3.d.ts) [dagre-d3.core.js](https://github.com/cpettitt/dagre-d3) by [Mark Wong Siang Kai](https://github.com/markwongsk) * [:link:](dat-gui/dat-gui.d.ts) [dat.GUI](https://github.com/dataarts/dat.gui) by [Satoru Kimura](https://github.com/gyohk) * [:link:](date.format.js/date.format.d.ts) [Date Format](http://blog.stevenlevithan.com/archives/date-time-format) by [Rob Stutton](https://github.com/balrob) * [:link:](datejs/datejs.d.ts) [DateJS](http://www.datejs.com) by [David Khristepher Santos](http://github.com/rupertavery) @@ -195,12 +206,14 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](express-session/express-session.d.ts) [express-session](https://www.npmjs.org/package/express-session) by [Hiroki Horiuchi](https://github.com/horiuchi) * [:link:](express-unless/express-unless.d.ts) [express-unless](https://www.npmjs.org/package/express-unless) by [Wonshik Kim](https://github.com/wokim) * [:link:](express-validator/express-validator.d.ts) [express-validator](https://github.com/ctavan/express-validator) by [Nathan Ridley](https://github.com/axefrog), [Jonathan Häberle](http://dreampulse.de) +* [:link:](extend/extend.d.ts) [extend](https://www.npmjs.com/package/extend) by [Stefan Steinhart](https://github.com/reppners) * [:link:](extjs/ExtJS.d.ts) [ExtJS](http://www.sencha.com/products/extjs) by [Brian Kotek](https://github.com/brian428) * [:link:](fabricjs/fabricjs.d.ts) [FabricJS](http://fabricjs.com) by [Oliver Klemencic](https://github.com/oklemencic) * [:link:](fbsdk/fbsdk.d.ts) [Facebook Javascript SDK](https://developers.facebook.com/docs/javascript) by [Joshua Strobl](https://github.com/JoshStrobl) * [:link:](fancybox/fancybox.d.ts) [fancyBox](https://github.com/fancyapps/fancyBox) by [Boris Yankov](https://github.com/borisyankov) * [:link:](fast-stats/fast-stats.d.ts) [fast-stats](https://github.com/bluesmoon/node-faststats) by [Rogier Schouten](https://github.com/rogierschouten) * [:link:](fastclick/fastclick.d.ts) [FastClick](https://github.com/ftlabs/fastclick) by [Shinnosuke Watanabe](https://github.com/shinnn) +* [:link:](whatwg-fetch/whatwg-fetch.d.ts) [fetch API](https://github.com/github/fetch) by [Ryan Graham](https://github.com/ryan-codingintrigue) * [:link:](fibers/fibers.d.ts) [fibers](https://github.com/laverdet/node-fibers) by [Carlos Ballesteros Velasco](https://github.com/soywiz) * [:link:](filewriter/filewriter.d.ts) [File API: Writer](http://www.w3.org/TR/file-writer-api) by [Kon](http://phyzkit.net) * [:link:](filesystem/filesystem.d.ts) [File System API](http://www.w3.org/TR/file-system-api) by [Kon](http://phyzkit.net) @@ -224,7 +237,11 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](fpsmeter/FPSMeter.d.ts) [FPSmeter](http://darsa.in/fpsmeter) by [Aaron Lampros](http://github.com/alampros) * [:link:](from/from.d.ts) [from](https://github.com/dominictarr/from) by [Bart van der Schoor](https://github.com/Bartvds) * [:link:](fs-extra/fs-extra.d.ts) [fs-extra](https://github.com/jprichardson/node-fs-extra) by [midknight41](https://github.com/midknight41) +* [:link:](fs-finder/fs-finder.d.ts) [fs-finder](https://github.com/sakren/node-fs-finder) by [Michael Zabka](https://github.com/misak113) +* [:link:](fs-mock/fs-mock.d.ts) [fs-mock](https://github.com/sakren/node-fs-mock) by [Rogier Schouten](https://github.com/rogierschouten) * [:link:](ftdomdelegate/ftdomdelegate.d.ts) [ftdomdelegate](https://github.com/ftlabs/ftdomdelegate) by [Christian Holm Nielsen](https://github.com/dotnetnerd) +* [:link:](ftp/ftp.d.ts) [ftp](https://github.com/mscdex/node-ftp) by [Rogier Schouten](https://github.com/rogierschouten) +* [:link:](ftpd/ftpd.d.ts) [ftpd](https://github.com/sstur/nodeftpd) by [Rogier Schouten](https://github.com/rogierschouten) * [:link:](fullCalendar/fullCalendar.d.ts) [FullCalendar](http://arshaw.com/fullcalendar) by [Neil Stalker](https://github.com/nestalk) * [:link:](fuse/fuse.d.ts) [Fuse.js](https://github.com/krisk/Fuse) by [Greg Smith](https://github.com/smrq) * [:link:](jquery-galleria/jquery-galleria.d.ts) [galleria.js](https://github.com/aino/galleria) by [Robert Imig](https://github.com/rimig) @@ -257,8 +274,8 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](greensock/greensock.d.ts) [GreenSock Animation Platform](http://www.greensock.com/get-started-js) by [Robert S](https://github.com/codebelt) * [:link:](gridfs-stream/gridfs-stream.d.ts) [gridfs-stream](https://github.com/aheckmann/gridfs-stream) by [Lior Mualem](https://github.com/liorm) * [:link:](gruntjs/gruntjs.d.ts) [Grunt 0.4.x](http://gruntjs.com) by [Jeff May](https://github.com/jeffmay), [Basarat Ali Syed](https://github.com/basarat) -* [:link:](gsap/Ease.d.ts) [GSAP](http://greensock.com) by [VILIC VANE](https://vilic.github.io) * [:link:](gsap/Core.d.ts) [GSAP](http://greensock.com) by [VILIC VANE](https://vilic.github.io) +* [:link:](gsap/Ease.d.ts) [GSAP](http://greensock.com) by [VILIC VANE](https://vilic.github.io) * [:link:](gsap/TweenLite.d.ts) [GSAP](http://greensock.com) by [VILIC VANE](https://vilic.github.io) * [:link:](gulp/gulp.d.ts) [Gulp v3.8.x](http://gulpjs.com) by [Drew Noakes](https://drewnoakes.com) * [:link:](gulp-autoprefixer/gulp-autoprefixer.d.ts) [gulp-autoprefixer](https://github.com/sindresorhus/gulp-autoprefixer) by [Asana](https://asana.com) @@ -282,7 +299,8 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](gulp-util/gulp-util.d.ts) [gulp-util v3.0.x](https://github.com/gulpjs/gulp-util) by [jedmao](https://github.com/jedmao) * [:link:](hammerjs/hammerjs.d.ts) [Hammer.js](http://hammerjs.github.io) by [Philip Bulley](https://github.com/milkisevil), [Han Lin Yap](https://github.com/codler) * [:link:](handlebars/handlebars.d.ts) [Handlebars](http://handlebarsjs.com) by [Boris Yankov](https://github.com/borisyankov) -* [:link:](hapi/hapi.d.ts) [hapi](http://github.com/spumko/hapi) by [Hakubo](http://github.com/hakubo) +* [:link:](hapi/hapi.d.ts) [hapi](http://github.com/spumko/hapi) by [Jason Swearingen](http://github.com/jasonswearingen) +* [:link:](hasher/hasher.d.ts) [Hasher.js](https://github.com/millermedeiros/hasher) by [flyfishMT](https://github.com/flyfishMT) * [:link:](hashmap/hashmap.d.ts) [HashMap](https://github.com/flesler/hashmap) by [Rafał Wrzeszcz](http://wrzasq.pl) * [:link:](Headroom/headroom.d.ts) [headroom.js](http://wicky.nillia.ms/headroom.js) by [Jakub Olek](https://github.com/hakubo) * [:link:](heatmap.js/heatmap.d.ts) [heatmap.js](https://github.com/pa7/heatmap.js) by [Yang Guan](https://github.com/lookuptable) @@ -295,6 +313,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](touch-events/touch-events.d.ts) [HTML Touch Events](http://www.w3.org/TR/touch-events) by [Kevin Barabash](https://github.com/kevinb7) * [:link:](html2canvas/html2canvas.d.ts) [html2canvas.js](https://github.com/niklasvh/html2canvas) by [Richard Hepburn](https://github.com/rwhepburn) * [:link:](htmlparser2/htmlparser2.d.ts) [htmlparser2 v3.7.x](https://github.com/fb55/htmlparser2) by [James Roland Cabresos](https://github.com/staticfunction) +* [:link:](http-status/http-status.d.ts) [http-status](https://github.com/wdavidw/node-http-status) by [Michael Zabka](https://github.com/misak113) * [:link:](http-string-parser/http-string-parser.d.ts) [http-string-parser](https://github.com/apiaryio/http-string-parser) by [MIZUNE Pine](https://github.com/pine613) * [:link:](humane/humane.d.ts) [Humane](http://wavded.github.com/humane-js) by [jmvrbanac](https://github.com/jmvrbanac) * [:link:](i18n-node/i18n-node.d.ts) [i18n-node](https://github.com/mashpie/i18n-node) by [Maxime LUCE](https://github.com/SomaticIT) @@ -305,6 +324,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](imap/imap.d.ts) [imap](https://www.npmjs.com/package/imap) by [Peter Snider](https://github.com/psnider) * [:link:](impress/impress.d.ts) [Impress.js](https://github.com/bartaz/impress.js) by [Boris Yankov](https://github.com/borisyankov) * [:link:](inflection/inflection.d.ts) [inflection](https://github.com/dreamerslab/node.inflection) by [Shogo Iwano](https://github.com/shiwano) +* [:link:](ini/ini.d.ts) [ini](https://github.com/isaacs/ini) by [Marcin Porębski](https://github.com/marcinporebski) * [:link:](insight/insight.d.ts) [insight](https://github.com/yeoman/insight) by [vvakame](http://github.com/vvakame) * [:link:](interactjs/interact.d.ts) [Interacting for interact.js](https://github.com/taye/interact.js) by [Douglas Eichelberger](https://github.com/dduugg), [Adi Dahiya](https://github.com/adidahiya) * [:link:](intercomjs/intercom.d.ts) [intercom.js](https://github.com/diy/intercom.js) by [spencerwi](http://github.com/spencerwi) @@ -329,6 +349,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](jest/jest.d.ts) [Jest](http://facebook.github.io/jest) by [Asana](https://asana.com) * [:link:](jjv/jjv.d.ts) [JJV](https://github.com/acornejo/jjv) by [Wim Looman](https://github.com/Nemo157) * [:link:](jjve/jjve.d.ts) [JJVE](https://github.com/silas/jjve) by [Wim Looman](https://github.com/Nemo157) +* [:link:](johnny-five/johnny-five.d.ts) [johnny-five](https://github.com/rwaldron/johnny-five) by [Toshiya Nakakura](https://github.com/nakakura) * [:link:](joi/joi.d.ts) [joi](https://github.com/spumko/joi) by [Bart van der Schoor](https://github.com/Bartvds) * [:link:](jointjs/jointjs.d.ts) [Joint JS](http://www.jointjs.com) by [Aidan Reel](http://github.com/areel), [David Durman](http://github.com/DavidDurman), [Ewout Van Gossum](https://github.com/DenEwout) * [:link:](jqrangeslider/jqrangeslider.d.ts) [jQRangeSlider](http://ghusse.github.com/jQRangeSlider) by [Dániel Tar](https://github.com/qcz) @@ -419,16 +440,19 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](jsonwebtoken/jsonwebtoken.d.ts) [jsonwebtoken](https://github.com/auth0/node-jsonwebtoken) by [Maxime LUCE](https://github.com/SomaticIT) * [:link:](jsplumb/jquery.jsPlumb.d.ts) [jsPlumb 1.3.16 jQuery adapter](http://jsplumb.org) by [Steve Shearn](https://github.com/shearnie) * [:link:](jsrender/jsrender.d.ts) [JsRender](http://www.jsviews.com/#jsrender) by [Kensuke Matsuzaki](https://github.com/zakki) +* [:link:](jssha/jssha.d.ts) [jsSHA](https://github.com/Caligatio/jsSHA) by [David Li](https://github.com/randombk) * [:link:](jstorage/jstorage.d.ts) [jStorage](http://www.jstorage.info) by [Danil Flores](https://github.com/dflor003) * [:link:](jstree/jstree.d.ts) [jsTree](http://www.jstree.com) by [Adam Pluciński](https://github.com/adaskothebeast) * [:link:](jszip/jszip.d.ts) [JSZip](http://stuk.github.com/jszip) by [mzeiher](https://github.com/mzeiher) * [:link:](jwplayer/jwplayer.d.ts) [JW Player](http://developer.longtailvideo.com/trac) by [Martin Duparc](https://github.com/martinduparc) * [:link:](jwt-simple/jwt-simple.d.ts) [jwt-simple](https://github.com/hokaccha/node-jwt-simple) by [Ken Fukuyama](https://github.com/kenfdev) +* [:link:](kafka-node/kafka-node.d.ts) [kafka-node](https://github.com/SOHU-Co/kafka-node) by [Daniel Imrie-Situnayake](https://github.com/dansitu) * [:link:](karma-jasmine/karma-jasmine.d.ts) [karma-jasmine plugin](https://github.com/karma-runner/karma-jasmine) by [Michel Salib](https://github.com/michelsalib) * [:link:](keyboardjs/keyboardjs.d.ts) [KeyboardJS](https://github.com/RobertWHurst/KeyboardJS) by [Vincent Bortone](https://github.com/vbortone) * [:link:](keymaster/keymaster.d.ts) [keymaster](https://github.com/madrobby/keymaster) by [Martin W. Kirst](https://github.com/nitram509) * [:link:](keypress/keypress.d.ts) [Keypress](https://github.com/dmauro/Keypress) by [Roger Chen](https://github.com/rcchen) * [:link:](kineticjs/kineticjs.d.ts) [KineticJS](http://kineticjs.com) by [Basarat Ali Syed](http://www.github.com/basarat), [Ralph de Ruijter](http://www.superdopey.nl/techblog) +* [:link:](knex/knex.d.ts) [Knex.js](https://github.com/tgriesser/knex) by [Qubo](https://github.com/tkQubo) * [:link:](knockback/knockback.d.ts) [Knockback.js](http://kmalakoff.github.io/knockback) by [Boris Yankov](https://github.com/borisyankov) * [:link:](knockout/knockout.d.ts) [Knockout](http://knockoutjs.com) by [Boris Yankov](https://github.com/borisyankov), [Igor Oleinikov](https://github.com/Igorbek), [Clément Bourgeois](https://github.com/moonpyk) * [:link:](knockout.deferred.updates/knockout.deferred.updates.d.ts) [Knockout Deferred Updates](https://github.com/mbest/knockout-deferred-updates) by [Sebastián Galiano](https://github.com/sgaliano) @@ -468,7 +492,9 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](log4javascript/log4javascript.d.ts) [log4javascript](http://log4javascript.org) by [Markus Wagner](https://github.com/Ritzlgrmft) * [:link:](log4js/log4js.d.ts) [log4js](https://github.com/nomiddlename/log4js-node) by [Kentaro Okuno](http://github.com/armorik83) * [:link:](logg/logg.d.ts) [logg](https://github.com/dpup/node-logg) by [Bret Little](https://github.com/blittle) +* [:link:](loggly/loggly.d.ts) [loggly](https://github.com/nodejitsu/node-loggly) by [Ray Martone](https://github.com/rmartone) * [:link:](logrotate-stream/logrotate-stream.d.ts) [logrotate-stream](https://github.com/dstokes/logrotate-stream) by [Rogier Schouten](https://github.com/rogierschouten) +* [:link:](lolex/lolex.d.ts) [lolex](https://github.com/sinonjs/lolex) by [Wim Looman](https://github.com/Nemo157) * [:link:](long/long.d.ts) [Long.js](https://github.com/dcodeIO/Long.js) by [Toshihide Hara](https://github.com/kerug) * [:link:](lru-cache/lru-cache.d.ts) [lru-cache](https://github.com/isaacs/node-lru-cache) by [Bart van der Schoor](https://github.com/Bartvds) * [:link:](lscache/lscache.d.ts) [lscache](https://github.com/pamelafox/lscache) by [Chris Martinez](https://github.com/Chris-Martinezz) @@ -477,6 +503,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](main-bower-files/main-bower-files.d.ts) [main-bower-files](https://github.com/ck86/main-bower-files) by [Keita Kagurazaka](https://github.com/k-kagurazaka) * [:link:](mapbox/mapbox.d.ts) [Mapbox](https://www.mapbox.com/mapbox.js) by [Maxime Fabre](https://github.com/anahkiasen) * [:link:](mapsjs/mapsjs.d.ts) [Mapsjs](https://github.com/mapsjs) by [Matthew James Davis](https://github.com/davismj) +* [:link:](mariasql/mariasql.d.ts) [mariasql](https://github.com/mscdex/node-mariasql) by [MichaelBennett](https://github.com/bennett000) * [:link:](marionette/marionette.d.ts) [Marionette](https://github.com/marionettejs) by [Zeeshan Hamid](https://github.com/zhamid), [Natan Vivo](https://github.com/nvivo), [Sven Tschui](https://github.com/sventschui) * [:link:](marked/marked.d.ts) [Marked](https://github.com/chjj/marked) by [William Orr](https://github.com/worr) * [:link:](maskedinput/maskedinput.d.ts) [Masked Input plugin for jQuery](http://digitalbush.com/projects/masked-input-plugin) by [Lokesh Peta](https://github.com/lokeshpeta) @@ -510,6 +537,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](mkpath/mkpath.d.ts) [mkpath](https://www.npmjs.com/package/mkpath) by [Jared Klopper](https://github.com/optical) * [:link:](mocha/mocha.d.ts) [mocha](http://mochajs.org) by [Kazi Manzur Rashid](https://github.com/kazimanzurrashid), [otiai10](https://github.com/otiai10), [jt000](https://github.com/jt000) * [:link:](mocha-phantomjs/mocha-phantomjs.d.ts) [mocha-phantomjs](http://metaskills.net/mocha-phantomjs) by [Erik Schierboom](https://github.com/ErikSchierboom) +* [:link:](mock-fs/mock-fs.d.ts) [mock-fs](https://github.com/tschaub/mock-fs) by [Wim Looman](https://github.com/Nemo157) * [:link:](mockery/mockery.d.ts) [mockery](https://github.com/mfncooper/mockery) by [jt000](https://github.com/jt000) * [:link:](modernizr/modernizr.d.ts) [Modernizr](http://modernizr.com) by [Boris Yankov](https://github.com/borisyankov), [Theodore Brown](https://github.com/theodorejb) * [:link:](moment-timezone/moment-timezone.d.ts) [moment-timezone.js](http://momentjs.com/timezone) by [Michel Salib](https://github.com/michelsalib) @@ -526,6 +554,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](localForage/localForage.d.ts) [Mozilla's localForage](https://github.com/mozilla/localforage) by [david pichsenmeister](https://github.com/3x14159265) * [:link:](msgpack/msgpack.d.ts) [msgpack.js - MessagePack JavaScript Implementation](https://github.com/uupaa/msgpack.js) by [Shinya Mochizuki](https://github.com/enrapt-mochizuki) * [:link:](msnodesql/msnodesql.d.ts) [msnodesql](https://github.com/WindowsAzure/node-sqlserver) by [Boris Yankov](https://github.com/borisyankov), [Maxime LUCE](https://github.com/SomaticIT) +* [:link:](mssql/mssql.d.ts) [mssql](https://www.npmjs.com/package/mssql) by [COLSA Corporation](http://www.colsa.com) * [:link:](mu2/mu2.d.ts) [mu2](http://github.com/raycmorgan/mu) by [Jeff Goddard](https://github.com/jedigo) * [:link:](multer/multer.d.ts) [multer](https://github.com/expressjs/multer) by [jt000](https://github.com/jt000) * [:link:](mustache/mustache.d.ts) [Mustache](https://github.com/janl/mustache.js) by [Mark Ashley Bell](https://github.com/markashleybell) @@ -561,6 +590,9 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](xml2js/xml2js.d.ts) [node-xml2js](https://github.com/Leonidas-from-XIV/node-xml2js) by [Michel Salib](https://github.com/michelsalib), [Jason McNeil](https://github.com/jasonrm) * [:link:](node/node.d.ts) [Node.js](http://nodejs.org) by [Microsoft TypeScript](http://typescriptlang.org), [DefinitelyTyped](https://github.com/borisyankov/DefinitelyTyped) * [:link:](restify/restify.d.ts) [node.js REST framework](https://github.com/mcavage/node-restify) by [Bret Little](https://github.com/blittle) +* [:link:](acl/acl-mongodbBackend.d.ts) [node_acl](https://github.com/optimalbits/node_acl) by [Qubo](https://github.com/tkQubo) +* [:link:](acl/acl.d.ts) [node_acl](https://github.com/optimalbits/node_acl) by [Qubo](https://github.com/tkQubo) +* [:link:](acl/acl-redisBackend.d.ts) [node_acl](https://github.com/optimalbits/node_acl) by [Qubo](https://github.com/tkQubo) * [:link:](mdns/mdns.d.ts) [node_mdns](https://github.com/agnat/node_mdns) by [Stefan Steinhart](https://github.com/reppners) * [:link:](node_redis/node_redis.d.ts) [node_redis](https://github.com/mranney/node_redis) by [Boris Yankov](https://github.com/borisyankov) * [:link:](each/each.d.ts) [NodeEach](http://www.adaltas.com/projects/node-each) by [Michael Zabka](https://github.com/misak113) @@ -568,12 +600,15 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](nodeunit/nodeunit.d.ts) [nodeunit](https://github.com/caolan/nodeunit) by [Jeff Goddard](https://github.com/jedigo) * [:link:](nomnom/nomnom.d.ts) [nomnom](https://github.com/harthur/nomnom) by [Paul Vick](https://github.com/panopticoncentral) * [:link:](nopt/nopt.d.ts) [nopt](https://github.com/npm/nopt) by [jbondc](https://github.com/jbondc) -* [:link:](notify/notify.d.ts) [Notify.js](https://github.com/jpillora/notifyjs) by [Xiaohan Zhang](https://github.com/hellochar) * [:link:](notifyjs/notifyjs.d.ts) [notify.js](https://github.com/alexgibson/notify.js) by [soundTricker](https://github.com/soundTricker) +* [:link:](notify/notify.d.ts) [Notify.js](https://github.com/jpillora/notifyjs) by [Xiaohan Zhang](https://github.com/hellochar) +* [:link:](nouislider/nouislider.d.ts) [nouislider](https://github.com/leongersen/noUiSlider) by [Corey Jepperson](https://github.com/acoreyj) +* [:link:](wnumb/wnumb.d.ts) [nouislider](https://github.com/leongersen/wnumb) by [Corey Jepperson](https://github.com/acoreyj) * [:link:](noVNC/noVNC.d.ts) [noVNC](https://github.com/kanaka/noVNC) by [Ken Smith](https://github.com/smithkl42) * [:link:](npm/npm.d.ts) [npm](https://github.com/npm/npm) by [Maxime LUCE](https://github.com/SomaticIT) -* [:link:](nprogress/nprogress.d.ts) [NProgress](https://github.com/rstacruz/nprogress) by [Judah Gabriel Himango](http://debuggerdotbreak.wordpress.com) +* [:link:](nprogress/NProgress.d.ts) [NProgress](https://github.com/rstacruz/nprogress) by [Judah Gabriel Himango](http://debuggerdotbreak.wordpress.com) * [:link:](numeraljs/numeraljs.d.ts) [Numeral.js](https://github.com/adamwdraper/Numeral-js) by [Vincent Bortone](https://github.com/vbortone) +* [:link:](object-hash/object-hash.d.ts) [object-hash](https://github.com/puleos/object-hash) by [Michael Zabka](https://github.com/misak113) * [:link:](object-path/object-path.d.ts) [objectPath](https://github.com/mariocasciaro/object-path) by [Paulo Cesar](https://github.com/pocesar) * [:link:](oboe/oboe.d.ts) [oboe](https://github.com/jimhigson/oboe.js) by [Jared Klopper](https://github.com/optical) * [:link:](oclazyload/oclazyload.d.ts) [oc.LazyLoad](https://github.com/ocombe/ocLazyLoad) by [Roland Zwaga](https://github.com/rolandzwaga) @@ -588,7 +623,9 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](passport/passport.d.ts) [Passport](http://passportjs.org) by [Horiuchi_H](https://github.com/horiuchi) * [:link:](passport-strategy/passport-strategy.d.ts) [Passport Strategy module](https://github.com/jaredhanson/passport-strategy) by [Lior Mualem](https://github.com/liorm) * [:link:](passport-facebook/passport-facebook.d.ts) [passport-facebook](https://github.com/jaredhanson/passport-facebook) by [James Roland Cabresos](https://github.com/staticfunction) +* [:link:](passport-facebook-token/passport-facebook-token.d.ts) [passport-facebook-token](https://github.com/drudge/passport-facebook-token) by [Ray Martone](https://github.com/rmartone) * [:link:](passport-local/passport-local.d.ts) [passport-local](https://github.com/jaredhanson/passport-local) by [Maxime LUCE](https://github.com/SomaticIT) +* [:link:](path-to-regexp/path-to-regexp.d.ts) [path-to-regexp](https://github.com/pillarjs/path-to-regexp) by [xica](https://github.com/xica) * [:link:](pathwatcher/pathwatcher.d.ts) [pathwatcher](https://github.com/atom/node-pathwatcher) by [vvakame](https://github.com/vvakame) * [:link:](pdf/pdf.d.ts) [PDF.js](https://github.com/mozilla/pdf.js) by [Josh Baldwin](https://github.com/jbaldwin) * [:link:](peerjs/peerjs.d.ts) [PeerJS](http://peerjs.com) by [Toshiya Nakakura](https://github.com/nakakura) @@ -605,8 +642,12 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](platform/platform.d.ts) [Platform](https://github.com/bestiejs/platform.js) by [Jake Hickman](https://github.com/JakeH) * [:link:](playerframework/playerFramework.d.ts) [Player Framework (MMPPF)](https://playerframework.codeplex.com) by [Ricardo Sabino](https://github.com/ricardosabino) * [:link:](pleasejs/please.d.ts) [PleaseJS](http://www.checkman.io/please) by [Toshiya Nakakura](https://github.com/nakakura) +* [:link:](png-async/png-async.d.ts) [png-async](https://github.com/kanreisa/node-png-async) by [Yuki KAN](https://github.com/kanreisa) * [:link:](podcast/podcast.d.ts) [podcast](http://github.com/maxnowack/node-podcast) by [Niklas Mollenhauer](https://github.com/nikeee) * [:link:](poly2tri/poly2tri.d.ts) [poly2tri](http://github.com/r3mi/poly2tri.js) by [Elemar Junior](https://github.com/elemarjr) +* [:link:](polymer/polymer.d.ts) [polymer](https://github.com/polymer) by [Louis Grignon](https://github.com/lgrignon) +* [:link:](polymer/polymer.paper-toast.d.ts) [polymer's paper-toast](https://github.com/Polymer/paper-toast) by [Louis Grignon](https://github.com/lgrignon) +* [:link:](polymer/polymer.core-drawer-panel.d.ts) [polymer's paper-toast](https://github.com/Polymer/core-drawer-panel) by [Louis Grignon](https://github.com/lgrignon) * [:link:](popcorn/popcorn.d.ts) [Popcorn](https://github.com/mozilla/popcorn-js) by [grapswiz](https://github.com/grapswiz) * [:link:](pouchDB/pouch.d.ts) [Pouch](http://pouchdb.com) by [Bill Sears](https://github.com/MrBigDog2U) * [:link:](power-assert/power-assert.d.ts) [power-assert](https://github.com/twada/power-assert) by [vvakame](https://github.com/vvakame) @@ -627,12 +668,15 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](qajax/qajax.d.ts) [Qajax](https://github.com/gre/qajax) by [Boltmade](https://github.com/Boltmade) * [:link:](qunit/qunit.d.ts) [QUnit](http://qunitjs.com) by [Diullei Gomes](https://github.com/diullei) * [:link:](rabbit.js/rabbit.js.d.ts) [rabbit.js](https://github.com/squaremo/rabbit.js) by [Wonshik Kim](https://github.com/wokim) -* [:link:](ractive/ractive.d.ts) [Ractive 0.7.0 edge f22ab8ad0a640591b1c263f57e21d1565cb26bf5](http://ractivejs.org) by [Han Lin Yap](http://yap.nu) +* [:link:](ractive/ractive.d.ts) [Ractive](http://ractivejs.org) by [Han Lin Yap](http://yap.nu) * [:link:](raphael/raphael.d.ts) [Raphael](http://raphaeljs.com) by [CheCoxshall](https://github.com/CheCoxshall) * [:link:](rappid/rappid.d.ts) [Rappid](http://jointjs.com/about-rappid) by [Ewout Van Gossum](https://github.com/DenEwout) * [:link:](ravenjs/ravenjs.d.ts) [Raven.js](https://github.com/getsentry/raven-js) by [Santi Albo](https://github.com/santialbo) -* [:link:](react/react.d.ts) [React](http://facebook.github.io/react) by [Asana](https://asana.com) +* [:link:](react/react.d.ts) [React (external module)](http://facebook.github.io/react) by [Asana](https://asana.com), [AssureSign](http://www.assuresign.com) +* [:link:](react/react-global.d.ts) [React (internal module)](http://facebook.github.io/react) by [Asana](https://asana.com), [AssureSign](http://www.assuresign.com) * [:link:](react-router/react-router.d.ts) [React Router](https://github.com/rackt/react-router) by [Yuichi Murata](https://github.com/mrk21) +* [:link:](react/react-addons.d.ts) [ReactWithAddons (external module)](http://facebook.github.io/react) by [Asana](https://asana.com), [AssureSign](http://www.assuresign.com) +* [:link:](react/react-addons-global.d.ts) [ReactWithAddons (internal module)](http://facebook.github.io/react) by [Asana](https://asana.com), [AssureSign](http://www.assuresign.com) * [:link:](readdir-stream/readdir-stream.d.ts) [readdir-stream](https://github.com/logicalparadox/readdir-stream) by [Bart van der Schoor](https://github.com/Bartvds) * [:link:](redis/redis.d.ts) [redis](https://github.com/mranney/node_redis) by [Carlos Ballesteros Velasco](https://github.com/soywiz), [Peter Harris](https://github.com/CodeAnimal) * [:link:](ref/ref.d.ts) [ref](https://github.com/TooTallNate/ref) by [Paul Loyd](https://github.com/loyd) @@ -641,6 +685,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](ref-union/ref-union.d.ts) [ref-union](https://github.com/TooTallNate/ref-union) by [Paul Loyd](https://github.com/loyd) * [:link:](request/request.d.ts) [request](https://github.com/mikeal/request) by [Carlos Ballesteros Velasco](https://github.com/soywiz), [bonnici](https://github.com/bonnici), [Bart van der Schoor](https://github.com/Bartvds) * [:link:](requirejs/require.d.ts) [RequireJS](http://requirejs.org) by [Josh Baldwin](https://github.com/jbaldwin) +* [:link:](response-time/response-time.d.ts) [response-time](https://github.com/expressjs/response-time) by [Uros Smolnik](https://github.com/urossmolnik) * [:link:](rest/rest.d.ts) [rest.js](https://github.com/cujojs/rest) by [Wim Looman](https://github.com/Nemo157) * [:link:](restangular/restangular.d.ts) [Restangular](https://github.com/mgonto/restangular) by [Boris Yankov](https://github.com/borisyankov) * [:link:](rethinkdb/rethinkdb.d.ts) [Rethinkdb](http://rethinkdb.com) by [Sean Hess](https://seanhess.github.io) @@ -665,6 +710,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](rx/rx.testing.d.ts) [RxJS-Testing](https://github.com/Reactive-Extensions/RxJS) by [Igor Oleinikov](https://github.com/Igorbek) * [:link:](rx/rx.time.d.ts) [RxJS-Time](http://rx.codeplex.com) by [Carl de Billy](http://carl.debilly.net), [Igor Oleinikov](https://github.com/Igorbek) * [:link:](rx/rx.virtualtime.d.ts) [RxJS-VirtualTime](http://rx.codeplex.com) by [gsino](http://www.codeplex.com/site/users/view/gsino), [Igor Oleinikov](https://github.com/Igorbek) +* [:link:](s3-uploader/s3-uploader.d.ts) [s3-uploader](https://www.npmjs.com/package/s3-uploader) by [COLSA Corporation](http://www.colsa.com) * [:link:](sammyjs/sammyjs.d.ts) [Sammy.js](http://sammyjs.org) by [Boris Yankov](https://github.com/borisyankov), [Oisin Grehan](https://github.com/oising) * [:link:](sanitize-filename/sanitize-filename.d.ts) [sanitize-filename](https://github.com/parshap/node-sanitize-filename) by [Wim Looman](https://github.com/Nemo157) * [:link:](sanitize-html/sanitize-html.d.ts) [sanitize-html](https://github.com/punkave/sanitize-html) by [Rogier Schouten](https://github.com/rogierschouten) @@ -676,6 +722,8 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](semver/semver.d.ts) [semver](https://github.com/isaacs/node-semver) by [Bart van der Schoor](https://github.com/Bartvds) * [:link:](sendgrid/sendgrid.d.ts) [sendgrid](https://github.com/sendgrid/sendgrid-nodejs) by [Maxime LUCE](https://github.com/SomaticIT) * [:link:](sequelize/sequelize.d.ts) [Sequelize 2.0.0 dev13](http://sequelizejs.com) by [samuelneff](https://github.com/samuelneff), [Peter Harris](https://github.com/codeanimal) +* [:link:](serve-favicon/serve-favicon.d.ts) [serve-favicon](https://github.com/expressjs/serve-favicon) by [Uros Smolnik](https://github.com/urossmolnik) +* [:link:](serve-static/serve-static.d.ts) [serve-static](https://github.com/expressjs/serve-static) by [Uros Smolnik](https://github.com/urossmolnik) * [:link:](sharedworker/SharedWorker.d.ts) [SharedWorker](http://www.w3.org/TR/workers) by [Toshiya Nakakura](https://github.com/nakakura) * [:link:](shelljs/shelljs.d.ts) [ShellJS](http://shelljs.org) by [Niklas Mollenhauer](https://github.com/nikeee) * [:link:](should-promised/should-promised.d.ts) [should-promised](https://github.com/shouldjs/promised) by [Yaroslav Admin](https://github.com/devoto13) @@ -710,6 +758,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](sprintf/sprintf.d.ts) [sprintff](https://github.com/maritz/node-sprintff) by [Carlos Ballesteros Velasco](https://github.com/soywiz) * [:link:](sharepoint/SharePoint.d.ts) [sptypescript](http://sptypescript.codeplex.com) by [Stanislav Vyshchepan](http://gandjustas.blogspot.ru), [Andrey Markeev](http://markeev.com) * [:link:](sqlite3/sqlite3.d.ts) [sqlite3](https://github.com/mapbox/node-sqlite3) by [Nick Malaguti](https://github.com/nmalaguti) +* [:link:](stack-mapper/stack-mapper.d.ts) [stack-mapper](https://github.com/thlorenz/stack-mapper) by [Rogier Schouten](https://github.com/rogierschouten) * [:link:](stampit/stampit.d.ts) [stampit](https://github.com/ericelliott/stampit) by [Vasyl Boroviak](https://github.com/koresar) * [:link:](stats/stats.d.ts) [Stats.js r12](http://github.com/mrdoob/stats.js) by [Gregory Dalton](https://github.com/gregolai) * [:link:](status-bar/status-bar.d.ts) [status-bar](https://github.com/atom/status-bar) by [vvakame](https://github.com/vvakame) @@ -774,6 +823,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](type-detect/type-detect.d.ts) [type-detect](https://github.com/chaijs/type-detect) by [Bart van der Schoor](https://github.com/Bartvds) * [:link:](typeahead/typeahead.d.ts) [typeahead.js](http://twitter.github.io/typeahead.js) by [Ivaylo Gochkov](https://github.com/igochkov), [Gidon Junge](https://github.com/gjunge) * [:link:](typescript/typescript.d.ts) [TypeScript API](http://www.typescriptlang.org) by [Microsoft TypeScript](http://typescriptlang.org) +* [:link:](typescript-deferred/typescript-deferred.d.ts) [typescript-deferred](https://github.com/DirtyHairy/typescript-deferred) by [Christian Speckner](https://github.com/DirtyHairy) * [:link:](typescript-services/typescriptServices.d.ts) [TypeScript-Services](https://www.npmjs.org/package/typescript-services) by [Basarat Ali Syed](http://github.com/basarat) * [:link:](unity-webapi/unity-webapi.d.ts) [Ubuntu Unity Web API](https://launchpad.net/libunity-webapps) by [John Vrbanac](jhttps://github.com/jmvrbanac) * [:link:](underscore/underscore.d.ts) [Underscore](http://underscorejs.org) by [Boris Yankov](https://github.com/borisyankov), [Josh Baldwin](https://github.com/jbaldwin) @@ -804,6 +854,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](webspeechapi/webspeechapi.d.ts) [Web Speech API](https://dvcs.w3.org/hg/speech-api/raw-file/tip/speechapi.html) by [SaschaNaz](https://github.com/saschanaz) * [:link:](webcola/webcola.d.ts) [webcola](https://github.com/tgdwyer/WebCola) by [Qinfeng Chen](https://github.com/qinfchen) * [:link:](webcrypto/WebCrypto.d.ts) [WebCrypto](http://www.w3.org/TR/WebCryptoAPI) by [Lucas Dixon](https://github.com/iislucas) +* [:link:](webix/webix.d.ts) [Webix UI](http://webix.com) by [Maksim Kozhukh](http://github.com/mkozhukh) * [:link:](webrtc/MediaStream.d.ts) [WebRTC](http://dev.w3.org/2011/webrtc) by [Ken Smith](https://github.com/smithkl42) * [:link:](websocket/websocket.d.ts) [websocket](https://github.com/Worlize/WebSocket-Node) by [Paul Loyd](https://github.com/loyd) * [:link:](when/when.d.ts) [When](https://github.com/cujojs/when) by [Derek Cicerone](https://github.com/derekcicerone), [Wim Looman](https://github.com/Nemo157) diff --git a/FileSaver/FileSaver-tests.ts.tscparams b/FileSaver/FileSaver-tests.ts.tscparams deleted file mode 100644 index 934bc29ef..000000000 --- a/FileSaver/FileSaver-tests.ts.tscparams +++ /dev/null @@ -1 +0,0 @@ ---noImplicitAny \ No newline at end of file diff --git a/acl/acl-mongodbBackend-tests.ts b/acl/acl-mongodbBackend-tests.ts new file mode 100644 index 000000000..31411b65c --- /dev/null +++ b/acl/acl-mongodbBackend-tests.ts @@ -0,0 +1,17 @@ +/// + +// https://github.com/OptimalBits/node_acl/blob/master/Readme.md +import Acl = require('acl'); +import mongodb = require('mongodb'); + +var db: mongodb.Db; + +// Using the mongo db backend +var acl = new Acl(new Acl.mongodbBackend(db, 'acl_', true)); + +// guest is allowed to view blogs +acl.allow('guest', 'blogs', 'view'); + +// allow function accepts arrays as any parameter +acl.allow('member', 'blogs', ['edit','view', 'delete']); + diff --git a/acl/acl-mongodbBackend.d.ts b/acl/acl-mongodbBackend.d.ts new file mode 100644 index 000000000..8dbfb7e90 --- /dev/null +++ b/acl/acl-mongodbBackend.d.ts @@ -0,0 +1,22 @@ +// Type definitions for node_acl 0.4.7 +// Project: https://github.com/optimalbits/node_acl +// Definitions by: Qubo +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// +/// + +declare module "acl" { + import mongo = require('mongodb'); + + interface AclStatic { + mongodbBackend: MongodbBackendStatic; + } + + interface MongodbBackend extends Backend { } + interface MongodbBackendStatic { + new(db: mongo.Db, prefix: string, useSingle: boolean): MongodbBackend; + new(db: mongo.Db, prefix: string): MongodbBackend; + new(db: mongo.Db): MongodbBackend; + } +} diff --git a/acl/acl-redisBackend-test.ts b/acl/acl-redisBackend-test.ts new file mode 100644 index 000000000..e1bf29af4 --- /dev/null +++ b/acl/acl-redisBackend-test.ts @@ -0,0 +1,16 @@ +/// + +// https://github.com/OptimalBits/node_acl/blob/master/Readme.md +import Acl = require('acl'); +import redis = require('redis'); + +var client: redis.RedisClient; + +// Using the redis backend +var acl = new Acl(new Acl.redisBackend(client, 'acl_')); + +// guest is allowed to view blogs +acl.allow('guest', 'blogs', 'view'); + +// allow function accepts arrays as any parameter +acl.allow('member', 'blogs', ['edit','view', 'delete']); diff --git a/acl/acl-redisBackend.d.ts b/acl/acl-redisBackend.d.ts new file mode 100644 index 000000000..e199f8b81 --- /dev/null +++ b/acl/acl-redisBackend.d.ts @@ -0,0 +1,21 @@ +// Type definitions for node_acl 0.4.7 +// Project: https://github.com/optimalbits/node_acl +// Definitions by: Qubo +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// +/// + +declare module "acl" { + import redis = require('redis'); + + interface AclStatic { + redisBackend: RedisBackendStatic; + } + + interface RedisBackend extends Backend { } + interface RedisBackendStatic { + new(redis: redis.RedisClient, prefix: string): RedisBackend; + new(redis: redis.RedisClient): RedisBackend; + } +} diff --git a/acl/acl-tests.ts b/acl/acl-tests.ts new file mode 100644 index 000000000..551ad9c1c --- /dev/null +++ b/acl/acl-tests.ts @@ -0,0 +1,65 @@ +/// + +// Sample code from +// https://github.com/OptimalBits/node_acl/blob/master/Readme.md +import Acl = require('acl'); + +var report = (err: Error, value: T) => { + if (err) { + console.error(err); + } + console.info(value); +}; + +// Using the memory backend +var acl = new Acl(new Acl.memoryBackend()); + +// guest is allowed to view blogs +acl.allow('guest', 'blogs', 'view'); + +// allow function accepts arrays as any parameter +acl.allow('member', 'blogs', ['edit','view', 'delete']); + +acl.addUserRoles('joed', 'guest'); + +acl.addRoleParents('baz', ['foo','bar']); + +acl.allow('foo', ['blogs','forums','news'], ['view', 'delete']); + +acl.allow('admin', ['blogs','forums'], '*'); + +acl.allow([ + { + roles:['guest','special-member'], + allows:[ + {resources:'blogs', permissions:'get'}, + {resources:['forums','news'], permissions:['get','put','delete']} + ] + }, + { + roles:['gold','silver'], + allows:[ + {resources:'cash', permissions:['sell','exchange']}, + {resources:['account','deposit'], permissions:['put','delete']} + ] + } +]); + +acl.isAllowed('joed', 'blogs', 'view', (err, res) => { + if (res) { + console.log("User joed is allowed to view blogs"); + } +}); + +acl.isAllowed('jsmith', 'blogs', ['edit','view','delete']) +.then((result) => { + console.dir('jsmith is allowed blogs ' + result); + acl.addUserRoles('jsmith', 'member'); +}).then(() => + acl.isAllowed('jsmith', 'blogs', ['edit','view','delete']) +).then((result) => + console.dir('jsmith is allowed blogs ' + result) +).then(() => { + acl.allowedPermissions('james', ['blogs','forums'], report); + acl.allowedPermissions('jsmith', ['blogs','forums'], report); +}); diff --git a/acl/acl.d.ts b/acl/acl.d.ts new file mode 100644 index 000000000..5d0498fed --- /dev/null +++ b/acl/acl.d.ts @@ -0,0 +1,120 @@ +// Type definitions for node_acl 0.4.7 +// Project: https://github.com/optimalbits/node_acl +// Definitions by: Qubo +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// +/// + +declare module "acl" { + import http = require('http'); + import Promise = require("bluebird"); + + type strings = string|string[]; + type Value = string|number; + type Values = Value|Value[]; + type Action = () => any; + type Callback = (err: Error) => any; + type AnyCallback = (err: Error, obj: any) => any; + type AllowedCallback = (err: Error, allowed: boolean) => any; + type GetUserId = (req: http.ServerRequest, res: http.ServerResponse) => Value; + + interface AclStatic { + new (backend: Backend, logger: Logger, options: Option): Acl; + new (backend: Backend, logger: Logger): Acl; + new (backend: Backend): Acl; + memoryBackend: MemoryBackendStatic; + } + + interface Logger { + debug: (msg: string)=>any; + } + + interface Acl { + addUserRoles: (userId: Value, roles: strings, cb?: Callback) => Promise; + removeUserRoles: (userId: Value, roles: strings, cb?: Callback) => Promise; + userRoles: (userId: Value, cb?: (err: Error, roles: string[])=>any) => Promise; + roleUsers: (role: Value, cb?: (err: Error, users: Values)=>any) => Promise; + hasRole: (userId: Value, role: string, cb?: (err: Error, isInRole: boolean)=>any) => Promise; + addRoleParents: (role: string, parents: Values, cb?: Callback) => Promise; + removeRole: (role: string, cb?: Callback) => Promise; + removeResource: (resource: string, cb?: Callback) => Promise; + allow: { + (roles: Values, resources: strings, permissions: strings, cb?: Callback): Promise; + (aclSets: AclSet|AclSet[]): Promise; + } + removeAllow: (role: string, resources: strings, permissions: strings, cb?: Callback) => Promise; + removePermissions: (role: string, resources: strings, permissions: strings, cb?: Function) => Promise; + allowedPermissions: (userId: Value, resources: strings, cb?: AnyCallback) => Promise; + isAllowed: (userId: Value, resources: strings, permissions: strings, cb?: AllowedCallback) => Promise; + areAnyRolesAllowed: (roles: strings, resource: strings, permissions: strings, cb?: AllowedCallback) => Promise; + whatResources: (roles: strings, permissions: strings, cb?: AnyCallback) => Promise; + permittedResources: (roles: strings, permissions: strings, cb?: Function) => Promise; + middleware: (numPathComponents: number, userId: Value|GetUserId, actions: strings) => Promise; + } + + interface Option { + buckets?: BucketsOption; + } + + interface BucketsOption { + meta?: string; + parents?: string; + permissions?: string; + resources?: string; + roles?: string; + users?: string; + } + + interface AclSet { + roles: strings; + allows: AclAllow[]; + } + + interface AclAllow { + resources: strings; + permissions: strings; + } + + interface MemoryBackend extends Backend { } + interface MemoryBackendStatic { + new(): MemoryBackend; + } + + // + // For internal use + // + interface Backend { + begin: () => T; + end: (transaction: T, cb?: Action) => void; + clean: (cb?: Action) => void; + get: (bucket: string, key: Value, cb?: Action) => void; + union: (bucket: string, keys: Value[], cb?: Action) => void; + add: (transaction: T, bucket: string, key: Value, values: Values) => void; + del: (transaction: T, bucket: string, keys: Value[]) => void; + remove: (transaction: T, bucket: string, key: Value, values: Values) => void; + + endAsync: Function; //TODO: Give more specific function signature + getAsync: Function; + cleanAsync: Function; + unionAsync: Function; + } + + interface Contract { + (args: IArguments): Contract|NoOp; + debug: boolean; + fulfilled: boolean; + args: any[]; + checkedParams: string[]; + params: (...types: string[]) => Contract|NoOp; + end: () => void; + } + + interface NoOp { + params: (...types: string[]) => NoOp; + end: () => void; + } + + var _: AclStatic; + export = _; +} diff --git a/angular-file-upload/angular-file-upload.d.ts b/angular-file-upload/angular-file-upload.d.ts index f2a6bd042..2eb0e72b5 100644 --- a/angular-file-upload/angular-file-upload.d.ts +++ b/angular-file-upload/angular-file-upload.d.ts @@ -5,7 +5,7 @@ /// -declare module ng.angularFileUpload { +declare module angular.angularFileUpload { interface IUploadService { diff --git a/angular-hotkeys/angular-hotkeys.d.ts b/angular-hotkeys/angular-hotkeys.d.ts index 0c0b9109a..3340f9ff3 100644 --- a/angular-hotkeys/angular-hotkeys.d.ts +++ b/angular-hotkeys/angular-hotkeys.d.ts @@ -5,7 +5,7 @@ /// -declare module ng.hotkeys { +declare module angular.hotkeys { interface HotkeysProvider { template: string; diff --git a/angular-http-auth/angular-http-auth.d.ts b/angular-http-auth/angular-http-auth.d.ts index 297761c47..4a08272cd 100644 --- a/angular-http-auth/angular-http-auth.d.ts +++ b/angular-http-auth/angular-http-auth.d.ts @@ -5,7 +5,7 @@ /// -declare module ng.httpAuth { +declare module angular.httpAuth { interface IAuthService { loginConfirmed(data?:any, configUpdater?:Function):void; loginCancelled(data?:any, reason?:any):void; diff --git a/angular-idle/angular-idle.d.ts b/angular-idle/angular-idle.d.ts index 57ef2380b..4e1e98fb5 100644 --- a/angular-idle/angular-idle.d.ts +++ b/angular-idle/angular-idle.d.ts @@ -5,7 +5,7 @@ /// -declare module ng.idle { +declare module angular.idle { /** * Used to configure the $keepalive service. @@ -131,4 +131,4 @@ declare module ng.idle { */ unwatch(): void; } -} \ No newline at end of file +} diff --git a/angular-local-storage/angular-local-storage-tests.ts b/angular-local-storage/angular-local-storage-tests.ts index fde523af5..cf61d20c9 100644 --- a/angular-local-storage/angular-local-storage-tests.ts +++ b/angular-local-storage/angular-local-storage-tests.ts @@ -12,55 +12,53 @@ interface TestScope extends ng.IScope { property: string; } -module ng.local.storage.tests { - export class TestController { - constructor($scope: TestScope, localStorageService: ng.local.storage.ILocalStorageService) { - // isSupported - if (localStorageService.isSupported) { - // do something - } - - // getStorageType - var storageType: string = localStorageService.getStorageType(); - - // set - $scope.submit = (key, value) => { - return localStorageService.set(key, value); - }; - - // get - $scope.getItem = (key) => { - return localStorageService.get(key); - }; - - // remove - $scope.removeItem = (key) => { - return localStorageService.remove(key); - }; - - // clearAll(regexp) - $scope.clearNumbers = () => { - return localStorageService.clearAll(/^\d+$/); - }; - - // clearAll - $scope.clearAll = () => { - return localStorageService.clearAll(); - }; - - // keys - var lsKeys = localStorageService.keys(); - - // bind - localStorageService.set('property', 'oldValue'); - $scope.unbind = localStorageService.bind($scope, 'property'); - - // deriveKey - console.log(localStorageService.deriveKey('property')); // ls.property - - // length - var lsLength: number = localStorageService.length(); +export class TestController { + constructor($scope: TestScope, localStorageService: ng.local.storage.ILocalStorageService) { + // isSupported + if (localStorageService.isSupported) { + // do something } + + // getStorageType + var storageType: string = localStorageService.getStorageType(); + + // set + $scope.submit = (key, value) => { + return localStorageService.set(key, value); + }; + + // get + $scope.getItem = (key) => { + return localStorageService.get(key); + }; + + // remove + $scope.removeItem = (key) => { + return localStorageService.remove(key); + }; + + // clearAll(regexp) + $scope.clearNumbers = () => { + return localStorageService.clearAll(/^\d+$/); + }; + + // clearAll + $scope.clearAll = () => { + return localStorageService.clearAll(); + }; + + // keys + var lsKeys = localStorageService.keys(); + + // bind + localStorageService.set('property', 'oldValue'); + $scope.unbind = localStorageService.bind($scope, 'property'); + + // deriveKey + console.log(localStorageService.deriveKey('property')); // ls.property + + // length + var lsLength: number = localStorageService.length(); } } @@ -72,4 +70,4 @@ app.config(function (localStorageServiceProvider: ng.local.storage.ILocalStorage .setNotify(true, true); }); -app.controller('TestController', ng.local.storage.tests.TestController); +app.controller('TestController', TestController); diff --git a/angular-local-storage/angular-local-storage.d.ts b/angular-local-storage/angular-local-storage.d.ts index 07c7157e1..d40630a2a 100644 --- a/angular-local-storage/angular-local-storage.d.ts +++ b/angular-local-storage/angular-local-storage.d.ts @@ -5,7 +5,7 @@ /// -declare module ng.local.storage { +declare module angular.local.storage { interface ILocalStorageServiceProvider extends IServiceProvider { /** * Setter for the prefix diff --git a/angular-material/angular-material-tests.ts b/angular-material/angular-material-tests.ts new file mode 100644 index 000000000..ae091c805 --- /dev/null +++ b/angular-material/angular-material-tests.ts @@ -0,0 +1,94 @@ +/// + +var myApp = angular.module('testModule', ['ngMaterial']); + +myApp.config(( + $mdThemingProvider: ng.material.MDThemingProvider, + $mdIconProvider: ng.material.MDIconProvider) => { + + $mdThemingProvider.alwaysWatchTheme(true); + var neonRedMap: ng.material.MDPalette = $mdThemingProvider.extendPalette('red', { + '500': 'ff0000' + }); + // Register the new color palette map with the name neonRed + $mdThemingProvider.definePalette('neonRed', neonRedMap); + // Use that theme for the primary intentions + $mdThemingProvider.theme('default') + .primaryPalette('neonRed') + .accentPalette('blue') + .backgroundPalette('grey') + .warnPalette('red') + .dark(true); + + $mdIconProvider + .defaultIconSet('my/app/icons.svg') // Register a default set of SVG icons + .iconSet('social', 'my/app/social.svg') // Register a named icon set of SVGs + .icon('android', 'my/app/android.svg') // Register a specific icon (by name) + .icon('work:chair', 'my/app/chair.svg'); // Register icon in a specific set +}); + +myApp.controller('BottomSheetController', ($scope: ng.IScope, $mdBottomSheet: ng.material.MDBottomSheetService) => { + $scope['openBottomSheet'] = () => { + $mdBottomSheet.show({ + template: 'Hello!' + }); + }; + $scope['hideBottomSheet'] = $mdBottomSheet.hide.bind($mdBottomSheet, 'hide'); + $scope['cancelBottomSheet'] = $mdBottomSheet.cancel.bind($mdBottomSheet, 'cancel'); +}); + +myApp.controller('DialogController', ($scope: ng.IScope, $mdDialog: ng.material.MDDialogService) => { + $scope['openDialog'] = () => { + $mdDialog.show({ + template: 'Hello!' + }); + }; + $scope['alertDialog'] = () => { + $mdDialog.show($mdDialog.alert().content('Alert!')); + }; + $scope['confirmDialog'] = () => { + $mdDialog.show($mdDialog.confirm().content('Confirm!')); + }; + $scope['hideDialog'] = $mdDialog.hide.bind($mdDialog, 'hide'); + $scope['cancelDialog'] = $mdDialog.cancel.bind($mdDialog, 'cancel'); +}); + +class IconDirective implements ng.IDirective { + + private $mdIcon: ng.material.MDIcon; + constructor($mdIcon: ng.material.MDIcon) { + this.$mdIcon = $mdIcon; + } + + public link($scope: ng.IScope, $elm: ng.IAugmentedJQuery) { + this.$mdIcon('android').then((iconEl: Element) => $elm.append(iconEl)); + this.$mdIcon('work:chair').then((iconEl: Element) => $elm.append(iconEl)); + // Load and cache the external SVG using a URL + this.$mdIcon('img/icons/android.svg').then((iconEl: Element) => { + $elm.append(iconEl); + }); + } +} +myApp.directive('icon-directive', ($mdIcon: ng.material.MDIcon) => new IconDirective($mdIcon)); + +myApp.controller('MediaController', ($scope: ng.IScope, $mdMedia: ng.material.MDMedia) => { + $scope.$watch(() => $mdMedia('lg'), (big: boolean) => { + $scope['bigScreen'] = big; + }); + $scope['screenIsSmall'] = $mdMedia('sm'); + $scope['customQuery'] = $mdMedia('(min-width: 1234px)'); + $scope['anotherCustom'] = $mdMedia('max-width: 300px'); +}); + +myApp.controller('SidenavController', ($scope: ng.IScope, $mdSidenav: ng.material.MDSidenavService) => { + var componentId = 'left'; + $scope['toggle'] = () => $mdSidenav(componentId).toggle(); + $scope['open'] = () => $mdSidenav(componentId).open(); + $scope['close'] = () => $mdSidenav(componentId).close(); + $scope['isOpen'] = $mdSidenav(componentId).isOpen(); + $scope['isLockedOpen'] = $mdSidenav(componentId).isLockedOpen(); +}); + +myApp.controller('ToastController', ($scope: ng.IScope, $mdToast: ng.material.MDToastService) => { + $scope['openToast'] = () => $mdToast.show($mdToast.simple().content('Hello!')); +}); \ No newline at end of file diff --git a/angular-material/angular-material.d.ts b/angular-material/angular-material.d.ts new file mode 100644 index 000000000..cf7a20d79 --- /dev/null +++ b/angular-material/angular-material.d.ts @@ -0,0 +1,195 @@ +// Type definitions for Angular Material 0.8.3+ (ng.material module) +// Project: https://github.com/angular/material +// Definitions by: Matt Traynham +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// +declare module angular.material { + + interface MDBottomSheetOptions { + templateUrl?: string; + template?: string; + controller?: any; + locals?: {[index: string]: any}; + targetEvent?: any; + resolve?: {[index: string]: ng.IPromise} + controllerAs?: string; + parent?: Element; + disableParentScroll?: boolean; + } + + interface MDBottomSheetService { + show(options: MDBottomSheetOptions): ng.IPromise; + hide(response?: any): void; + cancel(response?: any): void; + } + + interface MDPresetDialog { + title(title: string): T; + content(content: string): T; + ok(content: string): T; + theme(theme: string): T; + } + + interface MDAlertDialog extends MDPresetDialog { + } + + interface MDConfirmDialog extends MDPresetDialog { + cancel(reason?: string): MDConfirmDialog; + } + + interface MDDialogOptions { + templateUrl?: string; + template?: string; + domClickEvent?: any; + disableParentScroll?: boolean; + clickOutsideToClose?: boolean; + hasBackdrop?: boolean; + escapeToClose?: boolean; + controller?: any; + locals?: {[index: string]: any}; + bindToController?: boolean; + resolve?: {[index: string]: ng.IPromise} + controllerAs?: string; + parent?: Element; + onComplete?: Function; + } + + interface MDDialogService { + show(dialog: MDDialogOptions|MDPresetDialog): ng.IPromise; + confirm(): MDConfirmDialog; + alert(): MDAlertDialog; + hide(response?: any): void; + cancel(response?: any): void; + } + + interface MDIcon { + (path: string): ng.IPromise; + } + + interface MDIconProvider { + icon(id: string, url: string, iconSize?: string): MDIconProvider; + iconSet(id: string, url: string, iconSize?: string): MDIconProvider; + defaultIconSet(url: string, iconSize?: string): MDIconProvider; + defaultIconSize(iconSize: string): MDIconProvider; + } + + interface MDMedia { + (media: string): boolean; + } + + interface MDSidenavObject { + toggle(): void; + open(): void; + close(): void; + isOpen(): boolean; + isLockedOpen(): boolean; + } + + interface MDSidenavService { + (component: string): MDSidenavObject; + } + + interface MDToastPreset { + content(content: string): T; + action(action: string): T; + highlightAction(highlightAction: boolean): T; + capsule(capsule: boolean): T; + theme(theme: string): T; + hideDelay(delay: number): T; + } + + interface MDSimpleToastPreset extends MDToastPreset { + } + + interface MDToastOptions { + templateUrl?: string; + template?: string; + hideDelay?: number; + position?: string; + controller?: any; + locals?: {[index: string]: any}; + bindToController?: boolean; + resolve?: {[index: string]: ng.IPromise} + controllerAs?: string; + parent?: Element; + } + + interface MDToastService { + show(optionsOrPreset: MDToastOptions|MDToastPreset): ng.IPromise; + showSimple(): ng.IPromise; + simple(): MDSimpleToastPreset; + build(): MDToastPreset; + updateContent(): void; + hide(response?: any): void; + cancel(response?: any): void; + } + + interface MDPalette { + 0?: string; + 50?: string; + 100?: string; + 200?: string; + 300?: string; + 400?: string; + 500?: string; + 600?: string; + 700?: string; + 800?: string; + 900?: string; + A100?: string; + A200?: string; + A400?: string; + A700?: string; + contrastDefaultColor?: string; + contrastDarkColors?: string; + contrastStrongLightColors?: string; + } + + interface MDThemeHues { + default?: string; + 'hue-1'?: string; + 'hue-2'?: string; + 'hue-3'?: string; + } + + interface MDThemePalette { + name: string; + hues: MDThemeHues; + } + + interface MDThemeColors { + accent: MDThemePalette; + background: MDThemePalette; + primary: MDThemePalette; + warn: MDThemePalette; + } + + interface MDThemeGrayScalePalette { + 1: string; + 2: string; + 3: string; + 4: string; + name: string; + } + + interface MDTheme { + name: string; + colors: MDThemeColors; + foregroundPalette: MDThemeGrayScalePalette; + foregroundShadow: string; + accentPalette(name: string, hues?: MDThemeHues): MDTheme; + primaryPalette(name: string, hues?: MDThemeHues): MDTheme; + warnPalette(name: string, hues?: MDThemeHues): MDTheme; + backgroundPalette(name: string, hues?: MDThemeHues): MDTheme; + dark(isDark?: boolean): MDTheme; + } + + interface MDThemingProvider { + theme(name: string, inheritFrom?: string): MDTheme; + definePalette(name: string, palette: MDPalette): MDThemingProvider; + extendPalette(name: string, palette: MDPalette): MDPalette; + setDefaultTheme(theme: string): void; + alwaysWatchTheme(alwaysWatch: boolean): void; + } +} diff --git a/angular-notify/angular-notify.d.ts b/angular-notify/angular-notify.d.ts index bbb7c1e6b..7e55dc654 100644 --- a/angular-notify/angular-notify.d.ts +++ b/angular-notify/angular-notify.d.ts @@ -5,7 +5,7 @@ /// -declare module ng.cgNotify { +declare module angular.cgNotify { interface INotifyService { @@ -113,4 +113,4 @@ declare module ng.cgNotify { */ close():void; } -} \ No newline at end of file +} diff --git a/angular-translate/angular-translate.d.ts b/angular-translate/angular-translate.d.ts index 135ac75ad..c972c927d 100644 --- a/angular-translate/angular-translate.d.ts +++ b/angular-translate/angular-translate.d.ts @@ -5,7 +5,7 @@ /// -declare module ng.translate { +declare module angular.translate { interface ITranslatePartialLoaderService { addPart(name: string): ITranslatePartialLoaderService; diff --git a/angular-ui-bootstrap/angular-ui-bootstrap.d.ts b/angular-ui-bootstrap/angular-ui-bootstrap.d.ts index ad90dc9db..d7e65c77c 100644 --- a/angular-ui-bootstrap/angular-ui-bootstrap.d.ts +++ b/angular-ui-bootstrap/angular-ui-bootstrap.d.ts @@ -5,7 +5,7 @@ /// -declare module ng.ui.bootstrap { +declare module angular.ui.bootstrap { interface IAccordionConfig { /** @@ -190,15 +190,15 @@ declare module ng.ui.bootstrap { /** * a promise that is resolved when a modal is closed and rejected when a modal is dismissed */ - result: ng.IPromise; + result: angular.IPromise; /** * a promise that is resolved when a modal gets opened after downloading content's template and resolving all variables */ - opened: ng.IPromise; + opened: angular.IPromise; } - interface IModalScope extends ng.IScope { + interface IModalScope extends angular.IScope { /** * Those methods make it easy to close a modal window without a need to create a dedicated controller */ @@ -623,11 +623,11 @@ declare module ng.ui.bootstrap { * * @return A promise that is resolved when the transition finishes. */ - (element: ng.IAugmentedJQuery, trigger: any, options?: ITransitionServiceOptions): ng.IPromise; + (element: angular.IAugmentedJQuery, trigger: any, options?: ITransitionServiceOptions): angular.IPromise; } interface ITransitionServiceOptions { animation?: boolean; } -} \ No newline at end of file +} diff --git a/angular-ui/angular-ui-router-tests.ts b/angular-ui-router/angular-ui-router-tests.ts similarity index 100% rename from angular-ui/angular-ui-router-tests.ts rename to angular-ui-router/angular-ui-router-tests.ts diff --git a/angular-ui-router/angular-ui-router.d.ts b/angular-ui-router/angular-ui-router.d.ts new file mode 100644 index 000000000..0cf796832 --- /dev/null +++ b/angular-ui-router/angular-ui-router.d.ts @@ -0,0 +1,186 @@ +// Type definitions for Angular JS 1.1.5+ (ui.router module) +// Project: https://github.com/angular-ui/ui-router +// Definitions by: Michel Salib +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module angular.ui { + + interface IState { + name?: string; + /** + * String HTML content, or function that returns an HTML string + */ + template?: string | {(): string}; + /** + * String URL path to template file OR Function, returns URL path string + */ + templateUrl?: string | {(): string}; + /** + * Function, returns HTML content string + */ + templateProvider?: Function; + /** + * A controller paired to the state. Function OR name as String + */ + controller?: Function | string; + controllerAs?: string; + /** + * Function (injectable), returns the actual controller function or string. + */ + controllerProvider?: Function; + resolve?: {}; + /** + * A url with optional parameters. When a state is navigated or transitioned to, the $stateParams service will be populated with any parameters that were passed. + */ + url?: string; + /** + * A map which optionally configures parameters declared in the url, or defines additional non-url parameters. Only use this within a state if you are not using url. Otherwise you can specify your parameters within the url. When a state is navigated or transitioned to, the $stateParams service will be populated with any parameters that were passed. + */ + params?: any; + /** + * Use the views property to set up multiple views. If you don't need multiple views within a single state this property is not needed. Tip: remember that often nested views are more useful and powerful than multiple sibling views. + */ + views?: {}; + abstract?: boolean; + /** + * Callback functions for when a state is entered and exited. Good way to trigger an action or dispatch an event, such as opening a dialog. + */ + onEnter?: Function; + /** + * Callback functions for when a state is entered and exited. Good way to trigger an action or dispatch an event, such as opening a dialog. + */ + onExit?: Function; + /** + * Arbitrary data object, useful for custom configuration. + */ + data?: any; + /** + * Boolean (default true). If false will not retrigger the same state just because a search/query parameter has changed. Useful for when you'd like to modify $location.search() without triggering a reload. + */ + reloadOnSearch?: boolean; + } + + interface IStateProvider extends IServiceProvider { + state(name:string, config:IState): IStateProvider; + state(config:IState): IStateProvider; + decorator(name?: string, decorator?: (state: IState, parent: Function) => any): any; + } + + interface IUrlMatcher { + concat(pattern: string): IUrlMatcher; + exec(path: string, searchParams: {}): {}; + parameters(): string[]; + format(values: {}): string; + } + + interface IUrlMatcherFactory { + compile(pattern: string): IUrlMatcher; + isMatcher(o: any): boolean; + type(name: string, definition: any, definitionFn?: any): any; + } + + interface IUrlRouterProvider extends IServiceProvider { + when(whenPath: RegExp, handler: Function): IUrlRouterProvider; + when(whenPath: RegExp, handler: any[]): IUrlRouterProvider; + when(whenPath: RegExp, toPath: string): IUrlRouterProvider; + when(whenPath: IUrlMatcher, hanlder: Function): IUrlRouterProvider; + when(whenPath: IUrlMatcher, handler: any[]): IUrlRouterProvider; + when(whenPath: IUrlMatcher, toPath: string): IUrlRouterProvider; + when(whenPath: string, handler: Function): IUrlRouterProvider; + when(whenPath: string, handler: any[]): IUrlRouterProvider; + when(whenPath: string, toPath: string): IUrlRouterProvider; + otherwise(handler: Function): IUrlRouterProvider; + otherwise(handler: any[]): IUrlRouterProvider; + otherwise(path: string): IUrlRouterProvider; + rule(handler: Function): IUrlRouterProvider; + rule(handler: any[]): IUrlRouterProvider; + } + + interface IStateOptions { + /** + * {boolean=true|string=} - If true will update the url in the location bar, if false will not. If string, must be "replace", which will update url and also replace last history record. + */ + location?: boolean | string; + /** + * {boolean=true}, If true will inherit url parameters from current url. + */ + inherit?: boolean; + /** + * {object=$state.$current}, When transitioning with relative path (e.g '^'), defines which state to be relative from. + */ + relative?: IState; + /** + * {boolean=true}, If true will broadcast $stateChangeStart and $stateChangeSuccess events. + */ + notify?: boolean; + /** + * {boolean=false}, If true will force transition even if the state or params have not changed, aka a reload of the same state. It differs from reloadOnSearch because you'd use this when you want to force a reload when everything is the same, including search params. + */ + reload?: boolean; + } + + interface IHrefOptions { + lossy?: boolean; + inherit?: boolean; + relative?: IState; + absolute?: boolean; + } + + interface IStateService { + /** + * Convenience method for transitioning to a new state. $state.go calls $state.transitionTo internally but automatically sets options to { location: true, inherit: true, relative: $state.$current, notify: true }. This allows you to easily use an absolute or relative to path and specify only the parameters you'd like to update (while letting unspecified parameters inherit from the currently active ancestor states). + * + * @param to Absolute state name or relative state path. Some examples: + * + * $state.go('contact.detail') - will go to the contact.detail state + * $state.go('^') - will go to a parent state + * $state.go('^.sibling') - will go to a sibling state + * $state.go('.child.grandchild') - will go to grandchild state + * + * @param params A map of the parameters that will be sent to the state, will populate $stateParams. Any parameters that are not specified will be inherited from currently defined parameters. This allows, for example, going to a sibling state that shares parameters specified in a parent state. Parameter inheritance only works between common ancestor states, I.e. transitioning to a sibling will get you the parameters for all parents, transitioning to a child will get you all current parameters, etc. + * + * @param options Options object. + */ + go(to: string, params?: {}, options?: IStateOptions): IPromise; + transitionTo(state: string, params?: {}, updateLocation?: boolean): void; + transitionTo(state: string, params?: {}, options?: IStateOptions): void; + includes(state: string, params?: {}): boolean; + is(state:string, params?: {}): boolean; + is(state: IState, params?: {}): boolean; + href(state: IState, params?: {}, options?: IHrefOptions): string; + href(state: string, params?: {}, options?: IHrefOptions): string; + get(state: string): IState; + get(): IState[]; + current: IState; + params: IStateParamsService; + reload(): void; + } + + interface IStateParamsService { + [key: string]: any; + } + + interface IUrlRouterService { + /* + * Triggers an update; the same update that happens when the address bar + * url changes, aka $locationChangeSuccess. + * + * This method is useful when you need to use preventDefault() on the + * $locationChangeSuccess event, perform some custom logic (route protection, + * auth, config, redirection, etc) and then finally proceed with the transition + * by calling $urlRouter.sync(). + * + */ + sync(): void; + } + + interface IUiViewScrollProvider { + /* + * Reverts back to using the core $anchorScroll service for scrolling + * based on the url anchor. + */ + useAnchorScroll(): void; + } +} diff --git a/angular-ui-sortable/angular-ui-sortable-tests.ts b/angular-ui-sortable/angular-ui-sortable-tests.ts new file mode 100644 index 000000000..836dc71e9 --- /dev/null +++ b/angular-ui-sortable/angular-ui-sortable-tests.ts @@ -0,0 +1,143 @@ +/// +/// + +var myApp = angular.module('testModule'); + +interface MySortableControllerScope extends ng.IScope { + items: SortableModelInfo[]; + sortableOptions: ng.ui.UISortableOptions; + sortingLog: SortLogInfo[]; +} + +interface SortableModelInfo { + text: string; + value: number; +} + +interface SortLogInfo { + ID: number; + Text: string; +} + +myApp.controller('sortableController', function ($scope: MySortableControllerScope) { + $scope.sortableOptions = { + activate: function(e, ui) { + var jQueryEventObject: JQueryEventObject = e; + var uiSortableUIParams: ng.ui.UISortableUIParams = ui; + }, + beforeStop: function(e, ui) { + var jQueryEventObject: JQueryEventObject = e; + var uiSortableUIParams: ng.ui.UISortableUIParams = ui; + }, + change: function(e, ui) { + var jQueryEventObject: JQueryEventObject = e; + var uiSortableUIParams: ng.ui.UISortableUIParams = ui; + }, + deactivate: function(e, ui) { + var jQueryEventObject: JQueryEventObject = e; + var uiSortableUIParams: ng.ui.UISortableUIParams = ui; + }, + out: function(e, ui) { + var jQueryEventObject: JQueryEventObject = e; + var uiSortableUIParams: ng.ui.UISortableUIParams = ui; + }, + over: function(e, ui) { + var jQueryEventObject: JQueryEventObject = e; + var uiSortableUIParams: ng.ui.UISortableUIParams = ui; + }, + receive: function(e, ui) { + var jQueryEventObject: JQueryEventObject = e; + var uiSortableUIParams: ng.ui.UISortableUIParams = ui; + }, + remove: function(e, ui) { + var jQueryEventObject: JQueryEventObject = e; + var uiSortableUIParams: ng.ui.UISortableUIParams = ui; + }, + sort: function(e, ui) { + var jQueryEventObject: JQueryEventObject = e; + var uiSortableUIParams: ng.ui.UISortableUIParams = ui; + }, + start: function(e, ui) { + var jQueryEventObject: JQueryEventObject = e; + var uiSortableUIParams: ng.ui.UISortableUIParams = ui; + }, + stop: function(e, ui) { + var jQueryEventObject: JQueryEventObject = e; + var uiSortableUIParams: ng.ui.UISortableUIParams = ui; + var uiitem: ng.ui.UISortableUIItem = ui.item; + var uiitemscope: ng.IScope = uiitem.scope(); + var uiitemsortable: ng.ui.UISortableProperties = uiitem.sortable; + + var dropindex: number = uiitemsortable.dropindex; + var droptarget: number = uiitemsortable.droptarget; + var droptargetModel: SortableModelInfo[] = uiitemsortable.droptargetModel; + var index: number = uiitemsortable.index; + var model: SortableModelInfo = uiitemsortable.model; + var moved: SortableModelInfo = uiitemsortable.moved; + var received: Boolean = uiitemsortable.received; + var source: ng.IAugmentedJQuery = uiitemsortable.source; + var sourceModel: SortableModelInfo[] = uiitemsortable.sourceModel; + + var logEntry = { + ID: $scope.sortingLog.length + 1, + Text: 'Moved element: ' + ui.item.sortable.model.text + }; + $scope.sortingLog.push(logEntry); + }, + update: function(e, ui) { + var jQueryEventObject: JQueryEventObject = e; + var uiSortableUIParams: ng.ui.UISortableUIParams = ui; + var voidcanceled: void = ui.item.sortable.cancel(); + var isCanceled: Boolean = ui.item.sortable.isCanceled(); + var isCustomHelperUsed: Boolean =ui.item.sortable.isCustomHelperUsed(); + } + }; + + $scope.sortableOptions.appendTo = document.body; + $scope.sortableOptions.appendTo = angular.element(document.body); + $scope.sortableOptions.appendTo = 'body'; + $scope.sortableOptions.axis = 'x'; + $scope.sortableOptions.axis = 'y'; + $scope.sortableOptions.axis = false; + $scope.sortableOptions.cancel = '.disabled'; + $scope.sortableOptions.connectWith = '.connectedSortable'; + $scope.sortableOptions.connectWith = false; + $scope.sortableOptions.containment = 'parent'; + $scope.sortableOptions.containment = 'body'; + $scope.sortableOptions.containment = document.body; + $scope.sortableOptions.containment = false; + $scope.sortableOptions.cursor = 'move'; + $scope.sortableOptions.cursorAt = false; + $scope.sortableOptions.cursorAt = { left: 5 }; + $scope.sortableOptions.delay = 300; + $scope.sortableOptions.disabled = true; + $scope.sortableOptions.distance = 5; + $scope.sortableOptions.dropOnEmpty = false; + $scope.sortableOptions.forceHelperSize = true; + $scope.sortableOptions.forcePlaceholderSize = true; + $scope.sortableOptions.grid = false; + $scope.sortableOptions.grid = [20, 10]; + $scope.sortableOptions.handle = '.handle'; + $scope.sortableOptions.helper = 'clone'; + $scope.sortableOptions.helper = function(e: JQueryEventObject, item: ng.IAugmentedJQuery) { + return item.clone(); + }; + $scope.sortableOptions.items = '> li:not(.disabled)'; + $scope.sortableOptions.opacity = false; + $scope.sortableOptions.opacity = 0.5; + $scope.sortableOptions.placeholder = false; + $scope.sortableOptions.placeholder = 'sortable-placeholder'; + $scope.sortableOptions.revert = true; + $scope.sortableOptions.revert = 300; + $scope.sortableOptions.scroll = false; + $scope.sortableOptions.scrollSensitivity = 10; + $scope.sortableOptions.scrollSpeed = 40; + $scope.sortableOptions.tolerance = 'pointer'; + $scope.sortableOptions.zIndex = 9999; + + $scope.sortableOptions['ui-floating'] = undefined; + $scope.sortableOptions['ui-floating'] = null; + $scope.sortableOptions['ui-floating'] = false; + $scope.sortableOptions['ui-floating'] = true; + $scope.sortableOptions['ui-floating'] = "auto"; +}); diff --git a/angular-ui-sortable/angular-ui-sortable.d.ts b/angular-ui-sortable/angular-ui-sortable.d.ts new file mode 100644 index 000000000..48b96f2d3 --- /dev/null +++ b/angular-ui-sortable/angular-ui-sortable.d.ts @@ -0,0 +1,210 @@ +// Type definitions for angular.ui.sortable module v0.13+ +// Project: https://github.com/angular-ui/ui-sortable +// Definitions by: Thodoris Greasidis +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module angular.ui { + + interface UISortableOptions extends SortableOptions { + 'ui-floating'?: string|boolean; + } + + interface UISortableProperties { + /** + * Holds the index of the drop target that the dragged item was dropped. + */ + dropindex: number; + + /** + * Holds the ui-sortable element that the dragged item was dropped on. + */ + droptarget: number; + + /** + * Holds the array that is specified by the `ng-model` attribute of the [`droptarget`](#droptarget) ui-sortable element. + */ + droptargetModel: Array; + + /** + * Holds the original index of the item dragged. + */ + index: number; + + /** + * Holds the JavaScript object that is used as the model of the dragged item, as specified by the ng-repeat of the [`source`](#source) ui-sortable element and the item's [`index`](#index). + */ + model: T; + + /** + * Holds the model of the dragged item only when a sorting happens between two connected ui-sortable elements. + * In other words: `'moved' in ui.item.sortable` will return false only when a sorting is withing the same ui-sortable element ([`source`](#source) equals to the [`droptarget`](#droptarget)). + */ + moved?: T; + + /** + * When sorting between two connected sortables, it will be set to true inside the `update` callback of the [`droptarget`](#droptarget). + */ + received: Boolean; + + /** + * Holds the ui-sortable element that the dragged item originated from. + */ + source: ng.IAugmentedJQuery + + /** + * Holds the array that is specified by the `ng-model` of the [`source`](#source) ui-sortable element. + */ + sourceModel: Array; + + /** + * Can be called inside the `update` callback, in order to prevent/revert a sorting. + * Should be used instead of the [jquery-ui-sortable cancel()](http://api.jqueryui.com/sortable/#method-cancel) method. + */ + cancel(): void; + + /** + * Returns whether the current sorting is marked as canceled, by an earlier call to [`ui.item.sortable.cancel()`](#cancel). + */ + isCanceled(): Boolean; + + /** + * Returns whether the [`helper`](http://api.jqueryui.com/sortable/#option-helper) element used for the current sorting, is one of the original ui-sortable list elements. + */ + isCustomHelperUsed(): Boolean; + } + + interface UISortableUIItem extends ng.IAugmentedJQuery { + sortable: UISortableProperties; + } + + interface UISortableUIParams extends SortableUIParams { + item: UISortableUIItem; + } + + // Base Sortable ////////////////////////////////////////////////// + + interface SortableCursorAtOptions { + top?: number; + left?: number; + right?: number; + bottom?: number; + } + + interface SortableHelperFunctionOption { + (event: JQueryEventObject, ui: ng.IAugmentedJQuery): JQuery; + } + + interface SortableOptions extends SortableEvents { + /** + * jQuery, Element, Selector or string + * Default: "parent" + */ + appendTo?: any; + /** + * "X", "Y" or false + * Default: false + */ + axis?: string|boolean; + /** + * Selector + * Default: "input,textarea,button,select,option" + */ + cancel?: string; + /** + * Selector or false + * Default: false + */ + connectWith?: string|boolean; + /** + * Element, Selector, string or false + * Default: false + */ + containment?: any; + cursor?: string; + /** + * Moves the sorting element or helper so the cursor always appears to drag from the same position. Coordinates can be given as a hash using a combination of one or two keys SortableCursorAtOptions: { top, left, right, bottom } + * Default: false + */ + cursorAt?: SortableCursorAtOptions|boolean; + delay?: number; + disabled?: boolean; + distance?: number; + dropOnEmpty?: boolean; + forceHelperSize?: boolean; + forcePlaceholderSize?: boolean; + /** + * Array of numbers or false + * Default: false + */ + grid?: number[]|boolean; + /** + * Selector or Element + */ + handle?: any; + /** + * "original", "clone" or Function() + * Default: "original" + */ + helper?: string|SortableHelperFunctionOption; + /** + * Selector + */ + items?: string; + /** + * Number or false + * Default: false + */ + opacity?: number|boolean; + /** + * string or false + * Default: false + */ + placeholder?: string|boolean; + /** + * boolean or number + * Default: false + */ + revert?: number|boolean; + scroll?: boolean; + scrollSensitivity?: number; + scrollSpeed?: number; + /** + * "intersect" or "pointer" + * Default: "intersect" + */ + tolerance?: string; + zIndex?: number; + } + + interface SortableUIParams { + helper: ng.IAugmentedJQuery; + item: ng.IAugmentedJQuery; + offset: any; + position: any; + originalPosition: any; + sender: ng.IAugmentedJQuery; + placeholder: ng.IAugmentedJQuery; + } + + interface SortableEvent { + (event: JQueryEventObject, ui: UISortableUIParams): void; + } + + interface SortableEvents { + activate?: SortableEvent; + beforeStop?: SortableEvent; + change?: SortableEvent; + deactivate?: SortableEvent; + out?: SortableEvent; + over?: SortableEvent; + receive?: SortableEvent; + remove?: SortableEvent; + sort?: SortableEvent; + start?: SortableEvent; + stop?: SortableEvent; + update?: SortableEvent; + } + +} diff --git a/angular-ui/angular-ui-router.d.ts b/angular-ui/angular-ui-router.d.ts deleted file mode 100644 index 53761552f..000000000 --- a/angular-ui/angular-ui-router.d.ts +++ /dev/null @@ -1,120 +0,0 @@ -// Type definitions for Angular JS 1.1.5+ (ui.router module) -// Project: https://github.com/angular-ui/ui-router -// Definitions by: Michel Salib -// Definitions: https://github.com/borisyankov/DefinitelyTyped - -/// - -declare module ng.ui { - - interface IState { - name?: string; - template?: any; - templateUrl?: any; - templateProvider?: any; - controller?: any; - controllerAs?: string; - controllerProvider?: any; - resolve?: {}; - url?: string; - params?: any; - views?: {}; - abstract?: boolean; - onEnter?: any; - onExit?: any; - data?: any; - reloadOnSearch?: boolean; - } - - interface IStateProvider extends IServiceProvider { - state(name:string, config:IState): IStateProvider; - state(config:IState): IStateProvider; - decorator(name?: string, decorator?: (state: IState, parent: Function) => any): any; - } - - interface IUrlMatcher { - concat(pattern: string): IUrlMatcher; - exec(path: string, searchParams: {}): {}; - parameters(): string[]; - format(values: {}): string; - } - - interface IUrlMatcherFactory { - compile(pattern: string): IUrlMatcher; - isMatcher(o: any): boolean; - type(name: string, definition: any, definitionFn?: any): any; - } - - interface IUrlRouterProvider extends IServiceProvider { - when(whenPath: RegExp, handler: Function): IUrlRouterProvider; - when(whenPath: RegExp, handler: any[]): IUrlRouterProvider; - when(whenPath: RegExp, toPath: string): IUrlRouterProvider; - when(whenPath: IUrlMatcher, hanlder: Function): IUrlRouterProvider; - when(whenPath: IUrlMatcher, handler: any[]): IUrlRouterProvider; - when(whenPath: IUrlMatcher, toPath: string): IUrlRouterProvider; - when(whenPath: string, handler: Function): IUrlRouterProvider; - when(whenPath: string, handler: any[]): IUrlRouterProvider; - when(whenPath: string, toPath: string): IUrlRouterProvider; - otherwise(handler: Function): IUrlRouterProvider; - otherwise(handler: any[]): IUrlRouterProvider; - otherwise(path: string): IUrlRouterProvider; - rule(handler: Function): IUrlRouterProvider; - rule(handler: any[]): IUrlRouterProvider; - } - - interface IStateOptions { - location?: any; - inherit?: boolean; - relative?: IState; - notify?: boolean; - } - - interface IHrefOptions { - lossy?: boolean; - inherit?: boolean; - relative?: IState; - absolute?: boolean; - } - - interface IStateService { - go(to: string, params?: {}, options?: IStateOptions): IPromise; - transitionTo(state: string, params?: {}, updateLocation?: boolean): void; - transitionTo(state: string, params?: {}, options?: IStateOptions): void; - includes(state: string, params?: {}): boolean; - is(state:string, params?: {}): boolean; - is(state: IState, params?: {}): boolean; - href(state: IState, params?: {}, options?: IHrefOptions): string; - href(state: string, params?: {}, options?: IHrefOptions): string; - get(state: string): IState; - get(): IState[]; - current: IState; - params: IStateParamsService; - reload(): void; - } - - interface IStateParamsService { - [key: string]: any; - } - - interface IUrlRouterService { - /* - * Triggers an update; the same update that happens when the address bar - * url changes, aka $locationChangeSuccess. - * - * This method is useful when you need to use preventDefault() on the - * $locationChangeSuccess event, perform some custom logic (route protection, - * auth, config, redirection, etc) and then finally proceed with the transition - * by calling $urlRouter.sync(). - * - */ - sync(): void; - } - - interface IUiViewScrollProvider { - /* - * Reverts back to using the core $anchorScroll service for scrolling - * based on the url anchor. - */ - useAnchorScroll(): void; - } -} diff --git a/angularLocalStorage/angularLocalStorage-tests.ts b/angularLocalStorage/angularLocalStorage-tests.ts index 7ae0d9066..366ab6e44 100644 --- a/angularLocalStorage/angularLocalStorage-tests.ts +++ b/angularLocalStorage/angularLocalStorage-tests.ts @@ -5,23 +5,21 @@ interface TestScope extends ng.IScope { viewType: string; } -module ng.LocalStorageTests { - export class TestController { - constructor(private $scope: TestScope, private storage: ng.localStorage.ILocalStorageService) { - storage.bind($scope, 'varName'); - storage.bind($scope,'varName', { defaultValue: 'randomValue123', storeName: 'customStoreKey' }); - $scope.viewType = 'ANYTHING'; - storage.unbind($scope, 'viewType'); +export class TestController { + constructor(private $scope: TestScope, private storage: ng.localStorage.ILocalStorageService) { + storage.bind($scope, 'varName'); + storage.bind($scope,'varName', { defaultValue: 'randomValue123', storeName: 'customStoreKey' }); + $scope.viewType = 'ANYTHING'; + storage.unbind($scope, 'viewType'); - storage.set('key', 'value'); - storage.get('key'); - storage.remove('key'); + storage.set('key', 'value'); + storage.get('key'); + storage.remove('key'); - storage.clearAll(); - } + storage.clearAll(); } } var app = angular.module('angularLocalStorageTests', ['angularLocalStorage']); -app.controller('testCtrl', ['$scope', 'storage', ($scope: TestScope, storage: ng.localStorage.ILocalStorageService) => new ng.LocalStorageTests.TestController($scope, storage)]); +app.controller('testCtrl', ['$scope', 'storage', ($scope: TestScope, storage: ng.localStorage.ILocalStorageService) => new TestController($scope, storage)]); diff --git a/angularLocalStorage/angularLocalStorage.d.ts b/angularLocalStorage/angularLocalStorage.d.ts index f83ae3306..08b5d473b 100644 --- a/angularLocalStorage/angularLocalStorage.d.ts +++ b/angularLocalStorage/angularLocalStorage.d.ts @@ -5,7 +5,7 @@ /// -declare module ng.localStorage { +declare module angular.localStorage { interface ILocalStorageService { set(key: string, value: any): any; get(key: string): any; diff --git a/angularjs/angular-amd-tests.ts b/angularjs/angular-amd-tests.ts new file mode 100644 index 000000000..2ce75cc22 --- /dev/null +++ b/angularjs/angular-amd-tests.ts @@ -0,0 +1,7 @@ +/// + +import localName = require('angular'); +var mod: localName.IModule = localName.module('mod', []); + +// Remain compatible with the ambient version +var mod2: angular.IModule = mod; diff --git a/angularjs/angular-animate.d.ts b/angularjs/angular-animate.d.ts index a01c93ef5..e78b85c3e 100644 --- a/angularjs/angular-animate.d.ts +++ b/angularjs/angular-animate.d.ts @@ -1,15 +1,19 @@ // Type definitions for Angular JS 1.3 (ngAnimate module) // Project: http://angularjs.org -// Definitions by: Michel Salib , Adi Dahiya +// Definitions by: Michel Salib , Adi Dahiya , Raphael Schweizer // Definitions: https://github.com/borisyankov/DefinitelyTyped /// +declare module "angular-animate" { + var _: string; + export = _; +} /////////////////////////////////////////////////////////////////////////////// // ngAnimate module (angular-animate.js) /////////////////////////////////////////////////////////////////////////////// -declare module ng.animate { +declare module angular.animate { /////////////////////////////////////////////////////////////////////////// // AnimateService @@ -25,23 +29,37 @@ declare module ng.animate { */ enabled(value?: boolean, element?: JQuery): boolean; + /** + * Performs an inline animation on the element. + * + * @param element the element that will be the focus of the animation + * @param from a collection of CSS styles that will be applied to the element at the start of the animation + * @param to a collection of CSS styles that the element will animate towards + * @param className an optional CSS class that will be added to the element for the duration of the animation (the default class is 'ng-inline-animate') + * @param options an optional collection of styles that will be picked up by the CSS transition/animation + * @returns the animation callback promise + */ + animate(element: JQuery, from: any, to: any, className?: string, options?: IAnimationOptions): ng.IPromise; + /** * Appends the element to the parentElement element that resides in the document and then runs the enter animation. * * @param element the element that will be the focus of the enter animation * @param parentElement the parent element of the element that will be the focus of the enter animation * @param afterElement the sibling element (which is the previous element) of the element that will be the focus of the enter animation + * @param options an optional collection of styles that will be picked up by the CSS transition/animation * @returns the animation callback promise */ - enter(element: JQuery, parentElement: JQuery, afterElement?: JQuery): ng.IPromise; + enter(element: JQuery, parentElement: JQuery, afterElement?: JQuery, options?: IAnimationOptions): ng.IPromise; /** * Runs the leave animation operation and, upon completion, removes the element from the DOM. * * @param element the element that will be the focus of the leave animation + * @param options an optional collection of styles that will be picked up by the CSS transition/animation * @returns the animation callback promise */ - leave(element: JQuery): ng.IPromise; + leave(element: JQuery, options?: IAnimationOptions): ng.IPromise; /** * Fires the move DOM operation. Just before the animation starts, the animate service will either append @@ -61,9 +79,10 @@ declare module ng.animate { * * @param element the element that will be animated * @param className the CSS class that will be added to the element and then animated + * @param options an optional collection of styles that will be picked up by the CSS transition/animation * @returns the animation callback promise */ - addClass(element: JQuery, className: string): ng.IPromise; + addClass(element: JQuery, className: string, options?: IAnimationOptions): ng.IPromise; /** * Triggers a custom animation event based off the className variable and then removes the CSS class @@ -71,9 +90,10 @@ declare module ng.animate { * * @param element the element that will be animated * @param className the CSS class that will be animated and then removed from the element + * @param options an optional collection of styles that will be picked up by the CSS transition/animation * @returns the animation callback promise */ - removeClass(element: JQuery, className: string): ng.IPromise; + removeClass(element: JQuery, className: string, options?: IAnimationOptions): ng.IPromise; /** * Adds and/or removes the given CSS classes to and from the element. Once complete, the done() callback @@ -82,9 +102,10 @@ declare module ng.animate { * @param element the element which will have its CSS classes changed removed from it * @param add the CSS classes which will be added to the element * @param remove the CSS class which will be removed from the element CSS classes have been set on the element + * @param options an optional collection of styles that will be picked up by the CSS transition/animation * @returns the animation callback promise */ - setClass(element: JQuery, add: string, remove: string): ng.IPromise; + setClass(element: JQuery, add: string, remove: string, options?: IAnimationOptions): ng.IPromise; /** * Cancels the provided animation. @@ -113,4 +134,13 @@ declare module ng.animate { */ classNameFilter(expression?: RegExp): RegExp; } + + /////////////////////////////////////////////////////////////////////////// + // Angular Animation Options + // see https://docs.angularjs.org/api/ngAnimate/#applying-directive-specific-styles-to-an-animation + /////////////////////////////////////////////////////////////////////////// + interface IAnimationOptions { + to?: Object; + from?: Object; + } } diff --git a/angularjs/angular-cookies.d.ts b/angularjs/angular-cookies.d.ts index 0feffae83..89a747f82 100644 --- a/angularjs/angular-cookies.d.ts +++ b/angularjs/angular-cookies.d.ts @@ -6,10 +6,15 @@ /// +declare module "angular-cookies" { + var _: string; + export = _; +} + /////////////////////////////////////////////////////////////////////////////// // ngCookies module (angular-cookies.js) /////////////////////////////////////////////////////////////////////////////// -declare module ng.cookies { +declare module angular.cookies { /////////////////////////////////////////////////////////////////////////// // CookieService diff --git a/angularjs/angular-mocks.d.ts b/angularjs/angular-mocks.d.ts index 877071127..db551ee3d 100644 --- a/angularjs/angular-mocks.d.ts +++ b/angularjs/angular-mocks.d.ts @@ -5,6 +5,16 @@ /// +declare module "angular-mocks/ngMock" { + var _: string; + export = _; +} + +declare module "angular-mocks/ngAnimateMock" { + var _: string; + export = _; +} + /////////////////////////////////////////////////////////////////////////////// // functions attached to global object (window) /////////////////////////////////////////////////////////////////////////////// @@ -14,7 +24,7 @@ declare var inject: (...fns: Function[]) => any; /////////////////////////////////////////////////////////////////////////////// // ngMock module (angular-mocks.js) /////////////////////////////////////////////////////////////////////////////// -declare module ng { +declare module angular { /////////////////////////////////////////////////////////////////////////// // AngularStatic @@ -59,7 +69,7 @@ declare module ng { flushNext(expectedDelay?: number): void; verifyNoPendingTasks(): void; } - + /////////////////////////////////////////////////////////////////////////// // IntervalService // see http://docs.angularjs.org/api/ngMock.$interval diff --git a/angularjs/angular-resource.d.ts b/angularjs/angular-resource.d.ts index ed08c77dd..4f03a341c 100644 --- a/angularjs/angular-resource.d.ts +++ b/angularjs/angular-resource.d.ts @@ -9,7 +9,7 @@ /////////////////////////////////////////////////////////////////////////////// // ngResource module (angular-resource.js) /////////////////////////////////////////////////////////////////////////////// -declare module ng.resource { +declare module angular.resource { /** * Currently supported options for the $resource factory options argument. @@ -146,7 +146,7 @@ declare module ng.resource { } /** extensions to base ng based on using angular-resource */ -declare module ng { +declare module angular { interface IModule { /** creating a resource service factory */ diff --git a/angularjs/angular-route.d.ts b/angularjs/angular-route.d.ts index 936b42589..b791942a4 100644 --- a/angularjs/angular-route.d.ts +++ b/angularjs/angular-route.d.ts @@ -5,11 +5,15 @@ /// +declare module "angular-route" { + var _: string; + export = _; +} /////////////////////////////////////////////////////////////////////////////// // ngRoute module (angular-route.js) /////////////////////////////////////////////////////////////////////////////// -declare module ng.route { +declare module angular.route { /////////////////////////////////////////////////////////////////////////// // RouteParamsService @@ -32,8 +36,8 @@ declare module ng.route { // to a controller that was not initialized as a result of a route maching. current?: ICurrentRoute; } - - + + /** * see http://docs.angularjs.org/api/ngRoute/provider/$routeProvider#when for API documentation */ @@ -54,24 +58,24 @@ declare module ng.route { /** * {string=|function()=} * Html template as a string or a function that returns an html template as a string which should be used by ngView or ngInclude directives. This property takes precedence over templateUrl. - * + * * If template is a function, it will be called with the following parameters: - * + * * {Array.} - route parameters extracted from the current $location.path() by applying the current route */ template?: string|{($routeParams?: ng.route.IRouteParamsService) : string;} /** * {string=|function()=} * Path or function that returns a path to an html template that should be used by ngView. - * + * * If templateUrl is a function, it will be called with the following parameters: - * + * * {Array.} - route parameters extracted from the current $location.path() by applying the current route */ templateUrl?: string|{ ($routeParams?: ng.route.IRouteParamsService): string; } /** * {Object.=} - An optional map of dependencies which should be injected into the controller. If any of these dependencies are promises, the router will wait for them all to be resolved or one to be rejected before the controller is instantiated. If all the promises are resolved successfully, the values of the resolved promises are injected and $routeChangeSuccess event is fired. If any of the promises are rejected the $routeChangeError event is fired. The map object is: - * + * * - key - {string}: a name of a dependency to be injected into the controller. * - factory - {string|function}: If string then it is an alias for a service. Otherwise if function, then it is injected and the return value is treated as the dependency. If the result is a promise, it is resolved before its value is injected into the controller. Be aware that ngRoute.$routeParams will still refer to the previous route within these resolve functions. Use $route.current.params to access the new route parameters, instead. */ @@ -79,9 +83,9 @@ declare module ng.route { /** * {(string|function())=} * Value to update $location path with and trigger route redirection. - * + * * If redirectTo is a function, it will be called with the following parameters: - * + * * - {Object.} - route parameters extracted from the current $location.path() by applying the current route templateUrl. * - {string} - current $location.path() * - {Object} - current $location.search() @@ -89,14 +93,14 @@ declare module ng.route { */ redirectTo?: string|{($routeParams?: ng.route.IRouteParamsService, $locationPath?: string, $locationSearch?: any) : string}; /** - * Reload route when only $location.search() or $location.hash() changes. - * + * Reload route when only $location.search() or $location.hash() changes. + * * This option defaults to true. If the option is set to false and url in the browser changes, then $routeUpdate event is broadcasted on the root scope. */ reloadOnSearch?: boolean; /** * Match routes without being case sensitive - * + * * This option defaults to false. If the option is set to true, then the particular route can be matched without being case sensitive */ caseInsensitiveMatch?: boolean; @@ -115,21 +119,21 @@ declare module ng.route { interface IRouteProvider extends IServiceProvider { /** * Sets route definition that will be used on route change when no other route definition is matched. - * + * * @params Mapping information to be assigned to $route.current. */ otherwise(params: IRoute): IRouteProvider; /** * Adds a new route definition to the $route service. - * + * * @param path Route path (matched against $location.path). If $location.path contains redundant trailing slash or is missing one, the route will still match and the $location.path will be updated to add or drop the trailing slash to exactly match the route definition. - * + * * - path can contain named groups starting with a colon: e.g. :name. All characters up to the next slash are matched and stored in $routeParams under the given name when the route matches. * - path can contain named groups starting with a colon and ending with a star: e.g.:name*. All characters are eagerly stored in $routeParams under the given name when the route matches. * - path can contain optional named groups with a question mark: e.g.:name?. * * For example, routes like /color/:color/largecode/:largecode*\/edit will match /color/brown/largecode/code/with/slashes/edit and extract: color: brown and largecode: code/with/slashes. - * + * * @param route Mapping information to be assigned to $route.current on route match. */ when(path: string, route: IRoute): IRouteProvider; diff --git a/angularjs/angular-sanitize.d.ts b/angularjs/angular-sanitize.d.ts index 6fde0baef..c8ab8e266 100644 --- a/angularjs/angular-sanitize.d.ts +++ b/angularjs/angular-sanitize.d.ts @@ -6,10 +6,15 @@ /// +declare module "angular-sanitize" { + var _: string; + export = _; +} + /////////////////////////////////////////////////////////////////////////////// // ngSanitize module (angular-sanitize.js) /////////////////////////////////////////////////////////////////////////////// -declare module ng.sanitize { +declare module angular.sanitize { /////////////////////////////////////////////////////////////////////////// // SanitizeService @@ -25,7 +30,7 @@ declare module ng.sanitize { /////////////////////////////////////////////////////////////////////////// export module filter { - // Finds links in text input and turns them into html links. + // Finds links in text input and turns them into html links. // Supports http/https/ftp/mailto and plain email address links. // see http://code.angularjs.org/1.2.0/docs/api/ngSanitize.filter:linky interface ILinky { diff --git a/angularjs/angular.d.ts b/angularjs/angular.d.ts index c907bbfe9..191aa7692 100755 --- a/angularjs/angular.d.ts +++ b/angularjs/angular.d.ts @@ -6,13 +6,15 @@ /// -declare var angular: ng.IAngularStatic; +declare var angular: angular.IAngularStatic; // Support for painless dependency injection interface Function { $inject?: string[]; } +// Collapse angular into ng +import ng = angular; // Support AMD require declare module 'angular' { export = angular; @@ -21,7 +23,7 @@ declare module 'angular' { /////////////////////////////////////////////////////////////////////////////// // ng module (angular.js) /////////////////////////////////////////////////////////////////////////////// -declare module ng { +declare module angular { // not directly implemented, but ensures that constructed class implements $get interface IServiceProviderClass { @@ -450,9 +452,9 @@ declare module ng { $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; + $addControl(control: INgModelController): void; + $removeControl(control: INgModelController): void; + $setValidity(validationErrorKey: string, isValid: boolean, control: INgModelController): void; $setDirty(): void; $setPristine(): void; $commitViewValue(): void; @@ -507,7 +509,7 @@ declare module ng { } interface IAsyncModelValidators { - [index: string]: (...args: any[]) => ng.IPromise; + [index: string]: (...args: any[]) => IPromise; } interface IModelParser { @@ -584,13 +586,13 @@ declare module ng { } interface IScope extends IRootScopeService { } - + /** * $scope for ngRepeat directive. * see https://docs.angularjs.org/api/ng/directive/ngRepeat */ interface IRepeatScope extends IScope { - + /** * iterator offset of the repeated element (0..length-1). */ @@ -620,7 +622,7 @@ declare module ng { * true if the iterator position $index is odd (otherwise false). */ $odd: boolean; - + } interface IAngularEvent { @@ -889,6 +891,7 @@ declare module ng { // implementation tests it as boolean, which makes more sense // since this is a toggler html5Mode(active: boolean): ILocationProvider; + html5Mode(mode: { enabled?: boolean; requireBase?: boolean; rewriteLinks?: boolean; }): ILocationProvider; } /////////////////////////////////////////////////////////////////////////// @@ -928,11 +931,19 @@ declare module ng { /** * Combines multiple promises into a single promise that is resolved when all of the input promises are resolved. * - * Returns a single promise that will be resolved with an array/hash of values, each value corresponding to the promise at the same index/key in the promises array/hash. If any of the promises is resolved with a rejection, this resulting promise will be rejected with the same rejection value. + * Returns a single promise that will be resolved with an array of values, each value corresponding to the promise at the same index in the promises array. If any of the promises is resolved with a rejection, this resulting promise will be rejected with the same rejection value. * - * @param promises An array or hash of promises. + * @param promises An array of promises. */ - all(promises: IPromise[]|{ [id: string]: IPromise; }): IPromise; + all(promises: IPromise[]): IPromise; + /** + * Combines multiple promises into a single promise that is resolved when all of the input promises are resolved. + * + * Returns a single promise that will be resolved with a hash of values, each value corresponding to the promise at the same key in the promises hash. If any of the promises is resolved with a rejection, this resulting promise will be rejected with the same rejection value. + * + * @param promises A hash of promises. + */ + all(promises: { [id: string]: IPromise; }): IPromise<{ [id: string]: any; }>; /** * Creates a Deferred object which represents a task which will finish in the future. */ @@ -1152,6 +1163,15 @@ declare module ng { */ put(url: string, data: any, config?: IRequestShortcutConfig): IHttpPromise; + /** + * Shortcut method to perform PATCH request. + * + * @param url Relative or absolute URL specifying the destination of the request + * @param data Request content + * @param config Optional configuration object + */ + patch(url: string, data: any, config?: IRequestShortcutConfig): IHttpPromise; + /** * Runtime equivalent of the $httpProvider.defaults property. Allows configuration of default headers, withCredentials as well as request and response transformations. */ @@ -1561,12 +1581,12 @@ declare module ng { * $delegate - The original service instance, which can be monkey patched, configured, decorated or delegated to. */ decorator(name: string, inlineAnnotatedFunction: any[]): void; - factory(name: string, serviceFactoryFunction: Function): ng.IServiceProvider; - factory(name: string, inlineAnnotatedFunction: any[]): ng.IServiceProvider; - provider(name: string, provider: ng.IServiceProvider): ng.IServiceProvider; - provider(name: string, serviceProviderConstructor: Function): ng.IServiceProvider; - service(name: string, constructor: Function): ng.IServiceProvider; - value(name: string, value: any): ng.IServiceProvider; + factory(name: string, serviceFactoryFunction: Function): IServiceProvider; + factory(name: string, inlineAnnotatedFunction: any[]): IServiceProvider; + provider(name: string, provider: IServiceProvider): IServiceProvider; + provider(name: string, serviceProviderConstructor: Function): IServiceProvider; + service(name: string, constructor: Function): IServiceProvider; + value(name: string, value: any): IServiceProvider; } } diff --git a/arcgis-js-api/arcgis-js-api-tests.ts b/arcgis-js-api/arcgis-js-api-tests.ts new file mode 100644 index 000000000..bf13a1a0a --- /dev/null +++ b/arcgis-js-api/arcgis-js-api-tests.ts @@ -0,0 +1,25 @@ +/// + +import esri = require("esri"); +import Map = require("esri/map"); +import Point = require("esri/geometry/Point"); + +export = MapController; + +class MapController { + map: Map; + + constructor(public mapDiv: string) { + } + + start() { + var point = new Point(-122.45, 37.75); // long, lat + + var mapOptions: esri.MapOptions = {}; + mapOptions.basemap = "topo"; + mapOptions.center = point; + mapOptions.zoom = 13; + + this.map = new Map(this.mapDiv, mapOptions); + } +} diff --git a/arcgis-js-api/arcgis-js-api.d.ts b/arcgis-js-api/arcgis-js-api.d.ts new file mode 100644 index 000000000..1f6523a23 --- /dev/null +++ b/arcgis-js-api/arcgis-js-api.d.ts @@ -0,0 +1,16049 @@ +// Type definitions for ArcGIS API for JavaScript v3.13 +// Project: http://js.arcgis.com +// Definitions by: Esri +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module "esri" { + import Graphic = require("esri/graphic"); + import Point = require("esri/geometry/Point"); + import ScreenPoint = require("esri/geometry/ScreenPoint"); + import FeatureLayer = require("esri/layers/FeatureLayer"); + import Map = require("esri/map"); + import ImageParameters = require("esri/layers/ImageParameters"); + import ImageServiceParameters = require("esri/layers/ImageServiceParameters"); + import InfoTemplate = require("esri/InfoTemplate"); + import Basemap = require("esri/dijit/Basemap"); + import Extent = require("esri/geometry/Extent"); + import TileInfo = require("esri/layers/TileInfo"); + import BasemapLayer = require("esri/dijit/BasemapLayer"); + import BookmarkItem = require("esri/dijit/BookmarkItem"); + import Units = require("esri/units"); + import Color = require("esri/Color"); + import LocationProviderBase = require("esri/tasks/locationproviders/LocationProviderBase"); + import PictureMarkerSymbol = require("esri/symbols/PictureMarkerSymbol"); + import Geocoder = require("esri/dijit/Geocoder"); + import RouteParameters = require("esri/tasks/RouteParameters"); + import SimpleLineSymbol = require("esri/symbols/SimpleLineSymbol"); + import Font = require("esri/symbols/Font"); + import ArcGISDynamicMapServiceLayer = require("esri/layers/ArcGISDynamicMapServiceLayer"); + import LineSymbol = require("esri/symbols/LineSymbol"); + import MarkerSymbol = require("esri/symbols/MarkerSymbol"); + import LayerSource = require("esri/layers/LayerSource"); + import GraphicsLayer = require("esri/layers/GraphicsLayer"); + import SpatialReference = require("esri/SpatialReference"); + import Symbol = require("esri/symbols/Symbol"); + import Layer = require("esri/layers/layer"); + import Locator = require("esri/tasks/locator"); + import InfoWindowBase = require("esri/InfoWindowBase"); + import LOD = require("esri/layers/LOD"); + import FillSymbol = require("esri/symbols/FillSymbol"); + import PrintTemplate = require("esri/tasks/PrintTemplate"); + import QueryTask = require("esri/tasks/QueryTask"); + import TextSymbol = require("esri/symbols/TextSymbol"); + import SimpleMarkerSymbol = require("esri/symbols/SimpleMarkerSymbol"); + import StandardGeographyQueryTask = require("esri/tasks/geoenrichment/StandardGeographyQueryTask"); + import WMTSLayerInfo = require("esri/layers/WMTSLayerInfo"); + + export interface AGSMouseEvent extends MouseEvent { + graphic?: Graphic; + mapPoint: Point; + screenPoint: ScreenPoint; + } + export interface AddOptions { + /** The features that were added to the feature layer. */ + addedGraphics?: Graphic[]; + /** The feature layer where the new feature(s) are added. */ + featureLayer?: FeatureLayer; + } + export interface AggregatePointsOptions { + /** The URL to the GPServer used to execute an analysis job. */ + analysisGpServer?: string; + /** A field name from pointLayer based on which the points will be grouped. */ + groupByField?: string; + /** When true, the polygons that have no points within them will be returned in the output. */ + keepBoundariesWithNoPoints?: boolean; + /** Reference to the map object. */ + map?: Map; + /** The name of the output layer to be shown in the Result layer name inputbox. */ + outputLayerName?: string; + /** The point feature layer that will be aggregated into the polygons in the polygon feature layer. */ + pointLayer: FeatureLayer; + /** The polygon layer to be shown selected in in the Choose area menu. */ + polygonLayer: FeatureLayer; + /** An array of feature layer candidates to be selected as the input polygon layer. */ + polygonLayers: FeatureLayer[]; + /** The url to the ArcGIS.com site or in-house portal where the GP server is hosted. */ + portalUrl?: string; + /** When true, returns the result of analysis as a client-side feature collection. */ + returnFeatureCollection?: boolean; + /** When true, the choose extent checkbox will be shown. */ + showChooseExtent?: boolean; + /** When true, the show credit option is visible. */ + showCredits?: boolean; + /** When true, the help links will be shown. */ + showHelp?: boolean; + /** When true, the select folder dropdown will be shown. */ + showSelectFolder?: boolean; + /** An array of attribute field names and statistic types that you would like to aggregate for all points within each polygon. */ + summaryFields?: string[]; + } + export interface ArcGISDynamicMapServiceLayerOptions { + /** Class attribute to set for the layer's node. */ + className?: string; + /** Specify the geodatabase version to display. */ + gdbVersion?: string; + /** Id to assign to the layer. */ + id?: string; + /** Represents the image parameter options. */ + imageParameters?: ImageParameters; + /** infoTemplates object. */ + infoTemplates?: any; + /** Initial opacity or transparency of layer. */ + opacity?: number; + /** Refresh interval of the layer in minutes. */ + refreshInterval?: number; + /** Specify the metadata of the layer. */ + resourceInfo?: any; + /** When true, the layer's attribution is displayed on the map. */ + showAttribution?: boolean; + /** By default, images are exported in MIME format, and the image is streamed to the client. */ + useMapImage?: boolean; + /** When true, the layer will update its content based on the map's time extent. */ + useMapTime?: boolean; + /** Initial visibility of the layer. */ + visible?: boolean; + } + export interface ArcGISImageServiceLayerOptions { + /** Id to assign to the layer. */ + id?: string; + /** The image service parameter options used when exporting an Image Service layer. */ + imageServiceParameters?: ImageServiceParameters; + /** The template that defines the content to display in the map info window when the user clicks on a raster. */ + infoTemplate?: InfoTemplate; + /** Initial opacity or transparency of layer. */ + opacity?: number; + /** Specify the metadata of the layer. */ + resourceInfo?: any; + /** By default, images are exported in MIME format, and the image is streamed to the client. */ + useMapImage?: boolean; + /** When true, the layer will update its content based on the map's time extent. */ + useMapTime?: boolean; + /** Initial visibility of the layer. */ + visible?: boolean; + } + export interface ArcGISImageServiceVectorLayerOptions { + /** Apply a function for visualization or post-processing purposes. */ + pixelFilter?: any; + /** Set the default renderer from a list of predefined options. */ + rendererStyle?: string; + /** A value used to aggregate pixels into tiles for visualization purposes. */ + symbolTileSize?: number; + } + export interface ArcGISTiledMapServiceLayerOptions { + /** Class attribute to set for the layer's node. */ + className?: string; + /** Lists which levels to draw. */ + displayLevels?: number; + /** An array of objects that define areas where a tiled map service should not display tiles. */ + exclusionAreas?: any[]; + /** Id to assign to the layer. */ + id?: string; + /** infoTemplates object. */ + infoTemplates?: any; + /** Initial opacity or transparency of layer. */ + opacity?: number; + /** Refresh interval of the layer in minutes. */ + refreshInterval?: number; + /** When true, tile resampling is enabled. */ + resampling?: boolean; + /** Number of levels beyond the last level where tiles are available. */ + resamplingTolerance?: number; + /** Specify the metadata of the layer. */ + resourceInfo?: any; + /** When true, the layer's attribution is displayed on the map. */ + showAttribution?: boolean; + /** Array of REST endpoints that can be used to retrieve tile images. */ + tileServers?: string[]; + /** Initial visibility of the layer. */ + visible?: boolean; + } + export interface AttributeInspectorOptions { + /** See the object specifications table below for the structure of the layerInfos object. */ + layerInfos: any[]; + } + export interface AttributionOptions { + /** String used as the delimiter between attribution items. */ + itemDelimiter?: string; + /** Reference to the map object. */ + map: Map; + } + export interface BasemapGalleryOptions { + /** List of basemap layer ids in the current map. */ + basemapIds?: string[]; + /** An array of user-defined basemaps to display in the BasemapGallery. */ + basemaps?: Basemap[]; + /** Specify an ArcGIS.com group that contains web maps that will be used as basemaps in the gallery. */ + basemapsGroup?: any; + /** Specify your Bing Maps key if the basemap group you want to display in the gallery contains bing basemaps. */ + bingMapsKey?: string; + /** Reference to the map. */ + map: Map; + /** Specify the portal url, including the instance name, used to access the group that contains the basemap gallery items. */ + portalUrl?: string; + /** List of reference layer ids in the current map. */ + referenceIds?: string[]; + /** When true, queries ArcGIS.com to retrieve available basemaps. */ + showArcGISBasemaps?: boolean; + } + export interface BasemapLayerOptions { + /** If the url points to an image service, you can specify which band ids will display. */ + bandIds?: number[]; + /** The attribution information for the layer. */ + copyright?: string; + /** If the url points to a cached map service you can specify the levels to draw. */ + displayLevels?: number[]; + /** Specify the full extent of the layer. */ + fullExtent?: Extent; + /** Specify the initial extent of the layer. */ + initialExtent?: Extent; + /** Set to true if the layer is a reference layer and should be drawn on top of all other layers in the map. */ + isReference?: boolean; + /** Initial opacity or transparency of the basemap layer. */ + opacity?: number; + /** Specify subDomains where tiles are served to speed up tile retrieval (using subDomains gets around the browser limit of the max number of concurrent requests to a domain). */ + subDomains?: string[]; + /** Define the tile info for the layer including lods, rows, cols, origin and spatial reference. */ + tileInfo?: TileInfo; + /** Define additional tile server domains for the layer. */ + tileServer?: string[]; + /** The type of layer, valid values are "BingMapsAerial", "BingMapsHybrid", "BingMapsRoad", "OpenStreetMap", or "WebTiledLayer". */ + type?: string; + /** URL to the ArcGIS Server REST resource that represents a map or image service. */ + url?: string; + /** If the url points to a dynamic map service you can specify a subset of layers to display. */ + visibleLayers?: number[]; + } + export interface BasemapOptions { + /** The id of the basemap. */ + id?: string; + /** An array of layers to add to the basemap. */ + layers: BasemapLayer[]; + /** A URL to a thumbnail image for the basemap that will be displayed in the BasemapGallery. */ + thumbnailUrl?: string; + /** Title for the basemap. */ + title?: string; + } + export interface BasemapToggleOptions { + /** The secondary basemap to toggle to. */ + basemap?: string; + /** Object containing the labels and URLs for the image of each basemap. */ + basemaps?: any; + /** Map object that this dijit is associated with. */ + map: Map; + /** Class used for styling the widget. */ + theme?: string; + /** Whether the widget is visible by default. */ + visible?: boolean; + } + export interface BookmarksOptions { + /** An array of BookmarkItem objects or a json object with the BookmarkItem format to initially display in the bookmark widget. */ + bookmarks?: BookmarkItem[]; + /** When true, users can add, remove and edit bookmark items. */ + editable?: boolean; + /** Reference to the map. */ + map: Map; + } + export interface CSVLayerOptions { + /** The column delimiter. */ + columnDelimiter?: string; + /** Copyright information for the layer. */ + copyright?: string; + /** The fields property contains objects with "name", "alias" and "type" String properties. */ + fields?: any[]; + /** The latitude field name. */ + latitudeFieldName?: string; + /** The longitude field name. */ + longitudeFieldName?: string; + /** An array of strings which correspond to fields to include in the CSVLayer. */ + outFields?: string[]; + } + export interface CircleOptions1 { + /** Applicable when the spatial reference of the center point is either set to Web Mercator or geographic/geodesic as true would apply. */ + geodesic?: boolean; + /** A circle can be thought of similar to a polygon. */ + numberOfPoints?: number; + /** Radius of the circle. */ + radius?: number; + /** Unit of the radius. */ + radiusUnit?: Units; + } + export interface CircleOptions2 { + /** The center point of the circle. */ + center: any; + /** Applicable when the spatial reference of the center point is either set to Web Mercator or geographic/geodesic as true would apply. */ + geodesic?: boolean; + /** A circle can be thought of similar to a polygon. */ + numberOfPoints?: number; + /** The radius of the circle. */ + radius?: number; + /** Unit of the radius. */ + radiusUnit?: Units; + } + export interface ClassedColorSliderOptions { + /** Data map containing renderer information. */ + breakInfos: any; + /** Classification method. */ + classificationMethod?: string; + /** Handles identified by their index values within the stops array. */ + handles: number[]; + /** Represents histogram data object. */ + histogram?: any; + /** Width of the histogram in pixels. */ + histogramWidth?: number; + /** Absolute maximum value of the slider. */ + maxValue?: number; + /** Absolute minimum value of the slider. */ + minValue?: number; + /** Normalization type. */ + normalizationType?: string; + /** Handle identified by its index value within the stops array. */ + primaryHandle?: number; + /** Width of the widget ramp in pixels. */ + rampWidth?: number; + /** Displays slider handles when true. */ + showHandles?: boolean; + /** Displays the histogram when true. */ + showHistogram?: boolean; + /** Displays slider labels when true. */ + showLabels?: boolean; + /** Displays ticks on slider when true. */ + showTicks?: boolean; + /** Represents statistics data object. */ + statistics?: any; + } + export interface ClassedSizeSliderOptions { + /** Data map containing renderer information. */ + breakInfos: any; + /** Classification method. */ + classificationMethod?: string; + /** Handles identified by their index values within the stops array. */ + handles: number[]; + /** Represents histogram data object. */ + histogram?: any; + /** Width of histogram in pixels. */ + histogramWidth?: number; + /** Absolute maximum value of the slider. */ + maxValue?: number; + /** Absolute minimum value of the slider. */ + minValue?: number; + /** Normalization type. */ + normalizationType?: string; + /** Handle identified by its index value within the stops array. */ + primaryHandle?: number; + /** Width of slider ramp in pixels. */ + rampWidth?: number; + /** Displays slider handles when true. */ + showHandles?: boolean; + /** Displays the histogram when true. */ + showHistogram?: boolean; + /** Displays labels when true. */ + showLabels?: boolean; + /** Displays slider ticks when true. */ + showTicks?: boolean; + /** Represents statistics data object. */ + statistics?: any; + /** Indicates whether to use a circle or line-based ClassedSizeSlider. */ + symbol?: any; + } + export interface ColorInfoSliderOptions { + /** Classification method. */ + classificationMethod?: string; + /** Data map containing renderer information. */ + colorInfo: any; + /** Handles identified by their index values within the stops array. */ + handles: number[]; + /** Represents histogram data object. */ + histogram?: any; + /** Width of histogram in pixels. */ + histogramWidth?: number; + /** Absolute maximum value of slider. */ + maxValue?: number; + /** Absolute minimum value of slider. */ + minValue?: number; + /** Normalization Type. */ + normalizationType?: string; + /** Handle identified by its index value within the stops array. */ + primaryHandle?: number; + /** Width of widget ramp in pixels. */ + rampWidth?: number; + /** Displays handles when set to true. */ + showHandles?: boolean; + /** Displays the histogram when true. */ + showHistogram?: boolean; + /** Displays labels when set to true. */ + showLabels?: boolean; + /** Displays ticks when set to true. */ + showTicks?: boolean; + /** Displays transparent background when set to true. */ + showTransparentBackground?: boolean; + /** Represents statistics data object. */ + statistics?: any; + /** Object containing additional options. */ + zoomOptions?: any; + } + export interface ColorPickerOptions { + /** The selected color. */ + color: Color; + /** The row size of the palette. */ + colorsPerRow: number; + /** The set of available color options. */ + palette: Color[]; + /** Array of recent colors to show in the recent colors row. */ + recentColors: Color[]; + /** Toggles color selection being required. */ + required: boolean; + /** Toggles the recent color row. */ + showRecentColors: boolean; + /** Toggles the transparency slider. */ + showTransparencySlider: boolean; + } + export interface ConnectOriginsToDestinationsOptions { + /** The URL to the GPServer used to execute an analysis job. */ + analysisGpServer?: string; + /** The linear unit used with the distance value(s). */ + distanceDefaultUnits?: string; + /** An array of feature layers containing destination points. */ + featureLayers: FeatureLayer[]; + /** Reference to the map object. */ + map?: Map; + /** The point feature layer containing the origin points. */ + originsLayer: FeatureLayer; + /** The name of the output layer to be shown in the Result layer name input box. */ + outputLayerName?: string; + /** The url to the ArcGIS.com site or in-house portal where the GP server is hosted. */ + portalUrl?: string; + } + export interface CoordinatesLocationProviderOptions { + /** The attribute field in the graphic object that contains the longitude (X) values. */ + xField: string; + /** The attribute field in the graphic object that has the latitude (Y) values. */ + yField: string; + } + export interface CreateBuffersOptions { + /** The URL to the GPServer used to execute an analysis job. */ + analysisGpServer?: string; + /** An array of buffer distances to buffer the input feature layer. */ + bufferDistance?: number[]; + /** The input point, line, or polygon feature layer to be buffered. */ + inputLayer: FeatureLayer; + /** Reference to the map object. */ + map?: Map; + /** The name of the output layer to be shown in the Result layer name inputbox. */ + outputLayerName?: string; + /** The url to the ArcGIS.com site or in-house portal where the GP server is hosted. */ + portalUrl?: string; + /** When true, returns the result of analysis as client-side feature collection. */ + returnFeatureCollection?: boolean; + /** When true, the choose extent checkbox will be shown. */ + showChooseExtent?: boolean; + /** When true, the show credit option is visible. */ + showCredits?: string; + /** When true, the help links will be shown. */ + showHelp?: boolean; + /** When true, the select folder dropdown will be shown. */ + showSelectFolder?: boolean; + } + export interface CreateDriveTimeAreasOptions { + /** The URL to the GPServer used to execute an analysis job. */ + analysisGpServer?: string; + /** The units of the breakValues parameter. */ + breakUnits?: string; + /** An array of driving time break values. */ + breakValues?: number[]; + /** The point feature layer around which drive-time areas will be drawn. */ + inputLayer: FeatureLayer; + /** The geometry type of the input layer. */ + inputType?: string; + /** Reference to the map object. */ + map?: Map; + /** The name of the output layer to be shown in the Result layer name inputbox. */ + outputLayerName?: string; + /** The rule of overlap. */ + overlapPolicy?: string; + /** The url to the ArcGIS.com site or in-house portal where the GP server is hosted. */ + portalUrl?: string; + /** When true, returns the result of analysis as a client-side feature collection. */ + returnFeatureCollection?: boolean; + /** When true, the choose extent checkbox will be shown. */ + showChooseExtent?: boolean; + /** When true, the show credit option is visible. */ + showCredits?: boolean; + /** When true, the help links will be shown. */ + showHelp?: boolean; + /** When true, the select folder dropdown will be shown. */ + showSelectFolder?: boolean; + } + export interface CreateViewshedOptions { + /** The URL to the GPServer used to execute an analysis job. */ + analysisGpServer?: string; + /** Feature layer containing observation points to be used as input. */ + inputLayer: FeatureLayer; + /** Reference to the map object. */ + map?: Map; + /** The url to the ArcGIS.com site or in-house portal where the GP server is hosted. */ + portalUrl?: string; + } + export interface CreateWatershedsOptions { + /** The URL to the GPServer used to execute an analysis job. */ + analysisGpServer?: string; + /** The feature layer containing input points used for calculating watersheds. */ + inputLayer: FeatureLayer; + /** Reference to the map object. */ + map?: Map; + /** The url to the ArcGIS.com site or in-house portal where the GP server is hosted. */ + portalUrl?: string; + } + export interface CutOptions { + /** The feature(s) added to the feature layer by the cut operation. */ + addedGraphics?: Graphic[]; + /** The feature layer that contains the cut feature(s). */ + featureLayer?: FeatureLayer; + /** The updated feature(s). */ + postUpdatedGraphics?: Graphic[]; + /** The feature(s) before the cut operation is performed. */ + preUpdatedGraphics?: Graphic[]; + } + export interface DataAdapterFeatureLayerOptions { + /** The query parameters to use in retrieving the data through the DataAdapter. */ + dataAdapterQuery: any; + /** An instance of the LocationProvider class. */ + locationProvider: LocationProviderBase; + } + export interface DataBrowserOptions { + /** Show/hide country drop down. */ + countryBox?: boolean; + /** Two-digit country code selected in the country drop down. */ + countryID?: string; + /** Selected variables array. */ + selection?: string[]; + /** Title to show in the top left hand corner. */ + title?: string; + } + export interface DeleteOptions { + /** The features that were removed from the feature layer. */ + deletedGraphics?: Graphic[]; + /** The feature layer from which the feature(s) are removed. */ + featureLayer?: FeatureLayer; + } + export interface DirectionsOptions { + /** Defines the values that label each stop. */ + alphabet?: any; + /** When true, solve will start when the last destination is complete and enter key is hit. */ + autoSolve?: boolean; + /** Display the 'Add Destination' button. */ + canModifyStops?: boolean; + /** Center the map at the start of the selected route segment. */ + centerAtSegmentStart?: boolean; + /** The returned directions object from the routing solve result. */ + directions?: any; + /** Length units. */ + directionsLengthUnits?: string; + /** Enable the dragging of stop locations on the map. */ + dragging?: boolean; + /** Focus the cursor in the stop input when a new stop is added. */ + focusOnNewStop?: boolean; + /** The symbol that is used to denote the start location on the map. */ + fromSymbol?: PictureMarkerSymbol; + /** The symbol that displays when the from location is dragged to a new location. */ + fromSymbolDrag?: PictureMarkerSymbol; + /** Define optional geocoder options view the Geocoder help for details on the object properties. */ + geocoderOptions?: any; + /** List of Geocoder widgets used for each stop. */ + geocoders?: Geocoder[]; + /** If available, this geometry service is used to provide latitude/longitude values for stops whose reverse geocoding did not return an address (Added at v3.11). */ + geometryTaskUrl?: string; + /** Reference to the map object. */ + map: Map; + /** Activates the map-click-active toggle button when true. */ + mapClickActive?: boolean; + /** Maximum number of stops. */ + maxStops?: number; + /** Minimum number of stops. */ + minStops?: number; + /** When true, stops on the route are re-ordered to provide an optimal route. */ + optimalRoute?: boolean; + /** URL link to a custom print page. */ + printPage?: string; + /** If available, this print task is used to display an overview map of the route on the directions print page (Added at v3.11). */ + printTaskUrl?: string; + /** HTML string for providing a custom printing page */ + printTemplate?: string; + /** When true, the route will return to start point. */ + returnToStart?: boolean; + /** Specify the input parameters for the route task. */ + routeParams?: RouteParameters; + /** Define the symbol used to draw the route on the map. */ + routeSymbol?: SimpleLineSymbol; + /** Specify the service that will be used to calculate directions. */ + routeTaskUrl?: string; + /** Define the info template for the popup that appears when the popup for a route segment is displayed. */ + segmentInfoTemplate?: InfoTemplate; + /** Specify the symbol used to render the individual route segments that display on the map when a direction step is clicked. */ + segmentSymbol?: SimpleLineSymbol; + /** Defines whether the Directions widget will show the map-click-active toggle button. */ + showActivateButton?: boolean; + /** If true, the Clear button is shown. */ + showClearButton?: boolean; + /** If true, the toggle button group allowing user to choose between Miles and Kilometers is shown. */ + showMilesKilometersOption?: boolean; + /** When true, the Optimize order option is shown. */ + showOptimalRouteOption?: boolean; + /** When true the 'Print' button is displayed that allows users to display driving directions in a print page. */ + showPrintPage?: boolean; + /** When true, the Return to start option is shown. */ + showReturnToStartOption?: boolean; + /** Display the 'Show Reverse Stops' button. */ + showReverseStopsButton?: boolean; + /** Highlight the route segment when a directions step is clicked. */ + showSegmentHighlight?: boolean; + /** Display a popup with segment details when a direction step is clicked. */ + showSegmentPopup?: boolean; + /** When true, the Use traffic option is shown. */ + showTrafficOption?: boolean; + /** If true, and six Standard Travel Modes are supported by the service and accessible using current credentials, then two toggle button groups are shown: one to allow user to choose between Driving a Car, a Truck, and Walking, and one more group to choose between Fastest and Shortest routes. */ + showTravelModesOption?: boolean; + /** True if currently calculating the route from the routing service. */ + solving?: boolean; + /** List of graphics used to display the point marker. */ + stopGraphics?: Graphic[]; + /** An array of points that define the stop locations. */ + stops?: any; + /** Define the info template for the popup that appears when a stop is clicked. */ + stopsInfoTemplate?: InfoTemplate; + /** The symbol that displays on the map for the locations between the origin and final destination locations. */ + stopSymbol?: PictureMarkerSymbol; + /** The symbol that displays when an intermediate location is dragged to a new location. */ + stopSymbolDrag?: PictureMarkerSymbol; + /** List of graphics used to display the text over the point marker. */ + textGraphics?: Graphic[]; + /** The text color for the text that appears for each destination. */ + textSymbolColor?: Color; + /** The font used for the text that displays on the map for each stop location. */ + textSymbolFont?: Font; + /** Define an x and/or y offset for the text symbols that are used for the stop locations on the map. */ + textSymbolOffset?: any; + /** Specify a theme for the widget. */ + theme?: string; + /** The symbol that is used to denote the final destination location on the map. */ + toSymbol?: PictureMarkerSymbol; + /** The symbol that displays when an final destination location is dragged to a new location. */ + toSymbolDrag?: PictureMarkerSymbol; + /** When true, real-time traffic is used to plan the route. */ + traffic?: boolean; + /** The traffic layer used for real-time traffic. */ + trafficLayer?: ArcGISDynamicMapServiceLayer; + } + export interface DissolveBoundariesOptions { + /** The URL to the GPServer used to execute an analysis job. */ + analysisGpServer?: string; + /** An array of field names based on which polygons are merged. */ + dissolveFields?: string[]; + /** The layer containing polygon features that will be dissolved. */ + inputLayer: FeatureLayer; + /** Reference to the map object. */ + map?: Map; + /** The name of the output layer to be shown in the Result layer name inputbox. */ + outputLayerName?: string; + /** The url to the ArcGIS.com site or in-house portal where the GP server is hosted. */ + portalUrl?: string; + /** When true, returns the result of analysis as a client-side feature collection. */ + returnFeatureCollection?: boolean; + /** When true, the choose extent checkbox will be shown. */ + showChooseExtent?: boolean; + /** When true, the show credit option is visible. */ + showCredits?: boolean; + /** When true, the help links will be shown. */ + showHelp?: boolean; + /** When true, the select folder dropdown will be shown. */ + showSelectFolder?: boolean; + /** An array of field names and statistical summary types that you wish to calculate from the polygons that are dissolved together. */ + summaryFields?: string[]; + } + export interface DotDensityRendererOptions { + /** The color to be used for the background of the symbol. */ + backgroundColor?: Color; + /** The shape to be used for the dot. */ + dotShape?: string; + /** The size of the dot in pixels. */ + dotSize?: number; + /** The value that a dot represents. */ + dotValue: number; + /** An array of objects, where each object defines a field to be mapped and its color. */ + fields: any[]; + /** The line symbol to use on the outline of the feature. */ + outline?: LineSymbol; + } + export interface DrawOptions { + /** Determines how much time to wait before adding a new point when using a freehand tool. */ + drawTime?: number; + /** If true, tooltips are displayed when creating new graphics with the draw toolbar. */ + showTooltips?: boolean; + /** Determines how far the mouse moves before adding a new point when using one of the freehand tools. */ + tolerance?: number; + /** Determines how far to offset the tool tip from the mouse pointer. */ + tooltipOffset?: number; + } + export interface DriveBufferOptions { + /** The radii to use to create ring buffers */ + radius: number[]; + /** The units of the radii. */ + units: string; + } + export interface EditOptions { + /** Specifies whether users can add new vertices. */ + allowAddVertices?: boolean; + /** Specifies whether users can delete vertices. */ + allowDeletevertices?: boolean; + /** Line symbol used to draw the guild lines, displayed when moving vertices. */ + ghostLineSymbol?: LineSymbol; + /** Marker symbol used to display the insertable vertices. */ + ghostVertexSymbol?: MarkerSymbol; + /** If users want to place the text symbol editor to a user defined HTML element. */ + textSymbolEditorHolder?: any; + /** When true, if the geometry is re-sized the aspect ration will be preserved. */ + uniformScaling?: boolean; + /** Marker symbol used to draw the vertices. */ + vertexSymbol?: MarkerSymbol; + } + export interface EditorOptions { + /** Create a new settings object that defines the capabilities of the widget. */ + settings?: any; + } + export interface EnrichLayerOptions { + /** The URL to the GPServer used to execute an analysis job. */ + analysisGpServer?: string; + /** An buffer distance or driving time value to buffer the input feature layer. */ + distance?: number; + /** When true, Travel Modes (Driving Time) is enabled for inputLayer with point geometries (esriGeometryPoint). */ + enableTravelModes?: boolean; + /** The input feature layer to enrich with new data. */ + inputLayer: FeatureLayer; + /** Reference to the map object. */ + map?: Map; + /** The name of the output layer to be shown in the Result layer name inputbox. */ + outputLayerName?: string; + /** The url to the ArcGIS.com site or in-house portal where the GP server is hosted. */ + portalUrl?: string; + /** When true, returns the result of analysis as a client-side feature collection. */ + returnFeatureCollection?: boolean; + /** When true, the choose extent checkbox will be shown. */ + showChooseExtent?: boolean; + /** When true, the show credit option is visible. */ + showCredits?: boolean; + /** When true, the help links will be shown. */ + showHelp?: boolean; + /** When true, the select folder dropdown will be shown. */ + showSelectFolder?: boolean; + /** When true, you can specify a time for traffic condition under Define areas to enrich - Driving Time. */ + showTrafficWidget?: boolean; + } + export interface ExtractDataOptions { + /** The URL to the GPServer used to execute an analysis job. */ + analysisGpServer?: string; + /** If true, the Clip features option in Study area will be ckecked. */ + clip?: boolean; + /** The format of output data shown as the default selection in the Output data format menu. */ + dataFormat?: string; + /** An array for feature layers to be extracted. */ + featureLayers: FeatureLayer[]; + /** An array for feature layers to be extracted. */ + inputLayers?: FeatureLayer[]; + /** Reference to the map object. */ + map?: Map; + /** The name of the output layer to be shown in the Result layer name inputbox. */ + outputLayerName?: string; + /** The url to the ArcGIS.com site or in-house portal where the GP server is hosted. */ + portalUrl?: string; + /** When true, returns the result of analysis as a client-side feature collection. */ + returnFeatureCollection?: boolean; + /** When true, the choose extent checkbox will be shown. */ + showChooseExtent?: boolean; + /** When true, the show credit option is visible. */ + showCredits?: boolean; + /** When true, the help links will be shown. */ + showHelp?: boolean; + /** When true, the select folder dropdown will be shown. */ + showSelectFolder?: boolean; + } + export interface FeatureLayerOptions { + /** Enable or disable the auto generalization of features from a non-editable layer in on-demand mode. */ + autoGeneralize?: boolean; + /** Class attribute to set for the layer's node. */ + className?: string; + /** Where clause to use as definition expression for layer. */ + definitionExpression?: string; + /** When true, graphics are displayed during panning. */ + displayOnPan?: boolean; + /** Set a callback function that will be invoked by FeatureLayer.getEditSummary. */ + editSummaryCallback?: Function; + /** Specify the geodatabase version to display. */ + gdbVersion?: string; + /** Unique ID to assign to the layer. */ + id?: string; + /** The template that defines the content to display in the map info window when the user clicks on a feature. */ + infoTemplate?: InfoTemplate; + /** The maximum allowable offset, only applicable for layers that are not editable. */ + maxAllowableOffset?: number; + /** The query mode for the feature layer. */ + mode?: number; + /** Initial opacity or transparency of layer. */ + opacity?: number; + /** One or more fields used to order features by - for queries as well as for rendering. */ + orderByFields?: string[]; + /** An array of strings which correspond to fields to include in the FeatureLayer. */ + outFields?: string[]; + /** Refresh interval of the layer in minutes. */ + refreshInterval?: number; + /** Specify the metadata of the layer. */ + resourceInfo?: any; + /** When true, the layer's attribution is displayed on the map. */ + showAttribution?: boolean; + /** Indicates whether to show labels on the layer. */ + showLabels?: boolean; + /** The dynamic layer or table source. */ + source?: LayerSource; + /** Specify the size of the virtual tiles, used in on-demand mode. */ + tileHeight?: number; + /** Specify the size of the virtual tiles, used in on-demand mode. */ + tileWidth?: number; + /** The name of the trackIdField. */ + trackIdField?: string; + /** When true, the layer will update its content based on the map's time extent. */ + useMapTime?: boolean; + /** Initial visibility of the layer. */ + visible?: boolean; + } + export interface FeatureTableOptions { + /** A dGrid property. */ + allowSelectAll?: boolean; + /** A dGrid property. */ + cellNavigation?: boolean; + /** Object defining the date options specifically for formatting date and time editors. */ + dateOptions?: any; + /** The featureLayer that the table is associated with. */ + featureLayer: FeatureLayer; + /** Columns to hide by default using the dGrid ColumnHider extension. */ + hiddenFields?: string[]; + /** A reference to the Map. */ + map?: Map; + /** A dGrid property. */ + noDataMessage?: string; + /** A dGrid property. */ + selectionMode?: string; + } + export interface FindHotSpotsOptions { + /** An array of feature layer candidates to be selected as the aggregation polygon layer. */ + aggregationPolygonLayers: FeatureLayer[]; + /** The numeric field in the AnalysisLayer that will be analyzed. */ + analysisField?: string; + /** The URL to the GPServer used to execute an analysis job. */ + analysisGpServer?: string; + /** The feature layer for which hot spots will be calculated. */ + analysisLayer: FeatureLayer; + /** An array of feature layer candidates to be selected as the bounding polygon layer. */ + boundingPolygonLayers: FeatureLayer[]; + /** When true, make process info to get analysis report. */ + isProcessInfo?: boolean; + /** Reference to the map object. */ + map?: Map; + /** The name of the output layer to be shown in the Result layer name inputbox. */ + outputLayerName?: string; + /** The url to the ArcGIS.com site or in-house portal where the GP server is hosted. */ + portalUrl?: string; + /** When true, returns the result of analysis as a client-side feature collection. */ + returnFeatureCollection?: boolean; + /** When true, the choose extent checkbox will be shown. */ + showChooseExtent?: boolean; + /** When true, the show credit option is visible. */ + showCredits?: boolean; + /** When true, the help links will be shown. */ + showHelp?: boolean; + /** When true, the select folder dropdown will be shown. */ + showSelectFolder?: boolean; + } + export interface FindNearestOptions { + /** The URL to the GPServer used to execute an analysis job. */ + analysisGpServer?: string; + /** The feature layer from which the nearest features are found. */ + analysisLayer: FeatureLayer; + /** When true, Travel Modes ( Driving Distance, Driving Time) are enabled for analysisLayer with point geometries (esriGeometryPoint). */ + enableTravelModes?: boolean; + /** Reference to the map object. */ + map?: Map; + /** The maximum number of nearest locations to find for each feature in analysisLayer. */ + maxCount?: number; + /** The feature layer to be shown selected in the "1. */ + nearLayer: FeatureLayer; + /** An array of near layer candidates. */ + nearLayers: FeatureLayer[]; + /** The name of the output layer to be shown in the Result layer name inputbox. */ + outputLayerName?: string; + /** The url to the ArcGIS.com site or in-house portal where the GP server is hosted. */ + portalUrl?: string; + /** When true, returns the result of analysis as a client-side feature collection. */ + returnFeatureCollection?: boolean; + /** The maximum range to search for nearest locations from each feature in the analysisLayer. */ + searchCutoff?: number; + /** The units of the searchCutoff parameter. */ + searchCutoffUnits?: string; + /** When true, the choose extent checkbox will be shown. */ + showChooseExtent?: boolean; + /** When true, the show credit option is visible. */ + showCredits?: boolean; + /** When true, the help links will be shown. */ + showHelp?: boolean; + /** When true, the select folder dropdown will be shown. */ + showSelectFolder?: boolean; + } + export interface FindTaskOptions { + /** Specify the geodatabase version to display. */ + gdbVersion?: string; + } + export interface GalleryOptions { + /** An array of items, see example below. */ + items: any[]; + /** Display the title for each item in the gallery. */ + showTitle?: boolean; + /** Specify the size of the gallery's thumbnail image. */ + thumbnailStyle?: string; + } + export interface GaugeOptions { + /** Text to display at the bottom of the gauge. */ + caption?: string; + /** Color used for the arc indicator on the gauge. */ + color?: string; + /** Name of the attribute field used to drive the gauge. */ + dataField?: string; + /** Either "value" or "percentage". */ + dataFormat?: string; + /** Name of the attribute field used to display a feature name on the gauge. */ + dataLabelField?: string; + /** When true, the gauge is created with JSON from an ArcGIS Online webmap. */ + fromWebmap?: boolean; + /** A esri.layers.GraphicsLayer or esri.layers.FeatureLayer used to drive the gauge. */ + layer?: GraphicsLayer; + /** Maximum value that will be displayed on the gauge. */ + maxDataValue?: number; + /** The text to display when a feature does not not a value for the dataLabelField. */ + noDataLabel?: string; + /** Object passed to dojo.number.format to specify how data values are formatted. */ + numberFormat?: any; + /** Text displayed above the gauge. */ + title?: string; + /** What to dsiplay after the value of the currently selected feature. */ + unitLabel?: string; + } + export interface GenerateRendererTaskOptions { + /** Prior to ArcGIS Server 10.2, map server/feature service only sample 1000 features to generate the renderer when using GenerateRenderer operation, which mean if there are more than 1000 features, it may run into the case that some feature will not be categorized into any breaks/unique values. */ + checkValueRange?: boolean; + /** Specify the geodatabase version to display. */ + gdbVersion?: string; + } + export interface GeoRSSLayerOptions { + /** The template used to display popup window for identify operation. */ + infoTemplate?: InfoTemplate; + /** The output spatial reference for the GeoRSSLayer. */ + outSpatialReference?: SpatialReference; + /** The default symbol use to display point features. */ + pointSymbol?: Symbol; + /** The default symbol used to display polygon features. */ + polygonSymbol?: Symbol; + /** The default symbol used to display polyline features. */ + polylineSymbol?: Symbol; + } + export interface GeocoderOptions { + /** By default, the Geocoder widget uses the Esri World Locator to find search locations. */ + arcgisGeocoder?: any; + /** When false, the geocoder will not display the auto-complete results menu. */ + autoComplete?: boolean; + /** When false, the geolocator will not navigate to the result after selection or search. */ + autoNavigate?: boolean; + /** When false, the geocoder menu will not be displayed when more than one geocoder is set. */ + geocoderMenu?: boolean; + /** Defines the geocoders that will be used by the Geocoder widget. */ + geocoders?: any[]; + /** Specify a graphicsLayer to use when highlightSymbol is true. */ + graphicsLayer?: GraphicsLayer; + /** Indicates whether to show a graphic at a selected location. */ + highlightLocation?: boolean; + /** Reference to the map. */ + map: Map; + /** Maximum number of results to return. */ + maxLocations?: number; + /** Minimum number of characters entered into the search field before querying for results. */ + minCharacters?: number; + /** Number of milliseconds before querying for results will begin. */ + searchDelay?: number; + /** When false, the geocoder will not show search suggestions while typing. */ + showResults?: boolean; + /** Symbol to use when highlightLocation is true. */ + symbol?: Symbol; + /** Specify a theme for the geocoder. */ + theme?: string; + /** Start the geocoder with a default value. */ + value?: string; + /** Scale to zoom to when geocoder does not return an extent. */ + zoomScale?: number; + } + export interface GeometryLocationProviderOptions { + /** The attribute field in the graphic object that contains the JSON string representing the geometry. */ + geometryField: string; + /** The geometry type of the returned features. */ + geometryType: string; + } + export interface GraphicsLayerOptions { + /** Class attribute to set for the layer's node. */ + className?: string; + /** List of attribute fields to be added as custom data attributes to graphics node. */ + dataAttributes?: any; + /** When true, graphics are displayed during panning. */ + displayOnPan?: boolean; + /** Id to assign to the layer. */ + id?: string; + /** The info template for the layer. */ + infoTemplate?: InfoTemplate; + /** Initial opacity or transparency of layer. */ + opacity?: number; + /** Refresh interval of the layer in minutes. */ + refreshInterval?: number; + /** Indicates whether the layer is responsible for styling graphics. */ + styling?: boolean; + /** Initial visibility of the layer. */ + visible?: boolean; + } + export interface Handle { + /** Remove the listener */ + remove(): void; + } + export interface HeatmapRendererOptions { + /** The radius (in pixels) of the circle over which the majority of each points value is spread out over. */ + blurRadius?: number; + /** An array of CSS color strings (#RGB, #RRGGBB, rgb(r,g,b), rgba(r,g,b,a)). */ + colors: string[]; + /** The name of the attribute field used to weight the heatmap points. */ + field?: string; + /** The pixel intensity value which is assigned the final color in the color ramp. */ + maxPixelIntensity?: number; + /** The pixel intensity value which is assigned the initial color in the color ramp. */ + minPixelIntensity?: number; + } + export interface HeatmapSliderOptions { + /** An array of colorStop objects describing the renderer's color ramp with more specificity than just colors. */ + colorStops: any[]; + /** Handles identified by their index values within the stops array. */ + handles: number[]; + /** Absolute maximum value of the slider. */ + maxValue?: number; + /** Absolute minimum value of the slider. */ + minValue?: number; + /** Width of slider ramp in pixels. */ + rampWidth?: number; + /** Displays slider handles when true. */ + showHandles?: boolean; + /** Displays slider labels when true. */ + showLabels?: boolean; + /** Displays slider ticks when true. */ + showTicks?: boolean; + } + export interface HistogramTimeSliderOptions { + /** Change color of histogram bars, default is "rgb(5, 112, 176)".color: "#555555" */ + color?: string; + /** Formats dates displayed by histogram slider.dateFormat: "DateFormat(selector: 'date', fullYear: true)" */ + dateFormat?: string; + /** Array of feature layers to be used by slider. */ + layers?: Layer[]; + /** With a stream layer, when the number of points on the map exceeds the maximum number allowed, this histogram will start removing bins at the beginning of the array if in the "show_partial" mode. */ + mode?: string; + /** Sets resolution for histogram slider (seconds/minutes/hours/etc) using Esri date formats. */ + timeInterval?: string; + } + export interface HomeButtonOptions { + /** The extent used to zoom to when clicked. */ + extent?: Extent; + /** Map object that this dijit is associated with. */ + map: Map; + /** Class used for styling the widget. */ + theme?: string; + /** Whether the widget is visible by default. */ + visible?: boolean; + } + export interface HorizontalSliderOptions { + /** Array of text labels to render - evenly spaced from left-to-right. */ + labels: string[]; + } + export interface IdentifyTaskOptions { + /** Specify the geodatabase version to display. */ + gdbVersion?: string; + } + export interface KMLLayerOptions { + /** Class attribute to set for the layer's node. */ + className?: string; + /** The output spatial reference for the KMLLayer. */ + outSR?: SpatialReference; + /** Refresh interval of the layer in minutes. */ + refreshInterval?: number; + } + export interface LabelLayerOptions { + /** ID assigned to the layer. */ + id?: string; + /** Display mode for the label layer. */ + mode?: string; + } + export interface LayerOptions { + /** Class attribute to set for the layer's node. */ + className?: string; + /** Refresh interval of the layer in minutes. */ + refreshInterval?: number; + /** When true, the layer's attribution is displayed on the map. */ + showAttribution?: boolean; + } + export interface LayerSwipeOptions { + /** The number of pixels to clip the swipe tool. */ + clip?: number; + /** If the widget is enabled and layers can be swiped. */ + enabled?: boolean; + /** The layers to be swiped. */ + layers: Layer[]; + /** The number of pixels to place the tool from the left of the map. */ + left?: number; + /** Map object that this dijit is associated with. */ + map: Map; + /** Class used for styling the widget. */ + theme?: string; + /** The number of pixels to place the tool from the top of the map. */ + top?: number; + /** Type of swipe tool to use. */ + type?: string; + } + export interface LegendOptions { + /** Specify the alignment of the legend within the HTML element where the legend is rendered. */ + arrangement?: number; + /** When false, the legend will not automatically update if the map changes scale or when layers are added are removed from the map. */ + autoUpdate?: boolean; + /** Specify a subset of the layers in the map to display in the legend. */ + layerInfos?: any[]; + /** Reference to the map. */ + map: Map; + /** When true the legend will update with every scale change and displays only the layers and sub layers that are visible in the current map scale. */ + respectCurrentMapScale?: boolean; + } + export interface LocateButtonOptions { + /** Centers the map to the location when a new position is returned. */ + centerAt?: boolean; + /** The HTML5 Geolocation Position options for locating. */ + geolocationOptions?: any; + /** If highlightLocation is on and this property is set then a graphic will be added to this layer instead of map.graphics. */ + graphicsLayer?: GraphicsLayer; + /** If true, the users location will be highlighted with a point. */ + highlightLocation?: boolean; + /** The infoTemplate used for the highlight graphic. */ + infoTemplate?: InfoTemplate; + /** Map object that this dijit is associated with. */ + map: Map; + /** The scale to zoom to when a users location has been found. */ + scale?: number; + /** Sets the maps scale when a new position is returned. */ + setScale?: boolean; + /** The symbol used on the highlight graphic to highlight the users location on the map. */ + symbol?: Symbol; + /** Class used for styling the widget. */ + theme?: string; + /** When enabled, the button becomes a toggle that creates an event to watch for location changes. */ + useTracking?: boolean; + /** Whether the widget is visible by default. */ + visible?: boolean; + } + export interface LocatorLocationProviderOptions { + /** Object that matches the Locator address fields to corresponding attribute names in the Graphic object. */ + addressFields: any; + /** An instance of a Locator object. */ + locator: Locator; + } + export interface MapImageOptions { + /** Specfiy an extent for the image. */ + extent?: Extent; + /** Specify the url of the image. */ + href?: string; + } + export interface MapOptions { + /** Width of the attribution node relative to the map width. */ + attributionWidth?: number; + /** When true the map will automatically resize when the browser window is resized or when the ContentPane widget enclosing the map is resized. */ + autoResize?: boolean; + /** Specify a basemap for the map. */ + basemap?: string; + /** The location where the map should be centered. */ + center?: any; + /** When true, graphics are displayed during panning. */ + displayGraphicsOnPan?: boolean; + /** If provided, the extent and projection of the map is set to the properties of Extent. */ + extent?: Extent; + /** When true a fade effect is enabled for supported layers. */ + fadeOnZoom?: boolean; + /** When true, for maps that contain tiled map service layers, you are guaranteed to have the initial extent defined using the extent constructor option shown completely on the map. */ + fitExtent?: boolean; + /** When the mapNavigation mode is set to 'css-transforms', CSS3 transforms will be used for map navigation when supported by the browser. */ + force3DTransforms?: boolean; + /** By default the map creates and uses an out-of-the-box esri/dijit/Popup. */ + infoWindow?: InfoWindowBase; + /** If provided, the map is initialized with the specified levels of detail. */ + lods?: LOD[]; + /** Display the esri logo on the map. */ + logo?: boolean; + /** Maximum visible scale of the map. */ + maxScale?: number; + /** Maximum map zoom level. */ + maxZoom?: number; + /** Minimum visible scale of the map. */ + minScale?: number; + /** Minimum map zoom level. */ + minZoom?: number; + /** Displays pan buttons on map. */ + nav?: boolean; + /** Specify whether or not to use CSS3 transformations when panning and zooming. */ + navigationMode?: string; + /** Default value is true, indicating that the map will skip panning animation when calling map.centerAt() or map.setExtent() (for map.setExtent(), the animation is only skipped if the map's zoom level is not changing) if the panning distance is twice the distance of the current extent. */ + optimizePanAnimation?: boolean; + /** Specify a time period in milliseconds to ignore repeated calls to the resize method. */ + resizeDelay?: number; + /** Initial map scale. */ + scale?: number; + /** Enable or disable map attribution display. */ + showAttribution?: boolean; + /** If true and a map click event occurs, it may show the map's infoWindow. */ + showInfoWindowOnClick?: boolean; + /** Indicate whether to display labels. */ + showLabels?: boolean; + /** Displays a slider on the map. */ + slider?: boolean; + /** Define labels for the slider. */ + sliderLabels?: string[]; + /** Orientation of the zoom slider. */ + sliderOrientation?: string; + /** Position of the zoom slider within the map control. */ + sliderPosition?: string; + /** Defines the slider style. */ + sliderStyle?: string; + /** When true, for Apple computers with a trackpad or magic mouse use, swipe pans instead of zooming. */ + smartNavigation?: boolean; + /** When true, supports continuous pan across the dateline. */ + wrapAround180?: boolean; + /** Initial zoom level of the map. */ + zoom?: number; + } + export interface MeasurementOptions { + /** Flag for showing full list of units in the Location tool. */ + advancedLocationUnits?: boolean; + /** The default area unit for the measure area tool. */ + defaultAreaUnit?: Units; + /** The default length unit for the measure distance tool. */ + defaultLengthUnit?: Units; + /** Allows the user to immediately measure previously-created geometry on dijit creation. */ + geometry?: any; + /** Line symbol used to draw the lines for the measure line and measure distance tools. */ + lineSymbol?: SimpleLineSymbol; + /** Reference to the map. */ + map: Map; + /** Marker symbol used to draw the points for the measure line tool. */ + pointSymbol?: MarkerSymbol; + } + export interface MergeLayersOptions { + /** The URL to the GPServer used to execute an analysis job. */ + analysisGpServer?: string; + /** The feature layer to be merged with the mergeLayer. */ + inputLayer: FeatureLayer; + /** Reference to the map object. */ + map?: Map; + /** An array of feature layer candidates to be selected as the merge layer. */ + mergeLayers: FeatureLayer[]; + /** An array of values that describe how fields from the mergeLayer are to be modified. */ + mergingAttributes?: string[]; + /** The name of the output layer to be shown in the Result layer name inputbox. */ + outputLayerName?: string; + /** The url to the ArcGIS.com site or in-house portal where the GP server is hosted. */ + portalUrl?: string; + /** When true, returns the result of analysis as a client-side feature collection. */ + returnFeatureCollection?: boolean; + /** When true, the choose extent checkbox will be shown. */ + showChooseExtent?: boolean; + /** When true, the show credit option is visible. */ + showCredits?: boolean; + /** When true, the help links will be shown. */ + showHelp?: boolean; + /** When true, the select folder dropdown will be shown. */ + showSelectFolder?: boolean; + } + /** Constants representing how the geometry is returned. */ + export interface NAOutputLine { + /** Do not return geometries. */ + NONE: any; + /** Return polylines containing striaght lines between input locations. */ + STRAIGHT: any; + /** Return polylines based on the underlying street geometries. */ + TRUE_SHAPE: any; + /** Return polylines based on the underlying street geometries with the M values set based on the accumulated impedance at each vertex. */ + TRUE_SHAPE_WITH_MEASURE: any; + } + /** Constants representing how the geometry is returned. */ + export interface NAOutputPolygon { + /** Detailed output polygons */ + DETAILED: any; + /** No output polygons */ + NONE: any; + /** Simplified output polygons. */ + SIMPLIFIED: any; + } + /** Constants representing directionality in network analysis. */ + export interface NATravelDirection { + /** Travel direction from the facility */ + FROM_FACILITY: any; + /** Travel direction to the facility */ + TO_FACILITY: any; + } + /** Constants representing how U-Turns are handled. */ + export interface NAUTurn { + /** Allow u-turns at the end of any street. */ + ALLOW_BACKTRACK: any; + /** Allow u-turns at dead ends and intersections. */ + AT_DEAD_ENDS_AND_INTERSECTIONS: any; + /** Only allow u-turns at dead ends where a street is not connected to another street. */ + AT_DEAD_ENDS_ONLY: any; + /** Do not allow u-turns at the end of any streets. */ + NO_BACKTRACK: any; + } + export interface OAuthInfoOptions { + /** The registered application Id. */ + appId: string; + /** Applications with the same value will share the stored token on the same host. */ + authNamespace?: string; + /** The number of minutes the token will be valid for. */ + expiration?: number; + /** The locale for the OAuth sign in page. */ + locale?: string; + /** The minimum time in minutes before a saved token is due to expire that it should still be considered valid for use. */ + minTimeUntilExpiration?: number; + /** Set to true to show the OAuth sign in page in a popup window. */ + popup?: boolean; + /** The relative page URL for the user to be sent to from the OAuth sign in page. */ + popupCallbackUrl?: string; + /** The window features passed to window.open(). */ + popupWindowFeatures?: string; + /** The ArcGIS for Portal URL. */ + portalUrl?: string; + } + export interface OpacitySliderOptions { + /** Handles identified by their index values within the stops array. */ + handles: number[]; + /** Represents histogram data object. */ + histogram?: any; + /** Width of histogram in pixels. */ + histogramWidth?: number; + /** Absolute maximum value of the slider. */ + maxValue?: number; + /** Absolute minimum value of the slider. */ + minValue?: number; + /** Data map containing renderer information. */ + opacityInfo: any; + /** Handle identified by its index value within the stops array. */ + primaryHandle?: number; + /** Width of slider ramp in pixels. */ + rampWidth?: number; + /** Displays slider handles when true. */ + showHandles?: boolean; + /** Displays the histogram when true. */ + showHistogram?: boolean; + /** Displays slider labels when true. */ + showLabels?: boolean; + /** Displays slider ticks when true. */ + showTicks?: boolean; + /** Displays the transparent background when true. */ + showTransparentBackground?: boolean; + /** Represents statistics data object. */ + statistics?: any; + /** Additional options for slider customization. */ + zoomOptions?: any; + } + export interface OpenStreetMapLayerOptions { + /** An array of levels at which to draw. */ + displayLevels?: number[]; + /** Id to assign to the layer. */ + id?: string; + /** Initial opacity or transparency of layer. */ + opacity?: number; + /** When true, tile resampling is enabled. */ + resampling?: boolean; + /** Number of levels beyond the last level where tiles are available. */ + resamplingTolerance?: number; + /** An array of tile servers */ + tileServers?: string[]; + /** Initial visibility of the layer. */ + visible?: boolean; + } + export interface OperationBaseOptions { + /** Provide information about the operation. */ + label?: string; + /** Specify the type of operation, for example: "edit" or "navigation". */ + type?: string; + } + export interface OverlayLayersOptions { + /** The URL to the GPServer used to execute an analysis job. */ + analysisGpServer?: string; + /** The feature layer that will be overlayed with the overlayLayer. */ + inputLayer: FeatureLayer; + /** Reference to the map object. */ + map?: Map; + /** The name of the output layer to be shown in the Result layer name inputbox. */ + outputLayerName?: string; + /** An array of feature layers to be overlaid with inputLayer. */ + overlayLayer: FeatureLayer[]; + /** Defines how two input layers are combined. */ + overlayType?: string; + /** The url to the ArcGIS.com site or in-house portal where the GP server is hosted. */ + portalUrl?: string; + /** When true, returns the result of analysis as a client-side feature collection. */ + returnFeatureCollection?: boolean; + /** When true, the choose extent checkbox will be shown. */ + showChooseExtent?: boolean; + /** When true, the show credit option is visible. */ + showCredits?: boolean; + /** When true, the help links will be shown. */ + showHelp?: boolean; + /** When true, the select folder dropdown will be shown. */ + showSelectFolder?: boolean; + /** When the distance between features is less than the tolerance, the features in the overlay layer will snap to the features in the input layer. */ + snapToInput?: boolean; + /** The minimum distance separating all feature coordinates (nodes and vertices) as well as the distance a coordinate can move in X or Y (or both). */ + tolerance?: number; + } + export interface OverviewMapOptions { + /** Specifies which corner of the map to attach the OverviewMap dijit. */ + attachTo?: string; + /** Specify the base layer for the overview map. */ + baseLayer?: Layer; + /** Fill color for the extent rectangle. */ + color?: string; + /** The ratio between the size of the overview map and the extent rectangle displayed on the overview map. */ + expandFactor?: number; + /** Height of the overview map dijit in screen pixels. */ + height?: number; + /** Unique identifier for the dijit. */ + id?: string; + /** Reference to the map. */ + map: Map; + /** Defines the visibility of the maximize/restore button. */ + maximizeButton?: boolean; + /** Opacity of the extent rectangle, defined as a number between 0 (invisible) and 1 (opaque). */ + opacity?: number; + /** Specifies the initial visibility of the overview map. */ + visible?: boolean; + /** Width of the overview map dijit in screen pixels. */ + width?: number; + } + export interface PixelBlockOptions { + /** Number of rows. */ + height: number; + /** An array of nodata mask. */ + mask?: any[]; + /** A two dimensional array. */ + pixels: number[][]; + /** Pixel type. */ + pixelType?: string; + /** Array of objects containing numeric statistical properties (e.g. */ + statistics?: any[]; + /** Number of columns. */ + width: number; + } + export interface PopupMobileOptions { + /** Define the symbol used to highlight polygon features. */ + fillSymbol?: FillSymbol; + /** When true, the feature is highlighted, set to false to disable highlighting. */ + highlight?: boolean; + /** Define the symbol used to highlight line features. */ + lineSymbol?: LineSymbol; + /** Specify the margin (in pixels) to leave to the left of the popup window when it is maximized. */ + marginLeft?: number; + /** Specify the margin (in pixels) to leave at the top of the popup window when it is maximized. */ + marginTop?: number; + /** Define the marker symbol used to highlight point features. */ + markerSymbol?: MarkerSymbol; + /** Specify the x-offset (in pixels) used when positioning the popup. */ + offsetX?: number; + /** Specify the y-offset (in pixels) used when positioning the popup. */ + offsetY?: number; + /** Define the number of levels to zoom in, default value is 4. */ + zoomFactor?: number; + } + export interface PopupOptions { + /** Controls the placement of the popup window with respect to the geographic location. */ + anchor?: string; + /** Define the symbol used to highlight polygon features. */ + fillSymbol?: FillSymbol; + /** Number of milliseconds after which the popup window will be hidden when visibleWhenEmpty is false and there are no features to be displayed. */ + hideDelay?: boolean; + /** Indicates whether popup should highlight features. */ + highlight?: boolean; + /** Indicates whether a feature should remain highlighted after the user closes the popup window. */ + keepHighlightOnHide?: boolean; + /** Define the symbol used to highlight line features. */ + lineSymbol?: LineSymbol; + /** Specify the margin (in pixels) to leave to the left of the popup window when it is maximized. */ + marginLeft?: number; + /** Specify the margin (in pixels) to leave at the top of the popup window when it is maximized. */ + marginTop?: number; + /** Define the marker symbol used to highlight point features. */ + markerSymbol?: MarkerSymbol; + /** Specify the x-offset (in pixels) used when positioning the popup. */ + offsetX?: number; + /** Specify the y-offset (in pixels) used when positioning the popup. */ + offsetY?: number; + /** Indicates whether popup should display previous and next buttons in the title bar. */ + pagingControls?: boolean; + /** Indicates whether popup should display the title bar text that contains the page number and total number of available features. */ + pagingInfo?: boolean; + /** Indicates whether the popup window should be displayed. */ + popupWindow?: boolean; + /** Indicates whether the feature's title should display within the body of the popup window as opposed to in the titlebar. */ + titleInBody?: boolean; + /** Indicates whether the popup window remains visible when there are no features to be displayed. */ + visibleWhenEmpty?: boolean; + /** Define the number of levels to zoom in when the 'Zoom to' link is clicked. */ + zoomFactor?: number; + } + export interface PopupTemplateOptions { + /** Positive or negative offset (in minutes) from UTC. */ + utcOffset?: number; + } + export interface PrintOptions { + /** Set to true if the print service is an asynchronous geoprocessing service. */ + async?: boolean; + /** The map to print. */ + map?: Map; + /** An optional array of user-defined templates. */ + templates?: PrintTemplate[]; + /** The url to an export web map task. */ + url?: string; + } + export interface PrintTaskOptions { + /** Set to true if the print service is an asynchronous geoprocessing service. */ + async?: boolean; + } + export interface ProcessorOptions { + /** Start processing features immediately. */ + autostart?: boolean; + /** Whether the processor allow the feature layer to draw its features. */ + drawFeatures?: boolean; + /** Whether the processor do the layer's I/O via a worker. */ + fetchWithWorker?: boolean; + /** A FeatureLayer or array of FeatureLayers to attach the processor to. */ + layers?: FeatureLayer[]; + /** Uses all FeatureLayers associated with the map in the processor. */ + map?: Map; + /** Whether the processor pass the features through without modification or delay to the FeatureLayer. */ + passFeatures?: boolean; + /** Whether the processor require Workers to function properly. */ + requireWorkerSupport?: boolean; + } + export interface QueryTaskLocationProviderOptions { + /** Object containing properties that will be used to query the ArcGIS layer. */ + queryParameters: any; + /** An instance of a QueryTask. */ + queryTask: QueryTask; + /** Set to true when querying a field that contains unicode characters. */ + unicode: boolean; + /** A mapping of the fields in the data and the ArcGIS layer to use to perform a join. */ + whereFields: any; + } + export interface QueryTaskOptions { + /** Specify the geodatabase version to display. */ + gdbVersion?: string; + } + export interface RasterLayerOptions { + /** Sets the layer's draw mode. */ + drawMode?: boolean; + /** Sets the context of the Canvas. */ + drawType?: string; + /** Additional parameters defined in an ImageServiceParameters object. */ + imageServiceParameters?: ImageServiceParameters; + /** Applies a function for visualization or post-processing purposes. */ + pixelFilter?: any; + } + export interface RendererSliderOptions { + /** Collection of indexes that indicates which children from the infos array to use as handles. */ + handles?: number[]; + /** Absolute maximum value allowed by the slider. */ + maximum: number; + /** Top label for the slider. */ + maxLabel?: string; + /** Absolute minimum value allowed by the slider. */ + minimum: number; + /** Bottom label for the slider. */ + minLabel?: string; + /** **CHECK THIS: Is it num of dec places? - Accuracy of the data (related to rounding). */ + precision?: number; + /** Primary handle identified by its index value within the related infos array (color, size, break). */ + primaryHandle?: number; + /** Toggle for showing the black handle bars. */ + showHandles?: boolean; + /** Flexible toggle for showing labels (e.g. */ + showLabels?: any; + /** Toggle for showing the horizontal line indicators from the center of the handle. */ + showTicks?: boolean; + /** Stores positions represented as numbers that fall between minimum and maximum. */ + values: number[]; + } + export interface RingBufferOptions { + /** The radii to use to create ring buffers */ + radii: number[]; + /** The units of the radii. */ + units: string; + } + export interface ScaleDependentRendererOptions { + /** An array of objects where each object defines a renderer and the zoom or scale range to which it applies. */ + rendererInfos?: any[]; + } + export interface ScalebarOptions { + /** Specify the scalebar position on the map. */ + attachTo?: string; + /** Reference to the map. */ + map: Map; + /** Specify the style for the scalebar. */ + scalebarStyle?: string; + /** Specify the scalebar units. */ + scalebarUnit?: string; + } + export interface SearchOptions { + /** The currently selected source. */ + activeSourceIndex?: any; + /** Indicates whether to automatically add all the feature layers from the map. */ + addLayersFromMap?: boolean; + /** Indicates whether to automatically navigate to the selected result. */ + autoNavigate?: boolean; + /** Indicates whether to automatically select the first result. */ + autoSelect?: boolean; + /** Indicates whether to enable an option to collapse/expand the search into a button. */ + enableButtonMode?: boolean; + /** Indicates whether to show the selected feature on the map using the highlight symbol property. */ + enableHighlight?: boolean; + /** Indicates whether to display the infoWindow on feature click. */ + enableInfoWindow?: boolean; + /** Indicates whether to enable showing a label for the geometry.The default value is false. */ + enableLabel?: boolean; + /** Indicates whether to enable the menu for selecting different sources. */ + enableSourcesMenu?: boolean; + /** Indicates whether or not to enable suggest on the widget. */ + enableSuggestions?: boolean; + /** Indicates whether to display suggest results. */ + enableSuggestionsMenu?: boolean; + /** Indicates whether to set the state of the enableButtonMode to expanded (true) or collapsed (false). */ + expanded?: boolean; + /** This the specified graphicsLayer to use for the highlightGraphic and labelGraphic instead of map.graphics. */ + graphicsLayer?: Layer; + /** The symbol used for highlightGraphic. */ + highlightSymbol?: Symbol; + /** A customized infoTemplate for the selected feature. */ + infoTemplate?: InfoTemplate; + /** The text symbol for the label graphic. */ + labelSymbol?: TextSymbol; + /** The default distance specified in meters used to reverse geocode, (if not specified by source).The default value is 1500. */ + locationToAddressDistance?: number; + /** Reference to the map. */ + map?: Map; + /** The default maximum number of results returned by the widget if not specified by source. */ + maxResults?: number; + /** The default maximum number of suggestions returned by the widget if not specified by source. */ + maxSuggestions?: number; + /** The default minimum amount of characters needed for the search if not specified by source. */ + minCharacters?: number; + /** Indicates whether to show the infoWindow when a result is selected. */ + showInfoWindowOnSelect?: boolean; + /** An array of source objects used to find search results. */ + sources?: any[]; + /** The millisecond delay after keyup and before making a suggest network request. */ + suggestionDelay?: number; + /** The CSS class selector used to uniquely style the widget. */ + theme?: string; + /** Current value of the search box input text string. */ + value?: string; + /** Indicates whether to show the Search widget. */ + visible?: boolean; + /** If the result does not have an associated extent, specify this number to use as the zoom scale for the result. */ + zoomScale?: number; + } + export interface SizeInfoSliderOptions { + /** Classification method. */ + classificationMethod?: string; + /** Handles identified by their index values within the stops array. */ + handles: number[]; + /** Represents histogram data object. */ + histogram?: any; + /** Width of the histogram in pixels. */ + histogramWidth?: number; + /** Absolute maximum value of the slider. */ + maxValue?: number; + /** Absolute minimum value of the slider. */ + minValue?: number; + /** Normalization type. */ + normalizationType?: string; + /** Handle identified by its index value within the stops array. */ + primaryHandle?: number; + /** Width of slider ramp in pixels. */ + rampWidth?: number; + /** Displays slider handles when true. */ + showHandles?: boolean; + /** Displays the histogram when true. */ + showHistogram?: boolean; + /** Displays labels when true. */ + showLabels?: boolean; + /** Displays slider ticks when true. */ + showTicks?: boolean; + /** Data map containing renderer information. */ + sizeInfo: any; + /** Represents statistics data object. */ + statistics?: any; + /** Additional options to customize slider. */ + zoomOptions?: any; + } + export interface SnappingManagerOptions { + /** When true, snapping is always enabled. */ + alwaysSnap?: boolean; + /** See the object specifications table below for the structure of the layerInfos object. */ + layerInfos?: any[]; + /** Reference to the map. */ + map: Map; + /** When alwaysSnap is set to false use this option to define the key users press to enable snapping. */ + snapKey?: any; + /** Define a symbol for the snapping location. */ + snapPointSymbol?: SimpleMarkerSymbol; + /** Specify the radius of the snapping circle in pixels. */ + tolerance?: number; + } + export interface SpatialIndexOptions { + /** Start processing features immediately. */ + autostart?: boolean; + /** Whether the processor allow the feature layer to draw its features. */ + drawFeatures?: boolean; + /** Whether the processor do the layer's I/O via a worker. */ + fetchWithWorkers?: boolean; + /** Index system specific options. */ + indexOptions?: any; + /** The indexing system to use. */ + indexType?: string; + /** A FeatureLayer or array of FeatureLayers to attach the processor to. */ + layers?: FeatureLayer[]; + /** Uses all FeatureLayers associated with the map in the processor. */ + map?: Map; + /** Whether the processor pass the features through without modification or delay to the FeatureLayer. */ + passFeatures?: boolean; + /** Whether the processor require Workers to function properly. */ + requireWorkerSupport?: boolean; + } + export interface StandardGeographyQueryLocationProviderOptions { + /** A template to be used to build the query for Standard Geography query. */ + geographyQueryTemplate: string; + /** An object that specifies the parameters to use in the Standard Geography query. */ + queryParameters?: any; + /** An instance of the StandardGeographyQuery class. */ + standardGeographyQueryTask: StandardGeographyQueryTask; + } + export interface StreamLayerOptions1 { + /** Class attribute to set for the layer's node. */ + className?: string; + /** Where clause to use as definition expression for layer. */ + definitionExpression?: string; + /** The extent to use as the spatial filter for the layer. */ + geometryDefinition?: Extent; + /** Maximum number of observations to show for each unique track. */ + maximumTrackPoints?: number; + /** An array of strings corresponding with fields to include in the StreamLayer. */ + outFields?: string[]; + /** Rules for purging data from the layer to avoid overloading the browser with too many features. */ + purgeOptions?: any; + } + export interface StreamLayerOptions2 { + /** Class attribute to set for the layer's node. */ + className?: string; + /** The extent to use as the spatial filter for the layer. */ + geometryDefinition?: Extent; + /** Maximum number of observations to show for each unique track. */ + maximumTrackPoints?: number; + /** An array of strings corresponding with fields to include in the StreamLayer. */ + outFields?: string[]; + /** Rules for purging data from the layer to avoid overloading the browser with too many features. */ + purgeOptions?: any; + /** The URL to use for connecting to a socket. */ + socketUrl?: string; + } + export interface SummarizeNearbyOptions { + /** The URL to the GPServer used to execute an analysis job. */ + analysisGpServer?: string; + /** An array of numbers that defines the search distance (for StraightLine or DrivingDistance) or time (for DrivingTime) shown in the distance input in the Find nearest features using a option. */ + distance?: number[]; + /** When true, Travel Modes (Driving Distance, Driving Time) are enabled for sumNearbyLayer with point geometries (esriGeometryPoint). */ + enableTravelModes?: boolean; + /** A field of the summarizeLayer features that you can use to calculate statistics separately for each unique attribute value. */ + groupByField?: string; + /** Reference to the map object. */ + map?: Map; + /** Type of distance measurement shown as the defeault value in the Find nearest features using a option. */ + nearType?: string; + /** The name of the output layer to be shown in the Result layer name inputbox. */ + outputLayerName?: string; + /** The url to the ArcGIS.com site or in-house portal where the GP server is hosted. */ + portalUrl?: string; + /** When true, returns the result of analysis as a client-side feature collection. */ + returnFeatureCollection?: boolean; + /** Type of units shown under the Total Area checkbox in the Add statistics from option. */ + shapeUnits?: string; + /** When true, the choose extent checkbox will be shown. */ + showChooseExtent?: boolean; + /** When true, the show credit option is visible. */ + showCredits?: boolean; + /** When true, the help links will be shown. */ + showHelp?: boolean; + /** When true, the select folder dropdown will be shown. */ + showSelectFolder?: boolean; + /** An array of possible statistics attribute field names and summary types that you wish to calculate for all nearby features. */ + summaryFields?: string[]; + /** The feature layer to be shown selected in the Choose layer to summarize dropdown. */ + summaryLayer?: FeatureLayer; + /** An array of possible feature layers summarizing toward. */ + summaryLayers: FeatureLayer[]; + /** The point, line, or polygon feature layer from which distances will be measured to features in summarizeLayer. */ + sumNearbyLayer: FeatureLayer; + /** If true. */ + sumShape?: boolean; + /** Type of units shown as the defeault value in the Find nearest features using a option. */ + units?: string; + } + export interface SummarizeWithinOptions { + /** The URL to the GPServer used to execute an analysis job. */ + analysisGpServer?: string; + /** A field name from summaryLayer that you can use to calculate statistics separately for each unique attribute value. */ + groupByField?: string; + /** Reference to the map object. */ + map?: Map; + /** The name of the output layer to be shown in the Result layer name inputbox. */ + outputLayerName?: string; + /** The url to the ArcGIS.com site or in-house portal where the GP server is hosted. */ + portalUrl?: string; + /** When true, returns the result of analysis as a client-side feature collection. */ + returnFeatureCollection?: boolean; + /** When true, the choose extent checkbox will be shown. */ + showChooseExtent?: boolean; + /** When true, the show credit option is visible. */ + showCredits?: boolean; + /** When true, the help links will be shown. */ + showHelp?: boolean; + /** When true, the select folder dropdown will be shown. */ + showSelectFolder?: boolean; + /** A list of field names and statistical summary type that you wish to calculate for all features in SummaryLayer that are within each polygon in sumWithinLayer. */ + summaryFields?: string; + /** The summary layer to be shown selected in in the Choose layer to summarize menu. */ + summaryLayer?: FeatureLayer; + /** An array of summarize layer candidates. */ + summaryLayers: FeatureLayer[]; + /** The polygon feature layer to be summarized toward. */ + sumWithinLayer: FeatureLayer; + } + export interface SymbolStylerOptions { + /** Self response of Portal used as symbol provider. */ + portalSelf: string; + /** URL to Portal used as symbol provider. */ + portalUrl: string; + } + export interface TemplatePickerOptions { + /** Number of visible columns. */ + columns?: number; + /** Defines the text to be displayed when the template picker does not have any templates to display. */ + emptyMessage?: string; + /** Array of input feature layers. */ + featureLayers?: FeatureLayer[]; + /** Templates are grouped based on the containing feature layer. */ + grouping?: boolean; + /** An array of items described using the syntax below. */ + items?: any[]; + /** Length of label description. */ + maxLabelLength?: number; + /** Number of visible rows. */ + rows?: number; + /** Tooltip content contains the template name and description. */ + showTooltip?: boolean; + /** HTML style attributes for the widget. */ + style?: string; + /** When true, the template picker displays map service legend swatches for feature layers created in selection mode that have an associated map service added to the map as a dynamic map service layer. */ + useLegend?: boolean; + } + export interface TimeSliderOptions { + /** When true, subtracts one second to the time extent's end time to exclude data at the exact end time instant. */ + excludeDataAtLeadingThumb?: boolean; + /** When true, adds one second to the time extent's start time to exclude data at the exact start time instant. */ + excludeDataAtTrailingThumb?: boolean; + } + export interface UndoManagerOptions { + /** The maximum number of operations the UndoManager can perform. */ + maxOperations?: number; + } + export interface UnionOptions { + /** The feature(s) removed from the feature layer by the union operation. */ + deletedGraphics?: Graphic[]; + /** The feature layer that contains the unioned feature(s). */ + featureLayer?: FeatureLayer; + /** The updated feature(s). */ + postUpdatedGraphics?: Graphic[]; + /** The feature(s) before the union operation is performed. */ + preUpdatedGraphics?: Graphic[]; + } + export interface UpdateOptions { + /** The feature layer that contains the updated feature(s). */ + featureLayer?: FeatureLayer; + /** The updated feature(s). */ + postUpdatedGraphics?: Graphic[]; + /** The feature(s) prior to the update. */ + preUpdatedGraphics?: Graphic[]; + } + export interface VEGeocoderOptions { + /** Key used to access Bing Maps maps. */ + bingMapsKey?: string; + /** Specifies the culture in which to return results. */ + culture?: string; + } + export interface VETiledLayerOptions { + /** Key used to access Bing Maps maps. */ + bingMapsKey?: string; + /** Class attribute to set for the layer's node. */ + className?: string; + /** Specifies the culture in which to return results. */ + culture?: string; + /** Bing Maps style. */ + mapStyle?: string; + /** Refresh interval of the layer in minutes. */ + refreshInterval?: number; + } + export interface VectorFieldRendererOptions { + /** Sets the flow direction of the data. */ + flowRepresentation?: string; + /** A symbol that can be defined if the style is set to STYLE_SINGLE_ARROW. */ + singleArrowSymbol?: Symbol; + /** A predefined style. */ + style?: string; + } + export interface WMSLayerOptions { + /** Specify the map image format, valid options are png,jpg,bmp,gif,svg. */ + format?: string; + /** An optional resourceInfo object. */ + resourceInfo?: any; + /** If the WMS service supports transparency, specify whether the image background is transparent. */ + transparent?: boolean; + /** A version number. */ + version?: string; + /** A list of layer names that represent the layers to include in the exported map. */ + visibleLayers?: string[]; + } + export interface WMTSLayerInfoOptions { + /** The description of the layer defined by the abstract property of the capabilities file or resource info. */ + description?: string; + /** Specify a format supported by the service. */ + format?: string; + /** The full extent of the WMTS layer. */ + fullExtent?: Extent; + /** The layer id. */ + identifier?: string; + /** The initial extent of the WMTS layer. */ + initialExtent?: Extent; + /** Specify the layer style. */ + style?: string; + /** A tile info object. */ + tileInfo?: TileInfo; + /** Define the tileMatrixSet for the layer. */ + tileMatrixSet?: string; + /** The layer title. */ + title?: string; + } + export interface WMTSLayerOptions { + /** A WMTSLayerInfo object that when ResourceInfo options are not specified the map will display the first layer in the WMTS capabilities that matches the properties specified by WMTSLayerInfo. */ + layerInfo?: WMTSLayerInfo; + /** When true, tile resampling is enabled. */ + resampling?: boolean; + /** Number of levels beyond the last level where tiles are available. */ + resamplingTolerance?: number; + /** An optional resource info object. */ + resourceInfo?: any; + /** Specify the service type. */ + serviceMode?: string; + } + export interface WebTiledLayerOptions { + /** Define attribution information for the layer to be used by the Attribution widget. */ + copyright?: string; + /** Specify the full extent of the layer. */ + fullExtent?: Extent; + /** Specify the initial extent of the layer. */ + initialExtent?: Extent; + /** When true, tile resampling is enabled. */ + resampling?: boolean; + /** Number of levels beyond the last level where tiles are available. */ + resamplingTolerance?: number; + /** Specify subDomains where tiles are served to speed up tile retrieval (using subDomains gets around the browser limit of the max number of concurrent requests to a domain). */ + subDomains?: string[]; + /** Define the tile info for the layer including lods, rows, cols, origin and spatial reference. */ + tileInfo?: TileInfo; + /** Define additional tile server domains for the layer. */ + tileServers?: string[]; + } +} + +declare module "esri/Color" { + /** Inherits all attributes from dojo/_base/Color to provide functions for setting colors. */ + class Color { + /** Dictionary list of all CSS named colors, by name. */ + static named: any; + /** The alpha value. */ + a: number; + /** The blue value. */ + b: number; + /** The green value. */ + g: number; + /** The red value. */ + r: number; + /** + * Creates a new Color object. + * @param color A named string, hex string, array of rgb or rgba values, an object with r, g, b, and a properties, or another Color object. + */ + constructor(color?: string); + /** + * Creates a new Color object. + * @param color A named string, hex string, array of rgb or rgba values, an object with r, g, b, and a properties, or another Color object. + */ + constructor(color?: number[]); + /** + * Creates a new Color object. + * @param color A named string, hex string, array of rgb or rgba values, an object with r, g, b, and a properties, or another Color object. + */ + constructor(color?: any); + /** + * Blend colors start and end with weight from 0 to 1, 0.5 being a 50/50 blend. + * @param start The start color. + * @param end The end color. + * @param weight The weight value. + * @param obj A previously allocated Color object to reuse for the result. + */ + static blendColors(start: Color, end: Color, weight: number, obj?: Color): Color; + /** + * Builds a Color from a 3 or 4 element array, mapping each element in sequence to the rgb(a) values of the color. + * @param a The input array. + * @param obj A previously allocated Color object to reuse for the result. + */ + static fromArray(a: number[], obj?: Color): Color; + /** + * Converts a hex string with a '#' prefix to a color object. + * @param color The input color. + * @param obj A previously allocated Color object to reuse for the result. + */ + static fromHex(color: string, obj?: Color): Color; + /** + * Returns a Color instance from a string of the form "rgb()" or "rgba()". + * @param color The input color. + * @param obj A previously allocated Color object to reuse for the result. + */ + static fromRgb(color: string, obj?: Color): Color; + /** + * Parses str for a color value. + * @param str The input value. + * @param obj A previously allocated Color object to reuse for the result. + */ + static fromString(str: string, obj?: Color): Color; + /** + * Takes a named string, hex string, array of rgb or rgba values, an object with r, g, b, and a properties, or another Color object and sets this color instance to that value. + * @param color The new color value. + */ + setColor(color: string): Color; + /** + * Takes a named string, hex string, array of rgb or rgba values, an object with r, g, b, and a properties, or another Color object and sets this color instance to that value. + * @param color The new color value. + */ + setColor(color: number[]): Color; + /** + * Takes a named string, hex string, array of rgb or rgba values, an object with r, g, b, and a properties, or another Color object and sets this color instance to that value. + * @param color The new color value. + */ + setColor(color: any): Color; + /** + * Returns a css color string in rgb(a) representation. + * @param includeAlpha If true, the alpha value will be included in the result. + */ + toCss(includeAlpha?: boolean): string; + /** Returns a CSS color string in hexadecimal representation. */ + toHex(): string; + /** Returns a 3 component array of rgb values. */ + toRgb(): number[]; + /** Returns a 4 component array of rgba values. */ + toRgba(): number[]; + } + export = Color; +} + +declare module "esri/Credential" { + import esri = require("esri"); + + /** The Credential class represents a credential object used to access a secure ArcGIS resource. */ + class Credential { + /** Token expiration time specified as number of milliseconds since 1 January 1970 00:00:00 UTC. */ + expires: number; + /** Indicates whether this credential belongs to a user with admin privileges. */ + isAdmin: boolean; + /** The Identity Manager's setOAuthRedirectionHandler returns an object that contains a "state" parameter. */ + oAuthState: any; + /** The server url. */ + server: string; + /** Indicates whether the resources accessed using this credential should be fetched over HTTPS protocol. */ + ssl: boolean; + /** Token generated by the token service using the specified userId and password. */ + token: string; + /** User associated wth the Credential object. */ + userId: string; + /** Destroy a credential. */ + destroy(): void; + /** Generate a new token and update the Credential's token property with the newly acquired token. */ + refreshToken(): any; + /** Return the properties of this object in JSON. */ + toJson(): any; + /** Fired when a credential object is destroyed. */ + on(type: "destroy", listener: (event: { target: Credential }) => void): esri.Handle; + /** Fired when the token associated with the credential is updated or changed. */ + on(type: "token-change", listener: (event: { target: Credential }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = Credential; +} + +declare module "esri/IdentityManager" { + import esri = require("esri"); + import IdentityManagerBase = require("esri/IdentityManagerBase"); + + /** This module returns a singleton class that is automatically instantiated into esri.id when the module containing this class is imported into the application. */ + class IdentityManager extends IdentityManagerBase { + /** Dialog box widget used to challenge the user for their credentials when the application attempts to access a secure resource. */ + dialog: any; + /** + * When accessing secure resources via Oauth2 from ArcGIS.com or one of its sub-domains the IdentityManager redirects the user to the ArcGIS.com or Portal for ArcGIS sign-in page. + * @param handlerFunction When called, the function passed to setOAuthRedirectionHandler receives an object containing the redirection properties. + */ + setOAuthRedirectionHandler(handlerFunction: Function): void; + /** + * Use this method in the popup callback page to pass the token and other values back to the IdentityManager. + * @param hash The token information in addition to any other values needed to be passed back to the IdentityManager. + */ + setOAuthResponseHash(hash: string): void; + /** This method is called by the base identity manager implementation. */ + signIn(): any; + /** Fired when the user clicks the cancel button on the dialog box widget. */ + on(type: "dialog-cancel", listener: (event: { info: any; target: IdentityManager }) => void): esri.Handle; + /** Fired when the dialog box widget, used to prompt users for their credentials, is created. */ + on(type: "dialog-create", listener: (event: { target: IdentityManager }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = IdentityManager; +} + +declare module "esri/IdentityManagerBase" { + import esri = require("esri"); + import Credential = require("esri/Credential"); + import OAuthInfo = require("esri/arcgis/OAuthInfo"); + import ServerInfo = require("esri/ServerInfo"); + + /** This class provides the framework and helper methods required to implement a solution for managing user credentials. */ + class IdentityManagerBase { + /** The suggested lifetime of the token in minutes. */ + tokenValidity: number; + /** + * Returns the credential (via Deferred) if the user has already signed in to access the given resource. + * @param resUrl The resource URL. + */ + checkSignInStatus(resUrl: string): any; + /** Destroys all credentials. */ + destroyCredentials(): void; + /** + * Returns the credential for the resource identified by the specified url. + * @param url The url to a server. + * @param userId The userId for which you want to obtain credentials. + */ + findCredential(url: string, userId?: string): Credential; + /** + * Returns the OAuth configuration for the passed in Portal server URL. + * @param url The URL to the Portal. + */ + findOAuthInfo(url: string): OAuthInfo; + /** + * Returns information about the server that is hosting the specified url. + * @param url The url to a server. + */ + findServerInfo(url: string): ServerInfo; + /** + * Returns an object containing a token and its expiration time. + * @param serverInfo A ServerInfo object that contains a token service URL. + * @param userInfo A user info object containing a user name and password. + * @param options Optional parameters. + */ + generateToken(serverInfo: ServerInfo, userInfo: any, options?: any): any; + /** + * Returns a Credential object that can be used to access the secured resource identified by the input url. + * @param url The url for the secure resource. + * @param options Optional parameters. + */ + getCredential(url: string, options?: any): any; + /** + * Call this method (during your application initialization) with JSON previously obtained from toJson method to re-hydrate the state of identity manager. + * @param json The JSON obtained from the toJson method. + */ + initialize(json: Object): any; + /** Returns true if the identity manager is busy accepting user input, i.e., the user has invoked signIn and is waiting for a response. */ + isBusy(): boolean; + /** + * Sub-classes must implement this method if OAuth support is required. + * @param resUrl The resource URL. + * @param serverInfo A ServerInfo object that contains the token service url. + * @param OAuthInfo A OAuthInfo object that contains the authorization configuration. + * @param options Optional parameters. + */ + oAuthSignIn(resUrl: string, serverInfo: ServerInfo, OAuthInfo: OAuthInfo, options?: any): any; + /** + * Registers OAuth configurations. + * @param oAuthInfos An OAuthInfos object that defines the OAuth configurations. + */ + registerOAuthInfos(oAuthInfos: OAuthInfo[]): void; + /** + * Register secure servers and the token endpoints. + * @param serverInfos A ServerInfos object that defines the secure service and token endpoint. + */ + registerServers(serverInfos: ServerInfo[]): void; + /** + * Registers the given OAuth2 access token with the identity manager. + * @param properties See the object specifications table below for the structure of the properties object. + */ + registerToken(properties: any): void; + /** + * When accessing secured resources, identity manager may prompt for username and password and send them to the server using a secure connection. + * @param handlerFunction The function to call when the protocol is mismatched. + */ + setProtocolErrorHandler(handlerFunction: Function): void; + /** + * When accessing secure resources from ArcGIS.com or one of its sub-domains the IdentityManager redirects the user to the ArcGIS.com sign-in page. + * @param handlerFunction When called, the function passed to setRedirectionHandler receives an object containing redirection properties. + */ + setRedirectionHandler(handlerFunction: Function): void; + /** + * Sub-classes must implement this method to create and manager the user interface that is used to obtain a username and password from the end-user. + * @param url Url for the secure resource. + * @param serverInfo A ServerInfo object that contains the token service url. + * @param options Optional parameters. + */ + signIn(url: string, serverInfo: ServerInfo, options?: any): any; + /** Return properties of this object in JSON. */ + toJson(): any; + /** Fired when a credential is created. */ + on(type: "credential-create", listener: (event: { target: IdentityManagerBase }) => void): esri.Handle; + /** Fired when all credentials are destroyed. */ + on(type: "credentials-destroy", listener: (event: { target: IdentityManagerBase }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = IdentityManagerBase; +} + +declare module "esri/InfoTemplate" { + /** An InfoTemplate contains a title and content template string used to transform Graphic.attributes into an HTML representation. */ + class InfoTemplate { + /** The template for defining how to format the content used in an InfoWindow. */ + content: any; + /** The template for defining how to format the title used in an InfoWindow. */ + title: any; + /** Creates a new empty InfoTemplate object. */ + constructor(); + /** + * Creates a new InfoTemplate object. + * @param title The template for defining how to format the title used in an InfoWindow. + * @param content The template for defining how to format the content used in an InfoWindow. + */ + constructor(title: string, content: string); + /** + * Creates a new InfoTemplate object using a JSON object. + * @param json JSON object representing the InfoTemplate. + */ + constructor(json: Object); + /** + * Sets the content template. + * @param template The template for the content. + */ + setContent(template: string): InfoTemplate; + /** + * Sets the content template. + * @param template The template for the content. + */ + setContent(template: Function): InfoTemplate; + /** + * Sets the title template. + * @param template The template for the title. + */ + setTitle(template: string): InfoTemplate; + /** + * Sets the title template. + * @param template The template for the title. + */ + setTitle(template: Function): InfoTemplate; + /** Converts object to its ArcGIS Server JSON representation. */ + toJson(): any; + } + export = InfoTemplate; +} + +declare module "esri/InfoWindowBase" { + import esri = require("esri"); + import Map = require("esri/map"); + import Point = require("esri/geometry/Point"); + + /** The base class for the out-of-the-box InfoWindow. */ + class InfoWindowBase { + /** The reference to a DOM node where the info window is constructed. */ + domNode: any; + /** Indicates if the info window is visible. */ + isShowing: boolean; + /** Helper method. */ + destroyDijits(): void; + /** Hide the info window. */ + hide(): void; + /** + * Helper method. + * @param value A string with HTML tags or a DOM node. + * @param parentNode The parent node where the value will be placed. + */ + place(value: string, parentNode: Node): void; + /** + * Helper method. + * @param value A string with HTML tags or a DOM node. + * @param parentNode The parent node where the value will be placed. + */ + place(value: HTMLElement, parentNode: Node): void; + /** + * Resize the info window to the specified width and height (in pixels). + * @param width The new width of the InfoWindow in pixels. + * @param height The new height of the InfoWindow in pixels. + */ + resize(width: number, height: number): void; + /** + * Define the info window content. + * @param content The content argument can be any of the following. + */ + setContent(content: string): void; + /** + * Define the info window content. + * @param content The content argument can be any of the following. + */ + setContent(content: any): void; + /** + * This method is called by the map when the object is set as its info window. + * @param map The map object. + */ + setMap(map: Map): void; + /** + * Set the input value as the title for the info window. + * @param title In most cases the title will be a string value but the same options are available as for the setContent method. + */ + setTitle(title: string): void; + /** + * Set the input value as the title for the info window. + * @param title In most cases the title will be a string value but the same options are available as for the setContent method. + */ + setTitle(title: any): void; + /** + * Display the info window at the specified location. + * @param location Location is an instance of esri.geometry.Point. + */ + show(location: Point): void; + /** Helper method. */ + startupDijits(): void; + /** + * This method is called by the map when the object is no longer the map's info window. + * @param map The map object. + */ + unsetMap(map: Map): void; + /** Fires after the info window is hidden. */ + on(type: "hide", listener: (event: { target: InfoWindowBase }) => void): esri.Handle; + /** Fires after the info window becomes visible. */ + on(type: "show", listener: (event: { target: InfoWindowBase }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = InfoWindowBase; +} + +declare module "esri/OperationBase" { + import esri = require("esri"); + + /** The OperationBase class defines operations that can be added to the UndoManager. */ + class OperationBase { + /** Details about the operation, for example: "Update" may be the label for an edit operation that updates features. */ + label: string; + /** The type of operation, for example: "edit" or "navigation". */ + type: string; + /** + * Creates a new OperationBase object. + * @param params See options list for parameters. + */ + constructor(params: esri.OperationBaseOptions); + /** Re-perform the last undo operation. */ + performRedo(): void; + /** Reverse the operation. */ + performUndo(): void; + } + export = OperationBase; +} + +declare module "esri/ServerInfo" { + /** This class contains information about an ArcGIS Server and its token endpoint. */ + class ServerInfo { + /** The token service URL used to generate tokens for ArcGIS Server Admin resources. */ + adminTokenServiceUrl: string; + /** Version of the ArcGIS Server REST API deployed on this server. */ + currentVersion: number; + /** The server URL. */ + server: string; + /** Validity of short-lived token in minutes. */ + shortLivedTokenValidity: number; + /** The token service URL used to generate tokens for the secured resources on the server. */ + tokenServiceUrl: string; + /** Return the properties of this object in JSON. */ + toJson(): any; + } + export = ServerInfo; +} + +declare module "esri/SnappingManager" { + import esri = require("esri"); + import Point = require("esri/geometry/Point"); + + /** The SnappingManager is used to add snapping capability to the Editor, Measurement Widget, Draw toolbar and Edit toolbar. */ + class SnappingManager { + /** + * Create a new SnappingManager object. + * @param options Optional parameters. + */ + constructor(options?: esri.SnappingManagerOptions); + /** Destroy the SnappingManager object. */ + destroy(): void; + /** + * Returns a deferred object, which can be added to a callback to find the snap point. + * @param screenPoint The input screen point for which to find the snapping location. + */ + getSnappingPoint(screenPoint: Point): any; + /** + * An array of layerInfo objects used to specify the target snapping layers. + * @param layerInfos An array of layerInfo objects that define the snapping target layers. + */ + setLayerInfos(layerInfos: any[]): void; + } + export = SnappingManager; +} + +declare module "esri/SpatialReference" { + /** The spatial reference of a map, layer, or inputs to and outputs from a task. */ + class SpatialReference { + /** The well-known ID of a spatial reference. */ + wkid: number; + /** The well-known text that defines a spatial reference. */ + wkt: string; + /** + * Creates a new SpatialReference object. + * @param json The REST JSON representation of the spatial reference. + */ + constructor(json: Object); + /** + * Create a spatial reference object and initialize it with a well-known ID (wkid). + * @param wkid The well-known id (wkid) of the coordinate system. + */ + constructor(wkid: number); + /** + * Create a spatial reference object and initialize it with the given well-known text (wkt). + * @param wkt The well-known text (wkt) of the coordinate system. + */ + constructor(wkt: string); + /** + * Returns true if the input spatial reference object has the same wkid or wkt as this spatial reference object. + * @param sr The spatial reference to compare. + */ + equals(sr: SpatialReference): boolean; + /** Returns true if the wkid of the spatial reference object is one of the following values: 102113, 102100, 3857. */ + isWebMercator(): boolean; + /** Returns an easily serializable object representation of the spatial reference. */ + toJson(): any; + } + export = SpatialReference; +} + +declare module "esri/TimeExtent" { + /** The time extent is a span of time going from a start time to an end time. */ + class TimeExtent { + /** The end time for the specified time extent. */ + endTime: Date; + /** The start time for the specified time extent. */ + startTime: Date; + /** + * Creates a new TimeExtent object with the specifed start and end time. + * @param startTime The start time for the specified time extent. + * @param endTime The end time for the specified time extent. + */ + constructor(startTime: Date, endTime: Date); + /** + * Returns a new time extent indicating the intersection between "this" and the argument time extent. + * @param timeExtent The input time extent. + */ + intersection(timeExtent: number): TimeExtent; + /** + * Returns a new time extent with the given offset from "this' time extent. + * @param offsetValue The length of time to offset from "this" time extent. + * @param offsetUnits The offset units, see the TimeInfo constants for a list of valid values. + */ + offset(offsetValue: number, offsetUnits: string): TimeExtent; + } + export = TimeExtent; +} + +declare module "esri/arcgis/OAuthInfo" { + import esri = require("esri"); + + /** This class contains information about an OAuth configuration. */ + class OAuthInfo { + /** The registered application Id. */ + appId: string; + /** Applications with the same value will share the stored token on the same host. */ + authNamespace: string; + /** The number of minutes the token that the token is valid. */ + expiration: number; + /** The locale for the OAuth sign in page. */ + locale: string; + /** The minimum time in minutes before a saved token is due to expire that it should still be considered valid for use. */ + minTimeUntilExpiration: number; + /** Set to true to show the OAuth sign in page in a popup window. */ + popup: boolean; + /** The relative page URL for the user to be sent to from the OAuth sign in page. */ + popupCallbackUrl: string; + /** The window features passed to window.open(). */ + popupWindowFeatures: string; + /** The ArcGIS for Portal URL. */ + portalUrl: string; + /** + * Creates a new OAuthInfo given the specified parameters. + * @param params Various options to configure the OAuthInfo object. + */ + constructor(params: esri.OAuthInfoOptions); + /** Returns an easily serializable object representation of the OAuthInfo. */ + toJson(): any; + } + export = OAuthInfo; +} + +declare module "esri/arcgis/Portal" { + import esri = require("esri"); + + /** The Portal class is part of the ArcGIS Portal API which provides a way to build applications that work with content from ArcGIS Online or an ArcGIS Portal. */ + export class Portal { + /** The access level of the organization. */ + access: string; + /** When true, access to the organization's Portal resources must occur over SSL. */ + allSSL: boolean; + /** The query that defines the basemaps that are displayed in the Basemap Gallery. */ + basemapGalleryGroupQuery: string; + /** The Bing key to use for web maps using Bing Maps. */ + bingKey: string; + /** Whether an organization can list applications in the marketplace . */ + canListApps: boolean; + /** Whether an organization can list data services in the marketplace. */ + canListData: boolean; + /** Whether an organization can list pre-provisioned items in the marketplace. */ + canListPreProvisionedItems: boolean; + /** Whether an organization can provision direct purchases in the marketplace without customer request. */ + canProvisionDirectPurchase: boolean; + /** When true, the organization's public items, groups and users are included in search queries. */ + canSearchPublic: boolean; + /** The Bing key can be shared to the public and is returned as part of a portal's description call (/sharing/rest/portals/). */ + canShareBingPublic: boolean; + /** When true, members of the organization can share resources outside the organization. */ + canSharePublic: boolean; + /** Whether to allow an organization with an enterprise IDP configured to be able to turn on or off the ArcGIS sign in. */ + canSignInArcGIS: boolean; + /** Whether to allow an organization with an enterprise IDP configured to be able to turn on or off the enterprise sign in. */ + canSignInIDP: boolean; + /** The query that identifies the group containing the color sets used for rendering in the map viewer. */ + colorSetsGroupQuery: string; + /** Whether to allow the organization to disable commenting. */ + commentsEnabled: boolean; + /** Date the organization was created. */ + created: Date; + /** The default locale (language and country) information. */ + culture: string; + /** The custom base URL for the portal. */ + customBaseUrl: string; + /** The default basemap the portal displays in the map viewer. */ + defaultBasemap: any; + /** The default extent for the map the portal displays in the map viewer. */ + defaultExtent: any; + /** A description of the organization / portal. */ + description: string; + /** The featured groups for the portal. */ + featuredGroups: any[]; + /** The featured groups for the organization. */ + featuredGroupsId: string; + /** The query that defines the featured group. */ + featuredItemsGroupQuery: string; + /** The query that identifies the group containing features items for the gallery. */ + galleryTemplatesGroupQuery: string; + /** The group that contains featured content to be displayed on the home page. */ + homePageFeaturedContent: string; + /** The number of featured items that can be displayed on the home page. */ + homePageFeaturedContentCount: number; + /** The port used by the portal for HTTP communication. */ + httpPort: number; + /** The port used by the portal for HTTPS communication. */ + httpsPort: number; + /** The id of the organization that owns this portal. */ + id: string; + /** The country code of the calling IP (ArcGIS Online only). */ + ipCntryCode: string; + /** Indicates if the portal is an organization. */ + isOrganization: boolean; + /** Indicates if the portal is on premises. */ + isPortal: boolean; + /** The query that defines the collection of editable layer templates. */ + layerTemplatesGroupQuery: string; + /** The maximum validity in minutes of tokens issued for users of the organization. */ + maxTokenExpirationMinutes: number; + /** Date the organization was last modified. */ + modified: Date; + /** The Name of the organization / portal. */ + name: string; + /** The portal host's URL. */ + portalHostname: string; + /** Denotes multitenant or singletenant. */ + portalMode: string; + /** The name of the portal, i.e., ArcGIS Online. */ + portalName: string; + /** Stores properties specific to the organization, for example the "contact us" link. */ + portalProperties: any; + /** The URL to the thumbnail of the portal. */ + portalThumbnail: string; + /** URL to the portal. */ + portalUrl: string; + /** The region for the organization. */ + region: string; + /** Custom HTML for the home page. */ + rotatorPanels: string[]; + /** Whether the description of your organization displays on the home page. */ + showHomePageDescription: boolean; + /** Whether hosted services are supported. */ + supportsHostedServices: boolean; + /** Whether OAuth is supported. */ + supportsOAuth: boolean; + /** The query that defines the symbols sets used by the map viewer. */ + symbolSetsGroupQuery: string; + /** The query that defines the collection of templates that will appear in the template gallery. */ + templatesGroupQuery: string; + /** The URL to the thumbnail of the organization. */ + thumbnail: string; + /** The url to the thumbnail of the organization (full path). */ + thumbnailUrl: string; + /** Sets the units of measure for the organization's users. */ + units: string; + /** The portal url. */ + url: string; + /** The prefix selected by the organization's administrator to be used with the customBaseURL. */ + urlKey: string; + /** User information for the accessing user is returned only when a token is passed in. */ + user: any; + /** If true, only simple where clauses that are complaint with SQL92 can be used when querying layers and tables. */ + useStandardizedQuery: boolean; + /** + * Creates a new Portal object. + * @param url URL to the ArcGIS.com site or in-house portal. + */ + constructor(url: string); + /** Returns a PortalUser object that describes the user currently signed in to the portal. */ + getPortalUser(): PortalUser; + /** + * Execute a query against the Portal to return a deferred that when resolved returns PortalQueryResult that contain a results array of PortalGroup objects for all the groups that match the input query. + * @param queryParams The input query parameters. + */ + queryGroups(queryParams?: any): any; + /** + * Execute a query against the Portal to return a deferred that when resolved returns PortalQueryResult that contain a results array of PortalItem objects that match the input query. + * @param queryParams The input query parameters. + */ + queryItems(queryParams?: any): any; + /** + * Execute a query against the Portal to return a deferred that when resolved returns PortalQueryResult that contain a results array of PortalUser objects that match the input query. + * @param queryParams The input query parameters. + */ + queryUsers(queryParams?: any): any; + /** Prompts the user using the IdentityManager and returns a deferred that, when resolved, returns the PortalUser for the input credentials. */ + signIn(): any; + /** Sign out of the Portal which resets the Portal and disables identity checking. */ + signOut(): Portal; + /** Fires when the signIn() call fails or if the Portal is not able to load. */ + on(type: "error", listener: (event: { error: Error; target: Portal }) => void): esri.Handle; + /** Fired when the portal has loaded. */ + on(type: "load", listener: (event: { target: Portal }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + /** Details about a comment on a Portal item.View the ArcGIS Portal API REST documentation for the item comment for more details. */ + export class PortalComment { + /** The comment text. */ + comment: string; + /** The date and time the comment was created. */ + created: string; + /** The comment id. */ + id: string; + /** The user name of the user who created the comment. */ + owner: string; + } + /** The PortalFolder class provides information about folders used to organize content in a portal. */ + export class PortalFolder { + /** The date the folder was created. */ + created: Date; + /** The id of the folder. */ + id: string; + /** The portal for the folder. */ + portal: Portal; + /** The title of the folder. */ + title: string; + /** The url to to the folder. */ + url: string; + /** Find all the items in the folder. */ + getItems(): any; + } + /** The group resource represents a group within the Portal. */ + export class PortalGroup { + /** The access privileges on the group which determines who can see and access the group. */ + access: string; + /** The date the group was created. */ + created: Date; + /** A detailed description of the group. */ + description: string; + /** The id for the group. */ + id: string; + /** If this is set to true, then users will not be able to apply to join the group. */ + isInvitationOnly: boolean; + /** Denotes a view only group where members are not able to share items. */ + isViewOnly: boolean; + /** The date the group was last modified. */ + modified: Date; + /** The username of the group's owner. */ + owner: Portal; + /** The portal for the group. */ + portal: Portal; + /** A short summary that describes the group. */ + snippet: string; + /** User defined tags that describe the group. */ + tags: string[]; + /** The url to the thumbnail used for the group. */ + thumbnailUrl: string; + /** The title for the group. */ + title: string; + /** The url to the group. */ + url: string; + /** Get the current members for the group. */ + getMembers(): any; + /** + * Execute a query against the group to return a deferred that when resolved returns PortalQueryResult that contain a results array of PortalItem objects that match the input query. + * @param queryParams The input query parameters. + */ + queryItems(queryParams?: any): any; + } + /** An item (a unit of content) in the Portal. */ + export class PortalItem { + /** Indicates the level of access: private, shared, org, or public. */ + access: string; + /** Information on the source of the item. */ + accessInformation: string; + /** Average rating. */ + avgRating: number; + /** The date the item was created. */ + created: Date; + /** The item locale information (language and country). */ + culture: string; + /** The detailed description of the item. */ + description: string; + /** The bounding rectangle of the item. */ + extent: any; + /** The unique id for this item. */ + id: string; + /** The url to the data resource associated with the item. */ + itemDataUrl: string; + /** The url to the item. */ + itemUrl: string; + /** Any license information or restrictions. */ + licenseInfo: string; + /** Date the item was last modified. */ + modified: Date; + /** The name of the item. */ + name: string; + /** Number of comments on the item. */ + numComments: number; + /** Number of ratings on the item. */ + numRatings: number; + /** Number of views on the item. */ + numViews: number; + /** The username of the user who owns this item. */ + owner: string; + /** The portal that contains the item. */ + portal: Portal; + /** The size of the item. */ + size: number; + /** A summary description of the item. */ + snippet: string; + /** The item's coordinate system. */ + spatialReference: string; + /** User defined tags that describe the item. */ + tags: string[]; + /** The url to the thumbnail used for the item. */ + thumbnailUrl: string; + /** The title for the item. */ + title: string; + /** The gis content type of this item. */ + type: string; + /** A set of keywords that further describes the type of this item. */ + typeKeywords: string[]; + /** The url for the resource represented by the item. */ + url: string; + /** The url to the user item. */ + userItemUrl: string; + /** + * Add a comment to the item. + * @param comment The text for the comment. + */ + addComment(comment: string): any; + /** + * Add a rating to an item that you have access to. + * @param rating Rating to set for the item. + */ + addRating(rating: number): any; + /** + * Deletes an item comment. + * @param comment The PortalComment to delete. + */ + deleteComment(comment: PortalComment): any; + /** + * Delete a rating that you created for the specified item. + * @param rating Rating to delete. + */ + deleteRating(rating: PortalRating): any; + /** Get the comments associated with the item. */ + getComments(): any; + /** Returns the rating (if any) given to the item. */ + getRating(): any; + /** + * Updates an item comment. + * @param comment A PortalComment that contains the comment updates. + */ + updateComment(comment: PortalComment): any; + } + /** Details about the result of a query. */ + export class PortalQueryResult { + /** The query parameters for the next set of results. */ + nextQueryParams: any; + /** The query parameters for the first set of results. */ + queryParams: any; + /** An array of result item objects. */ + results: any[]; + /** The total number of results. */ + total: number; + } + /** Details about the rating associated with a Portal item. */ + export class PortalRating { + /** Date the rating was added to the item. */ + created: Date; + /** A rating between 1.0 and 5.0 for the item. */ + rating: number; + } + /** Represents a registered user of the Portal. */ + export class PortalUser { + /** The access level for the user: private, org or public. */ + access: string; + /** The date the user was created. */ + created: Date; + /** The default culture for the user. */ + culture: string; + /** Description of the user. */ + description: string; + /** The user's email address. */ + email: string; + /** The user's full name. */ + fullName: string; + /** The date the user was modified. */ + modified: Date; + /** The id of the organization the user belongs to. */ + orgId: string; + /** The portal. */ + portal: Portal; + /** The user's preferred view for content, either Web or GIS. */ + preferredView: string; + /** The user's preferred region, used to set the featured maps on the portal home page, content in the gallery and the default extent for new maps in the Viewer. */ + region: string; + /** The user's role in the organization: administrator (org_admin), publisher (org_publisher), or user (org_user). */ + role: string; + /** User-defined tags that describe the user. */ + tags: string[]; + /** The url to the thumbnail image for the user. */ + thumbnailUrl: string; + /** The url for the user content. */ + userContentUrl: string; + /** The username for the user. */ + username: string; + /** Find folders for the portal user. */ + getFolders(): any; + /** Provides access to the group invitations for the portal user. */ + getGroupInvitations(): any; + /** Find all the groups that the portal user has permissions to access. */ + getGroups(): any; + /** + * Get the portal item along with folder info for the input item id. + * @param itemId The id of the item. + */ + getItem(itemId: string): any; + /** + * Retrieve all the items in the specified folder. + * @param folderId The id of the folder that contains the items to retrieve. + */ + getItems(folderId: string): any; + /** Get information about any notifications for the portal user. */ + getNotifications(): any; + /** Access the tag objects that have been created by the portal user. */ + getTags(): any; + } +} + +declare module "esri/arcgis/utils" { + import Layer = require("esri/layers/layer"); + + /** Utility methods to work with content from ArcGIS.com. */ + var utils: { + /** Specify the domain where the map associated with the webmap id is located. */ + arcgisUrl: string; + /** + * Create a map using information from an ArcGIS.com item. + * @param itemIdOrItemInfo An itemId for an ArcGIS.com item or the response object obtained from calling the arcgisUtils.getItem method. + * @param mapDiv Container ID for referencing map. + * @param options Optional parameters that define the map functionality. + */ + createMap(itemIdOrItemInfo: string, mapDiv: string, options?: any): any; + /** + * Create a map using information from an ArcGIS.com item. + * @param itemIdOrItemInfo An itemId for an ArcGIS.com item or the response object obtained from calling the arcgisUtils.getItem method. + * @param mapDiv Container ID for referencing map. + * @param options Optional parameters that define the map functionality. + */ + createMap(itemIdOrItemInfo: any, mapDiv: string, options?: any): any; + /** + * Get details about the input ArcGIS.com item. + * @param itemId The itemId for a publicly shared ArcGIS.com item. + */ + getItem(itemId: string): any; + /** + * Can be used with esri.dijit.Legend to get the layerInfos list to be passed into the Legend constructor. + * @param createMapResponse Object returned by .createMap() in the .then() callback. + */ + getLegendLayers(createMapResponse: any): Layer[]; + }; + export = utils; +} + +declare module "esri/basemaps" { + /** Contains properties referencing default basemaps used in the JS API. */ + var basemaps: { + /** The Light Gray Canvas basemap is designed to be used as a neutral background map for overlaying and emphasizing other map layers. */ + gray: any; + /** The World Imagery map is a detailed imagery map layer and labels that is designed to be used as a basemap for various maps and applications. */ + hybrid: any; + /** The Ocean Basemap is designed to be used as a basemap by marine GIS professionals and as a reference map by anyone interested in ocean data. */ + oceans: any; + /** The OpenStreetMap is a community map layer that is designed to be used as a basemap for various maps and applications. */ + osm: any; + /** The World Imagery map is a detailed imagery map layer that is designed to be used as a basemap for various maps and applications. */ + satellite: any; + /** The Streets basemap presents a multiscale street map for the world. */ + streets: any; + /** The Terrain with Labels basemap is designed to be used to overlay and emphasize other thematic map layers. */ + terrain: any; + /** The Topographic map includes boundaries, cities, water features, physiographic features, parks, landmarks, transportation, and buildings. */ + topo: any; + }; + export = basemaps; +} + +declare module "esri/config" { + /** The default values for all JS API configuration options. */ + var config: { + /** ArcGIS JavaScript API default configurations that can be overridden programmatically. */ + defaults: any; + }; + export = config; +} + +declare module "esri/dijit/AttributeInspector" { + import esri = require("esri"); + import Graphic = require("esri/graphic"); + + /** The AttributeInspector displays the attributes of selected features from one or more feature layers. */ + class AttributeInspector { + /** Field displayed as a rich text field. */ + static STRING_FIELD_OPTION_RICHTEXT: any; + /** Field displayed as a text area. */ + static STRING_FIELD_OPTION_TEXTAREA: any; + /** Field displays as a text box. */ + static STRING_FIELD_OPTION_TEXTBOX: any; + /** + * Creates a new Attribute Inspector object. + * @param params See options list. + * @param srcNodeRef HTML element where the attribute inspector should be rendered. + */ + constructor(params: esri.AttributeInspectorOptions, srcNodeRef: Node); + /** + * Creates a new Attribute Inspector object. + * @param params See options list. + * @param srcNodeRef HTML element where the attribute inspector should be rendered. + */ + constructor(params: esri.AttributeInspectorOptions, srcNodeRef: string); + /** Destroys the widget, used for page clean up. */ + destroy(): void; + /** Moves to the first feature. */ + first(): void; + /** Moves to the last feature. */ + last(): void; + /** Move to the next feature. */ + next(): void; + /** Move to the previous feature. */ + previous(): void; + /** Updates the contents of the AttributeInspector. */ + refresh(): void; + /** Finalizes the creation of the widget. */ + startup(): void; + /** Fires when a fields value changes. */ + on(type: "attribute-change", listener: (event: { feature: Graphic; fieldName: string; fieldValue: string; target: AttributeInspector }) => void): esri.Handle; + /** Fires when the AttributeInspector's delete button is pressed. */ + on(type: "delete", listener: (event: { feature: Graphic; target: AttributeInspector }) => void): esri.Handle; + /** Fires when the AttributeInspector's next or back button is pressed. */ + on(type: "next", listener: (event: { feature: Graphic; target: AttributeInspector }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = AttributeInspector; +} + +declare module "esri/dijit/Attribution" { + import esri = require("esri"); + import Map = require("esri/map"); + + /** Displays attribution text for the layers in a map. */ + class Attribution { + /** String used as the delimiter between attribution items. */ + itemDelimiter: string; + /** Object containing elements where each element contains attribution text for a layer in the map. */ + itemNodes: any; + /** Reference to the span element that contains all the attribution items. */ + listNode: HTMLSpanElement; + /** Reference to the map object for which the widget is displaying attribution. */ + map: Map; + /** + * Creates a new Attribution object. + * @param options An object that defines the attribution options. + * @param srcNodeRef HTML element where the time slider should be rendered. + */ + constructor(options: esri.AttributionOptions, srcNodeRef: Node); + /** + * Creates a new Attribution object. + * @param options An object that defines the attribution options. + * @param srcNodeRef HTML element where the time slider should be rendered. + */ + constructor(options: esri.AttributionOptions, srcNodeRef: string); + /** Destroy the attribution widget. */ + destroy(): void; + /** Finalizes the creation of the widget. */ + startup(): void; + } + export = Attribution; +} + +declare module "esri/dijit/Basemap" { + import esri = require("esri"); + import BasemapLayer = require("esri/dijit/BasemapLayer"); + + /** Define a basemap to display in the BasemapGallery dijit. */ + class Basemap { + /** The basemap's id. */ + id: string; + /** The URL to the thumbnail image for the basemap. */ + thumbnailUrl: string; + /** The title for the basemap. */ + title: string; + /** + * Creates a new Basemap Object. + * @param params Set of parameters used to create a basemap. + */ + constructor(params: esri.BasemapOptions); + /** The list of layers contained in the basemap or a dojo.Deferred if a call to ArcGIS.com needs to be made to retrieve the list of ArcGIS.com basemaps. */ + getLayers(): BasemapLayer[]; + /** Finalizes the creation of the widget. */ + startup(): void; + } + export = Basemap; +} + +declare module "esri/dijit/BasemapGallery" { + import esri = require("esri"); + import Basemap = require("esri/dijit/Basemap"); + + /** The BasemapGallery dijit displays a collection basemaps from ArcGIS.com or a user-defined set of map or image services. */ + class BasemapGallery { + /** List of basemaps displayed in the BasemapGallery. */ + basemaps: Basemap[]; + /** This value is true after the BasemapGallery retrieves the ArcGIS.com basemaps. */ + loaded: boolean; + /** Optional parameter to pass in a portal URL, including the instance name, used to access the group containing the basemap gallery items. */ + portalUrl: string; + /** + * Creates a new BasemapGallery dijit. + * @param params Parameters used to configure the widget. + * @param srcNodeRef Reference or id of the HTML element where the widget should be rendered. + */ + constructor(params: esri.BasemapGalleryOptions, srcNodeRef?: Node); + /** + * Creates a new BasemapGallery dijit. + * @param params Parameters used to configure the widget. + * @param srcNodeRef Reference or id of the HTML element where the widget should be rendered. + */ + constructor(params: esri.BasemapGalleryOptions, srcNodeRef?: string); + /** + * Add a new basemap to the BasemapGallery's list of basemaps. + * @param basemap The basemap to add to the map. + */ + add(basemap: Basemap): boolean; + /** Destroys the basemap gallery. */ + destroy(): void; + /** + * Return the basemap with the specified id. + * @param id The basemap id. + */ + get(id: string): Basemap; + /** Gets the currently selected basemap. */ + getSelected(): Basemap; + /** + * Remove a basemap from the BasemapGallery's list of basemaps. + * @param id The basemap id. + */ + remove(id: string): Basemap; + /** + * Select a new basemap for the map. + * @param id The basemap id. + */ + select(id: string): Basemap; + /** Finalizes the creation of the basemap gallery. */ + startup(): void; + /** Fires when a basemap is added to the BasemapGallery's list of basemaps. */ + on(type: "add", listener: (event: { basemap: Basemap; target: BasemapGallery }) => void): esri.Handle; + /** Fires when an error occurs while switching basemaps. */ + on(type: "error", listener: (event: { target: BasemapGallery }) => void): esri.Handle; + /** Fires when the BasemapGallery retrieves the ArcGIS.com basemaps. */ + on(type: "load", listener: (event: { target: BasemapGallery }) => void): esri.Handle; + /** Fires when a basemap is removed from the BasemapGallery's list of basemaps. */ + on(type: "remove", listener: (event: { basemap: Basemap; target: BasemapGallery }) => void): esri.Handle; + /** Fires after the map is updated with a new basemap. */ + on(type: "selection-change", listener: (event: { target: BasemapGallery }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = BasemapGallery; +} + +declare module "esri/dijit/BasemapLayer" { + import esri = require("esri"); + import Extent = require("esri/geometry/Extent"); + import TileInfo = require("esri/layers/TileInfo"); + + /** Defines a layer that will be added to a basemap and displayed in the BasemapGallery dijit. */ + class BasemapLayer { + /** The attribution information for the layer. */ + copyright: string; + /** The full extent of the layer. */ + fullExtent: Extent; + /** The initial extent of the layer. */ + initialExtent: Extent; + /** The subDomains where tiles are served to speed up tile retrieval (using subDomains gets around the browser limit of the max number of concurrent requests to a domain). */ + subDomains: string[]; + /** The tile info for the layer including lods, rows, cols, origin and spatial reference. */ + tileInfo: TileInfo; + /** Additional tile server domains for the layer. */ + tileServer: string[]; + /** The type of layer. */ + type: string; + /** + * Creates a new BasemapLayer object. + * @param params Set of parameters used to create a basemap layer. + */ + constructor(params: esri.BasemapLayerOptions); + } + export = BasemapLayer; +} + +declare module "esri/dijit/BasemapToggle" { + import esri = require("esri"); + import Map = require("esri/map"); + + /** BasemapToggle provides a simple button to toggle between two basemaps. */ + class BasemapToggle { + /** The secondary basemap to toggle to. */ + basemap: string; + /** Object containing the labels and URLs for the image of each basemap. */ + basemaps: any; + /** Whether the widget has been loaded. */ + loaded: boolean; + /** Map object that this dijit is associated with. */ + map: Map; + /** Class used for styling the widget. */ + theme: string; + /** Whether the widget is visible by default. */ + visible: boolean; + /** + * Creates a new BasemapToggle dijit using the given DOM node. + * @param params Various parameters to configure this dijit. + * @param srcNodeRef Reference or id of a HTML element that this dijit is rendered into. + */ + constructor(params: esri.BasemapToggleOptions, srcNodeRef: Node); + /** + * Creates a new BasemapToggle dijit using the given DOM node. + * @param params Various parameters to configure this dijit. + * @param srcNodeRef Reference or id of a HTML element that this dijit is rendered into. + */ + constructor(params: esri.BasemapToggleOptions, srcNodeRef: string); + /** Destroys the widget. */ + destroy(): void; + /** Hides the widget. */ + hide(): void; + /** Shows the widget. */ + show(): void; + /** Finalizes the creation of this dijit. */ + startup(): void; + /** Toggles to the next basemap. */ + toggle(): void; + /** Fires when the widget has been loaded. */ + on(type: "load", listener: (event: { target: BasemapToggle }) => void): esri.Handle; + /** Fires when the toggle method has been called. */ + on(type: "toggle", listener: (event: { currentBasemap: string; error: any; previousBasemap: string; target: BasemapToggle }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = BasemapToggle; +} + +declare module "esri/dijit/BookmarkItem" { + import Extent = require("esri/geometry/Extent"); + + /** Defines a bookmark for use in the Bookmark widget. */ + class BookmarkItem { + /** + * Creates a new BookmarkItem. + * @param name The name for the bookmark item. + * @param extent The extent for the specified bookmark item. + */ + constructor(name: string, extent: Extent); + } + export = BookmarkItem; +} + +declare module "esri/dijit/Bookmarks" { + import esri = require("esri"); + import BookmarkItem = require("esri/dijit/BookmarkItem"); + + /** The Bookmarks widget is a ready to use tool for bookmarking the current map extent. */ + class Bookmarks { + /** An array of BookmarkItem objects. */ + bookmarks: BookmarkItem[]; + /** + * Creates a new Bookmark widget + * @param params See options list for parameters. + * @param srcNodeRef HTML element where the bookmark widget should be rendered. + */ + constructor(params: esri.BookmarksOptions, srcNodeRef: Node); + /** + * Creates a new Bookmark widget + * @param params See options list for parameters. + * @param srcNodeRef HTML element where the bookmark widget should be rendered. + */ + constructor(params: esri.BookmarksOptions, srcNodeRef: string); + /** + * Add a new bookmark to the bookmark widget. + * @param bookmarkItem A BookmarkItem or json object with the same structure that defines the new location. + */ + addBookmark(bookmarkItem: BookmarkItem): void; + /** Destroy the bookmark widget. */ + destroy(): void; + /** Hides the Bookmark widget. */ + hide(): void; + /** + * Remove a bookmark from the bookmark widget. + * @param bookmarkName The name of the bookmark to remove from the bookmark widget. + */ + removeBookmark(bookmarkName: string): void; + /** Show the Bookmark widget. */ + show(): void; + /** Finalizes the creation of the widget. */ + startup(): void; + /** Returns an array of json objects with the following structure: [{ name:bookmarkName, extent:bookmarkExtent }] */ + toJson(): any; + /** Fired when a bookmark item is clicked. */ + on(type: "click", listener: (event: { target: Bookmarks }) => void): esri.Handle; + /** Fired after the bookmark item is edited. */ + on(type: "edit", listener: (event: { target: Bookmarks }) => void): esri.Handle; + /** Fired when a bookmark item is removed. */ + on(type: "remove", listener: (event: { target: Bookmarks }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = Bookmarks; +} + +declare module "esri/dijit/ClassedColorSlider" { + import esri = require("esri"); + import RendererSlider = require("esri/dijit/RendererSlider"); + + /** A widget to assist with managing a renderer used for visualizing features by their class and color. */ + class ClassedColorSlider extends RendererSlider { + /** Required */ + breakInfos: any; + /** Optional */ + classificationMethod: string; + /** Required: Handles identified by their index values within the stops array. */ + handles: number[]; + /** Optional: Property representing histogram data object. */ + histogram: any; + /** Optional */ + histogramWidth: boolean; + /** Optional */ + maxValue: number; + /** Optional */ + minValue: number; + /** Optional */ + normalizationType: string; + /** Optional: Handle identified by its index value within the stops array. */ + primaryHandle: number; + /** Optional */ + rampWidth: number; + /** Property for showing handles. */ + showHandles: boolean; + /** Optional: Property for displaying the histogram. */ + showHistogram: boolean; + /** Property for showing labels. */ + showLabels: boolean; + /** Property for showing ticks. */ + showTicks: boolean; + /** Property for displaying the transparent background. */ + showTransparentBackground: boolean; + /** Optional: Property representing statistics data object. */ + statistics: any; + /** + * Creates a new ClassedColorSlider widget. + * @param params Set of parameters used to specify the ClassedColorSlider widget options. + * @param srcNodeRef Reference or ID of the HTMLElement where the widget should be rendered. + */ + constructor(params: esri.ClassedColorSliderOptions, srcNodeRef: Node); + /** + * Creates a new ClassedColorSlider widget. + * @param params Set of parameters used to specify the ClassedColorSlider widget options. + * @param srcNodeRef Reference or ID of the HTMLElement where the widget should be rendered. + */ + constructor(params: esri.ClassedColorSliderOptions, srcNodeRef: string); + /** Finalizes the creation of the widget. */ + startup(): void; + /** Fires when the ClassedColorSlider widget properties change. */ + on(type: "change", listener: (event: { breakInfos: any; target: ClassedColorSlider }) => void): esri.Handle; + /** Fires when minValue or maxValue of ClassedColorSlider changes. */ + on(type: "data-value-change", listener: (event: { breakInfos: any; maxValue: number; minValue: number; target: ClassedColorSlider }) => void): esri.Handle; + /** Fires when a ClassedColorSlider handle is moved. */ + on(type: "handle-value-change", listener: (event: { breakInfos: any; target: ClassedColorSlider }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = ClassedColorSlider; +} + +declare module "esri/dijit/ClassedSizeSlider" { + import esri = require("esri"); + import RendererSlider = require("esri/dijit/RendererSlider"); + + /** A widget to assist with managing a renderer for visualizing features by varying classes and size. */ + class ClassedSizeSlider extends RendererSlider { + /** Required. */ + breakInfos: any; + /** Optional. */ + classificationMethod: string; + /** Required. */ + handles: number[]; + /** Optional. */ + histogram: any; + /** Optional. */ + histogramWidth: boolean; + /** Optional. */ + maxValue: number; + /** Optional. */ + minValue: number; + /** Optional. */ + normalizationType: string; + /** Optional. */ + primaryHandle: number; + /** Optional */ + rampWidth: number; + /** Property for showing handles. */ + showHandles: boolean; + /** Optional. */ + showHistogram: boolean; + /** Property for showing labels. */ + showLabels: boolean; + /** Property for showing ticks. */ + showTicks: boolean; + /** Optional. */ + statistics: any; + /** + * Creates a new ClassedSizeSlider widget within the provided DOM node srcNodeRef. + * @param params Set of parameters used to specify the ClassedSizeSlider widget options. + * @param srcNodeRef Reference or ID of the HTMLElement where the widget should be rendered. + */ + constructor(params: esri.ClassedSizeSliderOptions, srcNodeRef: Node); + /** + * Creates a new ClassedSizeSlider widget within the provided DOM node srcNodeRef. + * @param params Set of parameters used to specify the ClassedSizeSlider widget options. + * @param srcNodeRef Reference or ID of the HTMLElement where the widget should be rendered. + */ + constructor(params: esri.ClassedSizeSliderOptions, srcNodeRef: string); + /** Fires when ClassedSizeSlider changes. */ + on(type: "change", listener: (event: { breakInfos: any; target: ClassedSizeSlider }) => void): esri.Handle; + /** Fires when minValue or maxValue changes in ClassedSizeSlider. */ + on(type: "data-value-change", listener: (event: { breakInfos: any; maxValue: number; minValue: number; target: ClassedSizeSlider }) => void): esri.Handle; + /** Fires when a ClassedSizeSlider handle is moved. */ + on(type: "handle-value-change", listener: (event: { breakInfos: any; target: ClassedSizeSlider }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = ClassedSizeSlider; +} + +declare module "esri/dijit/ColorInfoSlider" { + import esri = require("esri"); + import RendererSlider = require("esri/dijit/RendererSlider"); + + /** A widget to assist with managing a renderer for visualizing features based upon colors. */ + class ColorInfoSlider extends RendererSlider { + /** Optional */ + classificationMethod: string; + /** Required: Example colorInfo: colorRenderer.renderer.visualVariables[0]. */ + colorInfo: any; + /** Required: Handles identified by their index values within the stops array. */ + handles: number[]; + /** Optional: Property representing histogram data object. */ + histogram: any; + /** Optional */ + histogramWidth: boolean; + /** Optional */ + maxValue: number; + /** Optional */ + minValue: number; + /** Optional */ + normalizationType: string; + /** Optional: Handle identified by its index value within the stops array. */ + primaryHandle: number; + /** Optional */ + rampWidth: number; + /** Property for showing handles. */ + showHandles: boolean; + /** Optional: Property for displaying the histogram. */ + showHistogram: boolean; + /** Property for showing labels. */ + showLabels: boolean; + /** Property for showing ticks. */ + showTicks: boolean; + /** Property for displaying the transparent background. */ + showTransparentBackground: boolean; + /** Optional: Property representing statistics data object. */ + statistics: any; + /** Optional */ + zoomOptions: any; + /** + * Creates a new ColorInfoSlider widget within the provided DOM node srcNodeRef. + * @param params Set of parameters used to specify the ColorInfoSlider widget options. + * @param srcNodeRef Reference or ID of the HTMLElement where the widget should be rendered. + */ + constructor(params: esri.ColorInfoSliderOptions, srcNodeRef: Node); + /** + * Creates a new ColorInfoSlider widget within the provided DOM node srcNodeRef. + * @param params Set of parameters used to specify the ColorInfoSlider widget options. + * @param srcNodeRef Reference or ID of the HTMLElement where the widget should be rendered. + */ + constructor(params: esri.ColorInfoSliderOptions, srcNodeRef: string); + /** Finalizes the creation of the widget. */ + startup(): void; + /** Fires when ColorInfoSlider changes. */ + on(type: "change", listener: (event: { colorInfo: any; target: ColorInfoSlider }) => void): esri.Handle; + /** Fires when minValue or maxValue of ColorInfoSlider changes. */ + on(type: "data-value-change", listener: (event: { colorInfo: any; maxValue: number; minValue: number; target: ColorInfoSlider }) => void): esri.Handle; + /** Fires when a ColorInfoSlider handle is moved. */ + on(type: "handle-value-change", listener: (event: { target: ColorInfoSlider }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = ColorInfoSlider; +} + +declare module "esri/dijit/ColorPicker" { + import esri = require("esri"); + import Color = require("esri/Color"); + + /** A widget to assist choosing a color from a color palette. */ + class ColorPicker { + /** The selected color. */ + color: Color; + /** The set of available color options. */ + palette: Color[]; + /** An array of recent colors to show in the recent colors row. */ + recentColors: Color[]; + /** + * Creates a new ColorPicker widget. + * @param params Set of parameters used to specify the ColorPicker widget options. + * @param srcNodeRef Reference or ID of the HTMLElement where the widget should be rendered. + */ + constructor(params: esri.ColorPickerOptions, srcNodeRef: Node); + /** + * Creates a new ColorPicker widget. + * @param params Set of parameters used to specify the ColorPicker widget options. + * @param srcNodeRef Reference or ID of the HTMLElement where the widget should be rendered. + */ + constructor(params: esri.ColorPickerOptions, srcNodeRef: string); + /** Finalizes the creation of the widget. */ + startup(): void; + /** Fires when the selected color has changed. */ + on(type: "color-change", listener: (event: { target: ColorPicker }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = ColorPicker; +} + +declare module "esri/dijit/Directions" { + import esri = require("esri"); + import DirectionsFeatureSet = require("esri/tasks/DirectionsFeatureSet"); + import Graphic = require("esri/graphic"); + import RouteParameters = require("esri/tasks/RouteParameters"); + import RouteTask = require("esri/tasks/RouteTask"); + import Point = require("esri/geometry/Point"); + import RouteResult = require("esri/tasks/RouteResult"); + + /** The Directions widget makes it easy to calculate directions between two or more input locations. */ + class Directions { + /** Read-only: Get the directions to all the locations along the route. */ + directions: DirectionsFeatureSet; + /** An array of objects that defines the potential matches for the input locations. */ + geocoderResults: any[]; + /** Indicates whether the Directions widget adds a stop on each map click. */ + mapClickActive: boolean; + /** Read-only: When true, the maximum number of stops for the route has been reached. */ + maxStopsReached: boolean; + /** Read-only: The graphic for the calculated route. */ + mergedRouteGraphic: Graphic; + /** Routing parameters for the widget. */ + routeParams: RouteParameters; + /** Routing task for the widget. */ + routeTask: RouteTask; + /** Read-only: The Service Description object returned by the Route REST Endpoint. */ + serviceDescription: any; + /** Indicates whether the Directions widget will display the map-click-active toggle button. */ + showActivateButton: boolean; + /** If true, the Clear button is shown. */ + showClearButton: boolean; + /** If true, the toggle button group allowing user to choose between Miles and Kilometers is shown. */ + showMilesKilometersOption: boolean; + /** If true, and supported by the service, then two toggle button groups are shown: one to allow user to choose between driving a car, a truck, or walking, and one more group to choose between fastest or shortest routes. */ + showTravelModesOption: boolean; + /** An array of graphics that define the stop locations along the route. */ + stops: Graphic[]; + /** The css theme used to style the widget. */ + theme: string; + /** Read-only: If Directions Widget runs with Travel Modes enabled, this property returns current Travel Mode name. */ + travelModeName: string; + /** + * Creates a new Directions dijit using the given DOM node. + * @param options Various options to configure this dijit. + * @param srcNodeRef Reference or id of a HTML element that this dijit is rendered into. + */ + constructor(options: esri.DirectionsOptions, srcNodeRef: Node); + /** + * Creates a new Directions dijit using the given DOM node. + * @param options Various options to configure this dijit. + * @param srcNodeRef Reference or id of a HTML element that this dijit is rendered into. + */ + constructor(options: esri.DirectionsOptions, srcNodeRef: string); + /** Deprecated at v3.13. */ + activate(): void; + /** + * Add a stop to the directions widget at the specified index location. + * @param stop A point that defines the stop location. + * @param index The index location where the stop should be added. + */ + addStop(stop: Point, index?: number): any; + /** + * Add a stop to the directions widget at the specified index location. + * @param stop A point that defines the stop location. + * @param index The index location where the stop should be added. + */ + addStop(stop: number[], index?: number): any; + /** + * Add a stop to the directions widget at the specified index location. + * @param stop A point that defines the stop location. + * @param index The index location where the stop should be added. + */ + addStop(stop: string, index?: number): any; + /** + * Add a stop to the directions widget at the specified index location. + * @param stop A point that defines the stop location. + * @param index The index location where the stop should be added. + */ + addStop(stop: any, index?: number): any; + /** + * Add multiple stops to the directions list starting at the specified location. + * @param stops An array of points that define the stop locations. + * @param index The index location where the stops will be added. + */ + addStops(stops: Point[], index?: number): any; + /** + * Add multiple stops to the directions list starting at the specified location. + * @param stops An array of points that define the stop locations. + * @param index The index location where the stops will be added. + */ + addStops(stops: number[][], index?: number): any; + /** + * Add multiple stops to the directions list starting at the specified location. + * @param stops An array of points that define the stop locations. + * @param index The index location where the stops will be added. + */ + addStops(stops: string[], index?: number): any; + /** + * Add multiple stops to the directions list starting at the specified location. + * @param stops An array of points that define the stop locations. + * @param index The index location where the stops will be added. + */ + addStops(stops: any[], index?: number): any; + /** + * Center the map at the start of the specified route segment. + * @param index The index of the segment where the map should be centered. + */ + centerAtSegmentStart(index: number): void; + /** Remove the route directions from the directions list. */ + clearDirections(): void; + /** Deprecated at v3.13. */ + deactivate(): void; + /** Destroy the Directions widget. */ + destroy(): void; + /** Calculate the route to the input locations and display the list of directions. */ + getDirections(): any; + /** If widget runs with Travel Modes enabled, call this method to obtain the list of supported Travel Mode names. */ + getSupportedTravelModeNames(): string[]; + /** + * Highlight the specified route segment on the map. + * @param index The index of the route segment to highlight. + */ + highlightSegment(index: number): void; + /** + * Remove the stop at the specified index. + * @param index The index of the stop to remove. + */ + removeStop(index: number): any; + /** Removes the existing stops from the directions widget. */ + removeStops(): any; + /** Resets the directions widget removing any directions, stops and map graphics. */ + reset(): any; + /** + * If widget runs with Travel Modes enabled, call this method to switch to particular Travel mode programmatically. + * @param travelModeName Travel mode. + */ + setTravelMode(travelModeName: string): any; + /** Finalizes the creation of this dijit. */ + startup(): void; + /** Removes the highlight symbol from the currently highlighted route segment. */ + unhighlightSegment(): void; + /** + * Update the existing stop at the specified index location. + * @param stop A point that defines the stop location. + * @param index The index of the stop to update. + */ + updateStop(stop: Point, index: number): any; + /** + * Update the existing stop at the specified index location. + * @param stop A point that defines the stop location. + * @param index The index of the stop to update. + */ + updateStop(stop: number[], index: number): any; + /** + * Update the existing stop at the specified index location. + * @param stop A point that defines the stop location. + * @param index The index of the stop to update. + */ + updateStop(stop: string, index: number): any; + /** + * Update the existing stop at the specified index location. + * @param stop A point that defines the stop location. + * @param index The index of the stop to update. + */ + updateStop(stop: any, index: number): any; + /** + * Update multiple stops in the directions widget by specifying an array of stops information. + * @param stops An array of points that define the stop locations. + */ + updateStops(stops: Point[]): any; + /** + * Update multiple stops in the directions widget by specifying an array of stops information. + * @param stops An array of points that define the stop locations. + */ + updateStops(stops: number[][]): any; + /** + * Update multiple stops in the directions widget by specifying an array of stops information. + * @param stops An array of points that define the stop locations. + */ + updateStops(stops: string[]): any; + /** + * Update multiple stops in the directions widget by specifying an array of stops information. + * @param stops An array of points that define the stop locations. + */ + updateStops(stops: any[]): any; + /** + * Sets the corresponding stop to point at the user's current location. + * @param stopIndex Index of the stop that will point to the user's current location. + */ + useMyCurrentLocation(stopIndex: number): any; + /** Zoom so that the full route is displayed within the current map extent. */ + zoomToFullRoute(): void; + /** + * Zoom to the specified route segment. + * @param index The index for a route segment. + */ + zoomToSegment(index: number): void; + /** Deprecated at v3.13. */ + on(type: "activate", listener: (event: { target: Directions }) => void): esri.Handle; + /** Deprecated at v3.13. */ + on(type: "deactivate", listener: (event: { target: Directions }) => void): esri.Handle; + /** Fires when the directions display is reset. */ + on(type: "directions-clear", listener: (event: { target: Directions }) => void): esri.Handle; + /** Fires when the route service has calculated the route and the directions are ready for display. */ + on(type: "directions-finish", listener: (event: { result: RouteResult; target: Directions }) => void): esri.Handle; + /** Fires when the route services starts to calculate the route. */ + on(type: "directions-start", listener: (event: { target: Directions }) => void): esri.Handle; + /** Fires when the directions widget has fully loaded. */ + on(type: "load", listener: (event: { target: Directions }) => void): esri.Handle; + /** Fires when the widget starts or stops listening for map clicks. */ + on(type: "map-click-active", listener: (event: { mapClickActive: boolean; target: Directions }) => void): esri.Handle; + /** Fired when you hover over a route segment in the directions display. */ + on(type: "segment-highlight", listener: (event: { graphic: Graphic; target: Directions }) => void): esri.Handle; + /** Fires when a route segment is selected in the directions display. */ + on(type: "segment-select", listener: (event: { graphic: Graphic; target: Directions }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = Directions; +} + +declare module "esri/dijit/FeatureTable" { + import esri = require("esri"); + import FeatureLayer = require("esri/layers/FeatureLayer"); + import Map = require("esri/map"); + + /** (Beta at v3.12) Creates an instance of the FeatureTable widget within the provided DOM node. */ + class FeatureTable { + /** An optional dGrid property. */ + allowSelectAll: boolean; + /** An optional dGrid property. */ + cellNavigation: boolean; + /** A reference to the column objects and their parameters. */ + columns: any[]; + /** Reference to the dataStore used by the dGrid. */ + dataStore: any; + /** Object defining the date options specifically for formatting date and time editors. */ + dateOptions: any; + /** The featureLayer that the table is associated with. */ + featureLayer: FeatureLayer; + /** Reference to the dGrid. */ + grid: any; + /** Optional columns to hide by default using the dGrid ColumnHider extension. */ + hiddenFields: string[]; + /** A reference to the primary key used by the dataStore to differentiate columns. */ + idProperty: string; + /** When true, the FeatureTable widget has successfully loaded. */ + loaded: boolean; + /** Reference to the map. */ + map: Map; + /** A dGrid property. */ + noDataMessage: string; + /** Attribute fields to include in the FeatureTable. */ + outFields: string[]; + /** Indicates whether the data is editable via the widget. */ + readOnly: boolean; + /** A dGrid property. */ + selectionMode: string; + /** + * Creates an instance of the FeatureTable widget within the provided DOM node. + * @param params Various options to configure this dijit. + * @param srcNodeRef Reference or id of a HTML element that this dijit is rendered into. + */ + constructor(params: esri.FeatureTableOptions, srcNodeRef: Node); + /** + * Creates an instance of the FeatureTable widget within the provided DOM node. + * @param params Various options to configure this dijit. + * @param srcNodeRef Reference or id of a HTML element that this dijit is rendered into. + */ + constructor(params: esri.FeatureTableOptions, srcNodeRef: string); + /** Finalizes the creation of the widget. */ + startup(): void; + /** Fired when a row is deselected. */ + on(type: "dgrid-deselect", listener: (event: { target: FeatureTable }) => void): esri.Handle; + /** Fired when the grid is refreshed. */ + on(type: "dgrid-refresh-complete", listener: (event: { target: FeatureTable }) => void): esri.Handle; + /** Fired when a row is selected. */ + on(type: "dgrid-select", listener: (event: { target: FeatureTable }) => void): esri.Handle; + /** Fired when the FeatureTable is loaded. */ + on(type: "load", listener: (event: { target: FeatureTable }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = FeatureTable; +} + +declare module "esri/dijit/Gallery" { + import esri = require("esri"); + + /** The Gallery widget provides a touch-aware thumbnail gallery for mobile devices such as iOS and Android. */ + class Gallery { + /** + * Creates a new mobile Gallery. + * @param params See options list. + * @param srcNodeRef HTML element where the gallery should be rendered. + */ + constructor(params: esri.GalleryOptions, srcNodeRef: Node); + /** + * Creates a new mobile Gallery. + * @param params See options list. + * @param srcNodeRef HTML element where the gallery should be rendered. + */ + constructor(params: esri.GalleryOptions, srcNodeRef: string); + /** Removes any object references and associated objects created by the gallery. */ + destroy(): void; + /** Gets the item with the current focus. */ + getFocusedItem(): any; + /** Get the currently selected item. */ + getSelectedItem(): any; + /** Move the gallery to the next page of items. */ + next(): void; + /** Move the gallery to the previous page of items. */ + previous(): void; + /** + * Select an item in the gallery. + * @param item The item to select. + */ + select(item: any): void; + /** + * Set the focus to the specified item. + * @param item The item which will have focus. + */ + setFocus(item: any): void; + /** Finalize the creation of the gallery. */ + startup(): void; + /** Fires when the items setFocus method is called. */ + on(type: "focus", listener: (event: { item: any; target: Gallery }) => void): esri.Handle; + /** Fires when an item is selected. */ + on(type: "select", listener: (event: { item: any; target: Gallery }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = Gallery; +} + +declare module "esri/dijit/Gauge" { + import esri = require("esri"); + import Graphic = require("esri/graphic"); + + /** The gauge widget provides a streamlined way to create a dashboard-like interface and display data on a semi-circular gauge. */ + class Gauge { + /** + * Create a new Gauge object. + * @param params See options list for parameters. + * @param srcNodeRef HTML element where the gauge should be rendered. + */ + constructor(params: esri.GaugeOptions, srcNodeRef: Node); + /** + * Create a new Gauge object. + * @param params See options list for parameters. + * @param srcNodeRef HTML element where the gauge should be rendered. + */ + constructor(params: esri.GaugeOptions, srcNodeRef: string); + /** Destroy the gauge. */ + destroy(): void; + /** + * Get the value of the property from the Gauge. + * @param name Property to get value. + */ + get(name: string): any; + /** + * Set the value of a property from the Gauge. + * @param name Property to set value. + * @param value Value to set. + */ + set(name: string, value: string): Gauge; + /** + * Set the value of a property from the Gauge. + * @param name Property to set value. + * @param value Value to set. + */ + set(name: string, value: Graphic): Gauge; + /** + * Set the value of a property from the Gauge. + * @param name Property to set value. + * @param value Value to set. + */ + set(name: string, value: number): Gauge; + /** Finalizes the creation of the gauge. */ + startup(): void; + } + export = Gauge; +} + +declare module "esri/dijit/Geocoder" { + import esri = require("esri"); + import GraphicsLayer = require("esri/layers/GraphicsLayer"); + import Symbol = require("esri/symbols/Symbol"); + + /** Add a geographic search box to an application. */ + class Geocoder { + /** Currently selected locator object. */ + activeGeocoder: any; + /** Current locator index to search by default. */ + activeGeocoderIndex: number; + /** When true, the auto-complete menu is enabled. */ + autoComplete: boolean; + /** When true, the widget will navigate to the selected location. */ + autoNavigate: boolean; + /** When true the geocoder menu is enabled. */ + geocoderMenu: boolean; + /** List of geocoders the widget uses to find search results. */ + geocoders: any[]; + /** Specify a graphicsLayer to use when highlightLocation is true. */ + graphicsLayer: GraphicsLayer; + /** Indicates whether to show a graphic at a selected location. */ + highlightLocation: boolean; + /** Maximum number of locations to display in the results menu. */ + maxLocations: number; + /** Minimum number of characters required before the query is performed. */ + minCharacters: number; + /** Current results from query or select. */ + results: any[]; + /** Delay in milliseconds before each keyUp calls for the query to be performed. */ + searchDelay: number; + /** When true, suggestions are displayed as the user is typing. */ + showResults: boolean; + /** Symbol to use when highlightLocation is true. */ + symbol: Symbol; + /** Current theme being used to style the widget. */ + theme: string; + /** Current value of the input textbox. */ + value: string; + /** Scale to zoom to when geocoder does not return an extent. */ + zoomScale: number; + /** + * Create a new Geocoder widget using the given DOM node. + * @param params Set of parameters used to specify Geocoder options. + * @param srcNodeRef Reference or id of the HTML element where the widget should be rendered. + */ + constructor(params: esri.GeocoderOptions, srcNodeRef: Node); + /** + * Create a new Geocoder widget using the given DOM node. + * @param params Set of parameters used to specify Geocoder options. + * @param srcNodeRef Reference or id of the HTML element where the widget should be rendered. + */ + constructor(params: esri.GeocoderOptions, srcNodeRef: string); + /** Unfocus the widget's text input. */ + blur(): void; + /** Clears the values currently set in the widget. */ + clear(): void; + /** Releases all the resources used by the widget. */ + destroy(): void; + /** Executes a search using the current value of the geocoder. */ + find(): any; + /** Brings focus to the widget's text input. */ + focus(): void; + /** Hide the widget. */ + hide(): void; + /** + * Select a result using a result object. + * @param result An object with the following properties. + */ + select(result: any): void; + /** Show the widget. */ + show(): void; + /** Finalizes the creation of the widget. */ + startup(): void; + /** Fired when results are returned from an auto-complete. */ + on(type: "auto-complete", listener: (event: { results : any; target: Geocoder }) => void): esri.Handle; + /** Fired when a result is cleared from the input box or a new result is selected. */ + on(type: "clear", listener: (event: { target: Geocoder }) => void): esri.Handle; + /** Fired when results are returned from a search. */ + on(type: "find-results", listener: (event: { results: any; target: Geocoder }) => void): esri.Handle; + /** Fired when a geocoder is selected. */ + on(type: "geocoder-select", listener: (event: { geocoder: any; target: Geocoder }) => void): esri.Handle; + /** Fired when a result has been selected, the submit button is pressed, or the enter key is fired. */ + on(type: "select", listener: (event: { results: any; target: Geocoder }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = Geocoder; +} + +declare module "esri/dijit/HeatmapSlider" { + import esri = require("esri"); + import RendererSlider = require("esri/dijit/RendererSlider"); + + /** A widget to assist in managing properties of a HeatmapRenderer. */ + class HeatmapSlider extends RendererSlider { + /** Required. */ + colorStops: any; + /** Required. */ + handles: number[]; + /** Optional. */ + maxValue: number; + /** Optional. */ + minValue: number; + /** Optional */ + rampWidth: number; + /** Property for showing handles. */ + showHandles: boolean; + /** Property for showing labels. */ + showLabels: boolean; + /** Property for showing ticks. */ + showTicks: boolean; + /** + * Creates a new HeatmapSlider widget within the provided DOM node srcNodeRef. + * @param params Set of parameters used to specify the HeatmapSlider widget options. + * @param srcNodeRef Reference or ID of the HTMLElement where the widget should be rendered. + */ + constructor(params: esri.HeatmapSliderOptions, srcNodeRef: Node); + /** + * Creates a new HeatmapSlider widget within the provided DOM node srcNodeRef. + * @param params Set of parameters used to specify the HeatmapSlider widget options. + * @param srcNodeRef Reference or ID of the HTMLElement where the widget should be rendered. + */ + constructor(params: esri.HeatmapSliderOptions, srcNodeRef: string); + /** Fires when HeatmapSlider changes. */ + on(type: "change", listener: (event: { colorStops: any; target: HeatmapSlider }) => void): esri.Handle; + /** Fires when HeatmapSlider handle is moved. */ + on(type: "handle-value-change", listener: (event: { colorStops: any; target: HeatmapSlider }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = HeatmapSlider; +} + +declare module "esri/dijit/HistogramTimeSlider" { + import esri = require("esri"); + + /** The HistogramTimeSlider dijit provides a histogram chart representation of data for time-enabled layers on a map. */ + class HistogramTimeSlider { + /** + * Creates a new HistogramTimeSlider dijit using the given DOM node. + * @param params Input parameters. + * @param srcNodeRef HTML element where the tool should be rendered. + */ + constructor(params: esri.HistogramTimeSliderOptions, srcNodeRef: Node); + /** + * Creates a new HistogramTimeSlider dijit using the given DOM node. + * @param params Input parameters. + * @param srcNodeRef HTML element where the tool should be rendered. + */ + constructor(params: esri.HistogramTimeSliderOptions, srcNodeRef: string); + /** Set related objects as null and hide the widget. */ + destroy(): void; + /** Finalizes the creation of the widget. */ + startup(): void; + /** Fires whenever the slider moved, and the visible time extent is changed. */ + on(type: "time-extent-change", listener: (event: { target: HistogramTimeSlider }) => void): esri.Handle; + /** Fires fires each time the histogram is drawn. */ + on(type: "update", listener: (event: { target: HistogramTimeSlider }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = HistogramTimeSlider; +} + +declare module "esri/dijit/HomeButton" { + import esri = require("esri"); + import Extent = require("esri/geometry/Extent"); + import Map = require("esri/map"); + + /** HomeButton provides a simple button to return to the map's default starting extent. */ + class HomeButton { + /** The extent used to zoom to when clicked. */ + extent: Extent; + /** Whether the widget has been loaded. */ + loaded: boolean; + /** Map object that this dijit is associated with. */ + map: Map; + /** Class used for styling the widget. */ + theme: string; + /** Whether the widget is visible by default. */ + visible: boolean; + /** + * Creates a new HomeButton dijit using the given DOM node. + * @param params Various parameters to configure this dijit. + * @param srcNodeRef Reference or id of a HTML element that this dijit is rendered into. + */ + constructor(params: esri.HomeButtonOptions, srcNodeRef: Node); + /** + * Creates a new HomeButton dijit using the given DOM node. + * @param params Various parameters to configure this dijit. + * @param srcNodeRef Reference or id of a HTML element that this dijit is rendered into. + */ + constructor(params: esri.HomeButtonOptions, srcNodeRef: string); + /** Destroys the widget. */ + destroy(): void; + /** Hides the widget. */ + hide(): void; + /** Goes to the home extent. */ + home(): any; + /** Shows the widget. */ + show(): void; + /** Finalizes the creation of this dijit. */ + startup(): void; + /** Fires when the home method has been called. */ + on(type: "home", listener: (event: { error: any; extent: Extent; target: HomeButton }) => void): esri.Handle; + /** Fires when the widget has been loaded. */ + on(type: "load", listener: (event: { target: HomeButton }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = HomeButton; +} + +declare module "esri/dijit/HorizontalSlider" { + import esri = require("esri"); + + /** A form widget that allows one to select a value with a horizontally draggable handle. */ + class HorizontalSlider { + /** Show increment/decrement buttons at the ends of the slider. */ + showButtons: boolean; + /** + * Creates a new HorizontalSlider widget. + * @param params Set of parameters used to specify the HorizontalSlider widget options. + * @param srcNodeRef Reference or ID of the HTMLElement where the widget should be rendered. + */ + constructor(params: esri.HorizontalSliderOptions, srcNodeRef: Node); + /** + * Creates a new HorizontalSlider widget. + * @param params Set of parameters used to specify the HorizontalSlider widget options. + * @param srcNodeRef Reference or ID of the HTMLElement where the widget should be rendered. + */ + constructor(params: esri.HorizontalSliderOptions, srcNodeRef: string); + /** Finalizes the creation of the widget. */ + startup(): void; + } + export = HorizontalSlider; +} + +declare module "esri/dijit/InfoWindow" { + import esri = require("esri"); + import InfoWindowBase = require("esri/InfoWindowBase"); + import Point = require("esri/geometry/Point"); + + /** An InfoWindow is an HTML popup. */ + class InfoWindow extends InfoWindowBase { + /** InfoWindow is anchored to the lower left of the point. */ + static ANCHOR_LOWERLEFT: any; + /** InfoWindow is anchored to the lower right of the point. */ + static ANCHOR_LOWERRIGHT: any; + /** InfoWindow is anchored to the upper left of the point. */ + static ANCHOR_UPPERLEFT: any; + /** InfoWindow is anchored to the upper right of the point. */ + static ANCHOR_UPPERRIGHT: any; + /** Placement of the InfoWindow with respect to the graphic. */ + anchor: string; + /** The anchor point of the InfoWindow in screen coordinates. */ + coords: Point; + /** InfoWindow always show with the specified anchor. */ + fixedAnchor: string; + /** Determines whether the InfoWindow is currently shown on the map. */ + isShowing: boolean; + /** + * Create a new Info Window. + * @param params Optional parameters. + * @param srcNodeRef Reference or id of the HTML element where the widget should be rendered. + */ + constructor(params: any, srcNodeRef: Node); + /** + * Create a new Info Window. + * @param params Optional parameters. + * @param srcNodeRef Reference or id of the HTML element where the widget should be rendered. + */ + constructor(params: any, srcNodeRef: string); + /** Hides the InfoWindow. */ + hide(): void; + /** + * Moves the InfoWindow to the specified screen point. + * @param point The new anchor point when moving the InfoWindow. + */ + move(point: Point): void; + /** + * Resizes the InfoWindow to the specified height and width in pixels. + * @param width The new width of the InfoWindow in pixels. + * @param height The new height of the InfoWindow in pixels. + */ + resize(width: number, height: number): void; + /** + * Sets the content in the InfoWindow. + * @param content The content for the InfoWindow. + */ + setContent(content: any): InfoWindow; + /** + * Sets the fixed location of the InfoWindow anchor. + * @param anchor Fixed anchor that cannot be overridden by InfoWindow.show(). + */ + setFixedAnchor(anchor: string): void; + /** + * Sets the title for the InfoWindow. + * @param title The title for the InfoWindow. + */ + setTitle(title: string): InfoWindow; + /** + * Display the InfoWindow at the specified location. + * @param point Location to place anchor. + * @param placement Placement of the InfoWindow with respect to the graphic. + */ + show(point: Point, placement?: string): void; + /** Finalizes the creation of the widget. */ + startup(): void; + /** Fires when an infoWindow is hidden. */ + on(type: "hide", listener: (event: { target: InfoWindow }) => void): esri.Handle; + /** Fires when an InfoWindow is visible. */ + on(type: "show", listener: (event: { target: InfoWindow }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = InfoWindow; +} + +declare module "esri/dijit/InfoWindowLite" { + import esri = require("esri"); + import InfoWindowBase = require("esri/InfoWindowBase"); + import Point = require("esri/geometry/Point"); + import InfoWindow = require("esri/dijit/InfoWindow"); + + /** Creates a new InfoWindowLite object. */ + class InfoWindowLite extends InfoWindowBase { + /** Placement of the InfoWindow with respect to the graphic. */ + anchor: string; + /** The anchor point of the InfoWindowLite in screen coordinates. */ + coords: Point; + /** Always display the info window using the specified anchor. */ + fixedAnchor: string; + /** Determines whether the InfoWindowLite is currently shown on the map. */ + isShowing: boolean; + /** Hides the InfoWindow. */ + hide(): void; + /** + * Moves the InfoWindow to the specified screen point. + * @param point The new anchor point when moving the InfoWindowLite. + */ + move(point: Point): void; + /** + * Resizes the InfoWindowLite to the specified height and width in pixels. + * @param width The new width of the InfoWindowLite in pixels. + * @param height The new height of the InfoWindowLite in pixels. + */ + resize(width: number, height: number): void; + /** + * Sets the content in the InfoWindow. + * @param content The content for the InfoWindow. + */ + setContent(content: any): void; + /** + * Set the fixed location of the InfoWindowLite anchor. + * @param anchor Fixed anchor that cannot be overridden by InfoWindowLite.show(). + */ + setFixedAnchor(anchor: string): void; + /** + * Define the title for the InfoWindowLite. + * @param title The title for the InfoWindowLite. + */ + setTitle(title: string): InfoWindow; + /** + * Display the InfoWindow at the specified location. + * @param point Location to place anchor. + * @param placement Placement of the InfoWindow with respect to the graphic. + */ + show(point: Point, placement?: string): void; + /** Finalizes the creation of the widget. */ + startup(): void; + /** Fires when an infoWindow is hidden. */ + on(type: "hide", listener: (event: { target: InfoWindowLite }) => void): esri.Handle; + /** Fires when an InfoWindowLite is displayed. */ + on(type: "show", listener: (event: { target: InfoWindowLite }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = InfoWindowLite; +} + +declare module "esri/dijit/LayerSwipe" { + import esri = require("esri"); + import Layer = require("esri/layers/layer"); + import Map = require("esri/map"); + + /** LayerSwipe provides a simple tool to show a portion of a layer or layers on top of a map. */ + class LayerSwipe { + /** The number of pixels to clip the swipe tool. */ + clip: number; + /** If the widget is enabled and layers can be swiped. */ + enabled: boolean; + /** The layers to be swiped. */ + layers: Layer[]; + /** The number of pixels to place the tool from the left of the map. */ + left: number; + /** Whether the widget has been loaded. */ + loaded: boolean; + /** Map object that this dijit is associated with. */ + map: Map; + /** Class used for styling the widget. */ + theme: string; + /** The number of pixels to place the tool from the top of the map. */ + top: number; + /** Type of swipe tool to use. */ + type: string; + /** Whether the widget is visible by default. */ + visible: boolean; + /** + * Creates a new LayerSwipe dijit using the given DOM node. + * @param params Various parameters to configure this dijit. + * @param srcNodeRef Reference or id of a HTML element that this dijit is rendered into. + */ + constructor(params: esri.LayerSwipeOptions, srcNodeRef: Node); + /** + * Creates a new LayerSwipe dijit using the given DOM node. + * @param params Various parameters to configure this dijit. + * @param srcNodeRef Reference or id of a HTML element that this dijit is rendered into. + */ + constructor(params: esri.LayerSwipeOptions, srcNodeRef: string); + /** Destroys the widget. */ + destroy(): void; + /** Disables the widget. */ + disable(): void; + /** Enables the widget. */ + enable(): void; + /** Finalizes the creation of this dijit. */ + startup(): void; + /** Updates the map to the position of the swipe node. */ + swipe(): void; + /** Event is fired when the widget has been loaded. */ + on(type: "load", listener: (event: { target: LayerSwipe }) => void): esri.Handle; + /** Event is fired when the tool has moved. */ + on(type: "swipe", listener: (event: { layers: any[]; target: LayerSwipe }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = LayerSwipe; +} + +declare module "esri/dijit/Legend" { + import esri = require("esri"); + + /** The legend dijit displays a label and symbol for some or all of the layers in the map. */ + class Legend { + /** + * Creates a new Legend dijit. + * @param params Parameters used to configure the dijit. + * @param srcNodeRef Reference or id of the HTML element where the widget should be rendered. + */ + constructor(params: esri.LegendOptions, srcNodeRef: Node); + /** + * Creates a new Legend dijit. + * @param params Parameters used to configure the dijit. + * @param srcNodeRef Reference or id of the HTML element where the widget should be rendered. + */ + constructor(params: esri.LegendOptions, srcNodeRef: string); + /** Destroys the legend. */ + destroy(): void; + /** Refresh the legend. */ + refresh(): void; + /** Finalizes the creation of the legend . */ + startup(): void; + } + export = Legend; +} + +declare module "esri/dijit/LocateButton" { + import esri = require("esri"); + import GraphicsLayer = require("esri/layers/GraphicsLayer"); + import InfoTemplate = require("esri/InfoTemplate"); + import Map = require("esri/map"); + import Symbol = require("esri/symbols/Symbol"); + import Graphic = require("esri/graphic"); + + /** LocateButton provides a simple button to locate and zoom to the users current location. */ + class LocateButton { + /** Centers the map to the location when a new position is returned. */ + centerAt: boolean; + /** Removes existing graphic when tracking stops. */ + clearOnTrackingStop: boolean; + /** The HTML5 Geolocation Position options for locating. */ + geolocationOptions: any; + /** Layer in which the highlighted graphic is set to. */ + graphicsLayer: GraphicsLayer; + /** If true, the users location will be highlighted with a point. */ + highlightLocation: boolean; + /** The infoTemplate used for the highlight graphic. */ + infoTemplate: InfoTemplate; + /** Whether the widget has been loaded. */ + loaded: boolean; + /** Map object that this dijit is associated with. */ + map: Map; + /** The scale to zoom to when a users location has been found. */ + scale: number; + /** Sets the maps scale when a new position is returned. */ + setScale: boolean; + /** The symbol used on the highlight graphic to highlight the users location on the map. */ + symbol: Symbol; + /** Class used for styling the widget. */ + theme: string; + /** Shows the current tracking state. */ + tracking: boolean; + /** When enabled, the button becomes a toggle that creates an event to watch for location changes. */ + useTracking: boolean; + /** Whether the widget is visible. */ + visible: boolean; + /** + * Creates a new LocateButton dijit using the given DOM node. + * @param params Various parameters to configure this dijit. + * @param srcNodeRef Reference or id of a HTML element that this dijit is rendered into. + */ + constructor(params: esri.LocateButtonOptions, srcNodeRef: Node); + /** + * Creates a new LocateButton dijit using the given DOM node. + * @param params Various parameters to configure this dijit. + * @param srcNodeRef Reference or id of a HTML element that this dijit is rendered into. + */ + constructor(params: esri.LocateButtonOptions, srcNodeRef: string); + /** Clears the point graphic. */ + clear(): void; + /** Destroys the widget. */ + destroy(): void; + /** Hides the widget. */ + hide(): void; + /** Goes to the users extent. */ + locate(): any; + /** Shows the widget. */ + show(): void; + /** Finalizes the creation of this dijit. */ + startup(): void; + /** Fires when the widget has been loaded. */ + on(type: "load", listener: (event: { target: LocateButton }) => void): esri.Handle; + /** Fires when the locate method has been called. */ + on(type: "locate", listener: (event: { error: any; graphic: Graphic; position: any; scale: number; target: LocateButton }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = LocateButton; +} + +declare module "esri/dijit/Measurement" { + import esri = require("esri"); + import Point = require("esri/geometry/Point"); + import Polyline = require("esri/geometry/Polyline"); + import Polygon = require("esri/geometry/Polygon"); + import Geometry = require("esri/geometry/Geometry"); + + /** The Measurement widget provides tools for calculating the current location (Get Location) and measuring distance (Measure Distance) and area (Measure Area). */ + class Measurement { + /** + * Creates a new Measurement widget. + * @param params See options list for parameters. + * @param srcNodeRef Reference or id of the HTML element where the widget should be rendered. + */ + constructor(params: esri.MeasurementOptions, srcNodeRef: Node); + /** + * Creates a new Measurement widget. + * @param params See options list for parameters. + * @param srcNodeRef Reference or id of the HTML element where the widget should be rendered. + */ + constructor(params: esri.MeasurementOptions, srcNodeRef: string); + /** Remove the measurement graphics and results. */ + clearResult(): void; + /** Destroy the measurement widget. */ + destroy(): void; + /** Returns an Object with two properties: toolName and unitName. */ + getTool(): any; + /** Returns current measurement unit of the active tool. */ + getUnit(): string; + /** Hide the measurement widget. */ + hide(): void; + /** + * Hide the specified tool. + * @param toolName Valid values are "area", "distance" or "location". + */ + hideTool(toolName: string): void; + /** + * Invoke the measurement functionality of the widget by passing in a previously created geometry. + * @param geometry Geometry to be measured. + */ + measure(geometry: Point): void; + /** + * Invoke the measurement functionality of the widget by passing in a previously created geometry. + * @param geometry Geometry to be measured. + */ + measure(geometry: Polyline): void; + /** + * Invoke the measurement functionality of the widget by passing in a previously created geometry. + * @param geometry Geometry to be measured. + */ + measure(geometry: Polygon): void; + /** + * Activate or deactivate a tool. + * @param toolName The name of the tool to activate or deactivate. + * @param activate When true, the specified tool is activated. + */ + setTool(toolName: string, activate: boolean): void; + /** Show the measurement widget after it has been hidden using the hide method. */ + show(): void; + /** + * Display the specified tool. + * @param toolName Valid values are "area", "distance" or "location". + */ + showTool(toolName: string): void; + /** Finalizes the creation of the measurement widget . */ + startup(): void; + /** Fires when a measurement is made but the measurement is not complete (single-click). */ + on(type: "measure", listener: (event: { geometry: Geometry; toolName: string; unitName: string; values: number; target: Measurement }) => void): esri.Handle; + /** Fired when the measurement is complete. */ + on(type: "measure-end", listener: (event: { geometry: Geometry; toolName: string; unitName: string; values: any; target: Measurement }) => void): esri.Handle; + /** Fires when a measurement operation begins (single-click). */ + on(type: "measure-start", listener: (event: { toolName: string; unitName: string; target: Measurement }) => void): esri.Handle; + /** Fires when the primary tool is changed. */ + on(type: "tool-change", listener: (event: { toolName: string; unitName: string; target: Measurement }) => void): esri.Handle; + /** Fires when the units currently being used by the Measurement widget changes. */ + on(type: "unit-change", listener: (event: { toolName: string; unitName: string; target: Measurement }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = Measurement; +} + +declare module "esri/dijit/OpacitySlider" { + import esri = require("esri"); + import RendererSlider = require("esri/dijit/RendererSlider"); + + /** A widget to assist with managing opacity with a renderer. */ + class OpacitySlider extends RendererSlider { + /** Required. */ + handles: number[]; + /** Optional. */ + histogram: any; + /** Optional: */ + histogramWidth: boolean; + /** Optional. */ + maxValue: number; + /** Optional. */ + minValue: number; + /** Required. */ + opacityInfo: any; + /** Optional */ + rampWidth: number; + /** Property for showing handles. */ + showHandles: boolean; + /** Optional. */ + showHistogram: boolean; + /** Property for showing labels. */ + showLabels: boolean; + /** Property for showing ticks. */ + showTicks: boolean; + /** Property for displaying the transparent background. */ + showTransparentBackground: boolean; + /** Optional. */ + statistics: any; + /** Optional. */ + zoomOptions: any; + /** + * Creates a new OpacitySlider widget within the provided DOM node srcNodeRef. + * @param params Set of parameters used to specify the OpacitySlider widget options. + * @param srcNodeRef Reference or ID of the HTMLElement where the widget should be rendered. + */ + constructor(params: esri.OpacitySliderOptions, srcNodeRef: Node); + /** + * Creates a new OpacitySlider widget within the provided DOM node srcNodeRef. + * @param params Set of parameters used to specify the OpacitySlider widget options. + * @param srcNodeRef Reference or ID of the HTMLElement where the widget should be rendered. + */ + constructor(params: esri.OpacitySliderOptions, srcNodeRef: string); + /** Fires when OpacitySlider changes. */ + on(type: "change", listener: (event: { opacityInfo: any; target: OpacitySlider }) => void): esri.Handle; + /** Fires when minValue or maxValue of OpacitySlider changes. */ + on(type: "data-value-change", listener: (event: { maxValue: number; minValue: number; opacityInfo: any; target: OpacitySlider }) => void): esri.Handle; + /** Fires when an OpacitySlider handle is moved. */ + on(type: "handle-value-change", listener: (event: { opacityInfo: any; target: OpacitySlider }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = OpacitySlider; +} + +declare module "esri/dijit/OverviewMap" { + import esri = require("esri"); + + /** The OverviewMap widget displays the current extent of the map within the context of a larger area. */ + class OverviewMap { + /** + * Creates a new OverviewMap object. + * @param params Parameters that define the functionality of the OverviewMap widget. + * @param srcNodeRef HTML element where the widget should be rendered. + */ + constructor(params: esri.OverviewMapOptions, srcNodeRef: Node); + /** + * Creates a new OverviewMap object. + * @param params Parameters that define the functionality of the OverviewMap widget. + * @param srcNodeRef HTML element where the widget should be rendered. + */ + constructor(params: esri.OverviewMapOptions, srcNodeRef: string); + /** Releases the resources used by the dijit. */ + destroy(): void; + /** Hide the overview map. */ + hide(): void; + /** + * Resize the widget. + * @param size Object containing width and height of the desired size. + */ + resize(size: any): void; + /** Show the overview map. */ + show(): void; + /** Finalizes the creation of the OverviewMap dijit. */ + startup(): void; + } + export = OverviewMap; +} + +declare module "esri/dijit/Popup" { + import esri = require("esri"); + import InfoWindowBase = require("esri/InfoWindowBase"); + import Graphic = require("esri/graphic"); + import FillSymbol = require("esri/symbols/FillSymbol"); + import LineSymbol = require("esri/symbols/LineSymbol"); + import Point = require("esri/geometry/Point"); + import MarkerSymbol = require("esri/symbols/MarkerSymbol"); + + /** The Popup class is an implementation of InfoWindow that inherits from InfoWindowBase to provide additional capabilities. */ + class Popup extends InfoWindowBase { + /** Controls the placement of the popup window with respect to the geographic location. */ + anchor: string; + /** The number of features associated with the info window. */ + count: number; + /** An array of pending deferreds, null if there are not any pending deferreds. */ + deferreds: any[]; + /** The HTML element (reference to a DOM Node) where the info window is constructed. */ + domNode: any; + /** The array of features currently associated with the info window. */ + features: Graphic[]; + /** Define the symbol used to highlight polygon features. */ + fillSymbol: FillSymbol; + /** Number of milliseconds after which the popup window will be hidden when visibleWhenEmpty is false and there are no features to be displayed. */ + hideDelay: number; + /** Indicates whether popup should highlight features. */ + highlight: boolean; + /** Indicates if the info window is visible. */ + isShowing: boolean; + /** Indicates whether a feature should remain highlighted after the user closes the popup window. */ + keepHighlightOnHide: boolean; + /** Define the symbol used to highlight line features. */ + lineSymbol: LineSymbol; + /** The location the info window is pointing to. */ + location: Point; + /** Specify the margin (in pixels) to leave to the left of the popup window when it is maximized. */ + marginLeft: number; + /** Specify the margin (in pixels) to leave at the top of the popup window when it is maximized. */ + marginTop: number; + /** Define the marker symbol used to highlight point features. */ + markerSymbol: MarkerSymbol; + /** Specify the x-offset (in pixels) used when positioning the popup. */ + offsetX: number; + /** Specify the y-offset (in pixels) used when positioning the popup. */ + offsetY: number; + /** Indicates whether popup should display previous and next buttons in the title bar. */ + pagingControls: boolean; + /** Indicates whether popup should display the title bar text that contains the page number and total number of available features. */ + pagingInfo: boolean; + /** Indicates whether the popup window should be displayed. */ + popupWindow: boolean; + /** The index of the currently selected feature in the features array. */ + selectedIndex: number; + /** Indicates whether the feature's title should display within the body of the popup window as opposed to in the titlebar. */ + titleInBody: boolean; + /** Indicates whether the popup window remains visible when there are no features to be displayed. */ + visibleWhenEmpty: boolean; + /** Define the number of levels to zoom in when the 'Zoom to' link is clicked. */ + zoomFactor: number; + /** + * Create a new Popup object. + * @param options Optional parameters. + * @param srcNodeRef Reference or id of the HTML element where the widget should be rendered. + */ + constructor(options: esri.PopupOptions, srcNodeRef: Node); + /** + * Create a new Popup object. + * @param options Optional parameters. + * @param srcNodeRef Reference or id of the HTML element where the widget should be rendered. + */ + constructor(options: esri.PopupOptions, srcNodeRef: string); + /** Removes all features and destroys any pending deferreds. */ + clearFeatures(): void; + /** Destroy the popup. */ + destroy(): void; + /** Get the currently selected feature. */ + getSelectedFeature(): Graphic; + /** Hide the info window. */ + hide(): void; + /** Maximize the info window. */ + maximize(): void; + /** Re-calculates the popup's position with respect to the map location it is pointing to. */ + reposition(): void; + /** + * Resize the info window to the specified height (in pixels). + * @param width The new width of the InfoWindow in pixels. + * @param height The new height of the InfoWindow in pixels. + */ + resize(width: number, height: number): void; + /** Restore the info window to the pre-maximized state. */ + restore(): void; + /** + * Selects the feature at the specified index. + * @param index The index of the feature to select. + */ + select(index: number): void; + /** Go to the next feature. */ + selectNext(): void; + /** Go to the previous feature. */ + selectPrevious(): void; + /** + * Set the value of a property. + * @param name Property to set value. + * @param value Value to set. + */ + set(name: string, value: any): Popup; + /** + * Set the content for the info window. + * @param content The content for the info window. + */ + setContent(content: string): void; + /** + * Set the content for the info window. + * @param content The content for the info window. + */ + setContent(content: Function): void; + /** + * Associate an array of features or an array of deferreds that return features with the info window. + * @param features An array of features or deferreds. + */ + setFeatures(features: Graphic[]): void; + /** + * Associate an array of features or an array of deferreds that return features with the info window. + * @param features An array of features or deferreds. + */ + setFeatures(features: any[]): void; + /** + * Sets the info window title. + * @param title The text for the title. + */ + setTitle(title: string): void; + /** + * Sets the info window title. + * @param title The text for the title. + */ + setTitle(title: Function): void; + /** + * Display the info window at the specified location. + * @param location An instance of esri.geometry.Point that represents the geographic location to display the popup. + * @param options See the object specifications table below for the structure of the options object. + */ + show(location: Point, options?: any): void; + /** Finalizes the creation of the widget. */ + startup(): void; + /** Fired when clearFeatures is called. */ + on(type: "clear-features", listener: (event: { target: Popup }) => void): esri.Handle; + /** Fired when the info window is hidden. */ + on(type: "hide", listener: (event: { target: Popup }) => void): esri.Handle; + /** Fired when the popup has finished maximizing. */ + on(type: "maximize", listener: (event: { target: Popup }) => void): esri.Handle; + /** Fired when the popup has been restored from its maximized state. */ + on(type: "restore", listener: (event: { target: Popup }) => void): esri.Handle; + /** Fired when the selection changes. */ + on(type: "selection-change", listener: (event: { target: Popup }) => void): esri.Handle; + /** Fired after registering an array of features. */ + on(type: "set-features", listener: (event: { target: Popup }) => void): esri.Handle; + /** Fired when the info window becomes visible. */ + on(type: "show", listener: (event: { target: Popup }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = Popup; +} + +declare module "esri/dijit/PopupMobile" { + import esri = require("esri"); + import InfoWindowBase = require("esri/InfoWindowBase"); + import Point = require("esri/geometry/Point"); + import Graphic = require("esri/graphic"); + + /** The PopupMobile class is an implementation of InfoWindow that inherits from InfoWindowBase to provide additional capabilities. */ + class PopupMobile extends InfoWindowBase { + /** The location the info window is pointing to. */ + location: Point; + /** + * Create a new PopupMobile object. + * @param options Optional parameters. + * @param srcNodeRef Reference or id of the HTML element where the widget should be rendered. + */ + constructor(options: esri.PopupMobileOptions, srcNodeRef: Node); + /** + * Create a new PopupMobile object. + * @param options Optional parameters. + * @param srcNodeRef Reference or id of the HTML element where the widget should be rendered. + */ + constructor(options: esri.PopupMobileOptions, srcNodeRef: string); + /** Removes all features and destroys any pending deferreds. */ + clearFeatures(): void; + /** Destroy the popup. */ + destroy(): void; + /** Get the currently selected feature. */ + getSelectedFeature(): Graphic; + /** Hide the info window. */ + hide(): void; + /** + * Selects the feature at the specified index. + * @param index The index of the feature to select. + */ + select(index: number): void; + /** Go to the next feature. */ + selectNext(): void; + /** Go to the previous feature. */ + selectPrevious(): void; + /** + * Set the content for the info window. + * @param content The content for the info window. + */ + setContent(content: string): void; + /** + * Set the content for the info window. + * @param content The content for the info window. + */ + setContent(content: Function): void; + /** + * Associate an array of features or an array of deferreds that return features with the info window. + * @param features An array of features or deferreds. + */ + setFeatures(features: Graphic[]): any; + /** + * Associate an array of features or an array of deferreds that return features with the info window. + * @param features An array of features or deferreds. + */ + setFeatures(features: any[]): any; + /** + * Sets the info window title. + * @param title The text for the title. + */ + setTitle(title: string): void; + /** + * Sets the info window title. + * @param title The text for the title. + */ + setTitle(title: Function): void; + /** + * Display the info window at the specified location. + * @param location An instance of esri.geometry.Point that represents the geographic location to display the popup. + */ + show(location: Point): void; + /** Finalizes the creation of the widget. */ + startup(): void; + /** Fired when clearFeatures is called. */ + on(type: "clear-features", listener: (event: { target: PopupMobile }) => void): esri.Handle; + /** Fired when the info window is hidden. */ + on(type: "hide", listener: (event: { target: PopupMobile }) => void): esri.Handle; + /** Fired when the selection changes. */ + on(type: "selection-change", listener: (event: { target: PopupMobile }) => void): esri.Handle; + /** Fired after registering an array of features. */ + on(type: "set-features", listener: (event: { target: PopupMobile }) => void): esri.Handle; + /** Fired when the info window becomes visible. */ + on(type: "show", listener: (event: { target: PopupMobile }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = PopupMobile; +} + +declare module "esri/dijit/PopupTemplate" { + import esri = require("esri"); + import InfoTemplate = require("esri/InfoTemplate"); + + /** The PopupTemplate class extends esri/InfoTemplate and provides support for defining a layout. */ + class PopupTemplate extends InfoTemplate { + /** The popup definition defined as a JavaScript object. */ + info: any; + /** + * Create a new PopupTemplate object. + * @param popupInfo An object that defines popup content. + * @param options Optional parameters. + */ + constructor(popupInfo: any, options?: esri.PopupTemplateOptions); + } + export = PopupTemplate; +} + +declare module "esri/dijit/Print" { + import esri = require("esri"); + import PrintTemplate = require("esri/tasks/PrintTemplate"); + + /** The Print widget simplifies the process of printing a map using a default or user-defined layout. */ + class Print { + /** + * Creates a new Print widget. + * @param params Parameters for the print widget. + * @param srcNodeRef HTML element where the print widget button and drop down list will be rendered. + */ + constructor(params: esri.PrintOptions, srcNodeRef: Node); + /** + * Creates a new Print widget. + * @param params Parameters for the print widget. + * @param srcNodeRef HTML element where the print widget button and drop down list will be rendered. + */ + constructor(params: esri.PrintOptions, srcNodeRef: string); + /** Destroys the print widget. */ + destroy(): void; + /** Hide the print widget. */ + hide(): void; + /** + * User can call this function so that it programatically print the map. + * @param template Print template. + */ + printMap(template: PrintTemplate): void; + /** Set the print widget's visibility to true. */ + show(): void; + /** Finalizes the creation of the print widget. */ + startup(): void; + /** Fired when an error occurs during the print request. */ + on(type: "error", listener: (event: { error: Error; target: Print }) => void): esri.Handle; + /** Fired when the print job has succeeded. */ + on(type: "print-complete", listener: (event: { value: any; target: Print }) => void): esri.Handle; + /** Fired when the request is sent to the print service. */ + on(type: "print-start", listener: (event: { target: Print }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = Print; +} + +declare module "esri/dijit/RendererSlider" { + import esri = require("esri"); + + /** The base slider class for all Subclass Slider widgets listed below. */ + class RendererSlider { + /** Absolute maximum value allowed by the slider. */ + maximum: number; + /** Top label for the slider. */ + maxLabel: string; + /** Absolute minimum value allowed by the slider. */ + minimum: number; + /** Bottom label for the slider. */ + minLabel: string; + /** Accuracy of the data (related to rounding). */ + precision: number; + /** Toggle for showing the black handle bars. */ + showHandles: boolean; + /** Flexible toggle for showing labels e.g. */ + showLabels: any; + /** Toggle for showing the horizontal line indicators from the center of the handle. */ + showTicks: boolean; + /** Handle positions represented as numbers that fall between minimum and maximum. */ + values: number[]; + /** + * Creates a new RendererSlider widget. + * @param params Set of parameters used to specify the RendererSlider widget options. + * @param srcNodeRef Reference or ID of the HTMLElement where the widget should be rendered. + */ + constructor(params: esri.RendererSliderOptions, srcNodeRef: Node); + /** + * Creates a new RendererSlider widget. + * @param params Set of parameters used to specify the RendererSlider widget options. + * @param srcNodeRef Reference or ID of the HTMLElement where the widget should be rendered. + */ + constructor(params: esri.RendererSliderOptions, srcNodeRef: string); + /** Finalizes the creation of the widget. */ + startup(): void; + /** Fires when the user actively slides the handle. */ + on(type: "slide", listener: (event: { values: number[]; target: RendererSlider }) => void): esri.Handle; + /** Fires when the user lets go of the handle. */ + on(type: "stop", listener: (event: { values: number[]; target: RendererSlider }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = RendererSlider; +} + +declare module "esri/dijit/Scalebar" { + import esri = require("esri"); + + /** The Scalebar widget displays a scalebar on the map or in a specified HTML node. */ + class Scalebar { + /** + * Creates a new Scalebar dijit. + * @param params Parameters used to configure the widget. + * @param srcNodeRef Reference or id of the HTML element where the widget should be rendered. + */ + constructor(params: esri.ScalebarOptions, srcNodeRef?: Node); + /** + * Creates a new Scalebar dijit. + * @param params Parameters used to configure the widget. + * @param srcNodeRef Reference or id of the HTML element where the widget should be rendered. + */ + constructor(params: esri.ScalebarOptions, srcNodeRef?: string); + /** Destroy the scalebar. */ + destroy(): void; + /** Hide the scalebar dijit. */ + hide(): void; + /** Set the scalebar's visibility to true. */ + show(): void; + /** Finalizes the creation of the widget. */ + startup(): void; + } + export = Scalebar; +} + +declare module "esri/dijit/Search" { + import esri = require("esri"); + import Layer = require("esri/layers/layer"); + import Graphic = require("esri/graphic"); + import InfoTemplate = require("esri/InfoTemplate"); + import TextSymbol = require("esri/symbols/TextSymbol"); + import Map = require("esri/map"); + import Geometry = require("esri/geometry/Geometry"); + + /** The Search widget provides a way to perform search capabilities based on locator service(s) and/or map/feature service feature layer(s). */ + class Search { + /** Read-only property of the source object currently selected. */ + activeSource: any; + /** The currently selected source. */ + activeSourceIndex: number; + /** Indicates whether to automatically add all the feature layers from the map. */ + addLayersFromMap: boolean; + /** Indicates whether to automatically navigate to the selected result. */ + autoNavigate: boolean; + /** Indicates whether to automatically select the first result. */ + autoSelect: boolean; + /** Indicates whether to enable an option to collapse/expand the search into a button. */ + enableButtonMode: boolean; + /** Show the selected feature on the map using a default symbol determined by the source's geometry type. */ + enableHighlight: boolean; + /** Indicates whether to display the infoWindow on feature click. */ + enableInfoWindow: boolean; + /** Indicates whether to enable showing a label for the geometry. */ + enableLabel: boolean; + /** Indicates whether to enable the menu for selecting different sources. */ + enableSourcesMenu: boolean; + /** Enable suggestions for the widget. */ + enableSuggestions: boolean; + /** Indicates whether to display suggest results. */ + enableSuggestionsMenu: boolean; + /** Indicates whether to set the state of the enableButtonMode to expanded (true) or collapsed (false). */ + expanded: boolean; + /** This is the specified graphicsLayer to use for the highlightGraphic and labelGraphic instead of map.graphics. */ + graphicsLayer: Layer; + /** Read-only property indicating the highlighted location graphic. */ + highlightGraphic: Graphic; + /** A customized infoTemplate for the selected feature. */ + infoTemplate: InfoTemplate; + /** Read-only graphic property for the text label. */ + labelGraphic: Graphic; + /** The text symbol for the label graphic. */ + labelSymbol: TextSymbol; + /** Read-only property indicating whether the widget is loaded. */ + loaded: boolean; + /** The default distance specified in meters used to reverse geocode (if not specified by source). */ + locationToAddressDistance: number; + /** Reference to the map. */ + map: Map; + /** The default maximum number of results returned by the widget if not specified by source. */ + maxResults: number; + /** The default maximum number of suggestions returned by the widget if not specified by source. */ + maxSuggestions: number; + /** The default minimum number of characters needed for the search if not specified by source. */ + minCharacters: number; + /** Read-only property that returns an array of current results from the search. */ + searchResults: any[]; + /** Indicates whether to show the infoWindow when a result is selected. */ + showInfoWindowOnSelect: boolean; + /** An array of source objects used to find search results. */ + sources: any[]; + /** The millisecond delay after keyup and before making a suggest network request. */ + suggestionDelay: number; + /** Read-only property that returns an array of current results from the suggest. */ + suggestResults: any[]; + /** The CSS class selector used to uniquely style the widget. */ + theme: string; + /** The current value of the search box input text string. */ + value: string; + /** Indicate whether to show the widget. */ + visible: boolean; + /** If the result does not have an associated extent, specify this number to use as the zoom scale for the result. */ + zoomScale: number; + /** + * Create a new Search widget using the given DOM node. + * @param options Set of options used to specify Search options. + * @param srcNode Reference or id of the HTML element where the widget should be rendered. + */ + constructor(options: esri.SearchOptions, srcNode: Node); + /** + * Create a new Search widget using the given DOM node. + * @param options Set of options used to specify Search options. + * @param srcNode Reference or id of the HTML element where the widget should be rendered. + */ + constructor(options: esri.SearchOptions, srcNode: string); + /** Unfocus the widget's text input. */ + blur(): void; + /** Clears the current value, search results, suggest results, graphic, and/or graphics layer. */ + clear(): void; + /** Closes the widget from button mode. */ + collapse(): void; + /** Destroys the Search widget. */ + destroy(): void; + /** Opens the widget from button mode. */ + expand(): void; + /** Brings focus to the widget's text input. */ + focus(): void; + /** + * Get the value of the property from the Search widget. + * @param name String value indicating the property to get. + */ + get(name: string): any; + /** Hides the Search widget. */ + hide(): void; + /** + * Depending on the sources specified, search() queries the feature layer(s) and/or performs address matching using any specified Locator(s) and returns any applicable results. + * @param value This value can be a string, geometry, suggest candidate object, or an array of [latitude,longitude]. + */ + search(value?: string): any; + /** + * Depending on the sources specified, search() queries the feature layer(s) and/or performs address matching using any specified Locator(s) and returns any applicable results. + * @param value This value can be a string, geometry, suggest candidate object, or an array of [latitude,longitude]. + */ + search(value?: Geometry): any; + /** + * Depending on the sources specified, search() queries the feature layer(s) and/or performs address matching using any specified Locator(s) and returns any applicable results. + * @param value This value can be a string, geometry, suggest candidate object, or an array of [latitude,longitude]. + */ + search(value?: any): any; + /** + * Depending on the sources specified, search() queries the feature layer(s) and/or performs address matching using any specified Locator(s) and returns any applicable results. + * @param value This value can be a string, geometry, suggest candidate object, or an array of [latitude,longitude]. + */ + search(value?: any[]): any; + /** + * Selects a result. + * @param value The result object to select. + */ + select(value: any): void; + /** + * Set the value of a non "read-only" property from the widget. + * @param name The string value to set. + */ + set(name: string): any; + /** Show the Search widget. */ + show(): void; + /** Finalizes the creation of the Search widget. */ + startup(): void; + /** + * Performs a suggest() request on the active Locator. + * @param value The string value used to suggest() on an active Locator. + */ + suggest(value?: string): any; + /** Fired when the widget's text input loses focus. */ + on(type: "blur", listener: (event: { target: Search }) => void): esri.Handle; + /** Fired when a result is cleared from the input box or a new result is selected. */ + on(type: "clear-search", listener: (event: { target: Search }) => void): esri.Handle; + /** Fired when the widget's text input sets focus. */ + on(type: "focus", listener: (event: { target: Search }) => void): esri.Handle; + /** Fired when the search widget has fully loaded. */ + on(type: "load", listener: (event: { target: Search }) => void): esri.Handle; + /** Fired when the search method is called and returns its results. */ + on(type: "search-results", listener: (event: { activeSourceIndex: number; error: Error; numResults: number; results: any; value: string; target: Search }) => void): esri.Handle; + /** Fired when a search result is selected. */ + on(type: "select-result", listener: (event: { result: any; source: any; sourceIndex: number; target: Search }) => void): esri.Handle; + /** Fired when the suggest method is called and returns its results. */ + on(type: "suggest-results", listener: (event: { activeSourceIndex: number; error: Error; numResults: number; results: any; value: string; target: Search }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = Search; +} + +declare module "esri/dijit/SizeInfoSlider" { + import esri = require("esri"); + import RendererSlider = require("esri/dijit/RendererSlider"); + + class SizeInfoSlider extends RendererSlider { + /** Optional. */ + classificationMethod: string; + /** Required. */ + handles: number[]; + /** Optional. */ + histogram: any; + /** Optional. */ + histogramWidth: boolean; + /** Optional. */ + maxValue: number; + /** Optional. */ + minValue: number; + /** Optional. */ + normalizationType: string; + /** Optional. */ + primaryHandle: number; + /** Optional */ + rampWidth: number; + /** Property for showing handles. */ + showHandles: boolean; + /** Optional. */ + showHistogram: boolean; + /** Property for showing labels. */ + showLabels: boolean; + /** Property for showing ticks. */ + showTicks: boolean; + /** Required. */ + sizeInfo: any; + /** Optional. */ + statistics: any; + /** Optional. */ + zoomOptions: any; + /** + * Creates a new SizeInfoSlider widget. + * @param params Set of parameters used to specify the SizeInfoSlider widget options. + * @param srcNodeRef Reference or ID of the HTMLElement where the widget should be rendered. + */ + constructor(params: esri.SizeInfoSliderOptions, srcNodeRef: Node); + /** + * Creates a new SizeInfoSlider widget. + * @param params Set of parameters used to specify the SizeInfoSlider widget options. + * @param srcNodeRef Reference or ID of the HTMLElement where the widget should be rendered. + */ + constructor(params: esri.SizeInfoSliderOptions, srcNodeRef: string); + /** Finalizes the creation of the widget. */ + startup(): void; + /** Fires when the SizeInfoSlider properties change. */ + on(type: "change", listener: (event: { sizeInfo: any; target: SizeInfoSlider }) => void): esri.Handle; + /** Fires when minValue or maxValue of SizeInfoSlider change. */ + on(type: "data-value-change", listener: (event: { maxValue: number; minValue: number; sizeInfo: any; target: SizeInfoSlider }) => void): esri.Handle; + /** Fires when a SizeInfoSlider handle is moved. */ + on(type: "handle-value-change", listener: (event: { sizeInfo: any; target: SizeInfoSlider }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = SizeInfoSlider; +} + +declare module "esri/dijit/SymbolStyler" { + import esri = require("esri"); + import Symbol = require("esri/symbols/Symbol"); + + /** A widget that assist with applying properties to Symbols. */ + class SymbolStyler { + /** Read-only: Returns the name of the currently active tab. */ + activeTab: string; + /** + * Creates a new SymbolStyler widget. + * @param params Set of parameters used to specify the SymbolStyler widget options. + * @param srcNodeRef Reference or ID of the HTMLElement where the widget should be rendered. + */ + constructor(params: esri.SymbolStylerOptions, srcNodeRef: Node); + /** + * Creates a new SymbolStyler widget. + * @param params Set of parameters used to specify the SymbolStyler widget options. + * @param srcNodeRef Reference or ID of the HTMLElement where the widget should be rendered. + */ + constructor(params: esri.SymbolStylerOptions, srcNodeRef: string); + /** + * Sets the symbol to edit. + * @param symbol Symbol to edit. + * @param options Styling options. + */ + edit(symbol: Symbol, options: any): void; + /** Returns the current style. */ + getStyle(): any; + /** Finalizes the creation of the widget. */ + startup(): void; + /** Saves the recent fill and outline colors. */ + storeColors(): void; + } + export = SymbolStyler; +} + +declare module "esri/dijit/TimeSlider" { + import esri = require("esri"); + import TimeExtent = require("esri/TimeExtent"); + + /** The TimeSlider widget is used for visualizing content within a map that contains time-aware layers. */ + class TimeSlider { + /** Default value is false. */ + loop: boolean; + /** Default value is false. */ + playing: boolean; + /** Default value is 1. */ + thumbCount: number; + /** Rate at which the time animation plays. */ + thumbMovingRate: number; + /** An array of dates representing the stops (tics) on the TimeSlider. */ + timeStops: Date[]; + /** + * Creates a new TimeSlider object. + * @param params Parameters for the time slider object. + * @param srcNodeRef HTML element where the time slider should be rendered. + */ + constructor(params: esri.TimeSliderOptions, srcNodeRef: Node); + /** + * Creates a new TimeSlider object. + * @param params Parameters for the time slider object. + * @param srcNodeRef HTML element where the time slider should be rendered. + */ + constructor(params: esri.TimeSliderOptions, srcNodeRef: string); + /** + * The specified number of time stops are created for the input time extent. + * @param timeExtent The time extent used to define the time slider's start and end time stops. + * @param count The number of time stops to create. + */ + createTimeStopsByCount(timeExtent: TimeExtent, count?: number): void; + /** + * Create a time stop for each interval specified, i.e., (week, month, day). + * @param timeExtent The time extent used to define the time slider's start and end time stops. + * @param timeInterval The length of the time interval. + * @param timeIntervalUnits Valid values are listed in the TimeInfo constants table. + */ + createTimeStopsByTimeInterval(timeExtent: TimeExtent, timeInterval?: number, timeIntervalUnits?: string): void; + /** Gets the current time extent for the time slider. */ + getCurrentTimeExtent(): TimeExtent; + /** Move to the next time step. */ + next(): void; + /** Pause the time slider. */ + pause(): void; + /** Play the time slider. */ + play(): void; + /** Move to the previous time step. */ + previous(): void; + /** + * Specify an array of strings to be used as labels. + * @param labels An array of strings that define the labels for each tick. + */ + setLabels(labels: string[]): void; + /** + * Determines whether or not loop. + * @param loop True plays the time slider continuously. + */ + setLoop(loop: boolean): void; + /** + * The number of thumbs to display. + * @param thumbCount The number of thumbs to display. + */ + setThumbCount(thumbCount: number): void; + /** + * Array of two integers, the first value determines where to put the first thumb. + * @param indexes Array of two integers. + */ + setThumbIndexes(indexes: number[]): void; + /** + * Change the rate at which the time animation plays. + * @param thumbMovingRate The rate at which the time slider plays. + */ + setThumbMovingRate(thumbMovingRate: number): void; + /** + * Specify the number of ticks to display on the time slider. + * @param count The number of ticks to display on the slider. + */ + setTickCount(count: number): void; + /** + * Manually define the time stop locations by providing an array of dates. + * @param timeStops Array of dates + */ + setTimeStops(timeStops: Date[]): void; + /** + * Determine if the time is displayed for an instant in time. + * @param createTimeInstants When true, the time slider displays features for the current point in time. + */ + singleThumbAsTimeInstant(createTimeInstants: boolean): void; + /** Finalizes the creation of the widget. */ + startup(): void; + /** Fires when the timeExtent of the TimeSlider is changed. */ + on(type: "time-extent-change", listener: (event: { timeExtent: TimeExtent; target: TimeSlider }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = TimeSlider; +} + +declare module "esri/dijit/VisibleScaleRangeSlider" { + import esri = require("esri"); + import FeatureLayer = require("esri/layers/FeatureLayer"); + import Map = require("esri/map"); + + /** A widget that helps set the visible scale range for a layer. */ + class VisibleScaleRangeSlider { + /** Setting the layer will update the suggested scale range, minScale and maxScale. */ + layer: FeatureLayer; + /** Setting this property will update the slider's minimum/maximum values and current scale indicator. */ + map: Map; + /** Read-only: The maxScale bound in the slider range */ + maximum: number; + /** The current maxScale value. */ + maxScale: number; + /** Read-only: The minScale bound in the slider range. */ + minimum: number; + /** The current minScale value. */ + minScale: number; + /** + * Creates a new VisibleScaleRangeSlider widget. + * @param params Set of parameters used to specify the VisibleScaleRangeSlider widget options. + * @param srcNodeRef Reference or ID of the HTMLElement where the widget should be rendered. + */ + constructor(params: any, srcNodeRef: Node); + /** + * Creates a new VisibleScaleRangeSlider widget. + * @param params Set of parameters used to specify the VisibleScaleRangeSlider widget options. + * @param srcNodeRef Reference or ID of the HTMLElement where the widget should be rendered. + */ + constructor(params: any, srcNodeRef: string); + /** Finalizes the creation of the widget. */ + startup(): void; + /** Dispatched whenever minScale or maxScale changes. */ + on(type: "scale-range-change", listener: (event: { target: VisibleScaleRangeSlider }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = VisibleScaleRangeSlider; +} + +declare module "esri/dijit/analysis/AggregatePoints" { + import esri = require("esri"); + import AnalysisBase = require("esri/dijit/analysis/AnalysisBase"); + import Map = require("esri/map"); + import FeatureLayer = require("esri/layers/FeatureLayer"); + + /** The AggregatePoints widget works with point feature layer and a polygon feature layer. */ + class AggregatePoints extends AnalysisBase { + /** A field name from pointLayer based on which the points will be grouped. */ + groupByField: string; + /** When true, the polygons that have no points within them will be returned in the output. */ + keepBoundariesWithNoPoints: boolean; + /** Reference to the map object. */ + map: Map; + /** When true, two fields will be added to your result layer to indicate which attribute values within each group are the minority (least dominant) or the majority (most dominant) within each boundary. */ + minorityMajority: boolean; + /** The name of the output layer to be shown in the Result layer name inputbox. */ + outputLayerName: string; + /** When true, a new field will be added to the result table containing the percentages of each attribute value within each group. */ + percentPoints: boolean; + /** The point feature layer that will be aggregated into the polygons in the polygon feature layer. */ + pointLayer: FeatureLayer; + /** The polygon layer to be shown selected in in the Choose area menu. */ + polygonLayer: FeatureLayer; + /** An array of feature layer candidates to be selected as the input polygon layer. */ + polygonLayers: FeatureLayer[]; + /** When true, returns the result of analysis as a client-side feature collection. */ + returnFeatureCollection: boolean; + /** When true, the choose extent checkbox will be shown. */ + showChooseExtent: boolean; + /** When true, the show credit option is visible. */ + showCredits: boolean; + /** When true, the help links will be shown. */ + showHelp: boolean; + /** When true, the select folder dropdown will be shown. */ + showSelectFolder: boolean; + /** An array of attribute field names and statistic types that you would like to aggregate for all points within each polygon. */ + summaryFields: string[]; + /** + * Creates a new AggregatePoints dijit using the given DOM node. + * @param params Various options to configure this dijit. + * @param srcNodeRef Reference or id of a HTML element that this dijit is rendered into. + */ + constructor(params: esri.AggregatePointsOptions, srcNodeRef: Node); + /** + * Creates a new AggregatePoints dijit using the given DOM node. + * @param params Various options to configure this dijit. + * @param srcNodeRef Reference or id of a HTML element that this dijit is rendered into. + */ + constructor(params: esri.AggregatePointsOptions, srcNodeRef: string); + /** Finalizes the creation of the widget. */ + startup(): void; + } + export = AggregatePoints; +} + +declare module "esri/dijit/analysis/AnalysisBase" { + import esri = require("esri"); + + /** The AnalysisBase widget is the base class for all other widgets under esri/dijit/analysis. */ + class AnalysisBase { + /** The URL to the analysis service, for example "http://analysis.arcgis.com/arcgis/rest/services/tasks/GPServer". */ + analysisGpServer: string; + /** Sets the selected folder of the select folder dropdown, based on the provided folderId, when showSelectFolder is true. */ + folderId: string; + /** Sets the selected folder of the select folder dropdown, based on the provided folderName, when showSelectFolder is true. */ + folderName: string; + /** The URL to the ArcGIS.com site or in-house portal where the GP server is hosted, for example "http://www.arcgis.com". */ + portalUrl: string; + /** + * Cancels an analysis job that is being processed. + * @param jobInfo An object containing job information including job ID, status, message, etc returned by the job-status event. + */ + cancel(jobInfo: any): void; + /** + * Starts checking the analysis job status for the given jobId. + * @param jobId Job id of the analysis job to check. + */ + checkJobStatus(jobId: string): void; + /** + * Starts an analysis tool. + * @param params See the object specifications table below for the structure of the params object. + */ + execute(params: string): void; + /** + * Gets credits estimate for a specific analysis job. + * @param toolName The name of the analysis tool from which a credits estimate will be returned. + * @param jobParams The input job parameters. + */ + getCreditsEstimate(toolName: string, jobParams: string): any; + /** Fires when close icon is clicked or when run analysis button is clicked. */ + on(type: "close", listener: (event: { target: AnalysisBase }) => void): esri.Handle; + /** Fires when the drawn boundaries option is activated. */ + on(type: "drawtool-activate", listener: (event: { target: AnalysisBase }) => void): esri.Handle; + /** Fires when the drawn boundaries option is deactivated. */ + on(type: "drawtool-deactivate", listener: (event: { target: AnalysisBase }) => void): esri.Handle; + /** Fires when the job in cancelled. */ + on(type: "job-cancel", listener: (event: { response: any; target: AnalysisBase }) => void): esri.Handle; + /** Fires when the job fails. */ + on(type: "job-fail", listener: (event: { error: any; target: AnalysisBase }) => void): esri.Handle; + /** Fires after the job fetches result data. */ + on(type: "job-result", listener: (event: { result: any; target: AnalysisBase }) => void): esri.Handle; + /** Fires when the job execution status is received. */ + on(type: "job-status", listener: (event: { jobInfo: any; target: AnalysisBase }) => void): esri.Handle; + /** Fires when the job is submitted to the server for asynchronous processing. */ + on(type: "job-submit", listener: (event: { params: any; target: AnalysisBase }) => void): esri.Handle; + /** Fires when the job succeeds. */ + on(type: "job-success", listener: (event: { jobInfo: any; target: AnalysisBase }) => void): esri.Handle; + /** Fires when the execute method is called. */ + on(type: "start", listener: (event: { params: any; target: AnalysisBase }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = AnalysisBase; +} + +declare module "esri/dijit/analysis/CalculateDensity" { + import AnalysisBase = require("esri/dijit/analysis/AnalysisBase"); + import FeatureLayer = require("esri/layers/FeatureLayer"); + + /** Create a density map from point or line features by spreading known quantities of some phenomenon (represented as attributes of the points or lines) across the map. */ + class CalculateDensity extends AnalysisBase { + /** Possible values are "SquareMiles" or "SquareKilometers". */ + areaUnits: string; + /** A layer specifying the area where you want densities to be calculated. */ + boundingPolygonLayer: FeatureLayer; + /** An array of feature layer candidates to be selected as the bounding polygon layer. */ + boundingPolygonLayers: FeatureLayer[]; + /** Classification type to use for the analysis. */ + classificationType: string; + /** The input point, line, or polygon feature layer. */ + inputLayer: FeatureLayer; + /** The number of classes (range of predicted values) in the result layer. */ + numClasses: number; + /** The name of the output layer to be shown in the Result layer name input box. */ + outputLayerName: string; + /** The distance specifying how far to search to find point or line features when calculating density values. */ + radius: number; + /** Possible values are Miles, Yards, Kilometers and Meters. */ + radiusUnits: string; + /** When true, returns the result of analysis as a client-side feature collection. */ + returnFeatureCollection: boolean; + /** When true, the choose extent checkbox will be shown. */ + showChooseExtent: boolean; + /** When true, the show credit option is visible. */ + showCredits: boolean; + /** When true, the help links will be shown. */ + showHelp: boolean; + /** When true, the select folder dropdown will be shown. */ + showSelectFolder: boolean; + /** + * Creates a new CalculateDensity dijit using the given DOM node. + * @param params Various options to configure this dijit. + * @param srcNodeRef Reference or id of a HTML element that this dijit is rendered into. + */ + constructor(params: any, srcNodeRef: Node); + /** + * Creates a new CalculateDensity dijit using the given DOM node. + * @param params Various options to configure this dijit. + * @param srcNodeRef Reference or id of a HTML element that this dijit is rendered into. + */ + constructor(params: any, srcNodeRef: string); + /** Finalizes the creation of the widget. */ + startup(): void; + } + export = CalculateDensity; +} + +declare module "esri/dijit/analysis/ConnectOriginsToDestinations" { + import esri = require("esri"); + import AnalysisBase = require("esri/dijit/analysis/AnalysisBase"); + import FeatureLayer = require("esri/layers/FeatureLayer"); + import Map = require("esri/map"); + + /** Measure the travel time or distance between pairs of points. */ + class ConnectOriginsToDestinations extends AnalysisBase { + /** The linear unit used with the distance value(s). */ + distanceDefaultUnits: string; + /** When true, Travel Modes (Driving Distance, Driving Time) are enabled for analysisLayer with point geometries. */ + enableTravelModes: boolean; + /** An array of feature layers containing destination points. */ + featureLayers: FeatureLayer[]; + /** References the map object. */ + map: Map; + /** The point feature layer containing the origin points. */ + originsLayer: FeatureLayer; + /** The name of the output layer to be shown in the Result layer name input box. */ + outputLayerName: string; + /** When true, returns the result of analysis as a client-side feature collection. */ + returnFeatureCollection: boolean; + /** When true, the choose extent checkbox will be shown. */ + showChooseExtent: boolean; + /** When true, the show credit option is visible. */ + showCredits: boolean; + /** When true, the help links will be shown. */ + showHelp: boolean; + /** When true, the select folder dropdown will be shown. */ + showSelectFolder: boolean; + /** + * Creates a new ConnectOriginsToDestinations dijit using the given DOM node. + * @param params Various options to configure this dijit. + * @param srcNodeRef Reference or id of a HTML element that this dijit is rendered into. + */ + constructor(params: esri.ConnectOriginsToDestinationsOptions, srcNodeRef: Node); + /** + * Creates a new ConnectOriginsToDestinations dijit using the given DOM node. + * @param params Various options to configure this dijit. + * @param srcNodeRef Reference or id of a HTML element that this dijit is rendered into. + */ + constructor(params: esri.ConnectOriginsToDestinationsOptions, srcNodeRef: string); + /** Finalizes the creation of the widget. */ + startup(): void; + } + export = ConnectOriginsToDestinations; +} + +declare module "esri/dijit/analysis/CreateBuffers" { + import esri = require("esri"); + import AnalysisBase = require("esri/dijit/analysis/AnalysisBase"); + import FeatureLayer = require("esri/layers/FeatureLayer"); + import Map = require("esri/map"); + + /** The CreateBuffers widget creates polygons that cover a given distance from an input point, line, or polygon feature layer. */ + class CreateBuffers extends AnalysisBase { + /** An array of buffer distances to buffer the input feature layer. */ + bufferDistance: number[]; + /** The input point, line, or polygon feature layer to be buffered. */ + inputLayer: FeatureLayer; + /** Reference to the map object. */ + map: Map; + /** The name of the output layer to be shown in the Result layer name inputbox. */ + outputLayerName: string; + /** When true, returns the result of analysis as a client-side feature collection. */ + returnFeatureCollection: boolean; + /** When true, the choose extent checkbox will be shown. */ + showChooseExtent: boolean; + /** When true, the show credit option is visible. */ + showCredits: boolean; + /** When true, the help links will be shown. */ + showHelp: boolean; + /** When true, the select folder dropdown will be shown. */ + showSelectFolder: boolean; + /** The linear unit to be used with the distance value(s). */ + units: string; + /** + * Creates a new CreateBuffers dijit using the given DOM node. + * @param params Various options to configure this dijit. + * @param srcNodeRef Reference or id of a HTML element that this dijit is rendered into. + */ + constructor(params: esri.CreateBuffersOptions, srcNodeRef: Node); + /** + * Creates a new CreateBuffers dijit using the given DOM node. + * @param params Various options to configure this dijit. + * @param srcNodeRef Reference or id of a HTML element that this dijit is rendered into. + */ + constructor(params: esri.CreateBuffersOptions, srcNodeRef: string); + /** Finalizes the creation of the widget. */ + startup(): void; + } + export = CreateBuffers; +} + +declare module "esri/dijit/analysis/CreateDriveTimeAreas" { + import esri = require("esri"); + import AnalysisBase = require("esri/dijit/analysis/AnalysisBase"); + import FeatureLayer = require("esri/layers/FeatureLayer"); + import Map = require("esri/map"); + + /** The CreateDriveTimeAreas widget creates drive-time (or drive-distance) polygons around input points for the given drive-time values. */ + class CreateDriveTimeAreas extends AnalysisBase { + /** The units of the breakValues parameter. */ + breakUnits: string; + /** An array of driving time break values. */ + breakValues: number[]; + /** The point feature layer around which drive-time areas will be drawn. */ + inputLayer: FeatureLayer; + /** The geometry type of the input layer. */ + inputType: string; + /** Reference to the map object. */ + map: Map; + /** The name of the output layer to be shown in the Result layer name inputbox. */ + outputLayerName: string; + /** The rule of overlap. */ + overlapPolicy: string; + /** When true, returns the result of analysis as a client-side feature collection. */ + returnFeatureCollection: boolean; + /** When true, the choose extent checkbox will be shown. */ + showChooseExtent: boolean; + /** When true, the show credit option is visible. */ + showCredits: boolean; + /** When true, the help links will be shown. */ + showHelp: boolean; + /** When true, the select folder dropdown will be shown. */ + showSelectFolder: boolean; + /** + * Creates a new CreateDriveTimeAreas dijit using the given DOM node. + * @param params Various options to configure this dijit. + * @param srcNodeRef Reference or id of a HTML element that this dijit is rendered into. + */ + constructor(params: esri.CreateDriveTimeAreasOptions, srcNodeRef: Node); + /** + * Creates a new CreateDriveTimeAreas dijit using the given DOM node. + * @param params Various options to configure this dijit. + * @param srcNodeRef Reference or id of a HTML element that this dijit is rendered into. + */ + constructor(params: esri.CreateDriveTimeAreasOptions, srcNodeRef: string); + /** Finalizes the creation of the widget. */ + startup(): void; + } + export = CreateDriveTimeAreas; +} + +declare module "esri/dijit/analysis/CreateViewshed" { + import esri = require("esri"); + import AnalysisBase = require("esri/dijit/analysis/AnalysisBase"); + import FeatureLayer = require("esri/layers/FeatureLayer"); + import Map = require("esri/map"); + + /** Creates areas that are visible based on locations you specify. */ + class CreateViewshed extends AnalysisBase { + /** Feature layer containing points representing observation points. */ + inputLayer: FeatureLayer; + /** Reference to the map object. */ + map: Map; + /** The linear units to use for the 'maximumDistance' value. */ + maxDistanceUnits: string; + /** The cutoff distance where the computation of visible areas stops. */ + maximumDistance: number; + /** The height above ground of your analysis points. */ + observerHeight: number; + /** The linear units to use for the 'observerHeight' value. */ + observerHeightUnits: string; + /** The name of the output layer to be shown in the Result layer name input box. */ + outputLayerName: string; + /** When true, returns the result of analysis as a client-side feature collection. */ + returnFeatureCollection: boolean; + /** When true, the choose extent checkbox will be shown. */ + showChooseExtent: boolean; + /** When true, the show credit option is visible. */ + showCredits: boolean; + /** When true, the help links will be shown. */ + showHelp: boolean; + /** When true, the select folder dropdown will be shown. */ + showSelectFolder: boolean; + /** The height of structures or people on the ground used to establish visibility. */ + targetHeight: number; + /** The linear units to use for the 'targetHeight' value. */ + targetHeightUnits: string; + /** + * Creates a new CreateViewshed dijit using the given DOM node. + * @param params Various options to configure this dijit. + * @param srcNodeRef Reference or id of a HTML element that this dijit is rendered into. + */ + constructor(params: esri.CreateViewshedOptions, srcNodeRef: Node); + /** + * Creates a new CreateViewshed dijit using the given DOM node. + * @param params Various options to configure this dijit. + * @param srcNodeRef Reference or id of a HTML element that this dijit is rendered into. + */ + constructor(params: esri.CreateViewshedOptions, srcNodeRef: string); + /** Finalizes the creation of the widget. */ + startup(): void; + } + export = CreateViewshed; +} + +declare module "esri/dijit/analysis/CreateWatersheds" { + import esri = require("esri"); + import AnalysisBase = require("esri/dijit/analysis/AnalysisBase"); + import FeatureLayer = require("esri/layers/FeatureLayer"); + import Map = require("esri/map"); + + /** Creates catchment areas based on locations you specify. */ + class CreateWatersheds extends AnalysisBase { + /** The input feature layer containing points used to calculate watersheds. */ + inputLayer: FeatureLayer; + /** Reference to the map object. */ + map: Map; + /** The name of the output layer to be shown in the Result layer name input box. */ + outputLayerName: string; + /** When true, returns the result of analysis as a client-side feature collection. */ + returnFeatureCollection: boolean; + /** The default unit provided to the user for searching a specified distance from the origin points to their nearest drainages. */ + searchUnits: string; + /** When true, the choose extent checkbox will be shown. */ + showChooseExtent: boolean; + /** When true, the show credit option is visible. */ + showCredits: boolean; + /** When true, the help links will be shown. */ + showHelp: boolean; + /** When true, the select folder dropdown will be shown. */ + showSelectFolder: boolean; + /** + * Creates a new CreateWatersheds dijit using the given DOM node. + * @param params Various options to configure this dijit. + * @param srcNodeRef Reference or id of a HTML element that this dijit is rendered into. + */ + constructor(params: esri.CreateWatershedsOptions, srcNodeRef: Node); + /** + * Creates a new CreateWatersheds dijit using the given DOM node. + * @param params Various options to configure this dijit. + * @param srcNodeRef Reference or id of a HTML element that this dijit is rendered into. + */ + constructor(params: esri.CreateWatershedsOptions, srcNodeRef: string); + /** Finalizes the creation of the widget. */ + startup(): void; + } + export = CreateWatersheds; +} + +declare module "esri/dijit/analysis/DeriveNewLocations" { + import AnalysisBase = require("esri/dijit/analysis/AnalysisBase"); + import FeatureLayer = require("esri/layers/FeatureLayer"); + + /** Derive new features from the input layers that meet a query you specify. */ + class DeriveNewLocations extends AnalysisBase { + /** The analysis layer to derive new locations from. */ + analysisLayer: FeatureLayer; + /** An array of feature layers to use as input. */ + inputLayers: FeatureLayer[]; + /** The name of the output layer to be shown in the Result layer name input box. */ + outputLayerName: string; + /** When true, returns the result of analysis as a client-side feature collection. */ + returnFeatureCollection: boolean; + /** When true, the choose extent checkbox will be shown. */ + showChooseExtent: boolean; + /** When true, the show credit option is visible. */ + showCredits: boolean; + /** When true, the help links will be shown. */ + showHelp: boolean; + /** When true, the select folder dropdown will be shown. */ + showSelectFolder: boolean; + /** + * Creates a new DeriveNewLocations dijit using the given DOM node. + * @param params Various options to configure this dijit. + * @param srcNodeRef Reference or id of a HTML element that this dijit is rendered into. + */ + constructor(params: any, srcNodeRef: Node); + /** + * Creates a new DeriveNewLocations dijit using the given DOM node. + * @param params Various options to configure this dijit. + * @param srcNodeRef Reference or id of a HTML element that this dijit is rendered into. + */ + constructor(params: any, srcNodeRef: string); + /** Finalizes the creation of the widget. */ + startup(): void; + } + export = DeriveNewLocations; +} + +declare module "esri/dijit/analysis/DissolveBoundaries" { + import esri = require("esri"); + import AnalysisBase = require("esri/dijit/analysis/AnalysisBase"); + import FeatureLayer = require("esri/layers/FeatureLayer"); + import Map = require("esri/map"); + + /** The DissolveBoundaries widget finds polygons that overlap or share a common boundary, and merges them together to form a single polygon. */ + class DissolveBoundaries extends AnalysisBase { + /** An array of field names based on which polygons are merged. */ + dissolveFields: string[]; + /** The layer containing polygon features that will be dissolved. */ + inputLayer: FeatureLayer; + /** Reference to the map object. */ + map: Map; + /** The name of the output layer to be shown in the Result layer name inputbox. */ + outputLayerName: string; + /** When true, returns the result of analysis as a client-side feature collection. */ + returnFeatureCollection: boolean; + /** When true, the choose extent checkbox will be shown. */ + showChooseExtent: boolean; + /** When true, the show credit option is visible. */ + showCredits: boolean; + /** When true, the help links will be shown. */ + showHelp: boolean; + /** When true, the select folder dropdown will be shown. */ + showSelectFolder: boolean; + /** An array of field names and statistical summary types that you wish to calculate from the polygons that are dissolved together. */ + summaryFields: string[]; + /** + * Creates a new DissolveBoundaries dijit using the given DOM node. + * @param params Various options to configure this dijit. + * @param srcNodeRef Reference or id of a HTML element that this dijit is rendered into. + */ + constructor(params: esri.DissolveBoundariesOptions, srcNodeRef: Node); + /** + * Creates a new DissolveBoundaries dijit using the given DOM node. + * @param params Various options to configure this dijit. + * @param srcNodeRef Reference or id of a HTML element that this dijit is rendered into. + */ + constructor(params: esri.DissolveBoundariesOptions, srcNodeRef: string); + /** Finalizes the creation of the widget. */ + startup(): void; + } + export = DissolveBoundaries; +} + +declare module "esri/dijit/analysis/EnrichLayer" { + import esri = require("esri"); + import AnalysisBase = require("esri/dijit/analysis/AnalysisBase"); + import FeatureLayer = require("esri/layers/FeatureLayer"); + import Map = require("esri/map"); + + /** The EnrichLayer widget enriches an input layer with facts about the people, places, and businesses nearby. */ + class EnrichLayer extends AnalysisBase { + /** An buffer distance or driving time value to buffer the input feature layer. */ + distance: number; + /** When true, Travel Modes (Driving Time) is enabled for inputLayer with point geometries (esriGeometryPoint). */ + enableTravelModes: boolean; + /** The input feature layer to enrich with new data. */ + inputLayer: FeatureLayer; + /** Reference to the map object. */ + map: Map; + /** The name of the output layer to be shown in the Result layer name inputbox. */ + outputLayerName: string; + /** When true, returns the result of analysis as a client-side feature collection. */ + returnFeatureCollection: boolean; + /** When true, the choose extent checkbox will be shown. */ + showChooseExtent: boolean; + /** When true, the show credit option is visible. */ + showCredits: boolean; + /** When true, the help links will be shown. */ + showHelp: boolean; + /** When true, the select folder dropdown will be shown. */ + showSelectFolder: boolean; + /** When true, you can specify a time for traffic condition under Define areas to enrich - Driving Time. */ + showTrafficWidget: boolean; + /** + * Creates a new EnrichLayer dijit using the given DOM node. + * @param params Various options to configure this dijit. + * @param srcNodeRef Reference or id of a HTML element that this dijit is rendered into. + */ + constructor(params: esri.EnrichLayerOptions, srcNodeRef: Node); + /** + * Creates a new EnrichLayer dijit using the given DOM node. + * @param params Various options to configure this dijit. + * @param srcNodeRef Reference or id of a HTML element that this dijit is rendered into. + */ + constructor(params: esri.EnrichLayerOptions, srcNodeRef: string); + /** Finalizes the creation of the widget. */ + startup(): void; + } + export = EnrichLayer; +} + +declare module "esri/dijit/analysis/ExtractData" { + import esri = require("esri"); + import AnalysisBase = require("esri/dijit/analysis/AnalysisBase"); + import FeatureLayer = require("esri/layers/FeatureLayer"); + import Map = require("esri/map"); + + /** The ExtractData widget is used to extract data from one or more layers within a given extent. */ + class ExtractData extends AnalysisBase { + /** If true, the Clip features option in Study area will be ckecked. */ + clip: boolean; + /** The format of output data shown as the default selection in the Output data format menu. */ + dataFormat: string; + /** An array for feature layers to be extracted. */ + featureLayers: FeatureLayer[]; + /** An array of feature layers to be shown in the Layers to extract menu as selected. */ + inputLayers: FeatureLayer[]; + /** Reference to the map object. */ + map: Map; + /** The name of the output layer to be shown in the Result layer name inputbox. */ + outputLayerName: string; + /** When true, the choose extent checkbox will be shown. */ + showChooseExtent: boolean; + /** When true, the show credit option is visible. */ + showCredits: boolean; + /** When true, the help links will be shown. */ + showHelp: boolean; + /** When true, the select folder dropdown will be shown. */ + showSelectFolder: boolean; + /** + * Creates a new ExtractData dijit using the given DOM node. + * @param params Various options to configure this dijit. + * @param srcNodeRef Reference or id of a HTML element that this dijit is rendered into. + */ + constructor(params: esri.ExtractDataOptions, srcNodeRef: Node); + /** + * Creates a new ExtractData dijit using the given DOM node. + * @param params Various options to configure this dijit. + * @param srcNodeRef Reference or id of a HTML element that this dijit is rendered into. + */ + constructor(params: esri.ExtractDataOptions, srcNodeRef: string); + /** Finalizes the creation of the widget. */ + startup(): void; + } + export = ExtractData; +} + +declare module "esri/dijit/analysis/FindExistingLocations" { + import AnalysisBase = require("esri/dijit/analysis/AnalysisBase"); + import FeatureLayer = require("esri/layers/FeatureLayer"); + + /** Select features in the input layer that meet an attribute and/or spatial query you specify. */ + class FindExistingLocations extends AnalysisBase { + /** The analysis layer to find existing locations from. */ + analysisLayer: FeatureLayer; + /** An array of feature layers to use as input. */ + inputLayers: FeatureLayer[]; + /** The name of the output layer to be shown in the Result layer name input box. */ + outputLayerName: string; + /** When true, returns the result of analysis as a client-side feature collection. */ + returnFeatureCollection: boolean; + /** When true, the choose extent checkbox will be shown. */ + showChooseExtent: boolean; + /** When true, the show credit option is visible. */ + showCredits: boolean; + /** When true, the help links will be shown. */ + showHelp: boolean; + /** When true, the select folder dropdown will be shown. */ + showSelectFolder: boolean; + /** + * Creates a new FindExistingLocations dijit using the given DOM node. + * @param params Various options to configure this dijit. + * @param srcNodeRef Reference or id of a HTML element that this dijit is rendered into. + */ + constructor(params: any, srcNodeRef: Node); + /** + * Creates a new FindExistingLocations dijit using the given DOM node. + * @param params Various options to configure this dijit. + * @param srcNodeRef Reference or id of a HTML element that this dijit is rendered into. + */ + constructor(params: any, srcNodeRef: string); + /** Finalizes the creation of the widget. */ + startup(): void; + } + export = FindExistingLocations; +} + +declare module "esri/dijit/analysis/FindHotSpots" { + import esri = require("esri"); + import AnalysisBase = require("esri/dijit/analysis/AnalysisBase"); + import FeatureLayer = require("esri/layers/FeatureLayer"); + import Map = require("esri/map"); + + /** The FindHotSpots widget finds statistically significant clusters of incident points, weighted points, or weighted polygons. */ + class FindHotSpots extends AnalysisBase { + /** An array of feature layer candidates to be selected as the aggregation polygon layer. */ + aggregationPolygonLayers: FeatureLayer[]; + /** The numeric field in the AnalysisLayer that will be analyzed. */ + analysisField: string; + /** The feature layer for which hot spots will be calculated. */ + analysisLayer: FeatureLayer; + /** A layer of bounding areas to answer the question: Within the bounding areas, are there any locations with unexpectedly high or low point concentrations? */ + boundingPolygonLayer: FeatureLayer; + /** An array of feature layer candidates to be selected as the bounding polygon layer. */ + boundingPolygonLayers: FeatureLayer[]; + /** Reference to the map object. */ + map: Map; + /** The name of the output layer to be shown in the Result layer name inputbox. */ + outputLayerName: string; + /** When true, returns the result of analysis as a client-side feature collection. */ + returnFeatureCollection: boolean; + /** Return a report of the analysis process. */ + returnProcessInfo: boolean; + /** When true, the choose extent checkbox will be shown. */ + showChooseExtent: boolean; + /** When true, the show credit option is visible. */ + showCredits: boolean; + /** When true, the help links will be shown. */ + showHelp: boolean; + /** When true, the select folder dropdown will be shown. */ + showSelectFolder: boolean; + /** + * Creates a new FindHotSpots dijit using the given DOM node. + * @param params Various options to configure this dijit. + * @param srcNodeRef Reference or id of a HTML element that this dijit is rendered into. + */ + constructor(params: esri.FindHotSpotsOptions, srcNodeRef: Node); + /** + * Creates a new FindHotSpots dijit using the given DOM node. + * @param params Various options to configure this dijit. + * @param srcNodeRef Reference or id of a HTML element that this dijit is rendered into. + */ + constructor(params: esri.FindHotSpotsOptions, srcNodeRef: string); + /** Finalizes the creation of the widget. */ + startup(): void; + } + export = FindHotSpots; +} + +declare module "esri/dijit/analysis/FindNearest" { + import esri = require("esri"); + import AnalysisBase = require("esri/dijit/analysis/AnalysisBase"); + import FeatureLayer = require("esri/layers/FeatureLayer"); + import Map = require("esri/map"); + + /** The FindNearest widget works with two layers: an analysis layer and a near layer. */ + class FindNearest extends AnalysisBase { + /** The feature layer from which the nearest features are found. */ + analysisLayer: FeatureLayer; + /** When true, Travel Modes (Driving Distance, Driving Time) are enabled for analysisLayer with point geometries (esriGeometryPoint). */ + enableTravelModes: boolean; + /** Reference to the map object. */ + map: Map; + /** The maximum number of nearest locations to find for each feature in analysisLayer. */ + maxCount: number; + /** The feature layer to be shown selected in the "1. */ + nearLayer: FeatureLayer; + /** An array of near layer candidates. */ + nearLayers: FeatureLayer[]; + /** The name of the output layer to be shown in the Result layer name inputbox. */ + outputLayerName: string; + /** When true, returns the result of analysis as a client-side feature collection. */ + returnFeatureCollection: boolean; + /** The maximum range to search for nearest locations from each feature in the analysisLayer. */ + searchCutoff: number; + /** The units of the searchCutoff parameter. */ + searchCutoffUnits: string; + /** When true, the choose extent checkbox will be shown. */ + showChooseExtent: boolean; + /** When true, the show credit option is visible. */ + showCredits: boolean; + /** When true, the help links will be shown. */ + showHelp: boolean; + /** When true, the select folder dropdown will be shown. */ + showSelectFolder: boolean; + /** + * Creates a new FindNearest dijit using the given DOM node. + * @param params Various options to configure this dijit. + * @param srcNodeRef Reference or id of a HTML element that this dijit is rendered into. + */ + constructor(params: esri.FindNearestOptions, srcNodeRef: Node); + /** + * Creates a new FindNearest dijit using the given DOM node. + * @param params Various options to configure this dijit. + * @param srcNodeRef Reference or id of a HTML element that this dijit is rendered into. + */ + constructor(params: esri.FindNearestOptions, srcNodeRef: string); + /** Finalizes the creation of the widget. */ + startup(): void; + } + export = FindNearest; +} + +declare module "esri/dijit/analysis/FindSimilarLocations" { + import esri = require("esri"); + import AnalysisBase = require("esri/dijit/analysis/AnalysisBase"); + import FeatureLayer = require("esri/layers/FeatureLayer"); + + /** Measure the similarity of candidate locations to one or more reference locations. */ + class FindSimilarLocations extends AnalysisBase { + /** The input point, line, or polygon feature layer. */ + inputLayer: FeatureLayer; + /** The name of the output layer to be shown in the Result layer name input box. */ + outputLayerName: string; + /** When true, returns the result of analysis as a client-side feature collection. */ + returnFeatureCollection: boolean; + /** Return a report of the analysis process. */ + returnProcessInfo: boolean; + /** The point, line, or polygon feature layer to search. */ + searchLayers: FeatureLayer[]; + /** When true, the choose extent checkbox will be shown. */ + showChooseExtent: boolean; + /** When true, the show credit option is visible. */ + showCredits: boolean; + /** When true, the help links will be shown. */ + showHelp: boolean; + /** When true, the select folder dropdown will be shown. */ + showSelectFolder: boolean; + /** + * Creates a new FindSimilarLocations dijit using the given DOM node. + * @param params Various options to configure this dijit. + * @param srcNodeRef Reference or id of a HTML element that this dijit is rendered into. + */ + constructor(params: any, srcNodeRef: Node); + /** + * Creates a new FindSimilarLocations dijit using the given DOM node. + * @param params Various options to configure this dijit. + * @param srcNodeRef Reference or id of a HTML element that this dijit is rendered into. + */ + constructor(params: any, srcNodeRef: string); + /** Finalizes the creation of the widget. */ + startup(): void; + /** Fires when the select tool option is activated. */ + on(type: "selecttool-activate", listener: (event: { target: FindSimilarLocations }) => void): esri.Handle; + /** Fires when the select tool option is deactivated. */ + on(type: "selecttool-deactivate", listener: (event: { target: FindSimilarLocations }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = FindSimilarLocations; +} + +declare module "esri/dijit/analysis/InterpolatePoints" { + import AnalysisBase = require("esri/dijit/analysis/AnalysisBase"); + import FeatureLayer = require("esri/layers/FeatureLayer"); + + /** Predict values at new locations based on measurements from a collection of points. */ + class InterpolatePoints extends AnalysisBase { + /** A layer specifying the area where you want the result to be drawn. */ + boundingPolygonLayer: FeatureLayer; + /** Polygon layers (optional). */ + boundingPolygonLayers: FeatureLayer[]; + /** Classification type to use for the analysis. */ + classificationType: string; + /** The point features that will be interpolated. */ + inputLayer: FeatureLayer; + /** Maximum number to display in widget UI from which user can pick the number of classes to use in the analysis. */ + maxClasses: number; + /** Minimum number to display in widget UI from which user can pick the number of classes to use in the analysis. */ + minClasses: number; + /** The number of classes (range of predicted values) in the result layer. */ + numClasses: number; + /** The name of the output layer to be shown in the Result layer name input box. */ + outputLayerName: string; + /** Point layers (optional). */ + predictAtPointLayers: FeatureLayer[]; + /** When true, returns the result of analysis as a client-side feature collection. */ + returnFeatureCollection: boolean; + /** When true, the choose extent checkbox will be shown. */ + showChooseExtent: boolean; + /** When true, the show credit option is visible. */ + showCredits: boolean; + /** When true, the help links will be shown. */ + showHelp: boolean; + /** When true, the select folder dropdown will be shown. */ + showSelectFolder: boolean; + /** + * Creates a new InterpolatePoints dijit using the given DOM node. + * @param params Various options to configure this dijit. + * @param srcNodeRef Reference or id of a HTML element that this dijit is rendered into. + */ + constructor(params: any, srcNodeRef: Node); + /** + * Creates a new InterpolatePoints dijit using the given DOM node. + * @param params Various options to configure this dijit. + * @param srcNodeRef Reference or id of a HTML element that this dijit is rendered into. + */ + constructor(params: any, srcNodeRef: string); + /** Finalizes the creation of the widget. */ + startup(): void; + } + export = InterpolatePoints; +} + +declare module "esri/dijit/analysis/MergeLayers" { + import esri = require("esri"); + import AnalysisBase = require("esri/dijit/analysis/AnalysisBase"); + import FeatureLayer = require("esri/layers/FeatureLayer"); + import Map = require("esri/map"); + + /** The MergeLayers widget copies features from two layers into a new layer. */ + class MergeLayers extends AnalysisBase { + /** URL to the GPServer to be used for this analysis. */ + analysisGpServer: string; + /** The feature layer to be merged with the mergeLayer. */ + inputLayer: FeatureLayer; + /** Reference to the map object. */ + map: Map; + /** An array of feature layer candidates to be selected as the merge layer. */ + mergeLayers: FeatureLayer[]; + /** An array of values that describe how fields from the mergeLayer are to be modified. */ + mergingAttributes: string[]; + /** The name of the output layer to be shown in the Result layer name inputbox. */ + outputLayerName: string; + /** When true, returns the result of analysis as a client-side feature collection. */ + returnFeatureCollection: boolean; + /** When true, the choose extent checkbox will be shown. */ + showChooseExtent: boolean; + /** When true, the show credit option is visible. */ + showCredits: boolean; + /** When true, the help links will be shown. */ + showHelp: boolean; + /** When true, the select folder dropdown will be shown. */ + showSelectFolder: boolean; + /** + * Creates a new MergeLayers dijit using the given DOM node. + * @param params Various options to configure this dijit. + * @param srcNodeRef Reference or id of a HTML element that this dijit is rendered into. + */ + constructor(params: esri.MergeLayersOptions, srcNodeRef: Node); + /** + * Creates a new MergeLayers dijit using the given DOM node. + * @param params Various options to configure this dijit. + * @param srcNodeRef Reference or id of a HTML element that this dijit is rendered into. + */ + constructor(params: esri.MergeLayersOptions, srcNodeRef: string); + /** Finalizes the creation of the widget. */ + startup(): void; + } + export = MergeLayers; +} + +declare module "esri/dijit/analysis/OverlayLayers" { + import esri = require("esri"); + import AnalysisBase = require("esri/dijit/analysis/AnalysisBase"); + import FeatureLayer = require("esri/layers/FeatureLayer"); + import Map = require("esri/map"); + + /** The OverlayLayers widget combines two or more layers into one single layer containing all the information found in the stack. */ + class OverlayLayers extends AnalysisBase { + /** The feature layer that will be overlayed with the overlayLayer. */ + inputLayer: FeatureLayer; + /** Reference to the map object. */ + map: Map; + /** The name of the output layer to be shown in the Result layer name inputbox. */ + outputLayerName: string; + /** An array of feature layers to be overlaid with inputLayer. */ + overlayLayer: FeatureLayer[]; + /** Defines how two input layers are combined. */ + overlayType: string; + /** When true, returns the result of analysis as a client-side feature collection. */ + returnFeatureCollection: boolean; + /** When true, the choose extent checkbox will be shown. */ + showChooseExtent: boolean; + /** When true, the show credit option is visible. */ + showCredits: boolean; + /** When true, the help links will be shown. */ + showHelp: boolean; + /** When true, the select folder dropdown will be shown. */ + showSelectFolder: boolean; + /** When the distance between features is less than the tolerance, the features in the overlay layer will snap to the features in the input layer. */ + snapToInput: boolean; + /** The minimum distance separating all feature coordinates (nodes and vertices) as well as the distance a coordinate can move in X or Y (or both). */ + tolerance: number; + /** + * Creates a new OverlayLayers dijit using the given DOM node. + * @param params Various options to configure this dijit. + * @param srcNodeRef Reference or id of a HTML element that this dijit is rendered into. + */ + constructor(params: esri.OverlayLayersOptions, srcNodeRef: Node); + /** + * Creates a new OverlayLayers dijit using the given DOM node. + * @param params Various options to configure this dijit. + * @param srcNodeRef Reference or id of a HTML element that this dijit is rendered into. + */ + constructor(params: esri.OverlayLayersOptions, srcNodeRef: string); + /** Finalizes the creation of the widget. */ + startup(): void; + } + export = OverlayLayers; +} + +declare module "esri/dijit/analysis/PlanRoutes" { + import AnalysisBase = require("esri/dijit/analysis/AnalysisBase"); + import FeatureLayer = require("esri/layers/FeatureLayer"); + + /** Determine how to efficiently divide tasks among a mobile workforce. */ + class PlanRoutes extends AnalysisBase { + /** Possible values are "Miles" or "Kilometers". */ + distanceDefaultUnits: string; + /** Provide the locations where the people or vehicles end their routes. */ + endLayer: string; + /** Layers to list in the dijit's input boxes. */ + featureLayers: FeatureLayer[]; + /** Whether to limit the max time per route. */ + limitMaxTimePerRoute: boolean; + /** Maximum number of stops per vehicle. */ + maxStopsPerRoute: number; + /** The name of the output layer to be shown in the Result layer name input box. */ + outputLayerName: string; + /** When true, returns the result of analysis as a client-side feature collection. */ + returnFeatureCollection: boolean; + /** Whether each route must end its trip at the same place where it started. */ + returnToStart: boolean; + /** The number of vehicles that are available to visit the stops. */ + routeCount: number; + /** When true, the choose extent checkbox will be shown. */ + showChooseExtent: boolean; + /** When true, the show credit option is visible. */ + showCredits: boolean; + /** When true, the help links will be shown. */ + showHelp: boolean; + /** When true, the select folder dropdown will be shown. */ + showSelectFolder: boolean; + /** Provide the locations where the people or vehicles start their routes. */ + startLayer: string; + /** The points that the vehicles, drivers, or routes, should visit. */ + stopsLayer: FeatureLayer; + /** + * Creates a new PlanRoutes dijit using the given DOM node. + * @param params Various options to configure this dijit. + * @param srcNodeRef Reference or id of a HTML element that this dijit is rendered into. + */ + constructor(params: any, srcNodeRef: Node); + /** + * Creates a new PlanRoutes dijit using the given DOM node. + * @param params Various options to configure this dijit. + * @param srcNodeRef Reference or id of a HTML element that this dijit is rendered into. + */ + constructor(params: any, srcNodeRef: string); + /** Finalizes the creation of the widget. */ + startup(): void; + } + export = PlanRoutes; +} + +declare module "esri/dijit/analysis/SummarizeNearby" { + import esri = require("esri"); + import AnalysisBase = require("esri/dijit/analysis/AnalysisBase"); + import Map = require("esri/map"); + import FeatureLayer = require("esri/layers/FeatureLayer"); + + /** The FindNearest widget works with two layers: an summarize nearby layer and a summary layer. */ + class SummarizeNearby extends AnalysisBase { + /** An array of numbers that defines the search distance (for StraightLine or DrivingDistance) or time (for DrivingTime) shown in the distance input in the Find nearest features using a option. */ + distances: number[]; + /** When true, Travel Modes (Driving Distance, Driving Time) are enabled for sumNearbyLayer with point geometries (esriGeometryPoint). */ + enableTravelModes: boolean; + /** A field of the summarizeLayer features that you can use to calculate statistics separately for each unique attribute value. */ + groupByField: string; + /** Reference to the map object. */ + map: Map; + /** When true, two fields will be added to your result layer to indicate which attribute values within each group are the minority (least dominant) or the majority (most dominant) within each boundary. */ + minorityMajority: boolean; + /** Type of distance measurement shown as the defeault value in the Find nearest features using a option. */ + nearType: string; + /** The name of the output layer to be shown in the Result layer name inputbox. */ + outputLayerName: string; + /** When true, a new field will be added to the result table containing the percentages of each attribute value within each group. */ + percentPoints: boolean; + /** When true, returns the result of analysis as a client-side feature collection. */ + returnFeatureCollection: boolean; + /** Type of units shown under the Total Area checkbox in the Add statistics from option. */ + shapeUnits: string; + /** When true, the choose extent checkbox will be shown. */ + showChooseExtent: boolean; + /** When true, the show credit option is visible. */ + showCredits: boolean; + /** When true, the help links will be shown. */ + showHelp: boolean; + /** When true, the select folder dropdown will be shown. */ + showSelectFolder: boolean; + /** An array of possible statistics attribute field names and summary types that you wish to calculate for all nearby features. */ + summaryFields: string[]; + /** The feature layer to be shown selected in the Choose layer to summarize dropdown. */ + summaryLayer: FeatureLayer; + /** An array of possible feature layers summarizing toward. */ + summaryLayers: FeatureLayer[]; + /** The point, line, or polygon feature layer from which distances will be measured to features in summarizeLayer. */ + sumNearbyLayer: FeatureLayer; + /** If true. */ + sumShape: boolean; + /** Type of units shown as the defeault value in the Find nearest features using a option. */ + units: string; + /** + * Creates a new SummarizeNearby dijit using the given DOM node. + * @param params Various options to configure this dijit. + * @param srcNodeRef Reference or id of a HTML element that this dijit is rendered into. + */ + constructor(params: esri.SummarizeNearbyOptions, srcNodeRef: Node); + /** + * Creates a new SummarizeNearby dijit using the given DOM node. + * @param params Various options to configure this dijit. + * @param srcNodeRef Reference or id of a HTML element that this dijit is rendered into. + */ + constructor(params: esri.SummarizeNearbyOptions, srcNodeRef: string); + /** Finalizes the creation of the widget. */ + startup(): void; + } + export = SummarizeNearby; +} + +declare module "esri/dijit/analysis/SummarizeWithin" { + import esri = require("esri"); + import AnalysisBase = require("esri/dijit/analysis/AnalysisBase"); + import Map = require("esri/map"); + import FeatureLayer = require("esri/layers/FeatureLayer"); + + /** The SummarizeWithin widget works with two layers: an summarize within layer and a summary layer. */ + class SummarizeWithin extends AnalysisBase { + /** A field name from summaryLayer that you can use to calculate statistics separately for each unique attribute value. */ + groupByField: string; + /** Reference to the map object. */ + map: Map; + /** When true, two fields will be added to your result layer to indicate which attribute values within each group are the minority (least dominant) or the majority (most dominant) within each boundary. */ + minorityMajority: boolean; + /** The name of the output layer to be shown in the Result layer name inputbox. */ + outputLayerName: string; + /** When true, a new field will be added to the result table containing the percentages of each attribute value within each group. */ + percentPoints: boolean; + /** When true, returns the result of analysis as a client-side feature collection. */ + returnFeatureCollection: boolean; + /** When true, the choose extent checkbox will be shown. */ + showChooseExtent: boolean; + /** When true, the show credit option is visible. */ + showCredits: boolean; + /** When true, the help links will be shown. */ + showHelp: boolean; + /** When true, the select folder dropdown will be shown. */ + showSelectFolder: boolean; + /** A list of field names and statistical summary type that you wish to calculate for all features in SummaryLayer that are within each polygon in sumWithinLayer. */ + summaryFields: string; + /** The summary layer to be shown selected in in the Choose layer to summarize menu. */ + summaryLayer: FeatureLayer; + /** An array of summarize layer candidates. */ + summaryLayers: FeatureLayer[]; + /** The polygon feature layer to be summarized toward. */ + sumWithinLayer: FeatureLayer; + /** + * Creates a new SummarizeWithin dijit using the given DOM node. + * @param params Various options to configure this dijit. + * @param srcNodeRef Reference or id of a HTML element that this dijit is rendered into. + */ + constructor(params: esri.SummarizeWithinOptions, srcNodeRef: Node); + /** + * Creates a new SummarizeWithin dijit using the given DOM node. + * @param params Various options to configure this dijit. + * @param srcNodeRef Reference or id of a HTML element that this dijit is rendered into. + */ + constructor(params: esri.SummarizeWithinOptions, srcNodeRef: string); + /** Finalizes the creation of the widget. */ + startup(): void; + } + export = SummarizeWithin; +} + +declare module "esri/dijit/analysis/TraceDownstream" { + import AnalysisBase = require("esri/dijit/analysis/AnalysisBase"); + import FeatureLayer = require("esri/layers/FeatureLayer"); + + /** Determine the flow paths in a downstream direction from the locations you specify. */ + class TraceDownstream extends AnalysisBase { + /** A layer specifying the area where you want the trace to be clipped. */ + boundingPolygonLayer: FeatureLayer; + /** An array of feature layer candidates to be selected as the bounding polygon layer. */ + boundingPolygonLayers: FeatureLayer[]; + /** Total length of the line that will be returned. */ + maxDistance: number; + /** The linear units to use for the 'maxDistance' value. */ + maxDistanceUnits: string; + /** The name of the output layer to be shown in the Result layer name input box. */ + outputLayerName: string; + /** When true, returns the result of analysis as a client-side feature collection. */ + returnFeatureCollection: boolean; + /** When true, the choose extent checkbox will be shown. */ + showChooseExtent: boolean; + /** When true, the show credit option is visible. */ + showCredits: boolean; + /** When true, the help links will be shown. */ + showHelp: boolean; + /** When true, the select folder dropdown will be shown. */ + showSelectFolder: boolean; + /** The trace line will be split into multiple lines where each line is of the specified length. */ + splitDistance: number; + /** The units that splitDistance is specified in. */ + splitUnits: string; + /** + * Creates a new TraceDownstream dijit using the given DOM node. + * @param params Various options to configure this dijit. + * @param srcNodeRef Reference or id of a HTML element that this dijit is rendered into. + */ + constructor(params: any, srcNodeRef: Node); + /** + * Creates a new TraceDownstream dijit using the given DOM node. + * @param params Various options to configure this dijit. + * @param srcNodeRef Reference or id of a HTML element that this dijit is rendered into. + */ + constructor(params: any, srcNodeRef: string); + /** Finalizes the creation of the widget. */ + startup(): void; + } + export = TraceDownstream; +} + +declare module "esri/dijit/editing/Add" { + import esri = require("esri"); + import OperationBase = require("esri/OperationBase"); + + /** The esri/dijit/editing namespace contains editing related operations that inherit from OperationBase. */ + class Add extends OperationBase { + /** + * Create a new Add operation. + * @param params See options list for parameters. + */ + constructor(params: esri.AddOptions); + /** Redo the current operation. */ + performRedo(): void; + /** Undo the current operation. */ + performUndo(): void; + } + export = Add; +} + +declare module "esri/dijit/editing/AttachmentEditor" { + import Graphic = require("esri/graphic"); + import FeatureLayer = require("esri/layers/FeatureLayer"); + + /** Widget that supports viewing attachments for feature layers that have attachments enabled. */ + class AttachmentEditor { + /** + * Creates a new AttachmentEditor object. + * @param params No parameter options. + * @param srcNodeRef HTML element where the widget is rendered. + */ + constructor(params: any, srcNodeRef: Node); + /** + * Creates a new AttachmentEditor object. + * @param params No parameter options. + * @param srcNodeRef HTML element where the widget is rendered. + */ + constructor(params: any, srcNodeRef: string); + /** + * Display the attachment editor. + * @param graphic Graphic, with attachments, to display in the attachment editor. + * @param featureLayer The feature layer to display attachments for. + */ + showAttachments(graphic: Graphic, featureLayer: FeatureLayer): void; + /** Finalizes the creation of the attachment editor. */ + startup(): void; + } + export = AttachmentEditor; +} + +declare module "esri/dijit/editing/Cut" { + import esri = require("esri"); + import OperationBase = require("esri/OperationBase"); + + /** The esri/dijit/editing namespace contains editing related operations that inherit from OperationBase. */ + class Cut extends OperationBase { + /** + * Create a new Cut operation. + * @param params See options list for parameters. + */ + constructor(params: esri.CutOptions); + /** Redo the current operation. */ + performRedo(): void; + /** Undo the current operation. */ + performUndo(): void; + } + export = Cut; +} + +declare module "esri/dijit/editing/Delete" { + import esri = require("esri"); + import OperationBase = require("esri/OperationBase"); + + /** The esri/dijit/editing namespace contains editing related operations that inherit from OperationBase. */ + class Delete extends OperationBase { + /** + * Create a new Delete operation. + * @param params See options list for parameters. + */ + constructor(params: esri.DeleteOptions); + /** Redo the current operation. */ + performRedo(): void; + /** Undo the current operation. */ + performUndo(): void; + } + export = Delete; +} + +declare module "esri/dijit/editing/Editor" { + import esri = require("esri"); + + /** The Editor widget provides out-of-the-box editing capabilities using an editable layer in a Feature Service. */ + class Editor { + /** Arrow tool */ + static CREATE_TOOL_ARROW: any; + /** Autocomplete polygon tool */ + static CREATE_TOOL_AUTOCOMPLETE: any; + /** Circle tool */ + static CREATE_TOOL_CIRCLE: any; + /** Ellipse tool */ + static CREATE_TOOL_ELLIPSE: any; + /** Freehand polygon tool */ + static CREATE_TOOL_FREEHAND_POLYGON: any; + /** Freehand polyline tool */ + static CREATE_TOOL_FREEHAND_POLYLINE: any; + /** Polygon tool */ + static CREATE_TOOL_POLYGON: any; + /** Polyline tool */ + static CREATE_TOOL_POLYLINE: any; + /** Rectangle tool */ + static CREATE_TOOL_RECTANGLE: any; + /** Triangle tool */ + static CREATE_TOOL_TRIANGLE: any; + /** + * Creates a new Editor object. + * @param params Parameters that define the functionality of the editor widget. + * @param srcNodeRef HTML element where the widget should be rendered. + */ + constructor(params: esri.EditorOptions, srcNodeRef: Node); + /** + * Creates a new Editor object. + * @param params Parameters that define the functionality of the editor widget. + * @param srcNodeRef HTML element where the widget should be rendered. + */ + constructor(params: esri.EditorOptions, srcNodeRef: string); + /** Finalizes the creation of the widget. */ + startup(): void; + /** Fires when the widget has fully loaded. */ + on(type: "load", listener: (event: { target: Editor }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = Editor; +} + +declare module "esri/dijit/editing/TemplatePicker" { + import esri = require("esri"); + + /** A template picker displays a gallery of templates from one or more feature layers. */ + class TemplatePicker { + /** Reference to the data grid used to display the templates. */ + grid: any; + /** If tooltips are enabled the reference to the tooltip div. */ + tooltip: HTMLDivElement; + /** + * Creates a new TemplatePicker object that displays a gallery of templates from the input feature layers or items. + * @param params FeatureLayers or items are required all other parameters are optional. + * @param srcNodeRef HTML element where the TemplatePicker will be rendered. + */ + constructor(params: esri.TemplatePickerOptions, srcNodeRef: Node); + /** + * Creates a new TemplatePicker object that displays a gallery of templates from the input feature layers or items. + * @param params FeatureLayers or items are required all other parameters are optional. + * @param srcNodeRef HTML element where the TemplatePicker will be rendered. + */ + constructor(params: esri.TemplatePickerOptions, srcNodeRef: string); + /** + * Get or set the properties of the template picker. + * @param name Name of the attribute of interest. + * @param value Value for the specified attribute. + */ + attr(name: string, value?: any): void; + /** Clears the current selection. */ + clearSelection(): void; + /** Destroys the template picker. */ + destroy(): void; + /** Gets the selected item picked by the user. */ + getSelected(): any; + /** Finalizes the creation of the template picker. */ + startup(): void; + /** Updates the templatePicker after modifying the properties of the widget. */ + update(): void; + /** Fires when an item is selected or unselected in the template picker. */ + on(type: "selection-change", listener: (event: { target: TemplatePicker }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = TemplatePicker; +} + +declare module "esri/dijit/editing/Union" { + import esri = require("esri"); + import OperationBase = require("esri/OperationBase"); + + /** The esri/dijit/editing namespace contains editing related operations that inherit from OperationBase. */ + class Union extends OperationBase { + /** + * Create a new Union operation. + * @param params See options list for parameters. + */ + constructor(params: esri.UnionOptions); + /** Redo the current operation. */ + performRedo(): void; + /** Undo the current operation. */ + performUndo(): void; + } + export = Union; +} + +declare module "esri/dijit/editing/Update" { + import esri = require("esri"); + import OperationBase = require("esri/OperationBase"); + + /** The esri/dijit/editing namespace contains editing related operations that inherit from OperationBase. */ + class Update extends OperationBase { + /** + * Create a new Update operation. + * @param params See options list for parameters. + */ + constructor(params: esri.UpdateOptions); + /** Redo the current operation. */ + performRedo(): void; + /** Undo the current operation. */ + performUndo(): void; + } + export = Update; +} + +declare module "esri/dijit/geoenrichment/DataBrowser" { + import esri = require("esri"); + + /** The DataBrowser widget allows users to search or browse for geoenrichment variables. */ + class DataBrowser { + /** + * Creates a new DataBrowser dijit using the given DOM node. + * @param options Optional parameters used to create the layer. + * @param srcNodeRef Reference or id of an HTML element where the DataBrowser should be rendered. + */ + constructor(options: esri.DataBrowserOptions, srcNodeRef: Node); + /** + * Creates a new DataBrowser dijit using the given DOM node. + * @param options Optional parameters used to create the layer. + * @param srcNodeRef Reference or id of an HTML element where the DataBrowser should be rendered. + */ + constructor(options: esri.DataBrowserOptions, srcNodeRef: string); + /** Finalizes the creation of the DataBrowser. */ + startup(): void; + /** Fires when user clicks the Back button. */ + on(type: "back", listener: (event: { target: DataBrowser }) => void): esri.Handle; + /** Fires when user clicks the Cancel button. */ + on(type: "cancel", listener: (event: { target: DataBrowser }) => void): esri.Handle; + /** Fires when user clicks the OK button. */ + on(type: "ok", listener: (event: { target: DataBrowser }) => void): esri.Handle; + /** Fires when variables are selected. */ + on(type: "select", listener: (event: { target: DataBrowser }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = DataBrowser; +} + +declare module "esri/dijit/geoenrichment/InfoGraphic" { + import esri = require("esri"); + import GeometryStudyArea = require("esri/tasks/geoenrichment/GeometryStudyArea"); + import FeatureSet = require("esri/tasks/FeatureSet"); + + /** Displays an Infographic of one or more variables that describe the geographic context of a location. */ + class Infographic { + /** The number of Infographic's for which data retrieved is cached for that browser session. */ + cacheLimit: number; + /** The ID of the country for which data is retrieved. */ + countryID: string; + /** The ID of the dataset to which variables used in this Infographic belong. */ + datasetID: string; + /** If true, the Infographic will be displayed in its expanded state. */ + expanded: boolean; + /** When true, output geometry will be available as the geometry property in the returned object of the "data-ready" event handler. */ + returnGeometry: boolean; + /** The study area for this Infographic. */ + studyArea: GeometryStudyArea; + /** The options to apply to the study area. */ + studyAreaOptions: any; + /** An HTML template string used to define the Infographic subtitle. */ + subtitle: string; + /** The title of the Infographic. */ + title: string; + /** The type of the Infographic. */ + type: string; + /** The set of variables displayed in this Infographic. */ + variables: string[]; + /** + * Creates a new Infographic dijit using the given DOM node. + * @param params Various optional parameters that can be used to configure the dijit. + * @param srcNodeRef Reference or id of an HTML element where the Infographic should be rendered. + */ + constructor(params: any, srcNodeRef: Node); + /** + * Creates a new Infographic dijit using the given DOM node. + * @param params Various optional parameters that can be used to configure the dijit. + * @param srcNodeRef Reference or id of an HTML element where the Infographic should be rendered. + */ + constructor(params: any, srcNodeRef: string); + /** + * Define the infographic data. + * @param data Specify the FeatureSet containing the custom data to display in the Infographic. + * @param metadata Define the mappings of feature set attributes to Infographic display fields. + */ + setData(data: FeatureSet, metadata?: any): void; + /** Finalizes the creation of this dijit. */ + startup(): void; + /** Fires if an error occurs in retrieving data for the study area. */ + on(type: "data-error", listener: (event: { error: any; target: Infographic }) => void): esri.Handle; + /** Fires when loading data for the study area. */ + on(type: "data-load", listener: (event: { target: Infographic }) => void): esri.Handle; + /** Fires when data for the study area is ready. */ + on(type: "data-ready", listener: (event: { provider: any; target: Infographic }) => void): esri.Handle; + /** Fires when requesting data for the study area. */ + on(type: "data-request", listener: (event: { target: Infographic }) => void): esri.Handle; + /** Fires when the Infographic is resized. */ + on(type: "resize", listener: (event: { size: number[]; target: Infographic }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = Infographic; +} + +declare module "esri/dijit/geoenrichment/InfographicsCarousel" { + import esri = require("esri"); + import InfographicsOptions = require("esri/dijit/geoenrichment/InfographicsOptions"); + import GeometryStudyArea = require("esri/tasks/geoenrichment/GeometryStudyArea"); + + /** Displays a set of Infographic dijits in a carousel. */ + class InfographicsCarousel { + /** If true, the Infographic will be displayed in its expanded state. */ + expanded: boolean; + /** Describes the options used to configure the contents of the carousel. */ + options: InfographicsOptions; + /** When true, output geometry will be available as the geometry property in the returned object of the "data-ready" event handler. */ + returnGeometry: boolean; + /** The index of the currently selected InfoGraphic in this InfographicsCarousel. */ + selectedIndex: number; + /** The study area for this InfographicsCarousel. */ + studyArea: GeometryStudyArea; + /** The name of the study area to be shown in this InfographicsCarousel. */ + studyAreaTitle: string; + /** + * Creates a new InfographicsCarousel dijit using the given DOM node. + * @param params Various optional parameters that can be used to configure the dijit. + * @param srcNodeRef Reference or id of an HTML element where the Directions widget should be rendered. + */ + constructor(params: any, srcNodeRef: Node); + /** + * Creates a new InfographicsCarousel dijit using the given DOM node. + * @param params Various optional parameters that can be used to configure the dijit. + * @param srcNodeRef Reference or id of an HTML element where the Directions widget should be rendered. + */ + constructor(params: any, srcNodeRef: string); + /** Finalizes the creation of this dijit. */ + startup(): void; + /** Fires if an error occurs in retrieving data for the study area. */ + on(type: "data-error", listener: (event: { error: any; target: InfographicsCarousel }) => void): esri.Handle; + /** Fires when loading data for the study area. */ + on(type: "data-load", listener: (event: { target: InfographicsCarousel }) => void): esri.Handle; + /** Fires when data for the study area is ready. */ + on(type: "data-ready", listener: (event: { provider: any; target: InfographicsCarousel }) => void): esri.Handle; + /** Fires when the InfographicsCarousel is resized. */ + on(type: "resize", listener: (event: { size: number[]; target: InfographicsCarousel }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = InfographicsCarousel; +} + +declare module "esri/dijit/geoenrichment/InfographicsOptions" { + /** InfographicsOptions is used to customize and configure the Infographic's included in a InfographicCarousel. */ + class InfographicsOptions { + /** The options to apply to the study area. */ + studyAreaOptions: any; + /** The name of the css theme used to format the InfographicsCarousel. */ + theme: string; + /** + * Constructs instance from serialized state. + * @param json Various options to configure this InfographicsOptions. + */ + constructor(json?: Object); + /** + * Gets an array of default InfographicsOptions.Item's in the InfographicsCarousel with a countryID. + * @param countryID The ID of the country for which data is retrieved. + */ + getItems(countryID: string): any; + /** Converts object to its JSON representation. */ + toJson(): any; + } + export = InfographicsOptions; +} + +declare module "esri/dijit/geoenrichment/InfographicsOptionsItem" { + /** Defines the options for each Infographic in an InfographicsCarousel. */ + class InfographicsOptionsItem { + /** The ID of the dataset to which variables used in this Infographic belong. */ + datasetID: string; + /** When true, the Infographic is configured to be visible. */ + isVisible: boolean; + /** The title or name of the Infographic. */ + title: string; + /** The type of the Infographic. */ + type: string; + /** The set of variables displayed in this Infographic. */ + variables: string[]; + /** + * Constructs an InfographicsOptionsItem object. + * @param type The type of the Infographic. + * @param variables The set of variables displayed in this InfographicsOptionsItem. + */ + constructor(type: string, variables: string[]); + } + export = InfographicsOptionsItem; +} + +declare module "esri/dijit/util/busyIndicator" { + /** This module provides the ability to create a busy indicator for a target. */ + var busyIndicator: { + /** + * Creates a busy indicator on a target. + * @param target The String (Node id, dijit/_WidgetBase id), HTMLElement reference (Node), or dijit/_WidgetBase. + * @param params (Optional) The params options can be used when needing more fine-grained control. + */ + create(target: string, params?: any): any; + /** + * Creates a busy indicator on a target. + * @param target The String (Node id, dijit/_WidgetBase id), HTMLElement reference (Node), or dijit/_WidgetBase. + * @param params (Optional) The params options can be used when needing more fine-grained control. + */ + create(target: HTMLElement, params?: any): any; + /** + * Creates a busy indicator on a target. + * @param target The String (Node id, dijit/_WidgetBase id), HTMLElement reference (Node), or dijit/_WidgetBase. + * @param params (Optional) The params options can be used when needing more fine-grained control. + */ + create(target: any, params?: any): any; + }; + export = busyIndicator; +} + +declare module "esri/domUtils" { + /** Utility methods related to working with the DOM. */ + var domUtils: { + /** Represents the size of the client side window or document at first load. */ + documentBox: any; + /** + * Returns the DOM node from HTMLElement or dijit/_WidgetBase. + * @param target The HTMLElement or dijit/_WidgetBase to retrieve. + */ + getNode(target: HTMLElement): Node; + /** + * Returns the DOM node from HTMLElement or dijit/_WidgetBase. + * @param target The HTMLElement or dijit/_WidgetBase to retrieve. + */ + getNode(target: any): Node; + /** + * Hides the HTMLElement or dijit/_WidgetBase. + * @param target The HTMLElement or dijit/_WidgetBase. + */ + hide(target: HTMLElement): void; + /** + * Hides the HTMLElement or dijit/_WidgetBase. + * @param target The HTMLElement or dijit/_WidgetBase. + */ + hide(target: any): void; + /** + * Shows the HTMLElement or dijit/_WidgetBase. + * @param target The HTMLElement or dijit/_WidgetBase. + */ + show(target: HTMLElement): void; + /** + * Shows the HTMLElement or dijit/_WidgetBase. + * @param target The HTMLElement or dijit/_WidgetBase. + */ + show(target: any): void; + /** + * If the target (HTMLElement or dijit/_WidgetBase) is currently visible, the target is hidden. + * @param target The HTMLElement or dijit/_WidgetBase. + */ + toggle(target: HTMLElement): void; + /** + * If the target (HTMLElement or dijit/_WidgetBase) is currently visible, the target is hidden. + * @param target The HTMLElement or dijit/_WidgetBase. + */ + toggle(target: any): void; + }; + export = domUtils; +} + +declare module "esri/geometry/Circle" { + import esri = require("esri"); + import Polygon = require("esri/geometry/Polygon"); + import SpatialReference = require("esri/SpatialReference"); + import Point = require("esri/geometry/Point"); + + /** A circle (Polygon) created by a specified center point. */ + class Circle extends Polygon { + /** Center point of the circle. */ + center: any; + /** The radius of the circle based. */ + radius: number; + /** Unit of the radius. */ + radiusUnit: string; + /** Array of coordinate values constituting the circle like [[x1, y1], [x2, y2],...]. */ + rings: number[][][]; + /** The spatial reference of the circle will be the same as the spatial reference of the center point. */ + spatialReference: SpatialReference; + /** + * Create a new Circle by specifying an input center location using either an esri.geometry.Point object or a latitude/longitude array and an object with the following optional properties: radius, radiusUnits, geodesic and numberOfPoints. + * @param center Center point of the circle. + * @param options See options descriptions for further information. + */ + constructor(center: Point, options?: esri.CircleOptions1); + /** + * Create a new Circle by specifying an input center location using either an esri.geometry.Point object or a latitude/longitude array and an object with the following optional properties: radius, radiusUnits, geodesic and numberOfPoints. + * @param center Center point of the circle. + * @param options See options descriptions for further information. + */ + constructor(center: number[], options?: esri.CircleOptions1); + /** + * Create a new Circle by specifying an object with a required center location, defined as a longitude/latitude array or an esri.geometry.Point, and the following additional optional parameters: radius, radiusUnits, geodesic, and numberOfPoints. + * @param params If no center parameter is provided, it must be set within the options. + */ + constructor(params: esri.CircleOptions2); + } + export = Circle; +} + +declare module "esri/geometry/Extent" { + import Geometry = require("esri/geometry/Geometry"); + import SpatialReference = require("esri/SpatialReference"); + import Point = require("esri/geometry/Point"); + + /** The minimum and maximum X- and Y- coordinates of a bounding box. */ + class Extent extends Geometry { + /** Top-right X-coordinate of an extent envelope. */ + xmax: number; + /** Bottom-left X-coordinate of an extent envelope. */ + xmin: number; + /** Top-right Y-coordinate of an extent envelope. */ + ymax: number; + /** Bottom-left Y-coordinate of an extent envelope. */ + ymin: number; + /** + * Creates a new Extent object. + * @param xmin Bottom-left X-coordinate of an extent envelope. + * @param ymin Bottom-left Y-coordinate of an extent envelope. + * @param xmax Top-right X-coordinate of an extent envelope. + * @param ymax Top-right Y-coordinate of an extent envelope. + * @param spatialReference Spatial reference of the geometry. + */ + constructor(xmin: number, ymin: number, xmax: number, ymax: number, spatialReference: SpatialReference); + /** + * Creates a new Extent object using a JSON object. + * @param json JSON object representing the geometry. + */ + constructor(json: Object); + /** + * A new extent is returned with the same width and height centered at the argument point. + * @param point Centers the extent on the specified x,y location. + */ + centerAt(point: Point): Extent; + /** + * When "true", the geometry in the argument is contained in this extent. + * @param geometry Can be a Point or Extent. + */ + contains(geometry: Geometry): boolean; + /** + * Expands the extent by the factor given. + * @param factor The multiplier value. + */ + expand(factor: number): Extent; + /** Returns the center point of the extent in map units. */ + getCenter(): Point; + /** Distance between ymin and ymax. */ + getHeight(): number; + /** Distance between xmin and xmax. */ + getWidth(): number; + /** + * Returns the interesection extent if the input geometry is an extent that intersects this extent. + * @param geometry The geometry used to test the intersection. + */ + intersects(geometry: Geometry): any; + /** Returns an array with either one Extent that's been shifted to within +/- 180 or two Extents if the original extent intersects the dateline. */ + normalize(): Extent[]; + /** + * Returns a new Extent with x and y offsets. + * @param dx The offset distance in map units for the y-coordinate. + * @param dy The offset distance in map units for the x-coordinate. + */ + offset(dx: number, dy: number): Extent; + /** Returns an extent with a spatial reference with a custom shifted central meridian if the extent intersects the dateline. */ + shiftCentralMeridian(): Extent; + /** + * Expands this extent to include the extent of the argument. + * @param extent The minx, miny, maxx, and maxy bounding box. + */ + union(extent: Extent): Extent; + /** + * Updates this extent with the specified parameters. + * @param xmin Bottom-left X-coordinate of an extent envelope. + * @param ymin Bottom-left Y-coordinate of an extent envelope. + * @param xmax Top-right X-coordinate of an extent envelope. + * @param ymax Top-right Y-coordinate of an extent envelope. + * @param spatialReference Spatial reference of the geometry. + */ + update(xmin: number, ymin: number, xmax: number, ymax: number, spatialReference: SpatialReference): Extent; + } + export = Extent; +} + +declare module "esri/geometry/Geometry" { + import SpatialReference = require("esri/SpatialReference"); + + /** The base class for geometry objects. */ + class Geometry { + /** The cache is used to store values computed from geometries that need to cleared or recomputed upon mutation. */ + cache: any; + /** The spatial reference of the geometry. */ + spatialReference: SpatialReference; + /** The type of geometry. */ + type: string; + /** Sets the cache property to undefined. */ + clearCache(): void; + /** + * Returns the value for a named property stored in the cache. + * @param name The property name of the value to retrieve from the cache. + */ + getCacheValue(name: string): any; + /** + * Sets the value for a named property stored in the cache. + * @param name The property name for the value Object to store in the cache. + * @param value The value Object for a named property to store in the cache. + */ + setCacheValue(name: string, value: any): void; + /** + * Sets the spatial reference. + * @param sr Spatial reference of the geometry. + */ + setSpatialReference(sr: SpatialReference): Geometry; + /** Converts object to its ArcGIS Server JSON representation. */ + toJson(): any; + } + export = Geometry; +} + +declare module "esri/geometry/Multipoint" { + import Geometry = require("esri/geometry/Geometry"); + import SpatialReference = require("esri/SpatialReference"); + import Point = require("esri/geometry/Point"); + import Extent = require("esri/geometry/Extent"); + + /** An ordered collection of points. */ + class Multipoint extends Geometry { + /** An array of one or more points. */ + points: number[][]; + /** + * Creates a new Multipoint object. + * @param spatialReference Spatial reference of the geometry. + */ + constructor(spatialReference: SpatialReference); + /** + * Creates a new Multipoint object using a JSON object. + * @param json JSON object representing the geometry. + */ + constructor(json: Object); + /** + * Adds a point to the Multipoint. + * @param point The point to add. + */ + addPoint(point: Point): Multipoint; + /** + * Adds a point to the Multipoint. + * @param point The point to add. + */ + addPoint(point: number[]): Multipoint; + /** Gets the extent of all the points. */ + getExtent(): Extent; + /** + * Returns the point at the specified index. + * @param index Positional index of the point in the points property. + */ + getPoint(index: number): Point; + /** + * Removes a point from the Multipoint. + * @param index The index of the point to remove. + */ + removePoint(index: number): Point; + /** + * Updates the point at the specified index. + * @param index Positional index of the point in the points property. + * @param point Point that specifies the new location. + */ + setPoint(index: number, point: Point): Multipoint; + } + export = Multipoint; +} + +declare module "esri/geometry/Point" { + import Geometry = require("esri/geometry/Geometry"); + import SpatialReference = require("esri/SpatialReference"); + + /** A location defined by an X- and Y- coordinate. */ + class Point extends Geometry { + /** X-coordinate of a point in map units. */ + x: number; + /** Y-coordinate of a point in map units. */ + y: number; + /** + * Creates a new Point object using x, y, and a spatial reference. + * @param x X-coordinate of a point in map units. + * @param y Y-coordinate of a point in map units. + * @param spatialReference Spatial reference of the geometry. + */ + constructor(x: number, y: number, spatialReference: SpatialReference); + /** + * Creates a new Point object using an array containing an x,y coordinate value and a spatial reference. + * @param coords An array that includes an x,y coordinate. + * @param spatialReference Spatial reference of the geometry. + */ + constructor(coords: number[], spatialReference: SpatialReference); + /** + * Creates a new Point object using a JSON object. + * @param json A JSON object that contains an x,y coordinate. + */ + constructor(json: Object); + /** + * Create a point object and initialize it with specified longitude and latitude. + * @param long Longitude value. + * @param lat Latitude value. + */ + constructor(long: number, lat: number); + /** + * Create a point object and initialize it with an array containing longitude and latitude values. + * @param point An input array containing the longitude and latitude values for the point. + */ + constructor(point: number[]); + /** + * Create a point object and initialize it with an object that has latitude and longitude properties. + * @param point An object with latitude and longitude properties. + */ + constructor(point: any); + /** Returns the latitude coordinate for this point if the spatial reference of the point is Web Mercator or Geographic (4326). */ + getLatitude(): number; + /** Returns the longitude coordinate for this point if the spatial reference of the point is Web Mercator or Geographic (4326). */ + getLongitude(): number; + /** Shifts the x coordinate to within +/- 180 span. */ + normalize(): Point; + /** + * Returns a new Point with x and y offsets. + * @param dx The offset distance in map units from the x-coordinate. + * @param dy The offset distance in map units from the y-coordinate. + */ + offset(dx: number, dy: number): Point; + /** + * Sets the latitude coordinate for this point to the specified value if the point's spatial reference is Web Mercator or Geographic (4326). + * @param lat A valid latitude value. + */ + setLatitude(lat: number): Point; + /** + * Sets the longitude coordinate for this point to the specified value if the point's spatial reference is Web Mercator or Geographic (4326). + * @param lon A valid longitude value. + */ + setLongitude(lon: number): Point; + /** + * Sets x-coordinate of point. + * @param x Value for x-coordinate of point. + */ + setX(x: number): Point; + /** + * Sets y-coordinate of point. + * @param y Value for y-coordinate of point. + */ + setY(y: number): Point; + /** + * Updates a point. + * @param x X-coordinate of the updated point. + * @param y Y-coordinate of the updated point. + */ + update(x: number, y: number): Point; + } + export = Point; +} + +declare module "esri/geometry/Polygon" { + import Geometry = require("esri/geometry/Geometry"); + import SpatialReference = require("esri/SpatialReference"); + import Point = require("esri/geometry/Point"); + import Extent = require("esri/geometry/Extent"); + + /** An array of rings where each ring is an array of points. */ + class Polygon extends Geometry { + /** An array of rings. */ + rings: number[][][]; + /** + * Creates a new Polygon object. + * @param spatialReference Spatial reference of the geometry. + */ + constructor(spatialReference: SpatialReference); + /** + * Creates a new Polygon object using a JSON object. + * @param json JSON object representing the geometry. + */ + constructor(json: Object); + /** + * Create a new polygon by providing an array of geographic coordinate pairs. + * @param coordinates An array of geographic coordinates that define the polygon. + */ + constructor(coordinates: number[][]); + /** + * Create a new polygon by providing an array of geographic coordinate pairs. + * @param coordinates An array of geographic coordinates that define the polygon. + */ + constructor(coordinates: number[][][]); + /** + * Adds a ring to the Polygon. + * @param ring A polygon ring. + */ + addRing(ring: Point[]): Polygon; + /** + * Adds a ring to the Polygon. + * @param ring A polygon ring. + */ + addRing(ring: number[][]): Polygon; + /** + * Checks on the client if the specified point is inside the polygon. + * @param point The location defined by an X- and Y- coordinate in map units. + */ + contains(point: Point): boolean; + /** + * Returns a new Polygon with one ring containing points equivalent to the coordinates of the extent. + * @param extent The Extent geometry to convert to a Polygon. + */ + static fromExtent(extent: Extent): Polygon; + /** Returns the centroid of the polygon as defined here. */ + getCentroid(): Point; + /** Returns the extent of the polygon. */ + getExtent(): Extent; + /** + * Returns a point specified by a ring and point in the path. + * @param ringIndex The index of a ring. + * @param pointIndex The index of a point in a ring. + */ + getPoint(ringIndex: number, pointIndex: number): Point; + /** + * Inserts a new point into a polygon. + * @param ringIndex Ring index to insert point. + * @param pointIndex The index of the inserted point in the ring. + * @param point Point to insert into the ring. + */ + insertPoint(ringIndex: number, pointIndex: number, point: Point): Polygon; + /** + * Checks if a Polygon ring is clockwise. + * @param ring A polygon ring. + */ + isClockwise(ring: Point[]): boolean; + /** + * Checks if a Polygon ring is clockwise. + * @param ring A polygon ring. + */ + isClockwise(ring: number[][]): boolean; + /** + * When true, the polygon is self-intersecting which means that the ring of the polygon crosses itself. + * @param polygon The polygon to test for self-intersection. + */ + isSelfIntersecting(polygon: Polygon): boolean; + /** + * Remove a point from the polygon at the given pointIndex within the ring identified by ringIndex. + * @param ringIndex The index of the ring containing the point. + * @param pointIndex The index of the point within the ring. + */ + removePoint(ringIndex: number, pointIndex: number): Point; + /** + * Removes a ring from the Polygon. + * @param ringIndex The index of the ring to remove. + */ + removeRing(ringIndex: number): Point[]; + /** + * Updates a point in a polygon. + * @param ringIndex Ring index for updated point. + * @param pointIndex The index of the updated point in the ring. + * @param point Point to update in the ring. + */ + setPoint(ringIndex: number, pointIndex: number, point: Point): Polygon; + } + export = Polygon; +} + +declare module "esri/geometry/Polyline" { + import Geometry = require("esri/geometry/Geometry"); + import SpatialReference = require("esri/SpatialReference"); + import Point = require("esri/geometry/Point"); + import Extent = require("esri/geometry/Extent"); + + /** An array of paths where each path is an array of points. */ + class Polyline extends Geometry { + /** An array of paths. */ + paths: number[][][]; + /** + * Creates a new Polyline object. + * @param spatialReference Spatial reference of the geometry. + */ + constructor(spatialReference: SpatialReference); + /** + * Creates a new Polyline object using a JSON object. + * @param json JSON object representing the geometry. + */ + constructor(json: Object); + /** + * Create a new polyline by providing an array of geographic coordinates. + * @param coordinates An array of geographic coordinates that define the polyline. + */ + constructor(coordinates: number[][]); + /** + * Create a new polyline by providing an array of geographic coordinates. + * @param coordinates An array of geographic coordinates that define the polyline. + */ + constructor(coordinates: number[][][]); + /** + * Adds a path to the Polyline. + * @param path Path to add to the Polyline. + */ + addPath(path: Point[]): Polyline; + /** + * Adds a path to the Polyline. + * @param path Path to add to the Polyline. + */ + addPath(path: number[][]): Polyline; + /** Returns the extent of the Polyline. */ + getExtent(): Extent; + /** + * Returns a point specified by a path and point in the path. + * @param pathIndex The index of a path in a polyline. + * @param pointIndex The index of a point in a path. + */ + getPoint(pathIndex: number, pointIndex: number): Point; + /** + * Inserts a new point into a polyline. + * @param pathIndex Path index to insert point. + * @param pointIndex The index of the inserted point in the path. + * @param point Point to insert into the path. + */ + insertPoint(pathIndex: number, pointIndex: number, point: Point): Polyline; + /** + * Removes a path from the Polyline. + * @param pathIndex The index of a path to remove. + */ + removePath(pathIndex: number): Point[]; + /** + * Remove a point from the polyline at the given pointIndex within the path identified by the given pathIndex. + * @param pathIndex The index of the path containing the point. + * @param pointIndex The index of the point within the path. + */ + removePoint(pathIndex: number, pointIndex: number): Point; + /** + * Updates a point in a polyline. + * @param pathIndex Path index for updated point. + * @param pointIndex The index of the updated point in the path. + * @param point Point to update in the path. + */ + setPoint(pathIndex: number, pointIndex: number, point: Point): Polyline; + } + export = Polyline; +} + +declare module "esri/geometry/ScreenPoint" { + /** ScreenPoint represents a point in terms of pixels relative to the top-left corner of the map control. */ + class ScreenPoint { + /** X-coordinate relative to the top-left corner of the map control in pixels. */ + x: number; + /** Y-coordinate relative to the top-left corner of the map control in pixels. */ + y: number; + /** + * Creates a new ScreenPoint object with X-, Y- coordinates. + * @param x X-coordinate relative to the top-left corner of the map control in pixels. + * @param y Y-coordinate relative to the top-left corner of the map control in pixels. + */ + constructor(x: number, y: number); + /** + * Creates a new ScreenPoint object with an array containing X-, Y- coordinates. + * @param coords An array that includes X-, Y- coordinates. + */ + constructor(coords: number[]); + /** + * Creates a new ScreenPoint object with a JSON object. + * @param json A JSON object that includes X-, Y- coordinates. + */ + constructor(json: Object); + /** + * Offsets the point in an x and y direction. + * @param dx Value for x-coordinate of point. + * @param dy Value for y-coordinate of point. + */ + offset(dx: number, dy: number): ScreenPoint; + /** + * Sets x-coordinate of point. + * @param x Value for x-coordinate of point. + */ + setX(x: number): ScreenPoint; + /** + * Sets y-coordinate of point. + * @param y Value for y-coordinate of point. + */ + setY(y: number): ScreenPoint; + /** Converts object to its ArcGIS Server JSON representation. */ + toJson(): any; + /** + * Updates a ScreenPoint. + * @param x X-coordinate relative to the top-left corner of the map control in pixels. + * @param y Y-coordinate relative to the top-left corner of the map control in pixels. + */ + update(x: number, y: number): ScreenPoint; + } + export = ScreenPoint; +} + +declare module "esri/geometry/geodesicUtils" { + import Polygon = require("esri/geometry/Polygon"); + import Geometry = require("esri/geometry/Geometry"); + import Polyline = require("esri/geometry/Polyline"); + + /** Utility methods for various geodesic calculations. */ + var geodesicUtils: { + /** + * Determine the area for the input polygons. + * @param polygons An array of polygons. + * @param areaUnit The area unit. + */ + geodesicAreas(polygons: Polygon[], areaUnit: string): number[]; + /** + * Returns a densified geometry. + * @param geometry A polyline or polygon to densify. + * @param maxSegmentLength The maximum segment length in meters. + */ + geodesicDensify(geometry: Geometry, maxSegmentLength: number): Geometry; + /** + * Determine the length for the input polylines using the specified length unit. + * @param polylines An array of polylines. + * @param lengthUnit The length unit. + */ + geodesicLengths(polylines: Polyline[], lengthUnit: string): number[]; + }; + export = geodesicUtils; +} + +declare module "esri/geometry/geometryEngine" { + import Geometry = require("esri/geometry/Geometry"); + import Extent = require("esri/geometry/Extent"); + import Polyline = require("esri/geometry/Polyline"); + import SpatialReference = require("esri/SpatialReference"); + import Point = require("esri/geometry/Point"); + + /** (Beta at v3.13) A client-side geometry engine. */ + var geometryEngine: { + /** + * Creates buffer polygons at a specified distance around the given geometries. + * @param geometry The buffer input geometry. + * @param distance The specified distance(s) for buffering. + * @param unit Unit for the distances. + * @param unionResults Whether the output geometries should be unioned into a single polygon. + */ + buffer(geometry: Geometry, distance: number[], unit?: number, unionResults?: boolean): any; + /** + * Creates buffer polygons at a specified distance around the given geometries. + * @param geometry The buffer input geometry. + * @param distance The specified distance(s) for buffering. + * @param unit Unit for the distances. + * @param unionResults Whether the output geometries should be unioned into a single polygon. + */ + buffer(geometry: Geometry[], distance: number, unit?: number, unionResults?: boolean): any; + /** + * Creates buffer polygons at a specified distance around the given geometries. + * @param geometry The buffer input geometry. + * @param distance The specified distance(s) for buffering. + * @param unit Unit for the distances. + * @param unionResults Whether the output geometries should be unioned into a single polygon. + */ + buffer(geometry: Geometry, distance: number, unit?: number, unionResults?: boolean): any; + /** + * Creates buffer polygons at a specified distance around the given geometries. + * @param geometry The buffer input geometry. + * @param distance The specified distance(s) for buffering. + * @param unit Unit for the distances. + * @param unionResults Whether the output geometries should be unioned into a single polygon. + */ + buffer(geometry: Geometry[], distance: number[], unit?: number, unionResults?: boolean): any; + /** + * Calculates the clipped geometry from a target geometry by an envelope. + * @param geometry The geometry to be clipped. + * @param envelope The envelope used to clip. + */ + clip(geometry: Geometry, envelope: Extent): Geometry; + /** + * Indicates if one geometry contains another geometry. + * @param geometry1 The geometry that is tested for the contains relationship to the other geometry. + * @param geometry2 The geometry that is tested for within relationship to the other geometry. + */ + contains(geometry1: Geometry, geometry2: Geometry): boolean; + /** + * Calculates the convex hull of the input geometry. + * @param geometry The input geometry. + * @param merge Whether to merge output geometries. + */ + convexHull(geometry: Geometry, merge?: boolean): any; + /** + * Calculates the convex hull of the input geometry. + * @param geometry The input geometry. + * @param merge Whether to merge output geometries. + */ + convexHull(geometry: Geometry[], merge?: boolean): any; + /** + * Indicates if one geometry crosses another geometry. + * @param geometry1 The geometry to cross. + * @param geometry2 The geometry being crossed. + */ + crosses(geometry1: Geometry, geometry2: Geometry): boolean; + /** + * Split the input polyline or polygon where it crosses a cutting polyline. + * @param geometry The geometry to be cut. + * @param cutter The polyline to cut the geometry. + */ + cut(geometry: Geometry, cutter: Polyline): Geometry[]; + /** + * Densify geometries by plotting points between existing vertices. + * @param geometry The geometry to be densified. + * @param maxSegmentLength The maximum segment length allowed. + * @param maxSegmentLengthUnit Unit for the maximum segment length. + */ + densify(geometry: Geometry, maxSegmentLength: number, maxSegmentLengthUnit?: number): Geometry; + /** + * Creates the difference of two geometries. + * @param geometry The input geometry. + * @param subtractor The geometry being subtracted. + */ + difference(geometry: Geometry, subtractor: Geometry): any; + /** + * Creates the difference of two geometries. + * @param geometry The input geometry. + * @param subtractor The geometry being subtracted. + */ + difference(geometry: Geometry[], subtractor: Geometry): any; + /** + * Indicates if one geometry is disjoint from another geometry. + * @param geometry1 The base geometry that is tested for within relationship to the other geometry. + * @param geometry2 The comparison geometry that is tested for the disjoint relationship to the other geometry. + */ + disjoint(geometry1: Geometry, geometry2: Geometry): boolean; + /** + * Calculates the 2D planar shortest distance between two geometries. + * @param geometry1 + * @param geometry2 + * @param distanceUnit Units of the return value. + */ + distance(geometry1: Geometry, geometry2: Geometry, distanceUnit?: number): number; + /** + * Indicates if two geometries are equal. + * @param geometry1 + * @param geometry2 + */ + equals(geometry1: Geometry, geometry2: Geometry): boolean; + /** + * Returns an object containing additional information about the input spatial reference. + * @param spatialReference The spatial Reference. + */ + extendedSpatialReferenceInfo(spatialReference: SpatialReference): any; + /** + * Flips a geometry on the horizontal axis. + * @param geometry The input geometry. + * @param flipOrigin Point to flip the geometry around. + */ + flipHorizontal(geometry: Geometry, flipOrigin?: Point): Geometry; + /** + * Flips a geometry on the vertical axis. + * @param geometry The input geometry. + * @param flipOrigin Point to flip the geometry around. + */ + flipVertical(geometry: Geometry, flipOrigin?: Point): Geometry; + /** + * Performs the generalize operation on the geometries in the cursor. + * @param geometry The geometry to be generalized. + * @param maxDeviation The maximum allowed deviation from the generalized geometry to the original geometry. + * @param removeDegenerateParts When true, the degenerate parts of the geometry will be removed from the output (may be undesired for drawing). + * @param maxDeviationUnit A unit for maximum deviation. + */ + generalize(geometry: Geometry, maxDeviation: number, removeDegenerateParts?: boolean, maxDeviationUnit?: number): Geometry; + /** + * Calculates area of input geometry using geographic (geodesic) coordinates. + * @param geometry + * @param unit Units of the return value. + */ + geodesicArea(geometry: Geometry, unit?: number): number; + /** + * Creates buffer polygons at a specified distance around the given geometries using geographic (geodesic) coordinates. + * @param geometry The buffer input geometry. + * @param distance The specified distance(s) for buffering. + * @param unit Unit for the distances. + * @param unionResults Whether the output geometries should be unioned into a single polygon. + */ + geodesicBuffer(geometry: Geometry, distance: number[], unit?: number, unionResults?: boolean): any; + /** + * Creates buffer polygons at a specified distance around the given geometries using geographic (geodesic) coordinates. + * @param geometry The buffer input geometry. + * @param distance The specified distance(s) for buffering. + * @param unit Unit for the distances. + * @param unionResults Whether the output geometries should be unioned into a single polygon. + */ + geodesicBuffer(geometry: Geometry[], distance: number, unit?: number, unionResults?: boolean): any; + /** + * Creates buffer polygons at a specified distance around the given geometries using geographic (geodesic) coordinates. + * @param geometry The buffer input geometry. + * @param distance The specified distance(s) for buffering. + * @param unit Unit for the distances. + * @param unionResults Whether the output geometries should be unioned into a single polygon. + */ + geodesicBuffer(geometry: Geometry, distance: number, unit?: number, unionResults?: boolean): any; + /** + * Creates buffer polygons at a specified distance around the given geometries using geographic (geodesic) coordinates. + * @param geometry The buffer input geometry. + * @param distance The specified distance(s) for buffering. + * @param unit Unit for the distances. + * @param unionResults Whether the output geometries should be unioned into a single polygon. + */ + geodesicBuffer(geometry: Geometry[], distance: number[], unit?: number, unionResults?: boolean): any; + /** + * Calculates length of the input geometry using geographic (geodesic) coordinates. + * @param geometry + * @param unit Units of the return value. + */ + geodesicLength(geometry: Geometry, unit?: number): number; + /** + * Creates a new geometry through intersection between two geometries. + * @param geometry The input geometry. + * @param intersector The geometry being intersected. + */ + intersect(geometry: Geometry, intersector: Geometry): any; + /** + * Creates a new geometry through intersection between two geometries. + * @param geometry The input geometry. + * @param intersector The geometry being intersected. + */ + intersect(geometry: Geometry[], intersector: Geometry): any; + /** + * Indicates if one geometry intersects another geometry. + * @param geometry1 The geometry that is tested for the intersects relationship to the other geometry. + * @param geometry2 The geometry being intersected. + */ + intersects(geometry1: Geometry, geometry2: Geometry): boolean; + /** + * Indicates if the given geometry is simple. + * @param geometry Geometry + */ + isSimple(geometry: Geometry): boolean; + /** + * Finds the coordinate of the geometry which is closest to the specified point. + * @param geometry The geometry to consider. + * @param inputPoint The point to find the nearest coordinate in the geometry for. + */ + nearestCoordinate(geometry: Geometry, inputPoint: Point): any; + /** + * Finds vertex on the geometry nearest to the specified point. + * @param geometry The geometry to consider. + * @param inputPoint The point to find the nearest vertex in the geometry for. + */ + nearestVertex(geometry: Geometry, inputPoint: Point): any; + /** + * Finds all vertices in the given distance from the specified point, sorted from the closest to the furthest and returns them as an array of objects. + * @param geometry The geometry to consider. + * @param inputPoint The point to start from. + * @param searchRadius The search radius. + * @param maxVertexCountToReturn The maximum number number of vertices to return. + */ + nearestVertices(geometry: Geometry, inputPoint: Point, searchRadius: number, maxVertexCountToReturn: number): any[]; + /** + * Creates offset version of the input geometry. + * @param geometry The geometries to offset. + * @param distance The offset distance for the Geometries. + * @param offsetUnit Unit for the offset. + * @param joinType The join type. + * @param bevelRatio Applicable to MITER, bevelRatio is multiplied by the offset distance and the result determines how far a mitered offset intersection can be located before it is beveled. + * @param flattenError Applicable to ROUND, flattenError determines the maximum distance of the resulting segments compared to the true circular arc. + */ + offset(geometry: Geometry, distance: number, offsetUnit: number, joinType: number, bevelRatio?: number, flattenError?: number): any; + /** + * Creates offset version of the input geometry. + * @param geometry The geometries to offset. + * @param distance The offset distance for the Geometries. + * @param offsetUnit Unit for the offset. + * @param joinType The join type. + * @param bevelRatio Applicable to MITER, bevelRatio is multiplied by the offset distance and the result determines how far a mitered offset intersection can be located before it is beveled. + * @param flattenError Applicable to ROUND, flattenError determines the maximum distance of the resulting segments compared to the true circular arc. + */ + offset(geometry: Geometry[], distance: number, offsetUnit: number, joinType: number, bevelRatio?: number, flattenError?: number): any; + /** + * Indicates if one geometry overlaps another geometry. + * @param geometry1 The base geometry that is tested for overlaps relationship to the other geometry. + * @param geometry2 The comparison geometry that is tested for the overlaps relationship to the other geometry. + */ + overlaps(geometry1: Geometry, geometry2: Geometry): boolean; + /** + * Calculates the area of the input geometry using projected (planar) coordinates. + * @param geometry + * @param unit Units of the return value. + */ + planarArea(geometry: Geometry, unit?: number): number; + /** + * Calculates the length of the input geometry using projected (planar) coordinates. + * @param geometry + * @param unit Units of the return value. + */ + planarLength(geometry: Geometry, unit: number): number; + /** + * Indicates if the given relation holds for the two geometries. + * @param geometry1 The first geometry for the relation. + * @param geometry2 The second geometry for the relation. + * @param relation The DE-9IM matrix relation encoded as a string. + */ + relate(geometry1: Geometry, geometry2: Geometry, relation: string): boolean; + /** + * Rotates a geometry by a specified angle. + * @param geometry The input geometry. + * @param angle The rotation angle + * @param rotationOrigin Point to rotate the geometry around. + */ + rotate(geometry: Geometry, angle: number, rotationOrigin?: Point): Geometry; + /** + * Performs the simplify operation on the geometry which alters the given geometries to make their definitions topologically legal with respect to their geometry type. + * @param geometry Geometry + */ + simplify(geometry: Geometry): Geometry; + /** + * Creates the symmetric difference of two geometries. + * @param leftGeometry One of the Geometry instances in the XOR operation. + * @param rightGeometry One of the Geometry instances in the XOR operation. + */ + symmetricDifference(leftGeometry: Geometry, rightGeometry: Geometry): any; + /** + * Creates the symmetric difference of two geometries. + * @param leftGeometry One of the Geometry instances in the XOR operation. + * @param rightGeometry One of the Geometry instances in the XOR operation. + */ + symmetricDifference(leftGeometry: Geometry[], rightGeometry: Geometry): any; + /** + * Indicates if one geometry touches another geometry. + * @param geometry1 The geometry which may be touching another geometry. + * @param geometry2 The geometry to be touched. + */ + touches(geometry1: Geometry, geometry2: Geometry): boolean; + /** + * All inputs must be of the same type of geometries and share one spatial reference. + * @param geometries The geometries to union. + */ + union(geometries: Geometry[]): Geometry; + /** + * Indicates if one geometry is within another geometry. + * @param geometry1 The base geometry that is tested for within relationship to the other geometry. + * @param geometry2 The comparison geometry that is tested for the contains relationship to the other geometry. + */ + within(geometry1: Geometry, geometry2: Geometry): boolean; + }; + export = geometryEngine; +} + +declare module "esri/geometry/geometryEngineAsync" { + import Geometry = require("esri/geometry/Geometry"); + import Extent = require("esri/geometry/Extent"); + import Polyline = require("esri/geometry/Polyline"); + import SpatialReference = require("esri/SpatialReference"); + import Point = require("esri/geometry/Point"); + + /** (Beta at v3.13) A client-side asynchronous geometry engine. */ + var geometryEngineAsync: { + /** + * Creates buffer polygons at a specified distance around the given geometries. + * @param geometry The buffer input geometry. + * @param distance The specified distance(s) for buffering. + * @param unit Unit for the distances. + * @param unionResults Whether the output geometries should be unioned into a single polygon. + */ + buffer(geometry: Geometry, distance: number[], unit?: number, unionResults?: boolean): any; + /** + * Creates buffer polygons at a specified distance around the given geometries. + * @param geometry The buffer input geometry. + * @param distance The specified distance(s) for buffering. + * @param unit Unit for the distances. + * @param unionResults Whether the output geometries should be unioned into a single polygon. + */ + buffer(geometry: Geometry[], distance: number, unit?: number, unionResults?: boolean): any; + /** + * Creates buffer polygons at a specified distance around the given geometries. + * @param geometry The buffer input geometry. + * @param distance The specified distance(s) for buffering. + * @param unit Unit for the distances. + * @param unionResults Whether the output geometries should be unioned into a single polygon. + */ + buffer(geometry: Geometry, distance: number, unit?: number, unionResults?: boolean): any; + /** + * Creates buffer polygons at a specified distance around the given geometries. + * @param geometry The buffer input geometry. + * @param distance The specified distance(s) for buffering. + * @param unit Unit for the distances. + * @param unionResults Whether the output geometries should be unioned into a single polygon. + */ + buffer(geometry: Geometry[], distance: number[], unit?: number, unionResults?: boolean): any; + /** + * Calculates the clipped geometry from a target geometry by an envelope. + * @param geometry The geometry to be clipped. + * @param envelope The envelope used to clip. + */ + clip(geometry: Geometry, envelope: Extent): any; + /** + * Indicates if one geometry contains another geometry. + * @param geometry1 The geometry that is tested for the contains relationship to the other geometry. + * @param geometry2 The geometry that is tested for within relationship to the other geometry. + */ + contains(geometry1: Geometry, geometry2: Geometry): any; + /** + * Calculates the convex hull of the input geometry. + * @param geometry The input geometry. + * @param merge Whether to merge output geometries. + */ + convexHull(geometry: Geometry, merge?: boolean): any; + /** + * Calculates the convex hull of the input geometry. + * @param geometry The input geometry. + * @param merge Whether to merge output geometries. + */ + convexHull(geometry: Geometry[], merge?: boolean): any; + /** + * Indicates if one geometry crosses another geometry. + * @param geometry1 The geometry to cross. + * @param geometry2 The geometry being crossed. + */ + crosses(geometry1: Geometry, geometry2: Geometry): any; + /** + * Split the input polyline or polygon where it crosses a cutting polyline. + * @param geometry The geometry to be cut. + * @param cutter The polyline to cut the geometry. + */ + cut(geometry: Geometry, cutter: Polyline): any; + /** + * Densify geometries by plotting points between existing vertices. + * @param geometry The geometry to be densified. + * @param maxSegmentLength The maximum segment length allowed. + * @param maxSegmentLengthUnit Unit for the maximum segment length. + */ + densify(geometry: Geometry, maxSegmentLength: number, maxSegmentLengthUnit?: number): any; + /** + * Creates the difference of two geometries. + * @param geometry The input geometry. + * @param subtractor The geometry being subtracted. + */ + difference(geometry: Geometry, subtractor: Geometry): any; + /** + * Creates the difference of two geometries. + * @param geometry The input geometry. + * @param subtractor The geometry being subtracted. + */ + difference(geometry: Geometry[], subtractor: Geometry): any; + /** + * Indicates if one geometry is disjoint from another geometry. + * @param geometry1 The base geometry that is tested for within relationship to the other geometry. + * @param geometry2 The comparison geometry that is tested for the disjoint relationship to the other geometry. + */ + disjoint(geometry1: Geometry, geometry2: Geometry): any; + /** + * Calculates the 2D planar shortest distance between two geometries. + * @param geometry1 + * @param geometry2 + * @param distanceUnit Units of the return value. + */ + distance(geometry1: Geometry, geometry2: Geometry, distanceUnit?: number): any; + /** + * Indicates if two geometries are equal. + * @param geometry1 + * @param geometry2 + */ + equals(geometry1: Geometry, geometry2: Geometry): any; + /** + * Returns an object containing additional information about the input spatial reference. + * @param spatialReference The spatial Reference. + */ + extendedSpatialReferenceInfo(spatialReference: SpatialReference): any; + /** + * Flips a geometry on the horizontal axis. + * @param geometry The input geometry. + * @param flipOrigin Point to flip the geometry around. + */ + flipHorizontal(geometry: Geometry, flipOrigin?: Point): any; + /** + * Flips a geometry on the vertical axis. + * @param geometry The input geometry. + * @param flipOrigin Point to flip the geometry around. + */ + flipVertical(geometry: Geometry, flipOrigin?: Point): any; + /** + * Performs the generalize operation on the geometries in the cursor. + * @param geometry The geometry to be generalized. + * @param maxDeviation The maximum allowed deviation from the generalized geometry to the original geometry. + * @param removeDegenerateParts When true, the degenerate parts of the geometry will be removed from the output (may be undesired for drawing). + * @param maxDeviationUnit A unit for maximum deviation. + */ + generalize(geometry: Geometry, maxDeviation: number, removeDegenerateParts?: boolean, maxDeviationUnit?: number): any; + /** + * Calculates area of input geometry using geographic (geodesic) coordinates. + * @param geometry + * @param unit Units of the return value. + */ + geodesicArea(geometry: Geometry, unit?: number): any; + /** + * Creates buffer polygons at a specified distance around the given geometries using geographic (geodesic) coordinates. + * @param geometry The buffer input geometry. + * @param distance The specified distance(s) for buffering. + * @param unit Unit for the distances. + * @param unionResults Whether the output geometries should be unioned into a single polygon. + */ + geodesicBuffer(geometry: Geometry, distance: number[], unit?: number, unionResults?: boolean): any; + /** + * Creates buffer polygons at a specified distance around the given geometries using geographic (geodesic) coordinates. + * @param geometry The buffer input geometry. + * @param distance The specified distance(s) for buffering. + * @param unit Unit for the distances. + * @param unionResults Whether the output geometries should be unioned into a single polygon. + */ + geodesicBuffer(geometry: Geometry[], distance: number, unit?: number, unionResults?: boolean): any; + /** + * Creates buffer polygons at a specified distance around the given geometries using geographic (geodesic) coordinates. + * @param geometry The buffer input geometry. + * @param distance The specified distance(s) for buffering. + * @param unit Unit for the distances. + * @param unionResults Whether the output geometries should be unioned into a single polygon. + */ + geodesicBuffer(geometry: Geometry, distance: number, unit?: number, unionResults?: boolean): any; + /** + * Creates buffer polygons at a specified distance around the given geometries using geographic (geodesic) coordinates. + * @param geometry The buffer input geometry. + * @param distance The specified distance(s) for buffering. + * @param unit Unit for the distances. + * @param unionResults Whether the output geometries should be unioned into a single polygon. + */ + geodesicBuffer(geometry: Geometry[], distance: number[], unit?: number, unionResults?: boolean): any; + /** + * Calculates length of the input geometry using geographic (geodesic) coordinates. + * @param geometry + * @param unit Units of the return value. + */ + geodesicLength(geometry: Geometry, unit?: number): any; + /** + * Creates a new geometry through intersection between two geometries. + * @param geometry The input geometry. + * @param intersector The geometry being intersected. + */ + intersect(geometry: Geometry, intersector: Geometry): any; + /** + * Creates a new geometry through intersection between two geometries. + * @param geometry The input geometry. + * @param intersector The geometry being intersected. + */ + intersect(geometry: Geometry[], intersector: Geometry): any; + /** + * Indicates if one geometry intersects another geometry. + * @param geometry1 The geometry that is tested for the intersects relationship to the other geometry. + * @param geometry2 The geometry being intersected. + */ + intersects(geometry1: Geometry, geometry2: Geometry): any; + /** + * Indicates if the given geometry is simple. + * @param geometry Geometry + */ + isSimple(geometry: Geometry): any; + /** + * Finds the coordinate of the geometry which is closest to the specified point. + * @param geometry The geometry to consider. + * @param inputPoint The point used to find the nearest coordinate in the geometry. + */ + nearestCoordinate(geometry: Geometry, inputPoint: Point): any; + /** + * Finds vertex on the geometry nearest to the specified point. + * @param geometry The geometry to consider. + * @param inputPoint The point to find the nearest vertex in the geometry for. + */ + nearestVertex(geometry: Geometry, inputPoint: Point): any; + /** + * Finds all vertices in the given distance from the specified point, sorted from the closest to the furthest and returns them as an array of objects once resolved. + * @param geometry The geometry to consider. + * @param inputPoint The point to start from. + * @param searchRadius The search radius. + * @param maxVertexCountToReturn The maximum number number of vertices to return. + */ + nearestVertices(geometry: Geometry, inputPoint: Point, searchRadius: number, maxVertexCountToReturn: number): any; + /** + * Creates offset version of the input geometry. + * @param geometry The geometries to offset. + * @param distance The offset distance for the Geometries. + * @param offsetUnit Unit for the offset. + * @param joinType The join type. + * @param bevelRatio Applicable to MITER, bevelRatio is multiplied by the offset distance and the result determines how far a mitered offset intersection can be located before it is beveled. + * @param flattenError Applicable to ROUND, flattenError determines the maximum distance of the resulting segments compared to the true circular arc. + */ + offset(geometry: Geometry, distance: number, offsetUnit: number, joinType: number, bevelRatio?: number, flattenError?: number): any; + /** + * Creates offset version of the input geometry. + * @param geometry The geometries to offset. + * @param distance The offset distance for the Geometries. + * @param offsetUnit Unit for the offset. + * @param joinType The join type. + * @param bevelRatio Applicable to MITER, bevelRatio is multiplied by the offset distance and the result determines how far a mitered offset intersection can be located before it is beveled. + * @param flattenError Applicable to ROUND, flattenError determines the maximum distance of the resulting segments compared to the true circular arc. + */ + offset(geometry: Geometry[], distance: number, offsetUnit: number, joinType: number, bevelRatio?: number, flattenError?: number): any; + /** + * Indicates if one geometry overlaps another geometry. + * @param geometry1 The base geometry that is tested for overlaps relationship to the other geometry. + * @param geometry2 The comparison geometry that is tested for the overlaps relationship to the other geometry. + */ + overlaps(geometry1: Geometry, geometry2: Geometry): any; + /** + * Calculates the area of the input geometry using projected (planar) coordinates. + * @param geometry + * @param unit Units of the return value. + */ + planarArea(geometry: Geometry, unit?: number): any; + /** + * Calculates the length of the input geometry using projected (planar) coordinates. + * @param geometry + * @param unit Units of the return value. + */ + planarLength(geometry: Geometry, unit: number): any; + /** + * Indicates if the given relation holds for the two geometries. + * @param geometry1 The first geometry for the relation. + * @param geometry2 The second geometry for the relation. + * @param relation The DE-9IM matrix relation encoded as a string. + */ + relate(geometry1: Geometry, geometry2: Geometry, relation: string): any; + /** + * Rotates a geometry by a specified angle. + * @param geometry The input geometry. + * @param angle The rotation angle + * @param rotationOrigin Point to rotate the geometry around. + */ + rotate(geometry: Geometry, angle: number, rotationOrigin?: Point): any; + /** + * Performs the simplify operation on the geometry which alters the given geometries to make their definitions topologically legal with respect to their geometry type. + * @param geometry Geometry + */ + simplify(geometry: Geometry): any; + /** + * Creates the symmetric difference of two geometries. + * @param leftGeometry One of the Geometry instances in the XOR operation. + * @param rightGeometry One of the Geometry instances in the XOR operation. + */ + symmetricDifference(leftGeometry: Geometry, rightGeometry: Geometry): any; + /** + * Creates the symmetric difference of two geometries. + * @param leftGeometry One of the Geometry instances in the XOR operation. + * @param rightGeometry One of the Geometry instances in the XOR operation. + */ + symmetricDifference(leftGeometry: Geometry[], rightGeometry: Geometry): any; + /** + * Indicates if one geometry touches another geometry. + * @param geometry1 The geometry which may be touching another geometry. + * @param geometry2 The geometry to be touched. + */ + touches(geometry1: Geometry, geometry2: Geometry): any; + /** + * All inputs must be of the same type of geometries and share one spatial reference. + * @param geometries The geometries to union. + */ + union(geometries: Geometry[]): any; + /** + * Indicates if one geometry is within another geometry. + * @param geometry1 The base geometry that is tested for within relationship to the other geometry. + * @param geometry2 The comparison geometry that is tested for the contains relationship to the other geometry. + */ + within(geometry1: Geometry, geometry2: Geometry): any; + }; + export = geometryEngineAsync; +} + +declare module "esri/geometry/jsonUtils" { + import Geometry = require("esri/geometry/Geometry"); + + /** Utility methods for working with JSON geometry objects. */ + var jsonUtils: { + /** + * Converts the input JSON object to the appropriate esri.geometry.* object. + * @param json The JSON object. + */ + fromJson(json: Object): Geometry; + /** + * Requests the geometry type name as represented in the ArcGIS REST. + * @param geometry The ArcGIS JavaScript API geometry type to be converted. + */ + getJsonType(geometry: Geometry): string; + }; + export = jsonUtils; +} + +declare module "esri/geometry/mathUtils" { + import Point = require("esri/geometry/Point"); + + /** Utility methods for getting length of a line segment or intersection of two segments. */ + var mathUtils: { + /** + * Calculates the length of a line based on the input of two points. + * @param point1 The beginning point. + * @param point2 The ending point. + */ + getLength(point1: Point, point2: Point): number; + /** + * Calculates the intersecting point of two lines. + * @param line1start The beginning point of the first line. + * @param line1end The ending point of the first line. + * @param line2start The beginning point of the second line. + * @param line2end The ending point of the second line. + */ + getLineIntersection(line1start: Point, line1end: Point, line2start: Point, line2end: Point): Point; + }; + export = mathUtils; +} + +declare module "esri/geometry/normalizeUtils" { + import Geometry = require("esri/geometry/Geometry"); + import GeometryService = require("esri/tasks/GeometryService"); + + /** Normalizes geometries that intersect the central meridian or fall outside the world extent so they stay within the current coordinate system. */ + var normalizeUtils: { + /** + * Normalizes geometries that intersect the central meridian or fall outside the world extent so they stay within the current coordinate system. + * @param geometries An array of geometries to normalize. + * @param geometryService Specify a valid geometry service. + * @param callback The function to call when the method has completed. + * @param errback An error object is returned, if an error occurs on the Server during task execution. + */ + normalizeCentralMeridian(geometries: Geometry[], geometryService?: GeometryService, callback?: Function, errback?: Function): any; + }; + export = normalizeUtils; +} + +declare module "esri/geometry/scaleUtils" { + import Map = require("esri/map"); + import Extent = require("esri/geometry/Extent"); + import SpatialReference = require("esri/SpatialReference"); + + /** Utility methods to get map scale or extent for a given scale. */ + var scaleUtils: { + /** + * Get the extent for the specified scale. + * @param map The input map. + * @param scale The input scale. + */ + getExtentForScale(map: Map, scale: number): Extent; + /** + * Gets the current scale of the map. + * @param map The map whose scale should be calculated. + */ + getScale(map: Map): number; + /** + * Returns the value of one map unit for the given spatial reference (in meters). + * @param sr The spatial reference represented as a SpatialReference class, Number, or String. + */ + getUnitValueForSR(sr: SpatialReference): number; + /** + * Returns the value of one map unit for the given spatial reference (in meters). + * @param sr The spatial reference represented as a SpatialReference class, Number, or String. + */ + getUnitValueForSR(sr: number): number; + /** + * Returns the value of one map unit for the given spatial reference (in meters). + * @param sr The spatial reference represented as a SpatialReference class, Number, or String. + */ + getUnitValueForSR(sr: string): number; + }; + export = scaleUtils; +} + +declare module "esri/geometry/screenUtils" { + import Extent = require("esri/geometry/Extent"); + import Geometry = require("esri/geometry/Geometry"); + import ScreenPoint = require("esri/geometry/ScreenPoint"); + import Point = require("esri/geometry/Point"); + + /** Convert map coordinates to screen coordinates and vice versa. */ + var screenUtils: { + /** + * Converts the geometry argument to map coordinates based on the extent, width, and height of the Map. + * @param extent The current extent of the map in map coordinates. + * @param width The current width of the map in map units. + * @param height The current width of the map in map units. + * @param screenGeometry The geometry to convert from screen to map units. + */ + toMapGeometry(extent: Extent, width: number, height: number, screenGeometry: Geometry): Geometry; + /** + * Converts and returns the argument screen point in map coordinates. + * @param extent The current extent of the map in map coordinates. + * @param width The current width of the map in screen units. + * @param height The current width of the map in screen units. + * @param screenPoint The screenPoint to convert from screen to map units. + */ + toMapPoint(extent: Extent, width: number, height: number, screenPoint: ScreenPoint): Point; + /** + * Converts the geometry argument to screen coordinates based on the extent, width, and height of the Map. + * @param extent The current extent of the map in map coordinates. + * @param width The current width of the map in screen units. + * @param height The current width of the map in screen units. + * @param mapGeometry The geometry to convert from map to screen units. + */ + toScreenGeometry(extent: Extent, width: number, height: number, mapGeometry: Geometry): Geometry; + /** + * Converts and returns the argument map point in screen coordinates. + * @param extent The current extent of the map in map coordinates. + * @param width The current width of the map in screen units. + * @param height The current width of the map in screen units. + * @param mapPoint The point to convert from map to screen units. + */ + toScreenPoint(extent: Extent, width: number, height: number, mapPoint: Point): ScreenPoint; + }; + export = screenUtils; +} + +declare module "esri/geometry/webMercatorUtils" { + import SpatialReference = require("esri/SpatialReference"); + import Geometry = require("esri/geometry/Geometry"); + + /** Convert Web Mercator coordinates to geographic and vice versa. */ + var webMercatorUtils: { + /** + * Returns true if the 'source' can be projected to 'target' by the project() function, or if the 'source' and 'target' is the same spatialReference. + * @param source An input of type SpatialReference or an object with spatialReference property such as Geometry or Map. + * @param target The target spatial reference, of type SpatialReference or an object with spatialReference property such as Map. + */ + canProject(source: SpatialReference, target: any): boolean; + /** + * Returns true if the 'source' can be projected to 'target' by the project() function, or if the 'source' and 'target' is the same spatialReference. + * @param source An input of type SpatialReference or an object with spatialReference property such as Geometry or Map. + * @param target The target spatial reference, of type SpatialReference or an object with spatialReference property such as Map. + */ + canProject(source: any, target: SpatialReference): boolean; + /** + * Returns true if the 'source' can be projected to 'target' by the project() function, or if the 'source' and 'target' is the same spatialReference. + * @param source An input of type SpatialReference or an object with spatialReference property such as Geometry or Map. + * @param target The target spatial reference, of type SpatialReference or an object with spatialReference property such as Map. + */ + canProject(source: SpatialReference, target: SpatialReference): boolean; + /** + * Returns true if the 'source' can be projected to 'target' by the project() function, or if the 'source' and 'target' is the same spatialReference. + * @param source An input of type SpatialReference or an object with spatialReference property such as Geometry or Map. + * @param target The target spatial reference, of type SpatialReference or an object with spatialReference property such as Map. + */ + canProject(source: any, target: any): boolean; + /** + * Converts geometry from geographic units to Web Mercator units. + * @param geometry The geometry to convert. + */ + geographicToWebMercator(geometry: Geometry): Geometry; + /** + * Translates the given latitude and longitude values to Web Mercator. + * @param long The longitude value to convert. + * @param lat The latitude value to convert. + */ + lngLatToXY(long: number, lat: number): number[]; + /** + * Project the geometry clientside (if possible). + * @param geometry An input geometry. + * @param target The target spatial reference, of type SpatialReference or an object with spatialReference property such as Map. + */ + project(geometry: Geometry, target: SpatialReference): any; + /** + * Project the geometry clientside (if possible). + * @param geometry An input geometry. + * @param target The target spatial reference, of type SpatialReference or an object with spatialReference property such as Map. + */ + project(geometry: Geometry, target: any): any; + /** + * Converts geometry from Web Mercator units to geographic units. + * @param geometry The geometry to convert. + */ + webMercatorToGeographic(geometry: Geometry): Geometry; + /** + * Translates the given Web Mercator coordinates to Longitude and Latitude. + * @param x The x coordinate value to convert. + * @param y The y coordinate value to convert. + */ + xyToLngLat(x: number, y: number): number[]; + }; + export = webMercatorUtils; +} + +declare module "esri/graphic" { + import Geometry = require("esri/geometry/Geometry"); + import InfoTemplate = require("esri/InfoTemplate"); + import Symbol = require("esri/symbols/Symbol"); + import Layer = require("esri/layers/layer"); + + /** A Graphic can contain geometry, a symbol, attributes, or an infoTemplate. */ + class Graphic { + /** Name value pairs of fields and field values associated with the graphic. */ + attributes: any; + /** The geometry that defines the graphic. */ + geometry: Geometry; + /** The content for display in an InfoWindow. */ + infoTemplate: InfoTemplate; + /** The symbol for the graphic. */ + symbol: Symbol; + /** Indicate the visibility of the graphic. */ + visible: boolean; + /** + * Creates a new Graphic object. + * @param geometry The geometry that defines the graphic. + * @param symbol Symbol used for drawing the graphic. + * @param attributes Name value pairs of fields and field values associated with the graphic. + * @param infoTemplate The content for display in an InfoWindow. + */ + constructor(geometry?: Geometry, symbol?: Symbol, attributes?: any, infoTemplate?: InfoTemplate); + /** + * Creates a new Graphic object using a JSON object. + * @param json JSON object representing the graphic. + */ + constructor(json: Object); + /** + * Adds a new attribute or changes the value of an existing attribute on the graphic's node. + * @param name The name of the attribute. + * @param value The value of the attribute. + */ + attr(name: string, value: string): Graphic; + /** Draws the graphic. */ + draw(): Graphic; + /** Returns the content string based on attributes and infoTemplate values. */ + getContent(): string; + /** Returns the dojo/gfx/shape.Shape of the Esri graphic. */ + getDojoShape(): any; + /** Returns the info template associated with the graphic. */ + getInfoTemplate(): InfoTemplate; + /** Returns a reference to the associated layer. */ + getLayer(): Layer; + /** Returns the DOM node used to draw the graphic. */ + getNode(): any; + /** Returns one or more DOM nodes used to draw the graphic. */ + getNodes(): any; + /** Returns the dojox/gfx/shape.Shape of the Esri graphic. */ + getShape(): any; + /** Returns one or more dojox/gfx/shape.Shape used to draw the graphic. */ + getShapes(): any[]; + /** Returns the title string based on attributes and infoTemplate values. */ + getTitle(): string; + /** Hides the graphic. */ + hide(): void; + /** + * Defines the attributes of the graphic. + * @param attributes The name value pairs of fields and field values associated with the graphic. + */ + setAttributes(attributes: any): Graphic; + /** + * Defines the geometry of the graphic. + * @param geometry The geometry that defines the graphic. + */ + setGeometry(geometry: Geometry): Graphic; + /** + * Defines the InfoTemplate for the InfoWindow of the graphic. + * @param infoTemplate The content for display in an InfoWindow. + */ + setInfoTemplate(infoTemplate: InfoTemplate): Graphic; + /** + * Sets the symbol of the graphic. + * @param symbol The symbol for the graphic. + */ + setSymbol(symbol: Symbol): Graphic; + /** Shows the graphic. */ + show(): void; + /** Converts object to its ArcGIS Server JSON representation. */ + toJson(): any; + } + export = Graphic; +} + +declare module "esri/graphicsUtils" { + import Graphic = require("esri/graphic"); + import Geometry = require("esri/geometry/Geometry"); + import Extent = require("esri/geometry/Extent"); + + /** Utility methods for working with graphics. */ + var graphicsUtils: { + /** + * Converts an array of graphics to an array of geometries. + * @param graphics Array of graphics to convert to geometries + */ + getGeometries(graphics: Graphic[]): Geometry[]; + /** + * Utility function that returns the extent of an array of graphics. + * @param graphics The input graphics array. + */ + graphicsExtent(graphics: Graphic[]): Extent; + }; + export = graphicsUtils; +} + +declare module "esri/kernel" { + /** Utility methods for retrieving API version. */ + var kernel: { + /** Current version of the JavaScript API. */ + version: string; + }; + export = kernel; +} + +declare module "esri/lang" { + /** Utility methods for working with strings, arrays and objects. */ + var lang: { + /** + * Creates a new object with all properties that pass the test implemented by the filter provided in the function. + * @param object Object to filter. + * @param callback Function or string implementing the filtering. + * @param thisObject Optional object used to scope the call to the callback. + */ + filter(object: any, callback: Function, thisObject: any): any; + /** + * Returns true when the value is neither null or undefined. + * @param value The value to test. + */ + isDefined(value: any): boolean; + /** + * Strips HTML tags from a String or Object. + * @param value Object or String to be stripped of HTML tags. + */ + stripTags(value: any): any; + /** + * Strips HTML tags from a String or Object. + * @param value Object or String to be stripped of HTML tags. + */ + stripTags(value: string): any; + /** + * A wrapper around dojo.string.substitute that can also handle wildcard substitution. + * @param data The data object used in the substitution. + * @param template The template used for the substitution. + * @param first When true, returns only the first property found in the data object. + */ + substitute(data: any, template?: string, first?: boolean): string; + /** + * Iterates through the argument array and searches for the identifier to which the argument value matches. + * @param array The argument array for testing. + * @param value The value used in the search. + */ + valueOf(array: any[], value: any): any; + }; + export = lang; +} + +declare module "esri/layers/ArcGISDynamicMapServiceLayer" { + import esri = require("esri"); + import DynamicMapServiceLayer = require("esri/layers/DynamicMapServiceLayer"); + import DynamicLayerInfo = require("esri/layers/DynamicLayerInfo"); + import LayerDrawingOptions = require("esri/layers/LayerDrawingOptions"); + import LayerInfo = require("esri/layers/LayerInfo"); + import LayerTimeOptions = require("esri/layers/LayerTimeOptions"); + import TimeInfo = require("esri/layers/TimeInfo"); + import ImageParameters = require("esri/layers/ImageParameters"); + import MapImage = require("esri/layers/MapImage"); + + /** Allows you to work with a dynamic map service resource exposed by the ArcGIS Server REST API. */ + class ArcGISDynamicMapServiceLayer extends DynamicMapServiceLayer { + /** The URL, when available, where the layer's attribution data is stored. */ + attributionDataUrl: string; + /** Capabilities of the map service, possible values are Map, Query and Data. */ + capabilities: string; + /** Copyright string as defined by the map service. */ + copyright: string; + /** Map description as defined by the map service. */ + description: string; + /** When true, images are always requested from the server and the browser's cache is ignored. */ + disableClientCaching: boolean; + /** The output dpi of the dynamic map service layer. */ + dpi: number; + /** Array of DynamicLayerInfos used to change the layer ordering or redefine the map. */ + dynamicLayerInfos: DynamicLayerInfo[]; + /** When true, the layer has attribution data. */ + hasAttributionData: boolean; + /** The output image type. */ + imageFormat: string; + /** Whether or not background of dynamic image is transparent. */ + imageTransparency: boolean; + /** A dictionary from the layer id to the layerInfoTemplateOptions object. */ + infoTemplates: any; + /** Sets the layer definitions used to filter the features of individual layers in the map service. */ + layerDefinitions: string[]; + /** Array of LayerDrawingOptions used to override the way layers are drawn. */ + layerDrawingOptions: LayerDrawingOptions[]; + /** Returns the available layers in service and their default visibility. */ + layerInfos: LayerInfo[]; + /** Returns the current layer time options if applicable. */ + layerTimeOptions: LayerTimeOptions[]; + /** The maximum image height, in pixels, that the map service will export. */ + maxImageHeight: number; + /** The maximum image width, in pixels, that the map service will export. */ + maxImageWidth: number; + /** The maximum number of results that can be returned from query, identify and find operations. */ + maxRecordCount: number; + /** Maximum visible scale for the layer. */ + maxScale: number; + /** Minimum visible scale for the layer. */ + minScale: number; + /** When true, the layer's attribution is displayed on the map. */ + showAttribution: boolean; + /** Indicates if the service supports dynamic layers. */ + supportsDynamicLayers: boolean; + /** When true, the layer is suspended. */ + suspended: boolean; + /** Temporal information for the layer, such as time extent. */ + timeInfo: TimeInfo; + /** Default units of the layer as defined by the service. */ + units: string; + /** When true, the image is saved to the server, and a JSON formatted response is sent to the client with the URL location of the image. */ + useMapImage: boolean; + /** The version of ArcGIS Server where the map service is published. */ + version: number; + /** When true, the layer is visible at the current map scale. */ + visibleAtMapScale: boolean; + /** Gets the visible layers of the exported map. */ + visibleLayers: number[]; + /** + * Creates a new ArcGISDynamicMapServiceLayer object. + * @param url URL to the ArcGIS Server REST resource that represents a map service. + * @param options Optional parameters. + */ + constructor(url: string, options?: esri.ArcGISDynamicMapServiceLayerOptions); + /** Create an array of DynamicLayerInfos based on the current set of LayerInfo. */ + createDynamicLayerInfosFromLayerInfos(): DynamicLayerInfo[]; + /** + * Exports a map using values as specified by ImageParameters. + * @param imageParameters Input parameters assigned before exporting the map image. + * @param callback The function to call when the method has completed. + */ + exportMapImage(imageParameters?: ImageParameters, callback?: Function): void; + /** Asynchronously returns custom data for the layer when available. */ + getAttributionData(): any; + /** + * Returns true if the layer is visible at the given scale. + * @param scale The scale at which to check if the layer is visible. + */ + isVisibleAtScale(scale: number): boolean; + /** Resumes layer drawing. */ + resume(): void; + /** + * Resets all layer definitions to those defined in the service. + * @param doNotRefresh When true the layer will not refresh the map image. + */ + setDefaultLayerDefinitions(doNotRefresh?: boolean): void; + /** + * Clears the visible layers as defined in setVisibleLayers, and resets to the default layers of the map service. + * @param doNotRefresh When true the layer will not refresh the map image. + */ + setDefaultVisibleLayers(doNotRefresh?: boolean): void; + /** + * Sets whether images are always requested from the server and the browser's cache is ignored. + * @param disable When true, client side caching is disabled. + */ + setDisableClientCaching(disable: boolean): void; + /** + * Sets the dpi of the exported map. + * @param dpi DPI value. + * @param doNotRefresh Added at version 2.2 When true the layer will not refresh the map image. + */ + setDPI(dpi: number, doNotRefresh?: boolean): void; + /** + * Specify an array of DynamicLayerInfos used to change the layer ordering or to redefine the map. + * @param dynamicLayerInfos An array of dynamic layer infos. + * @param doNotRefresh When true the layer will not refresh the map image. + */ + setDynamicLayerInfos(dynamicLayerInfos: DynamicLayerInfo[], doNotRefresh?: boolean): void; + /** + * Set the version for the ArcGIS DynamicMapServiceLayer. + * @param gdbVersion The name of the version to display. + * @param doNotRefresh When true the layer will not refresh the map image. + */ + setGDBVersion(gdbVersion: string, doNotRefresh?: boolean): void; + /** + * Sets the image format of the exported map. + * @param imageFormat Valid values are png | png8 | png24 | png32 | jpg | pdf | bmp | gif | svg. + * @param doNotRefresh Added at version 2.2 When true the layer will not refresh the map image. + */ + setImageFormat(imageFormat: string, doNotRefresh?: boolean): void; + /** + * Sets the background of a dynamic image to transparent. + * @param transparent Valid values are true | false. + * @param doNotRefresh Added at version 2.2 When true the layer will not refresh the map image. + */ + setImageTransparency(transparent: boolean, doNotRefresh?: boolean): void; + /** + * Set the infoTemplates property. + * @param infoTemplates infoTemplates object. + */ + setInfoTemplates(infoTemplates: any): void; + /** + * Sets the layer definitions used to filter the features of individual layers in the map service. + * @param layerDefinitions An array containing each layer's definition. + * @param doNotRefresh Added at version 2.2 When true the layer will not refresh the map image. + */ + setLayerDefinitions(layerDefinitions: string[], doNotRefresh?: boolean): void; + /** + * Specify an array of LayerDrawingOptions that override the way the layers are drawn. + * @param layerDrawingOptions An array of layer drawing options. + * @param doNotRefresh When true the layer will not refresh the map image. + */ + setLayerDrawingOptions(layerDrawingOptions: LayerDrawingOptions[], doNotRefresh?: boolean): void; + /** + * Sets the time-related options for the layer. + * @param options Array of LayerTimeOptions objects that allow you to override how a layer is exported in reference to the map's time extent. + * @param doNotRefresh When true the layer will not refresh the map image. + */ + setLayerTimeOptions(options: LayerTimeOptions[], doNotRefresh?: boolean): void; + /** + * Set the maximum scale for the layer. + * @param scale The maximum scale at which the layer is visible. + */ + setMaxScale(scale: number): void; + /** + * Set the minimum scale for the layer. + * @param scale The minimum scale at which the layer is visible. + */ + setMinScale(scale: number): void; + /** + * Set the scale range for the layer. + * @param minScale The minimum scale at which the layer is visible. + * @param maxScale The maximum scale at which the layer is visible. + */ + setScaleRange(minScale: number, maxScale: number): void; + /** + * Determine if the layer will update its content based on the map's current time extent. + * @param update When false the layer will not update its content based on the map's time extent. + */ + setUseMapTime(update: boolean): void; + /** + * Sets the visible layers of the exported map. + * @param ids Array of layer IDs. + * @param doNotRefresh When true the layer will not refresh the map image. + */ + setVisibleLayers(ids: number[], doNotRefresh?: boolean): void; + /** Suspends layer drawing. */ + suspend(): void; + /** Fired when the geodatabase version is switched. */ + on(type: "gdb-version-change", listener: (event: { target: ArcGISDynamicMapServiceLayer }) => void): esri.Handle; + /** Fires when the map export is completed. */ + on(type: "map-image-export", listener: (event: { mapImage: MapImage; target: ArcGISDynamicMapServiceLayer }) => void): esri.Handle; + /** Fires when a layer resumes drawing. */ + on(type: "resume", listener: (event: { target: ArcGISDynamicMapServiceLayer }) => void): esri.Handle; + /** Fires when a layer's minScale and/or maxScale is changed. */ + on(type: "scale-range-change", listener: (event: { target: ArcGISDynamicMapServiceLayer }) => void): esri.Handle; + /** Fires when a layer's scale visibility changes. */ + on(type: "scale-visibility-change", listener: (event: { target: ArcGISDynamicMapServiceLayer }) => void): esri.Handle; + /** Fires when a layer suspends drawing. */ + on(type: "suspend", listener: (event: { target: ArcGISDynamicMapServiceLayer }) => void): esri.Handle; + /** Fires when the visibleLayers property is changed. */ + on(type: "visible-layers-change", listener: (event: { visibleLayers: number[]; target: ArcGISDynamicMapServiceLayer }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = ArcGISDynamicMapServiceLayer; +} + +declare module "esri/layers/ArcGISImageServiceLayer" { + import esri = require("esri"); + import DynamicMapServiceLayer = require("esri/layers/DynamicMapServiceLayer"); + import MosaicRule = require("esri/layers/MosaicRule"); + import InfoTemplate = require("esri/InfoTemplate"); + import RasterFunction = require("esri/layers/RasterFunction"); + import TimeInfo = require("esri/layers/TimeInfo"); + import ImageServiceParameters = require("esri/layers/ImageServiceParameters"); + import Graphic = require("esri/graphic"); + import Query = require("esri/tasks/query"); + import MapImage = require("esri/layers/MapImage"); + + /** Allows you to work with an image map service resource exposed by the ArcGIS Server REST API. */ + class ArcGISImageServiceLayer extends DynamicMapServiceLayer { + /** Number of bands in ArcGISImageServiceLayer. */ + bandCount: number; + /** Array of current band selections. */ + bandIds: number[]; + /** The raster bands that the raster dataset is composed of and their statistics. */ + bands: any[]; + /** Current compression quality value. */ + compressionQuality: number; + /** Copyright string as defined by the image service. */ + copyrightText: string; + /** Returns a MosaicRule object that defines the default mosaic properties published by the image service. */ + defaultMosaicRule: MosaicRule; + /** Description as defined by the image service. */ + description: string; + /** When true, images are always requested from the server and the browser's cache is ignored. */ + disableClientCaching: boolean; + /** The output image type. */ + format: string; + /** The template that defines the content to display in the map info window when the user clicks on a raster. */ + infoTemplate: InfoTemplate; + /** Current interpolation method. */ + interpolation: string; + /** The maximum image height, in pixels, that the map service will export. */ + maxImageHeight: number; + /** The maximum image width, in pixels, that the map service will export. */ + maxImageWidgth: number; + /** The maximum number of results that can be returned from query, identify and find operations. */ + maxRecordCount: number; + /** Maximum visible scale for the layer. */ + maxScale: number; + /** Minimum visible scale for the layer. */ + minScale: number; + /** Specifies the mosaic rule when defining how individual images should be mosaicked. */ + mosaicRule: MosaicRule; + /** Size of pixel in X direction. */ + pixelSizeX: number; + /** Size of pixel in Y direction. */ + pixelSizeY: number; + /** The pixel type of the image service. */ + pixelType: number; + /** Specifies the rendering rule for how the requested image should be rendered. */ + renderingRule: RasterFunction; + /** Temporal information for the layer, such as time extent. */ + timeInfo: TimeInfo; + /** By default, images are exported in MIME format, and the image is streamed to the client. */ + useMapImage: boolean; + /** The version of ArcGIS Server the image service is published to, e.g. */ + version: number; + /** + * Creates a new ArcGISImageServiceLayer object. + * @param url URL to the ArcGIS Server REST resource that represents a map service. + * @param options Optional parameters. + */ + constructor(url: string, options?: esri.ArcGISImageServiceLayerOptions); + /** + * Exports a map using values as specified by ImageServiceParameters. + * @param imageServiceParameters Input parameters assigned before exporting the map image. + * @param callback The function to call when the method has completed. + */ + exportMapImage(imageServiceParameters?: ImageServiceParameters, callback?: Function): void; + /** Returns the current definition expression. */ + getDefinitionExpression(): string; + /** Get key properties of an ImageService including information such as the band names associated with the imagery. */ + getKeyProperties(): any; + /** Asynchronously returns the raster attribute table of an ImageService which returns categorical mapping of pixel values (e.g. */ + getRasterAttributeTable(): any; + /** Gets the currently visible rasters. */ + getVisibleRasters(): Graphic[]; + /** + * Returns the rasters that are visible in the area defined by the geometry (required to be point or polygon) in the query parameter. + * @param query The esri.tasks.Query to be passed as the input to query visible rasters. + * @param options Options for query. + * @param callback The function to call when the method has completed. + * @param errback The function to call when an error occurs. + */ + queryVisibleRasters(query: Query, options?: any, callback?: Function, errback?: string): void; + /** + * Sets the R,G,B of the exported image to the appropriate ImageService Band ID. + * @param bandIds Array of band IDs to use in the exported image. + * @param doNotRefresh When true the layer will not refresh the map image. + */ + setBandIds(bandIds: number[], doNotRefresh?: boolean): void; + /** + * Sets the compression quality of the exported image. + * @param quality A value from 0 to 100. + * @param doNotRefresh When true the layer will not refresh the map image. + */ + setCompressionQuality(quality: number, doNotRefresh?: boolean): void; + /** + * Sets the definition expression for the ImageService Layer. + * @param expression The definition expression to be set. + * @param doNotRefresh Whether or not the expression definition will be refreshed. + */ + setDefinitionExpression(expression: string, doNotRefresh: boolean): void; + /** + * Sets whether images are always requested from the server and the browser's cache is ignored. + * @param disable When true, browser client side caching is disabled. + */ + setDisableClientCaching(disable: boolean): void; + /** + * Set the image format. + * @param imageFormat Valid values are png | png8 | png24 | jpg | pdf | bmp | gif | svg. + * @param doNotRefresh When true the layer will not refresh the map image. + */ + setImageFormat(imageFormat: string, doNotRefresh?: boolean): void; + /** + * Specify or change the info template for a layer. + * @param infoTemplate The content for display in an InfoWindow. + */ + setInfoTemplate(infoTemplate: InfoTemplate): void; + /** + * Sets the interpolation method. + * @param interpolation Interpolation value defined in ImageServiceParameters Constants Table. + * @param doNotRefresh When true the layer will not refresh the map image. + */ + setInterpolation(interpolation: string, doNotRefresh?: boolean): void; + /** + * Sets the mosaic rule of the layer to the specified value. + * @param mosaicRule The mosaic rule. + * @param doNotRefresh When true the layer will not refresh the map image. + */ + setMosaicRule(mosaicRule: MosaicRule, doNotRefresh?: boolean): void; + /** + * Sets the rendering rule of the layer to the given value. + * @param renderingRule The new rendering rule. + * @param doNotRefresh When true the layer will not refresh the map image. + */ + setRenderingRule(renderingRule: RasterFunction, doNotRefresh?: boolean): void; + /** + * Determine if the layer will update its content based on the map's current time extent. + * @param update When false the layer will not update its content based on the map's time extent. + */ + setUseMapTime(update: boolean): void; + /** Fires when the map export is completed. */ + on(type: "map-image-export", listener: (event: { mapImage: MapImage; target: ArcGISImageServiceLayer }) => void): esri.Handle; + /** Fired when the layers mosaic rule is changed. */ + on(type: "mosaic-rule-change", listener: (event: { target: ArcGISImageServiceLayer }) => void): esri.Handle; + /** Fired when the layers band ids are changed or if a raster function is applied. */ + on(type: "rendering-change", listener: (event: { target: ArcGISImageServiceLayer }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = ArcGISImageServiceLayer; +} + +declare module "esri/layers/ArcGISImageServiceVectorLayer" { + import esri = require("esri"); + import GraphicsLayer = require("esri/layers/GraphicsLayer"); + import Renderer = require("esri/renderers/Renderer"); + + /** The ArcGISImageServiceVectorLayer displays pixel values as vectors. */ + class ArcGISImageServiceVectorLayer extends GraphicsLayer { + /** + * Creates a new ArcGISImageServiceLayer object. + * @param url URL to the ArcGIS Server REST resource that represents an image service vector layer service. + * @param options Optional parameters. + */ + constructor(url: string, options?: esri.ArcGISImageServiceVectorLayerOptions); + /** Returns the flow direction of the data as determined by the service via key properties. */ + getFlowRepresentation(): string; + /** + * Sets the renderer for the layer. + * @param renderer The renderer object to apply to the layer. + */ + setRenderer(renderer: Renderer): void; + /** + * Enables the layer to update its content based on the map's current time extent. + * @param update A value of true allows the layer to use the map's time extent to update layer content. + */ + setUseMapTime(update: boolean): void; + /** + * Set the default renderer from a list of predefined options. + * @param style The default renderer. + */ + setVectorRendererStyle(style: string): void; + } + export = ArcGISImageServiceVectorLayer; +} + +declare module "esri/layers/ArcGISTiledMapServiceLayer" { + import esri = require("esri"); + import TiledMapServiceLayer = require("esri/layers/TiledMapServiceLayer"); + import LayerInfo = require("esri/layers/LayerInfo"); + import TimeInfo = require("esri/layers/TimeInfo"); + + /** Allows you to work with a cached map service resource exposed by the ArcGIS Server REST API. */ + class ArcGISTiledMapServiceLayer extends TiledMapServiceLayer { + /** The URL, when available, where the layer's attribution data is stored. */ + attributionDataUrl: string; + /** Capabilities of the map service, possible values are Map, Query and Data. */ + capabilities: string; + /** Copyright string as defined by the map service. */ + copyright: string; + /** Map description as defined by the map service. */ + description: string; + /** When true, the layer has attribution data. */ + hasAttributionData: boolean; + /** A dictionary from the layer id to the layerInfoTemplateOptions object. */ + infoTemplates: any; + /** Returns the available layers in service and their default visibility. */ + layerInfos: LayerInfo[]; + /** The maximum image height, in pixels, that the map service will export. */ + maxImageHeight: number; + /** The maximum image width, in pixels, that the map service will export. */ + maxImageWidth: number; + /** The maximum number of results that can be returned from query, identify and find operations. */ + maxRecordCount: number; + /** Maximum visible scale for the layer. */ + maxScale: number; + /** Minimum visible scale for the layer. */ + minScale: number; + /** When true, the layer's attribution is displayed on the map. */ + showAttribution: boolean; + /** When true, the layer is suspended. */ + suspended: boolean; + /** Temporal information for the layer, such as time extent. */ + timeInfo: TimeInfo; + /** Default units of the layer as defined by the service. */ + units: string; + /** The version of ArcGIS Server where the map service is published. */ + version: number; + /** When true, the layer is visible at the current map scale. */ + visibleAtMapScale: boolean; + /** + * Creates a new ArcGISTiledMapServiceLayer object. + * @param url URL to the ArcGIS Server REST resource at represents a map service. + * @param options Optional parameters. + */ + constructor(url: string, options?: esri.ArcGISTiledMapServiceLayerOptions); + /** Asynchronously returns custom data for the layer when available. */ + getAttributionData(): any; + /** + * Returns true if the layer is visible at the given scale. + * @param scale The scale at which to check if the layer is visible. + */ + isVisibleAtScale(scale: number): boolean; + /** Resumes layer drawing. */ + resume(): void; + /** + * Set the infoTemplates property. + * @param infoTemplates infoTemplates object. + */ + setInfoTemplates(infoTemplates: any): void; + /** + * Set the maximum scale for the layer. + * @param scale The maximum scale at which the layer is visible. + */ + setMaxScale(scale: number): void; + /** + * Set the minimum scale for the layer. + * @param scale The minimum scale at which the layer is visible. + */ + setMinScale(scale: number): void; + /** + * Set the scale range for the layer. + * @param minScale The minimum scale at which the layer is visible. + * @param maxScale The maximum scale at which the layer is visible. + */ + setScaleRange(minScale: number, maxScale: number): void; + /** Suspends layer drawing. */ + suspend(): void; + /** Fires when a layer resumes drawing. */ + on(type: "resume", listener: (event: { target: ArcGISTiledMapServiceLayer }) => void): esri.Handle; + /** Fires when a layer's minScale and/or maxScale is changed. */ + on(type: "scale-range-change", listener: (event: { target: ArcGISTiledMapServiceLayer }) => void): esri.Handle; + /** Fires when a layer's scale visibility changes. */ + on(type: "scale-visibility-change", listener: (event: { target: ArcGISTiledMapServiceLayer }) => void): esri.Handle; + /** Fires when a layer suspends drawing. */ + on(type: "suspend", listener: (event: { target: ArcGISTiledMapServiceLayer }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = ArcGISTiledMapServiceLayer; +} + +declare module "esri/layers/CSVLayer" { + import esri = require("esri"); + import FeatureLayer = require("esri/layers/FeatureLayer"); + + /** CSVLayer extends FeatureLayer to create a point layer based on a CSV file (.csv, .txt). */ + class CSVLayer extends FeatureLayer { + /** The column delimiter. */ + columnDelimiter: string; + /** The latitude field name. */ + latitudeFieldName: string; + /** The longitude field name. */ + longitudeFieldName: string; + /** The url to a CSV resource. */ + url: string; + /** + * Creates a CSV layer. + * @param url URL to a CSV resource. + * @param options Optional parameters used to create the layer. + */ + constructor(url: string, options?: esri.CSVLayerOptions); + } + export = CSVLayer; +} + +declare module "esri/layers/CodedValueDomain" { + import Domain = require("esri/layers/Domain"); + + /** Information about the coded values belonging to the domain. */ + class CodedValueDomain extends Domain { + /** An array of the coded values in the domain. */ + codedValues: any[]; + /** + * Returns the name of the coded-value associated with the specified code. + * @param code The code in which you wish to search for the name. + */ + getName(code: number): string; + /** + * Returns the name of the coded-value associated with the specified code. + * @param code The code in which you wish to search for the name. + */ + getName(code: string): string; + } + export = CodedValueDomain; +} + +declare module "esri/layers/DataAdapterFeatureLayer" { + import esri = require("esri"); + import FeatureLayer = require("esri/layers/FeatureLayer"); + import LocationProviderBase = require("esri/tasks/locationproviders/LocationProviderBase"); + + /** (Beta at v3.12) Display features using data that contains location information such as X and Y coordinates, Street address, place names etc using a DataAdapter object to retrieve the features and a LocationProvider to generate their geometries. */ + class DataAdapterFeatureLayer extends FeatureLayer { + /** The DataAdapter object points to data sources that contain non-spatial tables. */ + dataAdapter: any; + /** The query parameters to use for the DataAdapter. */ + dataAdapterQuery: any; + /** List of attribute fields added as custom data attributes to graphics node. */ + dataAttributes: string[]; + /** An instance of the Location Provider class. */ + locationProvider: LocationProviderBase; + /** + * Creates a DataAdapterFeatureLayer. + * @param dataAdapter The DataAdapter object. + * @param options Optional parameters used to create the layer. + */ + constructor(dataAdapter: any, options: esri.DataAdapterFeatureLayerOptions); + } + export = DataAdapterFeatureLayer; +} + +declare module "esri/layers/DataSource" { + /** Used to denote classes that may be used as a data source. */ + class DataSource { + /** + * Creates a new DataSource object. + * @param json JSON object representing the DataSource. + */ + constructor(json?: Object); + } + export = DataSource; +} + +declare module "esri/layers/DimensionalDefinition" { + /** A dimensional definition defines a filter based on one variable and one dimension. */ + class DimensionalDefinition { + /** (Optional) The dimension associated with the variable. */ + dimensionName: string; + /** Indicates whether the values indicate slices (rather than ranges). */ + isSlice: boolean; + /** An array of tuples (min, max) each defining a range of valid values along the specified dimension. */ + values: any[]; + /** The variable name by which to filter. */ + variableName: string; + /** + * Create a new dimensional definition object from an existing json object. + * @param json The REST JSON representation for Dimensional Definition. + */ + constructor(json: Object); + /** Converts object to its ArcGIS Server JSON representation. */ + toJson(): any; + } + export = DimensionalDefinition; +} + +declare module "esri/layers/Domain" { + /** Domains define constraints on a layer field. */ + class Domain { + /** The domain name. */ + name: string; + /** The domain type. */ + type: string; + /** Converts object to its ArcGIS Server JSON representation. */ + toJson(): any; + } + export = Domain; +} + +declare module "esri/layers/DynamicLayerInfo" { + import LayerInfo = require("esri/layers/LayerInfo"); + import LayerSource = require("esri/layers/LayerSource"); + + /** Information about each layer in a map service. */ + class DynamicLayerInfo extends LayerInfo { + /** Default visibility of the layers in the map service. */ + defaultVisibility: boolean; + /** Layer ID assigned by ArcGIS Server for a layer. */ + id: number; + /** The maximum visible scale for each layer in the map service. */ + maxScale: number; + /** The minimum visible scale for each layer in the map service. */ + minScale: number; + /** Layer name as defined in the map service. */ + name: string; + /** If the layer is part of a group layer, it will include the parent ID of the group layer. */ + parentLayerId: number; + /** The source for the dynamic layer can be either a LayerMapSource or LayerDataSource. */ + source: LayerSource; + /** If the layer is a parent layer, it will have one or more sub layers included in an array. */ + subLayerIds: number[]; + /** + * Creates a new DynamicLayerInfo object. + * @param json JSON object representing the DynamicLayerInfo. + */ + constructor(json?: Object); + /** Converts object to its ArcGIS Server JSON representation. */ + toJson(): any; + } + export = DynamicLayerInfo; +} + +declare module "esri/layers/DynamicMapServiceLayer" { + import Layer = require("esri/layers/layer"); + import Extent = require("esri/geometry/Extent"); + import SpatialReference = require("esri/SpatialReference"); + + /** The base class for ArcGIS Server dynamic map services. */ + class DynamicMapServiceLayer extends Layer { + /** Full extent as defined by the map service. */ + fullExtent: Extent; + /** Initial extent as defined by the map service. */ + initialExtent: Extent; + /** The spatial reference of the map service. */ + spatialReference: SpatialReference; + /** + * Method to implement when extending DynamicMapServiceLayer. + * @param extent Current extent of the map. + * @param width Current width of the map in pixels. + * @param height Current height of the map in pixels. + * @param callback The function to call when the method has completed. + */ + getImageUrl(extent: Extent, width: number, height: number, callback: Function): string; + /** Refreshes the map by making a new request to the server. */ + refresh(): void; + } + export = DynamicMapServiceLayer; +} + +declare module "esri/layers/FeatureEditResult" { + /** The results of a feature edit such as add, update or delete. */ + class FeatureEditResult { + /** Unique ID of the attachment. */ + attachmentId: number; + /** Information about errors that occur if the edit operation failed. */ + error: Error; + /** Unique ID of the feature or object. */ + objectId: number; + /** If true the operation was successful. */ + success: boolean; + } + export = FeatureEditResult; +} + +declare module "esri/layers/FeatureLayer" { + import esri = require("esri"); + import GraphicsLayer = require("esri/layers/GraphicsLayer"); + import Field = require("esri/layers/Field"); + import Extent = require("esri/geometry/Extent"); + import Graphic = require("esri/graphic"); + import LabelClass = require("esri/layers/LabelClass"); + import Renderer = require("esri/renderers/Renderer"); + import LayerSource = require("esri/layers/LayerSource"); + import FeatureTemplate = require("esri/layers/FeatureTemplate"); + import TimeInfo = require("esri/layers/TimeInfo"); + import FeatureType = require("esri/layers/FeatureType"); + import Domain = require("esri/layers/Domain"); + import Symbol = require("esri/symbols/Symbol"); + import TimeExtent = require("esri/TimeExtent"); + import Query = require("esri/tasks/query"); + import RelationshipQuery = require("esri/tasks/RelationshipQuery"); + import InfoTemplate = require("esri/InfoTemplate"); + import FeatureEditResult = require("esri/layers/FeatureEditResult"); + import FeatureSet = require("esri/tasks/FeatureSet"); + + /** The feature layer inherits from the graphics layer and can be used to display features from a single layer in either a Map Service or Feature Service. */ + class FeatureLayer extends GraphicsLayer { + /** Delegate to either on-demand or snapshot mode depending on the characteristics of the service. */ + static MODE_AUTO: any; + /** In on-demand mode, the feature layer retrieves features from the server when needed. */ + static MODE_ONDEMAND: any; + /** In selection mode, features are retrieved from the server only when they are selected. */ + static MODE_SELECTION: any; + /** In snapshot mode, the feature layer retrieves all the features from the associated layer resource and displays them as graphics on the client. */ + static MODE_SNAPSHOT: any; + /** The popup displays content in HTML/TEXT. */ + static POPUP_HTML_TEXT: any; + /** No popup type defined. */ + static POPUP_NONE: any; + /** The popup displays the contents of a URL. */ + static POPUP_URL: any; + /** Adds features to the current selection set. */ + static SELECTION_ADD: any; + /** Creates a new selection. */ + static SELECTION_NEW: any; + /** Removes features from the current selection. */ + static SELECTION_SUBTRACT: any; + /** An object that contains service level metadata about whether or not the layer supports queries using statistics, order by fields, DISTINCT, pagination, query with distance, and returning queries with extents. */ + advancedQueryCapabilities: any; + /** Returns true if the geometry of the features in the layer can be edited, false otherwise. */ + allowGeometryUpdates: boolean; + /** The URL, when available, where the layer's attribution data is stored. */ + attributionDataUrl: string; + /** Information about the capabilities enabled for this layer. */ + capabilities: string; + /** Copyright information for the layer. */ + copyright: string; + /** Metadata describing the default definition expression for the layer as defined by the service. */ + defaultDefinitionExpression: string; + /** Indicates the default visibility for the layer. */ + defaultVisibility: boolean; + /** The description of the layer as defined in the map service. */ + description: string; + /** The name of the layer's primary display field. */ + displayField: string; + /** Indicates the field names for the editor fields. */ + editFieldsInfo: any; + /** The array of fields in the layer. */ + fields: Field[]; + /** The full extent of the layer. */ + fullExtent: Extent; + /** Geometry type of the features in the layer. */ + geometryType: string; + /** The globalIdField for the layer. */ + globalIdField: string; + /** Array of features in the layer. */ + graphics: Graphic[]; + /** True if attachments are enabled on the feature layer. */ + hasAttachments: boolean; + /** When true, the layer has attribution data. */ + hasAttributionData: boolean; + /** The html popup type defined for the layer. */ + htmlPopupType: string; + /** Label definition for this layer, specified as an array of label classes. */ + labelingInfo: LabelClass[]; + /** Unique ID of the layer that the FeatureLayer was constructed against. */ + layerId: number; + /** The maximum number of results that will be returned from a query. */ + maxRecordCount: number; + /** Maximum visible scale for the layer. */ + maxScale: number; + /** Minimum visible scale for the layer. */ + minScale: number; + /** Supports feature services whose data source is a multipatch featureclass. */ + multipatchOption: string; + /** The name of the layer as defined in the map service. */ + name: string; + /** The name of the field that contains the Object ID field for the layer. */ + objectIdField: string; + /** Indicates the ownership access control configuration. */ + ownershipBasedAccessControlForFeatures: any; + /** Each element in the array is an object that describes the layer's relationship with another layer or table. */ + relationships: any[]; + /** The renderer for the layer. */ + renderer: Renderer; + /** When true, the layer's attribution is displayed on the map. */ + showAttribution: boolean; + /** Determines if labels are displayed. */ + showLabels: boolean; + /** The dynamic layer or table source. */ + source: LayerSource; + /** When true, the layer supports orderByFields in a query operation. */ + supportsAdvancedQueries: boolean; + /** When true, the layer supports uploading attachments with Uploads REST operation, which then can be used in the Add Attachment or Update Attachment REST operations. */ + supportsAttachmentsByUploadId: boolean; + /** When true, the layer supports the Calculate REST operation when updating features. */ + supportsCalculate: boolean; + /** When true, the layer supports statistical functions in query operations. */ + supportsStatistics: boolean; + /** When true, the layer is suspended. */ + suspended: boolean; + /** An array of feature templates defined in the Feature Service layer. */ + templates: FeatureTemplate[]; + /** Time information for the layer, such as start time field, end time field, track id field, layers time extent and the draw time interval. */ + timeInfo: TimeInfo; + /** Specifies the type of layer. */ + type: string; + /** The field that represents the Type ID field. */ + typeIdField: string; + /** An array of sub types defined in the Feature Service layer. */ + types: FeatureType[]; + /** The version of ArcGIS Server where the layer is published. */ + version: number; + /** When true, the layer is visible at the current map scale. */ + visibleAtMapScale: boolean; + /** + * Creates a new instance of a feature layer object from the ArcGIS Server REST resource identified by the input URL. + * @param url URL to the ArcGIS Server REST resource that represents a feature service. + * @param options Optional parameters. + */ + constructor(url: string, options?: esri.FeatureLayerOptions); + /** + * Creates a new instance of a feature layer using a FeatureCollection object. + * @param featureCollectionObject A feature collection object. + * @param options Optional parameters. + */ + constructor(featureCollectionObject: any, options?: esri.FeatureLayerOptions); + /** + * Add an attachment to the feature specified by the ObjectId. + * @param objectId The ObjectId of the feature to which the attachment is added. + * @param formNode HTML form that contains a file upload field pointing to the file to be added as an attachment. + * @param callback The function to call when the method has completed. + * @param errback An error object is returned if an error occurs during task execution. + */ + addAttachment(objectId: number, formNode: HTMLFormElement, callback?: Function, errback?: Function): any; + /** + * Apply edits to the feature layer. + * @param adds Array of features to add to the layer in the feature service. + * @param updates Array of features whose geometry and/or attributes have changed. + * @param deletes Array of features to delete. + * @param callback This function will be called when the operation is complete. + * @param errback An error object is returned if an error occurs. + */ + applyEdits(adds?: Graphic[], updates?: Graphic[], deletes?: Graphic[], callback?: Function, errback?: Function): any; + /** Clears the current selection. */ + clearSelection(): FeatureLayer; + /** + * Delete one or more attachments for the feature specified by the input ObjectId. + * @param objectId The ObjectId of the feature from which the attachment is removed. + * @param attachmentIds The array of attachment ids to delete. + * @param callback The function to call when the method has completed. + * @param errback An error object is returned if an error occurs. + */ + deleteAttachments(objectId: number, attachmentIds: number[], callback?: Function, errback?: Function): any; + /** Asynchrously returns custom data for the layer when available. */ + getAttributionData(): any; + /** Returns the current definition expression. */ + getDefinitionExpression(): string; + /** + * Returns the Domain associated with the given field name. + * @param fieldName Name of the attribute field. + * @param options Please see the options object specification table below. + */ + getDomain(fieldName: string, options?: any): Domain; + /** + * Returns an object that describes the edit capabilities of the layer. + * @param options If the layer supports ownership based access control, use the options to determine if the specified user can edit features. + */ + getEditCapabilities(options?: any): any; + /** + * Returns an object describing the most recent edit operation performed on the given feature, if available. + * @param feature The feature to get the edit info for. + * @param options See the object specifications table below for the structure of the options object. + */ + getEditInfo(feature: Graphic, options?: any): any; + /** + * Returns a localized summary of the last edit operation performed on the given feature, if available. + * @param feature The feature to get the edit summary for. + * @param options See the object specifications table below for the structure of the options object. + */ + getEditSummary(feature: Graphic, options?: any): string; + /** + * Returns the Field given the specified field name. + * @param fieldName Name of the attribute field. + */ + getField(fieldName: string): Field; + /** Returns the current value of the maxAllowableOffset used by the layer. */ + getMaxAllowableOffset(): number; + /** Returns the list of fields used to order features by. */ + getOrderByFields(): string[]; + /** Gets the currently selected features. */ + getSelectedFeatures(): Graphic[]; + /** Gets the current selection symbol. */ + getSelectionSymbol(): Symbol; + /** Get the current time definition applied to the feature layer. */ + getTimeDefinition(): TimeExtent; + /** + * Returns a FeatureType describing the feature's type. + * @param feature A feature from this layer. + */ + getType(feature: Graphic): FeatureType; + /** Returns true if geometryType is esriGeometryMultipatch and multipatchOption is xyFootprint. */ + hasXYFootprint(): boolean; + /** Returns true if the FeatureLayer is editable. */ + isEditable(): boolean; + /** + * Returns true if the layer is visible at the given scale. + * @param scale The scale at which to check if the layer is visible. + */ + isVisibleAtScale(scale: number): boolean; + /** + * Query for information about attachments associated with the specified ObjectIds. + * @param objectId The ObjectId for the feature to query for attachment information. + * @param callback The function to call when the method has completed. + * @param errback An error object is returned if an error occurs. + */ + queryAttachmentInfos(objectId: number, callback?: Function, errback?: Function): any; + /** + * Get a count of the number of features that satisfy the input query. + * @param query The input query. + * @param callback The function to call when the method has completed. + * @param errback An error object is returned if an error occurs. + */ + queryCount(query: Query, callback?: Function, errback?: Function): any; + /** + * Get the extent of features that satisfy the input query. + * @param query The query definition. + * @param callback The function called when the method has completed. + * @param errback The function called when error occurred. + */ + queryExtent(query: Query, callback?: Function, errback?: Function): any; + /** + * Query features from the feature layer. + * @param query The input query. + * @param callback The function to call when the method has completed. + * @param errback An error object is returned if an error occurs. + */ + queryFeatures(query: Query, callback?: Function, errback?: Function): any; + /** + * Query for ObjectIds. + * @param query The input query. + * @param callback The function to call when the method has completed. + * @param errback An error object is returned if an error occurs. + */ + queryIds(query: Query, callback?: Function, errback?: Function): any; + /** + * Query features or records, from another layer or table, related to features in this layer. + * @param relQuery The input query. + * @param callback The function to call when the method has completed. + * @param errback An error object is returned if an error occurs. + */ + queryRelatedFeatures(relQuery: RelationshipQuery, callback?: Function, errback?: Function): any; + /** Redraws all the graphics in the graphics layer. */ + redraw(): void; + /** Refreshes the features in the feature layer. */ + refresh(): void; + /** Resumes layer drawing. */ + resume(): void; + /** + * Selects features from the FeatureLayer. + * @param query The input query. + * @param selectionMethod The selection method defines how the rest of the selection is combined with the existing selection. + * @param callback The function to call when the method has completed. + * @param errback An error object is returned if an error occurs. + */ + selectFeatures(query: Query, selectionMethod?: number, callback?: Function, errback?: Function): any; + /** + * Enable or disable auto generalization for the layer. + * @param enable When true, auto generalize is enabled. + */ + setAutoGeneralize(enable: boolean): FeatureLayer; + /** + * Set's the definition expression for the FeatureLayer. + * @param expression The definition expression to apply. + */ + setDefinitionExpression(expression: string): FeatureLayer; + /** + * Set the editability of feature layers created from a feature collection. + * @param editable When true, the layer will be set as editable. + */ + setEditable(editable: boolean): FeatureLayer; + /** + * Set the layer's data source to the specified geodatabase version. + * @param versionName The name of the geodatabase version to use as the layer's data source. + */ + setGDBVersion(versionName: string): FeatureLayer; + /** + * Specify or change the info template for a layer. + * @param infoTemplate The new info template. + */ + setInfoTemplate(infoTemplate: InfoTemplate): void; + /** + * Sets labeling info on the layer. + * @param labelingInfo This is the label definition for this layer, specified as an array of label classes. + */ + setLabelingInfo(labelingInfo: LabelClass[]): void; + /** + * Sets the maximum allowable offset used when generalizing geometries. + * @param offset The maximum allowable offset. + */ + setMaxAllowableOffset(offset: number): void; + /** + * Set the maximum scale for the layer. + * @param scale The maximum scale at which the layer is visible. + */ + setMaxScale(scale: number): void; + /** + * Set the minimum scale for the layer. + * @param scale The minimum scale at which the layer is visible. + */ + setMinScale(scale: number): void; + /** + * Initial opacity or transparency of layer. + * @param opacity Value from 0 to 1, where 0 is 100% transparent and 1 has no transparency. + */ + setOpacity(opacity: number): void; + /** + * Set the renderer for the feature layer. + * @param renderer The renderer to apply to the feature layer + */ + setRenderer(renderer: Renderer): void; + /** + * Set the scale range for the layer. + * @param minScale The minimum scale for the layer. + * @param maxScale The maximum scale for the layer. + */ + setScaleRange(minScale: number, maxScale: number): void; + /** + * Set's the selection symbol for the feature layer. + * @param symbol Symbol for the current selection. + */ + setSelectionSymbol(symbol: Symbol): FeatureLayer; + /** + * Sets whether to display labels or not. + * @param showLabels Set to true to show labels. + */ + setShowLabels(showLabels: boolean): void; + /** + * Set's the time definition for the feature layer. + * @param definition The new time extent used to filter the layer. + */ + setTimeDefinition(definition: TimeExtent): FeatureLayer; + /** + * Time offset allows you to display the features at a different time so they can be overlaid on top of previous or future time periods. + * @param offsetValue The length of time to offset from "this" time. + * @param offsetUnits Units in which the offset is specified. + */ + setTimeOffset(offsetValue: number, offsetUnits: string): FeatureLayer; + /** + * Determine if the layer will update its content based on the map's current time extent. + * @param update When false the layer will not update its content based on the map's time extent. + */ + setUseMapTime(update: boolean): void; + /** Suspends layer drawing. */ + suspend(): void; + /** Returns an easily serializable object representation of the layer. */ + toJson(): any; + /** Fires when addAttachments() is complete. */ + on(type: "add-attachment-complete", listener: (event: { result: FeatureEditResult; target: FeatureLayer }) => void): esri.Handle; + /** Fired before edits are applied to the feature layer. */ + on(type: "before-apply-edits", listener: (event: { adds: Graphic[]; deletes: Graphic[]; updates: Graphic[]; target: FeatureLayer }) => void): esri.Handle; + /** Fired when the capabilities of the layer are modified using the setEditable method. */ + on(type: "capabilities-change", listener: (event: { target: FeatureLayer }) => void): esri.Handle; + /** Fires when a feature has been double clicked. */ + on(type: "dbl-click", listener: (event: { event: any; target: FeatureLayer }) => void): esri.Handle; + /** Fires when deleteAttachments is complete. */ + on(type: "delete-attachments-complete", listener: (event: { results: any[]; target: FeatureLayer }) => void): esri.Handle; + /** Fires after applyEdits() is complete. */ + on(type: "edits-complete", listener: (event: { adds: FeatureEditResult[]; deletes: FeatureEditResult[]; updates: FeatureEditResult[]; target: FeatureLayer }) => void): esri.Handle; + /** Fired when the geodatabase version is switched. */ + on(type: "gdb-version-change", listener: (event: { target: FeatureLayer }) => void): esri.Handle; + /** Fired when labeling info on the layer changes. */ + on(type: "labeling-info-change", listener: (event: { target: FeatureLayer }) => void): esri.Handle; + /** Fires when queryAttachmentInfos method is called. */ + on(type: "query-attachment-infos-complete", listener: (event: { info: any[]; target: FeatureLayer }) => void): esri.Handle; + /** Fires when the query for the count is complete. */ + on(type: "query-count-complete", listener: (event: { count: number; target: FeatureLayer }) => void): esri.Handle; + /** Fires when queryExtent method has completed. */ + on(type: "query-extent-complete", listener: (event: { count: number; extent: Extent; target: FeatureLayer }) => void): esri.Handle; + /** Fires when queryFeatures() is complete. */ + on(type: "query-features-complete", listener: (event: { featureSet: FeatureSet; target: FeatureLayer }) => void): esri.Handle; + /** Fires when queryIds() is complete. */ + on(type: "query-ids-complete", listener: (event: { objectIds: number[]; target: FeatureLayer }) => void): esri.Handle; + /** Fired when the feature layer could not draw all the features due to a maxRecordCount limitation on a query operation. */ + on(type: "query-limit-exceeded", listener: (event: { target: FeatureLayer }) => void): esri.Handle; + /** Fires when queryRelatedFeatures() is complete. */ + on(type: "query-related-features-complete", listener: (event: { relatedFeatures: any; target: FeatureLayer }) => void): esri.Handle; + /** Fires when a layer resumes drawing. */ + on(type: "resume", listener: (event: { target: FeatureLayer }) => void): esri.Handle; + /** Fires when a layer's minScale and/or maxScale is changed. */ + on(type: "scale-range-change", listener: (event: { target: FeatureLayer }) => void): esri.Handle; + /** Fires when a layer's scale visibility changes. */ + on(type: "scale-visibility-change", listener: (event: { target: FeatureLayer }) => void): esri.Handle; + /** Fires after clearSelection has been called. */ + on(type: "selection-clear", listener: (event: { target: FeatureLayer }) => void): esri.Handle; + /** Fires when selectFeatures() completes. */ + on(type: "selection-complete", listener: (event: { features: Graphic[]; method: number; target: FeatureLayer }) => void): esri.Handle; + /** Fired when the feature layer's labels are changed. */ + on(type: "show-labels-change", listener: (event: { target: FeatureLayer }) => void): esri.Handle; + /** Fires when a layer suspends drawing. */ + on(type: "suspend", listener: (event: { target: FeatureLayer }) => void): esri.Handle; + /** Fired when the layer has finished updating its content. */ + on(type: "update-end", listener: (event: { error: Error; info: any; target: FeatureLayer }) => void): esri.Handle; + /** Fired when the layer begins to update its content. */ + on(type: "update-start", listener: (event: { target: FeatureLayer }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = FeatureLayer; +} + +declare module "esri/layers/FeatureTemplate" { + import Graphic = require("esri/graphic"); + + /** Feature templates define the information required to create a new feature. */ + class FeatureTemplate { + /** The default drawing tool specified for this template is the arrow tool. */ + static TOOL_ARROW: any; + /** The default drawing tool specified for this template is a auto complete polygon tool. */ + static TOOL_AUTO_COMPLETE_POLYGON: any; + /** The default drawing tool specified for this template is the circle tool. */ + static TOOL_CIRCLE: any; + /** The default drawing tool specified for this template is a ellipse tool. */ + static TOOL_ELLIPSE: any; + /** The default drawing tool specified for this template is the freehand tool. */ + static TOOL_FREEHAND: any; + /** The default drawing tool specified for this template is the line tool. */ + static TOOL_LINE: any; + /** No default tool is specified. */ + static TOOL_NONE: any; + /** The default drawing tool specified for this template is the point tool. */ + static TOOL_POINT: any; + /** The default drawing tool specified for this template is the polygon tool. */ + static TOOL_POLYGON: any; + /** The default drawing tool specified for this template is the rectangle. */ + static TOOL_RECTANGLE: any; + /** The default drawing tool specified for this template is the triangle. */ + static TOOL_TRIANGLE: any; + /** The description of the template. */ + description: string; + /** The default drawing tool defined for the template. */ + drawingTool: string; + /** The templates name. */ + name: string; + /** An instance of the prototypical feature described by the template. */ + prototype: Graphic; + /** Converts object to its ArcGIS Server JSON representation. */ + toJson(): any; + } + export = FeatureTemplate; +} + +declare module "esri/layers/FeatureType" { + import FeatureTemplate = require("esri/layers/FeatureTemplate"); + + /** A type defined by a feature layer. */ + class FeatureType { + /** Map of field names to domains. */ + domains: any; + /** The feature type identifier. */ + id: number; + /** The feature type name. */ + name: string; + /** Array of feature templates associated with this feature type. */ + templates: FeatureTemplate[]; + /** Converts object to its ArcGIS Server JSON representation. */ + toJson(): any; + } + export = FeatureType; +} + +declare module "esri/layers/Field" { + import Domain = require("esri/layers/Domain"); + + /** Information about each field in a layer. */ + class Field { + /** The alias name for the field. */ + alias: string; + /** Domain associated with the field. */ + domain: Domain; + /** Indicates whether the field is editable. */ + editable: boolean; + /** The field length */ + length: number; + /** The name of the field. */ + name: string; + /** Indicates if the field can accept null values. */ + nullable: boolean; + /** The data type of the field. */ + type: string; + } + export = Field; +} + +declare module "esri/layers/GeoRSSLayer" { + import esri = require("esri"); + import Layer = require("esri/layers/layer"); + import Graphic = require("esri/graphic"); + import FeatureLayer = require("esri/layers/FeatureLayer"); + + /** The GeoRSSLayer class is used to create a layer based on GeoRSS. */ + class GeoRSSLayer extends Layer { + /** The copyright information for the layer. */ + copyright: string; + /** The default visibility of the layer. */ + defaultVisibility: boolean; + /** The layer description. */ + description: string; + /** An array that contains all the graphics in the GeoRSSLayer. */ + items: Graphic[]; + /** The name of the layer. */ + name: string; + /** + * Creates a new GeoRSSLayer object. + * @param url URL to the GeoRSS resource. + * @param options Optional parameters. + */ + constructor(url: string, options?: esri.GeoRSSLayerOptions); + /** An array of feature layers for the GeoRSSLayer. */ + getFeatureLayers(): FeatureLayer[]; + /** Fires when the layer is refreshed. */ + on(type: "refresh", listener: (event: { target: GeoRSSLayer }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = GeoRSSLayer; +} + +declare module "esri/layers/GraphicsLayer" { + import esri = require("esri"); + import Layer = require("esri/layers/layer"); + import Graphic = require("esri/graphic"); + import InfoTemplate = require("esri/InfoTemplate"); + import Renderer = require("esri/renderers/Renderer"); + + /** A layer that contains one or more Graphic features. */ + class GraphicsLayer extends Layer { + /** List of attribute fields added as custom data attributes to graphics node. */ + dataAttributes: any; + /** The array of graphics that make up the layer. */ + graphics: Graphic[]; + /** The info template for the layer. */ + infoTemplate: InfoTemplate; + /** Renderer assigned to the GraphicsLayer. */ + renderer: Renderer; + /** Indicates whether the layer is responsible for styling graphics. */ + styling: boolean; + /** Type of vector graphics surface used to draw graphics. */ + surfaceType: string; + /** Creates a new GraphicsLayer object. */ + constructor(); + /** + * Creates a new GraphicsLayer object with parameters. + * @param options See options list for parameters. + */ + constructor(options?: esri.GraphicsLayerOptions); + /** + * Adds a graphic. + * @param graphic The graphic to add. + */ + add(graphic: Graphic): Graphic; + /** Clears all graphics. */ + clear(): void; + /** Disables all mouse events on the graphics layer. */ + disableMouseEvents(): void; + /** Enables all mouse events on the graphics layer. */ + enableMouseEvents(): void; + /** Redraws all the graphics in the layer. */ + redraw(): void; + /** + * Removes a graphic. + * @param graphic The graphic to remove. + */ + remove(graphic: Graphic): Graphic; + /** + * Specify or change the info template for a layer. + * @param infoTemplate The new info template. + */ + setInfoTemplate(infoTemplate: InfoTemplate): void; + /** + * Initial opacity or transparency of layer. + * @param opacity Value from 0 to 1, where 0 is 100% transparent and 1 has no transparency. + */ + setOpacity(opacity: number): void; + /** + * Sets the renderer for the graphics layer. + * @param renderer The renderer used for the graphic. + */ + setRenderer(renderer: Renderer): void; + /** Fires when a graphic has been clicked. */ + on(type: "click", listener: (event: { event: any; target: GraphicsLayer }) => void): esri.Handle; + /** Fires when a graphic has been double clicked. */ + on(type: "dbl-click", listener: (event: { target: GraphicsLayer }) => void): esri.Handle; + /** Fires when a graphic is added to the GraphicsLayer. */ + on(type: "graphic-add", listener: (event: { graphic: Graphic; target: GraphicsLayer }) => void): esri.Handle; + /** Fires when a graphic is drawn. */ + on(type: "graphic-draw", listener: (event: { graphic: Graphic; target: GraphicsLayer }) => void): esri.Handle; + /** Fires when a graphic's DOM node is created and added to the layer. */ + on(type: "graphic-node-add", listener: (event: { graphic: Graphic; node: HTMLElement; target: GraphicsLayer }) => void): esri.Handle; + /** This event is fired when a graphic's DOM node is removed (consider the node destroyed). */ + on(type: "graphic-node-remove", listener: (event: { graphic: Graphic; node: HTMLElement; target: GraphicsLayer }) => void): esri.Handle; + /** Fires when a graphic is removed from the GraphicsLayer. */ + on(type: "graphic-remove", listener: (event: { graphic: Graphic; target: GraphicsLayer }) => void): esri.Handle; + /** Fires when all graphics in the GraphicsLayer are cleared. */ + on(type: "graphics-clear", listener: (event: { target: GraphicsLayer }) => void): esri.Handle; + /** Fires when a mouse button is pressed down and the mouse cursor is on a graphic. */ + on(type: "mouse-down", listener: (event: esri.AGSMouseEvent) => void): esri.Handle; + /** Fires while the mouse is being dragged until the mouse button is released. */ + on(type: "mouse-drag", listener: (event: esri.AGSMouseEvent) => void): esri.Handle; + /** Fires as the mouse moves through a graphic on the GraphicsLayer. */ + on(type: "mouse-move", listener: (event: esri.AGSMouseEvent) => void): esri.Handle; + /** Fires as the mouse exits a graphic on the GraphicsLayer. */ + on(type: "mouse-out", listener: (event: esri.AGSMouseEvent) => void): esri.Handle; + /** Fires when the mouse first enters into a graphic on the GraphicsLayer. */ + on(type: "mouse-over", listener: (event: esri.AGSMouseEvent) => void): esri.Handle; + /** Fires when a mouse button is released and the mouse cursor is on a graphic. */ + on(type: "mouse-up", listener: (event: esri.AGSMouseEvent) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = GraphicsLayer; +} + +declare module "esri/layers/ImageParameters" { + import Extent = require("esri/geometry/Extent"); + import SpatialReference = require("esri/SpatialReference"); + import LayerTimeOptions = require("esri/layers/LayerTimeOptions"); + import TimeExtent = require("esri/TimeExtent"); + + /** Represents the image parameter options used when calling ArcGISDynamicMapServiceLayer.exportMapImage, Geoprocessor.getResultImage, and Geoprocessor.getResultImageLayer. */ + class ImageParameters { + /** Shows all layers visible by default except the specified layer ID's. */ + static LAYER_OPTION_EXCLUDE: any; + /** Shows all layers except the specified layer ID's. */ + static LAYER_OPTION_HIDE: any; + /** Shows specified layer ID's in addition to layers visible by default. */ + static LAYER_OPTION_INCLUDE: any; + /** Shows only the specified layer ID's. */ + static LAYER_OPTION_SHOW: any; + /** Extent of map to be exported. */ + bbox: Extent; + /** Dots per inch setting for an ArcGISDynamicMapServiceLayer. */ + dpi: number; + /** Map image format. */ + format: string; + /** Requested image height in pixels. */ + height: number; + /** Spatial reference of exported map. */ + imageSpatialReference: SpatialReference; + /** Array of layer definition expressions that allows you to filter the features of individual layers in the exported map image. */ + layerDefinitions: string[]; + /** A list of layer ID's, that represent which layers to include in the exported map. */ + layerIds: number[]; + /** The option for displaying or hiding the layer. */ + layerOption: string; + /** Array of LayerTimeOptions objects that allow you to override how a layer is exported in reference to the map's time extent. */ + layerTimeOptions: LayerTimeOptions[]; + /** The time extent for the map image. */ + timeExtent: TimeExtent; + /** Whether or not background of dynamic image is transparent. */ + transparent: boolean; + /** Requested image width in pixels. */ + width: number; + /** Creates a new ImageParameters object. */ + constructor(); + } + export = ImageParameters; +} + +declare module "esri/layers/ImageServiceParameters" { + import Extent = require("esri/geometry/Extent"); + import MosaicRule = require("esri/layers/MosaicRule"); + import RasterFunction = require("esri/layers/RasterFunction"); + import TimeExtent = require("esri/TimeExtent"); + + /** Represents the image service parameter options used when calling ArcGISImageServiceLayer.exportMapImage. */ + class ImageServiceParameters { + /** Resamples pixel by bilinear interpolation. */ + static INTERPOLATION_BILINEAR: any; + /** Resamples pixel by cubic convolution. */ + static INTERPOLATION_CUBICCONVOLUTION: any; + /** Resamples pixel by majority value. */ + static INTERPOLATION_MAJORITY: any; + /** Resamples pixel by nearest neighbor. */ + static INTERPOLATION_NEARESTNEIGHBOR: any; + /** Array of current band selections. */ + bandIds: number[]; + /** Current compression quality value. */ + compressionQuality: number; + /** Extent of the exported image. */ + extent: Extent; + /** Map image format. */ + format: string; + /** Requested image height in pixels. */ + height: number; + /** Current interpolation method. */ + interpolation: string; + /** Specifies the mosaic rule when defining how individual images should be mosaicked. */ + mosaicRule: MosaicRule; + /** The pixel value that represents no information. */ + noData: number; + /** Specifies the rendering rule for how the requested image should be rendered. */ + renderingRule: RasterFunction; + /** Define the time extent for the image. */ + timeExtent: TimeExtent; + /** Requested image width in pixels. */ + width: number; + /** Creates a new ImageServiceParameters object. */ + constructor(); + } + export = ImageServiceParameters; +} + +declare module "esri/layers/InheritedDomain" { + import Domain = require("esri/layers/Domain"); + + /** This class is a subclass of esri/layers/Domain. */ + class InheritedDomain extends Domain { + } + export = InheritedDomain; +} + +declare module "esri/layers/JoinDataSource" { + import DataSource = require("esri/layers/DataSource"); + import LayerSource = require("esri/layers/LayerSource"); + + /** The JoinDataSource class defines and provides information about the result of a join operation. */ + class JoinDataSource extends DataSource { + /** The type of join that will be performed. */ + joinType: string; + /** The key field used for the left table source for the join. */ + leftTableKey: string; + /** The data source to be used as the left table for the join operation. */ + leftTableSource: LayerSource; + /** The key field used for the right table source for the join. */ + rightTableKey: string; + /** The data source to be used as the right table for the join operation. */ + rightTableSource: LayerSource; + /** + * Creates a new JoinDataSource object. + * @param json JSON object representing the JoinDataSource. + */ + constructor(json?: Object); + /** Converts object to its ArcGIS Server JSON representation. */ + toJson(): any; + } + export = JoinDataSource; +} + +declare module "esri/layers/KMLFolder" { + /** Defines information about a KML folder. */ + class KMLFolder { + /** The KML folder description. */ + description: string; + /** An array of objects that describe top-level KML features ids and their types. */ + featureInfos: any[]; + /** The KML folder id. */ + id: number; + /** The KML folder name. */ + name: string; + /** The id of the parent folder. */ + parentFolderId: number; + /** The KML folder snippet. */ + snippet: string; + /** An array of ids for the KML folder's subfolders. */ + subFolderIds: number[]; + /** The visibility of the KML folder. */ + visibility: number; + } + export = KMLFolder; +} + +declare module "esri/layers/KMLGroundOverlay" { + import Extent = require("esri/geometry/Extent"); + + /** The KMLGroundOverlay class provides details about a KML ground overlay. */ + class KMLGroundOverlay { + /** KML ground overlay description. */ + description: string; + /** Extent of image. */ + extent: Extent; + /** Requested image height in pixels. */ + height: number; + /** URL to returned image. */ + href: string; + /** The id of the KML ground overlay. */ + id: number; + /** The name of the KML ground overlay. */ + name: string; + /** Scale of requested dynamic map. */ + scale: number; + /** Short snippet describing the KML ground overlay. */ + snippet: string; + /** The KML ground overlay visibility. */ + visibility: number; + /** Requested image width in pixels. */ + width: number; + } + export = KMLGroundOverlay; +} + +declare module "esri/layers/KMLLayer" { + import esri = require("esri"); + import Layer = require("esri/layers/layer"); + import KMLFolder = require("esri/layers/KMLFolder"); + + /** The KMLLayer class is used to create a layer based on a KML file (.kml, .kmz). */ + class KMLLayer extends Layer { + /** An array of objects that describe top-level KML features ids and their types. */ + featureInfos: any[]; + /** An array of KMLFolder objects that describe the folders and nested folders defined in the KML file. */ + folders: KMLFolder[]; + /** A link info object with properties that describe the network link. */ + linkInfo: any; + /** The publicly accessible URL for a .kml or .kmz file. */ + url: string; + /** + * Creates a new KMLLayer based upon the given URL. + * @param id Id to assign to the layer. + * @param url URL for a .kml or .kmz file. + * @param options Optional parameters. + */ + constructor(id: string, url: string, options?: esri.KMLLayerOptions); + /** + * Get the KML feature identified by the input feature info. + * @param featureInfo Feature info for the kml feature. + */ + getFeature(featureInfo: any): any; + /** Get an array of map layers that were created to draw placemarks, ground and screen overlays. */ + getLayers(): Layer[]; + /** + * Set the visibility for the specified folder. + * @param folder A KML folder. + * @param isVisible The visibility of the folder and all kml features within the folder. + */ + setFolderVisibility(folder: KMLFolder, isVisible: boolean): void; + /** Fired after the layer is refreshed. */ + on(type: "refresh", listener: (event: { target: KMLLayer }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = KMLLayer; +} + +declare module "esri/layers/LOD" { + /** An ArcGISTiledMapServiceLayer has a number of LODs (Levels of Detail). */ + class LOD { + /** ID for each level. */ + level: number; + /** String to be used when constructing URL to access a tile from this LOD. */ + levelValue: string; + /** Resolution in map units of each pixel in a tile for each level. */ + resolution: number; + /** Scale for each level. */ + scale: number; + } + export = LOD; +} + +declare module "esri/layers/LabelClass" { + import TextSymbol = require("esri/symbols/TextSymbol"); + + /** LabelClass defines the styles of labels for ArcGISDynamicMapServiceLayer. */ + class LabelClass { + /** Adjusts the formatting of labels. */ + labelExpression: string; + /** The position of the label. */ + labelPlacement: string; + /** The maximum scale to show labels. */ + maxScale: number; + /** The minimum scale to show labels. */ + minScale: number; + /** If this is defined, the symbol size changes proportionally. */ + sizeInfo: any; + /** Sets the Rendering symbol for the label. */ + symbol: TextSymbol; + /** When true, show the fields in the labelExpression that have domains using the domain's name. */ + useCodedValues: boolean; + /** A where clause determining which features are labeled. */ + where: string; + /** + * Create a LabelClass, in order to be added to layerDrawingOption.labelingInfo. + * @param json Various options to configure this LabelClass. + */ + constructor(json?: Object); + } + export = LabelClass; +} + +declare module "esri/layers/LabelLayer" { + import esri = require("esri"); + import GraphicsLayer = require("esri/layers/GraphicsLayer"); + import FeatureLayer = require("esri/layers/FeatureLayer"); + import SimpleRenderer = require("esri/renderers/SimpleRenderer"); + import UniqueValueRenderer = require("esri/renderers/UniqueValueRenderer"); + import ClassBreaksRenderer = require("esri/renderers/ClassBreaksRenderer"); + + /** The LabelLayer inherits from the graphics layer and can be used to display texts and symbols on map. */ + class LabelLayer extends GraphicsLayer { + /** + * Creates a new Label layer. + * @param params Constructor parameters. + */ + constructor(params?: esri.LabelLayerOptions); + /** + * Adds reference to the feature layer which is labeled. + * @param featureLayer The feature layer to be added to the label layer. + * @param renderer The renderer used to render text labels. + * @param textExpression An expression determining what text and field(s) will be displayed as in labels. + */ + addFeatureLayer(featureLayer: FeatureLayer, renderer?: SimpleRenderer, textExpression?: any): void; + /** + * Adds reference to the feature layer which is labeled. + * @param featureLayer The feature layer to be added to the label layer. + * @param renderer The renderer used to render text labels. + * @param textExpression An expression determining what text and field(s) will be displayed as in labels. + */ + addFeatureLayer(featureLayer: FeatureLayer, renderer?: UniqueValueRenderer, textExpression?: any): void; + /** + * Adds reference to the feature layer which is labeled. + * @param featureLayer The feature layer to be added to the label layer. + * @param renderer The renderer used to render text labels. + * @param textExpression An expression determining what text and field(s) will be displayed as in labels. + */ + addFeatureLayer(featureLayer: FeatureLayer, renderer?: ClassBreaksRenderer, textExpression?: any): void; + /** + * Returns reference to the feature layer which features will be labeled. + * @param index Index of the referenced feature layer. + */ + getFeatureLayer(index: number): FeatureLayer; + } + export = LabelLayer; +} + +declare module "esri/layers/LayerDataSource" { + import LayerSource = require("esri/layers/LayerSource"); + import DataSource = require("esri/layers/DataSource"); + + /** The LayerDataSource class defines and provides information about a layer created on the fly from a data source. */ + class LayerDataSource extends LayerSource { + /** The data source used to create a dynamic data layer on the fly. */ + dataSource: DataSource; + /** + * Creates a new LayerDataSource object. + * @param json JSON object representing the LayerDataSource. + */ + constructor(json?: Object); + /** Converts object to its ArcGIS Server JSON representation. */ + toJson(): any; + } + export = LayerDataSource; +} + +declare module "esri/layers/LayerDrawingOptions" { + import LabelClass = require("esri/layers/LabelClass"); + import Renderer = require("esri/renderers/Renderer"); + + /** The LayerDrawingOptions class provides options for setting ArcGISDynamicMapServiceLayer rendering options. */ + class LayerDrawingOptions { + /** Define labels of dynamicLayers. */ + labelingInfo: LabelClass[]; + /** The renderer to use for the dynamic layer. */ + renderer: Renderer; + /** Determines if the layer renders the symbols based on scale. */ + scaleSymbols: boolean; + /** Determines if labels are displayed. */ + showLabels: boolean; + /** The transparency of the layer. */ + transparency: number; + /** + * Creates a new LayerDrawingOptions object. + * @param json JSON object representing the LayerDrawingOptions. + */ + constructor(json?: Object); + /** Converts object to its ArcGIS Server JSON representation. */ + toJson(): any; + } + export = LayerDrawingOptions; +} + +declare module "esri/layers/LayerInfo" { + /** Contains information about each layer in a map service. */ + class LayerInfo { + /** Default visibility of the layers in the map service. */ + defaultVisibility: boolean; + /** Layer ID assigned by ArcGIS Server for a layer. */ + id: number; + /** The maximum visible scale for each layer in the map service. */ + maxScale: number; + /** The minimum visible scale for each layer in the map service. */ + minScale: number; + /** Layer name as defined in the map service. */ + name: string; + /** If the layer is part of a group layer, it will include the parent ID of the group layer. */ + parentLayerId: number; + /** If the layer is a parent layer, it will have one or more sub layers included in an array. */ + subLayerIds: number[]; + } + export = LayerInfo; +} + +declare module "esri/layers/LayerMapSource" { + import LayerSource = require("esri/layers/LayerSource"); + + /** The LayerMapSource class defines and provides information about an existing map service layer. */ + class LayerMapSource extends LayerSource { + /** When supported, specify the version in an SDE workspace that the layer will use. */ + gdbVersion: string; + /** The layer id for a sub-layer in the current map service. */ + mapLayerId: number; + /** + * Creates a new LayerMapSource object. + * @param json JSON object representing the LayerMapSource. + */ + constructor(json?: Object); + /** Converts object to its ArcGIS Server JSON representation. */ + toJson(): any; + } + export = LayerMapSource; +} + +declare module "esri/layers/LayerSource" { + /** Used to denote classes that may be used as a layer's source. */ + class LayerSource { + /** Used to describe the origin of the LayerSource. */ + type: string; + /** + * Creates a new LayerSource object. + * @param json Creates a new LayerSource object. + */ + constructor(json?: Object); + } + export = LayerSource; +} + +declare module "esri/layers/LayerTimeOptions" { + /** Defines the time options for the layer. */ + class LayerTimeOptions { + /** If true, the layer will draw all features from the beginning of the data's time extent. */ + timeDataCumulative: boolean; + /** The length of time the data is offset from the time when the data was recorded. */ + timeOffset: number; + /** Temporal unit in which the time offset is measured. */ + timeOffsetUnits: string; + /** If true, the layer participates in time-related rendering and query operations. */ + useTime: boolean; + } + export = LayerTimeOptions; +} + +declare module "esri/layers/MapImage" { + import esri = require("esri"); + import Extent = require("esri/geometry/Extent"); + + /** Represents the data object for the dynamically generated map. */ + class MapImage { + /** Extent of exported map. */ + extent: Extent; + /** Requested image height in pixels. */ + height: number; + /** URL to returned image. */ + href: string; + /** Scale of requested dynamic map. */ + scale: number; + /** Requested image width in pixels. */ + width: number; + /** + * Creates a new Map Image object. + * @param options An object that defines the map image options. + */ + constructor(options: esri.MapImageOptions); + } + export = MapImage; +} + +declare module "esri/layers/MapImageLayer" { + import Layer = require("esri/layers/layer"); + import MapImage = require("esri/layers/MapImage"); + + /** The MapImageLayer class is used to add georeferenced images to the map. */ + class MapImageLayer extends Layer { + /** + * Creates a new MapImageLayer object + * @param options Optional parameters. + */ + constructor(options?: any); + /** + * Add an image to the map. + * @param mapImage A MapImage object that defines the image to add to the map. + */ + addImage(mapImage: MapImage): void; + /** Get an array of MapImage objects that define the images in the MapImageLayer. */ + getImages(): MapImage[]; + /** Remove all images from the layer. */ + removeAllImages(): void; + /** + * Remove the specified image from the layer. + * @param mapImage The MapImage object that defines the image to remove. + */ + removeImage(mapImage: MapImage): void; + } + export = MapImageLayer; +} + +declare module "esri/layers/MosaicRule" { + import DimensionalDefinition = require("esri/layers/DimensionalDefinition"); + import Point = require("esri/geometry/Point"); + + /** Specifies the mosaic rule when defining how individual images should be mosaicked. */ + class MosaicRule { + /** Sorts rasters based on an attribute field and its difference from a base value. */ + static METHOD_ATTRIBUTE: any; + /** Sorts rasters where rasters that have their centers closest to the view center or center of view extent are placed on top. */ + static METHOD_CENTER: any; + /** Specifies that only rasters in the given list of raster Ids participate in the mosaic. */ + static METHOD_LOCKRASTER: any; + /** Sorts rasters by the distance between the nadir position and view center. */ + static METHOD_NADIR: any; + /** No mosaic method specified. */ + static METHOD_NONE: any; + /** Sorts rasters in a view independent way, where rasters with their centers most northwest are displayed on top. */ + static METHOD_NORTHWEST: any; + /** Cuts the raster using the predefined seamline shape. */ + static METHOD_SEAMLINE: any; + /** Sorts rasters based on a user-defined viewpoint location and nadir location. */ + static METHOD_VIEWPOINT: any; + /** Takes the blended value of all overlapping pixels. */ + static OPERATION_BLEND: any; + /** Takes the first value of all overlapping pixels. */ + static OPERATION_FIRST: any; + /** Takes the last value of all overlapping pixels. */ + static OPERATION_LAST: any; + /** Takes the maximum value of all overlapping pixels. */ + static OPERATION_MAX: any; + /** Takes the mean value of all overlapping pixels. */ + static OPERATION_MEAN: any; + /** Takes the minimum value of all overlapping pixels. */ + static OPERATION_MIN: any; + /** Indicates whether the sort should be ascending or not. */ + ascending: boolean; + /** An array of raster Ids. */ + lockRasterIds: number[]; + /** The mosaic method determines how the selected rasters are ordered. */ + method: string; + /** A multiple dimensional service can have multiple variables and multiple dimensions. */ + multidimensionalDefinition: DimensionalDefinition[]; + /** Defines a selection using a set of ObjectIds. */ + objectIds: number[]; + /** Defines the mosaic operation used to resolve overlapping pixels. */ + operation: string; + /** The name of the attribute field that is used together with a constant sortValue to define the mosaicking order when the mosaic method is set to METHOD_ATTRIBUTE. */ + sortField: string; + /** A constant value defining a reference or base value for the sort field when the mosaic method is set to METHOD_ATTRIBUTE. */ + sortValue: string; + /** Defines the viewpoint location on which the ordering is defined based on the distance from the viewpoint and the nadir of rasters. */ + viewpoint: Point; + /** The where clause determines which rasters will participate in the mosaic. */ + where: string; + /** Creates a new MosaicRule object */ + constructor(); + /** + * Create a new mosaic rule object using a json string representing a serialized version of the mosaic rule. + * @param json A json string representing a serialized version of the mosaic rule. + */ + constructor(json: Object); + /** Returns an easily serializable object representation of the mosaic rule. */ + toJson(): any; + } + export = MosaicRule; +} + +declare module "esri/layers/OpenStreetMapLayer" { + import esri = require("esri"); + import TiledMapServiceLayer = require("esri/layers/TiledMapServiceLayer"); + + /** Allows you to use basemaps from OpenStreetMap . */ + class OpenStreetMapLayer extends TiledMapServiceLayer { + /** The copyright text. */ + copyright: string; + /** + * Creates a new OpenStreetMapLayer object. + * @param options Optional parameters. + */ + constructor(options?: esri.OpenStreetMapLayerOptions); + } + export = OpenStreetMapLayer; +} + +declare module "esri/layers/PixelBlock" { + import esri = require("esri"); + + /** (Beta at v3.13) The PixelBlock is used to hold pixels. */ + class PixelBlock { + /** Number of rows. */ + height: number; + /** An array of nodata mask. */ + mask: any[]; + /** A two dimensional array. */ + pixels: number[][]; + /** Pixel type. */ + pixelType: string; + /** Array of objects containing numeric statistical properties (e.g. */ + statistics: any[]; + /** Number of columns. */ + width: number; + /** + * Creates a new PixelBlock object. + * @param options Constructor parameters. + */ + constructor(options: esri.PixelBlockOptions); + /** + * Adds another plane. + * @param planeData Must have two properties set: pixels and statistics. + */ + addData(planeData: any): void; + /** Returns pixels and masks using a single array in bip format (e.g. */ + getAsRGBA(): any[]; + /** Similar to getAsRGBA, but returns floating point data. */ + getAsRGBAFloat(): any[]; + /** Returns the plane band count. */ + getPlaneCount(): number; + } + export = PixelBlock; +} + +declare module "esri/layers/QueryDataSource" { + import DataSource = require("esri/layers/DataSource"); + import SpatialReference = require("esri/SpatialReference"); + + /** The QueryDataSource class defines and provides information about a layer or table that is defined by a SQL query. */ + class QueryDataSource extends DataSource { + /** The geometry type of the data source. */ + geometryType: string; + /** An array of field names that define a unique identifier for the feature. */ + oidFields: string[]; + /** The SQL query string that defines the data source output. */ + query: string; + /** The spatial reference for the data source. */ + spatialReference: SpatialReference; + /** The workspace id for the registered file geodatabase, SDE or Shapefile workspace. */ + workspaceId: string; + /** + * Creates a new QueryDataSource object. + * @param json JSON object representing the QueryDataSource. + */ + constructor(json?: Object); + /** Converts object to its ArcGIS Server JSON representation. */ + toJson(): any; + } + export = QueryDataSource; +} + +declare module "esri/layers/RangeDomain" { + import Domain = require("esri/layers/Domain"); + + /** Information about the range of values belonging to the domain. */ + class RangeDomain extends Domain { + /** The maximum valid value. */ + maxValue: number; + /** The minimum valid value. */ + minValue: number; + } + export = RangeDomain; +} + +declare module "esri/layers/RasterDataSource" { + import DataSource = require("esri/layers/DataSource"); + + /** The RasterDataSource class defines and provides information about a file-based raster that resides in a registered raster workspace. */ + class RasterDataSource extends DataSource { + /** The name of a raster that resides in the registered workspace. */ + dataSourceName: string; + /** The workspace id for the registered raster workspace. */ + workspaceId: string; + /** + * Creates a new RasterDataSource object. + * @param json JSON object representing the RasterDataSource. + */ + constructor(json?: Object); + /** Converts object to its ArcGIS Server JSON representation. */ + toJson(): any; + } + export = RasterDataSource; +} + +declare module "esri/layers/RasterFunction" { + /** Specifies the processing to be done to the image service. */ + class RasterFunction { + /** Deprecated at v3.10, use functionArguments instead. */ + arguments: any; + /** The arguments for the raster function. */ + functionArguments: any; + /** The raster function name. */ + functionName: string; + /** Variable name for the raster function. */ + variableName: string; + /** Creates a new RasterFunction object. */ + constructor(); + /** + * Create a new Raster Function object using a json string representing a serialized version of a raster function. + * @param json A json string representing a serialized version of a raster function. + */ + constructor(json: Object); + /** Returns an easily serializable object representation of the raster function. */ + toJson(): any; + } + export = RasterFunction; +} + +declare module "esri/layers/RasterLayer" { + import esri = require("esri"); + import Layer = require("esri/layers/layer"); + + /** (Beta at v3.13) The RasterLayer is used to display image services. */ + class RasterLayer extends Layer { + /** + * Creates a new RasterLayer object. + * @param url URL to the ArcGIS Server REST resource that represents a raster layer service. + * @param options Optional parameters. + */ + constructor(url: string, options?: esri.RasterLayerOptions); + /** Returns the context of the Canvas. */ + getContext(): any; + } + export = RasterLayer; +} + +declare module "esri/layers/StreamLayer" { + import esri = require("esri"); + import FeatureLayer = require("esri/layers/FeatureLayer"); + import Extent = require("esri/geometry/Extent"); + import Layer = require("esri/layers/layer"); + + /** The stream layer extends the feature layer to add the ability to connect to a stream of data using HTML5 WebSockets. */ + class StreamLayer extends FeatureLayer { + /** The maximum number of observations being shown for each unique track. */ + maximumTrackPoints: number; + /** Purge interval of the layer in minutes. */ + purgeInterval: number; + /** Raw access to the connected websocket. */ + socket: any; + /** URL used to make the socket connection. */ + socketUrl: string; + /** + * Creates a new StreamLayer with a service URL. + * @param url URL to an ArcGIS Server Stream Service. + * @param options Optional parameters used to create the layer. + */ + constructor(url: string, options?: esri.StreamLayerOptions1); + /** + * Creates a new StreamLayer with a FeatureCollection object. + * @param featureCollectionObject A feature collection object. + * @param options Optional parameters used to create the layer. + */ + constructor(featureCollectionObject: any, options?: esri.StreamLayerOptions2); + /** + * Connect to the Stream Server socket. + * @param callback The function to call when the method has completed. + */ + connect(callback?: Function): void; + /** + * Disconnect from the Stream Server socket. + * @param callback The function to call when the method has completed. + */ + disconnect(callback?: Function): void; + /** Gets the where property of the layer's filter. */ + getDefinitionExpression(): string; + /** Gets the spatial filter set on the layer. */ + getGeometryDefinition(): Extent; + /** + * Gets the unique values of the graphics (in the StreamLayer) based on the `fieldName` parameter. + * @param fieldName Field to get the unique values from. + */ + getUniqueValues(fieldName: string): any[]; + /** + * Sets the spatial filter for the layer. + * @param extent Limit the features in the StreamLayer by setting a bounding box. + */ + setGeometryDefinition(extent: Extent): void; + /** + * Sets the maximumTrackPoints property for the layer. + * @param value The maximum track points for the layer. + */ + setMaximumTrackPoints(value: number): void; + /** + * Changes the layer's purge interval to the given value (in minutes). + * @param interval The purge interval in minutes. + */ + setPurgeInterval(interval: number): Layer; + /** Fires when the layer attempts to reconnect to the web socket. */ + on(type: "attempt-reconnect", listener: (event: { count: number; url: string; target: StreamLayer }) => void): esri.Handle; + /** Fires when connection is successfully made to socket. */ + on(type: "connect", listener: (event: { target: StreamLayer }) => void): esri.Handle; + /** Fires when a connection cannot be made with the web socket. */ + on(type: "connection-error", listener: (event: { error: Error; target: StreamLayer }) => void): esri.Handle; + /** Fires when disconnect from socket. */ + on(type: "disconnect", listener: (event: { target: StreamLayer }) => void): esri.Handle; + /** Fires when the layer receives a message that the server-side filter has been changed. */ + on(type: "filter-change", listener: (event: { error: Error; filter: any; target: StreamLayer }) => void): esri.Handle; + /** Fires after a message is pushed to the layer. */ + on(type: "message", listener: (event: { message: any; target: StreamLayer }) => void): esri.Handle; + /** Fires when the purgeInterval property is changed. */ + on(type: "purge-interval-change", listener: (event: { target: StreamLayer }) => void): esri.Handle; + /** Fires when layer is added to map (if stream service is associated with an archive feature service) and when graphics are updated on the map due to new ones being added or removed (for example purged). */ + on(type: "update-start", listener: (event: { target: StreamLayer }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = StreamLayer; +} + +declare module "esri/layers/TableDataSource" { + import DataSource = require("esri/layers/DataSource"); + + /** The TableDataSource class defines and provides information about a table, feature class, or raster that resides in a registered file geodatabase, SDE or Shapefile workspace. */ + class TableDataSource extends DataSource { + /** The name of a table, feature class or raster that resides in the registered workspace. */ + dataSourceName: string; + /** For versioned SDE workspaces, use this property to point to an alternate version. */ + gdbVersion: string; + /** The workspace id for the registered file geodatabase, SDE or Shapefile workspace. */ + workspaceId: string; + /** + * Creates a new TableDataSource object. + * @param json JSON object representing the TableDataSource. + */ + constructor(json?: Object); + /** Converts object to its ArcGIS Server JSON representation. */ + toJson(): any; + } + export = TableDataSource; +} + +declare module "esri/layers/TileInfo" { + import LOD = require("esri/layers/LOD"); + import Point = require("esri/geometry/Point"); + import SpatialReference = require("esri/SpatialReference"); + + /** Contains information about the tiling scheme for an ArcGISTiledMapServiceLayer. */ + class TileInfo { + /** The dpi of the tiling scheme. */ + dpi: number; + /** Image format of the cached tiles. */ + format: string; + /** Height of each tile in pixels. */ + height: number; + /** An array of levels of detail that define the tiling scheme. */ + lods: LOD[]; + /** The tiling scheme origin. */ + origin: Point; + /** The spatial reference of the tiling schema. */ + spatialReference: SpatialReference; + /** Width of each tile in pixels. */ + width: number; + /** + * Creates a new object describing the given tiling scheme. + * @param properties Properties describing the tiling scheme. + */ + constructor(properties: any); + /** Converts object to its ArcGIS Server JSON representation. */ + toJson(): any; + } + export = TileInfo; +} + +declare module "esri/layers/TiledMapServiceLayer" { + import Layer = require("esri/layers/layer"); + import Extent = require("esri/geometry/Extent"); + import SpatialReference = require("esri/SpatialReference"); + import TileInfo = require("esri/layers/TileInfo"); + + /** The base class for all tiled map service layers. */ + class TiledMapServiceLayer extends Layer { + /** Full extent as defined by the map service. */ + fullExtent: Extent; + /** Initial extent as defined by the map service. */ + initialExtent: Extent; + /** The spatial reference of the map service. */ + spatialReference: SpatialReference; + /** Returns TileInfo, which has information on the tiling schema. */ + tileInfo: TileInfo; + /** Creates a new TiledMapServiceLayer object. */ + constructor(); + /** + * Method to implement when extending TiledMapServiceLayer. + * @param level Requested tile's level. + * @param row Requested tile's row. + * @param column Requested tile's column. + */ + getTileUrl(level: number, row: number, column: number): string; + /** Reloads all the tiles in the current view. */ + refresh(): void; + /** Specify areas to not show tiles. */ + setExclusionAreas(): any[]; + } + export = TiledMapServiceLayer; +} + +declare module "esri/layers/TimeInfo" { + import LayerTimeOptions = require("esri/layers/LayerTimeOptions"); + import TimeExtent = require("esri/TimeExtent"); + import TimeReference = require("esri/layers/TimeReference"); + + /** Time information details. */ + class TimeInfo { + /** Indicates a value measured in centuries. */ + static UNIT_CENTURIES: any; + /** Indicates a value measured in days. */ + static UNIT_DAYS: any; + /** Indicates a value measured in decades. */ + static UNIT_DECADES: any; + /** Indicates a value measured in hours. */ + static UNIT_HOURS: any; + /** Indicates a value measured in milliseconds. */ + static UNIT_MILLISECONDS: any; + /** Indicates a value measured in minutes. */ + static UNIT_MINUTES: any; + /** Indicates a value measured in months. */ + static UNIT_MONTHS: any; + /** Indicates a value measured in seconds. */ + static UNIT_SECONDS: any; + /** Indicates a value measured in unknown units. */ + static UNIT_UNKNOWN: any; + /** Indicates a value measured in weeks. */ + static UNIT_WEEKS: any; + /** Indicates a value measured in years. */ + static UNIT_YEARS: any; + /** The name of the attribute field that contains the end time information. */ + endTimeField: string; + /** Default time-related export options for the layer. */ + exportOptions: LayerTimeOptions; + /** The name of the attribute field that contains the start time information. */ + startTimeField: string; + /** The time extent for all the data in the layer. */ + timeExtent: TimeExtent; + /** Time interval of the data in the layer. */ + timeInterval: number; + /** Temporal unit in which the time interval is measured. */ + timeIntervalUnits: string; + /** Information about how the time was measured. */ + timeReference: TimeReference; + /** The field that contains the trackId. */ + trackIdField: string; + } + export = TimeInfo; +} + +declare module "esri/layers/TimeReference" { + /** TimeReference contains information about how the time was measured. */ + class TimeReference { + /** Indicates whether the time reference respects daylight savings time. */ + respectsDaylightSaving: boolean; + /** The time zone information associated with the time reference. */ + timeZone: string; + } + export = TimeReference; +} + +declare module "esri/layers/WMSLayer" { + import esri = require("esri"); + import DynamicMapServiceLayer = require("esri/layers/DynamicMapServiceLayer"); + import Extent = require("esri/geometry/Extent"); + import WMSLayerInfo = require("esri/layers/WMSLayerInfo"); + import SpatialReference = require("esri/SpatialReference"); + + /** A layer for OGC Web Map Services (WMS). */ + class WMSLayer extends DynamicMapServiceLayer { + /** Copyright of the WMS service. */ + copyright: string; + /** Description of the WMS service. */ + description: string; + /** Extent of the WMS service. */ + extent: Extent; + /** The URL for the WMS GetMap call. */ + getMapUrl: string; + /** The map image format. */ + imageFormat: string; + /** List of layers in the WMS service. */ + layerInfos: WMSLayerInfo[]; + /** Maximum height in pixels the WMS service supports. */ + maxHeight: number; + /** Maximum width in pixels the WMS service supports. */ + maxWidth: number; + /** Spatial reference of the WMS service. */ + spatialReference: SpatialReference; + /** Title of the WMS service. */ + title: string; + /** Version of the WMS service. */ + version: string; + /** + * Creates a new WMSLayer object. + * @param url URL to the OGC Web Map Service. + * @param options Optional parameters. + */ + constructor(url: string, options?: esri.WMSLayerOptions); + /** + * Set the map image format; valid values are "png", "jpg", "pdf", "bmp", "gif" and "svg". + * @param format The image format. + */ + setImageFormat(format: string): void; + /** + * Specify whether the background image is transparent. + * @param transparency When true the background image is transparent. + */ + setImageTransparency(transparency: boolean): void; + /** + * Specify a list of layer names to updates the visible layers. + * @param layers An array of layer ids. + */ + setVisibleLayers(layers: string[]): void; + } + export = WMSLayer; +} + +declare module "esri/layers/WMSLayerInfo" { + import Extent = require("esri/geometry/Extent"); + + /** The WMSLayerInfo class defines and provides information about layers in a WMS service. */ + class WMSLayerInfo { + /** The layer description defines the value of the Abstract capabilities property. */ + description: string; + /** The layer extent. */ + extent: Extent; + /** Contains the value of the LegendURL capabilities property. */ + legendURL: string; + /** The layer name. */ + name: string; + /** The layer title. */ + title: string; + /** + * Creates a new WMSLayerInfo object. + * @param layer WMSLayerInfo layer object. + */ + constructor(layer: any); + } + export = WMSLayerInfo; +} + +declare module "esri/layers/WMTSLayer" { + import esri = require("esri"); + import TiledMapServiceLayer = require("esri/layers/TiledMapServiceLayer"); + import Extent = require("esri/geometry/Extent"); + import SpatialReference = require("esri/SpatialReference"); + import TileInfo = require("esri/layers/TileInfo"); + import WMTSLayerInfo = require("esri/layers/WMTSLayerInfo"); + + /** The WMTSLayer class is used to create a layer based on an OGC Web Map Tile Service layer. */ + class WMTSLayer extends TiledMapServiceLayer { + /** Copyright information for the service. */ + copyright: string; + /** The description of the active layer if specified in the capabilties file or the resource info. */ + description: string; + /** The tile format. */ + format: string; + /** The full extent of the active layer. */ + fullExtent: Extent; + /** The initial extent of the active layer. */ + initialExtent: Extent; + /** An array of WMTSLayerInfo objects. */ + layerInfos: any[]; + /** The service mode for the WMTS layer. */ + serviceMode: string; + /** The spatial reference for the WMTS service. */ + spatialReference: SpatialReference; + /** The tile info for the active layer. */ + tileInfo: TileInfo; + /** Title of the WMTS service. */ + title: string; + /** Version of the WMTS service. */ + version: string; + /** + * Creates a new WMTSLayer object. + * @param url URL for the WMTS endpoint. + * @param options Optional parameters. + */ + constructor(url: string, options?: esri.WMTSLayerOptions); + /** + * Set the active layer for the WMTS service. + * @param WMTSLayerInfo The WMTSLayerInfo for the layer to make active. + */ + setActiveLayer(WMTSLayerInfo: WMTSLayerInfo): void; + } + export = WMTSLayer; +} + +declare module "esri/layers/WMTSLayerInfo" { + import esri = require("esri"); + + /** The WMTSLayerInfo class defines and provides information about layers in a WMTS service. */ + class WMTSLayerInfo { + /** + * Creates a new WMTSLayerInfo object. + * @param options An object that defines the layer info options. + */ + constructor(options: esri.WMTSLayerInfoOptions); + } + export = WMTSLayerInfo; +} + +declare module "esri/layers/WebTiledLayer" { + import esri = require("esri"); + import TiledMapServiceLayer = require("esri/layers/TiledMapServiceLayer"); + import Extent = require("esri/geometry/Extent"); + import SpatialReference = require("esri/SpatialReference"); + import TileInfo = require("esri/layers/TileInfo"); + + /** The WebTiledLayer class provides a simple way to add non-ArcGIS Server map tiles as a layer to a map. */ + class WebTiledLayer extends TiledMapServiceLayer { + /** The attribution information for the layer. */ + copyright: string; + /** The full extent of the layer. */ + fullExtent: Extent; + /** The initial extent of the layer. */ + initialExtent: Extent; + /** The spatial reference of the layer. */ + spatialReference: SpatialReference; + /** Define the tile info for the layer including lods, rows, cols, origin and spatial reference. */ + tileInfo: TileInfo; + /** The tile server names for the layer. */ + tileServers: string[]; + /** + * Creates a new WebTiledLayer. + * @param urlTemplate The URL template to retrieve the tiles. + * @param options Optional parameters. + */ + constructor(urlTemplate: string, options?: esri.WebTiledLayerOptions); + } + export = WebTiledLayer; +} + +declare module "esri/layers/layer" { + import esri = require("esri"); + import Credential = require("esri/Credential"); + import Map = require("esri/map"); + + /** The base class for all layers that can be added to a map. */ + class Layer { + /** The URL, when available, where the layer's attribution data is stored. */ + attributionDataUrl: string; + /** class attribute of the layer's node. */ + className: string; + /** Provides credential information for the layer such as userid and token if the layer represents a resource that is secured with token-based authentication. */ + credential: Credential; + /** When true, the layer has attribution data. */ + hasAttributionData: boolean; + /** ID assigned to the layer. */ + id: string; + /** When the layer is loaded, the value becomes "true", and layer properties can be accessed. */ + loaded: boolean; + /** Set if the layer failed to load. */ + loadError: Error; + /** Maximum visible scale for the layer. */ + maxScale: number; + /** Minimum visible scale for the layer. */ + minScale: number; + /** Opacity or transparency of layer. */ + opacity: number; + /** Refresh interval of the layer in minutes. */ + refreshInterval: number; + /** When true, the layer's attribution is displayed on the map. */ + showAttribution: boolean; + /** When true, the layer is suspended. */ + suspended: boolean; + /** URL to the ArcGIS Server REST resource that represents a map service. */ + url: string; + /** Visibility of the layer. */ + visible: boolean; + /** When true, the layer is visible at the current map scale. */ + visibleAtMapScale: boolean; + /** + * Creates a new Layer object. + * @param options Optional parameters. + */ + constructor(options?: esri.LayerOptions); + /** + * Adds a new attribute or changes the value of an existing attribute on the layer's node. + * @param name The name of the attribute. + * @param value The value of the attribute. + */ + attr(name: string, value: string): Layer; + /** Asynchrously returns custom data for the layer when available. */ + getAttributionData(): any; + /** Returns reference to the map control the layer is added to. */ + getMap(): Map; + /** Returns the layer's DOM node. */ + getNode(): HTMLElement; + /** Sets the visibility of the layer to "false". */ + hide(): void; + /** + * Returns true if the layer is visible at the given scale. + * @param scale The scale at which to check if the layer is visible. + */ + isVisibleAtScale(scale: number): boolean; + /** Resumes layer drawing. */ + resume(): void; + /** + * Set the maximum scale for the layer. + * @param scale The maximum scale at which the layer is visible. + */ + setMaxScale(scale: number): void; + /** + * Set the minimum scale for the layer. + * @param scale The minimum scale at which the layer is visible. + */ + setMinScale(scale: number): void; + /** + * Sets the opacity of the layer. + * @param opacity Value from 0 to 1, where 0 is 100% transparent and 1 has no transparency. + */ + setOpacity(opacity: number): void; + /** + * Changes the layer's refresh interval to the given value (in minutes). + * @param interval Refresh interval of the layer in minutes. + */ + setRefreshInterval(interval: number): Layer; + /** + * Set the scale range for the layer. + * @param minScale The minimum scale at which the layer is visible. + * @param maxScale The maximum scale at which the layer is visible. + */ + setScaleRange(minScale: number, maxScale: number): void; + /** + * Sets the visibility of the layer. + * @param isVisible Set the visibility of the layer. + */ + setVisibility(isVisible: boolean): void; + /** Sets the visibility of the layer to "true". */ + show(): void; + /** Suspends layer drawing. */ + suspend(): void; + /** Fires when there is a problem retrieving a layer. */ + on(type: "error", listener: (event: { error: Error; target: Layer }) => void): esri.Handle; + /** Fires after layer properties for the layer are successfully populated. */ + on(type: "load", listener: (event: { layer: Layer; target: Layer }) => void): esri.Handle; + /** Fires when the layer opacity has been changed, and returns an object with the opacity value. */ + on(type: "opacity-change", listener: (event: { opacity: number; target: Layer }) => void): esri.Handle; + /** This event is fired when the layer's refreshInterval is modified. */ + on(type: "refresh-interval-change", listener: (event: { target: Layer }) => void): esri.Handle; + /** Fires when a layer resumes drawing. */ + on(type: "resume", listener: (event: { target: Layer }) => void): esri.Handle; + /** Fires when a layer's minScale and/or maxScale is changed. */ + on(type: "scale-range-change", listener: (event: { target: Layer }) => void): esri.Handle; + /** Fires when a layer's scale visibility changes. */ + on(type: "scale-visibility-change", listener: (event: { target: Layer }) => void): esri.Handle; + /** Fires when a layer suspends drawing. */ + on(type: "suspend", listener: (event: { target: Layer }) => void): esri.Handle; + /** Fires any time a layer has finished loading or updating itself. */ + on(type: "update", listener: (event: { target: Layer }) => void): esri.Handle; + /** Fires when a layer has finished updating its content. */ + on(type: "update-end", listener: (event: { error: Error; target: Layer }) => void): esri.Handle; + /** Fires when a layer begins to update its content. */ + on(type: "update-start", listener: (event: { target: Layer }) => void): esri.Handle; + /** Fires when the layer visibility has been changed, and returns an object with a Boolean visible property containing the new visibility value of the layer. */ + on(type: "visibility-change", listener: (event: { visible: boolean; target: Layer }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = Layer; +} + +declare module "esri/map" { + import esri = require("esri"); + import Attribution = require("esri/dijit/Attribution"); + import Extent = require("esri/geometry/Extent"); + import GraphicsLayer = require("esri/layers/GraphicsLayer"); + import InfoWindowBase = require("esri/InfoWindowBase"); + import Point = require("esri/geometry/Point"); + import SnappingManager = require("esri/SnappingManager"); + import SpatialReference = require("esri/SpatialReference"); + import TimeExtent = require("esri/TimeExtent"); + import Layer = require("esri/layers/layer"); + import ScreenPoint = require("esri/geometry/ScreenPoint"); + import TimeSlider = require("esri/dijit/TimeSlider"); + import LOD = require("esri/layers/LOD"); + + /** The Map class creates a container and required DOM structure for adding layers, graphics, an info window, and other navigation controls. */ + class Map { + /** Reference to the attribution widget created by the map when map attribution is enabled. */ + attribution: Attribution; + /** Value is true when the map automatically resizes if the browser window or ContentPane widget enclosing the map is resized. */ + autoResize: boolean; + /** An array of IDs corresponding to the layers that make up the map's current basemap. */ + basemapLayerIds: string[]; + /** The current extent of the map in map units. */ + extent: Extent; + /** Indicates if the fade effect is enabled while zooming. */ + fadeOnZoom: boolean; + /** When the mapNavigation mode is set to 'css-transforms', CSS3 transforms will be used for map navigation when supported by the browser. */ + force3DTransforms: boolean; + /** The extent (or bounding box) of the map in geographic coordinates. */ + geographicExtent: Extent; + /** Provides access to the Map's GraphicsLayer. */ + graphics: GraphicsLayer; + /** An array of the current GraphicsLayers in the map. */ + graphicsLayerIds: string[]; + /** Current height of the map in screen pixels. */ + height: number; + /** Reference to HTML DIV or other element where the map is placed on the page. */ + id: string; + /** Displays the InfoWindow on a map. */ + infoWindow: InfoWindowBase; + /** When true, the key sequence of shift then click to recenter the map is enabled. */ + isClickRecenter: boolean; + /** When true, double click zoom is enabled. */ + isDoubleClickZoom: boolean; + /** When true, keyboard navigation is enabled. */ + isKeyboardNavigation: boolean; + /** When true, map panning is enabled using the mouse. */ + isPan: boolean; + /** When true, pan arrows are displayed around the edge of the map. */ + isPanArrows: boolean; + /** When true, rubberband zoom is enabled. */ + isRubberBandZoom: boolean; + /** When true, the mouse scroll wheel zoom is enabled. */ + isScrollWheelZoom: boolean; + /** When true, shift double click zoom is enabled. */ + isShiftDoubleClickZoom: boolean; + /** When true, the zoom slider is displayed on the map. */ + isZoomSlider: boolean; + /** Array of IDs corresponding to layers in the map, except for GraphicsLayers and FeatureLayers, which are maintained in map.graphicsLayerIds. */ + layerIds: string[]; + /** After the first layer is loaded, the value is set to true. */ + loaded: boolean; + /** Indicates whether the map uses CSS3 transformations when panning and zooming. */ + navigationMode: string; + /** This point geometry in screen coordinates represent the top-left corner of the map container. */ + position: Point; + /** The DOM node that contains the container of layers, build-in info window, logo and slider. */ + root: Node; + /** When true, map attribution is enabled. */ + showAttribution: boolean; + /** If snapping is enabled on the map using map.enableSnapping() this property provides access to the SnappingManager. */ + snappingManager: SnappingManager; + /** The spatial reference of the map. */ + spatialReference: SpatialReference; + /** The current TimeExtent for the map. */ + timeExtent: TimeExtent; + /** Indicates whether map is visible. */ + visible: boolean; + /** Current width of the map in screen pixels. */ + width: number; + /** + * Creates a new map inside of the given HTML container, which is often a DIV element. + * @param divId Container id for the referencing map. + * @param options Optional parameters. + */ + constructor(divId: string, options?: esri.MapOptions); + /** + * Adds an Esri Layer to the map. + * @param layer Layer to be added to the map. + * @param index A layer can be added at a specified index in the map. + */ + addLayer(layer: Layer, index?: number): Layer; + /** + * Adds multiple layers to a map. + * @param layers Layers to be added to the map. + */ + addLayers(layers: Layer[]): void; + /** + * Adds a new attribute or changes the value of an existing attribute on the map container. + * @param name The name of the attribute. + * @param value The value of the attribute. + */ + attr(name: string, value: string): Map; + /** + * Centers and zooms the map. + * @param mapPoint Centers the map on the specified x,y location. + * @param levelOrFactor When using an ArcGISTiledMapServiceLayer, the map is zoomed to the level specified. + */ + centerAndZoom(mapPoint: Point, levelOrFactor: number): any; + /** + * Centers the map based on map coordinates as the center point. + * @param mapPoint Centers the map on the specified x,y location. + */ + centerAt(mapPoint: Point): any; + /** Destroys the map instance. */ + destroy(): void; + /** Disallows clicking on a map to center it. */ + disableClickRecenter(): void; + /** Disallows double clicking on a map to zoom in a level and center the map. */ + disableDoubleClickZoom(): void; + /** Disallows panning and zooming using the keyboard. */ + disableKeyboardNavigation(): void; + /** Disallows all map navigation except the slider and pan arrows. */ + disableMapNavigation(): void; + /** Disallows panning a map using the mouse. */ + disablePan(): void; + /** Disallows zooming in or out on a map using a bounding box. */ + disableRubberBandZoom(): void; + /** Disallows zooming in or out on a map using the mouse scroll wheel. */ + disableScrollWheelZoom(): void; + /** Disallows shift double clicking on a map to zoom in a level and center the map. */ + disableShiftDoubleClickZoom(): void; + /** Disables snapping on the map. */ + disableSnapping(): void; + /** Permits users to click on a map to center it. */ + enableClickRecenter(): void; + /** Permits users to double click on a map to zoom in a level and center the map. */ + enableDoubleClickZoom(): void; + /** Permits users to pan and zoom using the keyboard. */ + enableKeyboardNavigation(): void; + /** Allows all map navigation. */ + enableMapNavigation(): void; + /** Permits users to pan a map using the mouse. */ + enablePan(): void; + /** Permits users to zoom in or out on a map using a bounding box. */ + enableRubberBandZoom(): void; + /** Permits users to zoom in or out on a map using the mouse scroll wheel. */ + enableScrollWheelZoom(): void; + /** Permits users to shift double click on a map to zoom in a level and center the map. */ + enableShiftDoubleClickZoom(): void; + /** + * Enable snapping on the map when working with the Editor, Measurement widget or the Draw and Edit toolbars. + * @param snapOptions See the object specifications table below for the structure of the snapOptions object. + */ + enableSnapping(snapOptions?: any): SnappingManager; + /** Returns the name of the current basemap. */ + getBasemap(): string; + /** + * Sets an InfoWindow's anchor when calling InfoWindow.show. + * @param screenCoords The anchor point in screen units. + */ + getInfoWindowAnchor(screenCoords: ScreenPoint): string; + /** + * Returns an individual layer of a map. + * @param id ID assigned to the layer. + */ + getLayer(id: string): Layer; + /** Return an array of layers visible at the current scale. */ + getLayersVisibleAtScale(): Layer[]; + /** Gets the current level of detail for the map. */ + getLevel(): number; + /** Returns the maximum visible scale of the map. */ + getMaxScale(): number; + /** Returns the maximum zoom level of the map. */ + getMaxZoom(): number; + /** Returns the minimum visible scale of the map. */ + getMinScale(): number; + /** Returns the minimum zoom level of the map. */ + getMinZoom(): number; + /** Returns the current map scale. */ + getScale(): number; + /** Returns the current zoom level of the map. */ + getZoom(): number; + /** Hides the pan arrows from the map. */ + hidePanArrows(): void; + /** Hides the zoom slider from the map. */ + hideZoomSlider(): void; + /** Pans the map south. */ + panDown(): any; + /** Pans the map west. */ + panLeft(): any; + /** Pans the map southwest. */ + panLowerLeft(): any; + /** Pans the map southeast. */ + panLowerRight(): any; + /** Pans the map east. */ + panRight(): any; + /** Pans the map north. */ + panUp(): any; + /** Pans the map northwest. */ + panUpperLeft(): any; + /** Pans the map northeast. */ + panUpperRight(): any; + /** Removes all layers from the map. */ + removeAllLayers(): void; + /** + * Removes the specified layer from the map. + * @param layer Layer to be removed from the map. + */ + removeLayer(layer: Layer): void; + /** + * Changes the layer order in the map. + * @param layer The layer to be moved. + * @param index Refers to the location for placing the layer. + */ + reorderLayer(layer: Layer, index: number): void; + /** Repositions the map DIV on the page. */ + reposition(): void; + /** + * Resizes the map DIV. + * @param immediate By default, the actual resize logic is delayed internally in order to throttle spurious resize events dispatched by some browsers. + */ + resize(immediate?: boolean): void; + /** + * Change the map's current basemap. + * @param basemap A valid basemap name. + */ + setBasemap(basemap: string): void; + /** + * Sets the extent of the map. + * @param extent Sets the minx, miny, maxx, and maxy for a map. + * @param fit When true, for maps that contain tiled map service layers, you are guaranteed to have the input extent shown completely on the map. + */ + setExtent(extent: Extent, fit?: boolean): any; + /** + * If true and a map click event occurs, it may show the map's infoWindow. + * @param enabled Toggles the behavior initially set by the map's showInfoWindowOnClick constructor option. + */ + setInfoWindowOnClick(enabled: boolean): void; + /** + * Sets the map to the specified level. + * @param level The level ID. + */ + setLevel(level: number): any; + /** + * Sets the default cursor for the map. + * @param cursor A standard CSS cursor value. + */ + setMapCursor(cursor: string): void; + /** + * Sets the map scale to the specified value. + * @param scale A map scale value greater than 0. + */ + setScale(scale: number): any; + /** + * Sets the TimeExtent for the map. + * @param timeExtent Set the time extent for which data is displayed on the map. + */ + setTimeExtent(timeExtent: TimeExtent): void; + /** + * Set the time slider associated with the map. + * @param timeSlider The time slider dijit to associate with the map. + */ + setTimeSlider(timeSlider: TimeSlider): void; + /** + * Show or hide the map. + * @param visible If true, map will be visible. + */ + setVisibility(visible: boolean): Map; + /** + * Set the map zoom level to the given value. + * @param zoom A valid zoom level value. + */ + setZoom(zoom: number): any; + /** Shows the pan arrows on the map. */ + showPanArrows(): void; + /** Shows the zoom slider on the map. */ + showZoomSlider(): void; + /** + * Converts a single screen point to map coordinates. + * @param screenPoint Converts screen coordinates to map coordinates. + */ + toMap(screenPoint: ScreenPoint): Point; + /** + * Converts a single map point to screen coordinate. + * @param mapPoint Converts map coordinates to screen coordinates. + */ + toScreen(mapPoint: Point): ScreenPoint; + /** Fired when the map's basemap is changed. */ + on(type: "basemap-change", listener: (event: { current: any; previous: any; target: Map }) => void): esri.Handle; + /** Event is fired before the map gets destroyed. */ + on(type: "before-unload", listener: (event: { map: Map; target: Map }) => void): esri.Handle; + /** Fires when a user single clicks on the map using the mouse and the mouse pointer is within the map region of the HTML page. */ + on(type: "click", listener: (event: esri.AGSMouseEvent) => void): esri.Handle; + /** Fires when a user double clicks on the map using the mouse and the mouse pointer is within the map region of the HTML page. */ + on(type: "dbl-click", listener: (event: esri.AGSMouseEvent) => void): esri.Handle; + /** Fires when the extent of the map has changed. */ + on(type: "extent-change", listener: (event: { delta: Point; extent: Extent; levelChange: boolean; lod: LOD; target: Map }) => void): esri.Handle; + /** Fires when a keyboard key is pressed. */ + on(type: "key-down", listener: (event: KeyboardEvent) => void): esri.Handle; + /** Fires when a keyboard key is released. */ + on(type: "key-up", listener: (event: KeyboardEvent) => void): esri.Handle; + /** Fires any time a layer is added to the map. */ + on(type: "layer-add", listener: (event: { layer: Layer; target: Map }) => void): esri.Handle; + /** Fires after specified layer has been added to the map. */ + on(type: "layer-add-result", listener: (event: { error: Error; layer: Layer; target: Map }) => void): esri.Handle; + /** Fires after the layer has been removed. */ + on(type: "layer-remove", listener: (event: { layer: Layer; target: Map }) => void): esri.Handle; + /** Fires when the map layer order has been changed. */ + on(type: "layer-reorder", listener: (event: { index: number; layer: Layer; target: Map }) => void): esri.Handle; + /** Fires when a map layer resumes drawing. */ + on(type: "layer-resume", listener: (event: { layer: Layer; target: Map }) => void): esri.Handle; + /** Fires after all layers are added to the map using the map.addLayers method. */ + on(type: "layers-add-result", listener: (event: { layers: Layer[]; target: Map }) => void): esri.Handle; + /** Fires after all the layers have been removed. */ + on(type: "layers-removed", listener: (event: { target: Map }) => void): esri.Handle; + /** Fires when all the layers have been reordered. */ + on(type: "layers-reordered", listener: (event: { layerIds: string[]; target: Map }) => void): esri.Handle; + /** Fires when a map layer suspends drawing. */ + on(type: "layer-suspend", listener: (event: { layer: Layer; target: Map }) => void): esri.Handle; + /** Fires when the first or base layer has been successfully added to the map. */ + on(type: "load", listener: (event: { map: Map; target: Map }) => void): esri.Handle; + /** Fires when a mouse button is pressed down and the mouse cursor is in the map region of the HTML page. */ + on(type: "mouse-down", listener: (event: esri.AGSMouseEvent) => void): esri.Handle; + /** Fires while the mouse is being dragged until the mouse button is released. */ + on(type: "mouse-drag", listener: (event: esri.AGSMouseEvent) => void): esri.Handle; + /** Fires when a mouse button is released and the user stops dragging the mouse. */ + on(type: "mouse-drag-end", listener: (event: esri.AGSMouseEvent) => void): esri.Handle; + /** Fires when a mouse button is pressed down and the user starts to drag the mouse. */ + on(type: "mouse-drag-start", listener: (event: esri.AGSMouseEvent) => void): esri.Handle; + /** Fires any time the mouse pointer moves over the map region. */ + on(type: "mouse-move", listener: (event: esri.AGSMouseEvent) => void): esri.Handle; + /** Fires when the mouse moves out of the map region of the HTML page. */ + on(type: "mouse-out", listener: (event: esri.AGSMouseEvent) => void): esri.Handle; + /** Fires when the mouse moves into the map region of the HTML page. */ + on(type: "mouse-over", listener: (event: esri.AGSMouseEvent) => void): esri.Handle; + /** Fires when the mouse button is released and the mouse pointer is within the map region of the HTML page. */ + on(type: "mouse-up", listener: (event: esri.AGSMouseEvent) => void): esri.Handle; + /** Fires when the mouse wheel is scrolled. */ + on(type: "mouse-wheel", listener: (event: esri.AGSMouseEvent) => void): esri.Handle; + /** Fires during the pan process. */ + on(type: "pan", listener: (event: { delta: Point; extent: Extent; target: Map }) => void): esri.Handle; + /** Fires when the pan is complete. */ + on(type: "pan-end", listener: (event: { delta: Point; extent: Extent; target: Map }) => void): esri.Handle; + /** Fires when a user commences panning. */ + on(type: "pan-start", listener: (event: { extent: Extent; target: Map }) => void): esri.Handle; + /** Fires when the map DIV is repositioned. */ + on(type: "reposition", listener: (event: { x: number; y: number; target: Map }) => void): esri.Handle; + /** Fires when the map's container has been resized. */ + on(type: "resize", listener: (event: { extent: Extent; height: number; width: number; target: Map }) => void): esri.Handle; + /** Fires when the map's timeExtent property is set. */ + on(type: "time-extent-change", listener: (event: { timeExtent: TimeExtent; target: Map }) => void): esri.Handle; + /** Fires when the page is refreshed. */ + on(type: "unload", listener: (event: { map: Map; target: Map }) => void): esri.Handle; + /** Fires after layers that are updating their content have completed. */ + on(type: "update-end", listener: (event: { error: Error; target: Map }) => void): esri.Handle; + /** Fires when one or more layers begins updating their content. */ + on(type: "update-start", listener: (event: { target: Map }) => void): esri.Handle; + /** Fires during the zoom process. */ + on(type: "zoom", listener: (event: { anchor: Point; extent: Extent; zoomFactor: number; target: Map }) => void): esri.Handle; + /** Fires when the zoom is complete. */ + on(type: "zoom-end", listener: (event: { anchor: Point; extent: Extent; level: number; zoomFactor: number; target: Map }) => void): esri.Handle; + /** Fires when a user commences zooming. */ + on(type: "zoom-start", listener: (event: { anchor: Point; extent: Extent; level: number; zoomFactor: number; target: Map }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = Map; +} + +declare module "esri/plugins/FeatureLayerStatistics" { + import FeatureLayer = require("esri/layers/FeatureLayer"); + + /** This module defines a class and a feature layer plugin that is used to calculate feature layer statistics. */ + class FeatureLayerStatistics { + /** + * Creates a new object that is used to calculate statistics about features in a feature layer. + * @param params Parameters that define the FeatureLayerStatistics. + */ + constructor(params: any); + /** + * This function is called internally when the plugin is added to a feature layer. + * @param layer The target FeatureLayer that have the plugin added. + * @param options Additional options that will be passed into the FeatureLayerStatistics constructor when it is added as a plugin to the target FeatureLayer. + */ + add(layer: FeatureLayer, options?: any): void; + /** + * Calculate class breaks for data stored in the given field. + * @param params See the Object Specifications table below for the structure of the params object. + */ + getClassBreaks(params: any): any; + /** + * Calculate basic statistics for data stored in the given field. + * @param params See the Object Specifications table below for the structure of the params object. + */ + getFieldStatistics(params: any): any; + /** + * Calculate heatmap statistics. + * @param options See the Object Specifications table below for the structure of the options object. + */ + getHeatmapStatistics(options?: any): any; + /** + * Calculate histogram for data stored in the given field. + * @param params See the Object Specifications table below for the structure of the params object. + */ + getHistogram(params: any): any; + /** + * Get a random sampling of features in this layer. + * @param options See the Object Specifications table below for the structure of the options object. + */ + getSampleFeatures(options?: any): any; + /** + * Find optimal scale range for viewing this layer. + * @param options See the Object Specifications table below for the structure of the options object. + */ + getSuggestedScaleRange(options?: any): any; + /** + * Find unique values available for the given field. + * @param params See the Object Specifications table below for the structure of the params object. + */ + getUniqueValues(params: any): any; + /** + * This function is called internally when the plugin is removed from a feature layer. + * @param layer The target FeatureLayer that will have the plugin removed. + */ + remove(layer: FeatureLayer): void; + } + export = FeatureLayerStatistics; +} + +declare module "esri/plugins/spatialIndex" { + import Map = require("esri/map"); + import FeatureLayer = require("esri/layers/FeatureLayer"); + + /** A static utility module that adds or removes a SpatialIndex instance on a Map or FeatureLayer. */ + var spatialIndex: { + /** + * Adds an index property to the target instance. + * @param target The map or feature layer to which the index is connected. + * @param options See the object specifications table below for the structure of the index options object. + */ + add(target: Map, options?: any): void; + /** + * Adds an index property to the target instance. + * @param target The map or feature layer to which the index is connected. + * @param options See the object specifications table below for the structure of the index options object. + */ + add(target: FeatureLayer, options?: any): void; + /** Removes the index plugin. */ + remove(): void; + }; + export = spatialIndex; +} + +declare module "esri/process/Processor" { + import esri = require("esri"); + import FeatureLayer = require("esri/layers/FeatureLayer"); + import Map = require("esri/map"); + + /** The base processor class provides the generic api for processors and provides an extension point from which developers can create and extend additional processors. */ + class Processor { + /** Allow the feature layer to draw the features. */ + drawFeatures: boolean; + /** Should features be fetched through the Worker. */ + fetchWithWorker: boolean; + /** Layer(s) connected to the processor. */ + layers: FeatureLayer[]; + /** Pass features back to layer without delay before processing. */ + passFeatures: boolean; + /** Require support for Worker in order to use this processor. */ + requireWorkerSupport: boolean; + /** + * Creates a processor. + * @param options Configuration options for the processor. + */ + constructor(options?: esri.ProcessorOptions); + /** + * Add layer to processor. + * @param layer FeatureLayer to be added. + */ + addLayer(layer: FeatureLayer): void; + /** + * Remove layer from processor. + * @param layer FeatureLayer to be removed. + */ + removeLayer(layer: FeatureLayer): void; + /** + * Synchronize the layers the processor handles with the map's GraphicsLayer and GraphicsLayer subclasses (FeatureLayer etc). + * @param map The map instance to synchronize layers with. + */ + setMap(map: Map): void; + /** Start the processor. */ + start(): void; + /** Stop the processor. */ + stop(): void; + /** Unset the map and detach processor from all layers. */ + unsetMap(): void; + /** Fires when the processor is started. */ + on(type: "start", listener: (event: { target: Processor }) => void): esri.Handle; + /** Fires when the processor is stopped. */ + on(type: "stop", listener: (event: { target: Processor }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = Processor; +} + +declare module "esri/process/SpatialIndex" { + import esri = require("esri"); + import Processor = require("esri/process/Processor"); + import Point = require("esri/geometry/Point"); + import Graphic = require("esri/graphic"); + import Extent = require("esri/geometry/Extent"); + + /** Builds and maintains a spatial index of feature geometry in one or more FeatureLayer. */ + class SpatialIndex extends Processor { + /** + * Creates a SpatialIndex. + * @param options Configuration options for the processor. + */ + constructor(options?: esri.SpatialIndexOptions); + /** + * Searches index for items which intersect the test object. + * @param test The point or area to intersect. + * @param layerId ID assigned to the layer. + * @param getRects Whether to get the rectangle object with data in leaf, otherwise just get the stored data. + */ + intersects(test: Point, layerId?: string, getRects?: boolean): any; + /** + * Searches index for items which intersect the test object. + * @param test The point or area to intersect. + * @param layerId ID assigned to the layer. + * @param getRects Whether to get the rectangle object with data in leaf, otherwise just get the stored data. + */ + intersects(test: Graphic, layerId?: string, getRects?: boolean): any; + /** + * Searches index for items which intersect the test object. + * @param test The point or area to intersect. + * @param layerId ID assigned to the layer. + * @param getRects Whether to get the rectangle object with data in leaf, otherwise just get the stored data. + */ + intersects(test: Extent, layerId?: string, getRects?: boolean): any; + /** + * Searches index for items which intersect the test object. + * @param test The point or area to intersect. + * @param layerId ID assigned to the layer. + * @param getRects Whether to get the rectangle object with data in leaf, otherwise just get the stored data. + */ + intersects(test: number[], layerId?: string, getRects?: boolean): any; + /** + * Searches for the nearest point(s) to the passed point within the specified criteria. + * @param criteria See the object specifications table below for the structure of the criteria object. + * @param layerId ID assigned to the layer. + */ + nearest(criteria: any, layerId?: string): any; + } + export = SpatialIndex; +} + +declare module "esri/renderers/ClassBreaksRenderer" { + import Renderer = require("esri/renderers/Renderer"); + import FillSymbol = require("esri/symbols/FillSymbol"); + import Symbol = require("esri/symbols/Symbol"); + import Graphic = require("esri/graphic"); + + /** A class breaks renderer symbolizes each graphic based on the value of some numeric attribute. */ + class ClassBreaksRenderer extends Renderer { + /** Attribute field renderer uses to match values. */ + attributeField: string; + /** To symbolize polygon features with graduated symbols, use backgroundFillSymbol to specify a simple fill symbol to represent polygon features, and use marker symbols of varying sizes in class breaks to indicate the quantity. */ + backgroundFillSymbol: FillSymbol; + /** Deprecated at v2.0, use infos instead. */ + breaks: any[]; + /** The classification method used to generate class breaks. */ + classificationMethod: string; + /** Default symbol used when a value or break cannot be matched. */ + defaultSymbol: Symbol; + /** Each element in the array is an object that provides information about the class breaks associated with the renderer. */ + infos: any[]; + /** Include graphics with attribute values equal to the max value of a class in that class. */ + isMaxInclusive: boolean; + /** When normalizationType is "field", this property contains the attribute field name used for normalization. */ + normalizationField: string; + /** When normalizationType is "percent-of-total", this property contains the total of all data values. */ + normalizationTotal: number; + /** Indicates how the data is normalized. */ + normalizationType: string; + /** + * Creates a new ClassBreaksRenderer object. + * @param defaultSymbol Default symbol for the renderer. + * @param attributeField Specify either the attribute field the renderer uses to match values or starting at version 3.3, a function that returns a value to be compared against class breaks. + */ + constructor(defaultSymbol: Symbol, attributeField: string); + /** + * Creates a new ClassBreaksRenderer object. + * @param defaultSymbol Default symbol for the renderer. + * @param attributeField Specify either the attribute field the renderer uses to match values or starting at version 3.3, a function that returns a value to be compared against class breaks. + */ + constructor(defaultSymbol: Symbol, attributeField: Function); + /** + * Creates a new ClassBreaksRenderer. + * @param json JSON object representing the ClassBreaksRenderer. + */ + constructor(json: Object); + /** + * Adds a class break. + * @param minValueOrInfo The value can be provided as individual arguments or as an info object. + * @param maxValue Maximum value in the break. + * @param symbol Symbol used for the break. + */ + addBreak(minValueOrInfo: number, maxValue?: number, symbol?: Symbol): void; + /** + * Adds a class break. + * @param minValueOrInfo The value can be provided as individual arguments or as an info object. + * @param maxValue Maximum value in the break. + * @param symbol Symbol used for the break. + */ + addBreak(minValueOrInfo: any, maxValue?: number, symbol?: Symbol): void; + /** Remove all existing class breaks for this renderer. */ + clearBreaks(): void; + /** + * Returns the index at which rendering and legend information can be found in the break infos array for the given graphic. + * @param graphic The graphic whose rendering and legend information index in the break infos array will be returned. + */ + getBreakIndex(graphic: Graphic): number; + /** + * Returns rendering and legend information (as defined by the renderer) associated with the given graphic. + * @param graphic The graphic whose rendering and legend information will be returned. + */ + getBreakInfo(graphic: Graphic): any; + /** + * Removes a break. + * @param minValue Minimum value in the break to remove. + * @param maxValue Maximum value in the break to remove. + */ + removeBreak(minValue: number, maxValue: number): void; + /** + * A graphic or feature is considered a match for a class break for the first break where the graphic's attribute value is greater than or equal to the class's min value and less than or equal to the class's max value. + * @param enable Set true to enable the max inclusive behavior. + */ + setMaxInclusive(enable: boolean): void; + } + export = ClassBreaksRenderer; +} + +declare module "esri/renderers/DotDensityRenderer" { + import esri = require("esri"); + import Renderer = require("esri/renderers/Renderer"); + import Color = require("esri/Color"); + import LineSymbol = require("esri/symbols/LineSymbol"); + + /** The DotDensityRenderer provides the ability to create dot density visualizations on data. */ + class DotDensityRenderer extends Renderer { + /** The color to be used for the background of the symbol. */ + backgroundColor: Color; + /** The shape to be used for the dot. */ + dotShape: string; + /** The size of the dot in pixels. */ + dotSize: number; + /** The value that a dot represents. */ + dotValue: number; + /** An array of objects, where each object defines a field to be mapped and its color. */ + fields: any[]; + /** The line symbol to use on the outline of the feature. */ + outline: LineSymbol; + /** + * Creates a new instance of dot density renderer. + * @param params An object with various options. + */ + constructor(params: esri.DotDensityRendererOptions); + /** + * Updates the background color of the shape. + * @param color Background color. + */ + setBackgroundColor(color: Color): void; + /** + * Updates the size of the dot. + * @param size The size of the dot in pixels. + */ + setDotSize(size: number): void; + /** + * Updates the value that a dot represents. + * @param value The value that a dot represents. + */ + setDotValue(value: number): void; + /** + * Updates the outline symbol of the shape. + * @param outline The line symbol to use on the outline of the feature. + */ + setOutline(outline: LineSymbol): void; + } + export = DotDensityRenderer; +} + +declare module "esri/renderers/HeatmapRenderer" { + import esri = require("esri"); + import Renderer = require("esri/renderers/Renderer"); + + /** The HeatmapRenderer renders point data into a raster visualization that emphasizes areas of higher density or weighted values. */ + class HeatmapRenderer extends Renderer { + /** The radius (in pixels) of the circle over which the majority of each points value is spread out over. */ + blurRadius: number; + /** An array of CSS color strings (#RGB, #RRGGBB, rgb(r,g,b), rgba(r,g,b,a)). */ + colors: string[]; + /** An array of colorStop objects describing the renderer's color ramp with more specificity than just colors. */ + colorStops: any[]; + /** The name of the attribute field used to weight the heatmap points. */ + field: string; + /** The pixel intensity value which is assigned the final color in the color ramp. */ + maxPixelIntensity: number; + /** The pixel intensity value which is assigned the initial color in the color ramp. */ + minPixelIntensity: number; + /** + * Creates a new HeatmapRenderer object from json. + * @param options A parameterized list of options for constructing a HeatmapRenderer. + */ + constructor(options: esri.HeatmapRendererOptions); + /** + * Set the renderer's blur radius. + * @param blurRadius The radius (in pixels) of the circle over which the majority of each points value is spread out over. + */ + setBlurRadius(blurRadius: number): void; + /** + * Set the colors used to interpolate the color ramp of the renderer. + * @param colors An array of CSS color strings (#RGB, #RRGGBB, rgb(r,g,b), rgba(r,g,b,a)). + */ + setColors(colors: string[]): void; + /** + * Sets the colorStops property and returns the HeatmapRenderer instance to allow method chaining. + * @param stops An array of colorStop objects describing the renderer's color ramp with more specificity than just colors. + */ + setColorStops(stops: any[]): HeatmapRenderer; + /** + * Set the attribute field that the renderer uses to determine the weight on the heatmap points. + * @param field The name of the attribute field used to weight the heatmap points. + */ + setField(field: string): void; + /** + * Set the renderer's maxPixelIntensity. + * @param maxPixelIntensity The pixel intensity value which is assigned the final color in the color ramp. + */ + setMaxPixelIntensity(maxPixelIntensity: number): void; + /** + * Set the renderer's minPixelIntensity. + * @param minPixelIntensity The pixel intensity value which is assigned the initial color in the color ramp. + */ + setMinPixelIntensity(minPixelIntensity: number): void; + /** Returns the JSON string representation of the renderer's options. */ + toJson(): string; + } + export = HeatmapRenderer; +} + +declare module "esri/renderers/Renderer" { + import Graphic = require("esri/graphic"); + import Color = require("esri/Color"); + import Symbol = require("esri/symbols/Symbol"); + + /** The base class for the renderers - SimpleRenderer, ClassBreaksRenderer, UniqueValueRenderer, DotDensityRenderer, ScaleDependentRenderer, and TemporalRenderer used with a GraphicsLayer and FeatureLayer. */ + class Renderer { + /** An object defining a color ramp used to render the layer. */ + colorInfo: any; + /** An object that describes how opacity of features is calculated. */ + opacityInfo: any; + /** Defines how marker symbols are rotated. */ + rotationInfo: any; + /** Defines the size of the symbol where feature size is proportional to data value. */ + sizeInfo: any; + /** + * Gets the color for the Graphic. + * @param graphic Graphic to get color from. + */ + getColor(graphic: Graphic): Color; + /** + * Returns the opacity value for the specified graphic. + * @param graphic Returns the opacity value appropriate for the given graphic. + */ + getOpacity(graphic: Graphic): number; + /** + * Returns the angle of rotation (in degrees) for the graphic calculated using rotationInfo. + * @param graphic An input graphic for which you want to get the angle of rotation. + */ + getRotationAngle(graphic: Graphic): number; + /** + * Return the symbol size (in pixels) for the graphic, calculated using sizeInfo. + * @param graphic The graphic for which you want to calculate the symbol size. + */ + getSize(graphic: Graphic): number; + /** + * Gets the symbol for the Graphic. + * @param graphic Graphic to symbolize. + */ + getSymbol(graphic: Graphic): Symbol; + /** + * Sets the colorInfo property. + * @param info An info object that defines the color. + */ + setColorInfo(info: any): Renderer; + /** + * Sets opacity info for the renderer as defined by the info parameter. + * @param info The info parameter is an object with the same properties as opacityInfo. + */ + setOpacityInfo(info: any): Renderer; + /** + * Modifies rotation info for the renderer. + * @param info An object with the same properties as rotationInfo. + */ + setRotationInfo(info: any): Renderer; + /** Set size info of the renderer to modify the symbol size based on data value. */ + setSizeInfo(): Renderer; + /** Converts object to its ArcGIS Server JSON representation. */ + toJson(): any; + } + export = Renderer; +} + +declare module "esri/renderers/ScaleDependentRenderer" { + import esri = require("esri"); + import Renderer = require("esri/renderers/Renderer"); + import Graphic = require("esri/graphic"); + + /** ScaleDependentRenderer provides the capability to apply multiple scale-dependent renderers to a layer. */ + class ScaleDependentRenderer extends Renderer { + /** Indicates whether rendererInfos uses zoom range or scale range. */ + rangeType: string; + /** An array of objects, where each object defines a renderer and the zoom/scale range to which it applies. */ + rendererInfos: any; + /** + * Create a ScaleDependentRenderer. + * @param options Various options to configure this renderer. + */ + constructor(options?: esri.ScaleDependentRendererOptions); + /** + * Adds the specified renderer info to the array of existing renderers. + * @param info An object as defined in the rendererInfos property. + */ + addRendererInfo(info: any): ScaleDependentRenderer; + /** + * Returns the renderer info for the input graphic. + * @param graphic The graphic for which you want to get renderer info. + */ + getRendererInfo(graphic: Graphic): any; + /** + * Returns the renderer info for the specified scale. + * @param scale Returns the renderer info for the specified scale. + */ + getRendererInfoByScale(scale: number): any; + /** + * Returns the rendererInfo for the specified zoom level. + * @param zoom Specify the zoom level for which you want to retrieve the renderer info. + */ + getRenderInfoByZoom(zoom: number): any; + /** + * Replaces existing rendererInfos with new ones. + * @param infos An array of objects as defined in the rendererInfos property. + */ + setRendererInfos(infos: any): ScaleDependentRenderer; + } + export = ScaleDependentRenderer; +} + +declare module "esri/renderers/SimpleRenderer" { + import Renderer = require("esri/renderers/Renderer"); + import Symbol = require("esri/symbols/Symbol"); + + /** A renderer that uses one symbol only. */ + class SimpleRenderer extends Renderer { + /** Description for the renderer. */ + description: string; + /** Label for the renderer. */ + label: string; + /** The symbol for the renderer. */ + symbol: Symbol; + /** + * Creates a new SimpleRenderer object with a Symbol parameter. + * @param symbol Symbol to use for the renderer. + */ + constructor(symbol: Symbol); + /** + * Creates a new Simple Renderer. + * @param json JSON object representing the SimpleRenderer. + */ + constructor(json: Object); + } + export = SimpleRenderer; +} + +declare module "esri/renderers/SymbolAger" { + import Symbol = require("esri/symbols/Symbol"); + import Graphic = require("esri/graphic"); + + /** Base class for agers. */ + class SymbolAger { + /** + * All subclasses override this method to provide their own implementation to calculate aging and return the appropriate symbol. + * @param symbol The symbol to age. + * @param graphic Feature being rendered. + */ + getAgedSymbol(symbol: Symbol, graphic: Graphic): Symbol; + } + export = SymbolAger; +} + +declare module "esri/renderers/TemporalRenderer" { + import Renderer = require("esri/renderers/Renderer"); + import SymbolAger = require("esri/renderers/SymbolAger"); + import Graphic = require("esri/graphic"); + import Symbol = require("esri/symbols/Symbol"); + + /** Temporal renderers provide time-based rendering of features in a feature layer. */ + class TemporalRenderer extends Renderer { + /** + * Creates a new TemporalRenderer object that can be used with a time-aware feature layer. + * @param observationRenderer Renderer for regular/historic observations. + * @param latestObservationRenderer Renderer for the most current observations.In the snippet below RouteID is the field that contains the trackID for the feature layer this is used to display the latest observation for the specified tracks. + * @param trackRenderer Renderer for the tracks. + * @param observationAger Symbol ager for regular observations. + */ + constructor(observationRenderer: Renderer, latestObservationRenderer?: Renderer, trackRenderer?: Renderer, observationAger?: SymbolAger); + /** + * Returns the symbol used to render the graphic. + * @param graphic The input graphic. + */ + getSymbol(graphic: Graphic): Symbol; + } + export = TemporalRenderer; +} + +declare module "esri/renderers/TimeClassBreaksAger" { + import SymbolAger = require("esri/renderers/SymbolAger"); + import Symbol = require("esri/symbols/Symbol"); + import Graphic = require("esri/graphic"); + + /** Time class breaks ager displays aging by classifying features based on an age range. */ + class TimeClassBreaksAger extends SymbolAger { + /** Time breaks are measured in days. */ + static UNIT_DAYS: any; + /** Time breaks are measured in hours. */ + static UNIT_HOURS: any; + /** Time breaks are measured in milliseconds. */ + static UNIT_MILLISECONDS: any; + /** Time breaks are measured in minutes. */ + static UNIT_MINUTES: any; + /** Time breaks are measured in months. */ + static UNIT_MONTHS: any; + /** Time breaks are measured in seconds. */ + static UNIT_SECONDS: any; + /** Time breaks are measured in weeks. */ + static UNIT_WEEKS: any; + /** Time breaks are measured in years. */ + static UNIT_YEARS: any; + /** + * Creates a new TimeClassBreaksAgerObject with the specified time breaks inforamtion. + * @param infos Each element in the array is an object that describes the class breaks information. + * @param timeUnits The unit in which the minimum and maximum break values are measured. + */ + constructor(infos: any[], timeUnits?: string); + /** + * Calculates aging and returns the appropriate symbol. + * @param symbol The symbol to age. + * @param graphic Feature being rendered. + */ + getAgedSymbol(symbol: Symbol, graphic: Graphic): Symbol; + } + export = TimeClassBreaksAger; +} + +declare module "esri/renderers/TimeRampAger" { + import SymbolAger = require("esri/renderers/SymbolAger"); + import Color = require("esri/Color"); + import Symbol = require("esri/symbols/Symbol"); + import Graphic = require("esri/graphic"); + + /** Time ramp agers display aging using a gradual change in symbology. */ + class TimeRampAger extends SymbolAger { + /** + * Creates a new TimeRampAger object with the specified color and size ranges. + * @param colorRange An array containing the minimum and maximum color values. + * @param sizeRange An array containing the minimum and maximum size in pixels. + * @param alphaRange An array containing the minimum and maximum alpha opacity values. + */ + constructor(colorRange?: Color[], sizeRange?: number[], alphaRange?: number[]); + /** + * Calculates aging and returns the appropriate symbol. + * @param symbol The symbol to age. + * @param graphic Feature being rendered. + */ + getAgedSymbol(symbol: Symbol, graphic: Graphic): Symbol; + } + export = TimeRampAger; +} + +declare module "esri/renderers/UniqueValueRenderer" { + import Renderer = require("esri/renderers/Renderer"); + import Symbol = require("esri/symbols/Symbol"); + import Graphic = require("esri/graphic"); + + /** A unique value renderer symbolizes groups of graphics that have matching attributes. */ + class UniqueValueRenderer extends Renderer { + /** Attribute field renderer uses to match values. */ + attributeField: string; + /** If needed, specify an additional attribute field the renderer uses to match values. */ + attributeField2: string; + /** If needed, specify an additional attribute field the renderer uses to match values. */ + attributeField3: string; + /** Label for the default symbol used to draw unspecified values. */ + defaultLabel: string; + /** Default symbol used when a value or break cannot be matched. */ + defaultSymbol: Symbol; + /** String inserted between the values if multiple attribute fields are specified. */ + fieldDelimiter: string; + /** Each element in the array is an object that provides information about the unique values associated with the renderer. */ + infos: any[]; + /** Deprecated at v2.0, use infos instead. */ + values: string[]; + /** + * Creates a new UniqueValueRenderer object. + * @param defaultSymbol Default symbol for the renderer. + * @param attributeField Specify either the attribute field the renderer uses to match values or starting at version 3.3, a function that returns a value to be compared against unique values. + * @param attributeField2 If needed, specify an additional attribute field the renderer uses to match values. + * @param attributeField3 If needed, specify an additional attribute field the renderer uses to match values. + * @param fieldDelimeter String inserted between the values of different fields. + */ + constructor(defaultSymbol: Symbol, attributeField: string, attributeField2?: string, attributeField3?: string, fieldDelimeter?: string); + /** + * Creates a new UniqueValueRenderer object. + * @param defaultSymbol Default symbol for the renderer. + * @param attributeField Specify either the attribute field the renderer uses to match values or starting at version 3.3, a function that returns a value to be compared against unique values. + * @param attributeField2 If needed, specify an additional attribute field the renderer uses to match values. + * @param attributeField3 If needed, specify an additional attribute field the renderer uses to match values. + * @param fieldDelimeter String inserted between the values of different fields. + */ + constructor(defaultSymbol: Symbol, attributeField: Function, attributeField2?: string, attributeField3?: string, fieldDelimeter?: string); + /** + * Creates a new Unique Value Renderer. + * @param json JSON object representing the UniqueValueRenderer. + */ + constructor(json: Object); + /** + * Adds a unique value and symbol. + * @param valueOrInfo Value to match with. + * @param symbol Symbol used for the value. + */ + addValue(valueOrInfo: string, symbol?: Symbol): void; + /** + * Adds a unique value and symbol. + * @param valueOrInfo Value to match with. + * @param symbol Symbol used for the value. + */ + addValue(valueOrInfo: any, symbol?: Symbol): void; + /** + * Returns rendering and legend information (as defined by the renderer) associated with the given graphic. + * @param graphic The graphic whose rendering and legend information will be returned. + */ + getUniqueValueInfo(graphic: Graphic): any; + /** + * Removes a unique value. + * @param value Value to remove. + */ + removeValue(value: string): void; + } + export = UniqueValueRenderer; +} + +declare module "esri/renderers/VectorFieldRenderer" { + import esri = require("esri"); + import Renderer = require("esri/renderers/Renderer"); + + /** The VectorFieldRenderer function symbolizes a U-V or Magnitude-Direction data. */ + class VectorFieldRenderer extends Renderer { + /** Flow from angle */ + static FLOW_FROM: any; + /** Flow to angle */ + static FLOW_TO: any; + /** Beaufort point symbol (feet) */ + static STYLE_BEAUFORT_FEET: any; + /** Beaufort point symbol (kilometers) */ + static STYLE_BEAUFORT_KM: any; + /** Beaufort point symbol (knots) */ + static STYLE_BEAUFORT_KN: any; + /** Beaufort point symbol (meters) */ + static STYLE_BEAUFORT_METER: any; + /** Beaufort point symbol (miles) */ + static STYLE_BEAUFORT_MILE: any; + /** Classified arrow point symbol */ + static STYLE_CLASSIFIED_ARROW: any; + /** Ocean current point symbol (knots) */ + static STYLE_OCEAN_CURRENT_KN: any; + /** Ocean current point symbol (meters) */ + static STYLE_OCEAN_CURRENT_M: any; + /** Simple scalar point symbol */ + static STYLE_SCALAR: any; + /** Single arrow point symbol */ + static STYLE_SINGLE_ARROW: any; + /** Barb wind speed point symbol */ + static STYLE_WIND_BARBS: any; + /** + * Creates a new VectorFieldRenderer object. + * @param options Optional parameters. + */ + constructor(options?: esri.VectorFieldRendererOptions); + } + export = VectorFieldRenderer; +} + +declare module "esri/renderers/jsonUtils" { + import Renderer = require("esri/renderers/Renderer"); + + /** Utility method to create a renderer from JSON. */ + var jsonUtils: { + /** + * Converts the input JSON object to the appropriate esri.renderer.* object. + * @param json The JSON object. + */ + fromJson(json: Object): Renderer; + }; + export = jsonUtils; +} + +declare module "esri/renderers/smartMapping" { + /** This module contains a collection of helper functions used to create pre-configured renderers for smart feature styling. */ + var smartMapping: { + /** + * Creates a renderer for visualizing features using colors. + * @param params See the object specifications table below for the structure of the params object. + */ + createClassedColorRenderer(params: any): any; + /** + * Creates a renderer for visualizing features by varying their size. + * @param params See the object specifications table below for the structure of the params object. + */ + createClassedSizeRenderer(params: any): any; + /** + * Creates a renderer for visualizing features using colors. + * @param params See the object specifications table below for the structure of the params object. + */ + createColorRenderer(params: any): any; + /** + * Creates a renderer for visualizing features using heatmap. + * @param params See the object specifications table below for the structure of the params object. + */ + createHeatmapRenderer(params: any): any; + /** + * Creates a renderer for visualizing features by varying their size based on data. + * @param params See the object specifications table below for the structure of the params object. + */ + createSizeRenderer(params: any): any; + /** + * Creates a renderer for visualizing features by their type. + * @param params See the object specifications table below for the structure of the params object. + */ + createTypeRenderer(params: any): any; + }; + export = smartMapping; +} + +declare module "esri/request" { + /** Retrieve data from a remote server or upload a file. */ + var request: { + /** + * Retrieve data from a remote server or upload a file from a user's computer. + * @param request The request parameter is an object with the following properties that describe the request. + * @param options See the object specifications table below for the structure of the options object. + */ + (request: any, options?: any): any; + /** + * Define a callback function that will be called just before esri.request calls into dojo IO functions such as dojo.rawXhrPost and dojo.io.script.get. + * @param callbackFunction The callback function that will be executed prior to esri.request calls into dojo IO functions. + */ + setRequestPreCallback(callbackFunction: Function): void; + }; + export = request; +} + +declare module "esri/symbols/CartographicLineSymbol" { + import SimpleLineSymbol = require("esri/symbols/SimpleLineSymbol"); + import Color = require("esri/Color"); + + /** Line symbols are used to draw linear features on the graphics layer. */ + class CartographicLineSymbol extends SimpleLineSymbol { + /** Line ends square at the end point. */ + static CAP_BUTT: any; + /** Line is rounded just beyond the end point. */ + static CAP_ROUND: any; + /** Line is squared just beyond the end point. */ + static CAP_SQUARE: any; + /** The joined lines are beveled. */ + static JOIN_BEVEL: any; + /** The joined lines are not rounded or beveled. */ + static JOIN_MITER: any; + /** The joined lines are rounded. */ + static JOIN_ROUND: any; + /** The line is made of dashes. */ + static STYLE_DASH: any; + /** The line is made of a dash-dot pattern. */ + static STYLE_DASHDOT: any; + /** The line is made of a dash-dot-dot pattern. */ + static STYLE_DASHDOTDOT: any; + /** The line is made of dots. */ + static STYLE_DOT: any; + /** The line is made of a long dash pattern. */ + static STYLE_LONGDASH: any; + /** The line is made of a long dash-dot pattern. */ + static STYLE_LONGDASHDOT: any; + /** The line has no symbol. */ + static STYLE_NULL: any; + /** The line is made of a short dash pattern. */ + static STYLE_SHORTDASH: any; + /** The line is made of a short dash-dot pattern. */ + static STYLE_SHORTDASHDOT: any; + /** The line is made of a short dash-dot-dot pattern. */ + static STYLE_SHORTDASHDOTDOT: any; + /** The line is made of a short dot pattern. */ + static STYLE_SHORTDOT: any; + /** The line is solid. */ + static STYLE_SOLID: any; + /** The cap style. */ + cap: string; + /** The join style. */ + join: string; + /** Size threshold for showing mitered line joins. */ + miterLimit: string; + /** Creates a new empty CartographicLineSymbol object. */ + constructor(); + /** + * Creates a new CartographicLineSymbol object with parameters. + * @param style See Constants table for values. + * @param color Symbol color. + * @param width Width of the line in pixels. + * @param cap See Constants table for values. + * @param join See Constants table for values. + * @param miterLimit Size threshold for showing mitered line joins. + */ + constructor(style?: string, color?: Color, width?: number, cap?: string, join?: string, miterLimit?: string); + /** + * Creates a new CartographicLineSymbol object using a JSON object. + * @param json JSON object representing the CartographicLineSymbol. + */ + constructor(json: Object); + /** + * Sets the cap style. + * @param cap Cap style. + */ + setCap(cap: string): CartographicLineSymbol; + /** + * Sets the join style. + * @param join Join style. + */ + setJoin(join: string): CartographicLineSymbol; + /** + * Sets the size threshold for showing mitered line joins. + * @param miterLimit Miter limit. + */ + setMiterLimit(miterLimit: string): CartographicLineSymbol; + } + export = CartographicLineSymbol; +} + +declare module "esri/symbols/FillSymbol" { + import Symbol = require("esri/symbols/Symbol"); + import SimpleLineSymbol = require("esri/symbols/SimpleLineSymbol"); + + /** Fill symbols are used to draw polygon features on the graphics layer. */ + class FillSymbol extends Symbol { + /** Outline of the polygon. */ + outline: SimpleLineSymbol; + /** + * Sets the outline of the fill symbol. + * @param outline Symbol used for outline. + */ + setOutline(outline: SimpleLineSymbol): FillSymbol; + } + export = FillSymbol; +} + +declare module "esri/symbols/Font" { + /** Font used for text symbols added to the graphics layer. */ + class Font { + /** Text is in italics. */ + static STYLE_ITALIC: any; + /** Text style is normal. */ + static STYLE_NORMAL: any; + /** Text is slanted. */ + static STYLE_OBLIQUE: any; + /** Text variant is normal. */ + static VARIANT_NORMAL: any; + /** Text is in all small caps. */ + static VARIANT_SMALLCAPS: any; + /** Text weight is bold. */ + static WEIGHT_BOLD: any; + /** Text weight is extra bold. */ + static WEIGHT_BOLDER: any; + /** Text weight is lighter than normal. */ + static WEIGHT_LIGHTER: any; + /** Text weight is normal. */ + static WEIGHT_NORMAL: any; + /** Text decoration. */ + decoration: string; + /** Font family. */ + family: string; + /** Font size. */ + size: number; + /** Text style. */ + style: string; + /** Text variant. */ + variant: string; + /** Text weight. */ + weight: string; + /** Creates a new Font object. */ + constructor(); + /** + * Creates a new Font object. + * @param size Font size. + * @param style Font style. + * @param variant Font variant. + * @param weight Font weight. + * @param family Font family. + */ + constructor(size?: number, style?: string, variant?: string, weight?: string, family?: string); + /** + * Creates a new Font object. + * @param size Font size. + * @param style Font style. + * @param variant Font variant. + * @param weight Font weight. + * @param family Font family. + */ + constructor(size?: string, style?: string, variant?: string, weight?: string, family?: string); + /** + * Creates a new Font object using a JSON object. + * @param json JSON object representing the font. + */ + constructor(json: Object); + /** + * Updates the font with the given decoration. + * @param decoration Text decoration. + */ + setDecoration(decoration: string): Font; + /** + * Sets the font family. + * @param family Font family. + */ + setFamily(family: string): Font; + /** + * Sets the font size. + * @param size Font size. + */ + setSize(size: number): Font; + /** + * Sets the font size. + * @param size Font size. + */ + setSize(size: string): Font; + /** + * Sets the font style. + * @param style Font style. + */ + setStyle(style: string): Font; + /** + * Sets the font variant. + * @param variant Font variant. + */ + setVariant(variant: string): Font; + /** + * Sets the font weight. + * @param weight Font weight. + */ + setWeight(weight: string): Font; + } + export = Font; +} + +declare module "esri/symbols/LineSymbol" { + import Symbol = require("esri/symbols/Symbol"); + + /** Line symbols are used to draw linear features on the graphics layer. */ + class LineSymbol extends Symbol { + /** Width of line symbol in pixels. */ + width: number; + /** + * Sets the LineSymbol width. + * @param width Width of line symbol in pixels. + */ + setWidth(width: number): LineSymbol; + } + export = LineSymbol; +} + +declare module "esri/symbols/MarkerSymbol" { + import Symbol = require("esri/symbols/Symbol"); + + /** Marker symbols are used to draw points and multipoints on the graphics layer. */ + class MarkerSymbol extends Symbol { + /** The angle of the marker. */ + angle: number; + /** Size of the marker in pixels. */ + size: number; + /** The offset on the x-axis in pixels. */ + xoffset: number; + /** The offset on the y-axis in pixels. */ + yoffset: number; + /** + * Rotates the symbol clockwise around its center by the specified angle. + * @param angle The angle value. + */ + setAngle(angle: number): MarkerSymbol; + /** + * Sets the x and y offset of a marker in screen units. + * @param x The X offset value in pixels. + * @param y The Y offset value in pixels. + */ + setOffset(x: number, y: number): MarkerSymbol; + /** + * Sets the size of a marker in pixels. + * @param size The width of the symbol in pixels. + */ + setSize(size: number): MarkerSymbol; + /** Converts object to its ArcGIS Server JSON representation. */ + toJson(): any; + } + export = MarkerSymbol; +} + +declare module "esri/symbols/PictureFillSymbol" { + import FillSymbol = require("esri/symbols/FillSymbol"); + import SimpleLineSymbol = require("esri/symbols/SimpleLineSymbol"); + + /** Fill symbols are used to draw polygon features on the graphics layer. */ + class PictureFillSymbol extends FillSymbol { + /** Height of the image in pixels. */ + height: number; + /** URL of the image. */ + url: string; + /** Width of the image in pixels. */ + width: number; + /** The offset on the x-axis in pixels. */ + xoffset: number; + /** Scale factor in x direction. */ + xscale: number; + /** The offset on the y-axis in pixels. */ + yoffset: number; + /** Scale factor in y direction. */ + yscale: number; + /** + * Creates a new PictureFillSymbol object. + * @param url URL of the image. + * @param outline Outline of the symbol. + * @param width Width of the image in pixels. + * @param height Height of the image in pixels. + */ + constructor(url: string, outline: SimpleLineSymbol, width: number, height: number); + /** + * Creates a new PictureFillSymbol object using a JSON object. + * @param json JSON object representing the PictureFillSymbol. + */ + constructor(json: Object); + /** + * Sets the height of the symbol. + * @param height Height in pixels. + */ + setHeight(height: number): PictureFillSymbol; + /** + * Sets the symbol offset. + * @param x Offset in x direction in pixels. + * @param y Offset in y direction in pixels. + */ + setOffset(x: number, y: number): PictureFillSymbol; + /** + * Sets the URL to the location of the symbol. + * @param url URL string. + */ + setUrl(url: string): PictureFillSymbol; + /** + * Sets the width of the symbol. + * @param width Width in pixels. + */ + setWidth(width: number): PictureFillSymbol; + /** + * Sets the scale factor in x direction. + * @param scale Scale factor in x direction. + */ + setXScale(scale: number): PictureFillSymbol; + /** + * Sets the scale factor in y direction. + * @param scale Scale factor in y direction. + */ + setYScale(scale: number): PictureFillSymbol; + } + export = PictureFillSymbol; +} + +declare module "esri/symbols/PictureMarkerSymbol" { + import MarkerSymbol = require("esri/symbols/MarkerSymbol"); + + /** Marker symbols are used to draw points and multipoints on the graphics layer. */ + class PictureMarkerSymbol extends MarkerSymbol { + /** Height of the image in pixels. */ + height: number; + /** URL of the image. */ + url: string; + /** Width of the image in pixels. */ + width: number; + /** + * Creates a new PictureMarkerSymbol object. + * @param url URL of the image. + * @param width Width of the image in pixels. + * @param height Height of the image in pixels. + */ + constructor(url: string, width: number, height: number); + /** + * Creates a new PictureMarkerSymbol object using a JSON object. + * @param json JSON object representing the PictureMarkerSymbol. + */ + constructor(json: Object); + /** + * Sets the height of the image for display. + * @param height Height of marker in pixels. + */ + setHeight(height: number): PictureMarkerSymbol; + /** + * Sets the URL where the image is located. + * @param url URL location of marker image. + */ + setUrl(url: string): PictureMarkerSymbol; + /** + * Sets the width of the image for display. + * @param width Width of marker in pixels. + */ + setWidth(width: number): PictureMarkerSymbol; + } + export = PictureMarkerSymbol; +} + +declare module "esri/symbols/SimpleFillSymbol" { + import FillSymbol = require("esri/symbols/FillSymbol"); + import SimpleLineSymbol = require("esri/symbols/SimpleLineSymbol"); + import Color = require("esri/Color"); + + /** Fill symbols are used to draw polygon features on the graphics layer. */ + class SimpleFillSymbol extends FillSymbol { + /** The fill is backward diagonal lines. */ + static STYLE_BACKWARD_DIAGONAL: any; + /** The fill is a cross. */ + static STYLE_CROSS: any; + /** The fill is a diagonal cross. */ + static STYLE_DIAGONAL_CROSS: any; + /** The fill is forward diagonal lines. */ + static STYLE_FORWARD_DIAGONAL: any; + /** The fill is horizontal lines. */ + static STYLE_HORIZONTAL: any; + /** The polygon has no fill. */ + static STYLE_NULL: any; + /** The fill is solid. */ + static STYLE_SOLID: any; + /** The fill is vertical lines. */ + static STYLE_VERTICAL: any; + /** The fill style. */ + style: string; + /** Creates a new empty SimpleFillSymbol object. */ + constructor(); + /** + * Creates a new SimpleFillSymbol object with parameters. + * @param style See Constants table for values. + * @param outline See SimpleLineSymbol. + * @param color Symbol color. + */ + constructor(style: string, outline: SimpleLineSymbol, color: Color); + /** + * Creates a new SimpleFillSymbol object using a JSON object. + * @param json JSON object representing the SimpleFillSymbol. + */ + constructor(json: Object); + /** + * Sets the fill symbol style. + * @param style Fill style. + */ + setStyle(style: string): SimpleFillSymbol; + } + export = SimpleFillSymbol; +} + +declare module "esri/symbols/SimpleLineSymbol" { + import LineSymbol = require("esri/symbols/LineSymbol"); + import Color = require("esri/Color"); + + /** Line symbols are used to draw linear features on the graphics layer. */ + class SimpleLineSymbol extends LineSymbol { + /** The line is made of dashes. */ + static STYLE_DASH: any; + /** The line is made of a dash-dot pattern. */ + static STYLE_DASHDOT: any; + /** The line is made of a dash-dot-dot pattern. */ + static STYLE_DASHDOTDOT: any; + /** The line is made of dots. */ + static STYLE_DOT: any; + /** Line is constructed of a series of dashes. */ + static STYLE_LONGDASH: any; + /** Line is constructed of a series of short dashes. */ + static STYLE_LONGDASHDOT: any; + /** The line has no symbol. */ + static STYLE_NULL: any; + /** Line is constructed of a series of short dashes. */ + static STYLE_SHORTDASH: any; + /** Line is constructed of a dash followed by a dot. */ + static STYLE_SHORTDASHDOT: any; + /** Line is constructed of a series of a dash and two dots. */ + static STYLE_SHORTDASHDOTDOT: any; + /** Line is constructed of a series of short dots. */ + static STYLE_SHORTDOT: any; + /** The line is solid. */ + static STYLE_SOLID: any; + /** The line style. */ + style: string; + /** Creates a new empty SimpleLineSymbol object. */ + constructor(); + /** + * Creates a new SimpleLineSymbol object with parameters. + * @param style See Constants table for values. + * @param color Symbol color. + * @param width Width of the line in pixels. + */ + constructor(style: string, color: Color, width: number); + /** + * Creates a new SimpleLineSymbol object using a JSON object. + * @param json JSON object representing the SimpleLineSymbol. + */ + constructor(json: Object); + /** + * Sets the line symbol style. + * @param style Line style. + */ + setStyle(style: string): SimpleLineSymbol; + } + export = SimpleLineSymbol; +} + +declare module "esri/symbols/SimpleMarkerSymbol" { + import MarkerSymbol = require("esri/symbols/MarkerSymbol"); + import SimpleLineSymbol = require("esri/symbols/SimpleLineSymbol"); + import Color = require("esri/Color"); + + /** Marker symbols are used to draw points and multipoints on the graphics layer. */ + class SimpleMarkerSymbol extends MarkerSymbol { + /** The marker is a circle. */ + static STYLE_CIRCLE: any; + /** The marker is a cross. */ + static STYLE_CROSS: any; + /** The marker is a diamond. */ + static STYLE_DIAMOND: any; + /** The marker is a shape defined using an SVG Path string. */ + static STYLE_PATH: any; + /** The marker is a square. */ + static STYLE_SQUARE: any; + /** The marker is a diagonal cross. */ + static STYLE_X: any; + /** Outline of the marker. */ + outline: SimpleLineSymbol; + /** Size of the marker in pixels. */ + size: number; + /** The marker style. */ + style: string; + /** Creates a new empty SimpleMarkerSymbol object. */ + constructor(); + /** + * Creates a new SimpleMarkerSymbol object with parameters. + * @param style See Constants table for values. + * @param size Size of the marker in pixels. + * @param outline See SimpleLineSymbol. + * @param color Symbol color. + */ + constructor(style: string, size: number, outline: SimpleLineSymbol, color: Color); + /** + * Creates a new SimpleMarkerSymbol object using a JSON object. + * @param json JSON object representing the SimpleMarkerSymbol. + */ + constructor(json: Object); + /** + * Sets the outline of the marker symbol. + * @param outline Symbol used for outline. + */ + setOutline(outline: SimpleLineSymbol): SimpleMarkerSymbol; + /** + * Sets the marker shape to the given path string and switches the marker style to STYLE_PATH. + * @param path SVG path of the icon. + */ + setPath(path: string): SimpleMarkerSymbol; + /** + * Sets the marker symbol style. + * @param style Marker style. + */ + setStyle(style: string): SimpleMarkerSymbol; + } + export = SimpleMarkerSymbol; +} + +declare module "esri/symbols/Symbol" { + import Color = require("esri/Color"); + + /** Symbols are used to display points, lines, and polygons on the graphics layer. */ + class Symbol { + /** Symbol color. */ + color: Color; + /** The type of symbol. */ + type: string; + /** + * Sets the symbol color. + * @param color Symbol color. + */ + setColor(color: Color): Symbol; + /** Converts object to its ArcGIS Server JSON representation. */ + toJson(): any; + } + export = Symbol; +} + +declare module "esri/symbols/TextSymbol" { + import Symbol = require("esri/symbols/Symbol"); + import Font = require("esri/symbols/Font"); + import Color = require("esri/Color"); + + /** Text symbols are used to add text on the graphics layer. */ + class TextSymbol extends Symbol { + /** The end of the text string is aligned with the point. */ + static ALIGN_END: any; + /** The center of the text string is aligned with the point. */ + static ALIGN_MIDDLE: any; + /** The beginning of the text string is aligned with the point. */ + static ALIGN_START: any; + /** Text has a lined striked through it. */ + static DECORATION_LINETHROUGH: any; + /** Text has no decoration. */ + static DECORATION_NONE: any; + /** Text has a line along the top. */ + static DECORATION_OVERLINE: any; + /** Text is underlined. */ + static DECORATION_UNDERLINE: any; + /** The text alignment in relation to the point. */ + align: string; + /** Text angle. */ + angle: number; + /** The decoration on the text. */ + decoration: string; + /** Font for displaying text. */ + font: Font; + /** Horizontal alignment of the text with respect to the graphic. */ + horizontalAlignment: string; + /** Determines whether to adjust the spacing between characters in the text string. */ + kerning: boolean; + /** Determines whether every character in the text string is rotated. */ + rotated: boolean; + /** Text string for display in the graphics layer. */ + text: string; + /** Vertical alignment of the text with respect to the graphic. */ + verticalAlignment: string; + /** The offset on the x-axis in pixels from the point. */ + xoffset: number; + /** The offset on the y-axis in pixels from the point. */ + yoffset: number; + /** + * Creates a new TextSymbol object that includes only the text. + * @param text Text string for display in the graphics layer. + */ + constructor(text: string); + /** + * Creates a new TextSymbol object. + * @param text Text string for display in the graphics layer. + * @param font Font for displaying text. + * @param color Symbol color. + */ + constructor(text: string, font: Font, color: Color); + /** + * Creates a new TextSymbol object using a JSON object. + * @param json JSON object representing the TextSymbol. + */ + constructor(json: Object); + /** + * Sets the alignment of the text. + * @param align The text alignment. + */ + setAlign(align: string): TextSymbol; + /** + * Sets the angle of the text. + * @param angle Angle value between 0 and 359. + */ + setAngle(angle: number): TextSymbol; + /** + * Sets the decoration for the text. + * @param decoration The decoration on the text. + */ + setDecoration(decoration: string): TextSymbol; + /** + * Sets the text font. + * @param font Text font. + */ + setFont(font: Font): TextSymbol; + /** + * Updates the horizontal alignment of the text symbol. + * @param alignment Horizontal alignment of the text with respect to the graphic. + */ + setHorizontalAlignment(alignment: string): TextSymbol; + /** + * Sets whether to adjust the spacing between characters in the text string. + * @param kerning Set to true for kerning. + */ + setKerning(kerning: boolean): TextSymbol; + /** + * Sets the x and y offset of the text. + * @param x X offset value in pixels. + * @param y Y offset value in pixels. + */ + setOffset(x: number, y: number): TextSymbol; + /** + * Sets whether every character in the text string is rotated. + * @param rotated Set to true to rotate all characters in the string. + */ + setRotated(rotated: boolean): TextSymbol; + /** + * Sets the text string. + * @param text The text string. + */ + setText(text: string): TextSymbol; + /** + * Updates the vertical alignment of the text symbol. + * @param alignment Vertical alignment of the text with respect to the graphic. + */ + setVerticalAlignment(alignment: string): TextSymbol; + } + export = TextSymbol; +} + +declare module "esri/symbols/jsonUtils" { + import Symbol = require("esri/symbols/Symbol"); + + /** Utility methods for working with symbols. */ + var jsonUtils: { + /** + * Converts input json into a symbol, returns null if the input json represents an unknown or unsupported symbol type. + * @param json The input JSON. + */ + fromJson(json: Object): Symbol; + /** + * Returns the shape description properties for the given symbol as defined by the Dojo GFX API. + * @param symbol The input symbol. + */ + getShapeDescriptors(symbol: Symbol): any; + }; + export = jsonUtils; +} + +declare module "esri/tasks/AddressCandidate" { + import Point = require("esri/geometry/Point"); + + /** Represents an address and its location. */ + class AddressCandidate { + /** Address of the candidate. */ + address: any; + /** Name value pairs of field name and field value as defined in outFields in Locator.addressToLocations. */ + attributes: any; + /** X- and y-coordinate of the candidate. */ + location: Point; + /** Numeric score between 0 and 100 for geocode candidates. */ + score: number; + } + export = AddressCandidate; +} + +declare module "esri/tasks/AlgorithmicColorRamp" { + import ColorRamp = require("esri/tasks/ColorRamp"); + import Color = require("esri/Color"); + + /** Create an algorithmic color ramp to define the range of colors used in the renderer generated by the GenerateRendererTask. */ + class AlgorithmicColorRamp extends ColorRamp { + /** The algorithm used to generate the colors between the fromColor and toColor. */ + algorithm: string; + /** The first color in the color ramp. */ + fromColor: Color; + /** The last color in the color ramp. */ + toColor: Color; + /** Creates a new AlgorithmicColorRamp object. */ + constructor(); + /** Returns an easily serializable object representation of an algorithmic color ramp. */ + toJson(): any; + } + export = AlgorithmicColorRamp; +} + +declare module "esri/tasks/AreasAndLengthsParameters" { + import Geometry = require("esri/geometry/Geometry"); + + /** Input parameters for the areasAndLengths() method on the Geometry Service. */ + class AreasAndLengthsParameters { + /** The area unit in which areas of polygons will be calculated. */ + areaUnit: any; + /** Defines the type of calculation for the geometry. */ + calculationType: string; + /** The length unit in which perimeters of polygons will be calculated. */ + lengthUnit: any; + /** Polygon geometries for which to compute areas and lengths */ + polygons: Geometry[]; + /** Creates a new AreasAndLengthsParameters object. */ + constructor(); + } + export = AreasAndLengthsParameters; +} + +declare module "esri/tasks/BufferParameters" { + import SpatialReference = require("esri/SpatialReference"); + import Geometry = require("esri/geometry/Geometry"); + + /** Sets the distances, units, and other parameters for a buffer operation. */ + class BufferParameters { + /** The spatial reference in which the geometries are buffered. */ + bufferSpatialReference: SpatialReference; + /** The distances the input features are buffered. */ + distances: number[]; + /** If the input geometries are in geographic coordinate system set geodesic to true in order to generate a buffer polygon using a geodesic distance. */ + geodesic: boolean; + /** The input geometries to buffer. */ + geometries: Geometry[]; + /** The spatial reference for the returned geometries. */ + outSpatialReference: SpatialReference; + /** If true, all geometries buffered at a given distance are unioned into a single (possibly multipart) polygon, and the unioned geometry is placed in the output array. */ + unionResults: boolean; + /** The units for calculating each buffer distance. */ + unit: string; + /** Creates a new BufferParameters object. */ + constructor(); + } + export = BufferParameters; +} + +declare module "esri/tasks/ClassBreaksDefinition" { + import ClassificationDefinition = require("esri/tasks/ClassificationDefinition"); + import Symbol = require("esri/symbols/Symbol"); + import ColorRamp = require("esri/tasks/ColorRamp"); + + /** Define a class breaks classification scheme used by the GenerateRendererTask to generate classes. */ + class ClassBreaksDefinition extends ClassificationDefinition { + /** Define a default symbol for the classification. */ + baseSymbol: Symbol; + /** The number of class breaks. */ + breakCount: number; + /** The name of the field used to match values. */ + classificationField: string; + /** The name of the classification method. */ + classificationMethod: string; + /** Define a color ramp for the classification. */ + colorRamp: ColorRamp; + /** The name of the field that contains the values used to normalize class breaks when normalizationType is set to 'field'. */ + normalizationField: string; + /** The type of normalization used to normalize class breaks. */ + normalizationType: string; + /** The standard deviation interval. */ + standardDeviationInterval: number; + /** Creates a new ClassBreaksDefinition object */ + constructor(); + /** Returns an easily serializable object representation of the class breaks definition. */ + toJson(): any; + } + export = ClassBreaksDefinition; +} + +declare module "esri/tasks/ClassificationDefinition" { + import Symbol = require("esri/symbols/Symbol"); + import ColorRamp = require("esri/tasks/ColorRamp"); + + /** The super class for the classification definition objects used by the GenerateRendererTask class to generate data classes. */ + class ClassificationDefinition { + /** Define a default symbol for the classification. */ + baseSymbol: Symbol; + /** Define a color ramp for the classification. */ + colorRamp: ColorRamp; + /** The type of classification definition. */ + type: string; + } + export = ClassificationDefinition; +} + +declare module "esri/tasks/ClosestFacilityParameters" { + import SpatialReference = require("esri/SpatialReference"); + + /** Input parameters for the ClosestFacilityTask. */ + class ClosestFacilityParameters { + /** The list of network attribute names to be accumulated with the analysis, i.e., which attributes should be returned as part of the response. */ + accumulateAttributes: string[]; + /** An array of attribute parameter values that determine which network elements can be used by a vehicle. */ + attributeParameterValues: any[]; + /** The cutoff value used to determine when to stop traversing. */ + defaultCutoff: number; + /** The number of facilities to find. */ + defaultTargetFacilityCount: number; + /** The language used when computing directions. */ + directionsLanguage: string; + /** The length units used when computing directions. */ + directionsLengthUnits: string; + /** Defines the amount of direction information returned. */ + directionsOutputType: string; + /** The style to be used when returning directions. */ + directionsStyleName: string; + /** The name of the attribute field that contains the drive time values. */ + directionsTimeAttribute: string; + /** When true, restricted network elements should be considered when finding network locations. */ + doNotLocateOnRestrictedElements: boolean; + /** The set of facilities loaded as network locations during analysis. */ + facilities: any; + /** The network attribute field name used as the impedance attribute during analysis. */ + impedenceAttribute: string; + /** The set of incidents loaded as network locations during analysis. */ + incidents: any; + /** The output geometry precision. */ + outputGeometryPrecision: number; + /** The units of the output geometry precision. */ + outputGeometryPrecisionUnits: string; + /** The type of output lines to be generated in the result. */ + outputLines: string; + /** The well-known id of the spatial reference for the geometries returned with the analysis results. */ + outSpatialReference: SpatialReference; + /** The set of point barriers loaded as network locations during analysis. */ + pointBarriers: any; + /** The set of polygon barriers loaded as network locations during analysis. */ + polygonBarriers: any; + /** The set of polyline barriers loaded as network locations during analysis. */ + polylineBarriers: any; + /** The list of network attribute names to be used as restrictions with the analysis. */ + restrictionAttributes: string[]; + /** Specifies how U-Turns should be handled. */ + restrictUTurns: string; + /** If true, directions will be generated and returned in the directions property of each RouteResult and RouteSolveResult. */ + returnDirections: boolean; + /** If true, facilities will be returned with the analysis results. */ + returnFacilities: boolean; + /** If true, incidents will be returned with the analysis results. */ + returnIncidents: boolean; + /** If true, barriers will be returned in the barriers property of the ClosestFacilitySolveResult. */ + returnPointBarriers: boolean; + /** If true, polygon barriers will be returned in the barriers property of the ClosestFacilitySolveResult. */ + returnPolygonBarriers: boolean; + /** If true, polyline barriers will be returned in the barriers property of the ClosestFacilitySolveResult. */ + returnPolylineBarriers: boolean; + /** When true, closest facility routes will be generated and returned in the route property of each ClosestFacilityResult and ClosestFacilitySolveResult. */ + returnRoutes: boolean; + /** The arrival or departure date and time. */ + timeOfDay: Date; + /** Defines the way the timeOfDay value is used. */ + timeOfDayUsage: string; + /** Options for traveling to or from the facility. */ + travelDirection: string; + /** If true, the hierarchy attribute for the network will be used in analysis. */ + useHierarchy: boolean; + /** Creates a new ClosestFacilityParameters object */ + constructor(); + } + export = ClosestFacilityParameters; +} + +declare module "esri/tasks/ClosestFacilitySolveResult" { + import DirectionsFeatureSet = require("esri/tasks/DirectionsFeatureSet"); + import Point = require("esri/geometry/Point"); + import NAMessage = require("esri/tasks/NAMessage"); + import Polygon = require("esri/geometry/Polygon"); + import Polyline = require("esri/geometry/Polyline"); + import Graphic = require("esri/graphic"); + + /** The result from a ClosestFacilityTask operation. */ + class ClosestFacilitySolveResult { + /** An array of directions. */ + directions: DirectionsFeatureSet; + /** An array of points, only returned when ClosestFacilityParameters.returnFacilities is true. */ + facilities: Point[]; + /** An array of points, only returned when ClosestFacilityParameters.returnIncidents is true. */ + incidents: Point[]; + /** Message received when the solve is complete. */ + messages: NAMessage[]; + /** The point barriers are an array of points. */ + pointBarriers: Point[]; + /** The polygon barriers are an array of polygons. */ + polygonBarriers: Polygon[]; + /** The polyline barriers are an array of polylines. */ + polylineBarriers: Polyline[]; + /** The array of routes. */ + routes: Graphic[]; + } + export = ClosestFacilitySolveResult; +} + +declare module "esri/tasks/ClosestFacilityTask" { + import esri = require("esri"); + import ClosestFacilityParameters = require("esri/tasks/ClosestFacilityParameters"); + import ClosestFacilitySolveResult = require("esri/tasks/ClosestFacilitySolveResult"); + + /** Helps you find closest facilities around any location (incident) on a network. */ + class ClosestFacilityTask { + /** + * Creates a new ClosestFacilityTask object. + * @param url URL to the ArcGIS Server REST resource that represents a network analysis service. + */ + constructor(url: string); + /** + * Solve the closest facility. + * @param params The ClosestFacilityParameters object. + * @param callback The function to call when the method has completed. + * @param errback An error object is returned if an error occurs on the Server during task execution. + */ + solve(params: ClosestFacilityParameters, callback?: Function, errback?: Function): any; + /** Fires when ClosestFacilityTask has completed. */ + on(type: "solve-complete", listener: (event: { result: ClosestFacilitySolveResult; target: ClosestFacilityTask }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = ClosestFacilityTask; +} + +declare module "esri/tasks/ColorRamp" { + /** Used to denote classes that may be used as a color ramp. */ + class ColorRamp { + /** A string value representing the color ramp type. */ + type: string; + } + export = ColorRamp; +} + +declare module "esri/tasks/DataFile" { + /** A geoprocessing data object containing a data source. */ + class DataFile { + /** The ID of the uploaded file returned as a result of the upload operation. */ + itemID: string; + /** URL to the location of the data file. */ + url: string; + /** Creates a new DataFile object. */ + constructor(); + } + export = DataFile; +} + +declare module "esri/tasks/DataLayer" { + import Geometry = require("esri/geometry/Geometry"); + + /** Input for properties of ClosestFacilityParameters,RouteParameters or ServiceAreaParameters. */ + class DataLayer { + /** Part or all of a feature from feature class 1 is contained within a feature from feature class 2. */ + static SPATIAL_REL_CONTAINS: any; + /** The feature from feature class 1 crosses a feature from feature class 2. */ + static SPATIAL_REL_CROSSES: any; + /** The envelope of feature class 1 intersects with the envelope of feature class 2. */ + static SPATIAL_REL_ENVELOPEINTERSECTS: any; + /** The envelope of the query feature class intersects the index entry for the target feature class. */ + static SPATIAL_REL_INDEXINTERSECTS: any; + /** Part of a feature from feature class 1 is contained in a feature from feature class 2. */ + static SPATIAL_REL_INTERSECTS: any; + /** Features from feature class 1 overlap features in feature class 2. */ + static SPATIAL_REL_OVERLAPS: any; + /** The feature from feature class 1 touches the border of a feature from feature class 2. */ + static SPATIAL_REL_TOUCHES: any; + /** The feature from feature class 1 is completely enclosed by the feature from feature class 2. */ + static SPATIAL_REL_WITHIN: any; + /** The geometry to apply to the spatial filter. */ + geometry: Geometry; + /** The name of the data layer in the map service that is being referenced. */ + name: string; + /** The spatial relationship to be applied on the input geometry while performing the query. */ + spatialRelationship: string; + /** A where clause for the query. */ + where: string; + /** Creates a new DataLayer object. */ + constructor(); + } + export = DataLayer; +} + +declare module "esri/tasks/Date" { + /** Date used in geoprocessing. */ + class AGSDate { + /** Date value returned from server. */ + date: Date; + /** The format of the date used in the date property. */ + format: string; + /** Creates a new Date object. */ + constructor(); + } + export = AGSDate; +} + +declare module "esri/tasks/DensifyParameters" { + import Geometry = require("esri/geometry/Geometry"); + + /** Input parameters for the densify() method on the GeometryService - contains geometries, maxSegmentLength, and optionally lengthUnit, geodesic. */ + class DensifyParameters { + /** If true, GCS spatial references are used or densify geodesic is to be performed. */ + geodesic: boolean; + /** The array of geometries to be densified. */ + geometries: Geometry[]; + /** The length unit of maxSegmentLength, can be any esriUnits constant. */ + lengthUnit: any; + /** All segments longer than maxSegmentLength are replaced with sequences of lines no longer than maxSegmentLength. */ + maxSegmentLength: number; + /** Converts object to its JSON representation. */ + toJson(): any; + } + export = DensifyParameters; +} + +declare module "esri/tasks/DirectionsFeatureSet" { + import FeatureSet = require("esri/tasks/FeatureSet"); + import Extent = require("esri/geometry/Extent"); + import Polyline = require("esri/geometry/Polyline"); + + /** A FeatureSet that has properties specific to routing. */ + class DirectionsFeatureSet extends FeatureSet { + /** The extent of the route. */ + extent: Extent; + /** A single polyline representing the route. */ + mergedGeometry: Polyline; + /** The ID of the route returned from the server. */ + routeId: string; + /** Name specified in RouteParameters.stops. */ + routeName: string; + /** Lists additional information about the direction depending on the value of directionsOutputType. */ + strings: any[]; + /** Actual drive time calculated for the route. */ + totalDriveTime: number; + /** The length of the route as specified in RouteParameters.directionsLengthUnits. */ + totalLength: number; + /** The total time calculated for the route as specified in RouteParameters.directionsTimeAttribute. */ + totalTime: number; + } + export = DirectionsFeatureSet; +} + +declare module "esri/tasks/DistanceParameters" { + import Geometry = require("esri/geometry/Geometry"); + + /** Input parameters for the distance method on the GeometryService. */ + class DistanceParameters { + /** Specifies the units for measuring distance between geometry1 and geometry2. */ + distanceUnit: any; + /** When true, the geodesic distance between geometry1 and geometry2 is measured. */ + geodesic: boolean; + /** The geometry from which the distance is to measured. */ + geometry1: Geometry; + /** The geometry to which the distance is measured. */ + geometry2: Geometry; + /** Creates a new DistanceParameters object. */ + constructor(); + } + export = DistanceParameters; +} + +declare module "esri/tasks/FeatureSet" { + import Graphic = require("esri/graphic"); + import SpatialReference = require("esri/SpatialReference"); + + /** A collection of features returned from ArcGIS Server or used as input to tasks. */ + class FeatureSet { + /** The name of the layer's primary display field. */ + displayFieldName: string; + /** Typically a layer has a limit on the number of features (i.e., records) returned by the query operation. */ + exceededTransferLimit: boolean; + /** The array of graphics returned. */ + features: Graphic[]; + /** Set of name-value pairs for the attribute's field and alias names. */ + fieldAliases: any; + /** The geometry type of the FeatureSet. */ + geometryType: string; + /** When a FeatureSet is used as input to Geoprocessor, the spatial reference is set to the map's spatial reference by default. */ + spatialReference: SpatialReference; + /** Creates a new FeatureSet object. */ + constructor(); + /** + * Creates a new FeatureSet object using a JSON object. + * @param json A JSON object that contains feature set. + */ + constructor(json: Object); + } + export = FeatureSet; +} + +declare module "esri/tasks/FindParameters" { + import DynamicLayerInfo = require("esri/layers/DynamicLayerInfo"); + import SpatialReference = require("esri/SpatialReference"); + + /** This data object is used as the findParameters argument to FindTask.execute method. */ + class FindParameters { + /** The contains parameter determines whether to look for an exact match of the search text or not. */ + contains: boolean; + /** An array of DynamicLayerInfos used to change the layer ordering or redefine the map. */ + dynamicLayerInfos: DynamicLayerInfo[]; + /** Array of layer definition expressions that allows you to filter the features of individual layers. */ + layerDefinitions: string[]; + /** The layers to perform the find operation on. */ + layerIds: number[]; + /** The maximum allowable offset used for generalizing geometries returned by the find operation. */ + maxAllowableOffset: number; + /** The spatial reference of the output geometries. */ + outSpatialReference: SpatialReference; + /** If "true", the result set include the geometry associated with each result. */ + returnGeometry: boolean; + /** The names of the fields of a layer to search. */ + searchFields: string[]; + /** The search string text that is searched across the layers and the fields as specified in the layers and searchFields parameters. */ + searchText: string; + /** Creates a new FindParameters object. */ + constructor(); + } + export = FindParameters; +} + +declare module "esri/tasks/FindResult" { + import Graphic = require("esri/graphic"); + + /** Represents a result of a find operation. */ + class FindResult { + /** The name of the layer's primary display field. */ + displayFieldName: string; + /** The found feature. */ + feature: Graphic; + /** The name of the field that contains the search text. */ + foundFieldName: string; + /** Unique ID of the layer that contains the feature. */ + layerId: number; + /** The layer name that contains the feature. */ + layerName: string; + } + export = FindResult; +} + +declare module "esri/tasks/FindTask" { + import esri = require("esri"); + import FindParameters = require("esri/tasks/FindParameters"); + import FindResult = require("esri/tasks/FindResult"); + + /** Search a map service exposed by the ArcGIS Server REST API based on a string value. */ + class FindTask { + /** URL to the ArcGIS Server REST resource that represents a map service. */ + url: string; + /** + * Creates a new FindTask object. + * @param url URL to the ArcGIS Server REST resource that represents a layer in a service. + * @param options Optional parameters. + */ + constructor(url: string, options?: esri.FindTaskOptions); + /** + * Sends a request to the ArcGIS REST map service resource to perform a search based on the FindParameters specified in the findParameters argument. + * @param findParameters Specifies the layers and fields that are used to search against. + * @param callback The function to call when the method has completed. + * @param errback An error object is returned if an error occurs on the Server during task execution. + */ + execute(findParameters: FindParameters, callback?: Function, errback?: Function): any; + /** Fires when the find operation is complete. */ + on(type: "complete", listener: (event: { results: FindResult[]; target: FindTask }) => void): esri.Handle; + /** Fires when an error occurs when executing the task. */ + on(type: "error", listener: (event: { error: Error; target: FindTask }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = FindTask; +} + +declare module "esri/tasks/GPMessage" { + /** Represents a message generated during the execution of a geoprocessing task. */ + class GPMessage { + /** esriJobMessageTypeAbort */ + static TYPE_ABORT: any; + /** esriGPMessageTypeEmpty */ + static TYPE_EMPTY: any; + /** esriGPMessageTypeError */ + static TYPE_ERROR: any; + /** esriGPMessageTypeInformative */ + static TYPE_INFORMATIVE: any; + /** TBA */ + static TYPE_PROCESS_DEFINITION: any; + /** TBA */ + static TYPE_PROCESS_START: any; + /** TBA */ + static TYPE_PROCESS_STOP: any; + /** esriGPMessageTypeWarning */ + static TYPE_WARNING: any; + /** A description of the geoprocessing message. */ + description: string; + /** The geoprocessing message type. */ + type: number; + } + export = GPMessage; +} + +declare module "esri/tasks/GeneralizeParameters" { + import Geometry = require("esri/geometry/Geometry"); + + /** Sets the geometries, maximum deviation and units for the generalize operation. */ + class GeneralizeParameters { + /** The maximum deviation unit. */ + deviationUnit: any; + /** The array of input geometries to generalize. */ + geometries: Geometry[]; + /** The maximum deviation for constructing a generalized geometry based on the input geometries. */ + maxDeviation: number; + /** Creates a new GeneralizeParameters object. */ + constructor(); + } + export = GeneralizeParameters; +} + +declare module "esri/tasks/GenerateRendererParameters" { + import ClassificationDefinition = require("esri/tasks/ClassificationDefinition"); + + /** Define the classification definition and optional where clause for the GenerateRendererTask operation. */ + class GenerateRendererParameters { + /** A ClassBreaksDefinition or UniqueValueDefinition classification definition used to generate the data classes. */ + classificationDefinition: ClassificationDefinition; + /** Indicate if the label should be formatted */ + formatLabel: boolean; + /** Round values for the renderer. */ + precision: number; + /** The label in the legend will have this prefix */ + prefix: string; + /** The label in the legend will have this at the end of each label */ + unitLabel: string; + /** A where clause used to generate the data classes. */ + where: string; + /** Creates a new GenerateRendererParameters object. */ + constructor(); + } + export = GenerateRendererParameters; +} + +declare module "esri/tasks/GenerateRendererTask" { + import esri = require("esri"); + import GenerateRendererParameters = require("esri/tasks/GenerateRendererParameters"); + import Renderer = require("esri/renderers/Renderer"); + + /** The GenerateRendererTask class creates a renderer based on a classification definition and optional where clause. */ + class GenerateRendererTask { + /** + * Creates a new GenerateRendererTask object. + * @param url URL to a layer in a map service or table. + * @param options Optional parameters. + */ + constructor(url: string, options?: esri.GenerateRendererTaskOptions); + /** + * Perform a classification on the layer or table resource. + * @param generateRendererParameters A GenerateRendererParameters object that defines the classification definition and an optional where clause. + * @param callback This function will be called when the operation is complete. + * @param errback An error object is returned if an error occurs on the Server during task execution. + */ + execute(generateRendererParameters: GenerateRendererParameters, callback?: Function, errback?: Function): any; + /** Fired when the classification operation is complete. */ + on(type: "complete", listener: (event: { renderer: Renderer; target: GenerateRendererTask }) => void): esri.Handle; + /** Fired when an error occurs during task execution. */ + on(type: "error", listener: (event: { error: Error; target: GenerateRendererTask }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = GenerateRendererTask; +} + +declare module "esri/tasks/GeometryService" { + import esri = require("esri"); + import AreasAndLengthsParameters = require("esri/tasks/AreasAndLengthsParameters"); + import Polygon = require("esri/geometry/Polygon"); + import Polyline = require("esri/geometry/Polyline"); + import BufferParameters = require("esri/tasks/BufferParameters"); + import Geometry = require("esri/geometry/Geometry"); + import DensifyParameters = require("esri/tasks/DensifyParameters"); + import DistanceParameters = require("esri/tasks/DistanceParameters"); + import GeneralizeParameters = require("esri/tasks/GeneralizeParameters"); + import LengthsParameters = require("esri/tasks/LengthsParameters"); + import OffsetParameters = require("esri/tasks/OffsetParameters"); + import ProjectParameters = require("esri/tasks/ProjectParameters"); + import RelationParameters = require("esri/tasks/RelationParameters"); + import TrimExtendParameters = require("esri/tasks/TrimExtendParameters"); + + /** Represents a geometry service resource exposed by the ArcGIS Server REST API. */ + class GeometryService { + /** Acres (areal unit) */ + static UNIT_ACRES: any; + /** Ares (areal unit) */ + static UNIT_ARES: any; + /** International foot (0.3048 meters) */ + static UNIT_FOOT: any; + /** Hectares (areal unit) */ + static UNIT_HECTARES: any; + /** Kilometer */ + static UNIT_KILOMETER: any; + /** International meters */ + static UNIT_METER: any; + /** Nautical Miles (1,852 meters) */ + static UNIT_NAUTICAL_MILE: any; + /** Square Centimeters (areal unit) */ + static UNIT_SQUARE_CENTIMETERS: any; + /** Square Decimeters (areal unit) */ + static UNIT_SQUARE_DECIMETERS: any; + /** Square Feet (areal unit) */ + static UNIT_SQUARE_FEET: any; + /** Square Inches (areal unit) */ + static UNIT_SQUARE_INCHES: any; + /** Square Kilometers (areal unit) */ + static UNIT_SQUARE_KILOMETERS: any; + /** Square Meters (areal unit) */ + static UNIT_SQUARE_METERS: any; + /** Square Miles (areal unit) */ + static UNIT_SQUARE_MILES: any; + /** Square Millimeters (areal unit) */ + static UNIT_SQUARE_MILLIMETERS: any; + /** Square Yards (areal unit) */ + static UNIT_SQUARE_YARDS: any; + /** Miles (5,280 feet, 1,760 yards, or exactly 1,609.344 meters) */ + static UNIT_STATUTE_MILE: any; + /** US Nautical Mile */ + static UNIT_US_NAUTICAL_MILE: any; + /** URL to the ArcGIS Server REST resource that represents a locator service. */ + url: string; + /** + * Creates a new GeometryService object. + * @param url URL to the ArcGIS Server REST resource that represents a GeometryService, e.g., http://sampleserver6.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer. + */ + constructor(url: string); + /** + * Computes the area and length for the input polygons. + * @param areasAndLengthsParameters Specify the input polygons and optionally the linear and areal units. + * @param callback The function to call when the method has completed. + * @param errback An error object is returned if an error occurs on the Server during task execution. + */ + areasAndLengths(areasAndLengthsParameters: AreasAndLengthsParameters, callback?: Function, errback?: Function): any; + /** + * The Auto Complete operation is performed on a geometry service resource. + * @param polygons The array of polygons that will provide some boundaries for new polygons. + * @param polylines An array of polylines that will provide the remaining boundaries for new polygons. + * @param callback The function to call when the method has completed. + * @param errback An error object is returned if an error occurs during task execution. + */ + autoComplete(polygons: Polygon[], polylines: Polyline[], callback?: Function, errback?: Function): any; + /** + * Creates buffer polygons at a specified distance around the given geometries. + * @param bufferParameters Specifies the input geometries, buffer distances, and other options. + * @param callback The function to call when the method has completed. + * @param errback An error object is returned if an error occurs on the Server during task execution. + */ + buffer(bufferParameters: BufferParameters, callback?: Function, errback?: Function): any; + /** + * The convexHull operation is performed on a geometry service resource. + * @param geometries The geometries whose convex hull is to be created. + * @param callback The function to call when the method has completed. + * @param errback An error object is returned if an error occurs during task execution. + */ + convexHull(geometries: Geometry[], callback?: Function, errback?: Function): any; + /** + * The cut operation is performed on a geometry service resource. + * @param geometries The polyline or polygon to be cut. + * @param cutterGeometry The polyline that will be used to divide the target into pieces where it crosses the target. + * @param callback The function to call when the method has completed. + * @param errback An error object is returned if an error occurs during task execution. + */ + cut(geometries: Geometry[], cutterGeometry: Geometry, callback?: Function, errback?: Function): any; + /** + * The densify operation is performed on a geometry service resource. + * @param densifyParameters The DensifyParameters objects contains geometries, geodesic, lengthUnit, and maxSegmentLength parameters. + * @param callback The function to call when the method has completed. + * @param errback An error object is returned if an error occurs on the Server during task execution. + */ + densify(densifyParameters: DensifyParameters, callback?: Function, errback?: Function): any; + /** + * The difference operation is performed on a geometry service resource. + * @param geometries An array of points, multipoints, polylines or polygons. + * @param geometry A single geometry of any type, of dimension equal to or greater than the elements of geometries. + * @param callback The function to call when the method has completed. + * @param errback An error object is returned if an error occurs during task execution. + */ + difference(geometries: Geometry[], geometry: Geometry, callback?: Function, errback?: Function): any; + /** + * Measures the planar or geodesic distance between geometries. + * @param params Sets the input geometries to measure, distance units and other parameters. + * @param callback The function to call when the method has completed. + * @param errback An error object is returned if an error occurs during task execution. + */ + distance(params: DistanceParameters, callback?: Function, errback?: Function): any; + /** + * Converts an array of well-known strings into xy-coordinates based on the conversion type and spatial reference supplied by the user. + * @param params See the object specifications table below for the structure of the params object. + * @param callback The function to call when the method has completed. + * @param errback An error object is returned if an error occurs during task execution. + */ + fromGeoCoordinateString(params: any, callback?: Function, errback?: Function): any; + /** + * Generalizes the input geometries using the Douglas-Peucker algorithm. + * @param params An array of geometries to generalize and a maximum deviation. + * @param callback The function to call when the method has completed. + * @param errback An error object is returned if an error occurs during task execution. + */ + generalize(params: GeneralizeParameters, callback?: Function, errback?: Function): any; + /** + * The intersect operation is performed on a geometry service resource. + * @param geometries An array of points, multipoints, polylines or polygons. + * @param geometry A single geometry of any type, of dimension equal to or greater than the elements of geometries. + * @param callback The function to call when the method has completed. + * @param errback An error object is returned if an error occurs during task execution. + */ + intersect(geometries: Geometry[], geometry: Geometry, callback?: Function, errback?: Function): any; + /** + * Calculates an interior point for each polygon specified. + * @param polygons The graphics to process. + * @param callback The function to call when the method has completed. + * @param errback An error object is returned if an error occurs on the Server during task execution. + */ + labelPoints(polygons: Geometry[], callback?: Function, errback?: Function): any; + /** + * Gets the lengths for a Geometry[] when the geometry type is Polyline. + * @param lengthsParameter Specify the polylines and optionally the length unit and the geodesic length option. + * @param callback The function to call when the method has completed. + * @param errback An error object is returned if an error occurs on the Server during task execution. + */ + lengths(lengthsParameter: LengthsParameters, callback?: Function, errback?: Function): any; + /** + * Constructs the offset of the input geometries. + * @param params Set the geometries to offset, distance and units. + * @param callback The function to call when the method has completed. + * @param errback An error object is returned if an error occurs during task execution. + */ + offset(params: OffsetParameters, callback?: Function, errback?: Function): any; + /** + * Projects a set of geometries into a new spatial reference. + * @param params The input projection parameters. + * @param callback The function to call when the method has completed. + * @param errback An error object is returned if an error occurs on the Server during task execution. + */ + project(params: ProjectParameters, callback?: Function, errback?: Function): any; + /** + * Computes the set of pairs of geometries from the input geometry arrays that belong to the specified relation. + * @param relationParameters The set of parameters required to perform the comparison. + * @param callback The function to call when the method has completed. + * @param errback An error object is returned if an error occurs on the Server during task execution. + */ + relation(relationParameters: RelationParameters, callback?: Function, errback?: Function): any; + /** + * The reshape operation is performed on a geometry service resource. + * @param targetGeometry The polyline or polygon to be reshaped. + * @param reshaperGeometry The single-part polyline that does the reshaping. + * @param callback The function to call when the method has completed. + * @param errback An error object is returned if an error occurs on the Server during task execution. + */ + reshape(targetGeometry: Geometry, reshaperGeometry: Geometry, callback?: Function, errback?: Function): any; + /** + * Alters the given geometries to make their definitions topologically legal with respect to their geometry type. + * @param geometries The geometries to simplify + * @param callback The function to call when the method has completed. + * @param errback An error object is returned if an error occurs on the Server during task execution. + */ + simplify(geometries: Geometry[], callback?: Function, errback?: Function): any; + /** + * Converts an array of xy-coordinates into well-known strings based on the conversion type and spatial reference supplied by the user. + * @param params See the object specifications table below for the structure of the params object. + * @param callback The function to call when the method has completed. + * @param errback An error object is returned if an error occurs during task execution. + */ + toGeoCoordinateString(params: any, callback?: Function, errback?: Function): any; + /** + * Trims or extends the input polylines using the user specified guide polyline. + * @param params Input parameters for the trimExtend operation. + * @param callback The function to call when the method has completed. + * @param errback An error object is returned if an error occurs during task execution. + */ + trimExtend(params: TrimExtendParameters, callback?: Function, errback?: Function): any; + /** + * The union operation is performed on a geometry service resource. + * @param geometries The array of geometries to be unioned. + * @param callback The function to call when the method has completed. + * @param errback An error object is returned if an error occurs during task execution. + */ + union(geometries: Geometry[], callback?: Function, errback?: Function): any; + /** Fires when the areasAndLengths operation is complete. */ + on(type: "areas-and-lengths-complete", listener: (event: { result: any; target: GeometryService }) => void): esri.Handle; + /** Fires when the autoComplete operation is complete. */ + on(type: "auto-complete-complete", listener: (event: { geometries: Polygon[]; target: GeometryService }) => void): esri.Handle; + /** Fires when the buffer operation is complete. */ + on(type: "buffer-complete", listener: (event: { geometries: Geometry[]; target: GeometryService }) => void): esri.Handle; + /** Fires when the convexHull operation is complete. */ + on(type: "convex-hull-complete", listener: (event: { geometry: Geometry; target: GeometryService }) => void): esri.Handle; + /** Fires when the cut operation is complete. */ + on(type: "cut-complete", listener: (event: { result: any; target: GeometryService }) => void): esri.Handle; + /** Fires when the densify operation is complete. */ + on(type: "densify-complete", listener: (event: { geometries: Geometry[]; target: GeometryService }) => void): esri.Handle; + /** Fires when the difference operation is complete. */ + on(type: "difference-complete", listener: (event: { geometries: Geometry[]; target: GeometryService }) => void): esri.Handle; + /** Fires when the distance operation is complete. */ + on(type: "distance-complete", listener: (event: { distance: number; target: GeometryService }) => void): esri.Handle; + /** Fires when an error occurs when executing the task. */ + on(type: "error", listener: (event: { target: GeometryService }) => void): esri.Handle; + /** Fires when the generalize operation is complete. */ + on(type: "generalize-complete", listener: (event: { geometries: Geometry[]; target: GeometryService }) => void): esri.Handle; + /** Fires when the intersect operation is complete. */ + on(type: "intersect-complete", listener: (event: { geometries: Geometry[]; target: GeometryService }) => void): esri.Handle; + /** Fires when the labelPoints operation is complete. */ + on(type: "label-points-complete ", listener: (event: { geometries: Geometry[]; target: GeometryService }) => void): esri.Handle; + /** Fires when the lengths operation is complete. */ + on(type: "lengths-complete", listener: (event: { result: any; target: GeometryService }) => void): esri.Handle; + /** Fires when the offset operation is complete. */ + on(type: "offset-complete", listener: (event: { geometries: Geometry[]; target: GeometryService }) => void): esri.Handle; + /** Fires when the project operation is complete. */ + on(type: "project-complete", listener: (event: { geometries: Geometry[]; target: GeometryService }) => void): esri.Handle; + /** Fires when the relation operation is complete. */ + on(type: "relation-complete", listener: (event: { target: GeometryService }) => void): esri.Handle; + /** Fires when the reshape operation is complete. */ + on(type: "reshape-complete", listener: (event: { geometry: Geometry; target: GeometryService }) => void): esri.Handle; + /** Fires when the simplify operation is complete. */ + on(type: "simplify-complete", listener: (event: { geometries: Geometry[]; target: GeometryService }) => void): esri.Handle; + /** Fires when the trimExtend operation is complete. */ + on(type: "trim-extend-complete", listener: (event: { geometries: Geometry[]; target: GeometryService }) => void): esri.Handle; + /** Fires when the union operation is complete. */ + on(type: "union-complete", listener: (event: { geometry: Geometry; target: GeometryService }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = GeometryService; +} + +declare module "esri/tasks/Geoprocessor" { + import esri = require("esri"); + import SpatialReference = require("esri/SpatialReference"); + import ImageParameters = require("esri/layers/ImageParameters"); + import ArcGISDynamicMapServiceLayer = require("esri/layers/ArcGISDynamicMapServiceLayer"); + import GPMessage = require("esri/tasks/GPMessage"); + import ParameterValue = require("esri/tasks/ParameterValue"); + import MapImage = require("esri/layers/MapImage"); + + /** Represents a GP Task resource exposed by the ArcGIS Server REST API. */ + class Geoprocessor { + /** Deprecated at v2.0, use outSpatialReference instead. */ + outputSpatialReference: SpatialReference; + /** The spatial reference of the output geometries. */ + outSpatialReference: SpatialReference; + /** The spatial reference that the model will use to perform geometry operations. */ + processSpatialReference: SpatialReference; + /** The time interval in milliseconds between each job status request sent to an asynchronous GP task. */ + updateDelay: number; + /** ArcGIS Server Rest API endpoint to the resource that receives the geoprocessing request. */ + url: string; + /** + * Creates a new Geoprocessor object that represents the GP Task identifed by a URL. + * @param url URL to the ArcGIS Server REST resource that represents a geoprocessing service. + */ + constructor(url: string); + /** + * Cancel an asynchronous geoprocessing job. + * @param jobId A string that uniquely identifies a job on the server. + * @param callback The function to call when the method has completed. + * @param errback An error object is returned if an error occurs during task execution. + */ + cancelJob(jobId: string, callback: Function, errback: Function): any; + /** + * Cancels the periodic job status updates initiated automatically when submitJob() is invoked for the job identified by jobId. + * @param jobId A string that uniquely identifies the job for which the job updates are cancelled. + */ + cancelJobStatusUpdates(jobId: string): void; + /** + * Sends a request to the GP Task for the current state of the job identified by jobId. + * @param jobId A string that uniquely identifies a job on the server. + * @param callback The function to call when the method has completed. + * @param errback An error object is returned if an error occurs on the Server during task execution. + */ + checkJobStatus(jobId: string, callback?: Function, errback?: Function): void; + /** + * Sends a request to the server to execute a synchronous GP task. + * @param inputParameters The inputParameters argument specifies the input parameters accepted by the task and their corresponding values. + * @param callback The function to call when the method has completed. + * @param errback An error object is returned if an error occurs on the Server during task execution. + */ + execute(inputParameters: any, callback?: Function, errback?: Function): any; + /** + * Sends a request to the GP Task to get the task result identified by jobId and resultParameterName. + * @param jobId The jobId returned from JobInfo. + * @param parameterName The name of the result parameter as defined in Services Directory. + * @param callback The function to call when the method has completed. + * @param errback An error object is returned if an error occurs on the Server during task execution. + */ + getResultData(jobId: string, parameterName: string, callback?: Function, errback?: Function): any; + /** + * Sends a request to the GP Task to get the task result identified by jobId and resultParameterName as an image. + * @param jobId The jobId returned from JobInfo. + * @param parameterName The name of the result parameter as defined in Services Directory. + * @param imageParameters Specifies the properties of the result image. + * @param callback The function to call when the method has completed. + * @param errback An error object is returned if an error occurs on the Server during task execution. + */ + getResultImage(jobId: string, parameterName: string, imageParameters: ImageParameters, callback?: Function, errback?: Function): any; + /** + * Get the task result identified by jobId and resultParameterName as an ArcGISDynamicMapServiceLayer. + * @param jobId The jobId returned from JobInfo. + * @param parameterName The name of the result parameter as defined in Services Directory. + * @param imageParameters Contains various options that can be specified when generating a dynamic map image. + * @param callback The function to call when the method has completed. + */ + getResultImageLayer(jobId: string, parameterName?: string, imageParameters?: ImageParameters, callback?: Function): ArcGISDynamicMapServiceLayer; + /** + * Deprecated at v2.0, use setOutSpatialReference instead. + * @param spatialReference The well-known ID of a spatial reference. + */ + setOutputSpatialReference(spatialReference: SpatialReference): void; + /** + * Sets the well-known ID of the spatial reference of the output geometries. + * @param spatialReference The well-known ID of a spatial reference. + */ + setOutSpatialReference(spatialReference: SpatialReference): void; + /** + * Sets the well-known ID of the spatial reference that the model uses to perform geometry operations. + * @param spatialReference The well-known ID of a spatial reference. + */ + setProcessSpatialReference(spatialReference: SpatialReference): void; + /** + * Sets the time interval in milliseconds between each job status request sent to an asynchronous GP task. + * @param delay The value in milliseconds. + */ + setUpdateDelay(delay: number): void; + /** + * Submits a job to the server for asynchronous processing by the GP task. + * @param inputParameters The inputParameters argument specifies the input parameters accepted by the task and their corresponding values. + * @param callback The function to call when the method has completed. + * @param statusCallback Checks the current status of the job. + * @param errback An error object is returned if an error occurs on the Server during task execution. + */ + submitJob(inputParameters: any, callback?: Function, statusCallback?: Function, errback?: Function): void; + /** Fires when an error occurs when executing the task. */ + on(type: "error", listener: (event: { error: Error; target: Geoprocessor }) => void): esri.Handle; + /** Fires when a synchronous GP task is completed. */ + on(type: "execute-complete", listener: (event: { messages: GPMessage[]; results: ParameterValue[]; target: Geoprocessor }) => void): esri.Handle; + /** Fires when the result of an asynchronous GP task execution is available. */ + on(type: "get-result-data-complete", listener: (event: { result: ParameterValue; target: Geoprocessor }) => void): esri.Handle; + /** Fires when a map image is generated by invoking the getResultImage method. */ + on(type: "get-result-image-complete", listener: (event: { mapImage: MapImage; target: Geoprocessor }) => void): esri.Handle; + /** Fires when getResultImageLayer method has completed. */ + on(type: "get-result-image-layer-complete", listener: (event: { target: Geoprocessor }) => void): esri.Handle; + /** Fires when the geoprocessing job is cancelled using the cancelJob method. */ + on(type: "job-cancel", listener: (event: { target: Geoprocessor }) => void): esri.Handle; + /** Fires when an asynchronous GP task using submitJob is complete. */ + on(type: "job-complete", listener: (event: { target: Geoprocessor }) => void): esri.Handle; + /** Fires when a job status update is available. */ + on(type: "status-update", listener: (event: { target: Geoprocessor }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = Geoprocessor; +} + +declare module "esri/tasks/IdentifyParameters" { + import DynamicLayerInfo = require("esri/layers/DynamicLayerInfo"); + import Geometry = require("esri/geometry/Geometry"); + import LayerTimeOptions = require("esri/layers/LayerTimeOptions"); + import Extent = require("esri/geometry/Extent"); + import SpatialReference = require("esri/SpatialReference"); + import TimeExtent = require("esri/TimeExtent"); + + /** This data object is used as the identifyParameters argument to IdentifyTask.execute method. */ + class IdentifyParameters { + /** All layers are identified, even if they are not visible. */ + static LAYER_OPTION_ALL: any; + /** Only the top-most visible layer is identified. */ + static LAYER_OPTION_TOP: any; + /** All visible layers are identified. */ + static LAYER_OPTION_VISIBLE: any; + /** Resolution of the current map view in dots per inch. */ + dpi: number; + /** An array of DynamicLayerInfos used to change the layer ordering or redefine the map. */ + dynamicLayerInfos: DynamicLayerInfo[]; + /** The geometry used to select features during Identify. */ + geometry: Geometry; + /** Height of the map currently being viewed in pixels. */ + height: number; + /** Array of layer definition expressions that allows you to filter the features of individual layers. */ + layerDefinitions: string[]; + /** The layers to perform the identify operation on. */ + layerIds: number[]; + /** Specifies which layers to use when using Identify. */ + layerOption: string; + /** Array of LayerTimeOptions objects that allow you to define time options for the specified layers. */ + layerTimeOptions: LayerTimeOptions[]; + /** The Extent or bounding box of the map currently being viewed. */ + mapExtent: Extent; + /** The maximum allowable offset used for generalizing geometries returned by the identify operation. */ + maxAllowableOffset: number; + /** If "true", the result set includes the geometry associated with each result. */ + returnGeometry: boolean; + /** The spatial reference of the input and output geometries as well as of the mapExtent. */ + spatialReference: SpatialReference; + /** Specify the time extent used by the identify task. */ + timeExtent: TimeExtent; + /** The distance in screen pixels from the specified geometry within which the identify should be performed. */ + tolerance: number; + /** Width of the map currently being viewed in pixels. */ + width: number; + /** Creates a new IdentifyParameters object. */ + constructor(); + } + export = IdentifyParameters; +} + +declare module "esri/tasks/IdentifyResult" { + import Graphic = require("esri/graphic"); + + /** Represents a result of an identify operation. */ + class IdentifyResult { + /** The name of the layer's primary display field. */ + displayFieldName: string; + /** An identified feature. */ + feature: Graphic; + /** Unique ID of the layer that contains the feature. */ + layerId: number; + /** The layer name that contains the feature. */ + layerName: string; + } + export = IdentifyResult; +} + +declare module "esri/tasks/IdentifyTask" { + import esri = require("esri"); + import IdentifyParameters = require("esri/tasks/IdentifyParameters"); + import IdentifyResult = require("esri/tasks/IdentifyResult"); + + /** Performs an identify operation on the layers of a map service resource exposed by the ArcGIS Server REST API. */ + class IdentifyTask { + /** URL to the ArcGIS Server REST resource that represents a map service. */ + url: string; + /** + * Creates a new IdentifyTask object. + * @param url URL to the ArcGIS Server REST resource that represents a map service. + * @param options Optional parameters. + */ + constructor(url: string, options?: esri.IdentifyTaskOptions); + /** + * Sends a request to the ArcGIS REST map service resource to identify features based on the IdentifyParameters specified in the identifyParameters argument. + * @param identifyParameters Specifies the criteria used to identify the features. + * @param callback The function to call when the method has completed. + * @param errback An error object is returned if an error occurs on the Server during task execution. + */ + execute(identifyParameters: IdentifyParameters, callback?: Function, errback?: Function): any; + /** Fires when the identify operation is complete. */ + on(type: "complete", listener: (event: { results: IdentifyResult[]; target: IdentifyTask }) => void): esri.Handle; + /** Fires when an error occurs when executing the task. */ + on(type: "error", listener: (event: { error: Error; target: IdentifyTask }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = IdentifyTask; +} + +declare module "esri/tasks/ImageServiceIdentifyParameters" { + import Geometry = require("esri/geometry/Geometry"); + import MosaicRule = require("esri/layers/MosaicRule"); + import Symbol = require("esri/symbols/Symbol"); + import RasterFunction = require("esri/layers/RasterFunction"); + import TimeExtent = require("esri/TimeExtent"); + + /** Input parameters for the ImageServiceIdentifyTask. */ + class ImageServiceIdentifyParameters { + /** Input geometry that defines the location to be identified. */ + geometry: Geometry; + /** Specifies the mosaic rules defining the image sorting order. */ + mosaicRule: MosaicRule; + /** The pixel or RGB color value representing no information. */ + noData: any; + /** Used along with the noData property. */ + noDataInterpretation: string; + /** Specify the pixel level being identified on the x and y axis. */ + pixelSize: Symbol; + /** The pixel level being identified (or the resolution being looked at) on the x-axis. */ + pixelSizeX: number; + /** The pixel level being identified (or the resolution being looked at) on the y-axis. */ + pixelSizeY: number; + /** Specifies the rendering rule for how the requested image should be rendered. */ + renderingRule: RasterFunction; + /** If "true", returns both geometry and attributes of the catalog items. */ + returnCatalogItems: boolean; + /** When true, each feature in the catalog items includes the geometry. */ + returnGeometry: boolean; + /** Specify a time extent. */ + timeExtent: TimeExtent; + /** Creates a new ImageServiceIdentifyParameters object. */ + constructor(); + } + export = ImageServiceIdentifyParameters; +} + +declare module "esri/tasks/ImageServiceIdentifyResult" { + import FeatureSet = require("esri/tasks/FeatureSet"); + import Point = require("esri/geometry/Point"); + + /** The results from an ImageServiceIdentifyTask. */ + class ImageServiceIdentifyResult { + /** The set of catalog items that overlap the input geometry. */ + catalogItems: FeatureSet; + /** The set of visible areas for the identified catalog items. */ + catalogItemVisibilities: number[]; + /** The identified location. */ + location: Point; + /** The identify property name. */ + name: string; + /** The identify property id. */ + objectId: number; + /** The attributes of the identified object. */ + properties: any; + /** The identify property pixel value. */ + value: string; + } + export = ImageServiceIdentifyResult; +} + +declare module "esri/tasks/ImageServiceIdentifyTask" { + import esri = require("esri"); + import ImageServiceIdentifyParameters = require("esri/tasks/ImageServiceIdentifyParameters"); + import ImageServiceIdentifyResult = require("esri/tasks/ImageServiceIdentifyResult"); + + /** Performs an identify operation on an image service resource . */ + class ImageServiceIdentifyTask { + /** + * Creates a new ImageServiceIdentifyTask object. + * @param url URL to the ArcGIS Server REST resource that represents an image service. + */ + constructor(url: string); + /** + * Sends a request to the ArcGIS REST image service resource to identify content based on the ImageServiceIdentifyParameters specified in the imageServiceIdentifyParameters argument. + * @param params Specifies the criteria used to identify the features. + * @param callback The function to call when the method has completed. + * @param errback An error object is returned if an error occurs on the Server during task execution. + */ + execute(params: ImageServiceIdentifyParameters, callback?: Function, errback?: Function): any; + /** Fires when the identify operation is complete. */ + on(type: "complete", listener: (event: { result: ImageServiceIdentifyResult; target: ImageServiceIdentifyTask }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = ImageServiceIdentifyTask; +} + +declare module "esri/tasks/JobInfo" { + import GPMessage = require("esri/tasks/GPMessage"); + + /** Represents information pertaining to the execution of an asynchronous GP task on the server. */ + class JobInfo { + /** The job has been cancelled. */ + static STATUS_CANCELLED: any; + /** The job is in the process of cancelling. */ + static STATUS_CANCELLING: any; + /** The job has been deleted. */ + static STATUS_DELETED: any; + /** The job is in the process of deleting. */ + static STATUS_DELETING: any; + /** The job is being executed by job processor. */ + static STATUS_EXECUTING: any; + /** The job execution has failed. */ + static STATUS_FAILED: any; + /** The job is new. */ + static STATUS_NEW: any; + /** The job is submitted for execution. */ + static STATUS_SUBMITTED: any; + /** The job has completed successfully. */ + static STATUS_SUCCEEDED: any; + /** The job execution has timed out. */ + static STATUS_TIMED_OUT: any; + /** The job is waiting for available job processor. */ + static STATUS_WAITING: any; + /** The unique job ID assigned by ArcGIS Server. */ + jobId: string; + /** The job status. */ + jobStatus: string; + /** An array of messages that include the message type and a description. */ + messages: GPMessage[]; + } + export = JobInfo; +} + +declare module "esri/tasks/LegendLayer" { + /** Define layer properties for the legend layers associated with a PrintTemplate. */ + class LegendLayer { + /** The id of the operational layer to include in the printout's legend. */ + layerId: string; + /** The ids of the sublayers to include in the printout's legend. */ + subLayerIds: string[]; + /** Creates a new LegendLayer object. */ + constructor(); + } + export = LegendLayer; +} + +declare module "esri/tasks/LengthsParameters" { + import Geometry = require("esri/geometry/Geometry"); + + /** Sets the length units and other parameters for Lengths operation. */ + class LengthsParameters { + /** Defines the type of calculation for the geometry. */ + calculationType: string; + /** If polylines are in geographic coordinate system, then geodesic needs to be set to true in order to calculate the ellipsoidal shortest path distance between each pair of the vertices in the polylines. */ + geodesic: boolean; + /** The length unit in which perimeters of polygons will be calculated. */ + lengthUnit: any; + /** The array of polylines whose lengths are to be computed. */ + polylines: Geometry[]; + /** Creates a new LengthsParameter object. */ + constructor(); + } + export = LengthsParameters; +} + +declare module "esri/tasks/LinearUnit" { + /** A data object containing a linear distance. */ + class LinearUnit { + /** Specifies the value of the linear distance. */ + distance: number; + /** Specifies the unit type of the linear distance, such as "esriMeters", "esriMiles", "esriKilometers" etc. */ + units: string; + /** Creates a new LinearUnit object. */ + constructor(); + } + export = LinearUnit; +} + +declare module "esri/tasks/MultipartColorRamp" { + import ColorRamp = require("esri/tasks/ColorRamp"); + import AlgorithmicColorRamp = require("esri/tasks/AlgorithmicColorRamp"); + + /** Create a multipart color ramp to concatenate multiple color ramps for use in the renderer generated by the GenerateRendererTask. */ + class MultipartColorRamp extends ColorRamp { + /** Define an array of algorithmic color ramps used to generate the multi part ramp. */ + colorRamps: AlgorithmicColorRamp[]; + /** Creates a new MultipartColorRamp object. */ + constructor(); + /** Returns an easily serializable object representation of a multipart color ramp. */ + toJson(): any; + } + export = MultipartColorRamp; +} + +declare module "esri/tasks/NAMessage" { + /** Represents a message generated during the execution of a network analyst task. */ + class NAMessage { + /** TBA */ + static TYPE_ABORT: any; + /** TBA */ + static TYPE_EMPTY: any; + /** TBA */ + static TYPE_ERROR: any; + /** TBA */ + static TYPE_INFORMATIVE: any; + /** TBA */ + static TYPE_PROCESS_DEFINITION: any; + /** TBA */ + static TYPE_PROCESS_START: any; + /** TBA */ + static TYPE_PROCESS_STOP: any; + /** TBA */ + static TYPE_WARNING: any; + /** A description of the network analyst message. */ + description: string; + /** The network analyst message type, see constants table for a list of values. */ + type: number; + } + export = NAMessage; +} + +declare module "esri/tasks/NATypes" { + import esri = require("esri"); + + var NATypes: { + OutputLine: esri.NAOutputLine; + OutputPolygon: esri.NAOutputPolygon; + TravelDirection: esri.NATravelDirection; + UTurn: esri.NAUTurn; + }; + export = NATypes; +} + +declare module "esri/tasks/OffsetParameters" { + import Geometry = require("esri/geometry/Geometry"); + + /** Sets the offset distance, type and other parameters for the GeometryService.offset operation. */ + class OffsetParameters { + /** The bevelRatio is multiplied by the offset distance and the result determines how far a mitered offset intersection can be located before it is beveled. */ + bevelRatio: number; + /** The array of geometries to be offset. */ + geometries: Geometry[]; + /** Specifies the distance for constructing an offset based on the input geometries. */ + offsetDistance: number; + /** Options that determine how the ends intersect. */ + offsetHow: string; + /** The offset distance unit. */ + offsetUnit: string; + /** Creates a new OffsetParameters object. */ + constructor(); + } + export = OffsetParameters; +} + +declare module "esri/tasks/ParameterValue" { + /** Represent the output parameters of a GP task and their properties and values. */ + class ParameterValue { + /** Specifies the type of data for the parameter. */ + dataType: string; + /** The value of the parameter. */ + value: any; + } + export = ParameterValue; +} + +declare module "esri/tasks/PrintParameters" { + import Map = require("esri/map"); + import SpatialReference = require("esri/SpatialReference"); + import PrintTemplate = require("esri/tasks/PrintTemplate"); + + /** Input parameters for the PrintTask. */ + class PrintParameters { + /** Additional parameters for the print service. */ + extraParameters: any; + /** The map to print. */ + map: Map; + /** Specify the output spatial reference for the printout. */ + outSpatialReference: SpatialReference; + /** Defines the layout template used for the printed map. */ + template: PrintTemplate; + /** Creates a new PrintParameters object. */ + constructor(); + } + export = PrintParameters; +} + +declare module "esri/tasks/PrintTask" { + import esri = require("esri"); + import PrintParameters = require("esri/tasks/PrintParameters"); + + /** The PrintTask class generates a printer-ready version of the map using an Export Web Map Task available with ArGIS Server 10.1 and later. */ + class PrintTask { + /** The url to the Export Web Map Task. */ + url: string; + /** + * Creates a new PrintTask object. + * @param url URL to the Export Web Map Task. + * @param params Parameters for the print task. + */ + constructor(url: string, params?: esri.PrintTaskOptions); + /** + * Sends a request to the print service resource to create a print page using the information specified in the printParameters argument. + * @param printParameters A PrintParameters object that defines the printing options. + * @param callback The function to call when the method has completed. + * @param errback An error object is returned if an error occurs during task execution. + */ + execute(printParameters: PrintParameters, callback?: Function, errback?: Function): any; + /** Fired when the print operation is complete. */ + on(type: "complete", listener: (event: { url: string; target: PrintTask }) => void): esri.Handle; + /** Fired when an error occurs while executing the print task. */ + on(type: "error", listener: (event: { error: Error; target: PrintTask }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = PrintTask; +} + +declare module "esri/tasks/PrintTemplate" { + /** Define the layout template options used by the PrintTask and Print widget to generate the print page. */ + class PrintTemplate { + /** Define the map width, height and dpi. */ + exportOptions: any; + /** The print output format. */ + format: string; + /** The text that appears on the PrintWidget's print button. */ + label: string; + /** The layout used for the print output. */ + layout: string; + /** Define the layout elements. */ + layoutOptions: any; + /** The optional map scale of the printed map. */ + outScale: number; + /** Define whether the printed map should preserve map scale or map extent. */ + preserveScale: boolean; + /** When false, attribution is not displayed on the printout. */ + showAttribution: boolean; + /** Creates a new PrintTemplate object. */ + constructor(); + } + export = PrintTemplate; +} + +declare module "esri/tasks/ProjectParameters" { + import Geometry = require("esri/geometry/Geometry"); + import SpatialReference = require("esri/SpatialReference"); + + /** Define the projection parameters used when calling the GeometryService project method. */ + class ProjectParameters { + /** The input geometries to project. */ + geometries: Geometry[]; + /** The spatial reference to which you are projecting the geometries. */ + outSR: SpatialReference; + /** The well-known id {wkid:number} or well-known text {wkt:string} or for the datum transfomation to be applied on the projected geometries. */ + transformation: any; + /** Indicates whether to transform forward or not. */ + transformForward: boolean; + /** Creates a new ProjectParameters object. */ + constructor(); + } + export = ProjectParameters; +} + +declare module "esri/tasks/QueryTask" { + import esri = require("esri"); + import Query = require("esri/tasks/query"); + import RelationshipQuery = require("esri/tasks/RelationshipQuery"); + import FeatureSet = require("esri/tasks/FeatureSet"); + + /** Executes a query operation on a layer resource of a map service exposed by the ArcGIS Server REST API. */ + class QueryTask { + /** URL to the ArcGIS Server REST resource that represents a map service layer. */ + url: string; + /** + * Creates a new QueryTask object used to execute a query on the layer resource identified by the url. + * @param url URL to the ArcGIS Server REST resource that represents a layer in a service. + * @param options Optional parameters. + */ + constructor(url: string, options?: esri.QueryTaskOptions); + /** + * Executes a Query against an ArcGIS Server map layer. + * @param parameters Specifies the attributes and spatial filter of the query. + * @param callback The function to call when the method has completed. + * @param errback An error object is returned if an error occurs on the Server during task execution. + */ + execute(parameters: Query, callback?: Function, errback?: Function): any; + /** + * Get a count of the number of features that satisfy the input query. + * @param query Specify the input query object. + * @param callback The function to call when the method has completed. + * @param errback An error object is returned if an error occurs on the Server during task execution. + */ + executeForCount(query: Query, callback?: Function, errback?: Function): any; + /** + * Get the extent of the features that satisfy the input query. + * @param query Specify the input query object. + * @param callback The function to call when the method has completed. + * @param errback An error object is returned if an error occurs on the Server during task execution. + */ + executeForExtent(query: Query, callback?: Function, errback?: Function): any; + /** + * Executes a Query against an ArcGIS Server map layer. + * @param parameters Specifies the attributes and spatial filter of the query. + * @param callback The function to call when the method has completed. + * @param errback An error object is returned if an error occurs on the Server during task execution. + */ + executeForIds(parameters: Query, callback?: Function, errback?: Function): any; + /** + * Executes a RelationshipQuery against an ArcGIS Server map layer (or table). + * @param parameters Specifies the attributes and spatial filter of the query. + * @param callback The function to call when the method has completed. + * @param errback An error object is returned if an error occurs on the Server during task execution. + */ + executeRelationshipQuery(parameters: RelationshipQuery, callback?: Function, errback?: Function): any; + /** Fires when the query operation is complete. */ + on(type: "complete", listener: (event: { featureSet: FeatureSet; target: QueryTask }) => void): esri.Handle; + /** Fires when an error occurs when executing the task. */ + on(type: "error", listener: (event: { error: Error; target: QueryTask }) => void): esri.Handle; + /** Fires when the query for the count is complete. */ + on(type: "execute-for-count-complete", listener: (event: { count: number; target: QueryTask }) => void): esri.Handle; + /** Fires when the query for the extent is complete. */ + on(type: "execute-for-extent-complete", listener: (event: { count: number; extent: any; target: QueryTask }) => void): esri.Handle; + /** Fires when the query on IDs is complete. */ + on(type: "execute-for-ids-complete", listener: (event: { objectIds: number[]; target: QueryTask }) => void): esri.Handle; + /** Fires when the executeRelationshipQuery is complete. */ + on(type: "execute-relationship-query-complete", listener: (event: { featureSets: FeatureSet[]; target: QueryTask }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = QueryTask; +} + +declare module "esri/tasks/RasterData" { + /** A geoprocessing data object containing a raster data source. */ + class RasterData { + /** Specifies the format of the raster data such as "jpg", "tif" etc. */ + format: string; + /** The ID of the uploaded file returned as a result of the upload operation. */ + itemID: string; + /** URL to the location of the raster data file. */ + url: string; + /** Creates a new RasterData object. */ + constructor(); + } + export = RasterData; +} + +declare module "esri/tasks/RelationParameters" { + import Geometry = require("esri/geometry/Geometry"); + + /** Sets the relation and other parameters for Relation operation. */ + class RelationParameters { + /** The boundaries of the geometries must share an intersection, but the relationship between the interiors of the shapes is not considered (they could overlap, one could be contained in the other, or their interiors could be disjoint). */ + static SPATIAL_REL_COINCIDENCE: any; + /** Two polylines cross if they share only points in common, at least one of which is not an endpoint. */ + static SPATIAL_REL_CROSS: any; + /** Two geometries are disjoint if their intersection is empty. */ + static SPATIAL_REL_DISJOINT: any; + /** The base geometry is within the comparison geometry if the base geometry is the intersection of the geometries and the intersection of their interiors is not empty. */ + static SPATIAL_REL_IN: any; + /** Geometries intersect excluding boundary touch. */ + static SPATIAL_REL_INTERIORINTERSECTION: any; + /** Geometry interiors intersect or boundaries touch, same as 'not disjoint'. */ + static SPATIAL_REL_INTERSECTION: any; + /** Two geometries are said to touch when the intersection of the geometries is non-empty, but the intersection of their interiors is empty. */ + static SPATIAL_REL_LINETOUCH: any; + /** Two polylines share a common sub-line, or two polygons share a common sub-area. */ + static SPATIAL_REL_OVERLAP: any; + /** Two geometries are said to touch when the intersection of the geometries is non-empty, but the intersection of their interiors is empty. */ + static SPATIAL_REL_POINTTOUCH: any; + /** Allows specification of any relationship defined using the Shape Comparison Language. */ + static SPATIAL_REL_RELATION: any; + /** The union of point touch and line touch. */ + static SPATIAL_REL_TOUCH: any; + /** Same as SPATIAL_REL_IN but also allows polylines that are strictly on the boundaries of polygons to be considered in the polygon. */ + static SPATIAL_REL_WITHIN: any; + /** The first array of geometries to compute the relations. */ + geometries1: Geometry[]; + /** The second array of geometries to compute the relations. */ + geometries2: Geometry[]; + /** The spatial relationship to be tested between the two input geometry arrays. */ + relation: string; + /** The 'Shape Comparison Language' string to evaluate. */ + relationParam: string; + /** Creates a new RelationParameter object. */ + constructor(); + } + export = RelationParameters; +} + +declare module "esri/tasks/RelationshipQuery" { + import SpatialReference = require("esri/SpatialReference"); + + /** Define query parameters for the feature layer's queryRelatedFeatures method. */ + class RelationshipQuery { + /** The definition expression to be applied to the related table or layer. */ + definitionExpression: string; + /** Specify the number of decimal places for the geometries returned by the query operation. */ + geometryPrecision: number; + /** The maximum allowable offset used for generalizing geometries returned by the query operation. */ + maxAllowableOffset: number; + /** A comma delimited list of ObjectIds for the features in the layer/table that you want to query. */ + objectIds: number[]; + /** Attribute fields to include in the FeatureSet. */ + outFields: string[]; + /** The spatial reference for the returned geometry. */ + outSpatialReference: SpatialReference; + /** The ID of the relationship to test. */ + relationshipId: number; + /** If "true", each feature in the FeatureSet includes the geometry. */ + returnGeometry: boolean; + /** Creates a new RelationshipQuery object. */ + constructor(); + } + export = RelationshipQuery; +} + +declare module "esri/tasks/RouteParameters" { + import SpatialReference = require("esri/SpatialReference"); + + /** Input parameters for the RouteTask. */ + class RouteParameters { + /** The list of network attribute names to be accumulated with the analysis, i.e., which attributes should be returned as part of the response. */ + accumulateAttributes: string[]; + /** Each element in the array is an object that describes the parameter values. */ + attributeParameterValues: any[]; + /** The set of point barriers loaded as network locations during analysis. */ + barriers: any; + /** The language used when computing directions. */ + directionsLanguage: string; + /** The length units to use when computing directions. */ + directionsLengthUnits: string; + /** Defines the amount of direction information returned. */ + directionsOutputType: string; + /** The style to be used when returning directions. */ + directionsStyleName: string; + /** The name of network attribute to use for the drive time when computing directions. */ + directionsTimeAttribute: string; + /** If true, avoids network elements restricted by barriers or due to restrictions specified in restrictionAttributes. */ + doNotLocateOnRestrictedElements: boolean; + /** The RouteTask can help you find the most efficient path for visiting a given list of stops. */ + findBestSequence: boolean; + /** In routes where a stop is not located on a network or a stop could not be reached, the results will differ depending on the value of ignoreInvalidLocations. */ + ignoreInvalidLocations: boolean; + /** The network attribute name to be used as the impedance attribute in analysis. */ + impedanceAttribute: string; + /** The precision of the output geometry after generalization. */ + outputGeometryPrecision: number; + /** The units of the output geometry precision. */ + outputGeometryPrecisionUnits: string; + /** The type of output lines to be generated in the result. */ + outputLines: string; + /** The well-known ID of the spatial reference for the geometries returned with the analysis results. */ + outSpatialReference: SpatialReference; + /** The set of polygon barriers loaded as network locations during analysis. */ + polygonBarriers: any; + /** The set of polyline barriers loaded as network locations during analysis. */ + polylineBarriers: any; + /** If true, keeps the first stop fixed in the sequence even when findBestSequence is true. */ + preserveFirstStop: boolean; + /** If true, keeps the last stop fixed in the sequence even when findBestSequence is true. */ + preserveLastStop: boolean; + /** The list of network attribute names to be used as restrictions with the analysis. */ + restrictionAttributes: string[]; + /** Specifies how U-Turns should be handled. */ + restrictUTurns: string; + /** If true, barriers are returned as the second parameter of RouteTask.onSolveComplete. */ + returnBarriers: boolean; + /** If true, directions are generated and returned in the directions property of each RouteResult. */ + returnDirections: boolean; + /** If true, polygon barriers are returned as the third parameter of RouteTask.onSolveComplete. */ + returnPolygonBarriers: boolean; + /** If true, polyline barriers are returned as the fourth parameter of RouteTask.onSolveComplete. */ + returnPolylineBarriers: boolean; + /** If true, routes are generated and returned in the route property of each RouteResult. */ + returnRoutes: boolean; + /** If true, stops are returned in the stops property of each RouteResult. */ + returnStops: boolean; + /** The time the route begins. */ + startTime: Date; + /** Start time is in UTC format */ + startTimeIsUTC: boolean; + /** The set of stops loaded as network locations during analysis. */ + stops: any; + /** If true, the hierarchy attribute for the network should be used in analysis. */ + useHierarchy: boolean; + /** A useful feature of the RouteTask is the ability to constrain stop visits to certain times of day, or "time windows". */ + useTimeWindows: boolean; + /** Creates a new RouteParameters object. */ + constructor(); + } + export = RouteParameters; +} + +declare module "esri/tasks/RouteResult" { + import DirectionsFeatureSet = require("esri/tasks/DirectionsFeatureSet"); + import Graphic = require("esri/graphic"); + + /** The result from the Route Task. */ + class RouteResult { + /** Route directions are returned if RouteParameters.returnDirections is set to true. */ + directions: DirectionsFeatureSet; + /** The Route graphic that is returned if RouteParameters.returnRoutes is true. */ + route: Graphic; + /** The name of the route. */ + routeName: string; + /** Array of stops. */ + stops: Graphic[]; + } + export = RouteResult; +} + +declare module "esri/tasks/RouteTask" { + import esri = require("esri"); + import RouteParameters = require("esri/tasks/RouteParameters"); + + /** The ArcGIS JavaScript API's routeTask allows you to find routes between two or more locations and optionally get driving directions. */ + class RouteTask { + /** URL to the ArcGIS Server REST resource that represents a network analysis service. */ + url: string; + /** + * Creates a new RouteTask object. + * @param url URL to the ArcGIS Server REST resource that represents a network analysis service. + */ + constructor(url: string); + /** + * Solves the route against the route layer with the route parameters. + * @param params Route parameters used as input to generate the route. + * @param callback The function to call when the method has completed. + * @param errback An error object is returned if an error occurs during task execution. + */ + solve(params: RouteParameters, callback?: Function, errback?: Function): any; + /** Fires when an error occurs when executing the task. */ + on(type: "error", listener: (event: { error: Error; target: RouteTask }) => void): esri.Handle; + /** Fires when RouteTask.solve() has completed. */ + on(type: "solve-complete", listener: (event: { result: any; target: RouteTask }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = RouteTask; +} + +declare module "esri/tasks/ServiceAreaParameters" { + import SpatialReference = require("esri/SpatialReference"); + + /** Input parameters for a ServiceAreaTask. */ + class ServiceAreaParameters { + /** The list of network attribute names to be accumulated with the analysis, i.e., which attributes should be returned as part of the response. */ + accumulateAttributes: string[]; + /** A set of attribute parameter values that can be parameterized to determine which network elements can be used by a vehicle. */ + attributeParameterValues: any[]; + /** An array of numbers defining the breaks. */ + defaultBreaks: number[]; + /** When true, restricted network elements should be considered when finding network locations. */ + doNotLocateOnRestrictedElements: boolean; + /** An array of network source names to NOT use when generating polygons. */ + excludeSourcesFromPolygons: string[]; + /** The set of facilities loaded as network locations during analysis. */ + facilities: any; + /** The network attribute name used as the impedance attribute in analysis. */ + impedanceAttribute: string; + /** If true, similar ranges will be merged in the result polygons. */ + mergeSimilarPolygonRanges: boolean; + /** The precision of the output geometry after generalization. */ + outputGeometryPrecision: number; + /** The units of the output geometry precision. */ + outputGeometryPrecisionUnits: string; + /** The type of output lines to be generated in the result. */ + outputLines: string; + /** The type of output polygons to be generated in the result. */ + outputPolygons: string; + /** The well-known ID of the spatial reference for the geometries returned with the analysis results. */ + outSpatialReference: SpatialReference; + /** Indicates if the lines should overlap from multiple facilities. */ + overlapLines: boolean; + /** Indicates if the polygons should overlap from multiple facilities. */ + overlapPolygons: boolean; + /** The set of point barriers loaded as network locations during analysis. */ + pointBarriers: any; + /** The set of polygons barriers loaded as network locations during analysis. */ + polygonBarriers: any; + /** The set of polyline barriers loaded as network locations during analysis. */ + polylineBarriers: any; + /** The list of network attribute names to be used as restrictions with the analysis. */ + restrictionAttributes: string[]; + /** Specifies how U-Turns should be handled. */ + restrictUTurns: string; + /** If true, facilities will be returned with the analysis results. */ + returnFacilities: boolean; + /** If true, barriers will be returned in the barriers property of ClosestFacilitySolveResult. */ + returnPointBarriers: boolean; + /** If true, polygon barriers will be returned in the polygonBarriers property of ClosestFacilitySolveResult. */ + returnPolygonBarriers: boolean; + /** If true, polyline barriers will be returned in the polylineBarriers property of ClosestFacilitySolveResult. */ + returnPolylineBarriers: boolean; + /** If true, lines will be split at breaks. */ + splitLinesAtBreaks: boolean; + /** If true, polygons will be split at breaks. */ + splitPolygonsAtBreaks: boolean; + /** Local date and time at the facility. */ + timeOfDay: Date; + /** Options for traveling to or from the facility. */ + travelDirection: string; + /** If true, the outermost polygon (at the maximum break value) will be trimmed. */ + trimOuterPolygon: boolean; + /** If polygons are being trimmed, provides the distance to trim. */ + trimPolygonDistance: number; + /** If polygons are being trimmed, specifies the units of the trimPolygonDistance. */ + trimPolygonDistanceUnits: string; + /** When true, the hierarchy attributes for the network will be used in analysis. */ + useHierarchy: boolean; + /** Creates a new ServiceAreaParameters object. */ + constructor(); + } + export = ServiceAreaParameters; +} + +declare module "esri/tasks/ServiceAreaSolveResult" { + import Point = require("esri/geometry/Point"); + import NAMessage = require("esri/tasks/NAMessage"); + import Polygon = require("esri/geometry/Polygon"); + import Polyline = require("esri/geometry/Polyline"); + import Graphic = require("esri/graphic"); + + /** The result from a ServiceAreaTask operation. */ + class ServiceAreaSolveResult { + /** Array of points, only returned if ServiceAreaParameters.returnFacilities is set to true. */ + facilities: Point[]; + /** Message received when solve is completed. */ + messages: NAMessage[]; + /** The point barriers are an array of points. */ + pointBarriers: Point[]; + /** The polygon barriers are an array of polygons. */ + polygonBarriers: Polygon[]; + /** The polyline barriers are an array of polylines. */ + polylineBarriers: Polyline[]; + /** Array of service area polygon graphics. */ + serviceAreaPolygons: Graphic[]; + /** Array of service area polyline graphics. */ + serviceAreaPolylines: Graphic[]; + } + export = ServiceAreaSolveResult; +} + +declare module "esri/tasks/ServiceAreaTask" { + import esri = require("esri"); + import ServiceAreaParameters = require("esri/tasks/ServiceAreaParameters"); + import ServiceAreaSolveResult = require("esri/tasks/ServiceAreaSolveResult"); + + /** Helps you find service areas around any location on a network. */ + class ServiceAreaTask { + /** + * Creates a new ServiceAreaTask object. + * @param url URL to the ArcGIS Server REST resource that represents a network analysis service. + */ + constructor(url: string); + /** + * Solve the service area. + * @param params The ServiceAreaParameters object. + * @param callback The function to call when the method has completed. + * @param errback An error object is returned if an error occurs on the Server during task execution. + */ + solve(params: ServiceAreaParameters, callback?: Function, errback?: Function): any; + /** Fires when ServiceAreaTask has completed. */ + on(type: "solve-complete", listener: (event: { result: ServiceAreaSolveResult; target: ServiceAreaTask }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = ServiceAreaTask; +} + +declare module "esri/tasks/StatisticDefinition" { + /** The StatisticDefinition class defines the type of statistics, the field used to calculate the statistics and the resulting output field name. */ + class StatisticDefinition { + /** Define the field on which statistics will be calculated. */ + onStatisticField: string; + /** Specify the output field name. */ + outStatisticFieldName: string; + /** Define the type of statistic. */ + statisticType: string; + /** Creates a new StatisticDefinition object. */ + constructor(); + } + export = StatisticDefinition; +} + +declare module "esri/tasks/TrimExtendParameters" { + import Polyline = require("esri/geometry/Polyline"); + + /** Sets the polylines and other parameters for the trimExtend operation. */ + class TrimExtendParameters { + /** A flag used along with the trimExtend operation. */ + extendHow: string; + /** The array of polylines to trim or extend. */ + polylines: Polyline[]; + /** A polyline used as a guide for trimming or extending input polylines. */ + trimExtendTo: Polyline; + /** Creates a new TrimExtendParameters object. */ + constructor(); + } + export = TrimExtendParameters; +} + +declare module "esri/tasks/UniqueValueDefinition" { + import ClassificationDefinition = require("esri/tasks/ClassificationDefinition"); + import Symbol = require("esri/symbols/Symbol"); + import ColorRamp = require("esri/tasks/ColorRamp"); + + /** Define a unique value classification scheme used by the GenerateRendererTask to create a renderer that groups values based on a unique combination of one or more fields. */ + class UniqueValueDefinition extends ClassificationDefinition { + /** Attribute field renderer uses to match values. */ + attributeField: string; + /** The name of the field that contains unique values when combined with the values specified by attributeField. */ + attributeField2: string; + /** The name of the field that contains unique values when combined with the values specified by attributeField and attributeField2. */ + attributeField3: string; + /** Define a default symbol for the classification. */ + baseSymbol: Symbol; + /** Define a color ramp for the classification. */ + colorRamp: ColorRamp; + /** Creates a new UniqueValueDefinition object. */ + constructor(); + /** Returns an easily serializable object representation of the unique value definition. */ + toJson(): any; + } + export = UniqueValueDefinition; +} + +declare module "esri/tasks/geoenrichment/AddressStudyArea" { + import StudyArea = require("esri/tasks/geoenrichment/StudyArea"); + + /** The study area that is based on an address. */ + class AddressStudyArea extends StudyArea { + /** The address key value pairs to geocode to obtain this study area. */ + attributes: any; + } + export = AddressStudyArea; +} + +declare module "esri/tasks/geoenrichment/DriveBuffer" { + import esri = require("esri"); + + /** The study area is created with a drive time or drive distance buffer. */ + class DriveBuffer { + /** The radii to use to create ring buffers. */ + radius: number[]; + /** The units of the radii. */ + units: string; + /** + * Constructs a DriveBuffer. + * @param params Various optional parameters that can be used to configure this class. + */ + constructor(params: esri.DriveBufferOptions); + } + export = DriveBuffer; +} + +declare module "esri/tasks/geoenrichment/DriveUnits" { + /** DriveUnits provides various length units that can be passed as the units in the DriveBuffer. */ + class DriveUnits { + /** Acres (esriAcres). */ + static ACRES: any; + /** Ares (esriAres). */ + static ARES: any; + /** Centimeters (esriCentimeters). */ + static CENTIMETERS: any; + /** Decimal degrees (esriDecimalDegrees). */ + static DECIMAL_DEGREES: any; + /** Decimeters (esriDecimeters). */ + static DECIMETERS: any; + /** Degree minute seconds (esriDegreeMinuteSeconds). */ + static DEGREE_MINUTE_SECONDS: any; + /** Feet (esriFeet). */ + static FEET: any; + /** Hectares (esriHectares). */ + static HECTARES: any; + /** Inches (esriInches). */ + static INCHES: any; + /** Kilometers (esriKilometers). */ + static KILOMETERS: any; + /** Meters (esriMeters). */ + static METERS: any; + /** Miles (esriMiles). */ + static MILES: any; + /** Millimeters (esriMillimeters). */ + static MILLIMETERS: any; + /** Minutes (esriDriveTimeUnitsMinutes). */ + static MINUTES: any; + /** Nautical miles (esriNauticalMiles). */ + static NAUTICAL_MILES: any; + /** Points (esriPoints). */ + static POINTS: any; + /** Square centimeters (esriSquareCentimeters). */ + static SQUARE_CENTIMETERS: any; + /** Square decimeters (esriSquareDecimeters). */ + static SQUARE_DECIMETERS: any; + /** Square feet (esriSquareFeet). */ + static SQUARE_FEET: any; + /** Square inches (esriSquareInches). */ + static SQUARE_INCHES: any; + /** Square kilometers (esriSquareKilometers). */ + static SQUARE_KILOMETERS: any; + /** Square meters (esriSquareMeters). */ + static SQUARE_METERS: any; + /** Square miles (esriSquareMiles). */ + static SQUARE_MILES: any; + /** Square millimeters (esriSquareMillimeters). */ + static SQUARE_MILLIMETERS: any; + /** Square yards (esriSquareYards). */ + static SQUARE_YARDS: any; + /** Unknown (esriUnknownUnits). */ + static UNKNOWN: any; + /** Yards (esriYards). */ + static YARDS: any; + } + export = DriveUnits; +} + +declare module "esri/tasks/geoenrichment/GeographyLevel" { + /** GeographicLevel works with IntersectingGeographies to define a study area of InfoGraphic with a feature from a standard geography layer. */ + class GeographyLevel { + /** The ID of the country for which data is retrieved. */ + countryID: string; + /** The ID of the dataset to which variables used in this GeographyLevel belong. */ + datasetID: string; + /** The ID of the layer. */ + layerID: string; + /** + * Create a GeographyLevel object. + * @param json Various options to configure this GeographyLevel. + */ + constructor(json?: Object); + } + export = GeographyLevel; +} + +declare module "esri/tasks/geoenrichment/GeographyQuery" { + import GeographyQueryBase = require("esri/tasks/geoenrichment/GeographyQueryBase"); + + /** (Beta at v3.12) Represents StandardGeographyQuery parameters to search for geographies by ID or Name. */ + class GeographyQuery extends GeographyQueryBase { + /** Array of geography IDs. */ + geographyIDs: string[]; + /** Array of geography layer IDs. */ + geographyLayerIDs: string[]; + /** A where clause for the query. */ + where: string; + /** Creates a new instance of the GeographyQuery object. */ + constructor(); + } + export = GeographyQuery; +} + +declare module "esri/tasks/geoenrichment/GeographyQueryBase" { + import SpatialReference = require("esri/SpatialReference"); + + /** (Beta at v3.12) Base class for all GeographyQuery objects. */ + class GeographyQueryBase { + /** Two-digit country code. */ + countryID: string; + /** Optional string that denotes the ID of a dataset associated with a particular country. */ + datasetID: string; + /** Optional integer value where you can limit the number of features that are returned from the geographyQuery. */ + featureLimit: number; + /** Optional integer that specifies the level of generalization of the geometries. */ + generalizationLevel: number; + /** Determines spatial reference for output geometry if returnGeometry is set to true. */ + outSR: SpatialReference; + /** Use this parameter to return all the geometries as points. */ + returnCentroids: boolean; + /** Determines whether response will also include geometries. */ + returnGeometry: boolean; + /** Optional boolean to enable fuzzy search. */ + useFuzzySearch: boolean; + /** + * Creates a new instance of the GeographyQueryBase object. + * @param json JSON object used to set the properties of the object. + */ + constructor(json?: Object); + /** Converts object to its JSON representation. */ + toJson(): any; + } + export = GeographyQueryBase; +} + +declare module "esri/tasks/geoenrichment/GeometryStudyArea" { + import StudyArea = require("esri/tasks/geoenrichment/StudyArea"); + import Geometry = require("esri/geometry/Geometry"); + + /** The study area that is based on a geometry. */ + class GeometryStudyArea extends StudyArea { + /** The geometry for this study area. */ + geometry: Geometry; + /** Constructs a GeometryStudyArea. */ + constructor(); + } + export = GeometryStudyArea; +} + +declare module "esri/tasks/geoenrichment/IntersectingGeographies" { + import GeographyLevel = require("esri/tasks/geoenrichment/GeographyLevel"); + + /** The study area is created with the geometries intersecting the passed in geometry from specified layers. */ + class IntersectingGeographies { + /** The layers from which intersecting geographies should be used as study areas. */ + levels: GeographyLevel[]; + } + export = IntersectingGeographies; +} + +declare module "esri/tasks/geoenrichment/RingBuffer" { + import esri = require("esri"); + + /** The study area is created with a simple ring buffer with a radius. */ + class RingBuffer { + /** The radii to use to create ring buffers. */ + radii: number[]; + /** The units of the radii. */ + units: string; + /** + * Constructs a RingBuffer. + * @param params Various optional parameters that can be used to configure this class. + */ + constructor(params: esri.RingBufferOptions); + } + export = RingBuffer; +} + +declare module "esri/tasks/geoenrichment/StandardGeographyQueryTask" { + import esri = require("esri"); + import GeographyQueryBase = require("esri/tasks/geoenrichment/GeographyQueryBase"); + import FeatureSet = require("esri/tasks/FeatureSet"); + + /** (Beta at v3.12) Geoenrichment helper task that returns standard geography IDs and features for the supported geographic levels in Canada, the United States and a number of European countries. */ + class StandardGeographyQueryTask { + /** + * Creates a new instance of the StandardGeographyQueryTask class. + * @param url URL to the Geoenrichment server. + */ + constructor(url?: string); + /** + * Executes the StandardGeographyQueryTask. + * @param GeographyQuery See GeographyQuery or SubGeographyQuery classes for more details about available properties. + */ + execute(GeographyQuery: GeographyQueryBase): any; + /** Fires when an error occurs during the query. */ + on(type: "error", listener: (event: { error: Error; target: StandardGeographyQueryTask }) => void): esri.Handle; + /** Fires when the query successfully executes. */ + on(type: "execute-complete", listener: (event: { features: FeatureSet; target: StandardGeographyQueryTask }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = StandardGeographyQueryTask; +} + +declare module "esri/tasks/geoenrichment/StandardGeographyStudyArea" { + import StudyArea = require("esri/tasks/geoenrichment/StudyArea"); + + /** The study area that is based on a standard geography. */ + class StandardGeographyStudyArea extends StudyArea { + /** The country to which this geography belongs. */ + countryID: string; + /** The ID of the standard geography layer. */ + geographyLayerID: string; + /** The IDs of the standard geographies. */ + ids: string[]; + } + export = StandardGeographyStudyArea; +} + +declare module "esri/tasks/geoenrichment/StudyArea" { + import GeographyLevel = require("esri/tasks/geoenrichment/GeographyLevel"); + + /** The study area that is used for enrichment or for display in an Infographic widget. */ + class StudyArea { + /** Attributes of the study area. */ + attributes: any; + /** The identifiers for layers used to find comparison geographies. */ + comparisonGeographyLevels: GeographyLevel[]; + /** The options to apply to the study area. */ + options: any; + /** If true, geometry will be returned. */ + returnGeometry: boolean; + /** Converts object to its JSON representation. */ + toJson(): any; + } + export = StudyArea; +} + +declare module "esri/tasks/geoenrichment/SubGeographyQuery" { + import GeographyQueryBase = require("esri/tasks/geoenrichment/GeographyQueryBase"); + + /** (Beta at v3.12) Represents StandardGeographyQuery parameters to search subgeographic areas that are within a parent geography. */ + class SubGeographyQuery extends GeographyQueryBase { + /** Parent layer geography IDs. */ + filterGeographyIDs: string; + /** Parent layer ID. */ + filterGeographyLayerID: string; + /** Parent layer search string. */ + filterGeographyWhere: string; + /** Layer ID to return features from. */ + subGeographyLayerID: string; + /** Query string for the subquery. */ + subGeographyWhere: string; + /** + * Creates a new instance of the SubGeographyQuery object. + * @param json JSON object used to set the properties of the object. + */ + constructor(json?: Object); + } + export = SubGeographyQuery; +} + +declare module "esri/tasks/locationproviders/CoordinatesLocationProvider" { + import esri = require("esri"); + import LocationProviderClientBase = require("esri/tasks/locationproviders/LocationProviderClientBase"); + + /** (Beta at v3.12) The CoordinatesLocationProvider class uses the fields that contain Latitude and Longitude values to generate or locate geometries. */ + class CoordinatesLocationProvider extends LocationProviderClientBase { + /** The attribute field in the graphic object that has the longitude (X) values. */ + xField: string; + /** The attribute field in the graphic object that has the latitude (X) values. */ + yField: string; + /** + * Creates a new instance of the CoordinatesLocationProvider object. + * @param options Define the properties to use when creating the class. + */ + constructor(options: esri.CoordinatesLocationProviderOptions); + } + export = CoordinatesLocationProvider; +} + +declare module "esri/tasks/locationproviders/GeometryLocationProvider" { + import esri = require("esri"); + import LocationProviderClientBase = require("esri/tasks/locationproviders/LocationProviderClientBase"); + + /** (Beta at v3.12) The GeometryLocationProvider class uses the field in the data that has geometry as a JSON to generate the corresponding geometry. */ + class GeometryLocationProvider extends LocationProviderClientBase { + /** The attribute field in the graphic object that contains the JSON string representing the geometry. */ + geometryField: string; + /** + * Creates a new instance of the GeometryLocationProvider object. + * @param options Define the properties to use when creating the class. + */ + constructor(options: esri.GeometryLocationProviderOptions); + } + export = GeometryLocationProvider; +} + +declare module "esri/tasks/locationproviders/LocationProviderBase" { + import esri = require("esri"); + import Graphic = require("esri/graphic"); + + /** (Beta at v3.12) The base class for all LocationProviders. */ + class LocationProviderBase { + /** The geometry type of the returned features. */ + geometryType: string; + /** Returns true when the load event has been fired. */ + loaded: boolean; + /** + * Assigns geometries to the array of Graphic objects. + * @param features An array of Graphic objects. + * @param options Optional parameters. + */ + locate(features: Graphic[], options?: any): any; + /** Fires when an error occurs during locate. */ + on(type: "error", listener: (event: { error: Error; target: LocationProviderBase }) => void): esri.Handle; + /** Fires after the provider has loaded. */ + on(type: "load", listener: (event: { target: LocationProviderBase }) => void): esri.Handle; + /** Fires when the locate has completed. */ + on(type: "locate-complete", listener: (event: { failed: Graphic[]; features: Graphic[]; target: LocationProviderBase }) => void): esri.Handle; + /** Fires when the locate() method is in progress. */ + on(type: "locate-progress", listener: (event: { features: Graphic[]; target: LocationProviderBase }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = LocationProviderBase; +} + +declare module "esri/tasks/locationproviders/LocationProviderClientBase" { + import LocationProviderBase = require("esri/tasks/locationproviders/LocationProviderBase"); + import SpatialReference = require("esri/SpatialReference"); + + /** (Beta at v3.12) The base class for CoordinatesLocationProvider and GeometryLocationProvider. */ + class LocationProviderClientBase extends LocationProviderBase { + /** The Spatial Reference of the input geometries. */ + inSpatialReference: SpatialReference; + } + export = LocationProviderClientBase; +} + +declare module "esri/tasks/locationproviders/LocationProviderRemoteBase" { + import LocationProviderBase = require("esri/tasks/locationproviders/LocationProviderBase"); + + /** (Beta at v3.12) The base class for Location Providers that use a remote service to locate geometries. */ + class LocationProviderRemoteBase extends LocationProviderBase { + } + export = LocationProviderRemoteBase; +} + +declare module "esri/tasks/locationproviders/LocatorLocationProvider" { + import esri = require("esri"); + import LocationProviderRemoteBase = require("esri/tasks/locationproviders/LocationProviderRemoteBase"); + import Locator = require("esri/tasks/locator"); + + /** (Beta at v3.12) The LocatorLocationProvider class uses a geocode service through the Locator object to generate or locate geometries using fields in the graphics that contain Street address information */ + class LocatorLocationProvider extends LocationProviderRemoteBase { + /** Object that matches the Locator address fields to corresponding attribute names in the Graphic object. */ + addressFields: any; + /** An instance of a Locator object. */ + locator: Locator; + /** + * Creates a new instance of the LocatorLocationProvider object. + * @param options Define the properties to use when creating the class. + */ + constructor(options: esri.LocatorLocationProviderOptions); + } + export = LocatorLocationProvider; +} + +declare module "esri/tasks/locationproviders/QueryTaskLocationProvider" { + import esri = require("esri"); + import LocationProviderRemoteBase = require("esri/tasks/locationproviders/LocationProviderRemoteBase"); + import QueryTask = require("esri/tasks/QueryTask"); + + /** (Beta at v3.12) The QueryTaskLocationProvider performs a query against a ArcGIS Feature service or Map service layer based on common fields that are present in both the data and the ArcGIS layer. */ + class QueryTaskLocationProvider extends LocationProviderRemoteBase { + /** A query parameter object that will be used to query the ArcGIS layer. */ + queryParameters: any; + /** An instance of a QueryTask. */ + queryTask: QueryTask; + /** Set to true when querying a field that contains unicode characters. */ + unicode: boolean; + /** A mapping of the fields in the data and the ArcGIS layer to use to perform a join. */ + whereFields: any; + /** + * Creates a new instance of the QueryTaskLocationProvider object. + * @param options Define the properties to use when creating the class. + */ + constructor(options?: esri.QueryTaskLocationProviderOptions); + } + export = QueryTaskLocationProvider; +} + +declare module "esri/tasks/locationproviders/StandardGeographyQueryLocationProvider" { + import esri = require("esri"); + import LocationProviderRemoteBase = require("esri/tasks/locationproviders/LocationProviderRemoteBase"); + import StandardGeographyQueryTask = require("esri/tasks/geoenrichment/StandardGeographyQueryTask"); + + /** (Beta at v3.12) The StandardGeographyQueryLocationProvider class uses the Geoenrichment service to generate geometries by querying the standard geography layers. */ + class StandardGeographyQueryLocationProvider extends LocationProviderRemoteBase { + /** A template to be used to build the query for Standard Geography query. */ + geographyQueryTemplate: string; + /** An object that specifies the parameters to use in the Standard Geography query. */ + queryParameters: any; + /** An instance of the StandardGeographyQueryTask class. */ + standardGeographyQueryTask: StandardGeographyQueryTask; + /** + * Creates a new instance of the StandardGeographyQueryLocationProvider object. + * @param options Define the properties to use when creating the class. + */ + constructor(options: esri.StandardGeographyQueryLocationProviderOptions); + } + export = StandardGeographyQueryLocationProvider; +} + +declare module "esri/tasks/locator" { + import esri = require("esri"); + import SpatialReference = require("esri/SpatialReference"); + import Point = require("esri/geometry/Point"); + import AddressCandidate = require("esri/tasks/AddressCandidate"); + + /** Represents a geocode service resource exposed by the ArcGIS Server REST API. */ + class Locator { + /** Limit the results to one or more categories. */ + categories: string[]; + /** The country to limit results to for example "US" for United States or "SE" for Sweden. */ + countryCode: string; + /** The spatial reference of the output geometries. */ + outSpatialReference: SpatialReference; + /** URL to the ArcGIS Server REST resource that represents a locator service. */ + url: string; + /** + * Creates a new Locator object. + * @param url URL to the ArcGIS Server REST resource that represents a locator service. + */ + constructor(url: string); + /** + * Find address candidates for the input addresses. + * @param params The input addresses in the format supported by the geocoding service. + * @param callback The function to call when the method has completed. + * @param errback The function to call if an error occurs on the server during task execution. + */ + addressesToLocations(params: any, callback: Function, errback: Function): any; + /** + * Sends a request to the ArcGIS REST geocode resource to find candidates for a single address specified in the address parameter. + * @param params Specify the address and optionally specify the outFields and searchExtent. + * @param callback The function to call when the method has completed. + * @param errback An error object is returned if an error occurs on the Server during task execution. + */ + addressToLocations(params: any, callback?: Function, errback?: Function): any; + /** + * Locates an address based on a given point. + * @param location The point at which to search for the closest address. + * @param distance The distance in meters from the given location within which a matching address should be searched. + * @param callback The function to call when the method has completed. + * @param errback An error object is returned if an error occurs on the Server during task execution. + */ + locationToAddress(location: Point, distance: number, callback?: Function, errback?: Function): any; + /** + * Sets the well-known ID of the spatial reference of the output geometries. + * @param spatialReference The well-known ID of a spatial reference. + */ + setOutSpatialReference(spatialReference: SpatialReference): void; + /** + * Get character by character auto complete suggestions. + * @param params An object that defines suggest parameters. + */ + suggestLocations(params: any): any; + /** Fires when Locator.addressesToLocations method has completed. */ + on(type: "addresses-to-locations-complete", listener: (event: { addresses: AddressCandidate[]; target: Locator }) => void): esri.Handle; + /** Fires when Locator.addressToLocation method has completed. */ + on(type: "address-to-locations-complete", listener: (event: { addresses: AddressCandidate[]; target: Locator }) => void): esri.Handle; + /** Fires when an error occurs when executing the task. */ + on(type: "error", listener: (event: { error: Error; target: Locator }) => void): esri.Handle; + /** Fires when Locator.locationToAddress method has completed. */ + on(type: "location-to-address-complete", listener: (event: { address: AddressCandidate; target: Locator }) => void): esri.Handle; + /** Fires when the suggestLocations method has completed. */ + on(type: "suggest-locations-complete", listener: (event: { suggestions: any[]; target: Locator }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = Locator; +} + +declare module "esri/tasks/query" { + import Geometry = require("esri/geometry/Geometry"); + import SpatialReference = require("esri/SpatialReference"); + import StatisticDefinition = require("esri/tasks/StatisticDefinition"); + import Symbol = require("esri/symbols/Symbol"); + import TimeExtent = require("esri/TimeExtent"); + + /** Query for input to the QueryTask. */ + class Query { + /** Part or all of a feature from feature class 1 is contained within a feature from feature class 2. */ + static SPATIAL_REL_CONTAINS: any; + /** The feature from feature class 1 crosses a feature from feature class 2. */ + static SPATIAL_REL_CROSSES: any; + /** The envelope of feature class 1 intersects with the envelope of feature class 2. */ + static SPATIAL_REL_ENVELOPEINTERSECTS: any; + /** The envelope of the query feature class intersects the index entry for the target feature class. */ + static SPATIAL_REL_INDEXINTERSECTS: any; + /** Part of a feature from feature class 1 is contained in a feature from feature class 2. */ + static SPATIAL_REL_INTERSECTS: any; + /** Features from feature class 1 overlap features in feature class 2. */ + static SPATIAL_REL_OVERLAPS: any; + /** Allows specification of any relationship defined using the Shape Comparison Language. */ + static SPATIAL_REL_RELATION: any; + /** The feature from feature class 1 touches the border of a feature from feature class 2. */ + static SPATIAL_REL_TOUCHES: any; + /** The feature from feature class 1 is completely enclosed by the feature from feature class 2. */ + static SPATIAL_REL_WITHIN: any; + /** Distance to buffer input geometry. */ + distance: number; + /** The geometry to apply to the spatial filter. */ + geometry: Geometry; + /** Specify the number of decimal places for the geometries returned by the query operation. */ + geometryPrecision: number; + /** One or more field names that will be used to group the statistics. */ + groupByFieldsForStatistics: string[]; + /** The maximum allowable offset used for generalizing geometries returned by the query operation. */ + maxAllowableOffset: number; + /** Parameter to support querying feature services whose data source is a multipatch featureclass. */ + multipatchOption: string; + /** Number of features to retrieve. */ + num: number; + /** A comma delimited list of ObjectIds for the features in the layer/table that you want to query. */ + objectIds: number[]; + /** One or more field names that will be used to order the query results. */ + orderByFields: string[]; + /** Attribute fields to include in the FeatureSet. */ + outFields: string[]; + /** The spatial reference for the returned geometry. */ + outSpatialReference: SpatialReference; + /** The definitions for one or more field-based statistic to be calculated. */ + outStatistics: StatisticDefinition[]; + /** Specify the pixel level to be identified on the x and y axis. */ + pixelSize: Symbol; + /** Used to project the geometry onto a virtual grid, likely representing pixels on the screen. */ + quantizationParameters: any; + /** The 'Shape Comparison Language' string to evaluate. */ + relationParam: string; + /** If true then returns distinct values based on the fields specified in the outFields. */ + returnDistinctValues: boolean; + /** If "true", each feature in the FeatureSet includes the geometry. */ + returnGeometry: boolean; + /** The spatial relationship to be applied on the input geometry while performing the query. */ + spatialRelationship: string; + /** Zero-based index indicating where to begin retrieving features. */ + start: number; + /** Shorthand for a where clause using "like". */ + text: string; + /** Specify a time extent for the query. */ + timeExtent: TimeExtent; + /** Distance unit. */ + units: string; + /** A where clause for the query. */ + where: string; + /** Creates a new Query object used to execute a query on the layer resource identified by the URL. */ + constructor(); + } + export = Query; +} + +declare module "esri/toolbars/draw" { + import esri = require("esri"); + import SimpleFillSymbol = require("esri/symbols/SimpleFillSymbol"); + import SimpleLineSymbol = require("esri/symbols/SimpleLineSymbol"); + import SimpleMarkerSymbol = require("esri/symbols/SimpleMarkerSymbol"); + import Map = require("esri/map"); + import FillSymbol = require("esri/symbols/FillSymbol"); + import LineSymbol = require("esri/symbols/LineSymbol"); + import MarkerSymbol = require("esri/symbols/MarkerSymbol"); + import Geometry = require("esri/geometry/Geometry"); + + /** Toolbar that supports functionality to create new geometries by drawing them: points (POINT or MULTI_POINT), lines (LINE, POLYLINE, or FREEHAND_POLYLINE), polygons (FREEHAND_POLYGON or POLYGON), or rectangles (EXTENT). */ + class Draw { + /** Draws an arrow. */ + static ARROW: any; + /** Draws a circle. */ + static CIRCLE: any; + /** Draws an arrow that points down. */ + static DOWN_ARROW: any; + /** Draws an ellipse. */ + static ELLIPSE: any; + /** Draws an extent box. */ + static EXTENT: any; + /** Draws a freehand polygon. */ + static FREEHAND_POLYGON: any; + /** Draws a freehand polyline. */ + static FREEHAND_POLYLINE: any; + /** Draws an arrow that points left. */ + static LEFT_ARROW: any; + /** Draws a line. */ + static LINE: any; + /** Draws a Multipoint. */ + static MULTI_POINT: any; + /** Draws a point. */ + static POINT: any; + /** Draws a polygon. */ + static POLYGON: any; + /** Draws a polyline. */ + static POLYLINE: any; + /** Draws a rectangle. */ + static RECTANGLE: any; + /** Draws an arrow that points right. */ + static RIGHT_ARROW: any; + /** Draws a triangle. */ + static TRIANGLE: any; + /** Draws an arrow that points up. */ + static UP_ARROW: any; + /** Symbol to be used when drawing a Polygon or Extent. */ + fillSymbol: SimpleFillSymbol; + /** Symbol to be used when drawing a Polyline. */ + lineSymbol: SimpleLineSymbol; + /** Symbol to be used when drawing a Point or Multipoint. */ + markerSymbol: SimpleMarkerSymbol; + /** When set to false, the geometry is modified to be topologically correct. */ + respectDrawingVertexOrder: boolean; + /** + * Creates a new Draw object. + * @param map Map the toolbar is associated with. + * @param options Parameters that define the functionality of the draw toolbar. + */ + constructor(map: Map, options?: esri.DrawOptions); + /** + * Activates the toolbar for drawing geometries. + * @param geometryType The type of geometry drawn. + * @param options Options that define the functionality of the draw toolbar. + */ + activate(geometryType: string, options?: any): void; + /** Deactivates the toolbar and reactivates map navigation. */ + deactivate(): void; + /** Finishes drawing the geometry and fires the onDrawEnd event. */ + finishDrawing(): void; + /** + * Sets the fill symbol. + * @param fillSymbol The fill symbol. + */ + setFillSymbol(fillSymbol: FillSymbol): void; + /** + * Sets the line symbol. + * @param lineSymbol The line symbol. + */ + setLineSymbol(lineSymbol: LineSymbol): void; + /** + * Sets the marker symbol. + * @param markerSymbol The marker symbol. + */ + setMarkerSymbol(markerSymbol: MarkerSymbol): void; + /** + * Sets whether the polygon geometry should be modified to be topologically correct. + * @param set When set to false, the geometry is modified to be topologically correct. + */ + setRespectDrawingVertexOrder(set: boolean): void; + /** Fired when the user has ended drawing. */ + on(type: "draw-complete", listener: (event: { geographicGeometry: Geometry; geometry: Geometry; target: Draw }) => void): esri.Handle; + /** Fires when drawing is complete. */ + on(type: "draw-end", listener: (event: { geometry: Geometry; target: Draw }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = Draw; +} + +declare module "esri/toolbars/edit" { + import esri = require("esri"); + import Map = require("esri/map"); + import Graphic = require("esri/graphic"); + + /** The Edit toolbar is a helper class that provides functionality to move graphics or modify individual vertices, i.e., edit the geometry of existing graphics. */ + class Edit { + /** When a textSymbol point is in edit mode, double-clicking leads to text editing mode, which is a text box where uses can change the text content. */ + static EDIT_TEXT: any; + /** Display and edit vertices of a Polyline, Polygon, or Multipoint. */ + static EDIT_VERTICES: any; + /** Move graphic to a new location on the map. */ + static MOVE: any; + /** Rotate the graphic. */ + static ROTATE: any; + /** Scale or resize a graphic. */ + static SCALE: any; + /** + * Creates a new Edit object. + * @param map Map the toolbar is associated with. + * @param options Optional parameters. + */ + constructor(map: Map, options?: esri.EditOptions); + /** + * Activates the toolbar to edit the supplied graphic. + * @param tool Specify the active tool(s). + * @param graphic The graphic to edit. + * @param options See the object specifications table below for the structure of the options object. + */ + activate(tool: string, graphic: Graphic, options?: any): void; + /** Deactivates the toolbar. */ + deactivate(): void; + /** An object with the following properties that describe the current state. */ + getCurrentState(): any; + /** Refreshes the internal state of the toolbar. */ + refresh(): void; + /** Activates the toolbar for editing geometries. */ + on(type: "activate", listener: (event: { graphic: Graphic; tool: string; target: Edit }) => void): esri.Handle; + /** Deactivates the toolbar and reactivates map navigation. */ + on(type: "deactivate", listener: (event: { graphic: Graphic; info: any; tool: string; target: Edit }) => void): esri.Handle; + /** Fires when a graphic is clicked. */ + on(type: "graphic-click", listener: (event: { graphic: Graphic; info: any; target: Edit }) => void): esri.Handle; + /** Fires when the user begins to move a graphic. */ + on(type: "graphic-first-move", listener: (event: { graphic: Graphic; target: Edit }) => void): esri.Handle; + /** Fired continuously as the graphic moves. */ + on(type: "graphic-move", listener: (event: { graphic: Graphic; transform: any; target: Edit }) => void): esri.Handle; + /** Fired when the mouse button is pressed down on the graphic, usually while moving a graphic. */ + on(type: "graphic-move-start", listener: (event: { graphic: Graphic; target: Edit }) => void): esri.Handle; + /** Fired when the mouse button is released, usually after moving the graphic. */ + on(type: "graphic-move-stop", listener: (event: { graphic: Graphic; transform: any; target: Edit }) => void): esri.Handle; + /** Fires continuously as a graphic is rotated. */ + on(type: "rotate", listener: (event: { graphic: Graphic; info: any; target: Edit }) => void): esri.Handle; + /** Fires when the user begins to drag a handle to rotate the graphic. */ + on(type: "rotate-first-move", listener: (event: { graphic: Graphic; target: Edit }) => void): esri.Handle; + /** Fires when a user clicks on the handle to begin rotating a graphic. */ + on(type: "rotate-start", listener: (event: { graphic: Graphic; target: Edit }) => void): esri.Handle; + /** Fires when the mouse button is released from the rotate handle to finish rotating the graphic. */ + on(type: "rotate-stop", listener: (event: { graphic: Graphic; info: any; target: Edit }) => void): esri.Handle; + /** Fires continuously as the graphic is being scaled. */ + on(type: "scale", listener: (event: { graphic: Graphic; info: any; target: Edit }) => void): esri.Handle; + /** Fires when the user begins to drag a handle to scale the graphic. */ + on(type: "scale-first-move", listener: (event: { graphic: Graphic; target: Edit }) => void): esri.Handle; + /** Fires when a user clicks on the handle to scale or resize a graphic. */ + on(type: "scale-start", listener: (event: { graphic: Graphic; target: Edit }) => void): esri.Handle; + /** Fires when the mouse button is released from the scale handle to finish scaling the graphic. */ + on(type: "scale-stop", listener: (event: { graphic: Graphic; info: any; target: Edit }) => void): esri.Handle; + /** Fired after a new vertex is added to a polyline or polygon or a new point is added to a multipoint. */ + on(type: "vertex-add", listener: (event: { graphic: Graphic; vertexinfo: any; target: Edit }) => void): esri.Handle; + /** Fired when the mouse button is clicked on the vertex of a polyline or polygon or a point in a multipoint. */ + on(type: "vertex-click", listener: (event: { graphic: Graphic; vertexinfo: any; target: Edit }) => void): esri.Handle; + /** Fired after a vertex(polyline, polygon) or point(multipoint) is deleted. */ + on(type: "vertex-delete", listener: (event: { graphic: Graphic; vertexinfo: any; target: Edit }) => void): esri.Handle; + /** Fired when the user begins to move the vertex of a polyline or polygon or a point of a multipoint. */ + on(type: "vertex-first-move", listener: (event: { graphic: Graphic; vertexinfo: any; target: Edit }) => void): esri.Handle; + /** Fires as the mouse exits a vertex(polyline, polygon) or a point(multipoint). */ + on(type: "vertex-mouse-out", listener: (event: { graphic: Graphic; vertexinfo: any; target: Edit }) => void): esri.Handle; + /** Fired when the mouse moves over a vertex (polyline, polygon) or point (multipoint). */ + on(type: "vertex-mouse-over", listener: (event: { graphic: Graphic; vertexinfo: any; target: Edit }) => void): esri.Handle; + /** Fired continuously as the user is moving a vertex (polyline, polygon) or point (multipoint). */ + on(type: "vertex-move", listener: (event: { graphic: Graphic; transform: any; vertexinfo: any; target: Edit }) => void): esri.Handle; + /** Fired when the mouse button is pressed down on a vertex (polyline, polygon) or point (multipoint). */ + on(type: "vertex-move-start", listener: (event: { graphic: Graphic; vertexinfo: any; target: Edit }) => void): esri.Handle; + /** Fired when the mouse button is released from a vertex (polyline, polygon) or point(multipoint). */ + on(type: "vertex-move-stop", listener: (event: { graphic: Graphic; transform: any; vertexinfo: any; target: Edit }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = Edit; +} + +declare module "esri/toolbars/navigation" { + import esri = require("esri"); + import Map = require("esri/map"); + import Symbol = require("esri/symbols/Symbol"); + + /** Toolbar that supports basic navigation such as pan and zoom. */ + class Navigation { + /** Map is panned. */ + static PAN: any; + /** Map zooms in. */ + static ZOOM_IN: any; + /** Map zooms out. */ + static ZOOM_OUT: any; + /** + * Creates a new Navigation object. + * @param map Map the toolbar is associated with. + */ + constructor(map: Map); + /** + * Activates the toolbar for map navigation. + * @param navType The navigation type. + */ + activate(navType: string): void; + /** Deactivates the toolbar and reactivates map navigation. */ + deactivate(): void; + /** When "true", map is at the first extent. */ + isFirstExtent(): boolean; + /** When "true", map is at the last extent. */ + isLastExtent(): boolean; + /** + * Set the SimpleFillSymbol used for the rubber band zoom. + * @param symbol The SimpleFillSymbol used for the rubber band zoom. + */ + setZoomSymbol(symbol: Symbol): void; + /** Zoom to full extent of base layer. */ + zoomToFullExtent(): void; + /** Zoom to next extent in extent history. */ + zoomToNextExtent(): void; + /** Zoom to previous extent in extent history. */ + zoomToPrevExtent(): void; + /** Fires when the extent history changes. */ + on(type: "extent-history-change", listener: (event: { target: Navigation }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = Navigation; +} + +declare module "esri/undoManager" { + import esri = require("esri"); + import OperationBase = require("esri/OperationBase"); + + /** The UndoManager is a utility object that allows you to easily build applications with undo/redo functionality. */ + class UndoManager { + /** When true, there are redo operations available on the stack. */ + canRedo: boolean; + /** When true, there are undo operations available on the stack. */ + canUndo: boolean; + /** The number of operations stored in the history stack. */ + length: number; + /** The current operation position. */ + position: number; + /** + * Creates a new UndoManager object. + * @param options See options list for parameters. + */ + constructor(options?: esri.UndoManagerOptions); + /** + * Adds an undo operation to the stack and clears the redo stack. + * @param operation An operation to add to the stack. + */ + add(operation: OperationBase): void; + /** Clear the redo stack */ + clearRedo(): void; + /** Clear the undo stack. */ + clearUndo(): void; + /** Destroy the operation manager. */ + destroy(): void; + /** + * Get the specified operation from the stack. + * @param operationId The operation id. + */ + get(operationId: number): OperationBase; + /** Get the next redo operation from the stack */ + peekRedo(): OperationBase; + /** Get the next undo operation from the stack. */ + peekUndo(): OperationBase; + /** Moves the current position to the next redo operation and calls the operation's performRedo() method. */ + redo(): void; + /** + * Remove the specified operation from the stack. + * @param operationId The operation id. + */ + remove(operationId: number): OperationBase; + /** Moves the current position to the next undo operation and calls the operation's performUndo method. */ + undo(): void; + /** Fires when the add method is called to add an operation is added to the stack. */ + on(type: "add", listener: (event: { target: UndoManager }) => void): esri.Handle; + /** Fires when the undo/redo stack changes. */ + on(type: "change", listener: (event: { target: UndoManager }) => void): esri.Handle; + /** Fires when the redo method is called. */ + on(type: "redo", listener: (event: { target: UndoManager }) => void): esri.Handle; + /** Fires when the undo method is called. */ + on(type: "undo", listener: (event: { target: UndoManager }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = UndoManager; +} + +declare module "esri/units" { + /** Esri unit constants. */ + class Units { + /** Units are acres. */ + static ACRES: any; + /** Units are ares. */ + static ARES: any; + /** Units are centimeters. */ + static CENTIMETERS: any; + /** Units are decimal degrees. */ + static DECIMAL_DEGREES: any; + /** Units are decimeters. */ + static DECIMETERS: any; + /** Units are degree, minute, seconds. */ + static DEGREE_MINUTE_SECONDS: any; + /** Units are feet. */ + static FEET: any; + /** Units are hectares. */ + static HECTARES: any; + /** Units are inches. */ + static INCHES: any; + /** Units are kilometers. */ + static KILOMETERS: any; + /** Units are meters. */ + static METERS: any; + /** Units are miles. */ + static MILES: any; + /** Units are millimeters. */ + static MILLIMETERS: any; + /** Units are nautical miles. */ + static NAUTICAL_MILES: any; + /** Units are points. */ + static POINTS: any; + /** Units are square centimeters. */ + static SQUARE_CENTIMETERS: any; + /** Units are square deciemeters. */ + static SQUARE_DECIMETERS: any; + /** Units are square feet. */ + static SQUARE_FEET: any; + /** Units are square inches. */ + static SQUARE_INCHES: any; + /** Units are square kilometers. */ + static SQUARE_KILOMETERS: any; + /** Units are square meters. */ + static SQUARE_METERS: any; + /** Units are square miles. */ + static SQUARE_MILES: any; + /** Units are square millimeters. */ + static SQUARE_MILLIMETERS: any; + /** Units are square yards. */ + static SQUARE_YARDS: any; + /** Units are unknown. */ + static UNKNOWN: any; + /** Units are yards. */ + static YARDS: any; + } + export = Units; +} + +declare module "esri/urlUtils" { + /** Utility methods for working with URLs. */ + var urlUtils: { + /** + * Adds the given proxy rule to the proxy rules list: esri.config.defaults.io.proxyRules + * @param rule The rule argument should have the following properties. + */ + addProxyRule(rule: any): number; + /** Returns the proxy rule that matches the given url. */ + getProxyRule(): any; + /** + * Converts the URL arguments to an object representation. + * @param url The input URL. + */ + urlToObject(url: string): any; + }; + export = urlUtils; +} + +declare module "esri/virtualearth/VEAddress" { + /** The Bing Maps address details. */ + class VEAddress { + /** Specifies the street line of an address. */ + addressLine: string; + /** Specifies the subdivision name within the country or region for an address. */ + adminDistrict: string; + /** Specifies the country or region name of an address. */ + countryRegion: string; + /** Specifies the higher level administrative subdivision used in some countries or regions. */ + district: string; + /** Contains the complete address. */ + formattedAddress: string; + /** Specifies the populated place for the address. */ + locality: string; + /** Specifies the post code, postal code, or ZIP Code of an address. */ + postalCode: string; + /** Specifies the postal city of an address. */ + postalTown: string; + } + export = VEAddress; +} + +declare module "esri/virtualearth/VEGeocodeResult" { + import VEAddress = require("esri/virtualearth/VEAddress"); + import Extent = require("esri/geometry/Extent"); + import Point = require("esri/geometry/Point"); + + /** Represents a Bing Maps address and its location. */ + class VEGeocodeResult { + /** Specifies address properties for the result. */ + address: VEAddress; + /** Best extent for displaying the result. */ + bestView: Extent; + /** Contains values that indicate the geocode method used to match the location to the map. */ + calculationMethod: string; + /** Value indicating how confident the service is about the result. */ + confidence: string; + /** Contains a display name for the result. */ + displayName: string; + /** Further refines the geocode results that have been returned. */ + entityType: string; + /** The X and Y coordinates of the result in decimal degrees. */ + location: Point; + /** An array of values that indicate the geocoding level of the location match. */ + matchCodes: string; + } + export = VEGeocodeResult; +} + +declare module "esri/virtualearth/VEGeocoder" { + import esri = require("esri"); + import VEGeocodeResult = require("esri/virtualearth/VEGeocodeResult"); + + /** Bing Maps geocoder. */ + class VEGeocoder { + /** Specifies the culture in which to return results. */ + culture: string; + /** + * Creates a new VEGeocoder object. + * @param options See options list for parameters. + */ + constructor(options: esri.VEGeocoderOptions); + /** + * Sends a geocode request to Bing Maps to find candidates for a single address specified in the query argument. + * @param query The address to locate. + * @param callback The function to call when the method has completed. + * @param errback An error object is returned if an error occurs during task execution. + */ + addressToLocations(query: string, callback?: Function, errback?: Function): any; + /** + * Sets the culture in which to return results. + * @param culture The culture value. + */ + setCulture(culture: string): void; + /** Fires when VEGeocode.addressToLocation() has completed. */ + on(type: "address-to-locations-complete", listener: (event: { geocodeResults: VEGeocodeResult[]; target: VEGeocoder }) => void): esri.Handle; + /** Fires when an error occurs when executing the task. */ + on(type: "error", listener: (event: { error: Error; target: VEGeocoder }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = VEGeocoder; +} + +declare module "esri/virtualearth/VETiledLayer" { + import esri = require("esri"); + import TiledMapServiceLayer = require("esri/layers/TiledMapServiceLayer"); + + /** Bing Maps tiled layer. */ + class VETiledLayer extends TiledMapServiceLayer { + /** Bing Maps Aerial layer. */ + static MAP_STYLE_AERIAL: any; + /** Bing Maps Aerial with Labels layer. */ + static MAP_STYLE_AERIAL_WITH_LABELS: any; + /** Bing Maps Roads layer. */ + static MAP_STYLE_ROAD: any; + /** The copyright text. */ + copyright: string; + /** Specifies the culture in which to return results. */ + culture: string; + /** Bing Maps style. */ + mapStyle: string; + /** + * Creates a new VETiledLayer object. + * @param options See options list for parameters. + */ + constructor(options: esri.VETiledLayerOptions); + /** + * Sets the culture in which to return results. + * @param culture The culture value. + */ + setCulture(culture: string): void; + /** + * Sets the Bing Maps style. + * @param style Bing Maps style. + */ + setMapStyle(style: string): void; + /** Fires when the map style is changed. */ + on(type: "map-style-change", listener: (event: { target: VETiledLayer }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = VETiledLayer; +} + +declare module "esri/workers/WorkerClient" { + /** The WorkerClient is the primary entry point for interfacing with background Workers. */ + class WorkerClient { + /** Return Deferreds rather than Promises from postMessage. */ + returnDeferreds: boolean; + /** Reference to the actual HTML5 Worker instance. */ + worker: Worker; + /** + * Creates a WorkerClient. + * @param path A require style string path to the worker script. + * @param deferreds Whether to return Deferreds rather than Promises from methods. + */ + constructor(path: string, deferreds?: boolean); + /** + * Adds a function to the worker that takes the worker's internal calls to postMessage and calls this function before sending the original message back to the main thread. + * @param module A require path to a worker-compatible script containing the callback function. + * @param name The name of the callback function. + */ + addWorkerCallback(module: string, name?: string): any; + /** + * Import any script or function into the worker. + * @param paths An AMD require path to a script file to import. + */ + importScripts(paths: string): any; + /** + * Import any script or function into the worker. + * @param paths An AMD require path to a script file to import. + */ + importScripts(paths: string[]): any; + /** + * Posts a message to the worker. + * @param msg The data to post to the worker. + * @param transfers An optional array of transferable objects. + */ + postMessage(msg: any, transfers?: any[]): any; + /** + * Posts a message to the worker. + * @param msg The data to post to the worker. + * @param transfers An optional array of transferable objects. + */ + postMessage(msg: any[], transfers?: any[]): any; + /** + * Sets the worker that is used in the Worker Client. + * @param paths An AMD require path to a script file to import. + */ + setWorker(paths: string): void; + /** + * Sets the worker that is used in the Worker Client. + * @param paths An AMD require path to a script file to import. + */ + setWorker(paths: string[]): void; + /** Terminates the worker and cancels all unresolved messages. */ + terminate(): void; + } + export = WorkerClient; +} + diff --git a/async/async-explicit-tests.ts.tscparams b/async/async-explicit-tests.ts.tscparams deleted file mode 100644 index 3195c46cd..000000000 --- a/async/async-explicit-tests.ts.tscparams +++ /dev/null @@ -1 +0,0 @@ ---noImplicitAny diff --git a/autobahn/autobahn-tests.ts b/autobahn/autobahn-tests.ts new file mode 100644 index 000000000..ee9c41b3e --- /dev/null +++ b/autobahn/autobahn-tests.ts @@ -0,0 +1,47 @@ +/// + +class MyClass { + add2Count: number = 0; + session: autobahn.Session; + + constructor(session: autobahn.Session) { + this.session = session; + } + + add2(args: Array): number { + this.add2Count++; + return args[0] + args[1]; + } + + onEvent(args: Array): void { + console.log("Event:", args[0]); + } +} + +function test_client() { + var options: autobahn.IConnectionOptions = + { url: 'ws://127.0.0.1:8080/ws', realm: 'realm1' }; + + var connection = new autobahn.Connection(options); + + connection.onopen = session => { + var myInstance = new MyClass(session); + + // 1) subscribe to a topic + session.subscribe('com.myapp.hello', myInstance.onEvent); + + // 2) publish an event + session.publish('com.myapp.hello', ['Hello, world!']); + + // 3) register a procedure for remoting + session.register('com.myapp.add2', myInstance.add2); + + // 4) call a remote procedure + session.call('com.myapp.add2', [2, 3]).then( + res => { + console.log("Result:", res); + }); + }; + + connection.open(); +} \ No newline at end of file diff --git a/autobahn/autobahn.d.ts b/autobahn/autobahn.d.ts new file mode 100644 index 000000000..7191e9c4f --- /dev/null +++ b/autobahn/autobahn.d.ts @@ -0,0 +1,195 @@ +// Type definitions for AutobahnJS v0.9.6 +// Project: http://autobahn.ws/js/ +// Definitions by: Elad Zelingher +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// +declare module autobahn { + + export class Session { + id: number; + realm: string; + isOpen: boolean; + features: any; + caller_disclose_me: boolean; + publisher_disclose_me: boolean; + subscriptions: ISubscription[][]; + registrations: IRegistration[]; + + constructor(transport: ITransport, defer: DeferFactory, challenge: OnChallengeHandler); + + join(realm: string, authmethods: string[], authid: string): void; + + leave(reason: string, message: string): void; + + call(procedure: string, args?: any[], kwargs?: any, options?: ICallOptions): When.Promise; + + publish(topic: string, args?: any[], kwargs?: any, options?: IPublishOptions): When.Promise; + + subscribe(topic: string, handler: SubscribeHandler, options?: ISubscribeOptions): When.Promise; + + register(procedure: string, endpoint: RegisterEndpoint, options?: IRegisterOptions): When.Promise; + + unsubscribe(subscription: ISubscription): When.Promise; + + unregister(registration: IRegistration): When.Promise; + + prefix(prefix: string, uri: string): void; + + resolve(curie: string): string; + + onjoin: (roleFeatures: any) => void; + onleave: (reason: string, details: any) => void; + } + + interface IInvocation { + caller?: number; + progress?: boolean; + procedure: string; + } + + interface IEvent { + publication: number; + publisher?: number; + topic: string; + } + + interface IResult { + args: any[]; + kwargs: any; + } + + interface IError { + error: string; + args: any[]; + kwargs: any; + } + + type SubscribeHandler = (args?: any[], kwargs?: any, details?: IEvent) => void; + + interface ISubscription { + topic: string; + handler: SubscribeHandler; + options: ISubscribeOptions; + session: Session; + id: number; + active: boolean; + unsubscribe(): When.Promise; + } + + type RegisterEndpoint = (args?: any[], kwargs?: any, details?: IInvocation) => void; + + interface IRegistration { + procedure: string; + endpoint: RegisterEndpoint; + options: IRegisterOptions; + session: Session; + id: number; + active: boolean; + unregister(): When.Promise; + } + + interface IPublication { + id: number; + } + + interface ICallOptions { + timeout?: number; + receive_progress?: boolean; + disclose_me?: boolean; + } + + interface IPublishOptions { + exclude?: number[]; + eligible?: number[]; + disclose_me? : Boolean; + } + + interface ISubscribeOptions { + match? : string; + } + + interface IRegisterOptions { + disclose_caller?: boolean; + } + + export class Connection { + constructor(options?: IConnectionOptions); + + open(): void; + + close(reason: string, message: string): void; + + onopen: (session: Session, details: any) => void; + onclose: (reason: string, details: any) => boolean; + } + + interface ITransportDefinition { + url?: string; + protocols?: string[]; + type: string; + } + + type DeferFactory = () => any; + + type OnChallengeHandler = (session: Session, method: string, extra: any) => When.Promise; + + interface IConnectionOptions { + use_es6_promises?: boolean; + // use explicit deferred factory, e.g. jQuery.Deferred or Q.defer + use_deferred?: DeferFactory; + transports?: ITransportDefinition[]; + retry_if_unreachable?: boolean; + max_retries?: number; + initial_retry_delay?: number; + max_retry_delay?: number; + retry_delay_growth?: number; + retry_delay_jitter?: number; + url?: string; + protocols?: string[]; + onchallenge?: (session: Session, method: string, extra: any) => OnChallengeHandler; + realm?: string; + authmethods?: string[]; + authid?: string; + } + + interface ICloseEventDetails { + wasClean: boolean; + reason: string; + code: number; + } + + interface ITransport { + onopen: () => void; + onmessage: (message: any[]) => void; + onclose: (details: ICloseEventDetails) => void; + + send(message: any[]): void; + close(errorCode: number, reason?: string): void; + } + + interface ITransportFactory { + //constructor(options: any); + type: string; + create(): ITransport; + } + + interface ITransports { + register(name: string, factory: any): void; + isRegistered(name: string): boolean; + get(name: string): any; + list(): any[]; + } + + interface ILog { + debug(...args: any[]): void; + } + + interface IUtil { + assert(condition: boolean, message: string): void; + } + + var util: IUtil; + var log: ILog; + var transports: ITransports; +} \ No newline at end of file diff --git a/axios/axios-tests.ts b/axios/axios-tests.ts new file mode 100644 index 000000000..93787cf3d --- /dev/null +++ b/axios/axios-tests.ts @@ -0,0 +1,18 @@ +/// + +enum HttpMethod { GET, PUT, POST, DELETE, CONNECT, HEAD, OPTIONS, TRACE, PATCH } +enum ResponseType { arraybuffer, blob, document, json, text } + +interface Repository { + id: number; + name: string; +} + +axios.get("https://api.github.com/repos/mzabriskie/axios") + .then(r => console.log(r.config.method)); + +axios({ + url: "https://api.github.com/repos/mzabriskie/axios", + method: HttpMethod[HttpMethod.GET], + headers: {}, +}).then(r => console.log("ID:" + r.data.id + " Name: " + r.data.name)); diff --git a/axios/axios.d.ts b/axios/axios.d.ts new file mode 100644 index 000000000..c2a2873ea --- /dev/null +++ b/axios/axios.d.ts @@ -0,0 +1,162 @@ +// Type definitions for axios 0.5.2 +// Project: https://github.com/mzabriskie/axios +// Definitions by: Marcel Buesing +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module Axios { + + /** + * - request body data type + */ + interface AxiosXHRConfigBase { + + /** + * Change the request data before it is sent to the server. + * This is only applicable for request methods 'PUT', 'POST', and 'PATCH' + * The last function in the array must return a string or an ArrayBuffer + */ + transformRequest?: (data:T) => U; + + /** + * change the response data to be made before it is passed to then/catch + */ + transformResponse?: (data:T) => U; + + /** + * custom headers to be sent + */ + headers?: Object; + + /** + * URL parameters to be sent with the request + */ + params?: Object; + + /** + * indicates whether or not cross-site Access-Control requests + * should be made using credentials + */ + withCredentials?: boolean; + + /** + * indicates the type of data that the server will respond with + * options are 'arraybuffer', 'blob', 'document', 'json', 'text' + */ + responseType?: string; + + /** + * name of the cookie to use as a value for xsrf token + */ + xsrfCookieName?: string; + + /** + * name of the http header that carries the xsrf token value + */ + xsrfHeaderName?: string; + + } + + /** + * - request body data type + */ + interface AxiosXHRConfig extends AxiosXHRConfigBase { + /** + * server URL that will be used for the request, options are: + * GET, PUT, POST, DELETE, CONNECT, HEAD, OPTIONS, TRACE, PATCH + */ + url: string; + + /** + * request method to be used when making the request + */ + method?: string; + + /** + * data to be sent as the request body + * Only applicable for request methods 'PUT', 'POST', and 'PATCH' + * When no `transformRequest` is set, must be a string, an ArrayBuffer or a hash + */ + data?: T; + } + + /** + * - expected response type, + * - request body data type + */ + interface AxiosXHR { + /** + * Response that was provided by the server + */ + data: T; + + /** + * HTTP status code from the server response + */ + status: number; + + /** + * HTTP status message from the server response + */ + statusText: string; + + /** + * headers that the server responded with + */ + headers: Object; + + /** + * config that was provided to `axios` for the request + */ + config: AxiosXHRConfig; + } + + /** + * - expected response type, + * - request body data type + */ + interface AxiosStatic { + + (config: AxiosXHRConfig): Promise>; + + new (config: AxiosXHRConfig): Promise>; + + /** + * convenience alias, method = GET + */ + get(url: string, config?: AxiosXHRConfigBase): Promise>; + + + /** + * convenience alias, method = DELETE + */ + delete(url: string, config?: AxiosXHRConfigBase): Promise>; + + /** + * convenience alias, method = HEAD + */ + head(url: string, config?: AxiosXHRConfigBase): Promise>; + + /** + * convenience alias, method = POST + */ + post(url: string, data?: any, config?: AxiosXHRConfigBase): Promise>; + + /** + * convenience alias, method = PUT + */ + put(url: string, data?: any, config?: AxiosXHRConfigBase): Promise>; + + /** + * convenience alias, method = PATCH + */ + patch(url: string, data?: any, config?: AxiosXHRConfigBase): Promise>; + } +} + +declare var axios: Axios.AxiosStatic; + +declare module "axios" { + export = axios; +} diff --git a/backbone.paginator/backbone.paginator-tests.ts b/backbone.paginator/backbone.paginator-tests.ts new file mode 100644 index 000000000..413c4c373 --- /dev/null +++ b/backbone.paginator/backbone.paginator-tests.ts @@ -0,0 +1,305 @@ +/// +/// +/// + +module BackbonePaginatorTests { + + class TestModel extends Backbone.Model{}; + + var makeFetchOptions = >() => { + return { + reset: true, + url: 'example.com', + beforeSend: (jqxhr: JQueryXHR) => {}, + success: (model: TestModel, response: any, options: any) => {}, + error: (collection: TCol, jqxhr: JQueryXHR, options: any) => {}, + parse: '', + }; + }; + + + module InitializingWithNoOption { + + class TestCollection extends Backbone.PageableCollection { + constructor(){ + super(); + } + } + + var testCollection = new TestCollection(); + + } + + + + module InitializingWithOptions { + + class TestCollection extends Backbone.PageableCollection { + + constructor(models?: TestModel[], + options?: Backbone.PageableInitialOptions){ + super(); + } + + } + + var testCollection1 = new TestCollection(); + + var testCollection2 = new TestCollection([ + new TestModel(), + new TestModel() + ]); + + var testCollection3 = new TestCollection([], {}); + + var testCollection4 = new TestCollection([],{ + comparator: ()=>1, + full: true, + state: {}, + queryParam: {}, + }); + + var testCollection5 = new TestCollection([],{ + state: { + firstPage: 0, + lastPage: 0, + currentPage: 0, + pageSize: 1, + totalPages: 1, + totalRecords: 1, + sortKey: 'id', + order: 1, + }, + queryParam: { + currentPage: 'current_page', + pageSize: 'page_size', + totalPages: 'total_pages', + totalRecords: 'total_records', + sortKey: 'sort_key', + order: 'order', + directions: '', + }, + }); + + var testCollection6 = new TestCollection([ + {}, + {}, + ]); + + } + + + + module Fetching { + + class TestCollection extends Backbone.PageableCollection { + constructor(models?: TestModel[], + options?: Backbone.PageableInitialOptions){ + super(); + } + } + + + var testCollection = new TestCollection(); + + var result:JQueryXHR = testCollection.fetch(); + + testCollection.fetch({}); + + testCollection.fetch(makeFetchOptions()); + + } + + + + module Paging { + + class TestCollection extends Backbone.PageableCollection { + constructor(models?: TestModel[], + options?: Backbone.PageableInitialOptions){ + super(); + } + } + + var options = makeFetchOptions(); + + var testCollection = new TestCollection(); + + + var result:JQueryXHR|TestCollection = testCollection.getFirstPage(); + + testCollection.getFirstPage(options); + + // 'silent's type is boolean. (structural subtyping) + testCollection.getFirstPage({silent: 'aa'}); + // 'url's type is string. (structural subtyping) + testCollection.getFirstPage({url: true}); + + + result = testCollection.getLastPage(); + + testCollection.getLastPage(options); + + // 'silent's type is boolean. (structural subtyping) + testCollection.getLastPage({silent: 'aa'}); + // 'url's type is string. (structural subtyping) + testCollection.getLastPage({url: true}); + + + result = testCollection.getNextPage(); + + testCollection.getNextPage(options); + + // 'silent's type is boolean. (structural subtyping) + testCollection.getNextPage({silent: 'aa'}); + // 'url's type is string. (structural subtyping) + testCollection.getNextPage({url: true}); + + + result = testCollection.getPage(1); + + testCollection.getPage("1", options); + + // 'silent's type is boolean. (structural subtyping) + testCollection.getPage(1, {silent: 'aa'}); + // 'url's type is string. (structural subtyping) + testCollection.getPage(1, {url: true}); + + + result = testCollection.getPageByOffset(1); + + testCollection.getPageByOffset(1, options); + + // 'silent's type is boolean. (structural subtyping) + testCollection.getPageByOffset(1, {silent: 'aa'}); + // 'url's type is string. (structural subtyping) + testCollection.getPageByOffset(1, {url: true}); + + + result = testCollection.getPreviousPage(); + + testCollection.getPreviousPage(options); + + // 'silent's type is boolean. (structural subtyping) + testCollection.getPreviousPage({silent: 'aa'}); + // 'url's type is string. (structural subtyping) + testCollection.getPreviousPage({url: true}); + + + var hasPage:boolean = testCollection.hasNextPage(); + + hasPage = testCollection.hasPreviousPage(); + + } + + + + + module Parse { + + class TestCollection extends Backbone.PageableCollection { + constructor(models?: TestModel[], + options?: Backbone.PageableInitialOptions){ + super(); + } + } + + var testCollection = new TestCollection(); + + var result:any[] = testCollection.parse({}, {}); + + + var resultLinks:any = testCollection.parseLinks({}, {}); + + resultLinks = testCollection.parseLinks({}, { xhr: $.ajax({}) } ); + + + result = testCollection.parseRecords({}, {}); + + + var resultState: Backbone.PageableState = testCollection.parseState( + {}, + { + currentPage: 'current_page', + pageSize: 'page_size', + totalPages: 'total_pages', + totalRecords: 'total_records', + sortKey: 'sort_key', + order: 'order', + directions: '', + }, + { + firstPage: 0, + lastPage: 0, + currentPage: 0, + pageSize: 1, + totalPages: 1, + totalRecords: 1, + sortKey: 'id', + order: 1, + }, + {}); + + } + + + + module Setting { + + class TestCollection extends Backbone.PageableCollection { + constructor(models?: TestModel[], + options?: Backbone.PageableInitialOptions){ + super(); + } + } + + var testCollection = new TestCollection(); + + var options = makeFetchOptions(); + + + var result1:JQueryXHR|TestCollection + = testCollection.setPageSize(1, options); + + + var result2:TestCollection + = testCollection.setSorting('id', 1, options); + + + result1 = testCollection.switchMode( + 'server', + {fetch: true, resetState: true} + ); + + } + + + + module Syncing { + + class TestCollection extends Backbone.PageableCollection { + constructor(models?: TestModel[], + options?: Backbone.PageableInitialOptions){ + super(); + } + } + + var testCollection = new TestCollection(); + + + var result:JQueryXHR = testCollection.sync('server', new TestModel(), {}); + + result = testCollection.sync('server', testCollection, {}); + + } + + + + module Confllict { + + var result:typeof Backbone.PageableCollection + = Backbone.PageableCollection.noConflict(); + + } + +} diff --git a/backbone.paginator/backbone.paginator.d.ts b/backbone.paginator/backbone.paginator.d.ts new file mode 100644 index 000000000..6eb560cc8 --- /dev/null +++ b/backbone.paginator/backbone.paginator.d.ts @@ -0,0 +1,116 @@ +// Type definitions for backbone.paginator 2.0.2 +// Project: https://github.com/backbone-paginator/backbone.paginator +// Definitions by: Nyamazing +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module Backbone { + + interface PageableState { + firstPage?: number; + lastPage?: number; + currentPage?: number; + pageSize?: number; + totalPages?: number; + totalRecords?: number; + sortKey?: string; + order?: number; + } + + interface PageableQueryParams { + currentPage?: string; + pageSize?: string; + totalPages?: string; + totalRecords?: string; + sortKey?: string; + order?: string; + directions?: any; + } + + interface PageableInitialOptions { + comparator?: (...options: any[]) => number; + full?: boolean; + state?: PageableState; + queryParam?: PageableQueryParams; + } + + interface PageableParseLinksOptions { + xhr?: JQueryXHR; + } + + interface PageableSetSortingOptions { + side?: string; + full?: boolean; + sortValue?: (model: TModel, sortKey: string) => any | string; + } + + interface PageableSwitchModeOptions { + fetch?: boolean; + resetState?: boolean; + } + + type PageableGetPageOptions = CollectionFetchOptions|Silenceable; + + class PageableCollection extends Collection{ + + fullCollection: Collection; + mode: string; + queryParams: PageableQueryParams; + state: PageableState; + + constructor(models?: TModel[], options?: PageableInitialOptions); + + fetch(options?: CollectionFetchOptions): JQueryXHR; + + getFirstPage(options?: PageableGetPageOptions): + JQueryXHR|PageableCollection; + + getLastPage(options?: PageableGetPageOptions): + JQueryXHR|PageableCollection; + + getNextPage(options?: PageableGetPageOptions): + JQueryXHR|PageableCollection; + + getPage(index: number|string, options?: PageableGetPageOptions): + JQueryXHR|PageableCollection; + + getPageByOffset(offset: number, options?: PageableGetPageOptions): + JQueryXHR|PageableCollection; + + getPreviousPage(options?: PageableGetPageOptions): + JQueryXHR|PageableCollection; + + hasNextPage(): boolean; + + hasPreviousPage(): boolean; + + parse(resp: any, options?: any): any[]; + + parseLinks(resp: any, options?: PageableParseLinksOptions): any; + + parseRecords(resp: any, options?: any): any[]; + + parseState(resp: any, queryParams: PageableQueryParams, + state: PageableState, options?: any): PageableState; + + setPageSize(pageSize: number, + options?: CollectionFetchOptions): + JQueryXHR|PageableCollection; + + setSorting(sortKey: string, order?: number, + options?: PageableSetSortingOptions): + PageableCollection; + + switchMode(mode?: string, options?: PageableSwitchModeOptions): + JQueryXHR|PageableCollection; + + sync(method: string, + model: TModel|Collection, + options?: any): JQueryXHR; + + static noConflict(): typeof PageableCollection; + + } +} + diff --git a/backgrid/backgrid.d.ts.tscparams b/backgrid/backgrid.d.ts.tscparams index d3f5a12fa..aa5e71c8a 100644 --- a/backgrid/backgrid.d.ts.tscparams +++ b/backgrid/backgrid.d.ts.tscparams @@ -1 +1 @@ - +--target es5 diff --git a/bluebird/bluebird.d.ts b/bluebird/bluebird.d.ts index 93c81138a..424cdcbf2 100644 --- a/bluebird/bluebird.d.ts +++ b/bluebird/bluebird.d.ts @@ -404,7 +404,12 @@ declare class Promise implements Promise.Thenable, Promise.Inspection { * * If you pass a `receiver`, the `nodeFunction` will be called as a method on the `receiver`. */ - // TODO how to model promisify? + static promisify(func: (callback: (err:any, result: T) => void) => void, receiver?: any): () => Promise; + static promisify(func: (arg1: A1, callback: (err: any, result: T) => void) => void, receiver?: any): (arg1: A1) => Promise; + static promisify(func: (arg1: A1, arg2: A2, callback: (err: any, result: T) => void) => void, receiver?: any): (arg1: A1, arg2: A2) => Promise; + static promisify(func: (arg1: A1, arg2: A2, arg3: A3, callback: (err: any, result: T) => void) => void, receiver?: any): (arg1: A1, arg2: A2, arg3: A3) => Promise; + static promisify(func: (arg1: A1, arg2: A2, arg3: A3, arg4: A4, callback: (err: any, result: T) => void) => void, receiver?: any): (arg1: A1, arg2: A2, arg3: A3, arg4: A4) => Promise; + static promisify(func: (arg1: A1, arg2: A2, arg3: A3, arg4: A4, arg5: A5, callback: (err: any, result: T) => void) => void, receiver?: any): (arg1: A1, arg2: A2, arg3: A3, arg4: A4, arg5: A5) => Promise; static promisify(nodeFunction: Function, receiver?: any): Function; /** diff --git a/blueimp-md5/blueimp-md5-tests.ts b/blueimp-md5/blueimp-md5-tests.ts new file mode 100644 index 000000000..5e3808309 --- /dev/null +++ b/blueimp-md5/blueimp-md5-tests.ts @@ -0,0 +1,7 @@ +/// + +import blueimp = require('blueimp-md5'); + +function hash(): boolean { + return blueimp.md5('hello world') === '5eb63bbbe01eeed093cb22bb8f5acdc3'; +} diff --git a/blueimp-md5/blueimp-md5.d.ts b/blueimp-md5/blueimp-md5.d.ts new file mode 100644 index 000000000..37c3f3c00 --- /dev/null +++ b/blueimp-md5/blueimp-md5.d.ts @@ -0,0 +1,7 @@ +// Type definitions for blueimp-md5 v1.1.0 +// Project: https://github.com/blueimp/JavaScript-MD5 +// Definitions by: Ray Martone +// Definitions: https://github.com/borisyankov/DefinitelyTyped +declare module 'blueimp-md5' { + export function md5(value: string, key?: string, raw?: boolean): string; +} diff --git a/boom/boom.d.ts b/boom/boom.d.ts index 3a3f18fa2..d0f05065c 100644 --- a/boom/boom.d.ts +++ b/boom/boom.d.ts @@ -24,7 +24,33 @@ declare module Boom { export function wrap(error: Error, statusCode?: number, message?: string): BoomError; export function create(statusCode: number, message?: string, data?: any): BoomError; + // 4xx export function badRequest(message?: string, data?: any): BoomError; + export function unauthorized(message?: string, scheme?: any, attributes?: any): BoomError; + export function forbidden(message?: string, data?: any): BoomError; + export function notFound(message?: string, data?: any): BoomError; + export function methodNotAllowed(message?: string, data?: any): BoomError; + export function notAcceptable(message?: string, data?: any): BoomError; + export function proxyAuthRequired(message?: string, data?: any): BoomError; + export function clientTimeout(message?: string, data?: any): BoomError; + export function conflict(message?: string, data?: any): BoomError; + export function resourceGone(message?: string, data?: any): BoomError; + export function lengthRequired(message?: string, data?: any): BoomError; + export function preconditionFailed(message?: string, data?: any): BoomError; + export function entityTooLarge(message?: string, data?: any): BoomError; + export function uriTooLong(message?: string, data?: any): BoomError; + export function unsupportedMediaType(message?: string, data?: any): BoomError; + export function rangeNotSatisfiable(message?: string, data?: any): BoomError; + export function expectationFailed(message?: string, data?: any): BoomError; + export function badData(message?: string, data?: any): BoomError; + export function tooManyRequests(message?: string, data?: any): BoomError; + + // 5xx + export function notImplemented(message?: string, data?: any): BoomError; + export function badGateway(message?: string, data?: any): BoomError; + export function serverTimeout(message?: string, data?: any): BoomError; + export function gatewayTimeout(message?: string, data?: any): BoomError; + export function badImplementation(message?: string, data?: any): BoomError; } declare module "boom" { diff --git a/byline/byline.d.ts b/byline/byline.d.ts index 6dac6ad50..475386b28 100644 --- a/byline/byline.d.ts +++ b/byline/byline.d.ts @@ -9,7 +9,7 @@ declare module "byline" { import stream = require("stream"); export interface LineStreamOptions extends stream.TransformOptions { - keepEmptyLines: boolean; + keepEmptyLines?: boolean; } export interface LineStream extends stream.Transform { @@ -35,4 +35,4 @@ declare module "byline" { export function createStream(stream:NodeJS.ReadableStream, options?:LineStreamOptions):LineStream; export var LineStream:LineStreamCreatable; -} \ No newline at end of file +} diff --git a/chai/chai.d.ts b/chai/chai.d.ts index ff5526189..4b9d313dd 100644 --- a/chai/chai.d.ts +++ b/chai/chai.d.ts @@ -1,4 +1,4 @@ -// Type definitions for chai 1.7.2 +// Type definitions for chai 2.0.0 // Project: http://chaijs.com/ // Definitions by: Jed Hunsaker , Bart van der Schoor // Definitions: https://github.com/borisyankov/DefinitelyTyped @@ -92,6 +92,7 @@ declare module chai { been: Expect; is: Expect; that: Expect; + which: Expect; and: Expect; have: Expect; has: Expect; diff --git a/chartjs/chart.d.ts b/chartjs/chart.d.ts index 7364c6525..a73ecc94e 100644 --- a/chartjs/chart.d.ts +++ b/chartjs/chart.d.ts @@ -28,8 +28,8 @@ interface LinearChartData { interface CircularChartData { value: number; color: string; - highlight: string; - label: string; + highlight?: string; + label?: string; } interface ChartSettings { diff --git a/chrome/chrome.d.ts b/chrome/chrome.d.ts index cbabf893a..f67cb3949 100755 --- a/chrome/chrome.d.ts +++ b/chrome/chrome.d.ts @@ -1545,7 +1545,8 @@ declare module chrome.runtime { } interface Port { - postMessage: Function; + postMessage: (message: Object) => void; + disconnect: () => void; sender?: MessageSender; onDisconnect: chrome.events.Event; onMessage: PortMessageEvent; @@ -2250,7 +2251,7 @@ declare module chrome.webRequest { } interface UploadData { - bytes?: any[]; + bytes?: ArrayBuffer; file?: string; } @@ -2328,7 +2329,7 @@ declare module chrome.webRequest { } interface RequestBody { - raw?: UploadData; + raw?: UploadData[]; error?: string; formData?: FormData; } diff --git a/codemirror/codemirror.d.ts b/codemirror/codemirror.d.ts index a187d8ec1..65692cf1c 100644 --- a/codemirror/codemirror.d.ts +++ b/codemirror/codemirror.d.ts @@ -919,4 +919,91 @@ declare module CodeMirror { */ current(): string; } + + /** + * A Mode is, in the simplest case, a lexer (tokenizer) for your language — a function that takes a character stream as input, + * advances it past a token, and returns a style for that token. More advanced modes can also handle indentation for the language. + */ + interface Mode { + /** + * This function should read one token from the stream it is given as an argument, optionally update its state, + * and return a style string, or null for tokens that do not have to be styled. Multiple styles can be returned, separated by spaces. + */ + token(stream: StringStream, state: T): string; + + /** + * A function that produces a state object to be used at the start of a document. + */ + startState?: () => T; + /** + * For languages that have significant blank lines, you can define a blankLine(state) method on your mode that will get called + * whenever a blank line is passed over, so that it can update the parser state. + */ + blankLine?: (state: T) => void; + /** + * Given a state returns a safe copy of that state. + */ + copyState?: (state: T) => T; + + /** + * The indentation method should inspect the given state object, and optionally the textAfter string, which contains the text on + * the line that is being indented, and return an integer, the amount of spaces to indent. + */ + indent?: (state: T, textAfter: string) => number; + + /** The four below strings are used for working with the commenting addon. */ + /** + * String that starts a line comment. + */ + lineComment?: string; + /** + * String that starts a block comment. + */ + blockCommentStart?: string; + /** + * String that ends a block comment. + */ + blockCommentEnd?: string; + /** + * String to put at the start of continued lines in a block comment. + */ + blockCommentLead?: string; + + /** + * Trigger a reindent whenever one of the characters in the string is typed. + */ + electricChars?: string + /** + * Trigger a reindent whenever the regex matches the part of the line before the cursor. + */ + electricinput?: RegExp + } + + /** + * A function that, given a CodeMirror configuration object and an optional mode configuration object, returns a mode object. + */ + interface ModeFactory { + (config: CodeMirror.EditorConfiguration, modeOptions?: any): Mode + } + + /** + * id will be the id for the defined mode. Typically, you should use this second argument to defineMode as your module scope function + * (modes should not leak anything into the global scope!), i.e. write your whole mode inside this function. + */ + function defineMode(id: string, modefactory: ModeFactory): void; + + /** + * The first argument is a configuration object as passed to the mode constructor function, and the second argument + * is a mode specification as in the EditorConfiguration mode option. + */ + function getMode(config: CodeMirror.EditorConfiguration, mode: any): Mode; + + /** + * Utility function from the overlay.js addon that allows modes to be combined. The mode given as the base argument takes care of + * most of the normal mode functionality, but a second (typically simple) mode is used, which can override the style of text. + * Both modes get to parse all of the text, but when both assign a non-null style to a piece of code, the overlay wins, unless + * the combine argument was true and not overridden, or state.overlay.combineTokens was true, in which case the styles are combined. + */ + function overlayMode(base: Mode, overlay: Mode, combine?: boolean): Mode + } diff --git a/crossroads/crossroads.d.ts b/crossroads/crossroads.d.ts index e86e3154d..1ef15aba7 100644 --- a/crossroads/crossroads.d.ts +++ b/crossroads/crossroads.d.ts @@ -153,3 +153,7 @@ declare module CrossroadsJs { } declare var crossroads: CrossroadsJs.CrossRoadsStatic; + +declare module 'crossroads'{ + export = crossroads; +} diff --git a/crypto-js/crypto-js-tests.ts b/crypto-js/crypto-js-tests.ts new file mode 100644 index 000000000..199c32ef2 --- /dev/null +++ b/crypto-js/crypto-js-tests.ts @@ -0,0 +1,23 @@ +/// + +import CryptoJS = require('crypto-js'); + +var str: string; + +str = CryptoJS.MD5('some message'); +str = CryptoJS.MD5('some message', 'some key'); + +str = CryptoJS.SHA1('some message'); +str = CryptoJS.SHA1('some message', 'some key', { any: true }); + +str = CryptoJS.format.OpenSSL('some message'); +str = CryptoJS.format.OpenSSL('some message', 'some key'); + +str = CryptoJS.enc.Utf8('some message'); +str = CryptoJS.enc.Utf8('some message', 'some key'); + +str = CryptoJS.mode.OFB('some message'); +str = CryptoJS.mode.OFB('some message', 'some key'); + +str = CryptoJS.pad.Ansix923('some message'); +str = CryptoJS.pad.Ansix923('some message', 'some key'); diff --git a/crypto-js/crypto-js.d.ts b/crypto-js/crypto-js.d.ts new file mode 100644 index 000000000..0f0251402 --- /dev/null +++ b/crypto-js/crypto-js.d.ts @@ -0,0 +1,67 @@ +// Type definitions for crypto-js v3.1.3 +// Project: https://github.com/evanvosberg/crypto-js +// Definitions by: Michael Zabka +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module CryptoJS { + type Hash = (message: string, key?: string, ...options: any[]) => string; + + export interface Hashes { + MD5: Hash; + SHA1: Hash; + SHA256: Hash; + SHA224: Hash; + SHA512: Hash; + SHA384: Hash; + SHA3: Hash; + RIPEMD160: Hash; + HmacMD5: Hash; + HmacSHA1: Hash; + HmacSHA256: Hash; + HmacSHA224: Hash; + HmacSHA512: Hash; + HmacSHA384: Hash; + HmacSHA3: Hash; + HmacRIPEMD160: Hash; + PBKDF2: Hash; + AES: Hash; + TripleDES: Hash; + RC4: Hash; + Rabbit: Hash; + RabbitLegacy: Hash; + EvpKDF: Hash; + format: { + OpenSSL: Hash; + Hex: Hash; + }; + enc: { + Latin1: Hash; + Utf8: Hash; + Hex: Hash; + Utf16: Hash; + Base64: Hash; + }; + mode: { + CFB: Hash; + CTR: Hash; + CTRGladman: Hash; + OFB: Hash; + ECB: Hash; + }; + pad: { + Pkcs7: Hash; + Ansix923: Hash; + Iso10126: Hash; + Iso97971: Hash; + ZeroPadding: Hash; + NoPadding: Hash; + }; + } + + export var hashes: Hashes; +} + +declare module 'crypto-js' { + import hashes = CryptoJS.hashes; + export = hashes; +} diff --git a/csv-stringify/csv-stringify-tests.ts b/csv-stringify/csv-stringify-tests.ts new file mode 100644 index 000000000..e28ddb8f8 --- /dev/null +++ b/csv-stringify/csv-stringify-tests.ts @@ -0,0 +1,22 @@ +/// + +import stringify = require("csv-stringify"); + + +stringify([["1", "2", "3"], ["4", "5", "6"]], (error: Error, output: string): void => { + // nothing +}); + +stringify([["1", "2", "3"], ["4", "5", "6"]], { + delimiter: "," +}, (error: Error, output: string): void => { + // nothing +}); + + +var s = stringify({ delimiter: "," }); +s.write(["1", "2", "3"]); + + + + diff --git a/csv-stringify/csv-stringify.d.ts b/csv-stringify/csv-stringify.d.ts new file mode 100644 index 000000000..7f46d53f6 --- /dev/null +++ b/csv-stringify/csv-stringify.d.ts @@ -0,0 +1,83 @@ +// Type definitions for csv-stringify 0.0.6 +// Project: https://github.com/wdavidw/node-csv-stringify +// Definitions by: Rogier Schouten +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module "csv-stringify" { + + module stringify { + interface StringifyOpts { + /** + * List of fields, applied when transform returns an object, order matters, read the transformer documentation for additionnal information, columns are auto discovered when the user write object, see the "header" option on how to print columns names on the first line. + */ + columns?: string[]; + /** + * Set the field delimiter, one character only, defaults to a comma. + */ + delimiter?: string; + /** + * Add the value of "options.rowDelimiter" on the last line, default to true. + */ + eof?: boolean; + /** + * Defaults to the escape read option. + */ + escape?: boolean; + /** + * Display the column names on the first line if the columns option is provided or discovered. + */ + header?: boolean; + /** + * String used to delimit record rows or a special value; special values are 'auto', 'unix', 'mac', 'windows', 'unicode'; defaults to 'auto' (discovered in source or 'unix' if no source is specified). + */ + lineBreaks?: string; + /** + * Defaults to the quote read option. + */ + quote?: string; + /** + * Boolean, default to false, quote all the non-empty fields even if not required. + */ + quoted?: boolean; + /** + * Boolean, no default, quote empty fields? If specified, overrides quotedString for empty strings. + */ + quotedEmpty?: boolean; + /** + * Boolean, default to false, quote all fields of type string even if not required. + */ + quotedString?: boolean; + /** + * String used to delimit record rows or a special value; special values are 'auto', 'unix', 'mac', 'windows', 'unicode'; defaults to 'auto' (discovered in source or 'unix' if no source is specified). + */ + rowDelimiter?: string; + + } + + interface Stringifier extends NodeJS.ReadWriteStream { + + // Stringifier stream takes array of strings + write(line: string[]): boolean; + + // repeat declarations from NodeJS.WritableStream to avoid compile error + write(buffer: Buffer, cb?: Function): boolean; + write(str: string, cb?: Function): boolean; + write(str: string, encoding?: string, cb?: Function): boolean; + } + } + + /** + * Callback version: string in --> callback with string out + */ + function stringify(input: any[][], opts: stringify.StringifyOpts, callback: (error: Error, output: string) => void): void; + function stringify(input: any[][], callback: (error: Error, output: string) => void): void; + + /** + * Streaming stringifier + */ + function stringify(opts: stringify.StringifyOpts): stringify.Stringifier; + + export = stringify; +} diff --git a/d3/d3-tests.ts b/d3/d3-tests.ts index 1a2b5f1c5..51c51f608 100644 --- a/d3/d3-tests.ts +++ b/d3/d3-tests.ts @@ -47,6 +47,37 @@ function testPieChart() { }); } +function testMapConstructor() { + //No arg constructor + var emptyMap: D3.Map = d3.map(); + + //Object constructor + var object:{[key: string]: number } = {a: 1, b: 2, c: 3}; + var objectMap: D3.Map = d3.map(object); + + //Array constructor + var numberArray: number[] = [1, 2, 3] + var numberArrayMap: D3.Map = d3.map(numberArray); + + //Array with keyFn constructor + var objectArray: {key: string}[] = [{key: "v1"}, {key: "v2"}, {key: "v3"}]; + var indexes: number[] = []; + //keyFn with index + var objectArrayMap1: D3.Map<{key: string}> + = d3.map<{key: string}>(objectArray, (o: {key: string}, index: number) => { + indexes.push(index); + return o.key; + }); + //keyFn without index + var objectArrayMap2: D3.Map<{key: string}> + = d3.map<{key: string}>(objectArray, (o: {key: string}) => { + return o.key; + }); + + //Map constructor + var duplicateMap: D3.Map = d3.map(numberArrayMap); +} + //Example from http://bl.ocks.org/3887051 interface GroupedData { State: string; diff --git a/d3/d3.d.ts b/d3/d3.d.ts index a12009bba..57e817818 100644 --- a/d3/d3.d.ts +++ b/d3/d3.d.ts @@ -549,10 +549,17 @@ declare module D3 { functor(value: (p : R) => T): (p : R) => T; functor(value: T): (p : any) => T; - map(): Map; - set(): Set; - map(object: {[key: string]: T; }): Map; - set(array: T[]): Set; + map: { + (): Map; + (object: {[key: string]: T; }): Map; + (map: Map): Map; + (array: T[]): Map; + (array: T[], keyFn: (object: T, index?: number) => string): Map; + }; + set: { + (): Set; + (array: T[]): Set; + }; dispatch(...types: string[]): Dispatch; rebind(target: any, source: any, ...names: any[]): any; requote(str: string): string; @@ -772,9 +779,34 @@ declare module D3 { }; datum: { + /** + * Sets the element's bound data to the return value of the specified function evaluated + * for each selected element. + * Unlike the D3.Selection.data method, this method does not compute a join (and thus + * does not compute enter and exit selections). + * @param values The function to be evaluated for each selected element, being passed the + * previous datum d and the current index i, with the this context as the current DOM + * element. The function is then used to set each element's data. A null value will + * delete the bound data. This operator has no effect on the index. + */ (values: (data: any, index: number) => any): UpdateSelection; + /** + * Sets the element's bound data to the specified value on all selected elements. + * Unlike the D3.Selection.data method, this method does not compute a join (and thus + * does not compute enter and exit selections). + * @param values The same data to be given to all elements. + */ (values: any): UpdateSelection; - () : any; + /** + * Returns the bound datum for the first non-null element in the selection. + * This is generally useful only if you know the selection contains exactly one element. + */ + (): any; + /** + * Returns the bound datum for the first non-null element in the selection. + * This is generally useful only if you know the selection contains exactly one element. + */ + (): T; }; filter: { @@ -963,7 +995,29 @@ declare module D3 { */ (elements: EventTarget[]): Transition; } - each: (type?: string, eachFunction?: (data: any, index: number) => any) => Transition; + each: { + /** + * Immediately invokes the specified function for each element in the current + * transition, passing in the current datum and index, with the this context + * of the current DOM element. Similar to D3.Selection.each. + * + * @param eachFunction The function to be invoked for each element in the + * current transition, passing in the current datum and index, with the this + * context of the current DOM element. + */ + (eachFunction: (data: any, index: number) => any): Transition; + /** + * Adds a listener for transition events, supporting "start", "end" and + * "interrupt" events. The listener will be invoked for each individual + * element in the transition. + * + * @param type Type of transition event. Supported values are "start", "end" + * and "interrupt". + * @param listener The listener to be invoked for each individual element in + * the transition. + */ + (type: string, listener: (data: any, index: number) => any): Transition; + } transition: () => Transition; ease: (value: string, ...arrs: any[]) => Transition; attrTween(name: string, tween: (d: any, i: number, a: any) => BaseInterpolate): Transition; @@ -1236,24 +1290,24 @@ declare module D3 { } export interface GraphNode { - id: number; - index: number; - name: string; - px: number; - py: number; - size: number; - weight: number; - x: number; - y: number; - subindex: number; - startAngle: number; - endAngle: number; - value: number; - fixed: boolean; - children: GraphNode[]; - _children: GraphNode[]; - parent: GraphNode; - depth: number; + id?: number; + index?: number; + name?: string; + px?: number; + py?: number; + size?: number; + weight?: number; + x?: number; + y?: number; + subindex?: number; + startAngle?: number; + endAngle?: number; + value?: number; + fixed?: boolean; + children?: GraphNode[]; + _children?: GraphNode[]; + parent?: GraphNode; + depth?: number; } export interface GraphLink { @@ -1279,10 +1333,8 @@ declare module D3 { export interface ForceLayout { (): ForceLayout; size: { - (): number; + (): number[]; (mysize: number[]): ForceLayout; - (accessor: (d: any, index: number) => {}): ForceLayout; - }; linkDistance: { (): number; @@ -1673,8 +1725,8 @@ declare module D3 { } export interface Symbol { - type: (string:string) => Symbol; - size: (number:number) => Symbol; + type: (symbolType: string | ((datum: any, index: number) => string)) => Symbol; + size: (size: number | ((datum: any, index: number) => number)) => Symbol; (datum:any, index:number): string; } @@ -1790,7 +1842,7 @@ declare module D3 { (): number; (value: number): Axis; } - tickFormat(formatter: (value: any) => string): Axis; + tickFormat(formatter: (value: any, index?: number) => string): Axis; nice(count?: number): Axis; } diff --git a/dagre-d3/dagre-d3-tests.ts b/dagre-d3/dagre-d3-tests.ts new file mode 100644 index 000000000..e3e068816 --- /dev/null +++ b/dagre-d3/dagre-d3-tests.ts @@ -0,0 +1,19 @@ +/// +module DagreD3Tests { + var gDagre = new dagreD3.graphlib.Graph(); + var graph = gDagre.graph(); + + // has graph methods from dagre.d.ts + graph.setNode("a", {}); + var num: number = 251 + graph.height + graph.width; + var predecessors: { [vertex:string]: string[] } = {}; + var successors: { [vertex:string]: string[] } = {}; + + predecessors["a"] = graph.predecessors("a"); + successors["a"] = graph.successors("a"); + + var render = new dagreD3.render(); + var svg = d3.select("svg"); + render(svg, graph); +} + diff --git a/dagre-d3/dagre-d3.d.ts b/dagre-d3/dagre-d3.d.ts new file mode 100644 index 000000000..d088d1d82 --- /dev/null +++ b/dagre-d3/dagre-d3.d.ts @@ -0,0 +1,31 @@ +// Type definitions for dagre-d3.core.js +// Project: https://github.com/cpettitt/dagre-d3 +// Definitions by: Mark Wong Siang Kai +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// +/// + +declare module Dagre { + + interface DagreD3Factory extends Dagre.DagreFactory { + render: Render; + } + + // coupled with dagre.d.ts' Graph + // a lot of these methods come from graphlib.core.js + interface Graph { + graph(): Graph; + height: number; + predecessors(id: string): string[]; + successors(id: string): string[]; + width: number; + } + + interface Render { + new (): Render; + (selection: D3.Selection, g: Dagre.Graph): void; + } +} + +declare var dagreD3: Dagre.DagreD3Factory; diff --git a/dagre/dagre-tests.ts b/dagre/dagre-tests.ts index ab790e502..621727944 100644 --- a/dagre/dagre-tests.ts +++ b/dagre/dagre-tests.ts @@ -1,13 +1,10 @@ /// module DagreTests { var gDagre = new dagre.graphlib.Graph(); - gDagre.setGraph({}); - gDagre.setDefaultEdgeLabel(function(){ - return ; - }); - - gDagre.setNode("a", {}); - gDagre.setEdge("b", "c"); + gDagre.setGraph({}) + .setDefaultEdgeLabel(function(){ return ; }) + .setNode("a", {}) + .setEdge("b", "c"); dagre.layout(gDagre); } diff --git a/dagre/dagre.d.ts b/dagre/dagre.d.ts index a9d452826..ce389f2d7 100644 --- a/dagre/dagre.d.ts +++ b/dagre/dagre.d.ts @@ -14,14 +14,14 @@ declare module Dagre{ edge(id: string): any; nodes(): string[]; node(id: string): any; - setDefaultEdgeLabel(callback: () => void): void; - setEdge(sourceId: string, targetId: string): void; - setGraph(options: { [key: string]: any }): void; - setNode(id: string, node: { [key: string]: any }): void; + setDefaultEdgeLabel(callback: () => void): Graph; + setEdge(sourceId: string, targetId: string): Graph; + setGraph(options: { [key: string]: any }): Graph; + setNode(id: string, node: { [key: string]: any }): Graph; } interface GraphLib { - Graph: Graph + Graph: Graph; } } diff --git a/deployJava/deployJava-tests.ts.tscparams b/deployJava/deployJava-tests.ts.tscparams deleted file mode 100644 index 934bc29ef..000000000 --- a/deployJava/deployJava-tests.ts.tscparams +++ /dev/null @@ -1 +0,0 @@ ---noImplicitAny \ No newline at end of file diff --git a/drop/drop.d.ts b/drop/drop.d.ts index 18568afdd..e3615d510 100644 --- a/drop/drop.d.ts +++ b/drop/drop.d.ts @@ -9,6 +9,12 @@ declare module drop { interface DropStatic { new(options: IDropOptions): Drop; + createContext(options: IDropContextOptions): DropStatic; + } + + interface IDropContextOptions { + classPrefix?: string; + defaults?: IDropOptions; } interface IDropOptions { diff --git a/ember/ember-tests.ts.tscparams b/ember/ember-tests.ts.tscparams deleted file mode 100644 index d3f5a12fa..000000000 --- a/ember/ember-tests.ts.tscparams +++ /dev/null @@ -1 +0,0 @@ - diff --git a/ember/ember.d.ts.tscparams b/ember/ember.d.ts.tscparams deleted file mode 100644 index d3f5a12fa..000000000 --- a/ember/ember.d.ts.tscparams +++ /dev/null @@ -1 +0,0 @@ - diff --git a/eventemitter2/eventemitter2.d.ts b/eventemitter2/eventemitter2.d.ts index abaa0756e..dc9bb260b 100644 --- a/eventemitter2/eventemitter2.d.ts +++ b/eventemitter2/eventemitter2.d.ts @@ -55,7 +55,7 @@ declare class EventEmitter2 { * Removes the listener that will be fired when any event is emitted. * @param listener */ - offAny(listener: Function): EventEmitter2; + offAny(listener?: Function): EventEmitter2; /** * Adds a one time listener for the event. diff --git a/express/express.d.ts b/express/express.d.ts index 043c1e49c..e31332077 100644 --- a/express/express.d.ts +++ b/express/express.d.ts @@ -424,22 +424,22 @@ declare module "express" { * @param code */ status(code: number): Response; - + /** * Set the response HTTP status code to `statusCode` and send its string representation as the response body. * @link http://expressjs.com/4x/api.html#res.sendStatus - * + * * Examples: - * + * * res.sendStatus(200); // equivalent to res.status(200).send('OK') * res.sendStatus(403); // equivalent to res.status(403).send('Forbidden') * res.sendStatus(404); // equivalent to res.status(404).send('Not Found') * res.sendStatus(500); // equivalent to res.status(500).send('Internal Server Error') - * + * * @param code */ sendStatus(code: number): Response; - + /** * Set Link header field with the given `links`. * @@ -796,7 +796,7 @@ declare module "express" { (req: Request, res: Response, next: Function): any; } - interface Handler extends RequestHandler {} + interface Handler extends RequestHandler {} interface RequestParamHandler { (req: Request, res: Response, next: Function, param: any): any; diff --git a/extend/extend-tests.ts b/extend/extend-tests.ts new file mode 100644 index 000000000..059aa22ba --- /dev/null +++ b/extend/extend-tests.ts @@ -0,0 +1,41 @@ +/// +/// + +import assert = require('assert'); +import extend = require('extend'); + +var objectBase = { + test: 'base' +}; + +var objectOne = { + test: 'one', + iamone: true +}; + +var objectTwo = { + test: 2, + iamtwo: true +}; + +var objectThree = { + iamthree: true, + depth: { + innerType: 'deep' + } +}; + +var extended = extend(objectBase, objectOne); +assert(extended.test === 'one'); +assert(extended.iamone === true); + +var moreExtended = extend(objectBase, objectOne, objectTwo); +assert(moreExtended.test === 2); +assert(moreExtended.iamone === true); +assert(moreExtended.iamtwo === true); + +var deepExtended = extend(true, objectBase, objectOne, objectTwo, objectThree); +assert(deepExtended.iamone === true); +assert(moreExtended.iamtwo === true); +assert(deepExtended.iamthree === true); +assert(deepExtended.depth.innerType === 'one'); \ No newline at end of file diff --git a/extend/extend.d.ts b/extend/extend.d.ts new file mode 100644 index 000000000..39b5d1a04 --- /dev/null +++ b/extend/extend.d.ts @@ -0,0 +1,9 @@ +// Type definitions for extend v2.0.0 +// Project: https://www.npmjs.com/package/extend +// Definitions by: Stefan Steinhart +// Definitions: https://github.com/borisyankov/DefinitelyTyped +declare module "extend" { + + function extend(deepOrObject:boolean | Object, ...objectN: Object[]): any; + export = extend; +} \ No newline at end of file diff --git a/fabricjs/fabricjs.d.ts b/fabricjs/fabricjs.d.ts index fb73fecb3..f764d4768 100644 --- a/fabricjs/fabricjs.d.ts +++ b/fabricjs/fabricjs.d.ts @@ -881,5 +881,19 @@ declare module fabric { toArray(arrayLike): any[]; toFixed(number, fractionDigits); wrapElement(element: HTMLElement, wrapper, attributes); + rotatePoint(point: IPoint, origin: IPoint, radians: number); + transformPoint(p: IPoint, t: any[], ignoreOffset: boolean); + invertTransform(t: any[]); + parseUnit(value: number|string, fontSize?: number); + getKlass(type: string, namespace: string); + resolveNamespace(namespace: string); + enlivenObjects(objects: any[], callback: Function, namespace: string, reviver: Function); + drawDashedLine(ctx: CanvasRenderingContext2D, x: number, y: number, x2: number, y2: number, da: any[]); + createCanvasElement(canvasEl?: HTMLElement); + createImage(); + createAccessors(klass: Object); + clipContext(receiver: IObject, ctx: CanvasRenderingContext2D); + isTransparent(ctx: CanvasRenderingContext2D, x: number, y: number, tolerance: number); + } } diff --git a/filesystem/filesystem-tests.ts b/filesystem/filesystem-tests.ts index 8f175db98..9eb6fbaae 100644 --- a/filesystem/filesystem-tests.ts +++ b/filesystem/filesystem-tests.ts @@ -7,7 +7,7 @@ declare function writeDataToLogFile(fileWriter:FileWriterSync): void; function useAsyncFS(fs:FileSystem):void { // see getAsText example in [FILE-API-ED]. - fs.root.getFile("already_there.txt", null, function (f:FileEntry): void{ + fs.root.getFile("already_there.txt", null, function (f): void{ // In the example of the specification, there is a following code: // @@ -19,7 +19,7 @@ function useAsyncFS(fs:FileSystem):void { }); // But now we can also write to the file; see [FILE-WRITER-ED]. - fs.root.getFile("logFile", {create: true}, function (f:FileEntry): void{ + fs.root.getFile("logFile", {create: true}, function (f): void{ f.createWriter(writeDataToLogFile); }); } diff --git a/filesystem/filesystem.d.ts b/filesystem/filesystem.d.ts index 8b20b113c..1b76846b4 100644 --- a/filesystem/filesystem.d.ts +++ b/filesystem/filesystem.d.ts @@ -197,7 +197,7 @@ interface Entry { * @param successCallback A callback that is called to return the parent Entry. * @param errorCallback A callback that is called when errors happen. */ - getParent(successCallback:EntryCallback, errorCallback?:ErrorCallback):void; + getParent(successCallback:DirectoryEntryCallback, errorCallback?:ErrorCallback):void; } /** @@ -223,7 +223,7 @@ interface DirectoryEntry extends Entry { * @param successCallback A callback that is called to return the File selected or created. * @param errorCallback A callback that is called when errors happen. */ - getFile(path:string, options?:Flags, successCallback?:EntryCallback, errorCallback?:ErrorCallback):void; + getFile(path:string, options?:Flags, successCallback?:FileEntryCallback, errorCallback?:ErrorCallback):void; /** * Creates or looks up a directory. @@ -240,7 +240,7 @@ interface DirectoryEntry extends Entry { * @param errorCallback A callback that is called when errors happen. * */ - getDirectory(path:string, options?:Flags, successCallback?:EntryCallback, errorCallback?:ErrorCallback):void; + getDirectory(path:string, options?:Flags, successCallback?:DirectoryEntryCallback, errorCallback?:ErrorCallback):void; /** * Deletes a directory and all of its contents, if any. In the event of an error [e.g. trying to delete a directory that contains a file that cannot be removed], some of the contents of the directory may be deleted. It is an error to attempt to delete the root directory of a filesystem. @@ -307,6 +307,26 @@ interface EntryCallback { (entry:Entry):void; } +/** + * This interface is the callback used to look up FileEntry objects. + */ +interface FileEntryCallback { + /** + * @param entry + */ + (entry:FileEntry):void; +} + +/** + * This interface is the callback used to look up DirectoryEntry objects. + */ +interface DirectoryEntryCallback { + /** + * @param entry + */ + (entry:DirectoryEntry):void; +} + /** * When readEntries() succeeds, the following callback is made. */ diff --git a/flot/jquery.flot.d.ts b/flot/jquery.flot.d.ts index 9ea862c5c..027330eee 100644 --- a/flot/jquery.flot.d.ts +++ b/flot/jquery.flot.d.ts @@ -16,7 +16,7 @@ declare module jquery.flot { xaxes?: axisOptions[]; yaxes?: axisOptions[]; grid?: gridOptions; - interfaction?: interaction; + interaction?: interaction; hooks?: hooks; } @@ -107,7 +107,7 @@ declare module jquery.flot { ticks?: any; // null or number or ticks array or (fn: axis -> ticks array) tickSize?: any; // number or array minTickSize?: any; // number or array - tickFormatter?: (t: number) => string; // (fn: number, object -> string) or string + tickFormatter?: (t: number, a?: axis) => string; // (fn: number, object -> string) or string tickDecimals?: number; labelWidth?: number; @@ -198,9 +198,16 @@ declare module jquery.flot { c2p(canvasPoint: canvasPoint):point; } + interface plugin { + init(options: plotOptions): any; + options?: any; + name?: string; + version?: string; + } + interface plot { highlight(series: dataSeries, datapoint: item): void; - unhightlight(): void; + unhighlight(): void; unhighlight(series: dataSeries, datapoint: item): void; setData(data: any): void; setupGrid(): void; @@ -221,9 +228,14 @@ declare module jquery.flot { getPlotOffset(): canvasPoint; getOptions(): plotOptions; } + + interface plotStatic { + (placeholder: JQuery, data: dataSeries[], options?: plotOptions): plot; + (placeholder: JQuery, data: any[], options?: plotOptions): plot; + plugins: plugin[]; + } } interface JQueryStatic { - plot(placeholder: JQuery, data: jquery.flot.dataSeries[], options?: jquery.flot.plotOptions): jquery.flot.plot; - plot(placeholder: JQuery, data: any[], options?: jquery.flot.plotOptions): jquery.flot.plot; + plot: jquery.flot.plotStatic; } diff --git a/flot/jquery.flot.d.ts.tscparams b/flot/jquery.flot.d.ts.tscparams deleted file mode 100644 index d3f5a12fa..000000000 --- a/flot/jquery.flot.d.ts.tscparams +++ /dev/null @@ -1 +0,0 @@ - diff --git a/fluxxor/fluxxor.d.ts b/fluxxor/fluxxor.d.ts index e857a6b15..e8b89a66d 100644 --- a/fluxxor/fluxxor.d.ts +++ b/fluxxor/fluxxor.d.ts @@ -3,7 +3,7 @@ // Definitions by: Yuichi Murata // Definitions: https://github.com/borisyankov/DefinitelyTyped -/// +/// /// declare module Fluxxor { diff --git a/fs-finder/fs-finder-tests.ts b/fs-finder/fs-finder-tests.ts new file mode 100644 index 000000000..3f6a82d6c --- /dev/null +++ b/fs-finder/fs-finder-tests.ts @@ -0,0 +1,87 @@ +/// + +import finder = require('fs-finder'); + + +// static +var a: FsFinder.Finder = finder.in('./*'); + +var b: FsFinder.Finder = finder.from('./*'); + +var c: FsFinder.Finder = finder.find('./*'); +finder.find('./*', (paths: string[]) => {}); + +var d: FsFinder.Finder = finder.findFiles('./*'); +finder.findFiles('./*', (paths: string[]) => {}); + +var e: FsFinder.Finder = finder.findDirectories('./*'); +finder.findDirectories('./*', (paths: string[]) => {}); + +var f: FsFinder.Finder = finder.findFile('./*'); +finder.findFile('./*', (paths: string[]) => {}); + +var g: FsFinder.Finder = finder.findDirectory('./*'); +finder.findDirectory('./*', (paths: string[]) => {}); + + +// instance +var instance = finder.in('./any*'); + +var j: string[] = instance.find('./*'); +instance.find('./*', (paths: string[]) => {}); + +var k: string[] = instance.findFiles('./*'); +instance.findFiles('./*', (paths: string[]) => {}); + +var l: string[] = instance.findDirectories('./*'); +instance.findDirectories('./*', (paths: string[]) => {}); + +var m: string[] = instance.findFile('./*'); +instance.findFile('./*', (paths: string[]) => {}); + +var n: string[] = instance.findDirectory('./*'); +instance.findDirectory('./*', (paths: string[]) => {}); + +var paths: string[]; +paths = instance.find(); +paths = instance.findFiles(); +paths = instance.findDirectories(); +paths = instance.findFile(); +paths = instance.findDirectory(); + + +// Base +instance = instance.recursively(); +instance = instance.recursively(false); +instance = instance.exclude('b'); +instance = instance.exclude(['b']); +instance = instance.exclude('a', true); +instance = instance.showSystemFiles(); +instance = instance.showSystemFiles(false); +instance = instance.lookUp(); +instance = instance.lookUp(false); +instance = instance.findFirst(); +instance = instance.findFirst(true); +instance = instance.filter((path: string) => { + return false; +}); + +paths = instance.getPathsSync('all', './*', './dir'); +instance.getPathsAsync((paths: string[]) => {}, 'all', './*', './dir'); +paths = instance.getPathsSync('directories', './*', './dir'); +instance.getPathsAsync((paths: string[]) => {}, 'directories', './*', './dir'); +paths = instance.getPathsSync('files', './*', './dir'); +instance.getPathsAsync((paths: string[]) => {}, 'files', './*', './dir'); + +var is: boolean; +is = instance.checkExcludes('a'); +is = instance.checkSystemFiles('b'); +is = instance.checkFilters('c', {}); + +var numeric: number; +numeric = instance.checkFile('d', {}, './*.ts', 'all'); +numeric = instance.checkFile('d', {}, './*.ts', 'directories'); +numeric = instance.checkFile('d', {}, './*.ts', 'files'); + +paths = instance.getPathsFromParentsSync('a', 'all'); +instance.getPathsFromParentsAsync((paths: string[]) => {}, '*.ts', 'all'); diff --git a/fs-finder/fs-finder.d.ts b/fs-finder/fs-finder.d.ts new file mode 100644 index 000000000..a04ed8799 --- /dev/null +++ b/fs-finder/fs-finder.d.ts @@ -0,0 +1,55 @@ +// Type definitions for fs-finder v1.8.0 +// Project: https://github.com/sakren/node-fs-finder +// Definitions by: Michael Zabka +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module FsFinder { + + type AsyncFunction = (paths: string|string[]) => void; + type Type = string; // 'all'|'directories'|'files' + type Mask = string; + type Directory = string; + + export class Finder extends Base { + static TIME_FORMAT: string; + static in(path: string): Finder; + static from(path: string): Finder; + static find(path: string, fn?: AsyncFunction, type?: Type): Finder; + static findFiles(path?: string, fn?: AsyncFunction): Finder; + static findDirectories(path?: string, fn?: AsyncFunction): Finder; + static findFile(path?: string, fn?: AsyncFunction): Finder; + static findDirectory(path?: string, fn?: AsyncFunction): Finder; + find(mask?: Mask, fn?: AsyncFunction, type?: Type): string[]; + findFiles(mask?: Mask, fn?: AsyncFunction): string[]; + findDirectories(mask?: Mask, fn?: AsyncFunction): string[]; + findFile(mask?: Mask, fn?: AsyncFunction): string[]; + findDirectory(mask?: Mask, fn?: AsyncFunction): string[]; + size(operation?: any, value?: any): Finder; + date(operation?: any, value?: any): Finder; + } + + export class Base { + recursively(recursive?: boolean): Finder; + exclude(excludes: string|string[], exactly?: boolean): Finder; + showSystemFiles(systemFiles?: boolean): Finder; + lookUp(up?: boolean): Finder; + findFirst(findFirst?: boolean): Finder; + filter(fn: Function): Finder; + + getPathsSync(type?: Type, mask?: Mask, dir?: Directory): string[]; + getPathsAsync(fn: AsyncFunction, type?: Type, mask?: Mask, dir?: Directory): void; + + checkExcludes(path: string): boolean; + checkSystemFiles(path: string): boolean; + checkFilters(path: string, stats: any): boolean; + checkFile(path: string, stats: any, mask: Mask, type: Type): number; + + getPathsFromParentsSync(mask?: Mask, type?: Type): string[]; + getPathsFromParentsAsync(fn: AsyncFunction, mask?: Mask, type?: Type): void; + } +} + +declare module "fs-finder" { + import Finder = FsFinder.Finder; + export = Finder; +} diff --git a/fs-mock/fs-mock-tests.ts b/fs-mock/fs-mock-tests.ts new file mode 100644 index 000000000..953b27472 --- /dev/null +++ b/fs-mock/fs-mock-tests.ts @@ -0,0 +1,23 @@ +/// + +import FS = require("fs-mock"); + +var fs: FS = new FS({ + 'Users': { + 'David': { + 'password.txt': 'my super password' + } + } +}, { + windows: true +}); + +var fsopts: FS.Opts = { + windows: true, + drives: ["A", "B"], + root: "/" +}; + +fs.rename("/a/b.txt", "/a/c/txt", (err?: Error): void => { + // nothing +}); diff --git a/fs-mock/fs-mock.d.ts b/fs-mock/fs-mock.d.ts new file mode 100644 index 000000000..fdf82b4d1 --- /dev/null +++ b/fs-mock/fs-mock.d.ts @@ -0,0 +1,144 @@ +// Type definitions for fs-mock 1.1.3 +// Project: https://github.com/sakren/node-fs-mock +// Definitions by: Rogier Schouten +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module "fs-mock" { + import stream = require("stream"); + import events = require("events"); + import fs = require("fs"); + + module FS { + export interface Opts { + windows?: boolean; + drives?: string[]; + root?: string; + } + } + + class FS { + constructor(content: any, opts?: FS.Opts) + + rename(oldPath: string, newPath: string, callback?: (err?: NodeJS.ErrnoException) => void): void; + renameSync(oldPath: string, newPath: string): void; + truncate(path: string, callback?: (err?: NodeJS.ErrnoException) => void): void; + truncate(path: string, len: number, callback?: (err?: NodeJS.ErrnoException) => void): void; + truncateSync(path: string, len?: number): void; + ftruncate(fd: number, callback?: (err?: NodeJS.ErrnoException) => void): void; + ftruncate(fd: number, len: number, callback?: (err?: NodeJS.ErrnoException) => void): void; + ftruncateSync(fd: number, len?: number): void; + chown(path: string, uid: number, gid: number, callback?: (err?: NodeJS.ErrnoException) => void): void; + chownSync(path: string, uid: number, gid: number): void; + fchown(fd: number, uid: number, gid: number, callback?: (err?: NodeJS.ErrnoException) => void): void; + fchownSync(fd: number, uid: number, gid: number): void; + lchown(path: string, uid: number, gid: number, callback?: (err?: NodeJS.ErrnoException) => void): void; + lchownSync(path: string, uid: number, gid: number): void; + chmod(path: string, mode: number, callback?: (err?: NodeJS.ErrnoException) => void): void; + chmod(path: string, mode: string, callback?: (err?: NodeJS.ErrnoException) => void): void; + chmodSync(path: string, mode: number): void; + chmodSync(path: string, mode: string): void; + fchmod(fd: number, mode: number, callback?: (err?: NodeJS.ErrnoException) => void): void; + fchmod(fd: number, mode: string, callback?: (err?: NodeJS.ErrnoException) => void): void; + fchmodSync(fd: number, mode: number): void; + fchmodSync(fd: number, mode: string): void; + lchmod(path: string, mode: number, callback?: (err?: NodeJS.ErrnoException) => void): void; + lchmod(path: string, mode: string, callback?: (err?: NodeJS.ErrnoException) => void): void; + lchmodSync(path: string, mode: number): void; + lchmodSync(path: string, mode: string): void; + stat(path: string, callback?: (err: NodeJS.ErrnoException, stats: fs.Stats) => any): void; + lstat(path: string, callback?: (err: NodeJS.ErrnoException, stats: fs.Stats) => any): void; + fstat(fd: number, callback?: (err: NodeJS.ErrnoException, stats: fs.Stats) => any): void; + statSync(path: string): fs.Stats; + lstatSync(path: string): fs.Stats; + fstatSync(fd: number): fs.Stats; + link(srcpath: string, dstpath: string, callback?: (err?: NodeJS.ErrnoException) => void): void; + linkSync(srcpath: string, dstpath: string): void; + symlink(srcpath: string, dstpath: string, type?: string, callback?: (err?: NodeJS.ErrnoException) => void): void; + symlinkSync(srcpath: string, dstpath: string, type?: string): void; + readlink(path: string, callback?: (err: NodeJS.ErrnoException, linkString: string) => any): void; + readlinkSync(path: string): string; + realpath(path: string, callback?: (err: NodeJS.ErrnoException, resolvedPath: string) => any): void; + realpath(path: string, cache: {[path: string]: string}, callback: (err: NodeJS.ErrnoException, resolvedPath: string) =>any): void; + realpathSync(path: string, cache?: {[path: string]: string}): string; + unlink(path: string, callback?: (err?: NodeJS.ErrnoException) => void): void; + unlinkSync(path: string): void; + rmdir(path: string, callback?: (err?: NodeJS.ErrnoException) => void): void; + rmdirSync(path: string): void; + mkdir(path: string, callback?: (err?: NodeJS.ErrnoException) => void): void; + mkdir(path: string, mode: number, callback?: (err?: NodeJS.ErrnoException) => void): void; + mkdir(path: string, mode: string, callback?: (err?: NodeJS.ErrnoException) => void): void; + mkdirSync(path: string, mode?: number): void; + mkdirSync(path: string, mode?: string): void; + readdir(path: string, callback?: (err: NodeJS.ErrnoException, files: string[]) => void): void; + readdirSync(path: string): string[]; + close(fd: number, callback?: (err?: NodeJS.ErrnoException) => void): void; + closeSync(fd: number): void; + open(path: string, flags: string, callback?: (err: NodeJS.ErrnoException, fd: number) => any): void; + open(path: string, flags: string, mode: number, callback?: (err: NodeJS.ErrnoException, fd: number) => any): void; + open(path: string, flags: string, mode: string, callback?: (err: NodeJS.ErrnoException, fd: number) => any): void; + openSync(path: string, flags: string, mode?: number): number; + openSync(path: string, flags: string, mode?: string): number; + utimes(path: string, atime: number, mtime: number, callback?: (err?: NodeJS.ErrnoException) => void): void; + utimes(path: string, atime: Date, mtime: Date, callback?: (err?: NodeJS.ErrnoException) => void): void; + utimesSync(path: string, atime: number, mtime: number): void; + utimesSync(path: string, atime: Date, mtime: Date): void; + futimes(fd: number, atime: number, mtime: number, callback?: (err?: NodeJS.ErrnoException) => void): void; + futimes(fd: number, atime: Date, mtime: Date, callback?: (err?: NodeJS.ErrnoException) => void): void; + futimesSync(fd: number, atime: number, mtime: number): void; + futimesSync(fd: number, atime: Date, mtime: Date): void; + fsync(fd: number, callback?: (err?: NodeJS.ErrnoException) => void): void; + fsyncSync(fd: number): void; + write(fd: number, buffer: Buffer, offset: number, length: number, position: number, callback?: (err: NodeJS.ErrnoException, written: number, buffer: Buffer) => void): void; + writeSync(fd: number, buffer: Buffer, offset: number, length: number, position: number): number; + read(fd: number, buffer: Buffer, offset: number, length: number, position: number, callback?: (err: NodeJS.ErrnoException, bytesRead: number, buffer: Buffer) => void): void; + readSync(fd: number, buffer: Buffer, offset: number, length: number, position: number): number; + readFile(filename: string, encoding: string, callback: (err: NodeJS.ErrnoException, data: string) => void): void; + readFile(filename: string, options: { encoding: string; flag?: string; }, callback: (err: NodeJS.ErrnoException, data: string) => void): void; + readFile(filename: string, options: { flag?: string; }, callback: (err: NodeJS.ErrnoException, data: Buffer) => void): void; + readFile(filename: string, callback: (err: NodeJS.ErrnoException, data: Buffer) => void ): void; + readFileSync(filename: string, encoding: string): string; + readFileSync(filename: string, options: { encoding: string; flag?: string; }): string; + readFileSync(filename: string, options?: { flag?: string; }): Buffer; + writeFile(filename: string, data: any, callback?: (err: NodeJS.ErrnoException) => void): void; + writeFile(filename: string, data: any, options: { encoding?: string; mode?: number; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void; + writeFile(filename: string, data: any, options: { encoding?: string; mode?: string; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void; + writeFileSync(filename: string, data: any, options?: { encoding?: string; mode?: number; flag?: string; }): void; + writeFileSync(filename: string, data: any, options?: { encoding?: string; mode?: string; flag?: string; }): void; + appendFile(filename: string, data: any, options: { encoding?: string; mode?: number; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void; + appendFile(filename: string, data: any, options: { encoding?: string; mode?: string; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void; + appendFile(filename: string, data: any, callback?: (err: NodeJS.ErrnoException) => void): void; + appendFileSync(filename: string, data: any, options?: { encoding?: string; mode?: number; flag?: string; }): void; + appendFileSync(filename: string, data: any, options?: { encoding?: string; mode?: string; flag?: string; }): void; + watchFile(filename: string, listener: (curr: fs.Stats, prev: fs.Stats) => void): void; + watchFile(filename: string, options: { persistent?: boolean; interval?: number; }, listener: (curr: fs.Stats, prev: fs.Stats) => void): void; + unwatchFile(filename: string, listener?: (curr: fs.Stats, prev: fs.Stats) => void): void; + watch(filename: string, listener?: (event: string, filename: string) => any): fs.FSWatcher; + watch(filename: string, options: { persistent?: boolean; }, listener?: (event: string, filename: string) => any): fs.FSWatcher; + exists(path: string, callback?: (exists: boolean) => void): void; + existsSync(path: string): boolean; + createReadStream(path: string, options?: { + flags?: string; + encoding?: string; + fd?: string; + mode?: number; + bufferSize?: number; + }): fs.ReadStream; + createReadStream(path: string, options?: { + flags?: string; + encoding?: string; + fd?: string; + mode?: string; + bufferSize?: number; + }): fs.ReadStream; + createWriteStream(path: string, options?: { + flags?: string; + encoding?: string; + string?: string; + }): fs.WriteStream; + } + + export = FS; + +} \ No newline at end of file diff --git a/ftp/ftp-tests.ts b/ftp/ftp-tests.ts new file mode 100644 index 000000000..2e37e53f9 --- /dev/null +++ b/ftp/ftp-tests.ts @@ -0,0 +1,28 @@ +/// +/// + +import Client = require("ftp"); +import fs = require("fs"); + +var c = new Client(); +c.on('ready', (): void => { + c.get('foo.txt', function(err: Error, stream: NodeJS.ReadableStream): void { + if (err) throw err; + stream.once('close', function(): void { + c.end(); + }); + stream.pipe(fs.createWriteStream('foo.local-copy.txt')); + }); +}); +// connect to localhost:21 as anonymous +c.connect(); + +c.connect({ + host: "127.0.0.1", + port: 21, + username: "Boo", + password: "secret" +}); + + + diff --git a/ftp/ftp.d.ts b/ftp/ftp.d.ts new file mode 100644 index 000000000..764505037 --- /dev/null +++ b/ftp/ftp.d.ts @@ -0,0 +1,294 @@ +// Type definitions for ftp 0.3.8 +// Project: https://github.com/mscdex/node-ftp +// Definitions by: Rogier Schouten +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module "ftp" { + + import events = require("events"); + import tls = require("tls"); + + module Client { + + /** + * Options for Client#connect() + */ + export interface Options { + /** + * The hostname or IP address of the FTP server. Default: 'localhost' + */ + host?: string; + /** + * The port of the FTP server. Default: 21 + */ + port?: number; + /** + * Set to true for both control and data connection encryption, 'control' for control connection encryption only, or 'implicit' for + * implicitly encrypted control connection (this mode is deprecated in modern times, but usually uses port 990) Default: false + */ + secure?: string|boolean; + /** + * Additional options to be passed to tls.connect(). Default: (none) + */ + secureOptions?: tls.ConnectionOptions; + /** + * Username for authentication. Default: 'anonymous' + */ + user?: string; + /** + * Password for authentication. Default: 'anonymous@' + */ + password?: string; + /** + * How long (in milliseconds) to wait for the control connection to be established. Default: 10000 + */ + connTimeout?: number; + /** + * How long (in milliseconds) to wait for a PASV data connection to be established. Default: 10000 + */ + pasvTimeout?: number; + /** + * How often (in milliseconds) to send a 'dummy' (NOOP) command to keep the connection alive. Default: 10000 + */ + keepalive?: number; + } + + /** + * Element returned by Client#list() + */ + export interface ListingElement { + /** + * A single character denoting the entry type: 'd' for directory, '-' for file (or 'l' for symlink on **\*NIX only**). + */ + "type": string; + /** + * The name of the entry + */ + name: string; + /** + * The size of the entry in bytes + */ + size: string; + /** + * The last modified date of the entry + */ + date: Date; + /** + * The various permissions for this entry **(*NIX only)** + */ + rights?: { + /** + * An empty string or any combination of 'r', 'w', 'x'. + */ + user: string; + /** + * An empty string or any combination of 'r', 'w', 'x'. + */ + group: string; + /** + * An empty string or any combination of 'r', 'w', 'x'. + */ + other: string; + }; + /** + * The user name or ID that this entry belongs to **(*NIX only)**. + */ + owner?: string; + /** + * The group name or ID that this entry belongs to **(*NIX only)**. + */ + group?: string; + /** + * For symlink entries, this is the symlink's target **(*NIX only)**. + */ + target?: string; + /** + * True if the sticky bit is set for this entry **(*NIX only)**. + */ + sticky?: boolean; + } + } + + + /** + * FTP client. + * + * Events: + * @event greeting(< string >msg) - Emitted after connection. msg is the text the server sent upon connection. + * @event ready() - Emitted when connection and authentication were sucessful. + * @event close(< boolean >hadErr) - Emitted when the connection has fully closed. + * @event end() - Emitted when the connection has ended. + * @event error(< Error >err) - Emitted when an error occurs. In case of protocol-level errors, err contains + * a 'code' property that references the related 3-digit FTP response code. + */ + class Client extends events.EventEmitter { + + /** + * Creates and returns a new FTP client instance. + */ + constructor(); + + /** + * Connects to an FTP server. + */ + connect(config?: Client.Options): void; + + /** + * Closes the connection to the server after any/all enqueued commands have been executed. + */ + end(): void; + + /** + * Closes the connection to the server immediately. + */ + destroy(): void; + + /** + * Retrieves the directory listing of path. + * @param path defaults to the current working directory. + * @param useCompression defaults to false. + */ + list(path: string, useCompression: boolean, callback: (error: Error, listing: Client.ListingElement[]) => void): void; + list(path: string, callback: (error: Error, listing: Client.ListingElement[]) => void): void; + list(useCompression: boolean, callback: (error: Error, listing: Client.ListingElement[]) => void): void; + list(callback: (error: Error, listing: Client.ListingElement[]) => void): void; + + /** + * Retrieves a file at path from the server. useCompression defaults to false + */ + get(path: string, callback: (error: Error, stream: NodeJS.ReadableStream) => void): void; + get(path: string, useCompression: boolean, callback: (error: Error, stream: NodeJS.ReadableStream) => void): void; + + /** + * Sends data to the server to be stored as destPath. + * @param input can be a ReadableStream, a Buffer, or a path to a local file. + * @param destPath + * @param useCompression defaults to false. + */ + put(input: NodeJS.ReadableStream|Buffer|string, destPath: string, useCompression: boolean, callback: (error: Error) => void): void; + put(input: NodeJS.ReadableStream|Buffer|string, destPath: string, callback: (error: Error) => void): void; + + /** + * Same as put(), except if destPath already exists, it will be appended to instead of overwritten. + * @param input can be a ReadableStream, a Buffer, or a path to a local file. + * @param destPath + * @param useCompression defaults to false. + */ + append(input: NodeJS.ReadableStream|Buffer|string, destPath: string, useCompression: boolean, callback: (error: Error) => void): void; + append(input: NodeJS.ReadableStream|Buffer|string, destPath: string, callback: (error: Error) => void): void; + + /** + * Renames oldPath to newPath on the server + */ + rename(oldPath: string, newPath: string, callback: (error: Error) => void): void; + + /** + * Logout the user from the server. + */ + logout(callback: (error: Error) => void): void; + + /** + * Delete a file on the server + */ + delete(path: string, callback: (error: Error) => void): void; + + /** + * Changes the current working directory to path. callback has 2 parameters: < Error >err, < string >currentDir. + * Note: currentDir is only given if the server replies with the path in the response text. + */ + cwd(path: string, callback: (error: Error, currentDir?: string) => void): void; + + /** + * Aborts the current data transfer (e.g. from get(), put(), or list()) + */ + abort(callback: (error: Error) => void): void; + + /** + * Sends command (e.g. 'CHMOD 755 foo', 'QUOTA') using SITE. callback has 3 parameters: + * < Error >err, < _string >responseText, < integer >responseCode. + */ + site(command: string, callback: (error: Error, responseText: string, responseCode: number) => void): void; + + /** + * Retrieves human-readable information about the server's status. + */ + status(callback: (error: Error, status: string) => void): void; + + /** + * Sets the transfer data type to ASCII. + */ + ascii(callback: (error: Error) => void): void; + + /** + * Sets the transfer data type to binary (default at time of connection). + */ + binary(callback: (error: Error) => void): void; + + /** + * Optional "standard" commands (RFC 959) + * Creates a new directory, path, on the server. recursive is for enabling a 'mkdir -p' algorithm and defaults to false + */ + mkdir(path: string, recursive: boolean, callback: (error: Error) => void): void; + mkdir(path: string, callback: (error: Error) => void): void; + + + /** + * Optional "standard" commands (RFC 959) + * Removes a directory, path, on the server. If recursive, this call will delete the contents of the directory if it is not empty + */ + rmdir(path: string, recursive: boolean, callback: (error: Error) => void): void; + rmdir(path: string, callback: (error: Error) => void): void; + + /** + * Optional "standard" commands (RFC 959) + * Changes the working directory to the parent of the current directory + */ + cdup(callback: (error: Error) => void): void; + + /** + * Optional "standard" commands (RFC 959) + * Retrieves the current working directory + */ + pwd(callback: (error: Error, path: string) => void): void; + + /** + * Optional "standard" commands (RFC 959) + * Retrieves the server's operating system. + */ + system(callback: (error: Error, OS: string) => void): void; + + /** + * Optional "standard" commands (RFC 959) + * Similar to list(), except the directory is temporarily changed to path to retrieve the directory listing. + * This is useful for servers that do not handle characters like spaces and quotes in directory names well for the LIST command. + * This function is "optional" because it relies on pwd() being available. + */ + listSafe(path: string, useCompression: boolean, callback: (error: Error, listing: Client.ListingElement[]) => void): void; + listSafe(path: string, callback: (error: Error, listing: Client.ListingElement[]) => void): void; + listSafe(useCompression: boolean, callback: (error: Error, listing: Client.ListingElement[]) => void): void; + listSafe(callback: (error: Error, listing: Client.ListingElement[]) => void): void; + + /** + * Extended commands (RFC 3659) + * Retrieves the size of path + */ + size(path: string, callback: (error: Error, size: number) => void): void; + + /** + * Extended commands (RFC 3659) + * Retrieves the last modified date and time for path + */ + lastMod(path: string, callback: (error: Error, lastMod: Date) => void): void; + + /** + * Extended commands (RFC 3659) + * Sets the file byte offset for the next file transfer action (get/put) to byteOffset + */ + restart(byteOffset: number, callback: (error: Error) => void): void; + + } + + export = Client; +} diff --git a/ftpd/ftpd-tests.ts b/ftpd/ftpd-tests.ts new file mode 100644 index 000000000..9d8485a9e --- /dev/null +++ b/ftpd/ftpd-tests.ts @@ -0,0 +1,32 @@ +/// + +import ftpd = require("ftpd"); + +var options: ftpd.FtpServerOptions = { + pasvPortRangeStart: 4000, + pasvPortRangeEnd: 5000, + getInitialCwd: function(connection: ftpd.FtpConnection, callback: (error: Error, path: string) => void): void { + callback(null, "boo"); + }, + getRoot: function(connection: ftpd.FtpConnection): string { + return '/'; + } +}; + +var host: string = '10.0.0.42'; + +var server = new ftpd.FtpServer(host, options); + +server.on('client:connected', function(conn: ftpd.FtpConnection): void { + conn.on('command:user', function(user: string, success: () => void, failure: () => void): void { + success(); + }); + conn.on('command:pass', function( + pass: string, + success: (username: string, fs?: ftpd.FtpFileSystem) => void, + failure: () => void) { + success("Rogier"); + }); +}); + +server.listen(21); diff --git a/ftpd/ftpd.d.ts b/ftpd/ftpd.d.ts new file mode 100644 index 000000000..ac0123256 --- /dev/null +++ b/ftpd/ftpd.d.ts @@ -0,0 +1,202 @@ +// Type definitions for ftpd 0.2.11 +// Project: https://github.com/sstur/nodeftpd +// Definitions by: Rogier Schouten +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module "ftpd" { + + import events = require("events"); + import fs = require("fs"); + import net = require("net"); + import tls = require("tls"); + + /** + * Options for FtpServer constructor + */ + export interface FtpServerOptions { + /** + * Gets the initial working directory for the user. Called after user is authenticated + * Typical cases where you would want/need the callback involve retrieving configurations from external datasources and suchlike. + */ + getInitialCwd: (connection: FtpConnection, callback?: (error: Error, path: string) => void) => void|string; + /** + * Gets the root directory for the user relative to the CWD. Called after getInitialCwd. The user is not able to escape this directory. + * Typical cases where you would want/need the callback involve retrieving configurations from external datasources and suchlike. + */ + getRoot: (connection: FtpConnection, callback?: (error: Error, path: string) => void) => void|string; + /** + * If set to true, then files which the client uploads are buffered in memory and then written to disk using writeFile. + * If false, files are written using writeStream. + */ + useWriteFile?: boolean; + /** + * If set to true, then files which the client uploads are slurped using 'readFile'. + * If false, files are read using readStream. + */ + useReadFile?: boolean; + /** + * Determines the maximum file size (in bytes) for which uploads are buffered in memory before being written to disk. + * Has an effect only if useWriteFile is set to true. + * If uploadMaxSlurpSize is not set, then there is no limit on buffer size. + */ + uploadMaxSlurpSize?: number; + /** + * The maximum number of concurrent calls to fs.stat which will be made when processing a LIST request. Default 5. + */ + maxStatsAtOnce?: number; + /** + * A function which can be used as the argument of an array's sort method. Used to sort filenames for directory listings. + * See [https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/sort] for more info. + */ + filenameSortFunc?: (a: string, b: string) => number; + /** + * A function which is applied to each filename before sorting. + * If set to false, filenames are unaltered. + */ + filenameSortMap?: ((a: string) => string) | boolean; + /** + * If this is set, then filenames are not sorted in responses to the LIST and NLST commands. + */ + dontSortFilenames?: boolean; + /** + * If set to true, then LIST and NLST treat the characters ? and * as literals instead of as wildcards. + */ + noWildcards?: boolean; + /** + * If this is set, the server will allow explicit TLS authentication. Value should be a dictionary which is suitable as the options argument of tls.createServer. + */ + tlsOptions?: tls.TlsOptions; + /** + * If this is set to true, and tlsOptions is also set, then the server will not allow logins over non-secure connections. + * Default false + */ + tlsOnly?: boolean; + /** + * I obviously set this to true when tlsOnly is on -someone needs to update this. + */ + allowUnauthorizedTls?: boolean; + /** + * Integer, specifies the lower-bound port (min port) for creating PASV connections + */ + pasvPortRangeStart?: number; + /** + * Integer, specifies the upper-bound port (max port) for creating PASV connections + */ + pasvPortRangeEnd?: number; + } + + /** + * Represents one Ftp connection. Incomplete type definition. + * + * @event command:user (username: string, success: () => void, failure: () => void) + * @event command:pass (password: string, success: (username: string, fs?: FtpFileSystem) => void, failure: () => void) + * The server raises a command:pass event which is given pass, success and failure arguments. + * On successful login, success should be called with a username argument. It may also optionally + * be given a second argument, which should be an object providing an implementation of the API for Node's fs module. + */ + export class FtpConnection extends events.EventEmitter { + server: FtpServer; + socket: net.Socket; + pasv: net.Server; + dataSocket: net.Socket; // the actual data socket + mode: string; + username: string; + cwd: string; + root: string; + hasQuit: boolean; + // State for handling TLS upgrades. + secure: boolean; + pbszReceived: boolean; + } + + + /** + * Optional mock fs implementation to set in the command:pass event of FtpConnection + */ + export interface FtpFileSystem { + unlink: (path: string, callback?: (err?: NodeJS.ErrnoException) => void) => void; + readdir: (path: string, callback?: (err: NodeJS.ErrnoException, files: string[]) => void) => void; + mkdir: ((path: string, callback?: (err?: NodeJS.ErrnoException) => void) => void) + | ((path: string, mode: number, callback?: (err?: NodeJS.ErrnoException) => void) => void) + | ((path: string, mode: string, callback?: (err?: NodeJS.ErrnoException) => void) => void); + open: ((path: string, flags: string, callback?: (err: NodeJS.ErrnoException, fd: number) => any) => void) + | ((path: string, flags: string, mode: number, callback?: (err: NodeJS.ErrnoException, fd: number) => any) => void) + | ((path: string, flags: string, mode: string, callback?: (err: NodeJS.ErrnoException, fd: number) => any) => void); + close: (fd: number, callback?: (err?: NodeJS.ErrnoException) => void) => void; + rmdir: (path: string, callback?: (err?: NodeJS.ErrnoException) => void) => void; + rename: (oldPath: string, newPath: string, callback?: (err?: NodeJS.ErrnoException) => void) => void; + /** + * specific object properties: { mode, isDirectory(), size, mtime } + */ + stat: (path: string, callback?: (err: NodeJS.ErrnoException, stats: fs.Stats) => any) => void; + /** + * if useReadFile option is not set or is false + */ + createReadStream?: (path: string, options?: { + flags?: string; + encoding?: string; + fd?: string; + mode?: string; + bufferSize?: number; + }) => fs.ReadStream; + /** + * if useWriteFile option is not set or is false + */ + createWriteStream?: (path: string, options?: { + flags?: string; + encoding?: string; + string?: string; + }) => fs.WriteStream; + /** + * if useReadFile option is set to 'true' + */ + readFile?: + ((filename: string, encoding: string, callback: (err: NodeJS.ErrnoException, data: string) => void) => void) + | ((filename: string, options: { encoding: string; flag?: string; }, callback: (err: NodeJS.ErrnoException, data: string) => void) => void) + | ((filename: string, options: { flag?: string; }, callback: (err: NodeJS.ErrnoException, data: Buffer) => void) => void) + | ((filename: string, callback: (err: NodeJS.ErrnoException, data: Buffer) => void ) => void); + /** + * if useWriteFile option is set to 'true' + */ + writeFile?: + ((filename: string, data: any, callback?: (err: NodeJS.ErrnoException) => void) => void) + | ((filename: string, data: any, options: { encoding?: string; mode?: number; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void) => void) + | ((filename: string, data: any, options: { encoding?: string; mode?: string; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void) => void); + + } + + /** + * FTP server + * + * Events: + * @event close net.Server close event + * @event error net.Server error event + * @event client:connected (connection: FtpConnection) + */ + export class FtpServer extends events.EventEmitter { + + /** + * @param host host is a string representation of the IP address clients use to connect to the FTP server. + * It's imperative that this actually reflects the remote IP the clients use to access the server, + * as this IP will be used in the establishment of PASV data connections. If this IP is not the one clients use to connect, + * you will see some strange behavior from the client side (hangs). + * @param options See test.js for a simple example. + */ + constructor(host: string, options: FtpServerOptions); + + /** + * Start listening, see net.Server.listen() + */ + public listen(port: number, host?: string, backlog?: number, listeningListener?: () => void): void; + + /** + * Stop listening + */ + public close(callback?: () => void): void; + } + + + +} diff --git a/gulp-mocha/gulp-mocha.d.ts b/gulp-mocha/gulp-mocha.d.ts index e6bc099c3..8d21b1323 100644 --- a/gulp-mocha/gulp-mocha.d.ts +++ b/gulp-mocha/gulp-mocha.d.ts @@ -7,6 +7,6 @@ /// declare module "gulp-mocha" { - function mocha(setupOptions: MochaSetupOptions): NodeJS.ReadWriteStream; + function mocha(setupOptions?: MochaSetupOptions): NodeJS.ReadWriteStream; export = mocha; } \ No newline at end of file diff --git a/gulp-replace/gulp-replace.d.ts b/gulp-replace/gulp-replace.d.ts index 6607da98c..cf6ef7164 100644 --- a/gulp-replace/gulp-replace.d.ts +++ b/gulp-replace/gulp-replace.d.ts @@ -10,8 +10,12 @@ declare module "gulp-replace" { skipBinary?: boolean; } - function replace(pattern: string, replacement: string, opts?: Options): NodeJS.ReadWriteStream; - function replace(pattern: RegExp, replacement: string, opts?: Options): NodeJS.ReadWriteStream; + interface Replacer { + (match: string): string + } + + function replace(pattern: string, replacement: string | Replacer, opts?: Options): NodeJS.ReadWriteStream; + function replace(pattern: RegExp, replacement: string | Replacer, opts?: Options): NodeJS.ReadWriteStream; export = replace; } \ No newline at end of file diff --git a/gulp-tslint/gulp-tslint-tests.ts b/gulp-tslint/gulp-tslint-tests.ts index 2f12ace8f..fd4b1fe88 100644 --- a/gulp-tslint/gulp-tslint-tests.ts +++ b/gulp-tslint/gulp-tslint-tests.ts @@ -33,6 +33,12 @@ gulp.task('invalid-custom', function(){ .pipe(tslint.report(testReporter)); }); +gulp.task('invalid-custom', function () { + gulp.src('invalid.ts') + .pipe(tslint()) + .pipe(tslint.report(testReporter, { emitError: false })); +}); + gulp.task('tslint-json', function(){ gulp.src('invalid.ts') .pipe(tslint({ diff --git a/gulp-tslint/gulp-tslint.d.ts b/gulp-tslint/gulp-tslint.d.ts index 4ef5f0f8f..99b990277 100644 --- a/gulp-tslint/gulp-tslint.d.ts +++ b/gulp-tslint/gulp-tslint.d.ts @@ -32,10 +32,9 @@ declare module "gulp-tslint" { ruleName: string; } - export function report(reporter?: string): NodeJS.ReadWriteStream; - export function report(reporter: string, options?: Options): NodeJS.ReadWriteStream; + type Reporter = string|((output: Output[], file: vinyl, options: Options) => any); + export function report(reporter?: Reporter, options?: Options): NodeJS.ReadWriteStream; export function report(options?: Options): NodeJS.ReadWriteStream; - export function report(reporter?: (output: Output[], file: vinyl, options: Options) => any): NodeJS.ReadWriteStream; } diff --git a/gulp-typescript/gulp-typescript-tests.ts b/gulp-typescript/gulp-typescript-tests.ts index 29baf2ad2..1dd2fbb37 100644 --- a/gulp-typescript/gulp-typescript-tests.ts +++ b/gulp-typescript/gulp-typescript-tests.ts @@ -37,4 +37,9 @@ gulp.task('scripts', function() { }); gulp.task('watch', ['scripts'], function() { gulp.watch('lib/*.ts', ['scripts']); -}); \ No newline at end of file +}); + +gulp.task('scripts', function () { + return gulp.src('lib/*.ts') + .pipe(typescript(tsProject, undefined, typescript.reporter.fullReporter())); +}); diff --git a/gulp-typescript/gulp-typescript.d.ts b/gulp-typescript/gulp-typescript.d.ts index bffc6acfe..2eb3c3282 100644 --- a/gulp-typescript/gulp-typescript.d.ts +++ b/gulp-typescript/gulp-typescript.d.ts @@ -6,7 +6,7 @@ /// declare module "gulp-typescript" { - function GulpTypescript(params: GulpTypescript.Params, filters?: GulpTypescript.FilterSettings): GulpTypescript.CompilationStream; + function GulpTypescript(params: GulpTypescript.Params, filters?: GulpTypescript.FilterSettings, reporter?: GulpTypescript.Reporter): GulpTypescript.CompilationStream; module GulpTypescript { export function createProject(params: Params): Params; @@ -28,10 +28,20 @@ declare module "gulp-typescript" { referencedFrom?: string[]; } + interface Reporter { + error(error: any): void; + } + interface CompilationStream extends NodeJS.ReadWriteStream { dts: NodeJS.ReadWriteStream; js: NodeJS.ReadWriteStream; } + + module reporter { + function nullReporter(): Reporter; + function defaultReporter(): Reporter; + function fullReporter(showFullFilename?: boolean): Reporter; + } } export = GulpTypescript; diff --git a/handlebars/handlebars.d.ts b/handlebars/handlebars.d.ts index 076381571..c118760c5 100644 --- a/handlebars/handlebars.d.ts +++ b/handlebars/handlebars.d.ts @@ -38,13 +38,13 @@ interface HandlebarsStatic extends HandlebarsCommon { compile(input: any, options?: any): HandlebarsTemplateDelegate; } -interface HandlebarsTemplates { - [index: string]: HandlebarsTemplateDelegate; +interface HandlebarsTemplates { + [index: string]: HandlebarsTemplateDelegate; } -interface HandlebarsRuntimeStatic extends HandlebarsCommon { +interface HandlebarsRuntimeStatic extends HandlebarsCommon { // Handlebars.templates is the default template namespace in precompiler. - templates: HandlebarsTemplates; + templates: HandlebarsTemplates; } declare module hbs { diff --git a/hapi/hapi-tests.ts b/hapi/hapi-tests.ts index 586d3d29f..058903637 100644 --- a/hapi/hapi-tests.ts +++ b/hapi/hapi-tests.ts @@ -1,9 +1,13 @@ /// -import Hapi = require('hapi'); +import Hapi = require("hapi"); // Create a server with a host and port -var server = Hapi.createServer('localhost', 8000); +var server = new Hapi.Server(); +server.connection({ + host: "localhost", + port: 8000, +}); // Add plugins var plugin: any = { @@ -13,26 +17,26 @@ var plugin: any = { }; plugin.register.attributes = { - name: 'test', - version: '1.0.0' + name: "test", + version: "1.0.0" }; -server.pack.register(plugin, (err: Object) => { - if (err) { throw err; } -}); +//server.pack.register(plugin, (err: Object) => { +// if (err) { throw err; } +//}); -server.pack.register([plugin], (err: Object) => { - if (err) { throw err; } -}); +//server.pack.register([plugin], (err: Object) => { +// if (err) { throw err; } +//}); // Add server method var add = function (a: number, b: number, next: (err: any, result?: any, ttl?: number) => void) { next(null, a + b); }; -server.method('sum', add, { cache: { expiresIn: 2000 } }); +server.method("sum", add);//, { cache: { expiresIn: 2000 } }); -server.methods.sum(4, 5, (err: any, result: any) => { +server.methods["sum"](4, 5, (err: any, result: any) => { console.log(result); }); @@ -44,14 +48,14 @@ var addArray = function (array: Array, next: (err: any, result?: any, tt next(null, sum); }; -server.method('sumObj', addArray, { - cache: { expiresIn: 2000 }, +server.method("sumObj", addArray, { + //cache: { expiresIn: 2000 }, generateKey: (array: Array) => { return array.join(','); } }); -server.methods.sumObj([5, 6], (err: any, result: any) => { +server.methods["sumObj"]([5, 6], (err: any, result: any) => { console.log(result); }); diff --git a/hapi/hapi.d.ts b/hapi/hapi.d.ts index 7cfe80aaa..61a2ef2d5 100644 --- a/hapi/hapi.d.ts +++ b/hapi/hapi.d.ts @@ -1,459 +1,2211 @@ -// Type definitions for hapi +// Type definitions for hapi 8.2.0 // Project: http://github.com/spumko/hapi -// Definitions by: Hakubo +// Definitions by: Jason Swearingen // Definitions: https://github.com/borisyankov/DefinitelyTyped -/// +//This is a total rewrite of Hakubo's original hapi.d.ts, as it was out of date/incomplete. -declare module Hapi { - export interface ServerOptions { + +/// +/// + + + + +declare module "hapi" { + import http = require("http"); + import stream = require("stream"); + import Events = require("events"); + + interface IDictionary { + [key: string]: T; + } + + /** Boom Module for errors. https://github.com/hapijs/boom + * boom provides a set of utilities for returning HTTP errors. Each utility returns a Boom error response object (instance of Error) which includes the following properties: */ + export interface IBoom extends Error { + /** if true, indicates this is a Boom object instance. */ + isBoom: boolean; + /** convenience bool indicating status code >= 500. */ + isServer: boolean; + /** the error message. */ + message: string; + /** the formatted response.Can be directly manipulated after object construction to return a custom error response.Allowed root keys: */ + output: { + /** the HTTP status code (typically 4xx or 5xx). */ + statusCode: number; + /** an object containing any HTTP headers where each key is a header name and value is the header content. */ + headers: IDictionary; + /** the formatted object used as the response payload (stringified).Can be directly manipulated but any changes will be lost if reformat() is called.Any content allowed and by default includes the following content: */ + payload: { + /** the HTTP status code, derived from error.output.statusCode. */ + statusCode: number; + /** the HTTP status message (e.g. 'Bad Request', 'Internal Server Error') derived from statusCode. */ + error: string; + /** the error message derived from error.message. */ + message: string; + }; + }; + /** reformat()rebuilds error.output using the other object properties. */ + reformat(): void; + + } + + /** cache functionality via the "CatBox" module. */ + export interface ICatBoxCacheOptions { + /** a prototype function or catbox engine object. */ + engine: any; + /** an identifier used later when provisioning or configuring caching for server methods or plugins. Each cache name must be unique. A single item may omit the name option which defines the default cache. If every cache includes a name, a default memory cache is provisions as well. */ + name?: string; + /** if true, allows multiple cache users to share the same segment (e.g. multiple methods using the same cache storage container). Default to false. */ + shared?: boolean; + } + + /** Any connections configuration server defaults can be included to override and customize the individual connection. */ + export interface ISeverConnectionOptions extends IConnectionConfigurationServerDefaults { + /** - the public hostname or IP address. Used only to set server.info.host and server.info.uri. If not configured, defaults to the operating system hostname and if not available, to 'localhost'.*/ + host?: string; + /** - sets the host name or IP address the connection will listen on.If not configured, defaults to host if present, otherwise to all available network interfaces (i.e. '0.0.0.0').Set to 127.0.0.1 or localhost to restrict connection to only those coming from the same machine.*/ + address?: string; + /** - the TCP port the connection will listen to.Defaults to an ephemeral port (0) which uses an available port when the server is started (and assigned to server.info.port).If port is a string containing a '/' character, it is used as a UNIX domain socket path and if it starts with '\.\pipe' as a Windows named pipe.*/ + port?: string|number; + /** - the full public URI without the path (e.g. 'http://example.com:8080').If present, used as the connection info.uri otherwise constructed from the connection settings.*/ + uri?: string; + /** - optional node.js HTTP (or HTTPS) http.Server object or any compatible object.If the listener needs to be manually started, set autoListen to false.If the listener uses TLS, set tls to true.*/ + listener?: any; + /** - indicates that the connection.listener will be started manually outside the framework.Cannot be specified with a port setting.Defaults to true.*/ + autoListen?: boolean; + /** caching headers configuration: */ + cache?: { + /** - an array of HTTP response status codes (e.g. 200) which are allowed to include a valid caching directive.Defaults to [200]. */ + statuses: number[]; + }; + /** - a string or string array of labels used to server.select() specific connections matching the specified labels.Defaults to an empty array [](no labels).*/ + labels?: string|string[]; + /** - used to create an HTTPS connection.The tls object is passed unchanged as options to the node.js HTTPS server as described in the node.js HTTPS documentation.Set to true when passing a listener object that has been configured to use TLS directly. */ + tls?: boolean; + + } + + export interface IConnectionConfigurationServerDefaults { + /** application-specific connection configuration which can be accessed via connection.settings.app. Provides a safe place to store application configuration without potential conflicts with the framework internals. Should not be used to configure plugins which should use plugins[name]. Note the difference between connection.settings.app which is used to store configuration values and connection.app which is meant for storing run-time state. */ app?: any; -// cache?: string; -// cache?: { -// engine: any; -// }; - cache?: any; -// cors?: boolean; -// cors?: { -// origin?: Array; -// isOriginExposed?: boolean; -// matchOrigin?: boolean; -// maxAge?: number; -// headers?: Array; -// additionalHeaders?: Array; -// methods?: Array; -// additionalMethods?: Array; -// exposedHeaders?: Array; -// additionalExposedHeaders?: Array; -// credentials?: boolean; -// }; - cors?: any; -// security?: boolean; -// security?: { -// hsts?: boolean; -// hsts?: { -// maxAge: number; -// includeSubdomains: boolean; -// }; -// xframe?: boolean; -// xframe?: string; -// xframe?: { -// rule: string; -// source: any; -// }; -// xss?: boolean; -// noOpen?: boolean; -// noSniff?: boolean; -// }; - security?: any; - debug?: { - request: Array; - }; - files?: { - relativeTo: string; - etagsCacheMaxSize: number; - }; - json?: { -// replacer?: () => void; -// replacer?: Array<() => void>; - replacer?: any; - space?: number; - }; - labels?: Array; + /** connection load limits configuration where: */ load?: { - maxHeapUsedBytes?: number; - maxRssBytes?: number; - maxEventLoopDelay?: number; + /** maximum V8 heap size over which incoming requests are rejected with an HTTP Server Timeout (503) response. Defaults to 0 (no limit). */ + maxHeapUsedBytes: number; + /** maximum process RSS size over which incoming requests are rejected with an HTTP Server Timeout (503) response. Defaults to 0 (no limit). */ + maxRssBytes: number; + /** maximum event loop delay duration in milliseconds over which incoming requests are rejected with an HTTP Server Timeout (503) response. Defaults to 0 (no limit). */ + maxEventLoopDelay: number; + }; + /** plugin-specific configuration which can later be accessed via connection.settings.plugins. Provides a place to store and pass connection-specific plugin configuration. plugins is an object where each key is a plugin name and the value is the configuration. Note the difference between connection.settings.plugins which is used to store configuration values and connection.plugins which is meant for storing run-time state. */ + plugins?: any; + /** controls how incoming request URIs are matched against the routing table: */ + router?: { + /** determines whether the paths '/example' and '/EXAMPLE' are considered different resources. Defaults to true. */ + isCaseSensitive: boolean; + /** removes trailing slashes on incoming paths. Defaults to false. */ + stripTrailingSlash: boolean; + }; + /** a route options object used to set the default configuration for every route. */ + routes?: IRouteAdditionalConfigurationOptions; + state?: IServerState; + } + + /** Note that the options object is deeply cloned and cannot contain any values that are unsafe to perform deep copy on.*/ + export interface IServerOptions { + /** application-specific configuration which can later be accessed via server.settings.app. Note the difference between server.settings.app which is used to store static configuration values and server.app which is meant for storing run-time state. Defaults to {}. */ + app?: any; + /** sets up server-side caching. Every server includes a default cache for storing application state. By default, a simple memory-based cache is created which has limited capacity and capabilities. hapi uses catbox for its cache which includes support for common storage solutions (e.g. Redis, MongoDB, Memcached, and Riak). Caching is only utilized if methods and plugins explicitly store their state in the cache. The server cache configuration only defines the storage container itself. cache can be assigned: + a prototype function (usually obtained by calling require() on a catbox strategy such as require('catbox-redis')). + a configuration object with the following options: + enginea prototype function or catbox engine object. + namean identifier used later when provisioning or configuring caching for server methods or plugins. Each cache name must be unique. A single item may omit the name option which defines the default cache. If every cache includes a name, a default memory cache is provisions as well. + sharedif true, allows multiple cache users to share the same segment (e.g. multiple methods using the same cache storage container). Default to false. + other options passed to the catbox strategy used. + an array of the above object for configuring multiple cache instances, each with a unique name. When an array of objects is provided, multiple cache connections are established and each array item (except one) must include a name. */ + cache?: string|ICatBoxCacheOptions|Array|any; + /** sets the default connections configuration which can be overridden by each connection where: */ + connections?: IConnectionConfigurationServerDefaults; + /** determines which logged events are sent to the console (this should only be used for development and does not affect which events are actually logged internally and recorded). Set to false to disable all console logging, or to an object*/ + debug?: boolean|{ + /** - a string array of server log tags to be displayed via console.error() when the events are logged via server.log() as well as internally generated server logs. For example, to display all errors, set the option to ['error']. To turn off all console debug messages set it to false. Defaults to uncaught errors thrown in external code (these errors are handled automatically and result in an Internal Server Error response) or runtime errors due to developer error. */ + log: string[]; + /** - a string array of request log tags to be displayed via console.error() when the events are logged via request.log() as well as internally generated request logs. For example, to display all errors, set the option to ['error']. To turn off all console debug messages set it to false. Defaults to uncaught errors thrown in external code (these errors are handled automatically and result in an Internal Server Error response) or runtime errors due to developer error.*/ + request: string[]; + }; + /** file system related settings*/ + files?: { + /** sets the maximum number of file etag hash values stored in the etags cache. Defaults to 10000.*/ + etagsCacheMaxSize?: number; + }; + /** process load monitoring*/ + load?: { + /** the frequency of sampling in milliseconds. Defaults to 0 (no sampling).*/ sampleInterval?: number; }; - location?: string; + + /** options passed to the mimos module (https://github.com/hapijs/mimos) when generating the mime database used by the server and accessed via server.mime.*/ + mime: any; + /** if true, does not load the inert (file and directory support), h2o2 (proxy support), and vision (views support) plugins automatically. The plugins can be loaded manually after construction. Defaults to false (plugins loaded). */ + minimal: boolean; + /** plugin-specific configuration which can later be accessed via server.settings.plugins. plugins is an object where each key is a plugin name and the value is the configuration. Note the difference between server.settings.plugins which is used to store static configuration values and server.plugins which is meant for storing run-time state. Defaults to {}.*/ + plugins: IDictionary; + + } + + export interface IServerViewCompile { + (template: string, options: any): void; + (template: string, options: any, callback: (err: any, compiled: (context: any, options: any, callback: (err: any, rendered: boolean) => void) => void) => void): void; + } + + export interface IServerViewsAdditionalOptions { + /** path - the root file path used to resolve and load the templates identified when calling reply.view().Defaults to current working directory.*/ + path?: string; + /**partialsPath - the root file path where partials are located.Partials are small segments of template code that can be nested and reused throughout other templates.Defaults to no partials support (empty path). + */ + partialsPath?: string; + /**helpersPath - the directory path where helpers are located.Helpers are functions used within templates to perform transformations and other data manipulations using the template context or other inputs.Each '.js' file in the helpers directory is loaded and the file name is used as the helper name.The files must export a single method with the signature function(context) and return a string.Sub - folders are not supported and are ignored.Defaults to no helpers support (empty path).Note that jade does not support loading helpers this way.*/ + helpersPath?: string; + /**relativeTo - a base path used as prefix for path and partialsPath.No default.*/ + relativeTo?: string; + + /**layout - if set to true or a layout filename, layout support is enabled.A layout is a single template file used as the parent template for other view templates in the same engine.If true, the layout template name must be 'layout.ext' where 'ext' is the engine's extension. Otherwise, the provided filename is suffixed with the engine's extension and loaded.Disable layout when using Jade as it will handle including any layout files independently.Defaults to false.*/ + layout?: boolean; + /**layoutPath - the root file path where layout templates are located (using the relativeTo prefix if present). Defaults to path.*/ + layoutPath?: string; + /**layoutKeyword - the key used by the template engine to denote where primary template content should go.Defaults to 'content'.*/ + layoutKeywork?: string; + /**encoding - the text encoding used by the templates when reading the files and outputting the result.Defaults to 'utf8'.*/ + encoding?: string; + /**isCached - if set to false, templates will not be cached (thus will be read from file on every use).Defaults to true.*/ + isCached?: boolean; + /**allowAbsolutePaths - if set to true, allows absolute template paths passed to reply.view().Defaults to false.*/ + allowAbsolutePaths?: boolean; + /**allowInsecureAccess - if set to true, allows template paths passed to reply.view() to contain '../'.Defaults to false.*/ + allowInsecureAccess?: boolean; + /**compileOptions - options object passed to the engine's compile function. Defaults to empty options {}.*/ + compileOptions?: any; + /**runtimeOptions - options object passed to the returned function from the compile operation.Defaults to empty options {}.*/ + runtimeOptions?: any; + /**contentType - the content type of the engine results.Defaults to 'text/html'.*/ + contentType?: string; + /**compileMode - specify whether the engine compile() method is 'sync' or 'async'.Defaults to 'sync'.*/ + compileMode?: string; + /**context - a global context used with all templates.The global context option can be either an object or a function that takes no arguments and returns a context object.When rendering views, the global context will be merged with any context object specified on the handler or using reply.view().When multiple context objects are used, values from the global context always have lowest precedence.*/ + context?: any; + } + + export interface IServerViewsEnginesOptions extends IServerViewsAdditionalOptions { + /**- the npm module used for rendering the templates.The module object must contain: "module", the rendering function. The required function signature depends on the compileMode settings. + * If the compileMode is 'sync', the signature is compile(template, options), the return value is a function with signature function(context, options), and the method is allowed to throw errors.If the compileMode is 'async', the signature is compile(template, options, callback) where callback has the signature function(err, compiled) where compiled is a function with signature function(context, options, callback) and callback has the signature function(err, rendered).*/ + module: { + compile? (template: any, options: any): (context: any, options: any) => void; + compile? (template: any, options: any, callback: (err: any, compiled: (context: any, options: any, callback: (err: any, rendered: any) => void) => void) => void): void; + }; + } + + /**Initializes the server views manager + var Hapi = require('hapi'); + var server = new Hapi.Server(); + + server.views({ + engines: { + html: require('handlebars'), + jade: require('jade') + }, + path: '/static/templates' + }); + When server.views() is called within a plugin, the views manager is only available to plugins methods. + */ + export interface IServerViewsConfiguration extends IServerViewsAdditionalOptions { + /** - required object where each key is a file extension (e.g. 'html', 'hbr'), mapped to the npm module used for rendering the templates.Alternatively, the extension can be mapped to an object with the following options:*/ + engines: IDictionary|IServerViewsEnginesOptions; + /** defines the default filename extension to append to template names when multiple engines are configured and not explicit extension is provided for a given template. No default value.*/ + defaultExtension?: string; + } + + /** Concludes the handler activity by setting a response and returning control over to the framework where: + erran optional error response. + resultan optional response payload. + Since an request can only have one response regardless if it is an error or success, the reply() method can only result in a single response value. This means that passing both an err and result will only use the err. There is no requirement for either err or result to be (or not) an Error object. The framework will simply use the first argument if present, otherwise the second. The method supports two arguments to be compatible with the common callback pattern of error first. + FLOW CONTROL: + When calling reply(), the framework waits until process.nextTick() to continue processing the request and transmit the response. This enables making changes to the returned response object before the response is sent. This means the framework will resume as soon as the handler method exits. To suspend this behavior, the returned response object supports the following methods: hold(), send() */ + export interface IReply { + (err: Error, + result?: string|number|boolean|Buffer|stream.Stream | Promise | T, + /** Note that when used to return both an error and credentials in the authentication methods, reply() must be called with three arguments function(err, null, data) where data is the additional authentication information. */ + credentialData?: any + ): IBoom; + /** Note that if result is a Stream with a statusCode property, that status code will be used as the default response code. */ + (result: string|number|boolean|Buffer|stream.Stream | Promise | T): Response; + + //////// Returns control back to the framework without setting a response. If called in the handler, the response defaults to an empty payload with status code 200. + ////// + ////// The data argument is only used for passing back authentication data and is ignored elsewhere. + ////////continue(credentialData?: any): void; + + /** Transmits a file from the file system. The 'Content-Type' header defaults to the matching mime type based on filename extension. The response flow control rules do not apply. */ + file( + /** the file path. */ + path: string, + /** optional settings: */ + options?: { + /** - an optional filename to specify if sending a 'Content-Disposition' header, defaults to the basename of path*/ + filename?: string; + /** specifies whether to include the 'Content-Disposition' header with the response. Available values: + false - header is not included. This is the default value. + 'attachment' + 'inline'*/ + mode?: boolean|string; + /** if true, looks for the same filename with the '.gz' suffix for a pre-compressed version of the file to serve if the request supports content encoding. Defaults to false. */ + lookupCompressed: boolean; + }): void; + /** Concludes the handler activity by returning control over to the router with a templatized view response. + the response flow control rules apply. */ + + view( + /** the template filename and path, relative to the templates path configured via the server views manager. */ + template: string, + /** optional object used by the template to render context-specific result. Defaults to no context {}. */ + context?: {}, + /** optional object used to override the server's views manager configuration for this response. Cannot override isCached, partialsPath, or helpersPath which are only loaded at initialization. */ + options?: any): Response; + /** Concludes the handler activity by returning control over to the router and informing the router that a response has already been sent back directly via request.raw.res and that no further response action is needed + The response flow control rules do not apply. */ + close(options?: { + /** if false, the router will not call request.raw.res.end()) to ensure the response was ended. Defaults to true. */ + end?: boolean; + }): void; + /** Proxies the request to an upstream endpoint. + the response flow control rules do not apply. */ + + proxy(/** an object including the same keys and restrictions defined by the route proxy handler options. */ + options: IProxyHandlerConfig): void; + /** Redirects the client to the specified uri. Same as calling reply().redirect(uri). + he response flow control rules apply. */ + redirect(uri: string): Response; + } + + export interface ISessionHandler { + (request: Request, reply: IReply): void; + } + export interface IRequestHandler { + (request: Request): T; + } + + + export interface IFailAction { + (source: string, error: any, next: () => void): void + } + /** generates a reverse proxy handler */ + export interface IProxyHandlerConfig { + /** the upstream service host to proxy requests to. The same path on the client request will be used as the path on the host.*/ + host?: string; + /** the upstream service port. */ + port?: number; + /** The protocol to use when making a request to the proxied host: + 'http' + 'https'*/ + protocol?: string; + /** an absolute URI used instead of the incoming host, port, protocol, path, and query. Cannot be used with host, port, protocol, or mapUri.*/ + uri?: string; + /** if true, forwards the headers sent from the client to the upstream service being proxied to, headers sent from the upstream service will also be forwarded to the client. Defaults to false.*/ + passThrough?: boolean; + /** localStatePassThrough - if false, any locally defined state is removed from incoming requests before being passed upstream. This is a security feature to prevent local state (e.g. authentication cookies) from leaking upstream to other servers along with the cookies intended for those servers. This value can be overridden on a per state basis via the server.state() passThrough option. Defaults to false.*/ + localStatePassThrough?: boolean; + /**acceptEncoding - if false, does not pass-through the 'Accept-Encoding' HTTP header which is useful when using an onResponse post-processing to avoid receiving an encoded response (e.g. gzipped). Can only be used together with passThrough. Defaults to true (passing header).*/ + acceptEncoding?: boolean; + /** rejectUnauthorized - sets the rejectUnauthorized property on the https agent making the request. This value is only used when the proxied server uses TLS/SSL. When set it will override the node.js rejectUnauthorized property. If false then ssl errors will be ignored. When true the server certificate is verified and an 500 response will be sent when verification fails. This shouldn't be used alongside the agent setting as the agent will be used instead. Defaults to the https agent default value of true.*/ + rejectUnauthorized?: boolean; + /**if true, sets the 'X-Forwarded-For', 'X-Forwarded-Port', 'X-Forwarded-Proto' headers when making a request to the proxied upstream endpoint. Defaults to false.*/ + xforward?: boolean; + /** the maximum number of HTTP redirections allowed, to be followed automatically by the handler. Set to false or 0 to disable all redirections (the response will contain the redirection received from the upstream service). If redirections are enabled, no redirections (301, 302, 307, 308) will be passed along to the client, and reaching the maximum allowed redirections will return an error response. Defaults to false.*/ + redirects?: boolean|number; + /**number of milliseconds before aborting the upstream request. Defaults to 180000 (3 minutes).*/ + timeout?: number; + /** a function used to map the request URI to the proxied URI. Cannot be used together with host, port, protocol, or uri. The function signature is function(request, callback) where: + request - is the incoming request object. + callback - is function(err, uri, headers) where: + err - internal error condition. + uri - the absolute proxy URI. + headers - optional object where each key is an HTTP request header and the value is the header content.*/ + mapUri?: (request: Request, callback: (err: any, uri: string, headers?: { [key: string]: string }) => void) => void; + /** a custom function for processing the response from the upstream service before sending to the client. Useful for custom error handling of responses from the proxied endpoint or other payload manipulation. Function signature is function(err, res, request, reply, settings, ttl) where: - err - internal or upstream error returned from attempting to contact the upstream proxy. - res - the node response object received from the upstream service. res is a readable stream (use the wreck module read method to easily convert it to a Buffer or string). - request - is the incoming request object. - reply - the reply interface function. - settings - the proxy handler configuration. - ttl - the upstream TTL in milliseconds if proxy.ttl it set to 'upstream' and the upstream response included a valid 'Cache-Control' header with 'max-age'.*/ + onResponse?: ( + err: any, + res: http.ServerResponse, + req: Request, + reply: () => void, + settings: IProxyHandlerConfig, + ttl: number + ) => void; + /** if set to 'upstream', applies the upstream response caching policy to the response using the response.ttl() method (or passed as an argument to the onResponse method if provided).*/ + ttl?: number; + /** - a node http(s) agent to be used for connections to upstream server. see https://nodejs.org/api/http.html#http_class_http_agent */ + agent?: http.Agent; + /** sets the maximum number of sockets available per outgoing proxy host connection. false means use the wreck module default value (Infinity). Does not affect non-proxy outgoing client connections. Defaults to Infinity.*/ + maxSockets?: boolean|number; + } + /** TODO: fill in joi definition */ + export interface IJoi { + + } + /** a validation function using the signature function(value, options, next) */ + export interface IValidationFunction { + + (/** the object containing the path parameters. */ + value: any, + /** the server validation options. */ + options: any, + /** the callback function called when validation is completed. */ + next: (err: any, value: any) => void): void; + } + /** a custom error handler function with the signature 'function(request, reply, source, error)` */ + export interface IRouteFailFunction { + /** a custom error handler function with the signature 'function(request, reply, source, error)` */ + ( + /** - the [request object]. */ + request: Request, + /** the continuation reply interface. */ + reply: IReply, + /** the source of the invalid field (e.g. 'path', 'query', 'payload'). */ + source: string, + /** the error object prepared for the client response (including the validation function error under error.data). */ + error: any): void; + } + + /** Each route can be customize to change the default behavior of the request lifecycle using the following options: */ + export interface IRouteAdditionalConfigurationOptions { + /** application specific configuration.Should not be used by plugins which should use plugins[name] instead. */ + app?: any; + /** authentication configuration.Value can be: false to disable authentication if a default strategy is set. + a string with the name of an authentication strategy registered with server.auth.strategy(). + an object */ + auth?: boolean|string| + { + /** the authentication mode.Defaults to 'required' if a server authentication strategy is configured, otherwise defaults to no authentication.Available values: + 'required'authentication is required. + 'optional'authentication is optional (must be valid if present). + 'try'same as 'optional' but allows for invalid authentication. */ + mode: string; + /** a string array of strategy names in order they should be attempted.If only one strategy is used, strategy can be used instead with the single string value.Defaults to the default authentication strategy which is available only when a single strategy is configured. */ + strategies: string | Array; + /** if set, the payload (in requests other than 'GET' and 'HEAD') is authenticated after it is processed.Requires a strategy with payload authentication support (e.g.Hawk).Cannot be set to a value other than 'required' when the scheme sets the options.payload to true.Available values: + falseno payload authentication.This is the default value. + 'required'payload authentication required.This is the default value when the scheme sets options.payload to true. + 'optional'payload authentication performed only when the client includes payload authentication information (e.g.hash attribute in Hawk). */ + payload?: string; + /** the application scope required to access the route.Value can be a scope string or an array of scope strings.The authenticated credentials object scope property must contain at least one of the scopes defined to access the route.Set to false to remove scope requirements.Defaults to no scope required. */ + scope?: string|Array|boolean; + /** the required authenticated entity type.If set, must match the entity value of the authentication credentials.Available values: + anythe authentication can be on behalf of a user or application.This is the default value. + userthe authentication must be on behalf of a user. + appthe authentication must be on behalf of an application. */ + entity?: string; + }; + /** an object passed back to the provided handler (via this) when called. */ + bind?: any; + /** if the route method is 'GET', the route can be configured to include caching directives in the response using the following options */ + cache?: { + /** mines the privacy flag included in clientside caching using the 'Cache-Control' header.Values are: + fault'no privacy flag.This is the default setting. + 'public'mark the response as suitable for public caching. + 'private'mark the response as suitable only for private caching. */ + privacy: string; + /** relative expiration expressed in the number of milliseconds since the item was saved in the cache.Cannot be used together with expiresAt. */ + expiresIn: number; + /** time of day expressed in 24h notation using the 'HH:MM' format, at which point all cache records for the route expire.Cannot be used together with expiresIn. */ + expiresAt: string; + }; + /** the Cross- Origin Resource Sharing protocol allows browsers to make cross- origin API calls.CORS is required by web applications running inside a browser which are loaded from a different domain than the API server.CORS headers are disabled by default. To enable, set cors to true, or to an object with the following options: */ + cors?: { + /** a strings array of allowed origin servers ('Access-Control-Allow-Origin').The array can contain any combination of fully qualified origins along with origin strings containing a wildcard '' character, or a single `''origin string. Defaults to any origin['*']`. */ + origin?: Array; + /** if true, matches the value of the incoming 'Origin' header to the list of origin values ('*' matches anything) and if a match is found, uses that as the value of the 'Access-Control-Allow-Origin' response header.When false, the origin config is returned as- is.Defaults to true. */ + matchOrigin?: boolean; + /** if false, prevents the connection from returning the full list of non- wildcard origin values if the incoming origin header does not match any of the values.Has no impact if matchOrigin is set to false.Defaults to true. */ + isOriginExposed?: boolean; + /** number of seconds the browser should cache the CORS response ('Access-Control-Max-Age').The greater the value, the longer it will take before the browser checks for changes in policy.Defaults to 86400 (one day). */ + maxAge?: number; + /** a strings array of allowed headers ('Access-Control-Allow-Headers').Defaults to ['Authorization', 'Content-Type', 'If-None-Match']. */ + headers?: string[]; + /** a strings array of additional headers to headers.Use this to keep the default headers in place. */ + additionalHeaders?: string[]; + /** a strings array of allowed HTTP methods ('Access-Control-Allow-Methods').Defaults to ['GET', 'HEAD', 'POST', 'PUT', 'DELETE', 'OPTIONS']. */ + methods?: string[]; + /** a strings array of additional methods to methods.Use this to keep the default methods in place. */ + additionalMethods?: string[]; + /** a strings array of exposed headers ('Access-Control-Expose-Headers').Defaults to ['WWW-Authenticate', 'Server-Authorization']. */ + exposedHeaders?: string[]; + /** a strings array of additional headers to exposedHeaders.Use this to keep the default headers in place. */ + additionalExposedHeaders?: string[]; + /** if true, allows user credentials to be sent ('Access-Control-Allow-Credentials').Defaults to false. */ + credentials?: boolean; + /** if false, preserves existing CORS headers set manually before the response is sent.Defaults to true. */ + override?: boolean; + }; + /** defines the behavior for serving static resources using the built-in route handlers for files and directories: */ + files?: {/** determines the folder relative paths are resolved against when using the file and directory handlers. */ + relativeTo: string; + }; + + /** an alternative location for the route handler option. */ + handler?: ISessionHandler | string | IRouteHandlerConfig; + /** an optional unique identifier used to look up the route using server.lookup(). */ + id?: number; + /** optional arguments passed to JSON.stringify() when converting an object or error response to a string payload.Supports the following: */ + json?: { + /** the replacer function or array.Defaults to no action. */ + replacer?: Function | string[]; + /** number of spaces to indent nested object keys.Defaults to no indentation. */ + space?: number|string; + /** string suffix added after conversion to JSON string.Defaults to no suffix. */ + suffix?: string; + }; + /** enables JSONP support by setting the value to the query parameter name containing the function name used to wrap the response payload.For example, if the value is 'callback', a request comes in with 'callback=me', and the JSON response is '{ "a":"b" }', the payload will be 'me({ "a":"b" });'.Does not work with stream responses. */ + jsonp?: string; + /** determines how the request payload is processed: */ payload?: { - maxBytes: number; - uploads: string; + /** the type of payload representation requested. The value must be one of: + 'data'the incoming payload is read fully into memory.If parse is true, the payload is parsed (JSON, formdecoded, multipart) based on the 'Content- Type' header.If parse is false, the raw Buffer is returned.This is the default value except when a proxy handler is used. + 'stream'the incoming payload is made available via a Stream.Readable interface.If the payload is 'multipart/form-data' and parse is true, fields values are presented as text while files are provided as streams.File streams from a 'multipart/form-data' upload will also have a property hapi containing filename and headers properties. + 'file'the incoming payload in written to temporary file in the directory specified by the server's payload.uploads settings. If the payload is 'multipart/ formdata' and parse is true, fields values are presented as text while files are saved. Note that it is the sole responsibility of the application to clean up the files generated by the framework. This can be done by keeping track of which files are used (e.g. using the request.app object), and listening to the server 'response' event to perform any needed cleaup. */ + output?: string; + /** can be true, false, or gunzip; determines if the incoming payload is processed or presented raw. true and gunzip includes gunzipping when the appropriate 'Content-Encoding' is specified on the received request. If parsing is enabled and the 'Content-Type' is known (for the whole payload as well as parts), the payload is converted into an object when possible. If the format is unknown, a Bad Request (400) error response is sent. Defaults to true, except when a proxy handler is used. The supported mime types are: + 'application/json' + 'application/x-www-form-urlencoded' + 'application/octet-stream' + 'text/ *' + 'multipart/form-data' */ + parse?: string | boolean; + /** a string or an array of strings with the allowed mime types for the endpoint.Defaults to any of the supported mime types listed above.Note that allowing other mime types not listed will not enable them to be parsed, and that if parsing mode is 'parse', the request will result in an error response. */ + allow?: string | string[]; + /** a mime type string overriding the 'Content-Type' header value received.Defaults to no override. */ + override?: string; + /** limits the size of incoming payloads to the specified byte count.Allowing very large payloads may cause the server to run out of memory.Defaults to 1048576 (1MB). */ + maxBytes?: number; + /** payload reception timeout in milliseconds.Sets the maximum time allowed for the client to transmit the request payload (body) before giving up and responding with a Request Timeout (408) error response.Set to false to disable.Defaults to 10000 (10 seconds). */ + timeout?: number; + /** the directory used for writing file uploads.Defaults to os.tmpDir(). */ + uploads?: string; + /** determines how to handle payload parsing errors. Allowed values are: + 'error'return a Bad Request (400) error response. This is the default value. + 'log'report the error but continue processing the request. + 'ignore'take no action and continue processing the request. */ + failAction?: string; }; - plugins?: any; - router?: { - isCaseSensitive?: boolean; - stripTrailingSlash?: boolean; + /** pluginspecific configuration.plugins is an object where each key is a plugin name and the value is the plugin configuration. */ + plugins?: IDictionary; + /** an array with [route prerequisites] methods which are executed in serial or in parallel before the handler is called. */ + pre?: any[]; + /** validation rules for the outgoing response payload (response body).Can only validate object response: */ + response?: { + /** the default response object validation rules (for all non-error responses) expressed as one of: + trueany payload allowed (no validation performed). This is the default. + falseno payload allowed. + a Joi validation object. + a validation function using the signature function(value, options, next) where: + valuethe object containing the response object. + optionsthe server validation options. + next(err)the callback function called when validation is completed. */ + schema: boolean|any; + /** HTTP status- codespecific validation rules.The status key is set to an object where each key is a 3 digit HTTP status code and the value has the same definition as schema.If a response status code is not present in the status object, the schema definition is used, expect for errors which are not validated by default. */ + status: number; + /** the percent of responses validated (0100).Set to 0 to disable all validation.Defaults to 100 (all responses). */ + sample: number; + /** defines what to do when a response fails validation.Options are: + errorreturn an Internal Server Error (500) error response.This is the default value. + loglog the error but send the response. */ + failAction: string; + /** if true, applies the validation rule changes to the response.Defaults to false. */ + modify: boolean; + /** options to pass to Joi.Useful to set global options such as stripUnknown or abortEarly (the complete list is available here: https://github.com/hapijs/joi#validatevalue-schema-options-callback ).Defaults to no options. */ + options: any; }; + /** sets common security headers (disabled by default).To enable set security to true or to an object with the following options */ + security?: boolean| { + /** controls the 'Strict-Transport-Security' header.If set to true the header will be set to max- age=15768000, if specified as a number the maxAge parameter will be set to that number.Defaults to true.You may also specify an object with the following fields: */ + hsts: boolean|number|{ + /** the max- age portion of the header, as a number.Default is 15768000. */ + maxAge?: number; + /** a boolean specifying whether to add the includeSubdomains flag to the header. */ + includeSubdomains?: boolean; + }; + /** controls the 'X-Frame-Options' header.When set to true the header will be set to DENY, you may also specify a string value of 'deny' or 'sameorigin'.To use the 'allow-from' rule, you must set this to an object with the following fields: */ + xframe: { + /** either 'deny', 'sameorigin', or 'allow-from' */ + rule: string; + /** when rule is 'allow-from' this is used to form the rest of the header, otherwise this field is ignored.If rule is 'allow-from' but source is unset, the rule will be automatically changed to 'sameorigin'. */ + source: string; + }; + /** boolean that controls the 'X-XSS-PROTECTION' header for IE.Defaults to true which sets the header to equal '1; mode=block'.NOTE: This setting can create a security vulnerability in versions of IE below 8, as well as unpatched versions of IE8.See here and here for more information.If you actively support old versions of IE, it may be wise to explicitly set this flag to false. */ + xss: boolean; + /** boolean controlling the 'X-Download-Options' header for IE, preventing downloads from executing in your context.Defaults to true setting the header to 'noopen'. */ + noOpen: boolean; + /** boolean controlling the 'X-Content-Type-Options' header.Defaults to true setting the header to its only and default option, 'nosniff'. */ + noSniff: boolean; + }; + /** HTTP state management (cookies) allows the server to store information on the client which is sent back to the server with every request (as defined in RFC 6265).state supports the following options: */ state?: { - cookies: { - parse?: boolean; - failAction?: string; - clearInvalid?: boolean; - strictHeader?: boolean; + /** determines if incoming 'Cookie' headers are parsed and stored in the request.state object.Defaults to true. */ + parse: boolean; + /** determines how to handle cookie parsing errors.Allowed values are: + 'error'return a Bad Request (400) error response.This is the default value. + 'log'report the error but continue processing the request. + 'ignore'take no action. */ + failAction: string; + }; + /** request input validation rules for various request components.When using a Joi validation object, the values of the other inputs (i.e.headers, query, params, payload, and auth) are made available under the validation context (accessible in rules as Joi.ref('$query.key')).Note that validation is performed in order(i.e.headers, params, query, payload) and if type casting is used (converting a string to number), the value of inputs not yet validated will reflect the raw, unvalidated and unmodified values.The validate object supports: */ + validate?: { + /** validation rules for incoming request headers.Values allowed: + * trueany headers allowed (no validation performed).This is the default. + falseno headers allowed (this will cause all valid HTTP requests to fail). + a Joi validation object. + a validation function using the signature function(value, options, next) where: + valuethe object containing the request headers. + optionsthe server validation options. + next(err, value)the callback function called when validation is completed. + */ + headers: boolean | IJoi | IValidationFunction; + + + /** validation rules for incoming request path parameters, after matching the path against the route and extracting any parameters then stored in request.params.Values allowed: + trueany path parameters allowed (no validation performed).This is the default. + falseno path variables allowed. + a Joi validation object. + a validation function using the signature function(value, options, next) where: + valuethe object containing the path parameters. + optionsthe server validation options. + next(err, value)the callback function called when validation is completed. */ + params: boolean | IJoi | IValidationFunction; + /** validation rules for an incoming request URI query component (the key- value part of the URI between '?' and '#').The query is parsed into its individual key- value pairs (using the qs module) and stored in request.query prior to validation.Values allowed: + trueany query parameters allowed (no validation performed).This is the default. + falseno query parameters allowed. + a Joi validation object. + a validation function using the signature function(value, options, next) where: + valuethe object containing the query parameters. + optionsthe server validation options. + next(err, value)the callback function called when validation is completed. */ + query: boolean | IJoi | IValidationFunction; + /** validation rules for an incoming request payload (request body).Values allowed: + trueany payload allowed (no validation performed).This is the default. + falseno payload allowed. + a Joi validation object. + a validation function using the signature function(value, options, next) where: + valuethe object containing the payload object. + optionsthe server validation options. + next(err, value)the callback function called when validation is completed. */ + payload: boolean | IJoi | IValidationFunction; + /** an optional object with error fields copied into every validation error response. */ + errorFields: any; + /** determines how to handle invalid requests.Allowed values are: + 'error'return a Bad Request (400) error response.This is the default value. + 'log'log the error but continue processing the request. + 'ignore'take no action. + OR a custom error handler function with the signature 'function(request, reply, source, error)` where: + requestthe request object. + replythe continuation reply interface. + sourcethe source of the invalid field (e.g. 'path', 'query', 'payload'). + errorthe error object prepared for the client response (including the validation function error under error.data). */ + failAction: string | IRouteFailFunction; + /** options to pass to Joi.Useful to set global options such as stripUnknown or abortEarly (the complete list is available here: https://github.com/hapijs/joi#validatevalue-schema-options-callback ).Defaults to no options. */ + options: any; + }; + /** define timeouts for processing durations: */ + timeout?: { + /** response timeout in milliseconds.Sets the maximum time allowed for the server to respond to an incoming client request before giving up and responding with a Service Unavailable (503) error response.Disabled by default (false). */ + server: boolean|number; + /** by default, node sockets automatically timeout after 2 minutes.Use this option to override this behavior.Defaults to undefined which leaves the node default unchanged.Set to false to disable socket timeouts. */ + socket: boolean|number; + }; + + /** ONLY WHEN ADDING NEW ROUTES (not when setting defaults). + *route description used for generating documentation (string). + */ + description?: string; + /** ONLY WHEN ADDING NEW ROUTES (not when setting defaults). + *route notes used for generating documentation (string or array of strings). + */ + notes?: string|string[]; + /** ONLY WHEN ADDING NEW ROUTES (not when setting defaults). + *route tags used for generating documentation (array of strings). + */ + tags?: string[] + } + /** server.realm http://hapijs.com/api#serverrealm + The realm object contains server-wide or plugin-specific state that can be shared across various methods. For example, when calling server.bind(), + the active realm settings.bind property is set which is then used by routes and extensions added at the same level (server root or plugin). + Realms are a limited version of a sandbox where plugins can maintain state used by the framework when adding routes, extensions, and other properties. + The server.realm object should be considered read-only and must not be changed directly except for the plugins property can be directly manipulated by the plugins (each setting its own under plugins[name]). + exports.register = function (server, options, next) { + console.log(server.realm.modifiers.route.prefix); + return next(); + }; + */ + export interface IServerRealm { + /** when the server object is provided as an argument to the plugin register() method, modifiers provides the registration preferences passed the server.register() method */ + modifiers: { + /** routes preferences: */ + route: { + /** - the route path prefix used by any calls to server.route() from the server. */ + prefix: string; + /** the route virtual host settings used by any calls to server.route() from the server. */ + vhost: string; + }; + + }; + /** the active plugin name (empty string if at the server root). */ + plugin: string; + /** plugin-specific state to be shared only among activities sharing the same active state. plugins is an object where each key is a plugin name and the value is the plugin state. */ + plugins: IDictionary; + /** settings overrides */ + settings: { + files: { + relativeTo: any; + }; + bind: any; + } + } + /** server.state(name, [options]) http://hapijs.com/api#serverstatename-options + HTTP state management uses client cookies to persist a state across multiple requests. Registers a cookie definitions where:*/ + export interface IServerState { +/** - the cookie name string. */name: string; + +/** - are the optional cookie settings: */options: { +/** - time - to - live in milliseconds.Defaults to null (session time- life - cookies are deleted when the browser is closed).*/ttl: number; +/** - sets the 'Secure' flag.Defaults to false.*/isSecure: boolean; +/** - sets the 'HttpOnly' flag.Defaults to false.*/isHttpOnly: boolean +/** - the path scope.Defaults to null (no path).*/path: any; +/** - the domain scope.Defaults to null (no domain). */domain: any; + /** if present and the cookie was not received from the client or explicitly set by the route handler, the cookie is automatically added to the response with the provided value. The value can be a function with signature function(request, next) where: + request - the request object. + next - the continuation function using the function(err, value) signature.*/ + autoValue: (request: Request, next: (err: any, value: any) => void) => void; + /** - encoding performs on the provided value before serialization. Options are: + 'none' - no encoding. When used, the cookie value must be a string. This is the default value. + 'base64' - string value is encoded using Base64. + 'base64json' - object value is JSON-stringified than encoded using Base64. + 'form' - object value is encoded using the x-www-form-urlencoded method. + 'iron' - Encrypts and sign the value using iron.*/ + encoding: string; +/** - an object used to calculate an HMAC for cookie integrity validation.This does not provide privacy, only a mean to verify that the cookie value was generated by the server.Redundant when 'iron' encoding is used.Options are:*/sign: { +/** - algorithm options.Defaults to require('iron').defaults.integrity.*/integrity: any; +/** - password used for HMAC key generation.*/password: string; + }; +/** - password used for 'iron' encoding.*/password: string; +/** - options for 'iron' encoding.Defaults to require('iron').defaults.*/iron: any; +/** - if false, errors are ignored and treated as missing cookies.*/ignoreErrors: boolean; +/** - if true, automatically instruct the client to remove invalid cookies.Defaults to false.*/clearInvalid: boolean; +/** - if false, allows any cookie value including values in violation of RFC 6265. Defaults to true.*/strictHeader: boolean; +/** - overrides the default proxy localStatePassThrough setting.*/passThrough: any; + }; + } + + export interface IFileHandlerConfig { + /** a path string or function as described above.*/ + path: string; + /** an optional filename to specify if sending a 'Content-Disposition' header, defaults to the basename of path*/ + filename?: string; + /**- specifies whether to include the 'Content-Disposition' header with the response. Available values: + false - header is not included. This is the default value. + 'attachment' + 'inline'*/ + mode?: boolean| string; + /** if true, looks for the same filename with the '.gz' suffix for a pre-compressed version of the file to serve if the request supports content encoding. Defaults to false.*/ + lookupCompressed: boolean; + } + + /**http://hapijs.com/api#route-handler + Built-in handlers + + The framework comes with a few built-in handler types available by setting the route handler config to an object containing one of these keys.*/ + export interface IRouteHandlerConfig { + /** generates a static file endpoint for serving a single file. file can be set to: + a relative or absolute file path string (relative paths are resolved based on the route files configuration). + a function with the signature function(request) which returns the relative or absolute file path. + an object with the following options */ + file: string | IRequestHandler |IFileHandlerConfig; + /** directory - generates a directory endpoint for serving static content from a directory. Routes using the directory handler must include a path parameter at the end of the path string (e.g. /path/to/somewhere/{param} where the parameter name does not matter). The path parameter can use any of the parameter options (e.g. {param} for one level files only, {param?} for one level files or the directory root, {param*} for any level, or {param*3} for a specific level). If additional path parameters are present, they are ignored for the purpose of selecting the file system resource. The directory handler is an object with the following options: + path - (required) the directory root path (relative paths are resolved based on the route files configuration). Value can be: + a single path string used as the prefix for any resources requested by appending the request path parameter to the provided string. + an array of path strings. Each path will be attempted in order until a match is found (by following the same process as the single path string). + a function with the signature function(request) which returns the path string or an array of path strings. If the function returns an error, the error is passed back to the client in the response. + index - optional boolean|string|string[], determines if an index file will be served if found in the folder when requesting a directory. The given string or strings specify the name(s) of the index file to look for. If true, looks for 'index.html'. Any falsy value disables index file lookup. Defaults to true. + listing - optional boolean, determines if directory listing is generated when a directory is requested without an index document. Defaults to false. + showHidden - optional boolean, determines if hidden files will be shown and served. Defaults to false. + redirectToSlash - optional boolean, determines if requests for a directory without a trailing slash are redirected to the same path with the missing slash. Useful for ensuring relative links inside the response are resolved correctly. Disabled when the server config router.stripTrailingSlash is true.Defaults to false. + lookupCompressed - optional boolean, instructs the file processor to look for the same filename with the '.gz' suffix for a pre-compressed version of the file to serve if the request supports content encoding. Defaults to false. + defaultExtension - optional string, appended to file requests if the requested file is not found. Defaults to no extension.*/ + directory: { + path: string |Array | IRequestHandler | IRequestHandler>; + index?: boolean; + listing?: boolean; + showHidden?: boolean; + redirectToSlash?: boolean; + lookupCompressed?: boolean; + defaultExtension?: string; + }; + proxy?: IProxyHandlerConfig; + view: string | { + template: string; + context: { + payload: any; + params: any; + query: any; + pre: any; } }; - timeout?: { -// server?: boolean; -// server?: number; - server?: any; -// client?: boolean; -// client?: number; - client?: any; -// socket?: boolean; -// socket?: number; - socket?: any; + config: { + handler: any; + bind: any; + app: any; + plugins: { + [name: string]: any; + }; + pre: Array<() => void>; + validate: { + headers: any; + params: any; + query: any; + payload: any; + errorFields?: any; + failAction?: string | IFailAction; + }; + payload: { + output: { + data: any; + stream: any; + file: any; + }; + parse?: any; + allow?: string|Array; + override?: string; + maxBytes?: number; + uploads?: number; + failAction?: string; + }; + response: { + schema: any; + sample: number; + failAction: string; + }; + cache: { + privacy: string; + expiresIn: number; + expiresAt: number; + }; + auth: string|boolean|{ + mode: string; + strategies: Array; + payload?: boolean|string; + tos?: boolean|string; + scope?: string|Array; + entity: string; + }; + cors?: boolean; + jsonp?: string; + description?: string; + notes?: string|Array; + tags?: Array; }; - tls?: any; //This should be Node.tls - maxSockets?: number; - validation?: any; - views?: ServerView; } - - export class Pack { - require(name: string, options: {}, callback: Function): void; - register(plugins: any, options?: Object, callback?: Function, state?: Object): void; - } - - export interface ServerView { - engines: { - [extension: string]: string; - module?: string; -// compile: ( -// template: string, -// options: any -// ) => void; -// compile: ( -// template: string, -// options: any, -// callback: ( -// err: any, -// compiled: ( -// context: any, -// options: any, -// callback: ( -// err: any, -// rendered: boolean -// ) => void -// ) => void -// ) => void -// ) => void; - compile?: any; - }; - defaultExtension?: string; - path?: string; - partialsPath?: string; - helpersPath?: string; - basePath?: string; - layout?: boolean; - layoutPath?: string; - layoutKeyword?: string; - encoding?: string; - isCached?: boolean; - allowAbsolutePaths?: boolean; - allowInsecureAccess?: boolean; - compileOptions?: any; - runtimeOptions?: any; - contentType?: string; - compileMode?: string; - } - - export interface RouteOptions { + /** Route configuration + The route configuration object*/ + export interface IRouteConfiguration { + /** - (required) the absolute path used to match incoming requests (must begin with '/'). Incoming requests are compared to the configured paths based on the connection router configuration option.The path can include named parameters enclosed in {} which will be matched against literal values in the request as described in Path parameters.*/ path: string; + /** - (required) the HTTP method.Typically one of 'GET', 'POST', 'PUT', 'PATCH', 'DELETE', or 'OPTIONS'.Any HTTP method is allowed, except for 'HEAD'.Use '*' to match against any HTTP method (only when an exact match was not found, and any match with a specific method will be given a higher priority over a wildcard match). + * Can be assigned an array of methods which has the same result as adding the same route with different methods manually.*/ + method: string|string[]; + /** - an optional domain string or an array of domain strings for limiting the route to only requests with a matching host header field.Matching is done against the hostname part of the header only (excluding the port).Defaults to all hosts.*/ + vhost?: string; + /** - (required) the function called to generate the response after successful authentication and validation.The handler function is described in Route handler.If set to a string, the value is parsed the same way a prerequisite server method string shortcut is processed.Alternatively, handler can be assigned an object with a single key using the name of a registered handler type and value with the options passed to the registered handler.*/ + handler: ISessionHandler | string | IRouteHandlerConfig; + /** - additional route options.*/ + config?: IRouteAdditionalConfigurationOptions; + } + /** Route public interface When route information is returned or made available as a property. http://hapijs.com/api#route-public-interface */ + export interface IRoute { + + + /** the route HTTP method. */ method: string; -// vhost?: string; -// vhost?: Array; - vhost?: any; -// handler: string; -// handler: (request: Request, reply: Function) => void; -// handler: { -// file: string; -// file: (request: Request) => void; -// file: { -// path: string; -// filename?: string; -// mode?: boolean; -// mode?: string; -// lookupCompressed: boolean; -// }; -// directory: { -// path: string; -// path: Array; -// path: (request: Request) => string; -// path: (request: Request) => Array; -// index?: boolean; -// listing?: boolean; -// showHidden?: boolean; -// redirectToSlash?: boolean; -// lookupCompressed?: boolean; -// defaultExtension?: string; -// }; -// proxy?: { -// host?: string; -// port?: number; -// protocol?: string; -// uri?: string; -// passThrough?: boolean; -// rejectUnauthorized?: boolean; -// xforward?: boolean; -// redirects?: boolean; -// redirects?: number; -// timeout?: number; -// -// mapUri?: (request: Request, callback: (err: any, uri: string, headers: {[key: string]: string}) => void) => void; -// onResponse: ( -// err: any, -// res: any,//Node Response -// req: any,//Node Request -// reply: () => void, -// settings: any, -// ttl: number -// ) => void; -// ttl: number; -// }; -// view: string; -// view: { -// template: string; -// context: { -// payload: any; -// params: any; -// query: any; -// pre: any; -// } -// }; -// config: { -// handler: any; -// bind: any; -// app: any; -// plugins: { -// [name: string]: any; -// }; -// pre: Array<() => void>; -// validate: { -// headers: any; -// params: any; -// query: any; -// payload: any; -// errorFields?: any; -// failAction?: string; -// failAction?: (source: string, error: any, next: () => void) => void; -// }; -// payload: { -// output: { -// data: any; -// stream: any; -// file: any; -// }; -// parse?: any; -// allow?: string; -// allow?: Array; -// override?: string; -// maxBytes?: number; -// uploads?: number; -// failAction?: string; -// }; -// response: { -// schema: any; -// sample: number; -// failAction: string; -// }; -// cache: { -// privacy: string; -// expiresIn: number; -// expiresAt: number; -// }; -// auth: string; -// auth: boolean; -// auth: { -// mode: string; -// strategies: Array; -// payload?: boolean; -// payload?: string; -// tos?: boolean; -// tos?: string; -// scope?: string; -// scope?: Array; -// entity: string; -// }; -// cors?: boolean; -// jsonp?: string; -// description?: string; -// notes?: string; -// notes?: Array; -// tags?: Array; -// } -// }; - handler: any; + /** the route path. */ + path: string; + /** the route vhost option if configured. */ + vhost?: string|Array; + /** the [active realm] associated with the route.*/ + realm: IServerRealm; + /** the [route options] object with all defaults applied. */ + settings: IRouteAdditionalConfigurationOptions; } - export class Server { - app: any; - methods: any; - info: { - port: number; - host?: string; - protocol?: string; - uri?: string; + export interface IServerAuthScheme { + /** authenticate(request, reply) - required function called on each incoming request configured with the authentication scheme where: + request - the request object. + reply - the reply interface the authentication method must call when done authenticating the request where: + reply(err, response, result) - is called if authentication failed where: + err - any authentication error. + response - any authentication response action such as redirection. Ignored if err is present, otherwise required. + result - an object containing: + credentials - the authenticated credentials. + artifacts - optional authentication artifacts. + reply.continue(result) - is called if authentication succeeded where: + result - same object as result above. + When the scheme authenticate() method implementation calls reply() with an error condition, the specifics of the error affect whether additional authentication strategies will be attempted if configured for the route. + .If the err returned by the reply() method includes a message, no additional strategies will be attempted. + If the err does not include a message but does include a scheme name (e.g. Boom.unauthorized(null, 'Custom')), additional strategies will be attempted in order of preference. + var server = new Hapi.Server(); + server.connection({ port: 80 }); + var scheme = function (server, options) { + return { + authenticate: function (request, reply) { + var req = request.raw.req; + var authorization = req.headers.authorization; + if (!authorization) { + return reply(Boom.unauthorized(null, 'Custom')); + } + return reply(null, { credentials: { user: 'john' } }); + } }; - listener: any;// Node Http server - load: { - eventLoopDelay: number; - heapUsed: number; - rss: number; }; - pack: Pack; - plugins: { - [pluginName: string]: any; - }; - - start(callback?: () => void): void; - stop(options?: {timeout: number;}, callback?: () => void): void; - route(options: RouteOptions): void; - route(routes: Array): void; - table(host?: string): Array; - log(tags: string, data?: string, timestamp?: number): void; - log(tags: Array, data?: string, timestamp?: number): void; - log(tags: string, data?: any, timestamp?: number): void; - log(tags: Array, data?: any, timestamp?: number): void; - connection(options?: ServerOptions): void; - state(name: string, options?: { - ttl: number; - isSecure: boolean; - isHttpOnly: boolean; - path: string; - domain: string; - autoValue: (request: Request, next: (err: any, value: any) => void) => void; - encoding?: string; - sign: any; - password: string; - iron: any; - }): void; - views(options: ServerView): void; - cache(name: string, options: { - expiresIn: number; - expiresAt: number; - staleIn: number; - staleTimeout: number; - cache: string; - }): void; - - auth: { - scheme(name: string, scheme: { - name: string; - scheme: (server: Server, options: any) => (authenticate: any, payload: any, response: any) => void; - }): void; - strategy: any; - }; - ext(event: any, method: string, options?: any): void; - method(method: Array<{name: string; fn: () => void; options: any}>): void; - method(name: string, fn: Function, options: any): void; - inject(options: any, callback: any): void; - handler(name: string, method: (name: string, options: any) => void): void; + server.auth.scheme('custom', scheme);*/ + authenticate(request: Request, reply: IReply): void; + /** payload(request, reply) - optional function called to authenticate the request payload where: + request - the request object. + reply(err, response) - is called if authentication failed where: + err - any authentication error. + response - any authentication response action such as redirection. Ignored if err is present, otherwise required. + reply.continue() - is called if payload authentication succeeded. + When the scheme payload() method returns an error with a message, it means payload validation failed due to bad payload. If the error has no message but includes a scheme name (e.g. Boom.unauthorized(null, 'Custom')), authentication may still be successful if the route auth.payload configuration is set to 'optional'.*/ + payload? (request: Request, reply: IReply): void; + /** response(request, reply) - optional function called to decorate the response with authentication headers before the response headers or payload is written where: + request - the request object. + reply(err, response) - is called if an error occurred where: + err - any authentication error. + response - any authentication response to send instead of the current response. Ignored if err is present, otherwise required. + reply.continue() - is called if the operation succeeded.*/ + response? (request: Request, reply: IReply): void; + /** an optional object */ + options?: { + /** if true, requires payload validation as part of the scheme and forbids routes from disabling payload auth validation. Defaults to false.*/ + payload: boolean; + } } - export interface Request { - app: any; - auth: { - isAuthenticated: boolean; + + + export interface IServerInject { + (options: { + /** the request HTTP method (e.g. 'POST'). Defaults to 'GET'.*/ + method: string; + /** the request URL. If the URI includes an authority (e.g. 'example.com:8080'), it is used to automatically set an HTTP 'Host' header, unless one was specified in headers.*/ + url: string; + /** an object with optional request headers where each key is the header name and the value is the header content. Defaults to no additions to the default Shot headers.*/ + headers: IDictionary; + /**- an optional string or buffer containing the request payload (object must be manually converted to a string first). Defaults to no payload. Note that payload processing defaults to 'application/json' if no 'Content-Type' header provided.*/ + payload: string|Buffer; + /**an optional credentials object containing authentication information. The credentials are used to bypass the default authentication strategies, and are validated directly as if they were received via an authentication scheme. Defaults to no credentials.*/ credentials: any; + /**object with options used to simulate client request stream conditions for testing: + error - if true, emits an 'error' event after payload transmission (if any). Defaults to false. + close - if true, emits a 'close' event after payload transmission (if any). Defaults to false. + end - if false, does not end the stream. Defaults to true.*/ + simulate: { + error: boolean; + close: boolean; + end: boolean; + }; + }, + callback: ( + /**the response object where: + statusCode - the HTTP status code. + headers - an object containing the headers set. + payload - the response payload string. + rawPayload - the raw response payload buffer. + raw - an object with the injection request and response objects: + req - the simulated node request object. + res - the simulated node response object. + result - the raw handler response (e.g. when not a stream or a view) before it is serialized for transmission. If not available, the value is set to payload. Useful for inspection and reuse of the internal objects returned (instead of parsing the response string). + request - the request object.*/ + res: { statusCode: number; headers: IDictionary; payload: string; rawPayload: Buffer; raw: { req: http.ClientRequest; res: http.ServerResponse }; result: string; request: Request }) => void + ):void; + + } + + + /** host - optional host to filter routes matching a specific virtual host. Defaults to all virtual hosts. + The return value is an array where each item is an object containing: + info - the connection.info the connection the table was generated for. + labels - the connection labels. + table - an array of routes where each route contains: + settings - the route config with defaults applied. + method - the HTTP method in lower case. + path - the route path.*/ + export interface IConnectionTable { + info: any; + labels: any; + table: IRoute[]; + } + + export interface ICookieSettings { + /** - time - to - live in milliseconds.Defaults to null (session time- life - cookies are deleted when the browser is closed).*/ + ttl?: number; + /** - sets the 'Secure' flag.Defaults to false.*/ + isSecure?: boolean; + /** - sets the 'HttpOnly' flag.Defaults to false.*/ + isHttpOnly?: boolean; + /** - the path scope.Defaults to null (no path).*/ + path?: string; + /** - the domain scope.Defaults to null (no domain).*/ + domain?: any; + /** - if present and the cookie was not received from the client or explicitly set by the route handler, the cookie is automatically added to the response with the provided value.The value can be a function with signature function(request, next) where: + request - the request object. + next - the continuation function using the function(err, value) signature.*/ + autoValue?: (request: Request, next: (err: any, value: any) => void) => void; + /** - encoding performs on the provided value before serialization.Options are: + 'none' - no encoding.When used, the cookie value must be a string.This is the default value. + 'base64' - string value is encoded using Base64. + 'base64json' - object value is JSON- stringified than encoded using Base64. + 'form' - object value is encoded using the x- www - form - urlencoded method. */ + encoding?: string; + /** - an object used to calculate an HMAC for cookie integrity validation.This does not provide privacy, only a mean to verify that the cookie value was generated by the server.Redundant when 'iron' encoding is used.Options are: + integrity - algorithm options.Defaults to require('iron').defaults.integrity. + password - password used for HMAC key generation. */ + sign?: { integrity: any; password: string; } + password?: string; + iron?: any; + ignoreErrors?: boolean; + clearInvalid?: boolean; + strictHeader?: boolean; + passThrough?: any; + } + + /** method - the method function with the signature is one of: + function(arg1, arg2, ..., argn, next) where: + arg1, arg2, etc. - the method function arguments. + next - the function called when the method is done with the signature function(err, result, ttl) where: + err - error response if the method failed. + result - the return value. + ttl - 0 if result is valid but cannot be cached. Defaults to cache policy. + function(arg1, arg2, ..., argn) where: + arg1, arg2, etc. - the method function arguments. + the callback option is set to false. + the method must returns a value (result, Error, or a promise) or throw an Error.*/ + export interface IServerMethod { + //(): void; + //(next: (err: any, result: any, ttl: number) => void): void; + //(arg1: any): void; + //(arg1: any, arg2: any, next: (err: any, result: any, ttl: number) => void): void; + //(arg1: any, arg2: any): void; + (...args: any[]): void; + + } + /** options - optional configuration: + bind - a context object passed back to the method function (via this) when called. Defaults to active context (set via server.bind() when the method is registered. + cache - the same cache configuration used in server.cache(). + callback - if false, expects the method to be a synchronous function. Note that using a synchronous function with caching will convert the method interface to require a callback as an additional argument with the signature function(err, result, cached, report) since the cache interface cannot return values synchronously. Defaults to true. + generateKey - a function used to generate a unique key (for caching) from the arguments passed to the method function (the callback argument is not passed as input). The server will automatically generate a unique key if the function's arguments are all of types 'string', 'number', or 'boolean'. However if the method uses other types of arguments, a key generation function must be provided which takes the same arguments as the function and returns a unique string (or null if no key can be generated).*/ + export interface IServerMethodOptions { + bind?: any; + cache?: ICatBoxCacheOptions; + callback?: boolean; + generateKey?(args: any[]): string; + } + /** Request object + + The request object is created internally for each incoming request. It is different from the node.js request object received from the HTTP server callback (which is available in request.raw.req). The request object methods and properties change throughout the request lifecycle. + Request events + + The request object supports the following events: + + 'peek' - emitted for each chunk of payload data read from the client connection. The event method signature is function(chunk, encoding). + 'finish' - emitted when the request payload finished reading. The event method signature is function (). + 'disconnect' - emitted when a request errors or aborts unexpectedly. + var Crypto = require('crypto'); + var Hapi = require('hapi'); + var server = new Hapi.Server(); + server.connection({ port: 80 }); + + server.ext('onRequest', function (request, reply) { + + var hash = Crypto.createHash('sha1'); + request.on('peek', function (chunk) { + + hash.update(chunk); + }); + + request.once('finish', function () { + + console.log(hash.digest('hex')); + }); + + request.once('disconnect', function () { + + console.error('request aborted'); + }); + + return reply.continue(); + });*/ + export class Request extends Events.EventEmitter { + /** application-specific state. Provides a safe place to store application data without potential conflicts with the framework. Should not be used by plugins which should use plugins[name].*/ + app: any; + /** authentication information*/ + auth: { + /** true is the request has been successfully authenticated, otherwise false.*/ + isAuthenticated: boolean; + /** the credential object received during the authentication process. The presence of an object does not mean successful authentication.*/ + credentials: any; + /** an artifact object received from the authentication strategy and used in authentication-related actions.*/ artifacts: any; + /** the route authentication mode.*/ + mode: any; + /** the authentication error is failed and mode set to 'try'.*/ + error: any; + /** an object used by the ['cookie' authentication scheme] https://github.com/hapijs/hapi-auth-cookie */ session: any }; + /** the node domain object used to protect against exceptions thrown in extensions, handlers and route prerequisites. Can be used to manually bind callback functions otherwise bound to other domains.*/ domain: any; - headers: any; + /** the raw request headers (references request.raw.headers).*/ + headers: IDictionary; + /** a unique request identifier (using the format '{now}:{connection.info.id}:{5 digits counter}').*/ id: number; + /** request information */ info: { + /** request reception timestamp. */ received: number; + /** request response timestamp (0 is not responded yet). */ + responded: number; + /** remote client IP address. */ + remoteAddress: string; + /** remote client port. */ remotePort: number; + /** content of the HTTP 'Referrer' (or 'Referer') header. */ referrer: string; + /** content of the HTTP 'Host' header (e.g. 'example.com:8080'). */ host: string; + /** the hostname part of the 'Host' header (e.g. 'example.com').*/ + hostname: string; }; + /** the request method in lower case (e.g. 'get', 'post'). */ method: string; - mime?: string; - params: any; - path: string; - payload: any; - plugins: any; - pre: any; - response: any; - responses: any; - query: any; - raw: { - req: any; //http.ClientRequest - res: any; //http.ClientResponse + /** the parsed content-type header. Only available when payload parsing enabled and no payload error occurred. */ + mime: string; + /** an object containing the values of params, query, and payload before any validation modifications made. Only set when input validation is performed.*/ + orig: { + params: any; + query: any; + payload: any; }; - route: string; - server: Server; - session: any; - state: any; - url: any; - - setUrl? (url: string): void; - setMethod? (method: string): void; - log (tags: string, data?: string, timestamp?: number): void; - log (tags: string, data?: any, timestamp?: number): void; - log (tags: string[], data?: string, timestamp?: number): void; - log (tags: string[], data?: any, timestamp?: number): void; - getLog(): string[]; - getLog(tag: string): string[]; - getLog(tags: string[]): string[]; - tail(name?: string): Function; - } - - export interface Response { - statusCode: number; - headers: any; - source: any; - variety: string; - app: any; + /** an object where each key is a path parameter name with matching value as described in Path parameters.*/ + params: IDictionary; + /** an array containing all the path params values in the order they appeared in the path.*/ + paramsArray: string[]; + /** the request URI's path component. */ + path: string; + /** the request payload based on the route payload.output and payload.parse settings.*/ + payload: any; + /** plugin-specific state. Provides a place to store and pass request-level plugin data. The plugins is an object where each key is a plugin name and the value is the state.*/ plugins: any; + /** an object where each key is the name assigned by a route prerequisites function. The values are the raw values provided to the continuation function as argument. For the wrapped response object, use responses.*/ + pre: IDictionary; + /** the response object when set. The object can be modified but must not be assigned another object. To replace the response with another from within an extension point, use reply(response) to override with a different response. Contains null when no response has been set (e.g. when a request terminates prematurely when the client disconnects).*/ + response: Response; + /**preResponses - same as pre but represented as the response object created by the pre method.*/ + preResponses: any; + /**an object containing the query parameters.*/ + query: any; + /** an object containing the Node HTTP server objects. Direct interaction with these raw objects is not recommended.*/ + raw: { + req: http.ClientRequest; + res: http.ServerResponse; + }; + /** the route public interface.*/ + route: IRoute; + /** the server object. */ + server: Server; + /** Special key reserved for plugins implementing session support. Plugins utilizing this key must check for null value to ensure there is no conflict with another similar server. */ + session: any; + /** an object containing parsed HTTP state information (cookies) where each key is the cookie name and value is the matching cookie content after processing using any registered cookie definition. */ + state: any; + /** complex object contining details on the url */ + url: { + /** null when i tested */ + auth: any; + /** null when i tested */ + hash: any; + /** null when i tested */ + host: any; + /** null when i tested */ + hostname: any; + href: string; + path: string; + /** path without search*/ + pathname: string; + /** null when i tested */ + port: any; + /** null when i tested */ + protocol: any; + /** querystring parameters*/ + query: IDictionary; + /** querystring parameters as a string*/ + search: string; + /** null when i tested */ + slashes: any; + }; + /** request.setUrl(url) + + Available only in 'onRequest' extension methods. + + Changes the request URI before the router begins processing the request where: + + url - the new request path value. + var Hapi = require('hapi'); + var server = new Hapi.Server(); + server.connection({ port: 80 }); + + server.ext('onRequest', function (request, reply) { + + // Change all requests to '/test' + request.setUrl('/test'); + return reply.continue(); + });*/ + setUrl(url: string): void; + /** request.setMethod(method) + + Available only in 'onRequest' extension methods. + + Changes the request method before the router begins processing the request where: + + method - is the request HTTP method (e.g. 'GET'). + var Hapi = require('hapi'); + var server = new Hapi.Server(); + server.connection({ port: 80 }); + + server.ext('onRequest', function (request, reply) { + + // Change all requests to 'GET' + request.setMethod('GET'); + return reply.continue(); + });*/ + setMethod(method: string): void; + /** request.log(tags, [data, [timestamp]]) + + Always available. + + Logs request-specific events. When called, the server emits a 'request' event which can be used by other listeners or plugins. The arguments are: + + data - an optional message string or object with the application data being logged. + timestamp - an optional timestamp expressed in milliseconds. Defaults to Date.now() (now). + Any logs generated by the server internally will be emitted only on the 'request-internal' channel and will include the event.internal flag set to true. + + var Hapi = require('hapi'); + var server = new Hapi.Server(); + server.connection({ port: 80 }); + + server.on('request', function (request, event, tags) { + + if (tags.error) { + console.log(event); + } + }); + + var handler = function (request, reply) { + + request.log(['test', 'error'], 'Test event'); + return reply(); + }; + */ + log( + /** a string or an array of strings (e.g. ['error', 'database', 'read']) used to identify the event. Tags are used instead of log levels and provide a much more expressive mechanism for describing and filtering events.*/ + tags: string|string[], + /** an optional message string or object with the application data being logged.*/ + data?: string, + /** an optional timestamp expressed in milliseconds. Defaults to Date.now() (now).*/ + timestamp?: number): void; + /** request.getLog([tags], [internal]) + + Always available. + + Returns an array containing the events matching any of the tags specified (logical OR) + request.getLog(); + request.getLog('error'); + request.getLog(['error', 'auth']); + request.getLog(['error'], true); + request.getLog(false);*/ + + getLog( + /** is a single tag string or array of tag strings. If no tags specified, returns all events.*/ + tags?: string, + /** filters the events to only those with a matching event.internal value. If true, only internal logs are included. If false, only user event are included. Defaults to all events (undefined).*/ + internal?: boolean): string[]; + + /** request.tail([name]) + + Available until immediately after the 'response' event is emitted. + + Adds a request tail which has to complete before the request lifecycle is complete where: + + name - an optional tail name used for logging purposes. + Returns a tail function which must be called when the tail activity is completed. + + Tails are actions performed throughout the request lifecycle, but which may end after a response is sent back to the client. For example, a request may trigger a database update which should not delay sending back a response. However, it is still desirable to associate the activity with the request when logging it (or an error associated with it). + + When all tails completed, the server emits a 'tail' event. + + var Hapi = require('hapi'); + var server = new Hapi.Server(); + server.connection({ port: 80 }); + + var get = function (request, reply) { + + var dbTail = request.tail('write to database'); + + db.save('key', 'value', function () { + + dbTail(); + }); + + return reply('Success!'); + }; + + server.route({ method: 'GET', path: '/', handler: get }); + + server.on('tail', function (request) { + + console.log('Request completed including db activity'); + });*/ + tail( + /** an optional tail name used for logging purposes.*/ + name?: string): Function; + } + /** Response events + + The response object supports the following events: + + 'peek' - emitted for each chunk of data written back to the client connection. The event method signature is function(chunk, encoding). + 'finish' - emitted when the response finished writing but before the client response connection is ended. The event method signature is function (). + var Crypto = require('crypto'); + var Hapi = require('hapi'); + var server = new Hapi.Server(); + server.connection({ port: 80 }); + + server.ext('onPreResponse', function (request, reply) { + + var response = request.response; + if (response.isBoom) { + return reply(); + } + + var hash = Crypto.createHash('sha1'); + response.on('peek', function (chunk) { + + hash.update(chunk); + }); + + response.once('finish', function () { + + console.log(hash.digest('hex')); + }); + + return reply.continue(); + });*/ + export class Response extends Events.EventEmitter { + /** the HTTP response status code. Defaults to 200 (except for errors).*/ + statusCode: number; + /** an object containing the response headers where each key is a header field name. Note that this is an incomplete list of headers to be included with the response. Additional headers will be added once the response is prepare for transmission.*/ + headers: IDictionary; + /** the value provided using the reply interface.*/ + source: any; + /** a string indicating the type of source with available values: + 'plain' - a plain response such as string, number, null, or simple object (e.g. not a Stream, Buffer, or view). + 'buffer' - a Buffer. + 'view' - a view generated with reply.view(). + 'file' - a file generated with reply.file() of via the directory handler. + 'stream' - a Stream. + 'promise' - a Promise object. */ + variety: string; + /** application-specific state. Provides a safe place to store application data without potential conflicts with the framework. Should not be used by plugins which should use plugins[name].*/ + app: any; + /** plugin-specific state. Provides a place to store and pass request-level plugin data. The plugins is an object where each key is a plugin name and the value is the state. */ + plugins: any; + /** settings - response handling flags: + charset - the 'Content-Type' HTTP header 'charset' property. Defaults to 'utf-8'. + encoding - the string encoding scheme used to serial data into the HTTP payload when source is a string or marshals into a string. Defaults to 'utf8'. + passThrough - if true and source is a Stream, copies the statusCode and headers of the stream to the outbound response. Defaults to true. + stringify - options used for source value requiring stringification. Defaults to no replacer and no space padding. + ttl - if set, overrides the route cache expiration milliseconds value set in the route config. Defaults to no override. + varyEtag - if true, a suffix will be automatically added to the 'ETag' header at transmission time (separated by a '-' character) when the HTTP 'Vary' header is present.*/ settings: { - encoding: string; charset: string; - location: string; - ttl: number; - stringify: any; + encoding: string; passThrough: boolean; + stringify: any; + ttl: number; + varyEtag: boolean; } - code (statusCode: number): void; - header (name: string, value: string, options?: { + /** sets the HTTP 'Content-Length' header (to avoid chunked transfer encoding) where: + length - the header value. Must match the actual payload size.*/ + bytes(length: number): void; + /** sets the 'Content-Type' HTTP header 'charset' property where: charset - the charset property value.*/ + charset(charset: string): void; + + /** sets the HTTP status code where: + statusCode - the HTTP status code.*/ + code(statusCode: number): void; + /** sets the HTTP status code to Created (201) and the HTTP 'Location' header where: uri - an absolute or relative URI used as the 'Location' header value.*/ + created(uri: string): void; + + + /** encoding(encoding) - sets the string encoding scheme used to serial data into the HTTP payload where: encoding - the encoding property value (see node Buffer encoding).*/ + encoding(encoding: string): void; + + /** etag(tag, options) - sets the representation entity tag where: + tag - the entity tag string without the double-quote. + options - optional settings where: + weak - if true, the tag will be prefixed with the 'W/' weak signifier. Weak tags will fail to match identical tags for the purpose of determining 304 response status. Defaults to false. + vary - if true and content encoding is set or applied to the response (e.g 'gzip' or 'deflate'), the encoding name will be automatically added to the tag at transmission time (separated by a '-' character). Ignored when weak is true. Defaults to true.*/ + etag(tag: string, options: { + weak: boolean; vary: boolean; + }): void; + + /**header(name, value, options) - sets an HTTP header where: + name - the header name. + value - the header value. + options - optional settings where: + append - if true, the value is appended to any existing header value using separator. Defaults to false. + separator - string used as separator when appending to an exiting value. Defaults to ','. + override - if false, the header value is not set if an existing value present. Defaults to true.*/ + header(name: string, value: string, options?: { append: boolean; separator: string; override: boolean; }): void; - type (mimeType: string): void; - bytes (length: number): void; - vary (header: string): void; - location (location: string): void; - created (location: string): void; - redirect (location: string): void; - encoding (encoding: string): void; - charset (charset: string): void; - ttl (ttl: number): void; - state (name: string, value: string, options?: any): void; - unstate (name: string): void; - replacer (method: Function): void; - replacer (method: Array): void; - spaces (count: number): void; + /** location(uri) - sets the HTTP 'Location' header where: + uri - an absolute or relative URI used as the 'Location' header value.*/ + location(uri: string): void; + + /** redirect(uri) - sets an HTTP redirection response (302) and decorates the response with additional methods listed below, where: + uri - an absolute or relative URI used to redirect the client to another resource. */ + redirect(uri: string): void; + + /** replacer(method) - sets the JSON.stringify() replacer argument where: + method - the replacer function or array. Defaults to none.*/ + replacer(method: Function| Array): void; + + /** spaces(count) - sets the JSON.stringify() space argument where: + count - the number of spaces to indent nested object keys. Defaults to no indentation. */ + spaces(count: number): void; + /**state(name, value, [options]) - sets an HTTP cookie where: + name - the cookie name. + value - the cookie value. If no encoding is defined, must be a string. + options - optional configuration. If the state was previously registered with the server using server.state(), the specified keys in options override those same keys in the server definition (but not others).*/ + state(name: string, value: string, options?: any): void; - temporary (isTemporary: boolean): void; - permanent (isPermanent: boolean): void; - rewritable (isRewritable: boolean): void; } - export module reply { - function file(path: string, options: { - filePath: string; - options: { - filename: string; - mode: string + + + /** Server http://hapijs.com/api#server + rver object is the main application container. The server manages all incoming connections along with all the facilities provided by the framework. A server can contain more than one connection (e.g. listen to port 80 and 8080). + Server events + The server object inherits from Events.EventEmitter and emits the following events: + 'log' - events logged with server.log() and server events generated internally by the framework. + 'start' - emitted when the server is started using server.start(). + 'stop' - emitted when the server is stopped using server.stop(). + 'request' - events generated by request.log(). Does not include any internally generated events. + 'request-internal' - request events generated internally by the framework (multiple events per request). + 'request-error' - emitted whenever an Internal Server Error (500) error response is sent. Single event per request. + 'response' - emitted after the response is sent back to the client (or when the client connection closed and no response sent, in which case request.response is null). Single event per request. + 'tail' - emitted when a request finished processing, including any registered tails. Single event per request. + Note that the server object should not be used to emit application events as its internal implementation is designed to fan events out to the various plugin selections and not for application events. + MORE EVENTS HERE: http://hapijs.com/api#server-events*/ + export class Server extends Events.EventEmitter { + + constructor(options?: IServerOptions); + /** Provides a safe place to store server-specific run-time application data without potential conflicts with the framework internals. The data can be accessed whenever the server is accessible. Initialized with an empty object. + var Hapi = require('hapi'); + server = new Hapi.Server(); + server.app.key = 'value'; + var handler = function (request, reply) { + return reply(request.server.app.key); + }; */ + app: any; + /** An array containing the server's connections. When the server object is returned from server.select(), the connections array only includes the connections matching the selection criteria. + var server = new Hapi.Server(); + server.connection({ port: 80, labels: 'a' }); + server.connection({ port: 8080, labels: 'b' }); + // server.connections.length === 2 + var a = server.select('a'); + // a.connections.length === 1*/ + connections: Array; + /** When the server contains exactly one connection, info is an object containing information about the sole connection. + * When the server contains more than one connection, each server.connections array member provides its own connection.info. + var server = new Hapi.Server(); + server.connection({ port: 80 }); + // server.info.port === 80 + server.connection({ port: 8080 }); + // server.info === null + // server.connections[1].info.port === 8080 + */ + info: { + /** - a unique connection identifier (using the format '{hostname}:{pid}:{now base36}').*/ + id: string; + /** - the connection creation timestamp.*/ + created: number; + /** - the connection start timestamp (0 when stopped).*/ + started: number; + /** the connection port based on the following rules: + the configured port value before the server has been started. + the actual port assigned when no port is configured or set to 0 after the server has been started.*/ + port: number; + + /** - the host name the connection was configured to. Defaults to the operating system hostname when available, otherwise 'localhost'.*/ + host: string; + /** - the active IP address the connection was bound to after starting.Set to undefined until the server has been started or when using a non TCP port (e.g. UNIX domain socket).*/ + address: string; + /** - the protocol used: + 'http' - HTTP. + 'https' - HTTPS. + 'socket' - UNIX domain socket or Windows named pipe.*/ + protocol: string; + /** a string representing the connection (e.g. 'http://example.com:8080' or 'socket:/unix/domain/socket/path'). Contains the uri setting if provided, otherwise constructed from the available settings. If no port is available or set to 0, the uri will not include a port component.*/ + uri: string; + }; + /** An object containing the process load metrics (when load.sampleInterval is enabled): + rss - RSS memory usage. + var Hapi = require('hapi'); + var server = new Hapi.Server({ load: { sampleInterval: 1000 } }); + console.log(server.load.rss);*/ + load: { + /** - event loop delay milliseconds.*/ + eventLoopDelay: number; + /** - V8 heap usage.*/ + heapUsed: number; + }; + /** When the server contains exactly one connection, listener is the node HTTP server object of the sole connection. + When the server contains more than one connection, each server.connections array member provides its own connection.listener. + var Hapi = require('hapi'); + var SocketIO = require('socket.io'); + var server = new Hapi.Server(); + server.connection({ port: 80 }); + var io = SocketIO.listen(server.listener); + io.sockets.on('connection', function(socket) { + socket.emit({ msg: 'welcome' }); + });*/ + listener: http.Server; + + /** server.methods + An object providing access to the server methods where each server method name is an object property. + var Hapi = require('hapi'); + var server = new Hapi.Server(); + server.method('add', function (a, b, next) { + return next(null, a + b); + }); + server.methods.add(1, 2, function (err, result) { + // result === 3 + });*/ + methods: IDictionary; + + /** server.mime + Provides access to the server MIME database used for setting content-type information. The object must not be modified directly but only through the mime server setting. + var Hapi = require('hapi'); + var options = { + mime: { + override: { + 'node/module': { + source: 'steve', + compressible: false, + extensions: ['node', 'module', 'npm'], + type: 'node/module' + } + } + } + }; + var server = new Hapi.Server(options); + // server.mime.path('code.js').type === 'application/javascript' + // server.mime.path('file.npm').type === 'node/module'*/ + mime: any; + /**server.plugins + An object containing the values exposed by each plugin registered where each key is a plugin name and the values are the exposed properties by each plugin using server.expose(). Plugins may set the value of the server.plugins[name] object directly or via the server.expose() method. + exports.register = function (server, options, next) { + server.expose('key', 'value'); + // server.plugins.example.key === 'value' + return next(); + }; + exports.register.attributes = { + name: 'example' + };*/ + plugins: IDictionary; + /** server.realm + The realm object contains server-wide or plugin-specific state that can be shared across various methods. For example, when calling server.bind(), the active realm settings.bind property is set which is then used by routes and extensions added at the same level (server root or plugin). Realms are a limited version of a sandbox where plugins can maintain state used by the framework when adding routes, extensions, and other properties. + modifiers - when the server object is provided as an argument to the plugin register() method, modifiers provides the registration preferences passed the server.register() method and includes: + route - routes preferences: + prefix - the route path prefix used by any calls to server.route() from the server. + vhost - the route virtual host settings used by any calls to server.route() from the server. + plugin - the active plugin name (empty string if at the server root). + plugins - plugin-specific state to be shared only among activities sharing the same active state. plugins is an object where each key is a plugin name and the value is the plugin state. + settings - settings overrides: + files.relativeTo + bind + The server.realm object should be considered read-only and must not be changed directly except for the plugins property can be directly manipulated by the plugins (each setting its own under plugins[name]). + exports.register = function (server, options, next) { + console.log(server.realm.modifiers.route.prefix); + return next(); + };*/ + realm: IServerRealm; + + /** server.root + The root server object containing all the connections and the root server methods (e.g. start(), stop(), connection()).*/ + root: Server; + /** server.settings + The server configuration object after defaults applied. + var Hapi = require('hapi'); + var server = new Hapi.Server({ + app: { + key: 'value' + } + }); + // server.settings.app === { key: 'value' }*/ + settings: IServerOptions; + + /** server.version + The hapi module version number. + var Hapi = require('hapi'); + var server = new Hapi.Server(); + // server.version === '8.0.0'*/ + version: string; + + /** server.after(method, [dependencies]) + Adds a method to be called after all the plugin dependencies have been registered and before the server starts (only called if the server is started) where: + after - the method with signature function(plugin, next) where: + server - server object the after() method was called on. + next - the callback function the method must call to return control over to the application and complete the registration process. The function signature is function(err) where: + err - internal error which is returned back via the server.start() callback. + dependencies - a string or array of string with the plugin names to call this method after their after() methods. There is no requirement for the other plugins to be registered. Setting dependencies only arranges the after methods in the specified order. + var Hapi = require('hapi'); + var server = new Hapi.Server(); + server.connection({ port: 80 }); + server.after(function () { + // Perform some pre-start logic + }); + server.start(function (err) { + // After method already executed + }); + server.auth.default(options)*/ + after(method: (plugin: any, next: (err: any) => void) => void, dependencies: string|string[]): void; + + auth: { + /** server.auth.default(options) + Sets a default strategy which is applied to every route where: + options - a string with the default strategy name or an object with a specified strategy or strategies using the same format as the route auth handler options. + The default does not apply when the route config specifies auth as false, or has an authentication strategy configured. Otherwise, the route authentication config is applied to the defaults. Note that the default only applies at time of route configuration, not at runtime. Calling default() after adding a route will have no impact on routes added prior. + The default auth strategy configuration can be accessed via connection.auth.settings.default. + var server = new Hapi.Server(); + server.connection({ port: 80 }); + server.auth.scheme('custom', scheme); + server.auth.strategy('default', 'custom'); + server.auth.default('default'); + server.route({ + method: 'GET', + path: '/', + handler: function (request, reply) { + return reply(request.auth.credentials.user); } - }): void; + });*/ + default(options: string):void; + /** server.auth.scheme(name, scheme) + Registers an authentication scheme where: + name - the scheme name. + scheme - the method implementing the scheme with signature function(server, options) where: + server - a reference to the server object the scheme is added to. + options - optional scheme settings used to instantiate a strategy.*/ + scheme(name: string, + /** When the scheme authenticate() method implementation calls reply() with an error condition, the specifics of the error affect whether additional authentication strategies will be attempted if configured for the route. If the err returned by the reply() method includes a message, no additional strategies will be attempted. If the err does not include a message but does include a scheme name (e.g. Boom.unauthorized(null, 'Custom')), additional strategies will be attempted in order of preference. + n the scheme payload() method returns an error with a message, it means payload validation failed due to bad payload. If the error has no message but includes a scheme name (e.g. Boom.unauthorized(null, 'Custom')), authentication may still be successful if the route auth.payload configuration is set to 'optional'. + server = new Hapi.Server(); + server.connection({ port: 80 }); + scheme = function (server, options) { + urn { + authenticate: function (request, reply) { + req = request.raw.req; + var authorization = req.headers.authorization; + if (!authorization) { + return reply(Boom.unauthorized(null, 'Custom')); + } + urn reply(null, { credentials: { user: 'john' } }); + } + }; + }; + */ + scheme: (server: Server, options: any) => IServerAuthScheme): void; - function view(template: string, context?: any, options?: any): Response; - function close(options?: any): void; - function proxy(options: any): void; + /** server.auth.strategy(name, scheme, [mode], [options]) + Registers an authentication strategy where: + name - the strategy name. + scheme - the scheme name (must be previously registered using server.auth.scheme()). + mode - if true, the scheme is automatically assigned as a required strategy to any route without an auth config. Can only be assigned to a single server strategy. Value must be true (which is the same as 'required') or a valid authentication mode ('required', 'optional', 'try'). Defaults to false. + options - scheme options based on the scheme requirements. + var server = new Hapi.Server(); + server.connection({ port: 80 }); + server.auth.scheme('custom', scheme); + server.auth.strategy('default', 'custom'); + server.route({ + method: 'GET', + path: '/', + config: { + auth: 'default', + handler: function (request, reply) { + return reply(request.auth.credentials.user); + } + } + });*/ + strategy(name: string, scheme: any, mode?: boolean, options?: any):void; + + /** server.auth.test(strategy, request, next) + Tests a request against an authentication strategy where: + strategy - the strategy name registered with server.auth.strategy(). + request - the request object. + next - the callback function with signature function(err, credentials) where: + err - the error if authentication failed. + credentials - the authentication credentials object if authentication was successful. + Note that the test() method does not take into account the route authentication configuration. It also does not perform payload authentication. It is limited to the basic strategy authentication execution. It does not include verifying scope, entity, or other route properties. + var server = new Hapi.Server(); + server.connection({ port: 80 }); + server.auth.scheme('custom', scheme); + server.auth.strategy('default', 'custom'); + server.route({ + method: 'GET', + path: '/', + handler: function (request, reply) { + request.server.auth.test('default', request, function (err, credentials) { + if (err) { + return reply({ status: false }); + } + return reply({ status: true, user: credentials.name }); + }); + } + });*/ + test(strategy: string, request: Request, next: (err: any, credentials: any) => void): void; + }; + /** server.bind(context) + Sets a global context used as the default bind object when adding a route or an extension where: + context - the object used to bind this in handler and extension methods. + When setting context inside a plugin, the context is applied only to methods set up by the plugin. Note that the context applies only to routes and extensions added after it has been set. + var handler = function (request, reply) { + return reply(this.message); + }; + exports.register = function (server, options, next) { + var bind = { + message: 'hello' + }; + server.bind(bind); + server.route({ method: 'GET', path: '/', handler: handler }); + return next(); + };*/ + bind(context: any): void; + + + /** server.cache(options) + Provisions a cache segment within the server cache facility where: + options - catbox policy configuration where: + expiresIn - relative expiration expressed in the number of milliseconds since the item was saved in the cache. Cannot be used together with expiresAt. + expiresAt - time of day expressed in 24h notation using the 'HH:MM' format, at which point all cache records expire. Uses local time. Cannot be used together with expiresIn. + generateFunc - a function used to generate a new cache item if one is not found in the cache when calling get(). The method's signature is function(id, next) where: - id - the id string or object provided to the get() method. - next - the method called when the new item is returned with the signature function(err, value, ttl) where: - err - an error condition. - value - the new value generated. - ttl - the cache ttl value in milliseconds. Set to 0 to skip storing in the cache. Defaults to the cache global policy. + staleIn - number of milliseconds to mark an item stored in cache as stale and attempt to regenerate it when generateFunc is provided. Must be less than expiresIn. + staleTimeout - number of milliseconds to wait before checking if an item is stale. + generateTimeout - number of milliseconds to wait before returning a timeout error when the generateFunc function takes too long to return a value. When the value is eventually returned, it is stored in the cache for future requests. + cache - the cache name configured in 'server.cache`. Defaults to the default cache. + segment - string segment name, used to isolate cached items within the cache partition. When called within a plugin, defaults to '!name' where 'name' is the plugin name. Required when called outside of a plugin. + shared - if true, allows multiple cache provisions to share the same segment. Default to false. + var server = new Hapi.Server(); + server.connection({ port: 80 }); + var cache = server.cache({ segment: 'countries', expiresIn: 60 * 60 * 1000 }); + cache.set('norway', { capital: 'oslo' }, null, function (err) { + cache.get('norway', function (err, value, cached, log) { + // value === { capital: 'oslo' }; + }); + });*/ + cache(options: ICatBoxCacheOptions): void; + + /** server.connection([options]) + Adds an incoming server connection + Returns a server object with the new connection selected. + Must be called before any other server method that modifies connections is called for it to apply to the new connection (e.g. server.state()). + Note that the options object is deeply cloned (with the exception of listener which is shallowly copied) and cannot contain any values that are unsafe to perform deep copy on. + var Hapi = require('hapi'); + var server = new Hapi.Server(); + var web = server.connection({ port: 8000, host: 'example.com', labels: ['web'] }); + var admin = server.connection({ port: 8001, host: 'example.com', labels: ['admin'] }); + // server.connections.length === 2 + // web.connections.length === 1 + // admin.connections.length === 1 */ + connection(options: ISeverConnectionOptions): Server; + /** server.decorate(type, property, method) + Extends various framework interfaces with custom methods where: + type - the interface being decorated. Supported types: + 'reply' - adds methods to the reply interface. + 'server' - adds methods to the Server object. + property - the object decoration key name. + method - the extension function. + Note that decorations apply to the entire server and all its connections regardless of current selection. + var Hapi = require('hapi'); + var server = new Hapi.Server(); + server.connection({ port: 80 }); + server.decorate('reply', 'success', function () { + return this.response({ status: 'ok' }); + }); + server.route({ + method: 'GET', + path: '/', + handler: function (request, reply) { + return reply.success(); + } + });*/ + decorate(type: string, property: string, method: Function):void; + + /** server.dependency(dependencies, [after]) + Used within a plugin to declares a required dependency on other plugins where: + dependencies - a single string or array of plugin name strings which must be registered in order for this plugin to operate. Plugins listed must be registered before the server is started. Does not provide version dependency which should be implemented using npm peer dependencies. + after - an optional function called after all the specified dependencies have been registered and before the server starts. The function is only called if the server is started. If a circular dependency is detected, an exception is thrown (e.g. two plugins each has an after function to be called after the other). The function signature is function(server, next) where: + server - the server the dependency() method was called on. + next - the callback function the method must call to return control over to the application and complete the registration process. The function signature is function(err) where: + err - internal error condition, which is returned back via the server.start() callback. + exports.register = function (server, options, next) { + server.dependency('yar', after); + return next(); + }; + var after = function (server, next) { + // Additional plugin registration logic + return next(); + };*/ + dependency(dependencies: string|string[], after?: (server: Server, next: (err: any) => void) => void): void; + + + /** server.expose(key, value) + Used within a plugin to expose a property via server.plugins[name] where: + key - the key assigned (server.plugins[name][key]). + value - the value assigned. + exports.register = function (server, options, next) { + server.expose('util', function () { console.log('something'); }); + return next(); + };*/ + expose(key: string, value: any): void; + + /** server.expose(obj) + Merges a deep copy of an object into to the existing content of server.plugins[name] where: + obj - the object merged into the exposed properties container. + exports.register = function (server, options, next) { + server.expose({ util: function () { console.log('something'); } }); + return next(); + };*/ + expose(obj: any): void; + + /** server.ext(event, method, [options]) + Registers an extension function in one of the available extension points where: + event - the event name. + method - a function or an array of functions to be executed at a specified point during request processing. The required extension function signature is function(request, reply) where: + request - the request object. + reply - the reply interface which is used to return control back to the framework. To continue normal execution of the request lifecycle, reply.continue() must be called. To abort processing and return a response to the client, call reply(value) where value is an error or any other valid response. + this - the object provided via options.bind or the current active context set with server.bind(). + options - an optional object with the following: + before - a string or array of strings of plugin names this method must execute before (on the same event). Otherwise, extension methods are executed in the order added. + after - a string or array of strings of plugin names this method must execute after (on the same event). Otherwise, extension methods are executed in the order added. + bind - a context object passed back to the provided method (via this) when called. + var Hapi = require('hapi'); + var server = new Hapi.Server(); + server.connection({ port: 80 }); + server.ext('onRequest', function (request, reply) { + // Change all requests to '/test' + request.setUrl('/test'); + return reply.continue(); + }); + var handler = function (request, reply) { + return reply({ status: 'ok' }); + }; + server.route({ method: 'GET', path: '/test', handler: handler }); + server.start(); + // All requests will get routed to '/test'*/ + ext(event: string, method: (request: Request, reply: IReply, bind?: any) => void, options?: { before: string|string[]; after: string|string[]; bind?: any }): void; + + /** server.handler(name, method) + Registers a new handler type to be used in routes where: + name - string name for the handler being registered. Cannot override the built-in handler types (directory, file, proxy, and view) or any previously registered type. + method - the function used to generate the route handler using the signature function(route, options) where: + route - the route public interface object. + options - the configuration object provided in the handler config. + var Hapi = require('hapi'); + var server = new Hapi.Server(); + server.connection({ host: 'localhost', port: 8000 }); + // Defines new handler for routes on this server + server.handler('test', function (route, options) { + return function (request, reply) { + return reply('new handler: ' + options.msg); + } + }); + server.route({ + method: 'GET', + path: '/', + handler: { test: { msg: 'test' } } + }); + server.start(); + The method function can have a defaults object or function property. If the property is set to an object, that object is used as the default route config for routes using this handler. If the property is set to a function, the function uses the signature function(method) and returns the route default configuration. + var Hapi = require('hapi'); + var server = new Hapi.Server(); + server.connection({ host: 'localhost', port: 8000 }); + var handler = function (route, options) { + return function (request, reply) { + return reply('new handler: ' + options.msg); + } + }; + // Change the default payload processing for this handler + handler.defaults = { + payload: { + output: 'stream', + parse: false + } + }; + server.handler('test', handler);*/ + handler(name: string, method: (route: IRoute, options: THandlerConfig) => ISessionHandler): void; + /** When the server contains exactly one connection, injects a request into the sole connection simulating an incoming HTTP request without making an actual socket connection. + Injection is useful for testing purposes as well as for invoking routing logic internally without the overhead or limitations of the network stack. + Utilizes the [shot module | https://github.com/hapijs/shot ] for performing injections, with some additional options and response properties + * When the server contains more than one connection, each server.connections array member provides its own connection.inject(). + var Hapi = require('hapi'); + var server = new Hapi.Server(); + server.connection({ port: 80 }); + var handler = function (request, reply) { + return reply('Success!'); + }; + server.route({ method: 'GET', path: '/', handler: handler }); + server.inject('/', function (res) { + console.log(res.result); + }); + */ + inject: IServerInject; + + /** server.log(tags, [data, [timestamp]]) + Logs server events that cannot be associated with a specific request. When called the server emits a 'log' event which can be used by other listeners or plugins to record the information or output to the console. The arguments are: + tags - a string or an array of strings (e.g. ['error', 'database', 'read']) used to identify the event. Tags are used instead of log levels and provide a much more expressive mechanism for describing and filtering events. Any logs generated by the server internally include the 'hapi' tag along with event-specific information. + data - an optional message string or object with the application data being logged. + timestamp - an optional timestamp expressed in milliseconds. Defaults to Date.now() (now). + var Hapi = require('hapi'); + var server = new Hapi.Server(); + server.connection({ port: 80 }); + server.on('log', function (event, tags) { + if (tags.error) { + console.log(event); + } + }); + server.log(['test', 'error'], 'Test event');*/ + log(tags: string|string[], data?: string|any, timestamp?: number): void; + /**server.lookup(id) + When the server contains exactly one connection, looks up a route configuration where: + id - the route identifier as set in the route options. + returns the route public interface object if found, otherwise null. + var server = new Hapi.Server(); + server.connection(); + server.route({ + method: 'GET', + path: '/', + config: { + handler: function (request, reply) { return reply(); }, + id: 'root' + } + }); + var route = server.lookup('root'); + When the server contains more than one connection, each server.connections array member provides its own connection.lookup() method.*/ + lookup(id: string): IRoute; + /** server.match(method, path, [host]) + When the server contains exactly one connection, looks up a route configuration where: + method - the HTTP method (e.g. 'GET', 'POST'). + path - the requested path (must begin with '/'). + host - optional hostname (to match against routes with vhost). + returns the route public interface object if found, otherwise null. + var server = new Hapi.Server(); + server.connection(); + server.route({ + method: 'GET', + path: '/', + config: { + handler: function (request, reply) { return reply(); }, + id: 'root' + } + }); + var route = server.match('get', '/'); + When the server contains more than one connection, each server.connections array member provides its own connection.match() method.*/ + match(method: string, path: string, host?: string): IRoute; + + + + + /** server.method(name, method, [options]) + Registers a server method. Server methods are functions registered with the server and used throughout the application as a common utility. Their advantage is in the ability to configure them to use the built-in cache and share across multiple request handlers without having to create a common module. + Methods are registered via server.method(name, method, [options]) + var Hapi = require('hapi'); + var server = new Hapi.Server(); + server.connection({ port: 80 }); + // Simple arguments + var add = function (a, b, next) { + return next(null, a + b); + }; + server.method('sum', add, { cache: { expiresIn: 2000 } }); + server.methods.sum(4, 5, function (err, result) { + console.log(result); + }); + // Object argument + var addArray = function (array, next) { + var sum = 0; + array.forEach(function (item) { + sum += item; + }); + return next(null, sum); + }; + server.method('sumObj', addArray, { + cache: { expiresIn: 2000 }, + generateKey: function (array) { + return array.join(','); + } + }); + server.methods.sumObj([5, 6], function (err, result) { + console.log(result); + }); + // Synchronous method with cache + var addSync = function (a, b) { + return a + b; + }; + server.method('sumSync', addSync, { cache: { expiresIn: 2000 }, callback: false }); + server.methods.sumSync(4, 5, function (err, result) { + console.log(result); + }); */ + method( + /** a unique method name used to invoke the method via server.methods[name]. When configured with caching enabled, server.methods[name].cache.drop(arg1, arg2, ..., argn, callback) can be used to clear the cache for a given key. Supports using nested names such as utils.users.get which will automatically create the missing path under server.methods and can be accessed for the previous example via server.methods.utils.users.get.*/ + name: string, + method: IServerMethod, + options?: IServerMethodOptions):void; + + + /**server.method(methods) + Registers a server method function as described in server.method() using a configuration object where: + methods - an object or an array of objects where each one contains: + name - the method name. + method - the method function. + options - optional settings. + var add = function (a, b, next) { + next(null, a + b); + }; + server.method({ + name: 'sum', + method: add, + options: { + cache: { + expiresIn: 2000 + } + } + });*/ + method(methods: { + name: string; method: IServerMethod; options?: IServerMethodOptions + }| Array<{ + name: string; method: IServerMethod; options?: IServerMethodOptions + }>):void; + /**server.path(relativeTo) + Sets the path prefix used to locate static resources (files and view templates) when relative paths are used where: + relativeTo - the path prefix added to any relative file path starting with '.'. + Note that setting a path within a plugin only applies to resources accessed by plugin methods. If no path is set, the connection files.relativeTo configuration is used. The path only applies to routes added after it has been set. + exports.register = function (server, options, next) { + server.path(__dirname + '../static'); + server.route({ path: '/file', method: 'GET', handler: { file: './test.html' } }); + next(); + };*/ + path(relativeTo: string): void; + /**server.register(plugins, [options], callback) + Registers a plugin where: + plugins - an object or array of objects where each one is either: + a plugin registration function. + an object with the following: + register - the plugin registration function. + options - optional options passed to the registration function when called. + options - optional registration options (different from the options passed to the registration function): + select - a string or array of string labels used to pre-select connections for plugin registration. + routes - modifiers applied to each route added by the plugin: + prefix - string added as prefix to any route path (must begin with '/'). If a plugin registers a child plugin the prefix is passed on to the child or is added in front of the child-specific prefix. + vhost - virtual host string (or array of strings) applied to every route. The outer-most vhost overrides the any nested configuration. + callback - the callback function with signature function(err) where: + err - an error returned from the registration function. Note that exceptions thrown by the registration function are not handled by the framework. + server.register({ + register: require('plugin_name'), + options: { + message: 'hello' + } + }, function (err) { + if (err) { + console.log('Failed loading plugin'); + } + });*/ + register(plugins: any|any[], options: { + select: string|string[]; + routes: { + prefix: string; vhost: string|string[] + }; + } + , callback: (err: any) => void):void; + + /**server.render(template, context, [options], callback) + Utilizes the server views manager to render a template where: + template - the template filename and path, relative to the views manager templates path (path or relativeTo). + context - optional object used by the template to render context-specific result. Defaults to no context ({}). + options - optional object used to override the views manager configuration. + callback - the callback function with signature function (err, rendered, config) where: + err - the rendering error if any. + rendered - the result view string. + config - the configuration used to render the template. + var Hapi = require('hapi'); + var server = new Hapi.Server(); + server.connection({ port: 80 }); + server.views({ + engines: { html: require('handlebars') }, + path: __dirname + '/templates' + }); + var context = { + title: 'Views Example', + message: 'Hello, World' + }; + server.render('hello', context, function (err, rendered, config) { + console.log(rendered); + });*/ + render(template: string, context: any, options: any, callback: (err: any, rendered: any, config: any) => void):void; + /** server.route(options) + Adds a connection route where: + options - a route configuration object or an array of configuration objects. + var Hapi = require('hapi'); + var server = new Hapi.Server(); + server.connection({ port: 80 }); + server.route({ method: 'GET', path: '/', handler: function (request, reply) { return reply('ok'); } }); + server.route([ + { method: 'GET', path: '/1', handler: function (request, reply) { return reply('ok'); } }, + { method: 'GET', path: '/2', handler: function (request, reply) { return reply('ok'); } } + ]);*/ + route(options: IRouteConfiguration):void; + route(options: IRouteConfiguration[]):void; + /**server.select(labels) + Selects a subset of the server's connections where: + labels - a single string or array of strings of labels used as a logical OR statement to select all the connections with matching labels in their configuration. + Returns a server object with connections set to the requested subset. Selecting again on a selection operates as a logic AND statement between the individual selections. + var Hapi = require('hapi'); + var server = new Hapi.Server(); + server.connection({ port: 80, labels: ['a', 'b'] }); + server.connection({ port: 8080, labels: ['a', 'c'] }); + server.connection({ port: 8081, labels: ['b', 'c'] }); + var a = server.select('a'); // 80, 8080 + var ac = a.select('c'); // 8080*/ + select(labels: string|string[]): void; + /** server.start([callback]) + Starts the server connections by listening for incoming requests on the configured port of each listener (unless the connection was configured with autoListen set to false), where: + callback - optional callback when server startup is completed or failed with the signature function(err) where: + err - any startup error condition. + var Hapi = require('hapi'); + var server = new Hapi.Server(); + server.connection({ port: 80 }); + server.start(function (err) { + console.log('Server started at: ' + server.info.uri); + });*/ + start(callback?: (err: any) => void): void; + /** server.state(name, [options]) + HTTP state management uses client cookies to persist a state across multiple requests. Registers a cookie definitions + State defaults can be modified via the server connections.routes.state configuration option. + var Hapi = require('hapi'); + var server = new Hapi.Server(); + server.connection({ port: 80 }); + // Set cookie definition + server.state('session', { + ttl: 24 * 60 * 60 * 1000, // One day + isSecure: true, + path: '/', + encoding: 'base64json' + }); + // Set state in route handler + var handler = function (request, reply) { + var session = request.state.session; + if (!session) { + session = { user: 'joe' }; + } + session.last = Date.now(); + return reply('Success').state('session', session); + }; + Registered cookies are automatically parsed when received. Parsing rules depends on the route state.parse configuration. If an incoming registered cookie fails parsing, it is not included in request.state, regardless of the state.failAction setting. When state.failAction is set to 'log' and an invalid cookie value is received, the server will emit a 'request-internal' event. To capture these errors subscribe to the 'request-internal' events and filter on 'error' and 'state' tags: + var Hapi = require('hapi'); + var server = new Hapi.Server(); + server.connection({ port: 80 }); + server.on('request-internal', function (request, event, tags) { + if (tags.error && tags.state) { + console.error(event); + } + }); */ + state(name: string, options?: ICookieSettings): void; + + /** server.stop([options], [callback]) + Stops the server's connections by refusing to accept any new connections or requests (existing connections will continue until closed or timeout), where: + options - optional object with: + timeout - overrides the timeout in millisecond before forcefully terminating a connection. Defaults to 5000 (5 seconds). + callback - optional callback method with signature function() which is called once all the connections have ended and it is safe to exit the process. + var Hapi = require('hapi'); + var server = new Hapi.Server(); + server.connection({ port: 80 }); + server.stop({ timeout: 60 * 1000 }, function () { + console.log('Server stopped'); + });*/ + stop(options?: { timeout: number }, callback?: () => void): void; + /**server.table([host]) + Returns a copy of the routing table where: + host - optional host to filter routes matching a specific virtual host. Defaults to all virtual hosts. + The return value is an array where each item is an object containing: + info - the connection.info the connection the table was generated for. + labels - the connection labels. + table - an array of routes where each route contains: + settings - the route config with defaults applied. + method - the HTTP method in lower case. + path - the route path. + Note that if the server has not been started and multiple connections use port 0, the table items will override each other and will produce an incomplete result. + var Hapi = require('hapi'); + var server = new Hapi.Server(); + server.connection({ port: 80, host: 'example.com' }); + server.route({ method: 'GET', path: '/example', handler: function (request, reply) { return reply(); } }); + var table = server.table(); + When calling connection.table() directly on each connection, the return value is the same as the array table item value of an individual connection: + var Hapi = require('hapi'); + var server = new Hapi.Server(); + server.connection({ port: 80, host: 'example.com' }); + server.route({ method: 'GET', path: '/example', handler: function (request, reply) { return reply(); } }); + var table = server.connections[0].table(); + //[ + // { + // method: 'get', + // path: '/example', + // settings: { ... } + // } + //] + */ + table(host?: any): IConnectionTable; + + /**server.views(options) + Initializes the server views manager + var Hapi = require('hapi'); + var server = new Hapi.Server(); + server.views({ + engines: { + html: require('handlebars'), + jade: require('jade') + }, + path: '/static/templates' + }); + When server.views() is called within a plugin, the views manager is only available to plugins methods.*/ + views(options: IServerViewsConfiguration): void; - export function reply(result: any): any; } - - export function createServer (host: string, port: number, options?: ServerOptions): Server; -} - -declare module "hapi" { - export = Hapi; -} +} \ No newline at end of file diff --git a/hasher/hasher-tests.ts b/hasher/hasher-tests.ts new file mode 100644 index 000000000..5c43af9b0 --- /dev/null +++ b/hasher/hasher-tests.ts @@ -0,0 +1,14 @@ +/// + +//handle hash changes +function handleChanges(newHash: any, oldHash: any) { + console.log(newHash); +} + +hasher.changed.add(handleChanges); //add hash change listener +hasher.initialized.add(handleChanges); //add initialized listener (to grab initial value in case it is already set) +hasher.init(); //initialize hasher (start listening for history changes) + +hasher.setHash('foo'); //change hash value (generates new history record) + +hasher.prependHash = '!'; //default value is "/" diff --git a/hasher/hasher.d.ts b/hasher/hasher.d.ts new file mode 100644 index 000000000..dfed50bd4 --- /dev/null +++ b/hasher/hasher.d.ts @@ -0,0 +1,116 @@ +// Type definitions for Hasher.js +// Project: https://github.com/millermedeiros/hasher/ +// Definitions by: flyfishMT +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module HasherJs { + + export interface HasherStatic { + + // {string} hasher.appendHash + // String that should always be added to the end of Hash value. + appendHash(): string; + + // default value: ''; + // will be automatically removed from `hasher.getHash()` + // avoid conflicts with elements that contain ID equal to hash value; + // {signals.Signal} hasher.changed + // Signal dispatched when hash value changes. - pass current hash as 1st parameter to listeners and previous hash value as 2nd parameter. + changed: Signal; + + // {signals.Signal} hasher.initialized + // Signal dispatched when hasher is initialized. - pass current hash as first parameter to listeners. + initialized: Signal; + + // {string} hasher.prependHash + // String that should always be added to the beginning of Hash value. + prependHash: string; + + // default value: '/'; + // will be automatically removed from `hasher.getHash()` + // avoid conflicts with elements that contain ID equal to hash value; + // {string} hasher.separator + // String used to split hash paths; used by hasher.getHashAsArray() to split paths. + separator: string; + + // default value: '/'; + // {signals.Signal} hasher.stopped + // Signal dispatched when hasher is stopped. - pass current hash as first parameter to listeners + stopped: Signal; + + // {string} hasher.VERSION + // hasher Version Number + VERSION: string; + + // Method Detail + // hasher.dispose() + // Removes all event listeners, stops hasher and destroy hasher object. - IMPORTANT: hasher won't work after calling this method, hasher Object will be deleted. + dispose(): void; + + // {string} hasher.getBaseURL() + // Returns: + // {string} Retrieve URL without query string and hash. + getBaseURL(): string; + + // {string} hasher.getHash() + // Returns: + // {string} Hash value without '#', `hasher.appendHash` and `hasher.prependHash`. + getHash(): string; + + // {Array.} hasher.getHashAsArray() + // Returns: + // {Array.} Hash value split into an Array. + getHashAsArray(): string[]; + + // {string} hasher.getURL() + // Returns: + // {string} Full URL. + getURL(): string; + + // hasher.init() + // Start listening/dispatching changes in the hash/history. + init(): void; + + // hasher won't dispatch CHANGE events by manually typing a new value or pressing the back/forward buttons before calling this method. + // {boolean} hasher.isActive() + // Returns: + // {boolean} If hasher is listening to changes on the browser history and/or hash value. + isActive(): boolean; + + // hasher.replaceHash(path) + // Set Hash value without keeping previous hash on the history record. Similar to calling window.location.replace("#/hash") but will also work on IE6-7. + // hasher.replaceHash('lorem', 'ipsum', 'dolor') -> '#/lorem/ipsum/dolor' + // Parameters: + // {...string} path + // Hash value without '#'. Hasher will join path segments using `hasher.separator` and prepend/append hash value with `hasher.appendHash` and `hasher.prependHash` + replaceHash(...path: string[]): void; + + // hasher.setHash(path) + // Set Hash value, generating a new history record. + // hasher.setHash('lorem', 'ipsum', 'dolor') -> '#/lorem/ipsum/dolor' + // Parameters: + // {...string} path + // Hash value without '#'. Hasher will join path segments using `hasher.separator` and prepend/append hash value with `hasher.appendHash` and `hasher.prependHash` + setHash(...path: string[]): void; + + // hasher.stop() + // Stop listening/dispatching changes in the hash/history. + // hasher won't dispatch CHANGE events by manually typing a new value or pressing the back/forward buttons after calling this method, unless you call hasher.init() again. + // hasher will still dispatch changes made programatically by calling hasher.setHash(); + stop(): void; + + // {string} hasher.toString() + // Returns: + // {string} A string representation of the object. + toString(): string; + } +} + +declare var hasher: HasherJs.HasherStatic; + +// AMD +declare module 'hasher'{ + export = hasher; +} diff --git a/highcharts/highcharts.d.ts b/highcharts/highcharts.d.ts index 98e96e2ef..3b0801651 100644 --- a/highcharts/highcharts.d.ts +++ b/highcharts/highcharts.d.ts @@ -191,7 +191,15 @@ interface HighchartsBoolOrShadow { interface HighchartsChartResetZoomButton { position: HighchartsPosition; relativeTo?: string; - theme?: any; //TO DO + theme?: HighchartsChartResetZoomButtonTheme; //TO DO +} + +interface HighchartsChartResetZoomButtonTheme { + fill?:string; //css HEX colours. + stroke?: string;//css HEX colours. + r?: number; // Radius % + states?: any; // HTML element states eg: hover, with css attributes in object. + display?:string; // css attr eg: 'none' } interface HighchartsChartOptions { diff --git a/http-status/http-status-tests.ts b/http-status/http-status-tests.ts new file mode 100644 index 000000000..8717e99c3 --- /dev/null +++ b/http-status/http-status-tests.ts @@ -0,0 +1,91 @@ +/// + +import httpStatus = require('http-status'); + +var str: string; +var nmr: number; + +str = httpStatus[100]; +str = httpStatus[101]; +str = httpStatus[200]; +str = httpStatus[201]; +str = httpStatus[202]; +str = httpStatus[203]; +str = httpStatus[204]; +str = httpStatus[205]; +str = httpStatus[206]; +str = httpStatus[300]; +str = httpStatus[301]; +str = httpStatus[302]; +str = httpStatus[303]; +str = httpStatus[304]; +str = httpStatus[305]; +str = httpStatus[307]; +str = httpStatus[400]; +str = httpStatus[401]; +str = httpStatus[402]; +str = httpStatus[403]; +str = httpStatus[404]; +str = httpStatus[405]; +str = httpStatus[406]; +str = httpStatus[407]; +str = httpStatus[408]; +str = httpStatus[409]; +str = httpStatus[410]; +str = httpStatus[411]; +str = httpStatus[412]; +str = httpStatus[413]; +str = httpStatus[414]; +str = httpStatus[415]; +str = httpStatus[416]; +str = httpStatus[417]; +str = httpStatus[429]; +str = httpStatus[500]; +str = httpStatus[501]; +str = httpStatus[502]; +str = httpStatus[503]; +str = httpStatus[504]; +str = httpStatus[505]; + + +nmr = httpStatus.CONTINUE; +nmr = httpStatus.SWITCHING_PROTOCOLS; +nmr = httpStatus.OK; +nmr = httpStatus.CREATED; +nmr = httpStatus.ACCEPTED; +nmr = httpStatus.NON_AUTHORITATIVE_INFORMATION; +nmr = httpStatus.NO_CONTENT; +nmr = httpStatus.RESET_CONTENT; +nmr = httpStatus.PARTIAL_CONTENT; +nmr = httpStatus.MULTIPLE_CHOICES; +nmr = httpStatus.MOVED_PERMANENTLY; +nmr = httpStatus.FOUND; +nmr = httpStatus.SEE_OTHER; +nmr = httpStatus.NOT_MODIFIED; +nmr = httpStatus.USE_PROXY; +nmr = httpStatus.TEMPORARY_REDIRECT; +nmr = httpStatus.BAD_REQUEST; +nmr = httpStatus.UNAUTHORIZED; +nmr = httpStatus.PAYMENT_REQUIRED; +nmr = httpStatus.FORBIDDEN; +nmr = httpStatus.NOT_FOUND; +nmr = httpStatus.METHOD_NOT_ALLOWED; +nmr = httpStatus.NOT_ACCEPTABLE; +nmr = httpStatus.PROXY_AUTHENTICATION_REQUIRED; +nmr = httpStatus.REQUEST_TIMEOUT; +nmr = httpStatus.CONFLICT; +nmr = httpStatus.GONE; +nmr = httpStatus.LENGTH_REQUIRED; +nmr = httpStatus.PRECONDITION_FAILED; +nmr = httpStatus.REQUEST_ENTITY_TOO_LARGE; +nmr = httpStatus.REQUEST_URI_TOO_LONG; +nmr = httpStatus.UNSUPPORTED_MEDIA_TYPE; +nmr = httpStatus.REQUESTED_RANGE_NOT_SATISFIABLE; +nmr = httpStatus.EXPECTATION_FAILED; +nmr = httpStatus.TOO_MANY_REQUESTS; +nmr = httpStatus.INTERNAL_SERVER_ERROR; +nmr = httpStatus.NOT_IMPLEMENTED; +nmr = httpStatus.BAD_GATEWAY; +nmr = httpStatus.SERVICE_UNAVAILABLE; +nmr = httpStatus.GATEWAY_TIMEOUT; +nmr = httpStatus.HTTP_VERSION_NOT_SUPPORTED; diff --git a/http-status/http-status.d.ts b/http-status/http-status.d.ts new file mode 100644 index 000000000..39328b71a --- /dev/null +++ b/http-status/http-status.d.ts @@ -0,0 +1,95 @@ +// Type definitions for http-status v0.1.8 +// Project: https://github.com/wdavidw/node-http-status +// Definitions by: Michael Zabka +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +interface HttpStatus { + 100: string; + 101: string; + 200: string; + 201: string; + 202: string; + 203: string; + 204: string; + 205: string; + 206: string; + 300: string; + 301: string; + 302: string; + 303: string; + 304: string; + 305: string; + 307: string; + 400: string; + 401: string; + 402: string; + 403: string; + 404: string; + 405: string; + 406: string; + 407: string; + 408: string; + 409: string; + 410: string; + 411: string; + 412: string; + 413: string; + 414: string; + 415: string; + 416: string; + 417: string; + 429: string; + 500: string; + 501: string; + 502: string; + 503: string; + 504: string; + 505: string; + CONTINUE: number; + SWITCHING_PROTOCOLS: number; + OK: number; + CREATED: number; + ACCEPTED: number; + NON_AUTHORITATIVE_INFORMATION: number; + NO_CONTENT: number; + RESET_CONTENT: number; + PARTIAL_CONTENT: number; + MULTIPLE_CHOICES: number; + MOVED_PERMANENTLY: number; + FOUND: number; + SEE_OTHER: number; + NOT_MODIFIED: number; + USE_PROXY: number; + TEMPORARY_REDIRECT: number; + BAD_REQUEST: number; + UNAUTHORIZED: number; + PAYMENT_REQUIRED: number; + FORBIDDEN: number; + NOT_FOUND: number; + METHOD_NOT_ALLOWED: number; + NOT_ACCEPTABLE: number; + PROXY_AUTHENTICATION_REQUIRED: number; + REQUEST_TIMEOUT: number; + CONFLICT: number; + GONE: number; + LENGTH_REQUIRED: number; + PRECONDITION_FAILED: number; + REQUEST_ENTITY_TOO_LARGE: number; + REQUEST_URI_TOO_LONG: number; + UNSUPPORTED_MEDIA_TYPE: number; + REQUESTED_RANGE_NOT_SATISFIABLE: number; + EXPECTATION_FAILED: number; + TOO_MANY_REQUESTS: number; + INTERNAL_SERVER_ERROR: number; + NOT_IMPLEMENTED: number; + BAD_GATEWAY: number; + SERVICE_UNAVAILABLE: number; + GATEWAY_TIMEOUT: number; + HTTP_VERSION_NOT_SUPPORTED: number +} + +declare var httpStatus: HttpStatus; + +declare module 'http-status' { + export = httpStatus; +} diff --git a/ini/ini-tests.ts b/ini/ini-tests.ts new file mode 100644 index 000000000..44241625f --- /dev/null +++ b/ini/ini-tests.ts @@ -0,0 +1,10 @@ +/// +/// + +import fs = require("fs"); +import ini = require("ini"); + +var ini_content = fs.readFileSync("path_to_file.ini", "utf-8"); + +var ini_object: any = ini.decode(ini_content); +var ini_rev_string: string = ini.encode(ini_object); \ No newline at end of file diff --git a/ini/ini.d.ts b/ini/ini.d.ts new file mode 100644 index 000000000..6cab73533 --- /dev/null +++ b/ini/ini.d.ts @@ -0,0 +1,25 @@ +// Type definitions for ini v1.3.3 +// Project: https://github.com/isaacs/ini +// Definitions by: Marcin Porębski +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module "ini" +{ + interface EncodeOptions { + section: string + whitespace: boolean + } + + function decode(inistring: string): any; + + function parse(initstring: string): any; + + function encode(object: any, options?: EncodeOptions): string; + + function stringify(object: any, options?: EncodeOptions): string; + + function safe(val: string): string; + + function unsafe(val: string): string; + +} diff --git a/intercomjs/intercom-tests.ts b/intercomjs/intercom-tests.ts index be25ba7db..89729ca28 100644 --- a/intercomjs/intercom-tests.ts +++ b/intercomjs/intercom-tests.ts @@ -17,4 +17,6 @@ function test_intercom_static() { console.log(onceListenerInvokedTimes === 1); instance.emit("eventWithoutAMessage"); + + instance.off("test", detect); } diff --git a/intercomjs/intercom.d.ts b/intercomjs/intercom.d.ts index c149c827d..888f587a5 100644 --- a/intercomjs/intercom.d.ts +++ b/intercomjs/intercom.d.ts @@ -17,6 +17,12 @@ declare module intercom { * @param fn The listener method to invoke. */ on(name: string, fn: Function): void; + /** + * Remove a registered event listener + * @param name The string event listener name. + * @param fn The listener method to remove. + */ + off(name: string, fn: Function): void; /** * Given a unique key to represent the function, fn will be invoked in only one window. The ttl argument represents the number of seconds before the function can be called again. * @param key The unique function identifier key diff --git a/jasmine/jasmine-tests.ts b/jasmine/jasmine-tests.ts index cbac45d16..ef0572303 100644 --- a/jasmine/jasmine-tests.ts +++ b/jasmine/jasmine-tests.ts @@ -712,6 +712,23 @@ describe("Asynchronous specs", function () { expect(value).toBeGreaterThan(0); done(); }); + + describe("long asynchronous specs", function() { + beforeEach(function(done) { + done(); + }, 1000); + + it("takes a long time", function(done) { + setTimeout(function() { + done(); + }, 9000); + }, 10000); + + afterEach(function(done) { + done(); + }, 1000); + }); + }); describe("Fail", function () { diff --git a/jasmine/jasmine.d.ts b/jasmine/jasmine.d.ts index 17658120d..3727f8839 100644 --- a/jasmine/jasmine.d.ts +++ b/jasmine/jasmine.d.ts @@ -10,25 +10,25 @@ declare function describe(description: string, specDefinitions: () => void): voi declare function fdescribe(description: string, specDefinitions: () => void): void; declare function xdescribe(description: string, specDefinitions: () => void): void; -declare function it(expectation: string, assertion?: () => void): void; -declare function it(expectation: string, assertion?: (done: () => void) => void): void; -declare function fit(expectation: string, assertion?: () => void): void; -declare function fit(expectation: string, assertion?: (done: () => void) => void): void; -declare function xit(expectation: string, assertion?: () => void): void; -declare function xit(expectation: string, assertion?: (done: () => void) => void): void; +declare function it(expectation: string, assertion?: () => void, timeout?: number): void; +declare function it(expectation: string, assertion?: (done: () => void) => void, timeout?: number): void; +declare function fit(expectation: string, assertion?: () => void, timeout?: number): void; +declare function fit(expectation: string, assertion?: (done: () => void) => void, timeout?: number): void; +declare function xit(expectation: string, assertion?: () => void, timeout?: number): void; +declare function xit(expectation: string, assertion?: (done: () => void) => void, timeout?: number): void; /** If you call the function pending anywhere in the spec body, no matter the expectations, the spec will be marked pending. */ declare function pending(): void; -declare function beforeEach(action: () => void): void; -declare function beforeEach(action: (done: () => void) => void): void; -declare function afterEach(action: () => void): void; -declare function afterEach(action: (done: () => void) => void): void; +declare function beforeEach(action: () => void, timeout?: number): void; +declare function beforeEach(action: (done: () => void) => void, timeout?: number): void; +declare function afterEach(action: () => void, timeout?: number): void; +declare function afterEach(action: (done: () => void) => void, timeout?: number): void; -declare function beforeAll(action: () => void): void; -declare function beforeAll(action: (done: () => void) => void): void; -declare function afterAll(action: () => void): void; -declare function afterAll(action: (done: () => void) => void): void; +declare function beforeAll(action: () => void, timeout?: number): void; +declare function beforeAll(action: (done: () => void) => void, timeout?: number): void; +declare function afterAll(action: () => void, timeout?: number): void; +declare function afterAll(action: (done: () => void) => void, timeout?: number): void; declare function expect(spy: Function): jasmine.Matchers; declare function expect(actual: any): jasmine.Matchers; @@ -369,7 +369,6 @@ declare module jasmine { mostRecentCall: { args: any[]; }; argsForCall: any[]; wasCalled: boolean; - callCount: number; } interface SpyAnd { diff --git a/java-applet/java-applet-tests.ts.tscparams b/java-applet/java-applet-tests.ts.tscparams deleted file mode 100644 index 934bc29ef..000000000 --- a/java-applet/java-applet-tests.ts.tscparams +++ /dev/null @@ -1 +0,0 @@ ---noImplicitAny \ No newline at end of file diff --git a/jbinary/jbinary-tests.ts b/jbinary/jbinary-tests.ts index c1e286fce..f5f2abcbb 100644 --- a/jbinary/jbinary-tests.ts +++ b/jbinary/jbinary-tests.ts @@ -1,5 +1,8 @@ /// +jBinary.loadData([0x05, 0x03, 0x7F, 0x1E]); +jBinary.load([0x05, 0x03, 0x7F, 0x1E]); + var originalData = [0x05, 0x03, 0x7F, 0x1E]; var b1 = new jBinary(originalData); console.log(b1.readAll()); @@ -14,3 +17,6 @@ b1.write('int8', 0x9A, 2); b1.writeAll(originalData); console.log(b1.slice(0, 2)); + +jBinary.saveAs('myfile.pdf', 'application/pdf'); +jBinary.toURI(); diff --git a/jbinary/jbinary.d.ts b/jbinary/jbinary.d.ts index f9a2f2aaa..062a6bbb8 100644 --- a/jbinary/jbinary.d.ts +++ b/jbinary/jbinary.d.ts @@ -13,6 +13,12 @@ declare class jBinary { + static loadData(source:any, callback?: (error:string, data:any) => any):any; + static load(source:any, typeSet?:any, callback?: (error:string, data:any) => any):any; + + static saveAs(destination:any, mimeType?:string, callback?: (error:string, data:any) => any):any; + static toURI(mimeType?:string):any; + constructor(data:Array); constructor(data:jDataView, typeSet:Object); constructor(bufferSize:number, typeSet:Object); diff --git a/johnny-five/johnny-five-tests.ts b/johnny-five/johnny-five-tests.ts new file mode 100644 index 000000000..930a67ea8 --- /dev/null +++ b/johnny-five/johnny-five-tests.ts @@ -0,0 +1,255 @@ +/// + +import five = require('johnny-five'); +var board = new five.Board(); + +board.on('connect', function(){ +}); + +board.on('ready', function(){ + var accelerometer = new five.Accelerometer({ + controller: "MPU6050", + sensitivity: 16384 // optional + }); + + var servo = new five.Servo(9); + var animation = new five.Animation(servo); + + // Create an animation segment object + animation.enqueue({ + duration: 2000, + cuePoints: [0, 0.25, 0.5, 0.75, 1.0], + keyFrames: [ {degrees: 0}, {degrees: 135}, {degrees: 45}, {degrees: 180}, {degrees: 0}] + }); + + // Create a new `button` hardware instance. + var button = new five.Button(8); + + button.on("hold", function() { + console.log( "Button held" ); + }); + + button.on("press", function() { + console.log( "Button pressed" ); + }); + + button.on("release", function() { + console.log( "Button released" ); + }); + + + var compass = new five.Compass({ + controller: "HMC6352" + }); + + compass.on("headingchange", function() { + console.log("headingchange"); + console.log(" heading : ", Math.floor(this.heading)); + console.log(" bearing : ", this.bearing.name); + console.log("--------------------------------------"); + }); + + compass.on("data", function() { + console.log(" heading : ", Math.floor(this.heading)); + console.log(" bearing : ", this.bearing.name); + console.log("--------------------------------------"); + }); + + var esc = new five.ESC(11); + + // Set to top speed. (this can be physically dangerous, you've been warned.) + esc.max(); + + + var gyro = new five.Gyro({ + pins: ["A0", "A1"], + sensitivity: 0.67, // optional + resolution: 4.88 // optional + }); + + var accel = new five.IMU({ + controller: "MPU6050", + address: 0x68, // optional + freq: 100 // optional + }); + + var motion = new five.IR.Motion(7); + +// Options object with pin property + var motion = new five.IR.Motion({ + pin: 7 + }); + + var proximity = new five.IR.Proximity({ + controller: "GP2Y0A21YK", + pin: "A0" + }); + + var eyes = new five.IR.Reflect.Array({ + emitter: 13, + pins: ["A0", "A1", "A2"], // any number of pins + freq: 25 + }); + + eyes.on('data', function() { + console.log( "Raw Values: ", this.raw ); + }); + + eyes.on('line', function() { + console.log( "Line Position: ", this.line); + }); + + eyes.enable(); + + var joystick = new five.Joystick({ + pins: ["A0", "A1"] + }); + joystick.on("data", (value)=>{ + console.log(value); + }); + + joystick.on("axismove", (err, value)=>{ + console.log("change"); + + console.log(joystick.axis); + console.log(joystick.raw); + console.log(err); + console.log(value); + }); + + var lcd = new five.LCD({ + pins: [8, 9, 4, 5, 6, 7], + backlight: 13, + rows: 2, + cols: 16 + }); + + var led = new five.Led(13); + led.blink(); + + var digits = new five.Led.Digits({ + pins: { + data: 2, + clock: 3, + cs: 4 + } + }); + + var matrix = new five.Led.Matrix({ + controller: "HT16K33", + dims: "8x16", // or "16x8" + rotation: 2 + }); + + // With Options object & pins array + var rgb = new five.Led.RGB({ + pins: [9, 10, 11] + }); + + var motor = new five.Motor({ + pins: { + pwm:9, + dir:8, + brake: 11 + } + }); + + var piezo = new five.Piezo(3); + + // Plays a song + piezo.play({ + // song is composed by an array of pairs of notes and beats + // The first argument is the note (null means "no note") + // The second argument is the length of time (beat) of the note (or non-note) + song: [ + ["C4", 1 / 4], + ["D4", 1 / 4], + ["F4", 1 / 4], + ["D4", 1 / 4], + ["A4", 1 / 4], + [null, 1 / 4], + ["A4", 1], + ["G4", 1], + [null, 1 / 2], + ["C4", 1 / 4], + ["D4", 1 / 4], + ["F4", 1 / 4], + ["D4", 1 / 4], + ["G4", 1 / 4], + [null, 1 / 4], + ["G4", 1], + ["F4", 1], + [null, 1 / 2] + ], + tempo: 100 + }); + + var digital = new five.Pin({ + pin: 13 + }); + + var analog = new five.Pin({ + pin: "A0" + }); + + var analogAsDigital = new five.Pin({ + pin: 14, + type: "digital" + }); + + var ping = new five.Ping(7); + + var ping = new five.Ping({ + pin: 7 + }); + + var relay = new five.Relay(10); + +// Options object with pin property + var relay = new five.Relay({ + pin: 10 + }); + + var sensor = new five.Sensor("A0"); + + sensor.scale([ 0, 10 ]).on("data", function() { + console.log( this.value ); + }); + + var servo = new five.Servo({ + pin: 10, + range: [45, 135] + }); + + var register = new five.ShiftRegister({ + pins: { + data: 2, + clock: 3, + latch: 4 + } + }); + + var sonar = new five.Sonar("A0"); + + sonar.on("data", function() { + console.log("inches : " + this.in); + console.log("centimeters: " + this.cm); + console.log("-----------------------"); + }); + + var stepper = new five.Stepper({ + type: five.Stepper.TYPE.DRIVER, + stepsPerRev: 200, + pins: { + step: 11, + dir: 12 + } + }); + + var temperature = new five.Temperature({ + pin: "A0", + toCelsius: function(raw) { // optional + return (raw / 100) + 10; + } + }); +}); diff --git a/johnny-five/johnny-five.d.ts b/johnny-five/johnny-five.d.ts new file mode 100644 index 000000000..9dd1477eb --- /dev/null +++ b/johnny-five/johnny-five.d.ts @@ -0,0 +1,588 @@ +// Type definitions for johnny-five +// Project: https://github.com/rwaldron/johnny-five +// Definitions by: Toshiya Nakakura +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module "johnny-five" { + export interface AccelerometerOption{ + controller: string; + } + + export interface AccelerometerGeneralOption{ + controller?: string; + } + + export interface AccelerometerAnalogOption extends AccelerometerGeneralOption{ + pins: Array; + sensitivity?: number; + aref?: number; + zeroV?: number | Array; + autoCalibrate?: boolean; + } + + export interface AccelerometerMPU6050Option extends AccelerometerGeneralOption{ + sensitivity?: number; + } + + export interface AccelerometerMMA7361Option extends AccelerometerGeneralOption{ + sleepPin?: number | string; + } + + export class Accelerometer{ + constructor(option: AccelerometerGeneralOption | AccelerometerAnalogOption | AccelerometerMPU6050Option | AccelerometerMMA7361Option); + on(event: string, cb: ()=>void): void; + on(event: "change", cb: ()=>void): void; + on(event: "data", cb: (freq: any)=>void): void; + hasAxis(name: string): void; + enable(): void; + disable(): void; + } + + export class Animation{ + constructor(option: Servo | Array); + enqueue(segment: any): void; + play(): void; + pause(): void; + stop(): void; + next(): void; + speed(speed: Array): void; + + target: number; + duration: number; + cuePoints: Array; + keyFrames: number; + easing: string; + loop: boolean; + loopback: number; + metronomic: boolean; + progress: number; + currentSpeed: number; + fps: number; + } + + export interface ButtonOptions{ + pin: number | string; + invert?: boolean; + isPullup?: boolean; + holdtime?: number; + } + + export class Button{ + constructor(pin: number | string | ButtonOptions); + on(event: string, cb: ()=>void): void; + on(event: "hold", cb: (holdTime: number)=>void): void; + on(event: "down", cb: ()=>void): void; + on(event: "press", cb: ()=>void): void; + on(event: "up", cb: ()=>void): void; + on(event: "release", cb: ()=>void): void; + } + + export interface BoardOptions{ + id?: number | string; + port?: string | any; + repl?: boolean; + } + + export interface Repl{ + inject(object: any): void; + } + + export class Board{ + constructor(option?: BoardOptions); + on(event: string, cb: ()=>void): void; + on(event: "ready", cb: ()=>void): void; + on(event: "connect", cb: ()=>void): void; + pinMode(pin: number, mode: number): void; + analogWrite(pin: number, value: number): void; + analogRead(pin: number, cb: (item: number)=>void): void; + digitalWrite(pin: number, value: number): void; + digitalRead(pin: number, cb: (item: number)=>void): void; + shiftOut(dataPin: Pin, clockPin: Pin, isBigEndian: boolean, value: number): void; + wait(ms: number, cb: ()=>void): void; + loop(ms: number, cb: ()=>void): void; + + isReady: boolean; + io: any; + id: string; + pins: Array; + port: string; + inject: Repl; + } + + export interface CompassOptions{ + controller: string; + gauss?: number; + } + + export class Compass{ + constructor(option: CompassOptions); + on(event: string, cb: ()=>void): void; + on(event: "change", cb: ()=>void): void; + on(event: "data", cb: (data: any)=>void): void; + } + + export interface ESCOption{ + pin: number | string; + range?: Array; + startAt?: number; + } + + export class ESC{ + constructor(option: number | string | ESCOption); + speed(value: number): void; + min(): void; + max(): void; + stop(): void; + } + + export interface GyroGeneralOption{ + controller?: string; + } + + export interface GyroAnalogOption extends GyroGeneralOption{ + pins: Array; + sensitivity: number; + resolution?: number; + } + + export interface GyroMPU6050Option extends GyroGeneralOption{ + sensitivity: number; + } + + export class Gyro{ + constructor(option: GyroGeneralOption | GyroAnalogOption | GyroMPU6050Option); + on(event: string, cb: ()=>void): void; + on(event: "change", cb: ()=>void): void; + on(event: "data", cb: (data: any)=>void): void; + recalibrate(): void; + } + + export interface IMUGeneralOption{ + controller?: string; + freq?: number; + } + + export interface IMUMPU6050Option extends IMUGeneralOption{ + address: number; + } + + export class IMU{ + constructor(option: IMUGeneralOption | IMUMPU6050Option); + on(event: string, cb: ()=>void): void; + on(event: "change", cb: ()=>void): void; + on(event: "data", cb: (data: any)=>void): void; + } + + export module IR{ + export interface MotionOption{ + pin: number | string; + } + + export class Motion{ + constructor(option: number | MotionOption); + on(event: string, cb: ()=>void): void; + on(event: "data", cb: (data: any)=>void): void; + on(event: "motionstart", cb: ()=>void): void; + on(event: "motionend", cb: ()=>void): void; + on(event: "calibrated", cb: ()=>void): void; + } + + export interface PloximityOption{ + pin: number | string; + controller: string; + } + + export class Proximity{ + constructor(option: number | PloximityOption); + on(event: string, cb: ()=>void): void; + on(event: "data", cb: (data: any)=>void): void; + on(event: "change", cb: ()=>void): void; + } + + export interface ArrayOption{ + pins: Array | Array; + emitter: number | string; + freq?: number; + } + + export interface LoadCalibrationOption{ + min: Array; + max: Array; + } + + export module Reflect{ + export class Array{ + constructor(option: ArrayOption); + enable(): void; + disable(): void; + calibrate(): void; + calibrateUntil(predicate: ()=>void): void; + loadCalibration(option: LoadCalibrationOption): void; + on(event: string, cb: ()=>void): void; + on(event: "data", cb: (data: any)=>void): void; + on(event: "calibratedData", cb: (data: any)=>void): void; + on(event: "line", cb: (data: any)=>void): void; + } + } + } + + export interface JoystickOption{ + pins: Array; + } + + export class Joystick{ + constructor(option: JoystickOption); + on(event: string, cb: ()=>void): void; + on(event: "data", cb: (data: any)=>void): void; + on(event: "change", cb: ()=>void): void; + on(event: "axismove", cb: (error: Error, date: Date)=>void): void; + + axis: Array; + raw: Array; + } + + + export interface LCDGeneralOption{ + rows?: number; + cols?: number; + } + + export interface LCDI2COption extends LCDGeneralOption{ + controller: string; + } + + export interface LCDParallelOption extends LCDGeneralOption{ + pins: Array; + } + + export class LCD{ + constructor(option: LCDGeneralOption | LCDI2COption | LCDParallelOption); + print(message: string): void; + useChar(char: string): void; + clear(): void; + cursor(row: number, col: number): void; + home(): void; + display(): void; + noDisplay(): void; + blink(): void; + noBlink(): void; + autoscroll(): void; + noAutoscroll(): void; + } + + export interface LedOption{ + pin: number; + type?: string; + controller?: string; + address?: number; + isAnode?: boolean; + } + + export class Led{ + constructor(option: number | LedOption); + on(): void; + off(): void; + toggle(): void; + strobe(ms: number): void; + blink(): void; + blink(ms: number): void; + brightness(val: number): void; + fade(brightness: number, ms: number): void; + fadeIn(ms: number): void; + fadeOut(ms: number): void; + pulse(ms: number): void; + stop(ms: number): void; + } + + export module Led{ + export interface DigitsOption{ + pins: any; + devices?: number; + } + + export class Digits{ + constructor(option: DigitsOption); + on(): void; + on(index: number): void; + off(): void; + off(index: number): void; + clear(): void; + clear(index: number): void; + brightness(value: number): void; + brightness(index: number, value: number): void; + draw(position: number, character: number): void; + draw(index: number, position: number, character: number): void; + } + + export interface MatrixOption{ + pins: any; + devices?: number; + } + + export interface MatrixIC2Option{ + controller: string; + addresses?: Array; + isBicolor?: boolean; + dims? :any; + rotation?: number; + } + + export class Matrix{ + constructor(option: MatrixOption | MatrixIC2Option); + on(): void; + on(index: number): void; + off(): void; + off(index: number): void; + clear(): void; + clear(index: number): void; + brightness(value: number): void; + brightness(index: number, value: number): void; + led(row: number, col: number, state: any): void; + led(index: number, row: number, col: number, state: any): void; + row(row: number, val: number): void; + row(index: number, row: number, val: number): void; + column(row: number, val: number): void; + column(index: number, row: number, val: number): void; + draw(position: number, character: number): void; + draw(index: number, position: number, character: number): void; + } + + export interface RGBOption{ + pins: Array; + isAnode?: boolean; + controller?: string; + } + + export class RGB{ + constructor(option: RGBOption); + on(): void; + off(): void; + color(value: number): void; + toggle(): void; + strobe(ms: number): void; + brightness(value: number): void; + fadeIn(ms: number): void; + fadeOut(ms: number): void; + pulse(ms: number): void; + stop(ms: number): void; + } + } + + export interface MotorOption{ + pins: any; + current?: any; + invertPWM?: boolean; + address?: number; + controller?: string; + register?: any; + bits?: any; + } + + export class Motor{ + constructor(option: Array | MotorOption); + forward(speed: number): void; + fwd(speed: number): void; + reverse(speed: number): void; + rev(speed: number): void; + start(): void; + start(speed: number): void; + stop(): void; + brake(): void; + release(): void; + } + + export interface PiezoOption{ + pin: number; + } + + export class Piezo{ + constructor(option: number | PiezoOption); + frequency(frequency: number, duration: number): void; + play(tune: any, cb?: ()=>void): void; + tone(frequency: number, duration: number): void; + noTone(): void; + off(): void; + } + + export interface PinOption{ + id?: number | string; + pin: number | string; + type?: string; + } + + export interface PinState{ + supportedModes: Array; + mode: number; + value: number; + report: number; + analogChannel: number; + } + + export class Pin{ + constructor(option: number | string | PinOption); + query(cb: (pin: PinState)=>void): void; + high(): void; + low(): void; + write(value: number): void; + read(cb: (value: number)=>void): void; + static write(pin: number, value: number): void; + static read(pin: number, cb: (data: number)=>void): void; + } + + export interface PingOption{ + pin: number | string; + freq?: number; + pulse?: number; + } + + export class Ping{ + constructor(option: number | PingOption); + } + + export interface RelayOption{ + pin: number | string; + type?: string; + } + + export class Relay{ + constructor(option: number | RelayOption); + open(): void; + close(): void; + toggle(): void; + } + + export interface SensorOption{ + pin: number | string; + freq?: boolean; + threshold?: number; + } + + export class Sensor{ + constructor(option: number | string | SensorOption); + scale(low: number, high: number): Sensor; + scale(range: number[]): Sensor; + scale(): Sensor; + booleanAt(barrier: number): boolean; + within(range: Array, cb: ()=>void): void; + on(event: string, cb: ()=>void): void; + on(event: "data", cb: (data: any)=>void): void; + on(event: "change", cb: ()=>void): void; + } + + export interface ServoGeneralOption{ + pin: number | string; + range?: Array; + type?: string; + startAt?: number; + isInverted?: boolean; + center?: boolean; + controller?: string; + } + + export interface ServoPCA9685Option extends ServoGeneralOption{ + address?: number; + } + + export interface ServoSweepOpts{ + range: Array; + interval?: number; + step?: number; + } + + export class Servo{ + constructor(option: number | string | ServoGeneralOption); + to(degrees: number, ms?: number, rage?: number): void; + min(): void; + max(): void; + center(): void; + sweep(): void; + sweep(range: Array): void; + sweep(opt: ServoSweepOpts): void; + stop(): void; + cw(speed: number): void; + ccw(speed: number): void; + on(event: string, cb: ()=>void): void; + on(event: "move:complete", cb: ()=>void): void; + } + + export interface ShiftRegisterOption{ + pins: any; + } + + export class ShiftRegister{ + constructor(option: ShiftRegisterOption); + send(...value: number[]): void; + } + + export interface SonarOption{ + pin: number | string; + device: string; + freq?: number; + threshold?: number; + } + + export class Sonar{ + constructor(option: number | string | SonarOption); + within(range: Array, cb: ()=>void): void; + within(range: Array, unit: string, cb: ()=>void): void; + on(event: string, cb: ()=>void): void; + on(event: "data", cb: (data: any)=>void): void; + on(event: "change", cb: ()=>void): void; + } + + export interface StepperOption{ + pins: any; + stepsPerRev: number; + type: number; + rpm?: number; + direction?: number; + } + + export module Stepper{ + export class TYPE{ + static DRIVER: number; + static TWO_WIRE: number; + static FOUR_WIRE: number; + } + } + + export class Stepper{ + constructor(option: number | string | StepperOption); + step(stepsOrOpts: any, cb: ()=>void): void; + rpm(): Stepper; + rpm(value: number): Stepper; + speed(): Stepper; + speed(value: number): Stepper; + direction(): Stepper; + direction(value: number): Stepper; + accel(): Stepper; + accel(value: number): Stepper; + decel(): Stepper; + decel(value: number): Stepper; + cw(): Stepper; + ccw(): Stepper; + + within(range: Array, cb: ()=>void): void; + within(range: Array, unit: string, cb: ()=>void): void; + on(event: string, cb: ()=>void): void; + on(event: "data", cb: (data: any)=>void): void; + on(event: "change", cb: ()=>void): void; + } + + export interface TemperatureOption{ + controller?: string; + pin: string | number; + toCelsius?: (val: number)=>number; + freq?: number; + } + + export class Temperature{ + constructor(option: TemperatureOption); + on(event: string, cb: ()=>void): void; + on(event: "data", cb: (data: any)=>void): void; + on(event: "change", cb: ()=>void): void; + } +} + diff --git a/jointjs/jointjs.d.ts b/jointjs/jointjs.d.ts index 19e239445..eb03edbc7 100644 --- a/jointjs/jointjs.d.ts +++ b/jointjs/jointjs.d.ts @@ -78,6 +78,7 @@ declare module joint { findViewByModel(modelOrId:any):CellView; findViewsFromPoint(p:{ x: number; y: number; }):CellView[]; findViewsInArea(r:{ x: number; y: number; width: number; height: number; }):CellView[]; + fitToContent(opt?:any): void; } class ElementView extends CellView { diff --git a/jointjs/jointjs.d.ts.tscparams b/jointjs/jointjs.d.ts.tscparams deleted file mode 100644 index d3f5a12fa..000000000 --- a/jointjs/jointjs.d.ts.tscparams +++ /dev/null @@ -1 +0,0 @@ - diff --git a/jqgrid/jqgrid.d.ts.tscparams b/jqgrid/jqgrid.d.ts.tscparams deleted file mode 100644 index ce89a9e7d..000000000 --- a/jqgrid/jqgrid.d.ts.tscparams +++ /dev/null @@ -1 +0,0 @@ ---noImplicitAny --module commonjs --target es5 \ No newline at end of file diff --git a/jquery.contextMenu/jquery.contextMenu-tests.ts b/jquery.contextMenu/jquery.contextMenu-tests.ts new file mode 100644 index 000000000..df1b47943 --- /dev/null +++ b/jquery.contextMenu/jquery.contextMenu-tests.ts @@ -0,0 +1,19 @@ +/// + +//http://medialize.github.io/jQuery-contextMenu/docs.html + +//Disable a contextMenu trigger +$(".some-selector").contextMenu(false); + +//Manually show a contextMenu +$(".some-selector").contextMenu(); +$(".some-selector").contextMenu({x: 123, y: 123}); + +//Manually hide a contextMenu +$(".some-selector").contextMenu("hide"); + +//Unregister contextMenu +$.contextMenu('destroy', ".some-selector"); + +//Unregister all contextMenus +$.contextMenu('destroy'); diff --git a/jquery.contextMenu/jquery.contextMenu.d.ts b/jquery.contextMenu/jquery.contextMenu.d.ts index 620564fcd..34fd543e2 100644 --- a/jquery.contextMenu/jquery.contextMenu.d.ts +++ b/jquery.contextMenu/jquery.contextMenu.d.ts @@ -1,4 +1,4 @@ -// Type definitions for jQuery contextMenu 1.6.6 +// Type definitions for jQuery contextMenu 1.7.0 // Project: http://medialize.github.com/jQuery-contextMenu/ // Definitions by: Natan Vivo // Definitions: https://github.com/borisyankov/DefinitelyTyped @@ -11,9 +11,9 @@ interface JQueryContextMenuOptions { trigger?: string; autoHide?: boolean; delay?: number; - determinePosition?: (menu) => void; - position?: (opt, x, y) => void; - positionSubmenu?: (menu) => void; + determinePosition?: (menu: JQuery) => void; + position?: (opt: JQuery, x: number, y: number) => void; + positionSubmenu?: (menu: JQuery) => void; zIndex?: number; animation?: { duration?: number; @@ -26,9 +26,15 @@ interface JQueryContextMenuOptions { }; callback?: (key: any, options: any) => any; items: any; + reposition?: boolean; + className?: string; } interface JQueryStatic { contextMenu(options?: JQueryContextMenuOptions): JQuery; - contextMenu(type: string): JQuery; + contextMenu(type: string, selector?: any): JQuery; +} + +interface JQuery { + contextMenu(options?: any): JQuery; } diff --git a/jquery.contextMenu/jquery.contextMenu.d.ts.tscparams b/jquery.contextMenu/jquery.contextMenu.d.ts.tscparams index d3f5a12fa..2f5856b19 100644 --- a/jquery.contextMenu/jquery.contextMenu.d.ts.tscparams +++ b/jquery.contextMenu/jquery.contextMenu.d.ts.tscparams @@ -1 +1 @@ - +--noImplicitAny diff --git a/jquery.fancytree/jquery.fancytree.d.ts b/jquery.fancytree/jquery.fancytree.d.ts index feb5135b8..34a9f1422 100644 --- a/jquery.fancytree/jquery.fancytree.d.ts +++ b/jquery.fancytree/jquery.fancytree.d.ts @@ -20,6 +20,10 @@ interface JQuery { declare module Fancytree { interface Fancytree { + $div: JQuery; + + rootNode: FancytreeNode; + /** Activate node with a given key and fire focus and * activate events. A prevously activated node will be * deactivated. If activeVisible option is set, all parents diff --git a/jquery.gridster/gridster-tests.ts b/jquery.gridster/gridster-tests.ts index 1521b205d..72c90a6f0 100644 --- a/jquery.gridster/gridster-tests.ts +++ b/jquery.gridster/gridster-tests.ts @@ -1,7 +1,5 @@ /// -var el: HTMLElement = new HTMLElement(); - interface SerializeData { x?: number; y?: number; @@ -18,7 +16,7 @@ var options: GridsterOptions = { } }; -var gridster = $('.gridster ul').gridster(el, options).data('grister'); +var gridster = $('.gridster ul').gridster(options).data('grister'); gridster.add_widget('
  • The HTML of the widget...
  • ', 2, 1); gridster.remove_widget($('gridster li').eq(3).get(0)); var json = gridster.serialize(); diff --git a/jquery.gridster/gridster.d.ts b/jquery.gridster/gridster.d.ts index b293dcb2f..53f26704e 100644 --- a/jquery.gridster/gridster.d.ts +++ b/jquery.gridster/gridster.d.ts @@ -160,11 +160,10 @@ interface JQuery { /** * Gridster - * @param el The HTMLElement that contains all the widgets. * @param options An object with all the gridster options you want to overwrite. * @return Gridster jQuery instance. **/ - gridster(el: HTMLElement, options?: GridsterOptions): JQuery; + gridster(options?: GridsterOptions): JQuery; } interface Gridster { diff --git a/jquery.validation/jquery.validation.d.ts b/jquery.validation/jquery.validation.d.ts index 118b19ef6..cb4d2f042 100644 --- a/jquery.validation/jquery.validation.d.ts +++ b/jquery.validation/jquery.validation.d.ts @@ -180,7 +180,7 @@ interface Validator * @param name The name of the method used to identify it and referencing it; this must be a valid JavaScript identifier * @param method The actual method implementation, returning true if an element is valid. First argument: Current value. Second argument: Validated element. Third argument: Parameters. */ - addMethod(name: string, method: (value: any, element: HTMLElement, params: any) => any, message?: any): void; + addMethod(name: string, method: (value: any, element: HTMLElement, params: any) => boolean, message?: string): void; /** * Validates a single element, returns true if it is valid, false otherwise. * @@ -223,9 +223,12 @@ interface Validator valid(): boolean; validElements(): HTMLElement[]; size(): number; + focusInvalid(): void; + messages: { [index: string]: string }; - errorMap: ErrorDictionary; + errorMap: ErrorDictionary; errorList: ErrorListItem[]; + methods: { [index: string]: Function }; } interface JQuery diff --git a/jquery/jquery-tests.ts b/jquery/jquery-tests.ts index 8a2e23cf9..006140f2f 100644 --- a/jquery/jquery-tests.ts +++ b/jquery/jquery-tests.ts @@ -3212,7 +3212,7 @@ function test_EventIsCallable() { } $.when($.ajax("/my/page.json")).then(a => a.asdf); // is type JQueryPromise -$.when($.ajax("/my/page.json")).then((a?,b?,c?) => a.asdf); // is type JQueryPromise +$.when($.ajax("/my/page.json")).then((a?,b?,c?) => a.asdf); // is type JQueryPromise $.when("asdf", "jkl;").done((x,y) => x.length + y.length, (x,y) => x.length + y.length); var f1 = $.when("fetch"); // Is type JQueryPromise @@ -3370,4 +3370,28 @@ function test_promise_then_change_type() { count().done(data => { }).fail((exception: Error) => { }); -} \ No newline at end of file +} + +function test_promise_then_not_return_deferred() { + var state: string; + + var deferred: JQueryDeferred = $.Deferred(); + state = deferred.state(); + deferred = deferred.progress(); + deferred = deferred.done(); + deferred = deferred.fail(); + deferred = deferred.always(); + deferred = deferred.notify(); + deferred = deferred.resolve(); + deferred = deferred.reject(); + promise = deferred.promise(); + promise = deferred.then(function () { }); + + var promise: JQueryPromise = $.Deferred().promise(); + state = promise.state(); + promise = promise.then(function () { }); + promise = promise.progress(); + promise = promise.done(); + promise = promise.fail(); + promise = promise.always(); +} diff --git a/jquery/jquery.d.ts b/jquery/jquery.d.ts index b82711120..61fd62442 100644 --- a/jquery/jquery.d.ts +++ b/jquery/jquery.d.ts @@ -276,7 +276,15 @@ interface JQueryGenericPromise { * @param doneFilter A function that is called when the Deferred is resolved. * @param failFilter An optional function that is called when the Deferred is rejected. */ - then(doneFilter: (value: T) => U|JQueryGenericPromise, failFilter?: (reason: any) => U|JQueryGenericPromise): JQueryGenericPromise; + then(doneFilter: (value?: T, ...values: any[]) => U|JQueryPromise, failFilter?: (...reasons: any[]) => any, progressFilter?: (...progression: any[]) => any): JQueryPromise; + + /** + * Add handlers to be called when the Deferred object is resolved, rejected, or still in progress. + * + * @param doneFilter A function that is called when the Deferred is resolved. + * @param failFilter An optional function that is called when the Deferred is rejected. + */ + then(doneFilter: (value?: T, ...values: any[]) => void, failFilter?: (...reasons: any[]) => any, progressFilter?: (...progression: any[]) => any): JQueryPromise; } /** @@ -286,120 +294,92 @@ interface JQueryPromiseCallback { (value?: T, ...args: any[]): void; } -interface JQueryPromiseOperator { - (callback: JQueryPromiseCallback, ...callbacks: JQueryPromiseCallback[]): JQueryPromise; - (callback: JQueryPromiseCallback[], ...callbacks: JQueryPromiseCallback[]): JQueryPromise; +interface JQueryPromiseOperator { + (callback1: JQueryPromiseCallback|JQueryPromiseCallback[], ...callbacksN: Array|JQueryPromiseCallback[]>): JQueryPromise; } /** * Interface for the JQuery promise, part of callbacks */ -interface JQueryPromise { +interface JQueryPromise extends JQueryGenericPromise { + /** + * Determine the current state of a Deferred object. + */ + state(): string; /** * Add handlers to be called when the Deferred object is either resolved or rejected. * * @param alwaysCallbacks1 A function, or array of functions, that is called when the Deferred is resolved or rejected. * @param alwaysCallbacks2 Optional additional functions, or arrays of functions, that are called when the Deferred is resolved or rejected. */ - always: JQueryPromiseOperator; + always(alwaysCallback1?: JQueryPromiseCallback|JQueryPromiseCallback[], ...alwaysCallbacksN: Array|JQueryPromiseCallback[]>): JQueryPromise; /** * Add handlers to be called when the Deferred object is resolved. * * @param doneCallbacks1 A function, or array of functions, that are called when the Deferred is resolved. * @param doneCallbacks2 Optional additional functions, or arrays of functions, that are called when the Deferred is resolved. */ - done: JQueryPromiseOperator; + done(doneCallback1?: JQueryPromiseCallback|JQueryPromiseCallback[], ...doneCallbackN: Array|JQueryPromiseCallback[]>): JQueryPromise; /** * Add handlers to be called when the Deferred object is rejected. * * @param failCallbacks1 A function, or array of functions, that are called when the Deferred is rejected. * @param failCallbacks2 Optional additional functions, or arrays of functions, that are called when the Deferred is rejected. */ - fail: JQueryPromiseOperator; + fail(failCallback1?: JQueryPromiseCallback|JQueryPromiseCallback[], ...failCallbacksN: Array|JQueryPromiseCallback[]>): JQueryPromise; /** * Add handlers to be called when the Deferred object generates progress notifications. * * @param progressCallbacks A function, or array of functions, to be called when the Deferred generates progress notifications. */ - progress(progressCallback: JQueryPromiseCallback): JQueryPromise; - progress(progressCallbacks: JQueryPromiseCallback[]): JQueryPromise; - - /** - * Determine the current state of a Deferred object. - */ - state(): string; + progress(progressCallback1?: JQueryPromiseCallback|JQueryPromiseCallback[], ...progressCallbackN: Array|JQueryPromiseCallback[]>): JQueryPromise; // Deprecated - given no typings pipe(doneFilter?: (x: any) => any, failFilter?: (x: any) => any, progressFilter?: (x: any) => any): JQueryPromise; - - /** - * Add handlers to be called when the Deferred object is resolved, rejected, or still in progress. - * - * @param doneFilter A function that is called when the Deferred is resolved. - * @param failFilter An optional function that is called when the Deferred is rejected. - * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred. - */ - then(doneFilter: (value: T) => U|JQueryGenericPromise, failFilter?: (...reasons: any[]) => U|JQueryGenericPromise, progressFilter?: (...progression: any[]) => any): JQueryPromise; - - // Because JQuery Promises Suck - /** - * Add handlers to be called when the Deferred object is resolved, rejected, or still in progress. - * - * @param doneFilter A function that is called when the Deferred is resolved. - * @param failFilter An optional function that is called when the Deferred is rejected. - * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred. - */ - then(doneFilter: (...values: any[]) => U|JQueryGenericPromise, failFilter?: (...reasons: any[]) => U|JQueryGenericPromise, progressFilter?: (...progression: any[]) => any): JQueryPromise; } /** * Interface for the JQuery deferred, part of callbacks */ -interface JQueryDeferred extends JQueryPromise { +interface JQueryDeferred extends JQueryGenericPromise { + /** + * Determine the current state of a Deferred object. + */ + state(): string; /** * Add handlers to be called when the Deferred object is either resolved or rejected. * * @param alwaysCallbacks1 A function, or array of functions, that is called when the Deferred is resolved or rejected. * @param alwaysCallbacks2 Optional additional functions, or arrays of functions, that are called when the Deferred is resolved or rejected. */ - always(alwaysCallbacks1?: JQueryPromiseCallback, ...alwaysCallbacks2: JQueryPromiseCallback[]): JQueryDeferred; - always(alwaysCallbacks1?: JQueryPromiseCallback[], ...alwaysCallbacks2: JQueryPromiseCallback[]): JQueryDeferred; - always(alwaysCallbacks1?: JQueryPromiseCallback, ...alwaysCallbacks2: any[]): JQueryDeferred; - always(alwaysCallbacks1?: JQueryPromiseCallback[], ...alwaysCallbacks2: any[]): JQueryDeferred; + always(alwaysCallback1?: JQueryPromiseCallback|JQueryPromiseCallback[], ...alwaysCallbacksN: Array|JQueryPromiseCallback[]>): JQueryDeferred; /** * Add handlers to be called when the Deferred object is resolved. * * @param doneCallbacks1 A function, or array of functions, that are called when the Deferred is resolved. * @param doneCallbacks2 Optional additional functions, or arrays of functions, that are called when the Deferred is resolved. */ - done(doneCallbacks1?: JQueryPromiseCallback, ...doneCallbacks2: JQueryPromiseCallback[]): JQueryDeferred; - done(doneCallbacks1?: JQueryPromiseCallback[], ...doneCallbacks2: JQueryPromiseCallback[]): JQueryDeferred; - done(doneCallbacks1?: JQueryPromiseCallback, ...doneCallbacks2: any[]): JQueryDeferred; - done(doneCallbacks1?: JQueryPromiseCallback[], ...doneCallbacks2: any[]): JQueryDeferred; + done(doneCallback1?: JQueryPromiseCallback|JQueryPromiseCallback[], ...doneCallbackN: Array|JQueryPromiseCallback[]>): JQueryDeferred; /** * Add handlers to be called when the Deferred object is rejected. * * @param failCallbacks1 A function, or array of functions, that are called when the Deferred is rejected. * @param failCallbacks2 Optional additional functions, or arrays of functions, that are called when the Deferred is rejected. */ - fail(failCallbacks1?: JQueryPromiseCallback, ...failCallbacks2: JQueryPromiseCallback[]): JQueryDeferred; - fail(failCallbacks1?: JQueryPromiseCallback[], ...failCallbacks2: JQueryPromiseCallback[]): JQueryDeferred; - fail(failCallbacks1?: JQueryPromiseCallback, ...failCallbacks2: any[]): JQueryDeferred; - fail(failCallbacks1?: JQueryPromiseCallback[], ...failCallbacks2: any[]): JQueryDeferred; + fail(failCallback1?: JQueryPromiseCallback|JQueryPromiseCallback[], ...failCallbacksN: Array|JQueryPromiseCallback[]>): JQueryDeferred; /** * Add handlers to be called when the Deferred object generates progress notifications. * * @param progressCallbacks A function, or array of functions, to be called when the Deferred generates progress notifications. */ - progress(progressCallback: JQueryPromiseCallback): JQueryDeferred; - progress(progressCallbacks: JQueryPromiseCallback[]): JQueryDeferred; + progress(progressCallback1?: JQueryPromiseCallback|JQueryPromiseCallback[], ...progressCallbackN: Array|JQueryPromiseCallback[]>): JQueryDeferred; /** * Call the progressCallbacks on a Deferred object with the given args. * * @param args Optional arguments that are passed to the progressCallbacks. */ - notify(...args: any[]): JQueryDeferred; + notify(value?: any, ...args: any[]): JQueryDeferred; /** * Call the progressCallbacks on a Deferred object with the given context and args. @@ -407,21 +387,21 @@ interface JQueryDeferred extends JQueryPromise { * @param context Context passed to the progressCallbacks as the this object. * @param args Optional arguments that are passed to the progressCallbacks. */ - notifyWith(context: any, ...args: any[]): JQueryDeferred; + notifyWith(context: any, value?: any, ...args: any[]): JQueryDeferred; /** * Reject a Deferred object and call any failCallbacks with the given args. * * @param args Optional arguments that are passed to the failCallbacks. */ - reject(...args: any[]): JQueryDeferred; + reject(value?: any, ...args: any[]): JQueryDeferred; /** * Reject a Deferred object and call any failCallbacks with the given context and args. * * @param context Context passed to the failCallbacks as the this object. * @param args An optional array of arguments that are passed to the failCallbacks. */ - rejectWith(context: any, ...args: any[]): JQueryDeferred; + rejectWith(context: any, value?: any, ...args: any[]): JQueryDeferred; /** * Resolve a Deferred object and call any doneCallbacks with the given args. @@ -437,7 +417,7 @@ interface JQueryDeferred extends JQueryPromise { * @param context Context passed to the doneCallbacks as the this object. * @param args An optional array of arguments that are passed to the doneCallbacks. */ - resolveWith(context: any, ...args: any[]): JQueryDeferred; + resolveWith(context: any, value?: T, ...args: any[]): JQueryDeferred; /** * Return a Deferred's Promise object. @@ -445,6 +425,9 @@ interface JQueryDeferred extends JQueryPromise { * @param target Object onto which the promise methods have to be attached */ promise(target?: any): JQueryPromise; + + // Deprecated - given no typings + pipe(doneFilter?: (x: any) => any, failFilter?: (x: any) => any, progressFilter?: (x: any) => any): JQueryPromise; } /** @@ -805,19 +788,7 @@ interface JQueryStatic { * * @param deferreds One or more Deferred objects, or plain JavaScript objects. */ - when(...deferreds: JQueryGenericPromise[]): JQueryPromise; - /** - * Provides a way to execute callback functions based on one or more objects, usually Deferred objects that represent asynchronous events. - * - * @param deferreds One or more Deferred objects, or plain JavaScript objects. - */ - when(...deferreds: T[]): JQueryPromise; - /** - * Provides a way to execute callback functions based on one or more objects, usually Deferred objects that represent asynchronous events. - * - * @param deferreds One or more Deferred objects, or plain JavaScript objects. - */ - when(...deferreds: any[]): JQueryPromise; + when(...deferreds: Array/* as JQueryDeferred */>): JQueryPromise; /** * Hook directly into jQuery to override how particular CSS properties are retrieved or set, normalize CSS property naming, or create custom properties. diff --git a/js-data-angular/js-data-angular.d.ts b/js-data-angular/js-data-angular.d.ts index 11a295562..242c6d5ab 100644 --- a/js-data-angular/js-data-angular.d.ts +++ b/js-data-angular/js-data-angular.d.ts @@ -16,15 +16,13 @@ declare module JSData { bindAll(resourceName:string, params:DSFilterParams, scope:ng.IScope, expr:string, cb?:(err:DSError, items:Array)=>void):Function; - bindOne(resourceName:string, id:string, scope:ng.IScope, expr:string, cb?:(err:DSError, item:T)=>void):Function; - bindOne(resourceName:string, id:number, scope:ng.IScope, expr:string, cb?:(err:DSError, item:T)=>void):Function; + bindOne(resourceName:string, id:string | number, scope:ng.IScope, expr:string, cb?:(err:DSError, item:T)=>void):Function; } interface DSResourceDefinition { bindAll(params:DSFilterParams, scope:ng.IScope, expr:string, cb?:(err:DSError, items:Array)=>void):Function; - bindOne(id:string, scope:ng.IScope, expr:string, cb?:(err:DSError, item:T)=>void):Function; - bindOne(id:number, scope:ng.IScope, expr:string, cb?:(err:DSError, item:T)=>void):Function; + bindOne(id:string | number, scope:ng.IScope, expr:string, cb?:(err:DSError, item:T)=>void):Function; } } \ No newline at end of file diff --git a/js-data-http/js-data-http.d.ts b/js-data-http/js-data-http.d.ts index 416aa3c8c..295e7cc6f 100644 --- a/js-data-http/js-data-http.d.ts +++ b/js-data-http/js-data-http.d.ts @@ -13,14 +13,8 @@ declare module JSData { queryTransform?: (resourceName:string, params:DSFilterParams)=>any; httpConfig?: any; forceTrailingSlash?: boolean; - log?: any; - // TODO wait for union types to be supported - // log: (message?: any, ...optionalParams: any[])=> void; - // log: boolean; - error?: any; - // TODO wait for union types to be supported - // error: (message?: any, ...optionalParams: any[])=> void; - // error: boolean; + log?: boolean | ((message?:any, ...optionalParams:any[])=> void); + error?: boolean | ((message?:any, ...optionalParams:any[])=> void); } interface DSHttpAdapterPromiseResolveType { diff --git a/js-data/js-data.d.ts b/js-data/js-data.d.ts index 7017481ee..bec41d331 100644 --- a/js-data/js-data.d.ts +++ b/js-data/js-data.d.ts @@ -1,4 +1,4 @@ -// Type definitions for JSData v1.3.0 +// Type definitions for JSData v1.5.4 // Project: https://github.com/js-data/js-data // Definitions by: Stefan Steinhart // Definitions: https://github.com/borisyankov/DefinitelyTyped @@ -34,97 +34,44 @@ declare module JSData { defaults:DSConfiguration; - changeHistory(resourceName:string, id?:string):Array; - changeHistory(resourceName:string, id?:number):Array; - - changes(resourceName:string, id:string):Object; - changes(resourceName:string, id:number):Object; - - compute(resourceName:string, id:number):T; - compute(resourceName:string, id:string):T; - compute(resourceName:string, instance:Object):T; - - create(resourceName:string, attrs:any, options?:DSConfiguration):JSDataPromise; - - createInstance(resourceName:string, attrs?:T, options?:DSAdapterOperationConfiguration):T; - - defineResource(resourceName:string):DSResourceDefinition; - defineResource(definition:DSResourceDefinitionConfiguration):DSResourceDefinition; - - destroy(resourceName:string, id:string, options?:DSAdapterOperationConfiguration):JSDataPromise; - destroy(resourceName:string, id:number, options?:DSAdapterOperationConfiguration):JSDataPromise; - + // async + create(resourceName:string, attrs:Object, options?:DSConfiguration):JSDataPromise; + destroy(resourceName:string, id:string | number, options?:DSAdapterOperationConfiguration):JSDataPromise; destroyAll(resourceName:string, params?:DSFilterParams, options?:DSAdapterOperationConfiguration):JSDataPromise; - - digest():void; - - eject(resourceName:string, id:string, options?:DSConfiguration):T; - eject(resourceName:string, id:number, options?:DSConfiguration):T; - - ejectAll(resourceName:string, params:DSFilterParams, options?:DSConfiguration):Array; - - filter(resourceName:string, params:DSFilterParams, options?:DSConfiguration):Array; - - find(resourceName:string, id:string, options?:DSAdapterOperationConfiguration):JSDataPromise; - find(resourceName:string, id:number, options?:DSAdapterOperationConfiguration):JSDataPromise; - + find(resourceName:string, id:string | number, options?:DSAdapterOperationConfiguration):JSDataPromise; findAll(resourceName:string, params?:DSFilterParams, options?:DSAdapterOperationConfiguration):JSDataPromise>; + loadRelations(resourceName:string, idOrInstance:string | number | Object, relations:string | Array, options?:DSAdapterOperationConfiguration):JSDataPromise; + update(resourceName:string, id:string | number, attrs:Object, options?:DSSaveConfiguration):JSDataPromise; + updateAll(resourceName:string, attrs:Object, params?:DSFilterParams, options?:DSAdapterOperationConfiguration):JSDataPromise>; + reap(resourceName:string, options?:DSConfiguration):JSDataPromise; + refresh(resourceName:string, id:string | number, options?:DSAdapterOperationConfiguration):JSDataPromise; + save(resourceName:string, id:string | number, options?:DSSaveConfiguration):JSDataPromise; - get(resourceName:string, id:string, options?:DSConfiguration):T; - get(resourceName:string, id:number, options?:DSConfiguration):T; - - getAll(resourceName:string, ids?:Array):Array; - getAll(resourceName:string, ids?:Array):Array; - - hasChanges(resourceName:string, id:string):boolean; - hasChanges(resourceName:string, id:number):boolean; - + // sync + changeHistory(resourceName:string, id?:string | number):Array; + changes(resourceName:string, id:string | number):Object; + compute(resourceName:string, idOrInstance:number | string | Object ):T; + createInstance(resourceName:string, attrs?:T, options?:DSAdapterOperationConfiguration):T; + defineResource(resourceNameOrDefinition:string | DSResourceDefinitionConfiguration):DSResourceDefinition; + digest():void; + eject(resourceName:string, id:string | number, options?:DSConfiguration):T; + ejectAll(resourceName:string, params:DSFilterParams, options?:DSConfiguration):Array; + filter(resourceName:string, params:DSFilterParams, options?:DSConfiguration):Array; + get(resourceName:string, id:string | number, options?:DSConfiguration):T; + getAll(resourceName:string, ids?:Array):Array; + hasChanges(resourceName:string, id:string | number):boolean; inject(resourceName:string, attrs:T, options?:DSConfiguration):T; inject(resourceName:string, items:Array, options?:DSConfiguration):Array; - is(resourceName:string, object:Object): boolean; - - lastModified(resourceName:string, id?:string):number; // timestamp - lastModified(resourceName:string, id?:number):number; // timestamp - - lastSaved(resourceName:string, id?:string):number; // timestamp - lastSaved(resourceName:string, id?:number):number; // timestamp - - link(resourceName:string, id:string, relations?:Array):T; - link(resourceName:string, id:number, relations?:Array):T; - + lastModified(resourceName:string, id?:string | number):number; // timestamp + lastSaved(resourceName:string, id?:string | number):number; // timestamp + link(resourceName:string, id:string | number, relations?:Array):T; linkAll(resourceName:string, params:DSFilterParams, relations?:Array):T; - - linkInverse(resourceName:string, id:string, relations?:Array):T; - linkInverse(resourceName:string, id:number, relations?:Array):T; - - loadRelations(resourceName:string, id:string, relations:string, options?:DSAdapterOperationConfiguration):JSDataPromise; - loadRelations(resourceName:string, id:number, relations:string, options?:DSAdapterOperationConfiguration):JSDataPromise; - loadRelations(resourceName:string, instance:Object, relations:string, options?:DSAdapterOperationConfiguration):JSDataPromise; - loadRelations(resourceName:string, id:string, relations:Array, options?:DSAdapterOperationConfiguration):JSDataPromise; - loadRelations(resourceName:string, id:number, relations:Array, options?:DSAdapterOperationConfiguration):JSDataPromise; - loadRelations(resourceName:string, instance:Object, relations:Array, options?:DSAdapterOperationConfiguration):JSDataPromise; - - previous(resourceName:string, id:string):T; - previous(resourceName:string, id:number):T; - - reap(resourceName:string, options?:DSConfiguration):JSDataPromise; - - refresh(resourceName:string, id:string, options?:DSAdapterOperationConfiguration):JSDataPromise; - refresh(resourceName:string, id:number, options?:DSAdapterOperationConfiguration):JSDataPromise; + linkInverse(resourceName:string, id:string | number, relations?:Array):T; + previous(resourceName:string, id:string | number):T; + unlinkInverse(resourceName:string, id:string | number, relations?:Array):T; registerAdapter(adapterId:string, adapter:IDSAdapter, options?:{default: boolean}):void; - - save(resourceName:string, id:string, options?:DSSaveConfiguration):JSDataPromise; - save(resourceName:string, id:number, options?:DSSaveConfiguration):JSDataPromise; - - unlinkInverse(resourceName:string, id:string, relations?:Array):T; - unlinkInverse(resourceName:string, id:number, relations?:Array):T; - - update(resourceName:string, id:string, attrs:any, options?:DSSaveConfiguration):JSDataPromise; - update(resourceName:string, id:number, attrs:any, options?:DSSaveConfiguration):JSDataPromise; - - updateAll(resourceName:string, attrs:any, params?:DSFilterParams, options?:DSAdapterOperationConfiguration):JSDataPromise>; } interface DSConfiguration extends IDSResourceLifecycleEventHandlers { @@ -139,7 +86,7 @@ declare module JSData { // TODO enable when eagerInject in DS#create is implemented //eagerInject?: boolean; endpoint?: string; - error?: (message?:any, ...optionalParams:any[])=> void; + error?: boolean | ((message?:any, ...optionalParams:any[])=> void); fallbackAdapters?: Array; findAllFallbackAdapters?: Array; findAllStrategy?: string; @@ -150,15 +97,12 @@ declare module JSData { findInverseLinks?: boolean; findStrategy?: string idAttribute?: string; - ignoredChanges?: Array; + ignoredChanges?: Array; // TODO ignoreMissing is undocumented //ignoreMissing: boolean; keepChangeHistory?: boolean; loadFromServer?: boolean; - log?: any; - // TODO wait for union types to be supported - // log: (message?: any, ...optionalParams: any[])=> void; - // log: boolean; + log?: boolean | ((message?: any, ...optionalParams: any[])=> void); maxAge?: number; notify?: boolean; reapAction?: string; @@ -191,95 +135,41 @@ declare module JSData { interface DSResourceDefinition extends DSResourceDefinitionConfiguration { - changeHistory(id?:string):Array; - changeHistory(id?:number):Array; - - changes(id:string):Object; - changes(id:number):Object; - - compute(id:number):T; - compute(id:string):T; - compute(instance:Object):T; - - create(attrs:any, options?:DSConfiguration):JSDataPromise; - - createInstance(attrs?:T, options?:DSAdapterOperationConfiguration):T; - - defineResource(resourceName:string):DSResourceDefinition; - defineResource(definition:DSResourceDefinitionConfiguration):DSResourceDefinition; - - destroy(id:string, options?:DSAdapterOperationConfiguration):JSDataPromise; - destroy(id:number, options?:DSAdapterOperationConfiguration):JSDataPromise; - + //async + create(attrs:Object, options?:DSConfiguration):JSDataPromise; + destroy(id:string | number, options?:DSAdapterOperationConfiguration):JSDataPromise; destroyAll(params?:DSFilterParams, options?:DSAdapterOperationConfiguration):JSDataPromise; - - digest():void; - - eject(id:string, options?:DSConfiguration):T; - eject(id:number, options?:DSConfiguration):T; - - ejectAll(params:DSFilterParams, options?:DSConfiguration):Array; - - filter(params:DSFilterParams, options?:DSConfiguration):Array; - - find(id:string, options?:DSAdapterOperationConfiguration):JSDataPromise; - find(id:number, options?:DSAdapterOperationConfiguration):JSDataPromise; - + find(id:string | number, options?:DSAdapterOperationConfiguration):JSDataPromise; findAll(params?:DSFilterParams, options?:DSAdapterOperationConfiguration):JSDataPromise>; + loadRelations(idOrInstance:string | number | Object, relations:string | Array, options?:DSAdapterOperationConfiguration):JSDataPromise; + update(id:string | number, attrs:Object, options?:DSSaveConfiguration):JSDataPromise; + updateAll(attrs:Object, params?:DSFilterParams, options?:DSAdapterOperationConfiguration):JSDataPromise>; + reap(resourceNametions?:DSConfiguration):JSDataPromise; + refresh(id:string | number, options?:DSAdapterOperationConfiguration):JSDataPromise; + save(id:string | number, options?:DSSaveConfiguration):JSDataPromise; - get(id:string, options?:DSConfiguration):T; - get(id:number, options?:DSConfiguration):T; - - getAll(ids?:Array):Array; - getAll(ids?:Array):Array; - - hasChanges(id:string):boolean; - hasChanges(id:number):boolean; - + // sync + changeHistory(id?:string | number):Array; + changes(id:string | number):Object; + compute(idOrInstance:number | string | Object ):T; + createInstance(attrs?:T, options?:DSAdapterOperationConfiguration):T; + digest():void; + eject(id:string | number, options?:DSConfiguration):T; + ejectAll(params:DSFilterParams, options?:DSConfiguration):Array; + filter(params:DSFilterParams, options?:DSConfiguration):Array; + get(id:string | number, options?:DSConfiguration):T; + getAll(ids?:Array):Array; + hasChanges(id:string | number):boolean; inject(attrs:T, options?:DSConfiguration):T; inject(items:Array, options?:DSConfiguration):Array; - is(object:Object): boolean; - - lastModified(id?:string):number; // timestamp - lastModified(id?:number):number; // timestamp - - lastSaved(id?:string):number; // timestamp - lastSaved(id?:number):number; // timestamp - - link(id:string, relations?:Array):T; - link(id:number, relations?:Array):T; - + lastModified(id?:string | number):number; // timestamp + lastSaved(id?:string | number):number; // timestamp + link(id:string | number, relations?:Array):T; linkAll(params:DSFilterParams, relations?:Array):T; - - linkInverse(id:string, relations?:Array):T; - linkInverse(id:number, relations?:Array):T; - - loadRelations(id:string, relations:string, options?:DSAdapterOperationConfiguration):JSDataPromise; - loadRelations(id:number, relations:string, options?:DSAdapterOperationConfiguration):JSDataPromise; - loadRelations(instance:T, relations:string, options?:DSAdapterOperationConfiguration):JSDataPromise; - loadRelations(id:string, relations:Array, options?:DSAdapterOperationConfiguration):JSDataPromise; - loadRelations(id:number, relations:Array, options?:DSAdapterOperationConfiguration):JSDataPromise; - loadRelations(instance:T, relations:Array, options?:DSAdapterOperationConfiguration):JSDataPromise; - - previous(id:string):T; - previous(id:number):T; - - reap(options?:DSConfiguration):JSDataPromise; - - refresh(id:string, options?:DSAdapterOperationConfiguration):JSDataPromise; - refresh(id:number, options?:DSAdapterOperationConfiguration):JSDataPromise; - - save(id:string, options?:DSSaveConfiguration):JSDataPromise; - save(id:number, options?:DSSaveConfiguration):JSDataPromise; - - unlinkInverse(id:string, relations?:Array):T; - unlinkInverse(id:number, relations?:Array):T; - - update(id:string, attrs:any, options?:DSSaveConfiguration):JSDataPromise; - update(id:number, attrs:any, options?:DSSaveConfiguration):JSDataPromise; - - updateAll(attrs:any, params?:DSFilterParams, options?:DSAdapterOperationConfiguration):JSDataPromise>; + linkInverse(id:string | number, relations?:Array):T; + previous(id:string | number):T; + unlinkInverse(id:string | number, relations?:Array):T; } interface DSFilterParams { @@ -290,17 +180,8 @@ declare module JSData { skip?: number; offset?: number; - orderBy?: any; - // TODO wait for union types to be supported - //orderBy?: Array>; - //orderBy?: Array; - //orderBy?: string; - - sort?: any; - // TODO wait for union types to be supported - //sort?: string; - //sort?: Array; - //sort?: Array>; + orderBy?: string | Array | Array>; + sort?: string | Array | Array>; } interface IDSResourceLifecycleValidateEventHandlers { @@ -375,22 +256,19 @@ declare module JSData { // DSAdapter interface interface IDSAdapter { - create(config:DSResourceDefinition, attrs:any, options?:DSConfiguration):JSDataPromise; + create(config:DSResourceDefinition, attrs:Object, options?:DSConfiguration):JSDataPromise; - destroy(config:DSResourceDefinition, id:string, options?:DSConfiguration):JSDataPromise; - destroy(config:DSResourceDefinition, id:number, options?:DSConfiguration):JSDataPromise; + destroy(config:DSResourceDefinition, id:string | number, options?:DSConfiguration):JSDataPromise; destroyAll(config:DSResourceDefinition, params:DSFilterParams, options?:DSConfiguration):JSDataPromise; - find(config:DSResourceDefinition, id:string, options?:DSConfiguration):JSDataPromise; - find(config:DSResourceDefinition, id:number, options?:DSConfiguration):JSDataPromise; + find(config:DSResourceDefinition, id:string | number, options?:DSConfiguration):JSDataPromise; findAll(config:DSResourceDefinition, params?:DSFilterParams, options?:DSConfiguration):JSDataPromise; - update(config:DSResourceDefinition, id:string, attrs:any, options?:DSConfiguration):JSDataPromise; - update(config:DSResourceDefinition, id:number, attrs:any, options?:DSConfiguration):JSDataPromise; + update(config:DSResourceDefinition, id:string | number, attrs:Object, options?:DSConfiguration):JSDataPromise; - updateAll(config:DSResourceDefinition, attrs:any, params?:DSFilterParams, options?:DSConfiguration):JSDataPromise; + updateAll(config:DSResourceDefinition, attrs:Object, params?:DSFilterParams, options?:DSConfiguration):JSDataPromise; } } diff --git a/js-signals/js-signals.d.ts.tscparams b/js-signals/js-signals.d.ts.tscparams deleted file mode 100644 index d3f5a12fa..000000000 --- a/js-signals/js-signals.d.ts.tscparams +++ /dev/null @@ -1 +0,0 @@ - diff --git a/jsnox/jsnox.d.ts b/jsnox/jsnox.d.ts index b3e4460c0..72584563b 100644 --- a/jsnox/jsnox.d.ts +++ b/jsnox/jsnox.d.ts @@ -3,7 +3,7 @@ // Definitions by: Steve Baker // Definitions: https://github.com/borisyankov/DefinitelyTyped -/// +/// declare module 'jsnox' { diff --git a/jssha/jssha-tests.ts b/jssha/jssha-tests.ts new file mode 100755 index 000000000..8d6eec5a6 --- /dev/null +++ b/jssha/jssha-tests.ts @@ -0,0 +1,15 @@ +/// +/// + +var imported = require("jssha"); + +var shaObj1:jsSHA.jsSHA = new jsSHA("This is a Test", "TEXT", "UTF8"); +var shaObj2 = new imported("This is a Test", "TEXT"); + +var hash1:string = shaObj2.getHash("SHA-512", "HEX"); +var hash2:string = shaObj2.getHash("SHA-512", "HEX", 2); +var hash3:string = shaObj2.getHash("SHA-512", "HEX", 2, {outputUpper: false, b64Pad: "foobar"}); + +var format:jsSHA.OutputFormatOptions = {outputUpper: false, b64Pad: "foobar"}; +var hmac1 = shaObj2.getHMAC("SecretKey", "TEXT", "SHA-512", "HEX"); +var hmac2 = shaObj2.getHMAC("SecretKey", "TEXT", "SHA-512", "HEX", format); diff --git a/jssha/jssha.d.ts b/jssha/jssha.d.ts new file mode 100755 index 000000000..1c75c3862 --- /dev/null +++ b/jssha/jssha.d.ts @@ -0,0 +1,65 @@ +// Type definitions for jsSHA +// Project: https://github.com/Caligatio/jsSHA +// Definitions by: David Li +// Definitions: https://github.com/borisyankov/DefinitelyTyped + + +declare module jsSHA { + export interface OutputFormatOptions { + outputUpper : boolean; + b64Pad : string; + } + + export interface jsSHA { + /** + * jsSHA is the workhorse of the library. Instantiate it with the string to + * be hashed as the parameter + * + * @constructor + * @this {jsSHA} + * @param {string} srcString The string to be hashed + * @param {string} inputFormat The format of srcString, HEX, TEXT, B64, or BYTES + * @param {string=} encoding The text encoding to use to encode the source + * string + */ + new (srcString:string, inputFormat:string, encoding?:string):jsSHA; + + /** + * Returns the desired SHA hash of the string specified at instantiation + * using the specified parameters + * + * @param {string} variant The desired SHA variant (SHA-1, SHA-224, + * SHA-256, SHA-384, or SHA-512) + * @param {string} format The desired output formatting (B64, HEX, or BYTES) + * @param {number=} numRounds The number of rounds of hashing to be + * executed + * @param {{outputUpper : boolean, b64Pad : string}=} outputFormatOpts + * Hash list of output formatting options + * @return {string} The string representation of the hash in the format + * specified + */ + getHash(variant:string, format:string, numRounds?:number, outputFormatOpts?:OutputFormatOptions):string; + + /** + * Returns the desired HMAC of the string specified at instantiation + * using the key and variant parameter + * + * @param {string} key The key used to calculate the HMAC + * @param {string} inputFormat The format of key, HEX, TEXT, B64, or BYTES + * @param {string} variant The desired SHA variant (SHA-1, SHA-224, + * SHA-256, SHA-384, or SHA-512) + * @param {string} outputFormat The desired output formatting + * (B64, HEX, or BYTES) + * @param {{outputUpper : boolean, b64Pad : string}=} outputFormatOpts + * associative array of output formatting options + * @return {string} The string representation of the hash in the format + * specified + */ + getHMAC(key:string, inputFormat:string, variant:string, outputFormat:string, outputFormatOpts?:OutputFormatOptions):string; + } +} + +declare var jsSHA: jsSHA.jsSHA; +declare module 'jssha' { + export = jsSHA; +} diff --git a/jstree/jstree.d.ts b/jstree/jstree.d.ts index 5d4be29bf..ff0338e13 100644 --- a/jstree/jstree.d.ts +++ b/jstree/jstree.d.ts @@ -1,7 +1,8 @@ -// Type definitions for jsTree v3.0.4 +// Type definitions for jsTree v3.0.9 // Project: http://www.jstree.com/ // Definitions by: Adam Pluciński // Definitions: https://github.com/borisyankov/DefinitelyTyped +// 45 commit df38535 2015-03-02 13:23 +2:00 /// @@ -14,7 +15,6 @@ interface JQueryStatic { * @type {JSTreeStatic} */ jstree?: JSTreeStatic; - } interface JQuery { @@ -165,6 +165,11 @@ interface JSTreeStaticDefaults { */ dnd?: JSTreeStaticDefaultsDragNDrop; + /** + * Adds massload functionality to jsTree, so that multiple nodes can be loaded in a single request (only useful with lazy loading). + */ + massload?: JSTreeStaticDefaultsMassload; + /** * stores all defaults for the search plugin */ @@ -347,6 +352,12 @@ interface JSTreeStaticDefaultsCore { * @name $.jstree.defaults.core.force_text */ force_text?: boolean; + + /** + * Should the node should be toggled if the text is double clicked . Defaults to `true` + * @name $.jstree.defaults.core.dblclick_toggle + */ + dblclick_toggle?: boolean; } interface JSTreeStaticDefaultsCoreThemes { @@ -524,17 +535,71 @@ interface JSTreeStaticDefaultsDragNDrop { * @plugin dnd */ inside_pos: any; + + /** + * when starting the drag on a node that is selected this setting controls if all selected nodes are dragged or only the single node, default is `true`, which means all selected nodes are dragged when the drag is started on a selected node + * @name $.jstree.defaults.dnd.drag_selection + * @plugin dnd + */ + drag_selection: boolean; + + /** + * controls whether dnd works on touch devices. If left as boolean true dnd will work the same as in desktop browsers, which in some cases may impair scrolling. If set to boolean false dnd will not work on touch devices. There is a special third option - string "selected" which means only selected nodes can be dragged on touch devices. + * @name $.jstree.defaults.dnd.touch + * @plugin dnd + */ + touch: boolean; + + /** + * controls whether items can be dropped anywhere on the node, not just on the anchor, by default only the node anchor is a valid drop target. Works best with the wholerow plugin. If enabled on mobile depending on the interface it might be hard for the user to cancel the drop, since the whole tree container will be a valid drop target. + * @name $.jstree.defaults.dnd.large_drop_target + * @plugin dnd + */ + large_drop_target: boolean; + + /** + * controls whether a drag can be initiated from any part of the node and not just the text/icon part, works best with the wholerow plugin. Keep in mind it can cause problems with tree scrolling on mobile depending on the interface - in that case set the touch option to "selected". + * @name $.jstree.defaults.dnd.large_drag_target + * @plugin dnd + */ + large_drag_target: boolean; +} + +interface JSTreeStaticDefaultsMassload { + /** + * massload configuration + * + * It is possible to set this to a standard jQuery-like AJAX config. + * In addition to the standard jQuery ajax options here you can supply functions for `data` and `url`, the functions will be run in the current instance's scope and a param will be passed indicating which node IDs need to be loaded, the return value of those functions will be used. + * + * You can also set this to a function, that function will receive the node IDs being loaded as argument and a second param which is a function (callback) which should be called with the result. + * + * Both the AJAX and the function approach rely on the same return value - an object where the keys are the node IDs, and the value is the children of that node as an array. + * + * { + * "id1" : [{ "text" : "Child of ID1", "id" : "c1" }, { "text" : "Another child of ID1", "id" : "c2" }], + * "id2" : [{ "text" : "Child of ID2", "id" : "c3" }] + * } + * + * @name $.jstree.defaults.massload + * @plugin massload + */ + + url: any; + + data: any; } interface JSTreeStaticDefaultsSearch { /** * a jQuery-like AJAX config, which jstree uses if a server should be queried for results. * - * A `str` (which is the search string) parameter will be added with the request. + * A `str` (which is the search string) parameter will be added with the request, + * an optional `inside` parameter will be added if the search is limited to a node id. * The expected result is a JSON array with nodes that need to be opened so that matching nodes will be revealed. * Leave this setting as `false` to not query the server. You can also set this to a function, - * which will be invoked in the instance's scope and receive 2 parameters - - * the search string and the callback to call with the array of nodes to load. + * which will be invoked in the instance's scope and receive 3 parameters - the search string, + * the callback to call with the array of nodes to load, and the optional node ID to limit the search to * @name $.jstree.defaults.search.ajax * @plugin search */ @@ -556,7 +621,7 @@ interface JSTreeStaticDefaultsSearch { /** * Indicates if the tree should be filtered (by default) to show only matching nodes - * (keep in mind this can be a heavy on large trees in old browsers). + * (keep in mind this can be a heavy on large trees in old browsers). * This setting can be changed at runtime when calling the search method. Default is `false`. * @name $.jstree.defaults.search.show_only_matches * @plugin search @@ -637,12 +702,65 @@ interface JSTreeStaticDefaultsUnique { } interface JSTree extends JQuery { + /** + * used to decorate an instance with a plugin. Used internally. + * @private + * @name plugin(deco [, opts]) + * @param {String} deco the plugin to decorate with + * @param {Object} opts options for the plugin + * @return {jsTree} + */ + plugin: (deco: string, opts?: any) => JSTree; + + /** + * used to decorate an instance with a plugin. Used internally. + * @private + * @name init(el, options) + * @param {DOMElement|jQuery|String} el the element we are transforming + * @param {Object} options options for this instance + * @trigger init.jstree, loading.jstree, loaded.jstree, ready.jstree, changed.jstree + */ + init: (el:any, options:any) => void; + /** * destroy an instance * @name destroy() * @param {Boolean} keep_html if not set to `true` the container will be emptied, otherwise the current DOM elements will be kept intact */ destroy: (keep_html?: boolean) => void; + + /** + * part of the destroying of an instance. Used internally. + * @private + * @name teardown() + */ + teardown: () => void; + + /** + * bind all events. Used internally. + * @private + * @name bind() + */ + bind: () => any; + + /** + * part of the destroying of an instance. Used internally. + * @private + * @name unbind() + */ + unbind: () => any; + + /** + * trigger an event. Used internally. + * @private + * @name trigger(ev [, data]) + * @param {String} ev the name of the event to trigger + * @param {Object} data additional data to pass with the event + */ + /* + * defined in JQuery + */ + // trigger: (ev: string, data?: Object) => any; /** * returns the jQuery extended instance container @@ -651,6 +769,50 @@ interface JSTree extends JQuery { */ get_container: () => JQuery; + /** + * returns the jQuery extended main UL node inside the instance container. Used internally. + * @private + * @name get_container_ul() + * @return {jQuery} + */ + get_container_ul: () => JQuery; + + /** + * gets string replacements (localization). Used internally. + * @private + * @name get_string(key) + * @param {String} key + * @return {String} + */ + get_string: (key: string) => string; + + /** + * gets the first child of a DOM node. Used internally. + * @private + * @name _firstChild(dom) + * @param {DOMElement} dom + * @return {DOMElement} + */ + _firstChild: (dom: HTMLElement) => HTMLElement; + + /** + * gets the next sibling of a DOM node. Used internally. + * @private + * @name _nextSibling(dom) + * @param {DOMElement} dom + * @return {DOMElement} + */ + _nextSibling: (dom: HTMLElement) => HTMLElement; + + /** + * gets the previous sibling of a DOM node. Used internally. + * @private + * @name _previousSibling(dom) + * @param {DOMElement} dom + * @return {DOMElement} + */ + _previousSibling: (dom: HTMLElement) => HTMLElement; + /** * get the JSON representation of a node (or the actual jQuery extended DOM node) by using any input (child DOM element, ID string, selector, etc) * @name get_node(obj [, as_dom]) @@ -763,6 +925,107 @@ interface JSTree extends JQuery { */ load_node: (obj: any, callback: (node: any, status: boolean) => void) => boolean; + /** + * load an array of nodes (will also load unavailable nodes as soon as the appear in the structure). Used internally. + * @private + * @name _load_nodes(nodes [, callback]) + * @param {array} nodes + * @param {function} callback a function to be executed once loading is complete, the function is executed in the instance's scope and receives one argument - the array passed to _load_nodes + * @param {Boolean} is_callback - if false reloads node (AP - original comment missing in source code) + */ + _load_nodes: (nodes: any[], callback?: (nodes: any[]) => void, is_callback?: boolean) => void; + + /** + * loads all unloaded nodes + * @name load_all([obj, callback]) + * @param {mixed} obj the node to load recursively, omit to load all nodes in the tree + * @param {function} callback a function to be executed once loading all the nodes is complete, + * @trigger load_all.jstree + */ + load_all: (obj: any, callback: () => void) => void; + + /** + * handles the actual loading of a node. Used only internally. + * @private + * @name _load_node(obj [, callback]) + * @param {mixed} obj + * @param {function} callback a function to be executed once loading is complete, the function is executed in the instance's scope and receives one argument - a boolean status + * @return {Boolean} + */ + _load_node: (obj: any, callback?: (status: boolean) => void) => boolean; + + /** + * adds a node to the list of nodes to redraw. Used only internally. + * @private + * @name _node_changed(obj) + * @param {mixed} obj + */ + _node_changed: (obj: any) => void; + + /** + * appends HTML content to the tree. Used internally. + * @private + * @name _append_html_data(obj, data) + * @param {mixed} obj the node to append to + * @param {String} data the HTML string to parse and append + * @param {function} callback function which takes boolean flag executes after append (AP: originally lack of comment) + * @trigger model.jstree, changed.jstree + */ + _append_html_data: (dom: any, data: string, cb: (flag: boolean) => void) => void; + + /** + * appends JSON content to the tree. Used internally. + * @private + * @name _append_json_data(obj, data) + * @param {mixed} dom the node to append to + * @param {String} data the JSON object to parse and append + * @param {function} cb function which takes boolean flag executes after append (AP: originally lack of comment) + * @param {Boolean} force_processing internal param - do not set + * @trigger model.jstree, changed.jstree + */ + _append_json_data: (dom: any, data: string, cb: (flag: boolean) => void, force_processing: boolean) => void; + + /** + * parses a node from a jQuery object and appends them to the in memory tree model. Used internally. + * @private + * @name _parse_model_from_html(d [, p, ps]) + * @param {jQuery} d the jQuery object to parse + * @param {String} p the parent ID + * @param {Array} ps list of all parents + * @return {String} the ID of the object added to the model + */ + _parse_model_from_html: (d: JQuery, p?: string, ps?: any[]) => string; + + /** + * parses a node from a JSON object (used when dealing with flat data, which has no nesting of children, but has id and parent properties) and appends it to the in memory tree model. Used internally. + * @private + * @name _parse_model_from_flat_json(d [, p, ps]) + * @param {Object} d the JSON object to parse + * @param {String} p the parent ID + * @param {Array} ps list of all parents + * @return {String} the ID of the object added to the model + */ + _parse_model_from_flat_json: (d: any, p?: string, ps?: any[]) => string; + + /** + * parses a node from a JSON object and appends it to the in memory tree model. Used internally. + * @private + * @name _parse_model_from_json(d [, p, ps]) + * @param {Object} d the JSON object to parse + * @param {String} p the parent ID + * @param {Array} ps list of all parents + * @return {String} the ID of the object added to the model + */ + _parse_model_from_json: (d: any, p?: string, ps?: any[]) => string; + + /** + * redraws all nodes that need to be redrawn. Used internally. + * @private + * @name _redraw() + * @trigger redraw.jstree + */ + _redraw: () => void ; + /** * redraws all nodes that need to be redrawn or optionally - the whole tree * @name redraw([full]) @@ -770,6 +1033,25 @@ interface JSTree extends JQuery { */ redraw: (full?: boolean) => void; + /** + * redraws a single node's children. Used internally. + * @private + * @name draw_children(node) + * @param {mixed} node the node whose children will be redrawn + */ + draw_children: (node: any) => void; + + /** + * redraws a single node. Used internally. + * @private + * @name redraw_node(node, deep, is_callback, force_render) + * @param {mixed} node the node to redraw + * @param {Boolean} deep should child nodes be redrawn too + * @param {Boolean} is_callback is this a recursion call + * @param {Boolean} force_render should children of closed parents be drawn anyway + */ + redraw_node: (node: any, deep: boolean, is_callback: boolean, force_render: boolean) => void; + /** * opens a node, revaling its children. If the node is not loaded it will be loaded and opened once ready. * @name open_node(obj [, callback, animation]) @@ -781,6 +1063,14 @@ interface JSTree extends JQuery { */ open_node: (obj: any, callback?: any, animation?: any) => void; + /** + * opens every parent of a node (node should be loaded) + * @name _open_to(obj) + * @param {mixed} obj the node to reveal + * @private + */ + _open_to: (obj:any) => void; + /** * closes a node, hiding its children * @name close_node(obj [, animation]) @@ -841,6 +1131,34 @@ interface JSTree extends JQuery { */ disable_node: (obj: any) => boolean; + /** + * called when a node is selected by the user. Used internally. + * @private + * @name activate_node(obj, e) + * @param {mixed} obj the node + * @param {Object} e the related event + * @trigger activate_node.jstree, changed.jstree + */ + activate_node: (obj: any, e: any) => void; + + /** + * applies the hover state on a node, called when a node is hovered by the user. Used internally. + * @private + * @name hover_node(obj) + * @param {mixed} obj + * @trigger hover_node.jstree + */ + hover_node: (obj: any) => void; + + /** + * removes the hover state from a nodecalled when a node is no longer hovered by the user. Used internally. + * @private + * @name dehover_node(obj) + * @param {mixed} obj + * @trigger dehover_node.jstree + */ + dehover_node: (obj: any) => void; + /** * select a node * @name select_node(obj [, supress_event, prevent_open]) @@ -908,6 +1226,24 @@ interface JSTree extends JQuery { */ get_bottom_selected: (full?: any) => any[]; + /** + * gets the current state of the tree so that it can be restored later with `set_state(state)`. Used internally. + * @name get_state() + * @private + * @return {Object} + */ + get_state: () => any; + + /** + * sets the state of the tree. Used internally. + * @name set_state(state [, callback]) + * @private + * @param {Object} state the state to restore + * @param {Function} callback an optional function to execute once the state is restored. + * @trigger set_state.jstree + */ + set_state: (state: any, callback: () => void) => void; + /** * refreshes the tree - all nodes are reloaded with calls to `load_node`. * @name refresh() @@ -943,6 +1279,17 @@ interface JSTree extends JQuery { */ get_text: (obj: any) => string; + /** + * set the text value of a node. Used internally, please use `rename_node(obj, val)`. + * @private + * @name set_text(obj, val) + * @param {mixed} obj the node, you can pass an array to set the text on multiple nodes + * @param {String} val the new text value + * @return {Boolean} + * @trigger set_text.jstree + */ + set_text: (obj:any, val:string) => boolean; + /** * gets a JSON representation of a node (or the whole tree) * @name get_json([obj, options]) @@ -989,6 +1336,19 @@ interface JSTree extends JQuery { */ delete_node: (obj: any) => boolean; + /** + * check if an operation is premitted on the tree. Used internally. + * @private + * @name check(chk, obj, par, pos) + * @param {String} chk the operation to check, can be "create_node", "rename_node", "delete_node", "copy_node" or "move_node" + * @param {mixed} obj the node + * @param {mixed} par the parent + * @param {mixed} pos the position to insert at, or if "rename_node" - the new name + * @param {mixed} more some various additional information, for example if a "move_node" operations is triggered by DND this will be the hovered node + * @return {Boolean} + */ + check: (chk: string, obj: any, par: any, pos: any, more: any) => boolean; + /** * get the last error * @name last_error() @@ -1005,9 +1365,10 @@ interface JSTree extends JQuery { * @param {function} callback a function to call once the move is completed, receives 3 arguments - the node, the new parent and the position * @param {Boolean} is_loaded internal parameter indicating if the parent node has been loaded * @param {Boolean} skip_redraw internal parameter indicating if the tree should be redrawn + * @param {Boolean} instance internal parameter indicating if the node comes from another instance * @trigger move_node.jstree */ - move_node: (obj: any, par: any, pos?: any, callback?: (node: any, new_par: any, pos: any) => void, is_loaded?: boolean, skip_redraw?: boolean) => void; + move_node: (obj: any, par: any, pos?: any, callback?: (node: any, new_par: any, pos: any) => void, is_loaded?: boolean, skip_redraw?: boolean, origin?: boolean) => void; /** * copy a node to a new parent @@ -1018,9 +1379,10 @@ interface JSTree extends JQuery { * @param {function} callback a function to call once the move is completed, receives 3 arguments - the node, the new parent and the position * @param {Boolean} is_loaded internal parameter indicating if the parent node has been loaded * @param {Boolean} skip_redraw internal parameter indicating if the tree should be redrawn + * @param {Boolean} instance internal parameter indicating if the node comes from another instance * @trigger model.jstree copy_node.jstree */ - copy_node: (obj: any, par: any, pos?: any, callback?: (node: any, new_par: any, pos: any) => void, is_loaded?: boolean, skip_redraw?: boolean) => void; + copy_node: (obj: any, par: any, pos?: any, callback?: (node: any, new_par: any, pos: any) => void, is_loaded?: boolean, skip_redraw?: boolean, origin?: boolean) => void; /** * cut a node (a later call to `paste(obj)` would move the node) @@ -1193,15 +1555,12 @@ interface JSTree extends JQuery { show_icon: (obj: any) => void; /** - * redraws a single node. Used internally. + * set the undetermined state where and if necessary. Used internally. * @private - * @name redraw_node(node, deep, is_callback) - * @param {mixed} node the node to redraw - * @param {Boolean} deep should child nodes be redrawn too - * @param {Boolean} is_callback is this a recursion call - * @param {Boolean} force_render should children of closed parents be drawn anyway + * @name _undetermined() + * @plugin checkbox */ - redraw_node: (obj: any, deep?: boolean, is_callback?: boolean, force_render?: boolean) => any; + _undetermined: () => void; /** * show the node checkbox icons @@ -1232,16 +1591,6 @@ interface JSTree extends JQuery { */ is_undetermined: (obj: any) => boolean; - /** - * called when a node is selected by the user. Used internally. - * @private - * @name activate_node(obj, e) - * @param {mixed} obj the node - * @param {Object} e the related event - * @trigger activate_node.jstree, changed.jstree - */ - activate_node: (obj: any, e: any) => any; - /** * check a node (only if tie_selection in checkbox settings is false, otherwise select_node will be called internally) * @name check_node(obj) @@ -1315,7 +1664,6 @@ interface JSTree extends JQuery { /** * context menu plugin */ - teardown: () => void; /** * prepare and show the context menu for a node @@ -1329,16 +1677,31 @@ interface JSTree extends JQuery { */ show_contextmenu: (obj: any, x?: number, y?: number, e?: any) => void; + /** + * show the prepared context menu for a node + * @name _show_contextmenu(obj, x, y, i) + * @param {mixed} obj the node + * @param {Number} x the x-coordinate relative to the document to show the menu at + * @param {Number} y the y-coordinate relative to the document to show the menu at + * @param {Number} i the object of items to show + * @plugin contextmenu + * @trigger show_contextmenu.jstree + * @private + */ + _show_contextmenu: (obj: any, x: number, y: number, i: number) => void; + /** * used to search the tree nodes for a given string * @name search(str [, skip_async]) * @param {String} str the search string * @param {Boolean} skip_async if set to true server will not be queried even if configured * @param {Boolean} show_only_matches if set to true only matching nodes will be shown (keep in mind this can be very slow on large trees or old browsers) + * @param {mixed} inside an optional node to whose children to limit the search + * @param {Boolean} append if set to true the results of this search are appended to the previous search * @plugin search * @trigger search.jstree */ - search: (str: string, skip_async?: boolean, show_only_matches?: boolean) => void; + search: (str: string, skip_async?: boolean, show_only_matches?: boolean, inside?: any, append?: boolean) => void; /** * used to clear the last search (removes classes and shows all nodes if filtering is on) @@ -1348,6 +1711,15 @@ interface JSTree extends JQuery { */ clear_search: () => void; + /** + * opens nodes that need to be opened to reveal the search results. Used only internally. + * @private + * @name _search_open(d) + * @param {Array} d an array of node IDs + * @plugin search + */ + _search_open: (d: string[]) => void; + /** * used to sort a node's children * @private diff --git a/kafka-node/kafka-node-test.ts b/kafka-node/kafka-node-test.ts new file mode 100644 index 000000000..607ad5c19 --- /dev/null +++ b/kafka-node/kafka-node-test.ts @@ -0,0 +1,157 @@ +/// + +import kafka = require('kafka-node'); + +var basicClient = new kafka.Client('localhost:2181/', 'sendMessage'); + +var optionsClient = new kafka.Client('localhost:2181/', 'sendMessage', { + sessionTimeout: 30000, + spinDelay: 1000, + retries: 0 +}); +optionsClient.close(); +optionsClient.close(function(){}); + +var producer = new kafka.Producer(basicClient); +producer.on('error', function(error: Error){}); +producer.on('ready', function(){ + + var messages = [{ + topic: 'topicName', + messages: ['message body'], + partition: 0, + attributes: 2 + }, { + topic: 'topicName', + messages: ['message body'], + partition: 0 + }, { + topic: 'topicName', + messages: ['message body'], + attributes: 0 + }, { + topic: 'topicName', + messages: ['message body'] + }, { + topic: 'topicName', + messages: [new kafka.KeyedMessage('key', 'message')] + }]; + + producer.send(messages, function(err: Error){}); + producer.send(messages, function(err: Error, data: Object){}); + + producer.createTopics(['t'], true, function (err: Error, data: Object) {}); + producer.createTopics(['t'], false, function (err, data) {}); + // producer.createTopics(['t'], function (err: Error, data: Object) {}); // Omitting middle argument is not possible in TS + +}); + +var highLevelProducer = new kafka.HighLevelProducer(basicClient); +highLevelProducer.on('error', function(error: Error){}); +highLevelProducer.on('ready', function(){ + + var messages = [{ + topic: 'topicName', + messages: ['message body'], + attributes: 2 + }, { + topic: 'topicName', + messages: ['message body'], + partition: 0 + }, { + topic: 'topicName', + messages: ['message body'], + attributes: 0 + }, { + topic: 'topicName', + messages: ['message body'] + }, { + topic: 'topicName', + messages: [new kafka.KeyedMessage('key', 'message')] + }]; + + producer.send(messages, function(err: Error){}); + producer.send(messages, function(err: Error, data: Object){}); + + producer.createTopics(['t'], true, function (err: Error, data: Object) {}); + producer.createTopics(['t'], false, function (err, data) {}); + // producer.createTopics(['t'], function (err: Error, data: Object) {}); // Omitting middle argument is not possible in TS + +}); + +var fetchRequests = [{ topic: 'awesome' }]; +var consumer = new kafka.Consumer(basicClient, fetchRequests, { + groupId: 'abcde', + autoCommit: true +}); +consumer.on('error', function(error: Error){}); +consumer.on('message', function(message){}); + +consumer.addTopics(['t1', 't2'], function (err, added) {}); +consumer.addTopics([{ topic: 't1', offset: 10 }], function (err, added) {}, true); + +consumer.removeTopics(['t1', 't2'], function (err, removed) {}); + +consumer.commit(function (err, data) {}); + +consumer.setOffset('topic', 0, 0); + +consumer.pause(); +consumer.resume(); +consumer.pauseTopics([ + 'topic1', + { topic: 'topic2', partition: 0 } +]); +consumer.resumeTopics([ + 'topic1', + { topic: 'topic2', partition: 0 } +]); + +consumer.close(true, function () {}); + +var fetchRequests = [{ topic: 'awesome' }]; +var hlConsumer = new kafka.HighLevelConsumer(basicClient, fetchRequests, { + groupId: 'abcde', + autoCommit: true +}); + +hlConsumer.on('error', function(error: Error){}); +hlConsumer.on('message', function(message){}); +hlConsumer.addTopics(['t1', 't2'], function (err, added) {}); +hlConsumer.addTopics([{ topic: 't1', offset: 10 }], function (err, added) {}, true); + +hlConsumer.removeTopics(['t1', 't2'], function (err, removed) {}); + +hlConsumer.commit(function (err, data) {}); + +hlConsumer.setOffset('topic', 0, 0); + +hlConsumer.pause(); +hlConsumer.resume(); +hlConsumer.pauseTopics([ + 'topic1', + { topic: 'topic2', partition: 0 } +]); +hlConsumer.resumeTopics([ + 'topic1', + { topic: 'topic2', partition: 0 } +]); + +hlConsumer.close(true, function () {}); + +var offset = new kafka.Offset(basicClient); + +offset.on('ready', function(){}); + +offset.fetch([ + { topic: 't', partition: 0, time: Date.now(), maxNum: 1 }, + { topic: 't' } +], function (err, data) { }); + +offset.commit('groupId', [ + { topic: 't', partition: 0, offset: 10 } +], function (err, data) { }); + +offset.fetchCommits('groupId', [ + { topic: 't', partition: 0 } +], function (err, data) {}); diff --git a/kafka-node/kafka-node.d.ts b/kafka-node/kafka-node.d.ts new file mode 100644 index 000000000..03105805a --- /dev/null +++ b/kafka-node/kafka-node.d.ts @@ -0,0 +1,123 @@ +// Type definitions for kafka-node 0.2.22 +// Project: https://github.com/SOHU-Co/kafka-node/ +// Definitions by: Daniel Imrie-Situnayake +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module 'kafka-node' { + + // # Classes + export class Client { + constructor(connectionString: string, clientId: string, options?: ZKOptions); + close(callback?: Function): void; + } + + export class Producer { + constructor(client: Client); + on(eventName: string, cb: () => any): void; + on(eventName: string, cb: (error: any) => any): void; + send(payloads: Array, cb: (error: any, data: any) => any): void; + createTopics(topics: Array, async: boolean, cb?: (error: any, data: any) => any): void; + } + + export class HighLevelProducer { + constructor(client: Client); + on(eventName: string, cb: () => any): void; + on(eventName: string, cb: (error: any) => any): void; + send(payloads: Array, cb: (error: any, data: any) => any): void; + createTopics(topics: Array, async: boolean, cb?: (error: any, data: any) => any): void; + } + + export class Consumer { + constructor(client: Client, fetchRequests: Array, options: ConsumerOptions); + on(eventName: string, cb: (message: string) => any): void; + on(eventName: string, cb: (error: any) => any): void; + addTopics(topics: Array, cb: (error: any, added: boolean) => any): void; + addTopics(topics: Array, cb: (error: any, added: boolean) => any, fromOffset: boolean): void; + removeTopics(topics: Array, cb: (error: any, removed: boolean) => any): void; + commit(cb: (error: any, data: any) => any): void; + setOffset(topic: string, partition: number, offset: number): void; + pause(): void; + resume(): void; + pauseTopics(topics: Array /* Array */): void; + resumeTopics(topics: Array /* Array */): void; + close(force: boolean, cb: () => any): void; + } + + export class HighLevelConsumer { + constructor(client: Client, payloads: Array, options: ConsumerOptions); + on(eventName: string, cb: (message: string) => any): void; + on(eventName: string, cb: (error: any) => any): void; + addTopics(topics: Array, cb: (error: any, added: boolean) => any): void; + addTopics(topics: Array, cb: (error: any, added: boolean) => any, fromOffset: boolean): void; + removeTopics(topics: Array, cb: (error: any, removed: boolean) => any): void; + commit(cb: (error: any, data: any) => any): void; + setOffset(topic: string, partition: number, offset: number): void; + pause(): void; + resume(): void; + pauseTopics(topics: Array /* Array */): void; + resumeTopics(topics: Array /* Array */): void; + close(force: boolean, cb: () => any): void; + } + + export class Offset { + constructor(client: Client); + on(eventName: string, cb: () => any): void; + fetch(payloads: Array, cb: (error: any, data: any) => any): void; + commit(groupId: string, payloads: Array, cb: (error: any, data: any) => any): void; + fetchCommits(groupId: string, payloads: Array, cb: (error: any, data: any) => any): void; + } + + export class KeyedMessage { + constructor(key: string, message: string); + } + + // # Interfaces + export interface ZKOptions { + sessionTimeout?: number; + spinDelay?: number; + retries?: number; + } + + export interface ProduceRequest { + topic: string; + messages: any; // Array | Array | string | KeyedMessage + partition?: number; + attributes?: number; + } + + export interface ConsumerOptions { + groupId?: string; + autoCommit?: boolean; + autoCommitIntervalMs?: number; + fetchMaxWaitMs?: number; + fetchMinBytes?: number; + fetchMaxBytes?: number; + fromOffset?: boolean; + encoding?: string; + } + + export interface Topic { + topic: string; + offset?: number; + } + + export interface OffsetRequest { + topic: string; + partition?: number; + time?: number; + maxNum?: number; + } + + export interface OffsetCommitRequest { + topic: string; + partition?: number; + offset: number; + metadata?: string; + } + + export interface OffsetFetchRequest { + topic: string; + partition?: number; + } + +} diff --git a/knex/knex-test.ts b/knex/knex-test.ts new file mode 100644 index 000000000..39b441d6b --- /dev/null +++ b/knex/knex-test.ts @@ -0,0 +1,569 @@ +/// +/// +import Knex = require('knex'); +import _ = require('lodash'); +'use strict'; +// Initializing the Library +var knex = Knex({ + client: 'sqlite3', + connection: { + filename: "./mydb.sqlite" + } +}); + +var knex = Knex({ + client: 'mysql', + connection: { + socketPath : '/path/to/socket.sock', + user : 'your_database_user', + password : 'your_database_password', + database : 'myapp_test' + } +}); + +// Pooling +var knex = Knex({ + client: 'mysql', + connection: { + host : '127.0.0.1', + user : 'your_database_user', + password : 'your_database_password', + database : 'myapp_test' + }, + pool: { + min: 0, + max: 7 + } +}); + +// Migrations +var knex = Knex({ + client: 'mysql', + connection: { + host : '127.0.0.1', + user : 'your_database_user', + password : 'your_database_password', + database : 'myapp_test' + }, + migrations: { + tableName: 'migrations' + } +}); + +// Knex Query Builder +knex.select('title', 'author', 'year').from('books'); +knex.select().table('books'); + +knex.avg('sum_column1').from(function() { + this.sum('column1 as sum_column1').from('t1').groupBy('column1').as('t1') +}).as('ignored_alias'); + +knex.column('title', 'author', 'year').select().from('books'); +knex.column(['title', 'author', 'year']).select().from('books'); +knex.select('*').from('users'); + +knex('users').where({ + first_name: 'Test', + last_name: 'User' +}).select('id'); + +knex('users').where('id', 1); + +knex('users').where(() => { + this.where('id', 1).orWhere('id', '>', 10) +}).orWhere({name: 'Tester'}); + +knex('users').where('votes', '>', 100); + +var subquery = knex('users').where('votes', '>', 100).andWhere('status', 'active').orWhere('name', 'John').select('id'); +knex('accounts').where('id', 'in', subquery); + +knex.select('name').from('users') + .whereIn('id', [1, 2, 3]) + .orWhereIn('id', [4, 5, 6]); + +var subquery = knex.select('id').from('accounts'); +knex.select('name').from('users') + .whereIn('account_id', subquery); + +knex('users') + .where('name', '=', 'John') + .orWhere(function() { + this.where('votes', '>', 100).andWhere('title', '<>', 'Admin'); + }); + +knex('users').whereNotIn('id', [1, 2, 3]); + +knex('users').where('name', 'like', '%Test%').orWhereNotIn('id', [1, 2, 3]); + +knex('users').whereNull('updated_at'); + +knex('users').whereNotNull('created_at'); + +knex('users').whereExists(function() { + this.select('*').from('accounts').whereRaw('users.account_id = accounts.id'); +}); + +knex('users').whereExists(knex.select('*').from('accounts').whereRaw('users.account_id = accounts.id')); + +knex('users').whereNotExists(function() { + this.select('*').from('accounts').whereRaw('users.account_id = accounts.id'); +}); + +knex('users').whereBetween('votes', [1, 100]); + +knex('users').whereNotBetween('votes', [1, 100]); + +knex('users').whereRaw('id = ?', [1]); + +// Join methods +knex('users') + .join('contacts', 'users.id', '=', 'contacts.user_id') + .select('users.id', 'contacts.phone'); + +knex('users') + .join('contacts', 'users.id', 'contacts.user_id') + .select('users.id', 'contacts.phone'); + +knex.select('*').from('users').join('accounts', function() { + this.on('accounts.id', '=', 'users.account_id').orOn('accounts.owner_id', '=', 'users.id') +}); + +knex.select('*').from('users').join('accounts', 'accounts.type', knex.raw('?', ['admin'])); + +knex.from('users').innerJoin('accounts', 'users.id', 'accounts.user_id'); + +knex.table('users').innerJoin('accounts', 'users.id', '=', 'accounts.user_id'); + +knex('users').innerJoin('accounts', function() { + this.on('accounts.id', '=', 'users.account_id').orOn('accounts.owner_id', '=', 'users.id') +}); + +knex.select('*').from('users').leftJoin('accounts', 'users.id', 'accounts.user_id'); + +knex.select('*').from('users').leftJoin('accounts', function() { + this.on('accounts.id', '=', 'users.account_id').orOn('accounts.owner_id', '=', 'users.id') +}); + +knex.select('*').from('users').leftOuterJoin('accounts', 'users.id', 'accounts.user_id'); + +knex.select('*').from('users').leftOuterJoin('accounts', function() { + this.on('accounts.id', '=', 'users.account_id').orOn('accounts.owner_id', '=', 'users.id') +}); + +knex.select('*').from('users').rightJoin('accounts', 'users.id', 'accounts.user_id'); + +knex.select('*').from('users').rightJoin('accounts', function() { + this.on('accounts.id', '=', 'users.account_id').orOn('accounts.owner_id', '=', 'users.id') +}); + +knex.select('*').from('users').rightOuterJoin('accounts', 'users.id', 'accounts.user_id'); + +knex.select('*').from('users').rightOuterJoin('accounts', function() { + this.on('accounts.id', '=', 'users.account_id').orOn('accounts.owner_id', '=', 'users.id') +}); + +knex.select('*').from('users').outerJoin('accounts', 'users.id', 'accounts.user_id'); + +knex.select('*').from('users').outerJoin('accounts', function() { + this.on('accounts.id', '=', 'users.account_id').orOn('accounts.owner_id', '=', 'users.id') +}); + +knex.select('*').from('users').fullOuterJoin('accounts', 'users.id', 'accounts.user_id'); + +knex.select('*').from('users').fullOuterJoin('accounts', function() { + this.on('accounts.id', '=', 'users.account_id').orOn('accounts.owner_id', '=', 'users.id') +}); + +knex.select('*').from('users').crossJoin('accounts', 'users.id', 'accounts.user_id'); + +knex.select('*').from('accounts').joinRaw('natural full join table1').where('id', 1); + +knex.select('*').from('accounts').join(knex.raw('natural full join table1')).where('id', 1); + +knex('customers') + .distinct('first_name', 'last_name') + .select(); + +knex('users').groupBy('count'); + +knex.select('year', knex.raw('SUM(profit)')).from('sales').groupByRaw('year WITH ROLLUP'); + +knex('users').orderBy('name', 'desc'); + +knex.select('*').from('table').orderByRaw('col NULLS LAST DESC'); + +knex('books').insert({title: 'Slaughterhouse Five'}); + +knex('coords').insert([{x: 20}, {y: 30}, {x: 10, y: 20}]); + +knex.insert([{title: 'Great Gatsby'}, {title: 'Fahrenheit 451'}], 'id').into('books'); + +knex('books') + .returning('id') + .insert({title: 'Slaughterhouse Five'}); + +knex('books') + .returning('id') + .insert([{title: 'Great Gatsby'}, {title: 'Fahrenheit 451'}]); + +knex('books') + .where('published_date', '<', 2000) + .update({ + status: 'archived' + }); + +knex('books').update('title', 'Slaughterhouse Five'); + +knex('accounts') + .where('activated', false) + .del(); + +var someExternalMethod: Function; + +knex.transaction(function(trx) { + knex('books').transacting(trx).insert({name: 'Old Books'}) + .then(function(resp) { + var id = resp[0]; + return someExternalMethod(id, trx); + }) + .then(trx.commit) + .catch(trx.rollback); + +}).then(function() { + console.log('Transaction complete.'); +}).catch(function(err) { + console.error(err); +}); + +knex.transaction(function(trx) { + knex('tableName') + .transacting(trx) + .forUpdate() + .select('*'); + + knex('tableName') + .transacting(trx) + .forShare() + .select('*') +}); + +knex('users').count('active'); + +knex('users').min('age'); + +knex('users').min('age as a'); + +knex('users').max('age'); + +knex('users').max('age as a'); + +knex('users').sum('products'); + +knex('users').sum('products as p'); + +knex('users').avg('age'); + +knex('users').avg('age as a'); + +knex('accounts') + .where('userid', '=', 1) + .increment('balance', 10); + +knex('accounts').where('userid', '=', 1).decrement('balance', 5); + +knex('accounts').truncate(); + +knex.table('users').pluck('id').then(function(ids) { + console.log(ids); +}); + +knex.table('users').first('id', 'name').then(function(row) { + console.log(row); +}); + +// Using trx as a query builder: +knex.transaction(function(trx) { + + var info: any; + var books: any[] = [ + {title: 'Canterbury Tales'}, + {title: 'Moby Dick'}, + {title: 'Hamlet'} + ]; + + return trx + .insert({name: 'Old Books'}, 'id') + .into('catalogues') + .then(function(ids) { + return Promise.map(books, function(book) { + book.catalogue_id = ids[0]; + // Some validation could take place here. + return trx.insert(info).into('books'); + }); + }); +}) +.then(function(inserts) { + console.log(inserts.length + ' new books saved.'); +}) +.catch(function(error) { + // If we get here, that means that neither the 'Old Books' catalogues insert, + // nor any of the books inserts will have taken place. + console.error(error); +}); + +// Using trx as a transaction object: +knex.transaction(function(trx) { + + var info: any; + var books: any[] = [ + {title: 'Canterbury Tales'}, + {title: 'Moby Dick'}, + {title: 'Hamlet'} + ]; + + knex.insert({name: 'Old Books'}, 'id') + .into('catalogues') + .transacting(trx) + .then(function(ids) { + return Promise.map(books, function(book) { + book.catalogue_id = ids[0]; + + // Some validation could take place here. + + return knex.insert(info).into('books').transacting(trx); + }); + }) + .then(trx.commit) + .catch(trx.rollback); +}) +.then(function(inserts) { + console.log(inserts.length + ' new books saved.'); +}) +.catch(function(error) { + // If we get here, that means that neither the 'Old Books' catalogues insert, + // nor any of the books inserts will have taken place. + console.error(error); +}); + +knex.schema.createTable('users', function (table) { + table.increments(); + table.string('name'); + table.timestamps(); +}); + +knex.schema.renameTable('users', 'old_users'); + +knex.schema.dropTable('users'); + +knex.schema.hasTable('users').then(function(exists) { + if (!exists) { + return knex.schema.createTable('users', function(t) { + t.increments('id').primary(); + t.string('first_name', 100); + t.string('last_name', 100); + t.text('bio'); + }); + } +}); + +var tableName: string; +var columnName: string; +knex.schema.hasColumn(tableName, columnName); + +knex.schema.dropTableIfExists('users'); + +knex.schema.table('users', function (table) { + table.dropColumn('name'); + table.string('first_name'); + table.string('last_name'); +}); + +knex.schema.raw("SET sql_mode='TRADITIONAL'") +.table('users', function (table) { + table.dropColumn('name'); + table.string('first_name'); + table.string('last_name'); +}); + +knex('users') + .select(knex.raw('count(*) as user_count, status')) + .where(knex.raw(1)) + .orWhere(knex.raw('status <> ?', [1])) + .groupBy('status'); + + knex.raw('select * from users where id = ?', [1]).then(function(resp) { + // ... + }); + +(() => { + var subcolumn = knex.raw('select avg(salary) from employee where dept_no = e.dept_no') + .wrap('(', ') avg_sal_dept'); + + knex.select('e.lastname', 'e.salary', subcolumn) + .from('employee as e') + .whereRaw('dept_no = e.dept_no'); +})(); + +(() => { + var subcolumn = knex.avg('salary') + .from('employee') + .whereRaw('dept_no = e.dept_no') + .as('avg_sal_dept'); + + knex.select('e.lastname', 'e.salary', subcolumn) + .from('employee as e') + .whereRaw('dept_no = e.dept_no'); +})(); + +var x: number; +knex.select('name').from('users') + .where('id', '>', 20) + .andWhere('id', '<', 200) + .limit(10) + .offset(x) + .then(function(rows: any) { + return _.pluck(rows, 'name'); + }) + .then(function(names: any) { + return knex.select('id').from('nicknames').whereIn('nickname', names); + }) + .then(function(rows) { + console.log(rows); + }) + .catch(function(error) { + console.error(error) + }); + +knex.select('*').from('users').where({name: 'Tim'}) + .then(function(rows) { + return knex.insert({user_id: rows[0].id, name: 'Test'}, 'id').into('accounts'); + }).then(function(id) { + console.log('Inserted Account ' + id); + }).catch(function(error) { + console.error(error); + }); + +knex.insert({id: 1, name: 'Test'}, 'id').into('accounts') + .catch(function(error) { + console.error(error); + }).then(function() { + return knex.select('*').from('accounts').where('id', 1); + }).then(function(rows) { + console.log(rows[0]); + }).catch(function(error) { + console.error(error); + }); + +var query: any; +query.then(function(x: any) { + // doSideEffectsHere(x); + return x; +}); + +knex.select('name').from('users').limit(10).map(function(row: any) { + return row.name; +}).then(function(names) { + console.log(names); +}).catch(function(e) { + console.error(e); +}); + +knex.select('name').from('users').limit(10).reduce(function(memo: any, row: any) { + memo.names.push(row.name); + memo.count++; + return memo; +}, {count: 0, names: []}).then(function(obj) { + console.log(obj); +}).catch(function(e) { + console.error(e); +}); + +knex.select('name').from('users') + .limit(10) + .bind(console) + .then(console.log) + .catch(console.error); + +var values: any[]; +// Without return: +knex.insert(values).into('users') + .then(function() { + return {inserted: true}; + }); + +knex.insert(values).into('users').return({inserted: true}); + +knex.select('name').from('users') + .where('id', '>', 20) + .andWhere('id', '<', 200) + .limit(10) + .offset(x) + .exec(function(err: any, rows: any[]) { + if (err) return console.error(err); + knex.select('id').from('nicknames').whereIn('nickname', _.pluck(rows, 'name')) + .exec(function(err: any, rows: any[]) { + if (err) return console.error(err); + console.log(rows); + }); + }); + +// Retrieve the stream: +var stream = knex.select('*').from('users').stream(); +var writableStream: any; +stream.pipe(writableStream); + +// With options: +var stream = knex.select('*').from('users').stream({highWaterMark: 5}); +stream.pipe(writableStream); + +// Use as a promise: +(() => { + +var stream = knex.select('*').from('users').where(knex.raw('id = ?', [1])).stream(function(stream: any) { + stream.pipe(writableStream); +}).then(function() { + // ... +}).catch(function(e: Error) { + console.error(e); +}); + +})(); + +var stream = knex.select('*').from('users').pipe(writableStream); +var app: any; + +knex.select('*') + .from('users') + .on('query', function(data: any) { + app.log(data); + }) + .then(function() { + // ... + }); + + knex.select('*').from('users').where(knex.raw('id = ?', [1])).toString(); + + knex.select('*').from('users').where(knex.raw('id = ?', [1])).toSQL(); + +// +// Migrations +// +var config = { }; +knex.migrate.make(name, config); +knex.migrate.make(name); + +knex.migrate.latest(config); +knex.migrate.latest(); + +knex.migrate.rollback(config); +knex.migrate.rollback(); + +knex.migrate.currentversion(config); +knex.migrate.currentversion(); + +knex.seed.make(name, config); +knex.seed.make(name); + +knex.seed.run(config); +knex.seed.run(); diff --git a/knex/knex.d.ts b/knex/knex.d.ts new file mode 100644 index 000000000..d3216acf9 --- /dev/null +++ b/knex/knex.d.ts @@ -0,0 +1,457 @@ +// Type definitions for Knex.js +// Project: https://github.com/tgriesser/knex +// Definitions by: Qubo +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// +/// + +declare module "knex" { + import Promise = require("bluebird"); + import events = require("events"); + + type Callback = Function; + type Client = Function; + type Value = string|number|boolean|Date; + type ColumnName = string|Raw|QueryBuilder; + + module KnexStatic { + interface ConfigStatic { } + } + + interface KnexStatic { + (config: Config): Knex; + } + + interface Knex extends QueryInterface { } + + interface Knex { + (tableName?: string): QueryBuilder; + VERSION: string; + __knex__: string; + + raw: RawBuilder; + transaction: (transactionScope: ((trx: Transaction) => void)) => Promise; + destroy(callback: Function): void; + destroy(): Promise; + + client: any; + migrate: any; + seed: any; + fn: any; + } + + // + // QueryInterface + // + + interface QueryInterface { + select: Select; + as: As; + columns: Select; + column: Select; + from: Table; + into: Table; + table: Table; + distinct: Distinct; + + // Joins + join: Join; + joinRaw: JoinRaw; + innerJoin: Join; + leftJoin: Join; + leftOuterJoin: Join; + rightJoin: Join; + rightOuterJoin: Join; + outerJoin: Join; + fullOuterJoin: Join; + crossJoin: Join; + + // Wheres + where: Where; + andWhere: Where; + orWhere: Where; + whereRaw: WhereRaw; + whereWrapped: WhereWrapped; + havingWrapped: WhereWrapped; + orWhereRaw: WhereRaw; + whereExists: WhereExists; + orWhereExists: WhereExists; + whereNotExists: WhereExists; + orWhereNotExists: WhereExists; + whereIn: WhereIn; + orWhereIn: WhereIn; + whereNotIn: WhereIn; + orWhereNotIn: WhereIn; + whereNull: WhereNull; + orWhereNull: WhereNull; + whereNotNull: WhereNull; + orWhereNotNull: WhereNull; + whereBetween: WhereBetween; + whereNotBetween: WhereBetween; + orWhereBetween: WhereBetween; + orWhereNotBetween: WhereBetween; + + // Group by + groupBy: GroupBy; + groupByRaw: RawQueryBuilder; + + // Order by + orderBy: OrderBy; + orderByRaw: RawQueryBuilder; + + // Union + union: Union; + unionAll(callback: Function): QueryBuilder; + + // Having + having: Having; + havingRaw: RawQueryBuilder; + orHaving: Having; + orHavingRaw: RawQueryBuilder; + + // Paging + offset(offset: number): QueryBuilder; + limit(limit: number): QueryBuilder; + + // Aggregation + count(columnName?: string): QueryBuilder; + min(columnName: string): QueryBuilder; + max(columnName: string): QueryBuilder; + sum(columnName: string): QueryBuilder; + avg(columnName: string): QueryBuilder; + increment(columnName: string, amount?: number): QueryBuilder; + decrement(columnName: string, amount?: number): QueryBuilder; + + // Others + first(...columns: string[]): QueryBuilder; + + debug(enabled?: boolean): QueryBuilder; + pluck(column: string): QueryBuilder; + + insert(data: any, returning?: string): QueryBuilder; + update(data: any, returning?: string): QueryBuilder; + update(columnName: string, value: Value, returning?: string): QueryBuilder; + returning(column: string): QueryBuilder; + + del(returning?: string): QueryBuilder; + delete(returning?: string): QueryBuilder; + truncate(): QueryBuilder; + + transacting(trx: Transaction): QueryBuilder; + connection(connection: any): QueryBuilder; + } + + interface As { + (columnName: string): QueryBuilder; + } + + interface Select extends ColumnNameQueryBuilder { + } + + interface Table { + (tableName: string): QueryBuilder; + (callback: Function): QueryBuilder; + } + + interface Distinct extends ColumnNameQueryBuilder { + } + + interface Join { + (raw: Raw): QueryBuilder; + (tableName: string, callback: Function): QueryBuilder; + (tableName: string, column1: string, column2: string): QueryBuilder; + (tableName: string, column1: string, raw: Raw): QueryBuilder; + (tableName: string, column1: string, operator: string, column2: string): QueryBuilder; + } + + interface JoinRaw { + (tableName: string, binding?: Value): QueryBuilder; + } + + interface Where extends WhereRaw, WhereWrapped, WhereNull { + (object: Object): QueryBuilder; + (columnName: string, value: Value): QueryBuilder; + (columnName: string, operator: string, value: Value): QueryBuilder; + (columnName: string, operator: string, query: QueryBuilder): QueryBuilder; + } + + interface WhereRaw extends RawQueryBuilder { + (condition: boolean): QueryBuilder; + } + + interface WhereWrapped { + (callback: Function): QueryBuilder; + } + + interface WhereNull { + (columnName: string): QueryBuilder; + } + + interface WhereIn { + (columnName: string, values: Value[]): QueryBuilder; + (columnName: string, callback: Function): QueryBuilder; + (columnName: string, query: QueryBuilder): QueryBuilder; + } + + interface WhereBetween { + (columnName: string, range: [Value, Value]): QueryBuilder; + } + + interface WhereExists { + (callback: Function): QueryBuilder; + (query: QueryBuilder): QueryBuilder; + } + + interface WhereNull { + (columnName: string): QueryBuilder; + } + + interface WhereIn { + (columnName: string, values: Value[]): QueryBuilder; + } + + interface GroupBy extends RawQueryBuilder, ColumnNameQueryBuilder { + } + + interface OrderBy { + (columnName: string, direction?: string): QueryBuilder; + } + + interface Union { + (callback: Function, wrap?: boolean): QueryBuilder; + (callbacks: Function[], wrap?: boolean): QueryBuilder; + (...callbacks: Function[]): QueryBuilder; + // (...callbacks: Function[], wrap?: boolean): QueryInterface; + } + + interface Having extends RawQueryBuilder, WhereWrapped { + (tableName: string, column1: string, operator: string, column2: string): QueryBuilder; + } + + // commons + + interface ColumnNameQueryBuilder { + (...columnNames: ColumnName[]): QueryBuilder; + (columnNames: ColumnName[]): QueryBuilder; + } + + interface RawQueryBuilder { + (sql: string, ...bindings: Value[]): QueryBuilder; + (sql: string, bindings: Value[]): QueryBuilder; + (raw: Raw): QueryBuilder; + } + + // Raw + + interface Raw extends events.EventEmitter, ChainableInterface { + wrap(before: string, after: string): Raw; + } + + interface RawBuilder { + (value: Value): Raw; + (sql: string, ...bindings: Value[]): Raw; + (sql: string, bindings: Value[]): Raw; + } + + // + // QueryBuilder + // + + interface QueryBuilder extends QueryInterface, ChainableInterface { + or: QueryBuilder; + and: QueryBuilder; + + //TODO: Promise? + columnInfo(column?: string): Promise; + + forUpdate(): QueryBuilder; + forShare(): QueryBuilder; + + toSQL(): Sql; + + on(event: string, callback: Function): QueryBuilder; + } + + interface Sql { + method: string; + options: any; + bindings: Value[]; + sql: string; + } + + // + // Chainable interface + // + + interface ChainableInterface extends Promise { + toQuery(): string; + options(options: any): QueryBuilder; + stream(options?: any, callback?: (builder: QueryBuilder) => any): QueryBuilder; + stream(callback?: (builder: QueryBuilder) => any): QueryBuilder; + pipe(writable: any): QueryBuilder; + exec(callback: Function): QueryBuilder; + } + + interface Transaction extends QueryBuilder { + commit: any; + rollback: any; + } + + // + // Schema builder + // + + interface Knex { + schema: SchemaBuilder; + } + + interface SchemaBuilder { + createTable(tableName: string, callback: (tableBuilder: CreateTableBuilder) => any): void; + renameTable(oldTableName: string, newTableName: string): void; + dropTable(tableName: string): void; + hasTable(tableName: string): Promise; + hasColumn(tableName: string, columnName: string): Promise; + table(tableName: string, callback: (tableBuilder: AlterTableBuilder) => any): void; + dropTableIfExists(tableName: string): void; + raw(statement: string): SchemaBuilder; + } + + interface TableBuilder { + increments(columnName?: string): ColumnBuilder; + dropColumn(columnName: string): TableBuilder; + dropColumns(...columnNames: string[]): TableBuilder; + renameColumn(from: string, to: string): ColumnBuilder; + integer(columnName: string): ColumnBuilder; + bigInteger(columnName: string): ColumnBuilder; + text(columnName: string, textType?: string): ColumnBuilder; + string(columnName: string, length?: number): ColumnBuilder; + float(columnName: string, precision?: number, scale?: number): ColumnBuilder; + decimal(columnName: string, precision?: number, scale?: number): ColumnBuilder; + boolean(columnName: string): ColumnBuilder; + date(columnName: string): ColumnBuilder; + dateTime(columnName: string): ColumnBuilder; + time(columnName: string): ColumnBuilder; + timestamp(columnName: string): ColumnBuilder; + timestamps(): ColumnBuilder; + binary(columnName: string): ColumnBuilder; + enum(columnName: string): ColumnBuilder; + enu(columnName: string): ColumnBuilder; + json(columnName: string): ColumnBuilder; + uuid(columnName: string): ColumnBuilder; + comment(val: string): TableBuilder; + specificType(columnName: string, type: string): ColumnBuilder; + } + + interface CreateTableBuilder extends TableBuilder { + } + + interface MySqlTableBuilder extends CreateTableBuilder { + engine(val: string): CreateTableBuilder; + charset(val: string): CreateTableBuilder; + collate(val: string): CreateTableBuilder; + } + + interface AlterTableBuilder extends TableBuilder { + } + + interface MySqlAlterTableBuilder extends AlterTableBuilder { + } + + interface ColumnBuilder { + index(indexName?: string): ColumnBuilder; + primary(): ColumnBuilder; + unique(): ColumnBuilder; + references(columnName: string): ReferencingColumnBuilder; + onDelete(command: string): ColumnBuilder; + onUpdate(command: string): ColumnBuilder; + defaultTo(value: Value): ColumnBuilder; + unsigned(): ColumnBuilder; + notNullable(): ColumnBuilder; + nullable(): ColumnBuilder; + comment(value: string): ColumnBuilder; + } + + interface PostgreSqlColumnBuilder extends ColumnBuilder { + index(indexName?: string, indexType?: string): ColumnBuilder; + } + + interface ReferencingColumnBuilder { + inTable(tableName: string): ColumnBuilder; + } + + interface AlterColumnBuilder extends ColumnBuilder { + } + + interface MySqlAlterColumnBuilder extends AlterColumnBuilder { + first(): AlterColumnBuilder; + after(columnName: string): AlterColumnBuilder; + } + + // + // Configurations + // + + interface ColumnInfo { + defaultValue: Value; + type: string; + maxLength: number; + nullable: boolean; + } + + interface Config { + client?: string; + dialect?: string; + connection: string|ConnectionConfig| + Sqlite3ConnectionConfig|SocketConnectionConfig; + pool?: PoolConfig; + migrations?: MigrationConfig; + } + + interface ConnectionConfig { + host: string; + user: string; + password: string; + database: string; + debug?: boolean; + } + + /** Used with SQLite3 adapter */ + interface Sqlite3ConnectionConfig { + filename: string; + debug?: boolean; + } + + interface SocketConnectionConfig { + socketPath: string; + user: string; + password: string; + database: string; + debug?: boolean; + } + + interface PoolConfig { + name?: string; + create?: Function; + destroy?: Function; + min?: number; + max?: number; + refreshIdle?: boolean; + idleTimeoutMillis?: number; + reapIntervalMillis?: number; + returnToHead?: boolean; + priorityRange?: number; + validate?: Function; + log?: boolean; + } + + interface MigrationConfig { + database?: string; + directory?: string; + extension?: string; + tableName?: string; + } + + var _: KnexStatic; + export = _; +} diff --git a/knockout/knockout.d.ts b/knockout/knockout.d.ts index 5aa7c61cb..a906348a6 100644 --- a/knockout/knockout.d.ts +++ b/knockout/knockout.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Knockout v3.2.0-beta +// Type definitions for Knockout v3.2.0 // Project: http://knockoutjs.com // Definitions by: Boris Yankov , Igor Oleinikov , Clément Bourgeois // Definitions: https://github.com/borisyankov/DefinitelyTyped @@ -121,6 +121,8 @@ interface KnockoutBindingContext { $rawData: any | KnockoutObservable; $index?: KnockoutObservable; $parentContext?: KnockoutBindingContext; + $component: any; + $componentTemplateNodes: Node[]; extend(properties: any): any; createChildContext(dataItemOrAccessor: any, dataItemAlias?: any, extendCallback?: Function): any; @@ -133,8 +135,8 @@ interface KnockoutAllBindingsAccessor { } interface KnockoutBindingHandler { - init?: (element: any, valueAccessor: () => any, allBindingsAccessor: KnockoutAllBindingsAccessor, viewModel: any, bindingContext: KnockoutBindingContext) => void | { controlsDescendantBindings: boolean; }; - update?: (element: any, valueAccessor: () => any, allBindingsAccessor: KnockoutAllBindingsAccessor, viewModel: any, bindingContext: KnockoutBindingContext) => void; + init?: (element: any, valueAccessor: () => any, allBindingsAccessor?: KnockoutAllBindingsAccessor, viewModel?: any, bindingContext?: KnockoutBindingContext) => void | { controlsDescendantBindings: boolean; }; + update?: (element: any, valueAccessor: () => any, allBindingsAccessor?: KnockoutAllBindingsAccessor, viewModel?: any, bindingContext?: KnockoutBindingContext) => void; options?: any; preprocess?: (value: string, name: string, addBindingCallback?: (name: string, value: string) => void) => string; } @@ -559,94 +561,87 @@ interface KnockoutBindingProvider { getBindingAccessors?(node: Node, bindingContext: KnockoutBindingContext): { [key: string]: string; }; } -interface KnockoutComponents { - // overloads for register method: - register(componentName: string, config: KnockoutComponentRegister): void; - register(componentName: string, config: KnockoutComponentRegisterStringTemplate): void; - register(componentName: string, config: KnockoutComponentRegisterFnViewModel): void; - register(componentName: string, config: KnockoutComponentRegisterStringTemplateFnViewModel): void; - register(componentName: string, config: KnockoutComponentRegisterAMD): void; - register(componentName: string, config: {}): void; - - isRegistered(componentName: string): boolean; - unregister(componentName: string): void; - get(componentName: string, callback: (definition: KnockoutComponentDefinition) => void): void; - clearCachedDefinition(componentName: string): void - defaultLoader: KnockoutComponentLoader; - loaders: KnockoutComponentLoader[]; - getComponentNameForNode(node: Node): string; -} - -/* interfaces for register overloads*/ - -interface KnockoutComponentRegister { - template: KnockoutComponentTemplate; - viewModel?: KnockoutComponentConfigViewModel; -} - -interface KnockoutComponentRegisterAMD { - // load self-describing module using AMD module name - require: string; -} - -interface KnockoutComponentRegisterFnViewModel { - template: KnockoutComponentTemplate; - viewModel?: (params: any) => any; -} - -interface KnockoutComponentRegisterStringTemplate { - template: string; - viewModel?: KnockoutComponentConfigViewModel; -} - -interface KnockoutComponentRegisterStringTemplateFnViewModel { - template: string; - viewModel?: (params: any) => any; -} - -interface KnockoutComponentConfigViewModel { - instance?: any; - createViewModel? (params?: any, componentInfo?: KnockoutComponentInfo): any; - require?: string; -} - -interface KnockoutComponentTemplate { - // specify element id (string) or a node - element?: any; - // AMD module load - require?: string; -} - -interface KnockoutComponentInfo { - element: Node; -} -/* end register overloads */ -interface KnockoutComponentDefinition { - template: Node[]; - createViewModel?(params: any, options: { element: Node; }): any; -} - -interface KnockoutComponentLoader { - getConfig? (componentName: string, callback: (result: KnockoutComponentConfig) => void): void; - loadComponent? (componentName: string, config: KnockoutComponentConfig, callback: (result: KnockoutComponentDefinition) => void): void; - loadTemplate? (componentName: string, templateConfig: any, callback: (result: Node[]) => void): void; - loadViewModel? (componentName: string, viewModelConfig: any, callback: (result: any) => void): void; - suppressLoaderExceptions?: boolean; -} - -interface KnockoutComponentConfig { - template: any; - createViewModel?: any; -} - interface KnockoutComputedContext { getDependenciesCount(): number; isInitial: () => boolean; isSleeping: boolean; } -declare module "knockout" { - export = ko; +// +// refactored types into a namespace to reduce global pollution +// and used Union Types to simplify overloads (requires TypeScript 1.4) +// +declare module KnockoutComponentTypes { + + interface Config { + viewModel?: ViewModelFunction | ViewModelSharedInstance | ViewModelFactoryFunction | AMDModule; + template: string | Node[]| DocumentFragment | TemplateElement | AMDModule; + } + + interface ComponentConfig { + template: any; + createViewModel?: any; + } + + interface EmptyConfig { + } + + // common AMD type + interface AMDModule { + require: string; + } + + // viewmodel types + interface ViewModelFunction { + (params?: any): any; + } + + interface ViewModelSharedInstance { + instance: any; + } + + interface ViewModelFactoryFunction { + createViewModel: (params?: any, componentInfo?: ComponentInfo) => any; + } + + interface ComponentInfo { + element: Node; + templateNodes: Node[]; + } + + interface TemplateElement { + element: string | Node; + } + + interface Loader { + getConfig? (componentName: string, callback: (result: ComponentConfig) => void): void; + loadComponent? (componentName: string, config: ComponentConfig, callback: (result: Definition) => void): void; + loadTemplate? (componentName: string, templateConfig: any, callback: (result: Node[]) => void): void; + loadViewModel? (componentName: string, viewModelConfig: any, callback: (result: any) => void): void; + suppressLoaderExceptions?: boolean; + } + + interface Definition { + template: Node[]; + createViewModel? (params: any, options: { element: Node; }): any; + } +} + +interface KnockoutComponents { + // overloads for register method: + register(componentName: string, config: KnockoutComponentTypes.Config | KnockoutComponentTypes.EmptyConfig): void; + + isRegistered(componentName: string): boolean; + unregister(componentName: string): void; + get(componentName: string, callback: (definition: KnockoutComponentTypes.Definition) => void): void; + clearCachedDefinition(componentName: string): void + defaultLoader: KnockoutComponentTypes.Loader; + loaders: KnockoutComponentTypes.Loader[]; + getComponentNameForNode(node: Node): string; } declare var ko: KnockoutStatic; + +declare module "knockout" { + export = ko; +} diff --git a/knockout/tests/knockout-tests.ts b/knockout/tests/knockout-tests.ts index 7b0c8174e..e9334a753 100644 --- a/knockout/tests/knockout-tests.ts +++ b/knockout/tests/knockout-tests.ts @@ -605,52 +605,50 @@ function test_allBindingsAccessor() { }; } + function test_Components() { + // test all possible ko.components.register() overloads function test_Register() { - // test all possible ko.components.register() overloads + // reused parameters var nodeArray = [new Node, new Node]; var singleNode = new Node; + var viewModelFn = function (params: any) { return null; } - // ------- string-templates with different viewmodel overloads: + // ------- viewmodel overloads: - // string template and inline function (commonly used in examples) - ko.components.register("name", { template: "string-template", viewModel: function (params) { return null; } }); + // viewModel as inline function (commonly used in examples) + ko.components.register("name", { template: "string-template", viewModel: viewModelFn }); - // string template and instance vm + // viewModel from shared instance ko.components.register("name", { template: "string-template", viewModel: { instance: null } }); - // string template and createViewModel factory method - ko.components.register("name", { template: "string-template", viewModel: { createViewModel: function (params: any, componentInfo: KnockoutComponentInfo) { return null; } } }); + // viewModel from createViewModel factory method + ko.components.register("name", { template: "string-template", viewModel: { createViewModel: function (params: any, componentInfo: KnockoutComponentTypes.ComponentInfo) { return null; } } }); - // string template and require module vm + // viewModel from an AMD module ko.components.register("name", { template: "string-template", viewModel: { require: "module" } }); - // ------- non-string templates + // ------- template overloads - // viewmodel as function and four types of template - ko.components.register("name", { template: { element: "elementID" }, viewModel: function (params) { return null; } }); - // Node template for element and inline function (commonly used in examples) - ko.components.register("name", { template: { element: singleNode }, viewModel: function (params) { return null; } }); - // object template for element and inline function (commonly used in examples) - ko.components.register("name", { template: nodeArray, viewModel: function (params) { return null; } }); - // object template for element and inline function (commonly used in examples) - ko.components.register("name", { template: { require: "module" }, viewModel: function (params) { return null; } }); - - // viewmodel as object, and four types of non-string tempalte - ko.components.register("name", { template: { element: "elementID" }, viewModel: { instance: null } }); - // Node template for element and inline function (commonly used in examples) - ko.components.register("name", { template: { element: singleNode }, viewModel: { instance: null } }); - // object template for element and inline function (commonly used in examples) - ko.components.register("name", { template: nodeArray, viewModel: { instance: null } }); - // object template for element and inline function (commonly used in examples) - ko.components.register("name", { template: { require: "module" }, viewModel: { instance: null } }); + // template from named element + ko.components.register("name", { template: { element: "elementID" }, viewModel: viewModelFn }); + + // template using single Node + ko.components.register("name", { template: { element: singleNode }, viewModel: viewModelFn }); + + // template using Node array + ko.components.register("name", { template: nodeArray, viewModel: viewModelFn }); + + // template using an AMD module + ko.components.register("name", { template: { require: "text!module" }, viewModel: viewModelFn }); // Empty config for registering custom elements that are handled by name convention - ko.components.register('name', { /* No config needed */ }); + ko.components.register('name', { /* No config needed */ }); } } + function testUnwrapUnion() { var possibleObs: KnockoutObservable | number; diff --git a/leaflet/leaflet.d.ts b/leaflet/leaflet.d.ts index ed6b2dbcf..1708a9d10 100644 --- a/leaflet/leaflet.d.ts +++ b/leaflet/leaflet.d.ts @@ -3,7 +3,7 @@ // Definitions by: Vladimir Zotov // Definitions: https://github.com/borisyankov/DefinitelyTyped - + declare module L { export interface AttributionOptions { @@ -13,16 +13,16 @@ declare module L { * Default value: 'bottomright'. */ position?: string; - + /** * The HTML text shown before the attributions. Pass false to disable. * Default value: 'Powered by Leaflet'. */ prefix?: string; - + } } - + declare module L { /** @@ -56,49 +56,49 @@ declare module L { * Extends the bounds to contain the given point. */ extend(point: Point): void; - + /** * Returns the center point of the bounds. */ getCenter(): Point; - + /** * Returns true if the rectangle contains the given one. */ contains(otherBounds: Bounds): boolean; - + /** * Returns true if the rectangle contains the given point. */ contains(point: Point): boolean; - + /** * Returns true if the rectangle intersects the given bounds. */ intersects(otherBounds: Bounds): boolean; - + /** * Returns true if the bounds are properly initialized. */ isValid(): boolean; - + /** * Returns the size of the given bounds. */ getSize(): Point; - + /** * The top left corner of the rectangle. */ min: Point; - + /** * The bottom right corner of the rectangle. */ max: Point; } } - + declare module L { module Browser { @@ -107,73 +107,73 @@ declare module L { * true for all Internet Explorer versions. */ export var ie: boolean; - + /** * true for Internet Explorer 6. */ export var ie6: boolean; - + /** * true for Internet Explorer 6. */ export var ie7: boolean; - + /** * true for webkit-based browsers like Chrome and Safari (including mobile * versions). */ export var webkit: boolean; - + /** * true for webkit-based browsers that support CSS 3D transformations. */ export var webkit3d: boolean; - + /** * true for Android mobile browser. */ export var android: boolean; - + /** * true for old Android stock browsers (2 and 3). */ export var android23: boolean; - + /** * true for modern mobile browsers (including iOS Safari and different Android * browsers). */ export var mobile: boolean; - + /** * true for mobile webkit-based browsers. */ export var mobileWebkit: boolean; - + /** * true for mobile Opera. */ export var mobileOpera: boolean; - + /** * true for all browsers on touch devices. */ export var touch: boolean; - + /** * true for browsers with Microsoft touch model (e.g. IE10). */ export var msTouch: boolean; - + /** * true for devices with Retina screens. */ export var retina: boolean; - + } } - - + + declare module L { /** @@ -196,17 +196,17 @@ declare module L { * Returns the current geographical position of the circle. */ getLatLng(): LatLng; - + /** * Returns the current radius of a circle. Units are in meters. */ getRadius(): number; - + /** * Sets the position of a circle to a new location. */ setLatLng(latlng: LatLng): Circle; - + /** * Sets the radius of a circle. Units are in meters. */ @@ -219,7 +219,7 @@ declare module L { } } - + declare module L { /** @@ -245,7 +245,7 @@ declare module L { * Sets the position of a circle marker to a new location. */ setLatLng(latlng: LatLng): CircleMarker; - + /** * Sets the radius of a circle marker. Units are in pixels. */ @@ -261,24 +261,24 @@ declare module L { declare module L { export interface ClassExtendOptions { /** - * options is a special property that unlike other objects that you pass - * to extend will be merged with the parent one instead of overriding it - * completely, which makes managing configuration of objects and default + * options is a special property that unlike other objects that you pass + * to extend will be merged with the parent one instead of overriding it + * completely, which makes managing configuration of objects and default * values convenient. */ options?: any; /** - * includes is a special class property that merges all specified objects + * includes is a special class property that merges all specified objects * into the class (such objects are called mixins). A good example of this - * is L.Mixin.Events that event-related methods like on, off and fire + * is L.Mixin.Events that event-related methods like on, off and fire * to the class. */ includes?: any; /** - * statics is just a convenience property that injects specified object - * properties as the static properties of the class, useful for defining + * statics is just a convenience property that injects specified object + * properties as the static properties of the class, useful for defining * constants. */ static?: any; @@ -491,7 +491,7 @@ declare module L { export function scale(options?: ScaleOptions): L.Control.Scale; } } - + declare module L { export interface ControlOptions { @@ -505,7 +505,7 @@ declare module L { } } - + declare module L { module CRS { @@ -516,28 +516,28 @@ declare module L { * Map's crs option. */ export var EPSG3857: ICRS; - + /** * A common CRS among GIS enthusiasts. Uses simple Equirectangular projection. */ export var EPSG4326: ICRS; - + /** * Rarely used by some commercial tile providers. Uses Elliptical Mercator * projection. */ export var EPSG3395: ICRS; - + /** * A simple CRS that maps longitude and latitude into x and y directly. May be * used for maps of flat surfaces (e.g. game maps). Note that the y axis should * still be inverted (going from bottom to top). */ export var Simple: ICRS; - + } } - + declare module L { /** @@ -556,7 +556,7 @@ declare module L { export interface DivIcon extends Icon { } } - + declare module L { export interface DivIconOptions { @@ -565,7 +565,7 @@ declare module L { * Size of the icon in pixels. Can be also set through CSS. */ iconSize?: Point; - + /** * The coordinates of the "tip" of the icon (relative to its top left corner). * The icon will be aligned so that this point is at the marker's geographical @@ -573,24 +573,24 @@ declare module L { * with negative margins. */ iconAnchor?: Point; - + /** * A custom class name to assign to the icon. * * Default value: 'leaflet-div-icon'. */ className?: string; - + /** * A custom HTML code to put inside the div element. * * Default value: ''. */ html?: string; - + } } - + declare module L { export interface DomEvent { @@ -601,13 +601,13 @@ declare module L { */ addListener(el: HTMLElement, type: string, fn: (e: Event) => void, context?: any): DomEvent; on(el: HTMLElement, type: string, fn: (e: Event) => void, context?: any): DomEvent; - + /** * Removes an event listener from the element. */ removeListener(el: HTMLElement, type: string, fn: (e: Event) => void, context?: any): DomEvent; off(el: HTMLElement, type: string, fn: (e: Event) => void, context?: any): DomEvent; - + /** * Stop the given event from propagation to parent elements. Used inside the * listener functions: @@ -617,41 +617,41 @@ declare module L { * }); */ stopPropagation(e: Event): DomEvent; - + /** * Prevents the default action of the event from happening (such as following * a link in the href of the a element, or doing a POST request with page reload * when form is submitted). Use it inside listener functions. */ preventDefault(e: Event): DomEvent; - + /** * Does stopPropagation and preventDefault at the same time. */ stop(e: Event): DomEvent; - + /** * Adds stopPropagation to the element's 'click', 'doubleclick', 'mousedown' * and 'touchstart' events. */ disableClickPropagation(el: HTMLElement): DomEvent; - + /** * Gets normalized mouse position from a DOM event relative to the container * or to the whole page if not specified. */ getMousePosition(e: Event, container?: HTMLElement): Point; - + /** * Gets normalized wheel delta from a mousewheel DOM event. */ getWheelDelta(e: Event): number; - + } export var DomEvent: DomEvent; } - + declare module L { module DomUtil { @@ -661,74 +661,74 @@ declare module L { * the element if it was passed directly. */ export function get(id: string): HTMLElement; - + /** * Returns the value for a certain style attribute on an element, including * computed values or values set through CSS. */ export function getStyle(el: HTMLElement, style: string): string; - + /** * Returns the offset to the viewport for the requested element. */ export function getViewportOffset(el: HTMLElement): Point; - + /** * Creates an element with tagName, sets the className, and optionally appends * it to container element. */ export function create(tagName: string, className: string, container?: HTMLElement): HTMLElement; - + /** * Makes sure text cannot be selected, for example during dragging. */ export function disableTextSelection(): void; - + /** * Makes text selection possible again. */ export function enableTextSelection(): void; - + /** * Returns true if the element class attribute contains name. */ export function hasClass(el: HTMLElement, name: string): boolean; - + /** * Adds name to the element's class attribute. */ export function addClass(el: HTMLElement, name: string): void; - + /** * Removes name from the element's class attribute. */ export function removeClass(el: HTMLElement, name: string): void; - + /** * Set the opacity of an element (including old IE support). Value must be from * 0 to 1. */ export function setOpacity(el: HTMLElement, value: number): void; - + /** * Goes through the array of style names and returns the first name that is a valid * style name for an element. If no such name is found, it returns false. Useful * for vendor-prefixed styles like transform. */ export function testProp(props: string[]): any; - + /** * Returns a CSS transform string to move an element by the offset provided in * the given point. Uses 3D translate on WebKit for hardware-accelerated transforms * and 2D on other browsers. */ export function getTranslateString(point: Point): string; - + /** * Returns a CSS transform string to scale an element (with the given scale origin). */ export function getScaleString(scale: number, origin: Point): string; - + /** * Sets the position of an element to coordinates specified by point, using * CSS translate or top/left positioning depending on the browser (used by @@ -736,25 +736,25 @@ declare module L { * if disable3D is true. */ export function setPosition(el: HTMLElement, point: Point, disable3D?: boolean): void; - + /** * Returns the coordinates of an element previously positioned with setPosition. */ export function getPosition(el: HTMLElement): Point; - + /** * Vendor-prefixed transition style name (e.g. 'webkitTransition' for WebKit). */ export var TRANSITION: string; - + /** * Vendor-prefixed transform style name. */ export var TRANSFORM: string; - + } } - + declare module L { /** @@ -778,12 +778,12 @@ declare module L { * Enables the dragging ability. */ enable(): void; - + /** * Disables the dragging ability. */ disable(): void; - + //////////////// //////////////// addEventListener(type: string, fn: (e: LeafletEvent) => void, context?: any): Draggable; @@ -801,10 +801,10 @@ declare module L { on(eventMap: any, context?: any): Draggable; off(eventMap?: any, context?: any): Draggable; } -} - - - +} + + + declare module L { /** @@ -827,23 +827,23 @@ declare module L { * group that has a bindPopup method. */ bindPopup(htmlContent: string, options?: PopupOptions): FeatureGroup; - + /** * Returns the LatLngBounds of the Feature Group (created from bounds and coordinates * of its children). */ getBounds(): LatLngBounds; - + /** * Sets the given path options to each layer of the group that has a setStyle method. */ setStyle(style: PathOptions): FeatureGroup; - + /** * Brings the layer group to the top of all other layers. */ bringToFront(): FeatureGroup; - + /** * Brings the layer group to the bottom of all other layers. */ @@ -857,13 +857,13 @@ declare module L { * Called on map.addLayer(layer). */ onAdd(map: Map): void; - + /** * Should contain all clean up code that removes the overlay's elements from * the DOM and removes listeners previously added in onAdd. Called on map.removeLayer(layer). */ onRemove(map: Map): void; - + //////////////// //////////////// addEventListener(type: string, fn: (e: LeafletEvent) => void, context?: any): FeatureGroup; @@ -882,7 +882,7 @@ declare module L { off(eventMap?: any, context?: any): FeatureGroup; } } - + declare module L { export interface FitBoundsOptions extends ZoomPanOptions { @@ -899,14 +899,14 @@ declare module L { /** * The same for bottom right corner of the map. - * + * * Default value: [0, 0]. */ paddingBottomRight?: Point; /** * Equivalent of setting both top left and bottom right padding to the same value. - * + * * Default value: [0, 0]. */ padding?: Point; @@ -919,7 +919,7 @@ declare module L { maxZoom?: number; } } - + declare module L { /** @@ -947,7 +947,7 @@ declare module L { * used in GeoJSON for points. If reverse is set to true, the numbers will be interpreted * as (longitude, latitude). */ - coordsToLatlng(coords: number[], reverse?: boolean): LatLng; + coordsToLatLng(coords: number[], reverse?: boolean): LatLng; /** * Creates a multidimensional array of LatLng objects from a GeoJSON coordinates @@ -955,26 +955,26 @@ declare module L { * 1 for an array of arrays of points, etc., 0 by default). If reverse is set to * true, the numbers will be interpreted as (longitude, latitude). */ - coordsToLatlngs(coords: number[], levelsDeep?: number, reverse?: boolean): LatLng[]; + coordsToLatLngs(coords: any[], levelsDeep?: number, reverse?: boolean): any[]; } export var GeoJSON: GeoJSONStatic; export interface GeoJSON extends FeatureGroup { /** - * Adds a GeoJSON object to the layer. + * Adds a GeoJSON object to the layer. */ addData(data: any): boolean; - + /** * Changes styles of GeoJSON vector layers with the given style function. */ setStyle(style: (featureData: any) => any): GeoJSON; - + /** * Changes styles of GeoJSON vector layers with the given style options. */ setStyle(style: PathOptions): GeoJSON; - + /** * Resets the the given vector layer's style to the original GeoJSON style, * useful for resetting style after hover events. @@ -1017,9 +1017,9 @@ declare module L { } } - - - + + + declare module L { /** @@ -1056,7 +1056,7 @@ declare module L { } } } - + declare module L { export interface IconOptions { @@ -1066,18 +1066,18 @@ declare module L { * path). */ iconUrl?: string; - + /** * The URL to a retina sized version of the icon image (absolute or relative to * your script path). Used for Retina screen devices. */ iconRetinaUrl?: string; - + /** * Size of the icon image in pixels. */ iconSize?: Point; - + /** * The coordinates of the "tip" of the icon (relative to its top left corner). * The icon will be aligned so that this point is at the marker's geographical @@ -1085,43 +1085,43 @@ declare module L { * with negative margins. */ iconAnchor?: Point; - + /** * The URL to the icon shadow image. If not specified, no shadow image will be * created. */ shadowUrl?: string; - + /** * The URL to the retina sized version of the icon shadow image. If not specified, * no shadow image will be created. Used for Retina screen devices. */ shadowRetinaUrl?: string; - + /** * Size of the shadow image in pixels. */ shadowSize?: Point; - + /** * The coordinates of the "tip" of the shadow (relative to its top left corner) * (the same as iconAnchor if not specified). */ shadowAnchor?: Point; - + /** * The coordinates of the point from which popups will "open", relative to the * icon anchor. */ popupAnchor?: Point; - + /** * A custom class name to assign to both icon and shadow images. Empty by default. */ className?: string; } } - + declare module L { export interface IControl { @@ -1132,7 +1132,7 @@ declare module L { * containing the control. Called on map.addControl(control) or control.addTo(map). */ onAdd(map: Map): HTMLElement; - + /** * Optional, should contain all clean up code (e.g. removes control's event * listeners). Called on map.removeControl(control) or control.removeFrom(map). @@ -1141,7 +1141,7 @@ declare module L { onRemove(map: Map): void; } } - + declare module L { export interface ICRS { @@ -1150,35 +1150,35 @@ declare module L { * Projection that this CRS uses. */ projection: IProjection; - + /** * Transformation that this CRS uses to turn projected coordinates into screen * coordinates for a particular tile service. */ transformation: Transformation; - + /** * Standard code name of the CRS passed into WMS services (e.g. 'EPSG:3857'). */ code: string; - + /** * Projects geographical coordinates on a given zoom into pixel coordinates. */ latLngToPoint(latlng: LatLng, zoom: number): Point; - + /** * The inverse of latLngToPoint. Projects pixel coordinates on a given zoom * into geographical coordinates. */ pointToLatLng(point: Point, zoom: number): LatLng; - + /** * Projects geographical coordinates into coordinates in units accepted * for this CRS (e.g. meters for EPSG:3857, for passing it to WMS services). */ project(latlng: LatLng): Point; - + /** * Returns the scale used when transforming projected coordinates into pixel * coordinates for a particular zoom. For example, it returns 256 * 2^zoom for @@ -1190,10 +1190,10 @@ declare module L { * Returns the size of the world in pixels for a particular zoom. */ getSize(zoom: number): Point; - + } } - + declare module L { export interface IEventPowered { @@ -1205,7 +1205,7 @@ declare module L { * dblclick'). */ addEventListener(type: string, fn: (e: LeafletEvent) => void, context?: any): T; - + /** * The same as above except the listener will only get fired once and then removed. */ @@ -1214,29 +1214,29 @@ declare module L { * Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove} */ addEventListener(eventMap: any, context?: any): T; - + /** * Removes a previously added listener function. If no function is specified, * it will remove all the listeners of that particular event from the object. */ removeEventListener(type: string, fn?: (e: LeafletEvent) => void, context?: any): T; - + /** * Removes a set of type/listener pairs. */ removeEventListener(eventMap?: any, context?: any): T; - + /** * Returns true if a particular event type has some listeners attached to it. */ hasEventListeners(type: string): boolean; - + /** * Fires an event of the specified type. You can optionally provide an data object * — the first argument of the listener function will contain its properties. */ fireEvent(type: string, data?: any): T; - + /** * Removes all listeners to all events on the object. */ @@ -1266,14 +1266,14 @@ declare module L { * Alias to removeEventListener. */ off(eventMap?: any, context?: any): T; - + /** * Alias to fireEvent. */ fire(type: string, data?: any): T; } } - + declare module L { export interface IHandler { @@ -1282,12 +1282,12 @@ declare module L { * Enables the handler. */ enable(): void; - + /** * Disables the handler. */ disable(): void; - + /** * Returns true if the handler is enabled. */ @@ -1298,7 +1298,7 @@ declare module L { initialize(map: Map): void; } } - + declare module L { export interface ILayer { @@ -1309,7 +1309,7 @@ declare module L { * Called on map.addLayer(layer). */ onAdd(map: Map): void; - + /** * Should contain all clean up code that removes the overlay's elements from * the DOM and removes listeners previously added in onAdd. Called on map.removeLayer(layer). @@ -1326,7 +1326,7 @@ declare module L { export var Events: LeafletMixinEvents; } } - + declare module L { /** @@ -1349,7 +1349,7 @@ declare module L { * Adds the overlay to the map. */ addTo(map: Map): ImageOverlay; - + /** * Sets the opacity of the overlay. */ @@ -1358,13 +1358,13 @@ declare module L { /** * Changes the URL of the image. */ - setUrl(imageUrl: string): ImageOverlay; - + setUrl(imageUrl: string): ImageOverlay; + /** * Brings the layer to the top of all overlays. */ bringToFront(): ImageOverlay; - + /** * Brings the layer to the bottom of all overlays. */ @@ -1378,7 +1378,7 @@ declare module L { * Called on map.addLayer(layer). */ onAdd(map: Map): void; - + /** * Should contain all clean up code that removes the overlay's elements from * the DOM and removes listeners previously added in onAdd. Called on map.removeLayer(layer). @@ -1386,7 +1386,7 @@ declare module L { onRemove(map: Map): void; } } - + declare module L { export interface ImageOverlayOptions { @@ -1397,7 +1397,7 @@ declare module L { opacity?: number; } } - + declare module L { export interface IProjection { @@ -1406,14 +1406,14 @@ declare module L { * Projects geographical coordinates into a 2D point. */ project(latlng: LatLng): Point; - + /** * The inverse of project. Projects a 2D point into geographical location. */ unproject(point: Point): LatLng; } } - + declare module L { /** @@ -1427,7 +1427,7 @@ declare module L { */ export function noConflict(): typeof L; } - + declare module L { /** * Creates an object representing a geographical point with the given latitude @@ -1483,29 +1483,29 @@ declare module L { * Haversine formula. See description on wikipedia */ distanceTo(otherLatlng: LatLng): number; - + /** * Returns true if the given LatLng point is at the same position (within a small * margin of error). */ equals(otherLatlng: LatLng): boolean; - + /** * Returns a string representation of the point (for debugging purposes). */ toString(): string; - + /** * Returns a new LatLng object with the longitude wrapped around left and right * boundaries (-180 to 180 by default). */ wrap(left: number, right: number): LatLng; - + /** * Latitude in degrees. */ lat: number; - + /** * Longitude in degrees. */ @@ -1547,7 +1547,7 @@ declare module L { * Extends the bounds to contain the given point. */ extend(latlng: LatLng): LatLngBounds; - + /** * Extends the bounds to contain the given bounds. */ @@ -1557,68 +1557,68 @@ declare module L { * Returns the south-west point of the bounds. */ getSouthWest(): LatLng; - + /** * Returns the north-east point of the bounds. */ getNorthEast(): LatLng; - + /** * Returns the north-west point of the bounds. */ getNorthWest(): LatLng; - + /** * Returns the south-east point of the bounds. */ getSouthEast(): LatLng; - + /** * Returns the center point of the bounds. */ getCenter(): LatLng; - + /** * Returns true if the rectangle contains the given one. */ contains(otherBounds: LatLngBounds): boolean; - + /** * Returns true if the rectangle contains the given point. */ contains(latlng: LatLng): boolean; - + /** * Returns true if the rectangle intersects the given bounds. */ intersects(otherBounds: LatLngBounds): boolean; - + /** * Returns true if the rectangle is equivalent (within a small margin of error) * to the given bounds. */ equals(otherBounds: LatLngBounds): boolean; - + /** * Returns a string with bounding box coordinates in a 'southwest_lng,southwest_lat,northeast_lng,northeast_lat' * format. Useful for sending requests to web services that return geo data. */ toBBoxString(): string; - + /** * Returns bigger bounds created by extending the current bounds by a given * percentage in each direction. */ pad(bufferRatio: number): LatLngBounds; - + /** * Returns true if the bounds are properly initialized. */ isValid(): boolean; - + } } - + declare module L { /** @@ -1640,17 +1640,17 @@ declare module L { * Adds the group of layers to the map. */ addTo(map: Map): LayerGroup; - + /** * Adds a given layer to the group. */ addLayer(layer: T): LayerGroup; - + /** * Removes a given layer from the group. */ removeLayer(layer: T): LayerGroup; - + /** * Removes a given layer of the given id from the group. */ @@ -1675,7 +1675,7 @@ declare module L { * Removes all the layers from the group. */ clearLayers(): LayerGroup; - + /** * Iterates over the layers of the group, optionally specifying context of * the iterator function. @@ -1695,7 +1695,7 @@ declare module L { * Called on map.addLayer(layer). */ onAdd(map: Map): void; - + /** * Should contain all clean up code that removes the overlay's elements from * the DOM and removes listeners previously added in onAdd. Called on map.removeLayer(layer). @@ -1703,8 +1703,8 @@ declare module L { onRemove(map: Map): void; } } - - + + declare module L { export interface LayersOptions { @@ -1715,7 +1715,7 @@ declare module L { * Default value: 'topright'. */ position?: string; - + /** * If true, the control will be collapsed into an icon and expanded on mouse hover * or touch. @@ -1723,7 +1723,7 @@ declare module L { * Default value: true. */ collapsed?: boolean; - + /** * If true, the control will assign zIndexes in increasing order to all of its * layers so that the order is preserved when switching them on/off. @@ -1731,10 +1731,10 @@ declare module L { * Default value: true. */ autoZIndex?: boolean; - + } } - + declare module L { export interface LeafletErrorEvent extends LeafletEvent { @@ -1743,14 +1743,14 @@ declare module L { * Error message. */ message: string; - + /** * Error code (if applicable). */ code: number; } } - + declare module L { export interface LeafletEvent { @@ -1766,7 +1766,7 @@ declare module L { target: any; } } - + declare module L { export interface LeafletGeoJSONEvent extends LeafletEvent { @@ -1775,24 +1775,24 @@ declare module L { * The layer for the GeoJSON feature that is being added to the map. */ layer: ILayer; - + /** * GeoJSON properties of the feature. */ properties: any; - + /** * GeoJSON geometry type of the feature. */ geometryType: string; - + /** * GeoJSON ID of the feature (if present). */ id: string; } } - + declare module L { export interface LeafletLayerEvent extends LeafletEvent { @@ -1803,7 +1803,7 @@ declare module L { layer: ILayer; } } - + declare module L { export interface LeafletLocationEvent extends LeafletEvent { @@ -1812,13 +1812,13 @@ declare module L { * Detected geographical location of the user. */ latlng: LatLng; - + /** * Geographical bounds of the area user is located in (with respect to the accuracy * of location). */ bounds: LatLngBounds; - + /** * Accuracy of location in meters. */ @@ -1848,10 +1848,10 @@ declare module L { * The time when the position was acquired. */ timestamp: number; - + } } - + declare module L { export interface LeafletMouseEvent extends LeafletEvent { @@ -1860,26 +1860,26 @@ declare module L { * The geographical point where the mouse event occured. */ latlng: LatLng; - + /** * Pixel coordinates of the point where the mouse event occured relative to * the map layer. */ layerPoint: Point; - + /** * Pixel coordinates of the point where the mouse event occured relative to * the map сontainer. */ containerPoint: Point; - + /** * The original DOM mouse event fired by the browser. */ originalEvent: MouseEvent; } } - + declare module L { export interface LeafletPopupEvent extends LeafletEvent { @@ -1901,7 +1901,7 @@ declare module L { distance: number; } } - + declare module L { export interface LeafletResizeEvent extends LeafletEvent { @@ -1910,14 +1910,14 @@ declare module L { * The old size before resize event. */ oldSize: Point; - + /** * The new size after the resize event. */ newSize: Point; } } - + declare module L { export interface LeafletTileEvent extends LeafletEvent { @@ -1926,14 +1926,14 @@ declare module L { * The tile element (image). */ tile: HTMLElement; - + /** * The source URL of the tile. */ url: string; } } - + declare module L { module LineUtil { @@ -1947,27 +1947,27 @@ declare module L { * released as a separated micro-library Simplify.js. */ export function simplify(points: Point[], tolerance: number): Point[]; - + /** * Returns the distance between point p and segment p1 to p2. */ export function pointToSegmentDistance(p: Point, p1: Point, p2: Point): number; - + /** * Returns the closest point from a point p on a segment p1 to p2. */ export function closestPointOnSegment(p: Point, p1: Point, p2: Point): number; - + /** * Clips the segment a to b by rectangular bounds (modifying the segment points * directly!). Used by Leaflet to only show polyline points that are on the screen * or near, increasing performance. */ export function clipSegment(a: Point, b: Point, bounds: Bounds): void; - + } } - + declare module L { export interface LocateOptions { @@ -1980,7 +1980,7 @@ declare module L { * Default value: false. */ watch?: boolean; - + /** * If true, automatically sets the map view to the user location with respect * to detection accuracy, or to world view if geolocation failed. @@ -1988,14 +1988,14 @@ declare module L { * Default value: false. */ setView?: boolean; - + /** * The maximum zoom for automatic view setting when using `setView` option. * * Default value: Infinity. */ maxZoom?: number; - + /** * Number of millisecond to wait for a response from geolocation before firing * a locationerror event. @@ -2003,7 +2003,7 @@ declare module L { * Default value: 10000. */ timeout?: number; - + /** * Maximum age of detected location. If less than this amount of milliseconds * passed since last geolocation response, locate will return a cached location. @@ -2011,7 +2011,7 @@ declare module L { * Default value: 0. */ maximumAge?: number; - + /** * Enables high accuracy, see description in the W3C spec. * @@ -2020,7 +2020,7 @@ declare module L { enableHighAccuracy?: boolean; } } - + declare module L { /** @@ -2063,17 +2063,17 @@ declare module L { * animation options. */ setView(center: LatLng, zoom?: number, options?: ZoomPanOptions): Map; - + /** * Sets the zoom of the map. */ setZoom(zoom: number, options?: ZoomOptions): Map; - + /** * Increases the zoom of the map by delta (1 by default). */ zoomIn(delta?: number, options?: ZoomOptions): Map; - + /** * Decreases the zoom of the map by delta (1 by default). */ @@ -2084,43 +2084,43 @@ declare module L { * (e.g. used internally for scroll zoom and double-click zoom). */ setZoomAround(latlng: LatLng, zoom: number, options?: ZoomOptions): Map; - + /** * Sets a map view that contains the given geographical bounds with the maximum * zoom level possible. */ fitBounds(bounds: LatLngBounds, options?: FitBoundsOptions): Map; - + /** * Sets a map view that mostly contains the whole world with the maximum zoom * level possible. */ fitWorld(options?: FitBoundsOptions): Map; - + /** * Pans the map to a given center. Makes an animated pan if new center is not more * than one screen away from the current one. */ panTo(latlng: LatLng, options?: PanOptions): Map; - + /** * Pans the map to the closest view that would lie inside the given bounds (if * it's not already). */ panInsideBounds(bounds: LatLngBounds): Map; - + /** * Pans the map by a given number of pixels (animated). */ panBy(point: Point, options?: PanOptions): Map; - + /** * Checks if the map container size changed and updates the map if so — call it * after you've changed the map size dynamically, also animating pan by default. * If options.pan is false, panning will not occur. */ invalidateSize(options: ZoomPanOptions): Map; - + /** * Checks if the map container size changed and updates the map if so — call it * after you've changed the map size dynamically, also animating pan by default. @@ -2132,7 +2132,7 @@ declare module L { * passing the given animation options through to `setView`, if required. */ setMaxBounds(bounds: LatLngBounds, options?: ZoomPanOptions): Map; - + /** * Tries to locate the user using Geolocation API, firing locationfound event * with location data on success or locationerror event on failure, and optionally @@ -2141,7 +2141,7 @@ declare module L { * details. */ locate(options?: LocateOptions): Map; - + /** * Stops watching location previously initiated by map.locate({watch: true}) * and aborts resetting the map view if map.locate was called with {setView: true}. @@ -2152,34 +2152,34 @@ declare module L { * Destroys the map and clears all related event listeners. */ remove(): Map; - + // Methods for Getting Map State /** * Returns the geographical center of the map view. */ getCenter(): LatLng; - + /** * Returns the current zoom of the map view. */ getZoom(): number; - + /** * Returns the minimum zoom level of the map. */ getMinZoom(): number; - + /** * Returns the maximum zoom level of the map. */ getMaxZoom(): number; - + /** * Returns the LatLngBounds of the current map view. */ getBounds(): LatLngBounds; - + /** * Returns the maximum zoom level on which the given bounds fit to the map view * in its entirety. If inside (optional) is set to true, the method instead returns @@ -2187,24 +2187,24 @@ declare module L { * entirety. */ getBoundsZoom(bounds: LatLngBounds, inside?: boolean): number; - + /** * Returns the current size of the map container. */ getSize(): Point; - + /** * Returns the bounds of the current map view in projected pixel coordinates * (sometimes useful in layer and overlay implementations). */ getPixelBounds(): Bounds; - + /** * Returns the projected pixel coordinates of the top left point of the map layer * (useful in custom layer and overlay implementations). */ getPixelOrigin(): Point; - + // Methods for Layers and Controls /** @@ -2212,31 +2212,31 @@ declare module L { * the layer is inserted under all others (useful when switching base tile layers). */ addLayer(layer: ILayer, insertAtTheBottom?: boolean): Map; - + /** * Removes the given layer from the map. */ removeLayer(layer: ILayer): Map; - + /** * Returns true if the given layer is currently added to the map. */ hasLayer(layer: ILayer): boolean; - + /** * Opens the specified popup while closing the previously opened (to make sure * only one is opened at one time for usability). */ openPopup(popup: Popup): Map; - + /** - * Creates a popup with the specified options and opens it in the given point + * Creates a popup with the specified options and opens it in the given point * on a map. */ openPopup(html: string, latlng: LatLng, options?: PopupOptions): Map; - + /** - * Creates a popup with the specified options and opens it in the given point + * Creates a popup with the specified options and opens it in the given point * on a map. */ openPopup(el: HTMLElement, latlng: LatLng, options?: PopupOptions): Map; @@ -2245,17 +2245,17 @@ declare module L { * Closes the popup previously opened with openPopup (or the given one). */ closePopup(popup?: Popup): Map; - + /** * Adds the given control to the map. */ addControl(control: IControl): Map; - + /** * Removes the given control from the map. */ removeControl(control: IControl): Map; - + // Conversion Methods /** @@ -2263,116 +2263,116 @@ declare module L { * (useful for placing overlays on the map). */ latLngToLayerPoint(latlng: LatLng): Point; - + /** * Returns the geographical coordinates of a given map layer point. */ layerPointToLatLng(point: Point): LatLng; - + /** * Converts the point relative to the map container to a point relative to the * map layer. */ containerPointToLayerPoint(point: Point): Point; - + /** * Converts the point relative to the map layer to a point relative to the map * container. */ layerPointToContainerPoint(point: Point): Point; - + /** * Returns the map container point that corresponds to the given geographical * coordinates. */ latLngToContainerPoint(latlng: LatLng): Point; - + /** * Returns the geographical coordinates of a given map container point. */ containerPointToLatLng(point: Point): LatLng; - + /** * Projects the given geographical coordinates to absolute pixel coordinates * for the given zoom level (current zoom level by default). */ project(latlng: LatLng, zoom?: number): Point; - + /** * Projects the given absolute pixel coordinates to geographical coordinates * for the given zoom level (current zoom level by default). */ unproject(point: Point, zoom?: number): LatLng; - + /** * Returns the pixel coordinates of a mouse click (relative to the top left corner * of the map) given its event object. */ mouseEventToContainerPoint(event: LeafletMouseEvent): Point; - + /** * Returns the pixel coordinates of a mouse click relative to the map layer given * its event object. */ mouseEventToLayerPoint(event: LeafletMouseEvent): Point; - + /** * Returns the geographical coordinates of the point the mouse clicked on given * the click's event object. */ mouseEventToLatLng(event: LeafletMouseEvent): LatLng; - + // Other Methods /** * Returns the container element of the map. */ getContainer(): HTMLElement; - + /** * Returns an object with different map panes (to render overlays in). */ getPanes(): MapPanes; - + // REVIEW: Should we make it more flexible declaring parameter 'fn' as Function? /** * Runs the given callback when the map gets initialized with a place and zoom, * or immediately if it happened already, optionally passing a function context. */ whenReady(fn: (map: Map) => void, context?: any): Map; - + // Properties /** * Map dragging handler (by both mouse and touch). */ dragging: IHandler; - + /** * Touch zoom handler. */ touchZoom: IHandler; - + /** * Double click zoom handler. */ doubleClickZoom: IHandler; - + /** * Scroll wheel zoom handler. */ scrollWheelZoom: IHandler; - + /** * Box (shift-drag with mouse) zoom handler. */ boxZoom: IHandler; - + /** * Keyboard navigation handler. */ keyboard: IHandler; - + /** * Mobile touch hacks (quick tap and touch hold) handler. */ @@ -2421,27 +2421,27 @@ declare module L { * Initial geographical center of the map. */ center?: LatLng; - + /** * Initial map zoom. */ zoom?: number; - + /** * Layers that will be added to the map initially. */ layers?: ILayer[]; - + /** * Minimum zoom level of the map. Overrides any minZoom set on map layers. */ minZoom?: number; - + /** * Maximum zoom level of the map. This overrides any maxZoom set on map layers. */ maxZoom?: number; - + /** * When this option is set, the map restricts the view to the given geographical * bounds, bouncing the user back when he tries to pan outside the view, and also @@ -2449,7 +2449,7 @@ declare module L { * on the map size). To set the restriction dynamically, use setMaxBounds method */ maxBounds?: LatLngBounds; - + /** * Coordinate Reference System to use. Don't change this if you're not sure * what it means. @@ -2457,7 +2457,7 @@ declare module L { * Default value: L.CRS.EPSG3857. */ crs?: ICRS; - + // Interaction Options /** @@ -2466,14 +2466,14 @@ declare module L { * Default value: true. */ dragging?: boolean; - + /** * Whether the map can be zoomed by touch-dragging with two fingers. * * Default value: true. */ touchZoom?: boolean; - + /** * Whether the map can be zoomed by using the mouse wheel. * If passed 'center', it will zoom to the center of the view regardless of @@ -2482,7 +2482,7 @@ declare module L { * Default value: true. */ scrollWheelZoom?: boolean; - + /** * Whether the map can be zoomed in by double clicking on it and zoomed out * by double clicking while holding shift. @@ -2523,7 +2523,7 @@ declare module L { * Default value: true. */ trackResize?: boolean; - + /** * With this option enabled, the map tracks when you pan to another "copy" of * the world and seamlessly jumps to the original one so that all overlays like @@ -2532,14 +2532,14 @@ declare module L { * Default value: false. */ worldCopyJump?: boolean; - + /** * Set it to false if you don't want popups to close when user clicks the map. * * Default value: true. */ closePopupOnClick?: boolean; - + // Keyboard Navigation Options /** @@ -2549,21 +2549,21 @@ declare module L { * Default value: true. */ keyboard?: boolean; - + /** * Amount of pixels to pan when pressing an arrow key. * * Default value: 80. */ keyboardPanOffset?: number; - + /** * Number of zoom levels to change when pressing + or - key. * * Default value: 1. */ keyboardZoomOffset?: number; - + // Panning Inertia Options /** @@ -2574,21 +2574,21 @@ declare module L { * Default value: true. */ inertia?: boolean; - + /** * The rate with which the inertial movement slows down, in pixels/second2. * * Default value: 3000. */ inertiaDeceleration?: number; - + /** * Max speed of the inertial movement, in pixels/second. * * Default value: 1500. */ inertiaMaxSpeed?: number; - + /** * Amount of milliseconds that should pass between stopping the movement and * releasing the mouse or touch to prevent inertial movement. @@ -2596,7 +2596,7 @@ declare module L { * Default value: 32 for touch devices and 14 for the rest. */ inertiaThreshold?: number; - + // Control options /** @@ -2605,14 +2605,14 @@ declare module L { * Default value: true. */ zoomControl?: boolean; - + /** * Whether the attribution control is added to the map by default. * * Default value: true. */ attributionControl?: boolean; - + // Animation options /** @@ -2620,7 +2620,7 @@ declare module L { * browsers that support CSS3 Transitions except Android. */ fadeAnimation?: boolean; - + /** * Whether the tile zoom animation is enabled. By default it's enabled in all * browsers that support CSS3 Transitions except Android. @@ -2650,7 +2650,7 @@ declare module L { bounceAtZoomLimits?: boolean; } } - + declare module L { export interface MapPanes { @@ -2691,7 +2691,7 @@ declare module L { popupPane: HTMLElement; } } - + declare module L { /** @@ -2713,44 +2713,44 @@ declare module L { * Adds the marker to the map. */ addTo(map: Map): Marker; - + /** * Returns the current geographical position of the marker. */ getLatLng(): LatLng; - + /** * Changes the marker position to the given point. */ setLatLng(latlng: LatLng): Marker; - + /** * Changes the marker icon. */ setIcon(icon: Icon): Marker; - + /** * Changes the zIndex offset of the marker. */ setZIndexOffset(offset: number): Marker; - + /** * Changes the opacity of the marker. */ setOpacity(opacity: number): Marker; - + /** * Updates the marker position, useful if coordinates of its latLng object * were changed directly. */ update(): Marker; - + /** * Binds a popup with a particular HTML content to a click on this marker. You * can also open the bound popup with the Marker openPopup method. */ bindPopup(html: string, options?: PopupOptions): Marker; - + /** * Binds a popup with a particular HTML content to a click on this marker. You * can also open the bound popup with the Marker openPopup method. @@ -2767,7 +2767,7 @@ declare module L { * Unbinds the popup previously bound to the marker with bindPopup. */ unbindPopup(): Marker; - + /** * Opens the popup previously bound by the bindPopup method. */ @@ -2776,8 +2776,8 @@ declare module L { /** * Returns the popup previously bound by the bindPopup method. */ - getPopup(): Popup; - + getPopup(): Popup; + /** * Closes the bound popup of the marker if it's opened. */ @@ -2816,13 +2816,13 @@ declare module L { * Called on map.addLayer(layer). */ onAdd(map: Map): void; - + /** * Should contain all clean up code that removes the overlay's elements from * the DOM and removes listeners previously added in onAdd. Called on map.removeLayer(layer). */ onRemove(map: Map): void; - + //////////////// //////////////// addEventListener(type: string, fn: (e: LeafletEvent) => void, context?: any): Marker; @@ -2841,7 +2841,7 @@ declare module L { off(eventMap?: any, context?: any): Marker; } } - + declare module L { export interface MarkerOptions { @@ -2853,7 +2853,7 @@ declare module L { * Default value: new L.Icon.Default(). */ icon?: Icon; - + /** * If false, the marker will not emit mouse events and will act as a part of the * underlying map. @@ -2861,7 +2861,7 @@ declare module L { * Default value: true. */ clickable?: boolean; - + /** * Whether the marker is draggable with mouse/touch or not. * @@ -2875,7 +2875,7 @@ declare module L { * Default value: true. */ keyboard?: boolean; - + /** * Text for the browser tooltip that appear on marker hover (no tooltip by default). * @@ -2889,7 +2889,7 @@ declare module L { * Default value: ''. */ alt?: string; - + /** * By default, marker images zIndex is set automatically based on its latitude. * You this option if you want to put the marker on top of all others (or below), @@ -2898,21 +2898,21 @@ declare module L { * Default value: 0. */ zIndexOffset?: number; - + /** * The opacity of the marker. * * Default value: 1.0. */ opacity?: number; - + /** * If true, the marker will get on top of others when you hover the mouse over it. * * Default value: false. */ riseOnHover?: boolean; - + /** * The z-index offset used for the riseOnHover feature. * @@ -2921,7 +2921,7 @@ declare module L { riseOffset?: number; } } - + declare module L { /** @@ -2964,7 +2964,7 @@ declare module L { toGeoJSON(): any; } } - + declare module L { /** @@ -3005,7 +3005,7 @@ declare module L { toGeoJSON(): any; } } - + declare module L { export interface PanOptions { @@ -3013,14 +3013,14 @@ declare module L { /** * If true, panning will always be animated if possible. If false, it will not * animate panning, either resetting the map view if panning more than a screen - * away, or just setting a new offset for the map pane (except for `panBy` + * away, or just setting a new offset for the map pane (except for `panBy` * which always does the latter). */ animate?: boolean; /** * Duration of animated panning. - * + * * Default value: 0.25. */ duration?: number; @@ -3035,13 +3035,13 @@ declare module L { /** * If true, panning won't fire movestart event on start (used internally for panning inertia). - * + * * Default value: false. */ noMoveStart?: boolean; } } - + declare module L { export interface Path extends ILayer, IEventPowered { @@ -3050,12 +3050,12 @@ declare module L { * Adds the layer to the map. */ addTo(map: Map): Path; - + /** * Binds a popup with a particular HTML content to a click on this path. */ bindPopup(html: string, options?: PopupOptions): Path; - + /** * Binds a popup with a particular HTML content to a click on this path. */ @@ -3070,38 +3070,38 @@ declare module L { * Unbinds the popup previously bound to the path with bindPopup. */ unbindPopup(): Path; - + /** * Opens the popup previously bound by the bindPopup method in the given point, * or in one of the path's points if not specified. */ openPopup(latlng?: LatLng): Path; - + /** * Closes the path's bound popup if it is opened. */ closePopup(): Path; - + /** * Changes the appearance of a Path based on the options in the Path options object. */ setStyle(object: PathOptions): Path; - + /** * Returns the LatLngBounds of the path. */ getBounds(): LatLngBounds; - + /** * Brings the layer to the top of all path layers. */ bringToFront(): Path; - + /** * Brings the layer to the bottom of all path layers. */ bringToBack(): Path; - + /** * Redraws the layer. Sometimes useful after you changed the coordinates that * the path uses. @@ -3115,13 +3115,13 @@ declare module L { * Called on map.addLayer(layer). */ onAdd(map: Map): void; - + /** * Should contain all clean up code that removes the overlay's elements from * the DOM and removes listeners previously added in onAdd. Called on map.removeLayer(layer). */ onRemove(map: Map): void; - + //////////////// //////////////// addEventListener(type: string, fn: (e: LeafletEvent) => void, context?: any): Path; @@ -3181,48 +3181,48 @@ declare module L { * Default value: true. */ stroke?: boolean; - + /** * Stroke color. * * Default value: '#03f'. */ color?: string; - + /** * Stroke width in pixels. * * Default value: 5. */ weight?: number; - + /** * Stroke opacity. * * Default value: 0.5. */ opacity?: number; - + /** * Whether to fill the path with color. Set it to false to disable filling on polygons * or circles. */ fill?: boolean; - + /** * Fill color. * * Default value: same as color. */ fillColor?: string; - + /** * Fill opacity. * * Default value: 0.2. */ fillOpacity?: number; - + /** * A string that defines the stroke dash pattern. Doesn't work on canvas-powered * layers (e.g. Android 2). @@ -3242,7 +3242,7 @@ declare module L { * Default: null. */ lineJoin?: string; - + /** * If false, the vector will not emit mouse events and will act as a part of the * underlying map. @@ -3262,10 +3262,10 @@ declare module L { * Default value: ''. */ className?: string; - + } } - + declare module L { /** @@ -3288,48 +3288,48 @@ declare module L { * Returns the result of addition of the current and the given points. */ add(otherPoint: Point): Point; - + /** * Returns the result of subtraction of the given point from the current. */ subtract(otherPoint: Point): Point; - + /** * Returns the result of multiplication of the current point by the given number. */ multiplyBy(number: number): Point; - + /** * Returns the result of division of the current point by the given number. If * optional round is set to true, returns a rounded result. */ divideBy(number: number, round?: boolean): Point; - + /** * Returns the distance between the current and the given points. */ distanceTo(otherPoint: Point): number; - + /** * Returns a copy of the current point. */ clone(): Point; - + /** * Returns a copy of the current point with rounded coordinates. */ round(): Point; - + /** * Returns true if the given point has the same coordinates. */ equals(otherPoint: Point): boolean; - + /** * Returns a string representation of the point for debugging purposes. */ toString(): string; - + /** * The x coordinate. */ @@ -3341,7 +3341,7 @@ declare module L { y: number; } } - + declare module L { /** @@ -3369,7 +3369,7 @@ declare module L { export interface Polygon extends Polyline { } } - + declare module L { /** @@ -3392,24 +3392,24 @@ declare module L { * Adds a given point to the polyline. */ addLatLng(latlng: LatLng): Polyline; - + /** * Replaces all the points in the polyline with the given array of geographical * points. */ setLatLngs(latlngs: LatLng[]): Polyline; - + /** * Returns an array of the points in the path. */ getLatLngs(): LatLng[]; - + /** * Allows adding, removing or replacing points in the polyline. Syntax is the * same as in Array#splice. Returns the array of removed points (if any). */ spliceLatLngs(index: number, pointsToRemove: number, ...latlngs: LatLng[]): LatLng[]; - + /** * Returns the LatLngBounds of the polyline. */ @@ -3421,7 +3421,7 @@ declare module L { toGeoJSON(): any; } } - + declare module L { export interface PolylineOptions { @@ -3433,7 +3433,7 @@ declare module L { * Default value: 1.0. */ smoothFactor?: number; - + /** * Disabled polyline clipping. * @@ -3442,7 +3442,7 @@ declare module L { noClip?: boolean; } } - + declare module L { module PolyUtil { @@ -3456,7 +3456,7 @@ declare module L { export function clipPolygon(points: Point[], bounds: Bounds): Point[]; } } - + declare module L { /** @@ -3481,17 +3481,17 @@ declare module L { * Adds the popup to the map. */ addTo(map: Map): Popup; - + /** * Adds the popup to the map and closes the previous one. The same as map.openPopup(popup). */ openOn(map: Map): Popup; - + /** * Sets the geographical point where the popup will open. */ setLatLng(latlng: LatLng): Popup; - + /** * Returns the geographical point of popup. */ @@ -3521,7 +3521,7 @@ declare module L { * Called on map.addLayer(layer). */ onAdd(map: Map): void; - + /** * Should contain all clean up code that removes the overlay's elements from * the DOM and removes listeners previously added in onAdd. Called on map.removeLayer(layer). @@ -3535,7 +3535,7 @@ declare module L { update(): Popup; } } - + declare module L { export interface PopupOptions { @@ -3546,20 +3546,20 @@ declare module L { * Default value: 300. */ maxWidth?: number; - + /** * Min width of the popup. * * Default value: 50. */ minWidth?: number; - + /** * If set, creates a scrollable container of the given height inside a popup * if its content exceeds it. */ maxHeight?: number; - + /** * Set it to false if you don't want the map to do panning animation to fit the opened * popup. @@ -3567,14 +3567,14 @@ declare module L { * Default value: true. */ autoPan?: boolean; - + /** * Controls the presense of a close button in the popup. * * Default value: true. */ closeButton?: boolean; - + /** * The offset of the popup position. Useful to control the anchor of the popup * when opening it on some overlays. @@ -3598,7 +3598,7 @@ declare module L { * Default value: null. */ autoPanPaddingBottomRight?: Point; - + /** * The margin between the popup and the edges of the map view after autopanning * was performed. @@ -3606,7 +3606,7 @@ declare module L { * Default value: new Point(5, 5). */ autoPanPadding?: Point; - + /** * Whether to animate the popup on zoom. Disable it if you have problems with * Flash content inside popups. @@ -3616,14 +3616,14 @@ declare module L { zoomAnimation?: boolean; /** - * Set it to false if you want to override the default behavior of the popup + * Set it to false if you want to override the default behavior of the popup * closing when user clicks the map (set globally by the Map closePopupOnClick * option). */ closeOnClick?: boolean; } } - + declare module L { export interface PosAnimationStatic extends ClassStatic { @@ -3641,7 +3641,7 @@ declare module L { * of the cubic bezier curve, 0.5 by default) */ run(element: HTMLElement, newPos: Point, duration?: number, easeLinearity?: number): PosAnimation; - + //////////////// //////////////// addEventListener(type: string, fn: (e: LeafletEvent) => void, context?: any): PosAnimation; @@ -3660,7 +3660,7 @@ declare module L { off(eventMap?: any, context?: any): PosAnimation; } } - + declare module L { module Projection { @@ -3671,14 +3671,14 @@ declare module L { * is a sphere. Used by the EPSG:3857 CRS. */ export var SphericalMercator: IProjection; - + /** * Elliptical Mercator projection — more complex than Spherical Mercator. * Takes into account that Earth is a geoid, not a perfect sphere. Used by the * EPSG:3395 CRS. */ export var Mercator: IProjection; - + /** * Equirectangular, or Plate Carree projection — the most simple projection, * mostly used by GIS enthusiasts. Directly maps x as longitude, and y as latitude. @@ -3688,7 +3688,7 @@ declare module L { export var LonLat: IProjection; } } - + declare module L { /** @@ -3713,8 +3713,8 @@ declare module L { setBounds(bounds: LatLngBounds): Rectangle; } } - - + + declare module L { export interface ScaleOptions { @@ -3724,26 +3724,26 @@ declare module L { * Default value: 'bottomleft'. */ position?: string; - + /** * Maximum width of the control in pixels. The width is set dynamically to show * round values (e.g. 100, 200, 500). * Default value: 100. */ maxWidth?: number; - + /** * Whether to show the metric scale line (m/km). * Default value: true. */ metric?: boolean; - + /** * Whether to show the imperial scale line (mi/ft). * Default value: true. */ imperial?: boolean; - + /** * If true, the control is updated on moveend, otherwise it's always up-to-date * (updated on move). @@ -3752,7 +3752,7 @@ declare module L { updateWhenIdle?: boolean; } } - + declare module L { export interface TileLayerStatic extends ClassStatic { @@ -3784,32 +3784,32 @@ declare module L { * Adds the layer to the map. */ addTo(map: Map): TileLayer; - + /** * Brings the tile layer to the top of all tile layers. */ bringToFront(): TileLayer; - + /** * Brings the tile layer to the bottom of all tile layers. */ bringToBack(): TileLayer; - + /** * Changes the opacity of the tile layer. */ setOpacity(opacity: number): TileLayer; - + /** * Sets the zIndex of the tile layer. */ setZIndex(zIndex: number): TileLayer; - + /** * Causes the layer to clear all the tiles and request them again. */ redraw(): TileLayer; - + /** * Updates the layer's URL template and redraws it. */ @@ -3828,13 +3828,13 @@ declare module L { * Called on map.addLayer(layer). */ onAdd(map: Map): void; - + /** * Should contain all clean up code that removes the overlay's elements from * the DOM and removes listeners previously added in onAdd. Called on map.removeLayer(layer). */ onRemove(map: Map): void; - + //////////////// //////////////// addEventListener(type: string, fn: (e: LeafletEvent) => void, context?: any): TileLayer; @@ -3879,7 +3879,7 @@ declare module L { } export interface TileLayerFactory { - + /** * Instantiates a tile layer object given a URL template and optionally an options * object. @@ -3900,7 +3900,7 @@ declare module L { export var tileLayer: TileLayerFactory; } - + declare module L { export interface TileLayerOptions { @@ -3911,7 +3911,7 @@ declare module L { * Default value: 0. */ minZoom?: number; - + /** * Maximum zoom number. * @@ -3927,14 +3927,14 @@ declare module L { * Default value: null. */ maxNativeZoom?: number; - + /** * Tile size (width and height in pixels, assuming tiles are square). * * Default value: 256. */ tileSize?: number; - + /** * Subdomains of the tile service. Can be passed in the form of one string (where * each letter is a subdomain name) or an array of strings. @@ -3942,14 +3942,14 @@ declare module L { * Default value: 'abc'. */ subdomains?: string[]; - + /** * URL to the tile image to show in place of the tile that failed to load. * * Default value: ''. */ errorTileUrl?: string; - + /** * e.g. "© CloudMade" — the string used by the attribution control, describes * the layer data. @@ -3957,14 +3957,14 @@ declare module L { * Default value: ''. */ attribution?: string; - + /** * If true, inverses Y axis numbering for tiles (turn this on for TMS services). * * Default value: false. */ tms?: boolean; - + /** * If set to true, the tile coordinates won't be wrapped by world width (-180 * to 180 longitude) or clamped to lie within world height (-90 to 90). Use this @@ -3974,7 +3974,7 @@ declare module L { * Default value: false. */ continuousWorld?: boolean; - + /** * If set to true, the tiles just won't load outside the world width (-180 to 180 * longitude) instead of repeating. @@ -3982,14 +3982,14 @@ declare module L { * Default value: false. */ noWrap?: boolean; - + /** * The zoom number used in tile URLs will be offset with this value. * * Default value: 0. */ zoomOffset?: number; - + /** * If set to true, the zoom number used in tile URLs will be reversed (maxZoom * - zoom instead of zoom) @@ -3997,31 +3997,31 @@ declare module L { * Default value: false. */ zoomReverse?: boolean; - + /** * The opacity of the tile layer. * * Default value: 1.0. */ opacity?: number; - + /** * The explicit zIndex of the tile layer. Not set by default. */ zIndex?: number; - + /** * If true, all the tiles that are not visible after panning are removed (for * better performance). true by default on mobile WebKit, otherwise false. */ unloadInvisibleTiles?: boolean; - + /** * If false, new tiles are loaded during panning, otherwise only after it (for * better performance). true by default on mobile WebKit, otherwise false. */ updateWhenIdle?: boolean; - + /** * If true and user is on a retina display, it will request four tiles of half the * specified size and a bigger zoom level in place of one to utilize the high resolution. @@ -4029,7 +4029,7 @@ declare module L { * Default value: false. */ detectRetina?: boolean; - + /** * If true, all the tiles that are not visible after panning are placed in a reuse * queue from which they will be fetched when new tiles become visible (as opposed @@ -4058,7 +4058,7 @@ declare module L { * Only accepts real L.Point instances, not arrays. */ transform(point: Point, scale?: number): Point; - + /** * Returns the reverse transformation of the given point, optionally divided * by the given scale. Only accepts real L.Point instances, not arrays. @@ -4066,7 +4066,7 @@ declare module L { untransform(point: Point, scale?: number): Point; } } - + declare module L { module Util { @@ -4076,18 +4076,18 @@ declare module L { * and returns the latter. Has an L.extend shortcut. */ export function extend(dest: any, ...sources: any[]): any; - + /** * Returns a function which executes function fn with the given scope obj (so * that this keyword refers to obj inside the function code). Has an L.bind shortcut. */ export function bind(fn: T, obj: any): T; - + /** * Applies a unique key to the object and returns that key. Has an L.stamp shortcut. */ export function stamp(obj: any): string; - + /** * Returns a wrapper around the function fn that makes sure it's called not more * often than a certain time interval time, but as fast as possible otherwise @@ -4096,46 +4096,46 @@ declare module L { * be called. */ export function limitExecByInterval(fn: T, time: number, context?: any): T; - + /** * Returns a function which always returns false. */ export function falseFn(): () => boolean; - + /** * Returns the number num rounded to digits decimals. */ export function formatNum(num: number, digits: number): number; - + /** * Trims and splits the string on whitespace and returns the array of parts. */ export function splitWords(str: string): string[]; - + /** * Merges the given properties to the options of the obj object, returning the * resulting options. See Class options. Has an L.setOptions shortcut. */ export function setOptions(obj: any, options: any): any; - + /** * Converts an object into a parameter URL string, e.g. {a: "foo", b: "bar"} * translates to '?a=foo&b=bar'. */ export function getParamString(obj: any): string; - + /** * Simple templating facility, creates a string by applying the values of the * data object of a form {a: 'foo', b: 'bar', …} to a template string of the form * 'Hello {a}, {b}' — in this example you will get 'Hello foo, bar'. */ export function template(str: string, data: any): string; - + /** * Returns true if the given object is an array. */ export function isArray(obj: any): boolean; - + /** * Trims the whitespace from both ends of the string and returns the result. */ @@ -4149,8 +4149,8 @@ declare module L { export var emptyImageUrl: string; } } - - + + declare module L { export interface WMSOptions { @@ -4161,37 +4161,37 @@ declare module L { * Default value: ''. */ layers?: string; - + /** * Comma-separated list of WMS styles. * * Default value: 'image/jpeg'. */ styles?: string; - + /** * WMS image format (use 'image/png' for layers with transparency). * * Default value: false. */ format?: string; - + /** * If true, the WMS service will return images with transparency. * * Default value: '1.1.1'. */ transparent?: boolean; - + /** * Version of the WMS service to use. */ version?: string; - + } } - - + + declare module L { export interface ZoomOptions { @@ -4204,7 +4204,7 @@ declare module L { position?: string; } } - + declare module L { export interface ZoomPanOptions { @@ -4237,10 +4237,10 @@ declare module L { debounceMoveend?: boolean; } } - + /** - * Forces Leaflet to use the Canvas back-end (if available) for vector layers - * instead of SVG. This can increase performance considerably in some cases + * Forces Leaflet to use the Canvas back-end (if available) for vector layers + * instead of SVG. This can increase performance considerably in some cases * (e.g. many thousands of circle markers on the map). */ declare var L_PREFER_CANVAS: boolean; @@ -4251,11 +4251,11 @@ declare var L_PREFER_CANVAS: boolean; declare var L_NO_TOUCH: boolean; /** - * Forces Leaflet to not use hardware-accelerated CSS 3D transforms for positioning + * Forces Leaflet to not use hardware-accelerated CSS 3D transforms for positioning * (which may cause glitches in some rare environments) even if they're supported. */ declare var L_DISABLE_3D: boolean; - + declare module "leaflet" { export = L; } diff --git a/log4js/log4js-tests.ts b/log4js/log4js-tests.ts index 10b6f9bbc..4fefc1caa 100644 --- a/log4js/log4js-tests.ts +++ b/log4js/log4js-tests.ts @@ -71,3 +71,4 @@ log4js.configure({ } }); +log4js.configure('file.json', { reloadSecs: 300 }); diff --git a/log4js/log4js.d.ts b/log4js/log4js.d.ts index 4e1cfc43b..28d821377 100644 --- a/log4js/log4js.d.ts +++ b/log4js/log4js.d.ts @@ -64,6 +64,7 @@ declare module "log4js" { export function shutdown(cb: Function): void; export function configure(config: IConfig, options?: any): void; + export function configure(filename: string, options?: any): void; export function setGlobalLogLevel(level: string): void; export function setGlobalLogLevel(level: Level): void; diff --git a/loggly/loggly-tests.ts b/loggly/loggly-tests.ts new file mode 100644 index 000000000..bf022999f --- /dev/null +++ b/loggly/loggly-tests.ts @@ -0,0 +1,12 @@ +/// +import loggly = require("loggly"); + +var options: loggly.LogglyOptions = { + token: "YOUR_TOKEN", + subdomain: "YOUR_DOMAIN", + tags: ["NodeJS"], + json: true +}; + +var client: loggly.Loggly = loggly.createClient(options) +client.log('hello world'); diff --git a/loggly/loggly-tests.ts.tscparams b/loggly/loggly-tests.ts.tscparams new file mode 100644 index 000000000..5f84b9777 --- /dev/null +++ b/loggly/loggly-tests.ts.tscparams @@ -0,0 +1 @@ +--noImplicitAny --module commonjs --target es5 diff --git a/loggly/loggly.d.ts b/loggly/loggly.d.ts new file mode 100644 index 000000000..40724f855 --- /dev/null +++ b/loggly/loggly.d.ts @@ -0,0 +1,25 @@ +// Type definitions for loggly 1.0.8 +// Project: https://github.com/nodejitsu/node-loggly +// Definitions by: Ray Martone +// Definitions: https://github.com/borisyankov/DefinitelyTyped +declare module "loggly" { + + interface LogglyOptions { + token: string; + subdomain: string; + tags?: string[]; + json?: boolean; + host?: string; + auth?: { + username: string; + password: string; + } + } + + interface Loggly { + log(message: any, tags?: string[], callback?: (err: any, results: any) => void): void; + log(message: any, callback?: (err: any, results: any) => void): void; + } + + function createClient(options: LogglyOptions): Loggly; +} diff --git a/lolex/lolex-tests.ts b/lolex/lolex-tests.ts new file mode 100644 index 000000000..10500211c --- /dev/null +++ b/lolex/lolex-tests.ts @@ -0,0 +1,116 @@ +/// + +import lolex = require("lolex"); + +function a() { + var clock = lolex.createClock(); + + clock.setTimeout(function () { + console.log("The poblano is a mild chili pepper originating in the state of Puebla, Mexico."); + }, 15); + + // ... + + clock.tick(15); +} + +function b() { + var clock = lolex.install(window); + + window.setTimeout(() => {}, 15); // Schedules with clock.setTimeout + + clock.uninstall(); + + // window.setTimeout is restored to the native implementation +} + +function c() { + var clock = lolex.install(); + + // Equivalent to + // var clock = lolex.install(typeof global !== "undefined" ? global : window); +} + +var clock: lolex.Clock; + +/** + * var clock = lolex.createClock([now]) + */ + +clock = lolex.createClock(); +clock = lolex.createClock(Date.now()); + + +/** + * var clock = lolex.install([context[, now[, toFake]]]) + */ + +clock = lolex.install(); +clock = lolex.install(window); +clock = lolex.install(window, Date.now()); +clock = lolex.install(window, Date.now(), ['setTimeout', 'clearTimeout']); + + +/** + * var clock = lolex.install([now[, toFake]]) + */ + +clock = lolex.install(Date.now()); +clock = lolex.install(Date.now(), ['setTimeout', 'clearTimeout']); + + +var id: number; +/** + * var id = clock.setTimeout(callback, timeout) + */ + +id = clock.setTimeout(() => {}, 1000); + + +/** + * clock.clearTimeout(id) + */ + +clock.clearTimeout(id); + + +/** + * var id = clock.setInterval(callback, timeout) + */ + +id = clock.setInterval(() => {}, 1000); + + +/** + * clock.clearInterval(id) + */ + +clock.clearInterval(id); + + +/** + * var id = clock.setImmediate(callback) + */ + +id = clock.setImmediate(() => {}); + + +/** + * clock.clearImmediate(id) + */ + +clock.clearImmediate(id); + + +/** + * clock.tick(time) + */ + +clock.tick(1000); + + +/** + * clock.uninstall() + */ + +clock.uninstall(); diff --git a/lolex/lolex.d.ts b/lolex/lolex.d.ts new file mode 100644 index 000000000..bc0f0c81c --- /dev/null +++ b/lolex/lolex.d.ts @@ -0,0 +1,24 @@ +// Type definitions for lolex 1.2.1 +// Project: https://github.com/sinonjs/lolex +// Definitions by: Wim Looman +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module 'lolex' { + export interface Clock { + setTimeout(callback: () => any, timeout: number): number; + setInterval(callback: () => any, timeout: number): number; + setImmediate(callback: () => any): number; + + clearTimeout(id: number): void; + clearInterval(id: number): void; + clearImmediate(id: number): void; + + tick(ms: number): void; + uninstall(): void; + } + + export function createClock(now?: number): Clock; + + export function install(now?: number, toFake?: string[]): Clock; + export function install(context?: any, now?: number, toFake?: string[]): Clock; +} diff --git a/mariasql/mariasql-tests.ts b/mariasql/mariasql-tests.ts new file mode 100644 index 000000000..554d3d4a7 --- /dev/null +++ b/mariasql/mariasql-tests.ts @@ -0,0 +1,198 @@ +// These are the examples from the node-mariasql README transposed to TypeScript +// https://github.com/mscdex/node-mariasql + +/// + +// Example 1 - SHOW DATABASES +import util = require('util'); +import Client = require('mariasql'); + +var c:Client = new Client(), + inspect = util.inspect; + +c.connect({ + host: '127.0.0.1', + user: 'foo', + password: 'bar' +}); + +c.on('connect', function () { + console.log('Client connected'); +}) + .on('error', function (err) { + console.log('Client error: ' + err); + }) + .on('close', function (hadError) { + console.log('Client closed'); + }); + +c.query('SHOW DATABASES') + .on('result', function (res) { + res.on('row', function (row) { + console.log('Result row: ' + inspect(row)); + }) + .on('error', function (err) { + console.log('Result error: ' + inspect(err)); + }) + .on('end', function (info) { + console.log('Result finished successfully'); + }); + }) + .on('end', function () { + console.log('Done with all results'); + }); + +c.end(); + + +// Example 2 - Query Placeholders +var c = new Client(); + +c.connect({ + host: '127.0.0.1', + user: 'foo', + password: 'bar', + db: 'mydb' +}); + +c.on('connect', function () { + console.log('Client connected'); +}) + .on('error', function (err) { + console.log('Client error: ' + err); + }) + .on('close', function (hadError) { + console.log('Client closed'); + }); + +c.query('SELECT * FROM users WHERE id = :id AND name = :name', + {id: 1337, name: 'Frylock'}) + .on('result', function (res) { + res.on('row', function (row) { + console.log('Result row: ' + inspect(row)); + }) + .on('error', function (err) { + console.log('Result error: ' + inspect(err)); + }) + .on('end', function (info) { + console.log('Result finished successfully'); + }); + }) + .on('end', function () { + console.log('Done with all results'); + }); + +c.query('SELECT * FROM users WHERE id = ? AND name = ?', + [1337, 'Frylock']) + .on('result', function (res) { + res.on('row', function (row) { + console.log('Result row: ' + inspect(row)); + }) + .on('error', function (err) { + console.log('Result error: ' + inspect(err)); + }) + .on('end', function (info) { + console.log('Result finished successfully'); + }); + }) + .on('end', function () { + console.log('Done with all results'); + }); + +c.end(); + + +// Example 3 prepared query +c = new Client(); + +c.connect({ + host: '127.0.0.1', + user: 'foo', + password: 'bar', + db: 'mydb' +}); + +c.on('connect', function () { + console.log('Client connected'); +}) + .on('error', function (err) { + console.log('Client error: ' + err); + }) + .on('close', function (hadError) { + console.log('Client closed'); + }); + +var pq = c.prepare('SELECT * FROM users WHERE id = :id AND name = :name'); + +c.query(pq({id: 1337, name: 'Frylock'})) + .on('result', function (res) { + res.on('row', function (row) { + console.log('Result row: ' + inspect(row)); + }) + .on('error', function (err) { + console.log('Result error: ' + inspect(err)); + }) + .on('end', function (info) { + console.log('Result finished successfully'); + }); + }) + .on('end', function () { + console.log('Done with all results'); + }); + +c.end(); + + +// Example 4 - Abort Query +c = new Client() +var qcnt:number = 0; + +c.connect({ + host: '127.0.0.1', + user: 'foo', + password: 'bar', + multiStatements: true +}); + +c.on('connect', function () { + console.log('Client connected'); +}) + .on('error', function (err) { + console.log('Client error: ' + err); + }) + .on('close', function (hadError) { + console.log('Client closed'); + }); + +c.query('SELECT "first query"; SELECT "second query"; SELECT "third query"', true) + .on('result', function (res) { + if (++qcnt === 2) + res.abort(); + res.on('row', function (row) { + console.log('Query #' + (qcnt) + ' row: ' + inspect(row)); + }) + .on('error', function (err) { + console.log('Query #' + (qcnt) + ' error: ' + inspect(err)); + }) + .on('abort', function () { + console.log('Query #' + (qcnt) + ' was aborted'); + }) + .on('end', function (info) { + console.log('Query #' + (qcnt) + ' finished successfully'); + }); + }) + .on('end', function () { + console.log('Done with all queries'); + }); + +c.end(); +/* output: + Client connected + Query #1 row: [ 'first query' ] + Query #1 finished successfully + Query #2 was aborted + Query #3 row: [ 'third query' ] + Query #3 finished successfully + Done with all queries + Client closed + */ \ No newline at end of file diff --git a/mariasql/mariasql.d.ts b/mariasql/mariasql.d.ts new file mode 100644 index 000000000..2c375a173 --- /dev/null +++ b/mariasql/mariasql.d.ts @@ -0,0 +1,97 @@ +// Type definitions for mariasql v0.1.22 +// Project: https://github.com/mscdex/node-mariasql +// Definitions by: MichaelBennett +// Definitions: https://github.com/borisyankov/DefinitelyTyped + + +/** + */ +interface MariaCallBackError { + (error:Error):void +} + +interface MariaCallBackResult { + (result:MariaResult):void +} + +interface MariaCallBackRow { + (result:Array):void +} + +interface MariaCallBackBoolean { + (result:boolean):void +} + +interface MariaCallBackObject { + (result:Object):void +} + +interface MariaCallBackVoid { + ():void +} + +interface Dictionary { + [index: string]: any; +} + +interface MariaPreparedQuery { + (values:Dictionary):string; + (values:Array):string; +} + +interface ClientConfig { + host: string; + user: string; + password: string; + db?: string; + port?: number; + unixSocket?: string; + keepQueries?: boolean; + multiStatements?: boolean; + connTimeout?: number; + pingInterval?: number; + secureAuth?: boolean; + compress?: boolean; + ssl?:any; + local_infile?: boolean; + read_default_group?: string; + charset?: string; +} + +declare class MariaResult { + on(signal:string, cb:MariaCallBackObject):MariaResult; // signal 'end' + on(signal:string, cb:MariaCallBackError):MariaResult; // signal 'error' + on(signal:string, cb:MariaCallBackRow):MariaResult; // signal 'row' + on(signal:string, cb:MariaCallBackVoid):MariaResult; // signal 'abort' + abort():void; +} + +declare class MariaQuery { + on(signal:string, cb:MariaCallBackResult):MariaQuery; // signal 'result' + on(signal:string, cb:MariaCallBackVoid):MariaQuery; // signal 'end' + on(signal:string, cb:MariaCallBackVoid):MariaQuery; // signal 'abort' + on(signal:string, cb:MariaCallBackError):MariaQuery; // signal 'error' + abort():void; +} + +declare class MariaClient { + connect(config:ClientConfig):void; + end():void; + destroy():void; + escape(query:string):string; + query(q:string, placeHolders?:Dictionary, useArray?:boolean):MariaQuery; + query(q:string, placeHolders?:Array, useArray?:boolean):MariaQuery; + query(q:string, useArray?:boolean):MariaQuery; + prepare(query:string): MariaPreparedQuery; + isMariaDB():boolean; + on(signal:string, cb:MariaCallBackError): MariaClient; // signal 'error' + on(signal:string, cb:MariaCallBackObject): MariaClient; // signal 'close' + on(signal:string, cb:MariaCallBackVoid): MariaClient; // signal 'connect' + connected: boolean; + threadId: string; +} + +declare module 'mariasql' { + export = MariaClient; +} + diff --git a/maskedinput/maskedinput.d.ts.tscparams b/maskedinput/maskedinput.d.ts.tscparams deleted file mode 100644 index ce89a9e7d..000000000 --- a/maskedinput/maskedinput.d.ts.tscparams +++ /dev/null @@ -1 +0,0 @@ ---noImplicitAny --module commonjs --target es5 \ No newline at end of file diff --git a/mocha/mocha.d.ts b/mocha/mocha.d.ts index 6a2a53959..3f5d3e571 100644 --- a/mocha/mocha.d.ts +++ b/mocha/mocha.d.ts @@ -37,10 +37,10 @@ interface MochaSetupOptions { reporter?: any; // bail on the first test failure - bail?: Boolean; + bail?: boolean; // ignore global leaks - ignoreLeaks?: Boolean; + ignoreLeaks?: boolean; // grep string or regexp to filter tests with grep?: any; diff --git a/mock-fs/mock-fs-tests.ts b/mock-fs/mock-fs-tests.ts new file mode 100644 index 000000000..3dd9f0121 --- /dev/null +++ b/mock-fs/mock-fs-tests.ts @@ -0,0 +1,79 @@ +/// + +var mock = require('mock-fs'); + +function a() { + mock({ + 'path/to/fake/dir': { + 'some-file.txt': 'file content here', + 'empty-dir': {/** empty directory */} + }, + 'path/to/some.png': new Buffer([8, 6, 7, 5, 3, 0, 9]), + 'some/other/path': {/** another empty directory */} + }); + + // after a test runs + mock.restore(); +} + +function b() { + mock({ + 'path/to/file.txt': 'file content here' + }); +} + +function c() { + mock({ + foo: mock.file({ + content: 'file content here', + ctime: new Date(1), + mtime: new Date(1) + }) + }); +} + +function d() { + // note that this could also be written as + // mock({'path/to/dir': { /** config */ }}) + mock({ + path: { + to: { + dir: { + file1: 'text content', + file2: new Buffer([1, 2, 3, 4]) + } + } + } + }); +} + +function e() { + mock({ + 'some/dir': mock.directory({ + mode: 0755, + items: { + file1: 'file one content', + file2: new Buffer([8, 6, 7, 5, 3, 0, 9]) + } + }) + }); +} + +function f() { + mock({ + 'some/dir': { + 'regular-file': 'file contents', + 'a-symlink': mock.symlink({ + path: 'regular-file' + }) + } + }); +} + +var mockedFS = mock.fs({ + '/file': 'blah' +}); + +if (mockedFS.readFileSync('/file', { encoding: 'utf8' }) === 'blah') { + console.log('woo'); +} diff --git a/mock-fs/mock-fs.d.ts b/mock-fs/mock-fs.d.ts new file mode 100644 index 000000000..539e74e86 --- /dev/null +++ b/mock-fs/mock-fs.d.ts @@ -0,0 +1,51 @@ +// Type definitions for mock-fs 2.5.0 +// Project: https://github.com/tschaub/mock-fs +// Definitions by: Wim Looman +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module "mock-fs" { + import fs = require("fs"); + + function mock(config?: mock.Config): void; + + module mock { + function file(config: FileConfig): File; + function directory(config: DirectoryConfig): Directory; + function symlink(config: SymlinkConfig): Symlink; + + function restore(): void; + + function fs(config?: Config): typeof fs; + + interface Config { + [path: string]: string | Buffer | File | Directory | Symlink | Config; + } + + interface CommonConfig { + mode?: number; + uid?: number; + git?: number; + atime?: Date; + ctime?: Date; + mtime?: Date; + } + + interface FileConfig extends CommonConfig { + content: string | Buffer; + } + interface DirectoryConfig extends CommonConfig { + items: Config; + } + interface SymlinkConfig extends CommonConfig { + path: string; + } + + class File { private _file: any; } + class Directory { private _directory: any; } + class Symlink { private _symlink: any; } + } + + export = mock; +} diff --git a/mongoose/mongoose.d.ts b/mongoose/mongoose.d.ts index 8c60b638f..fedd8fec6 100644 --- a/mongoose/mongoose.d.ts +++ b/mongoose/mongoose.d.ts @@ -128,7 +128,7 @@ declare module "mongoose" { versionKey?: boolean; } - export interface Model { + export interface Model extends NodeJS.EventEmitter { new(doc: Object): T; aggregate(...aggregations: Object[]): Aggregate; diff --git a/mssql/mssql-tests.ts b/mssql/mssql-tests.ts new file mode 100644 index 000000000..5a7e3e305 --- /dev/null +++ b/mssql/mssql-tests.ts @@ -0,0 +1,70 @@ +/// +/// + +import sql = require('mssql'); + +var config: sql.config = { + user: 'user', + password: 'password', + server: 'ip', + database: 'database', + connectionTimeout: 10000, + options: { + encrypt: true + } +} + +var connection: sql.Connection = new sql.Connection(config, function (err: any) { + if (err != null) { + console.warn("Issue with connecting to SQL Server!"); + } + else { + var requestQuery = new sql.Request(connection); + + var getArticlesQuery = "SELECT * FROM TABLE"; + + requestQuery.query(getArticlesQuery, function (err, recordSet) { + if (err) { + console.error('Error happened calling Query: ' + err.name + " " + err.message); + + } + // checking to see if the articles returned as at least one. + else if (recordSet.length > 0) { + } + }); + + var requestStoredProcedure = new sql.Request(connection); + var testId: number = 0; + var testString: string = 'test'; + + requestStoredProcedure.input('pId', testId); + requestStoredProcedure.input('pString', testString); + + + requestStoredProcedure.execute('StoredProcedureName', function (err, recordsets, returnValue) { + if (err != null) { + console.error('Error happened calling Query: ' + err.name + " " + err.message); + } + else { + console.info(returnValue); + } + }); + + var requestStoredProcedureWithOutput = new sql.Request(connection); + var testId: number = 0; + var testString: string = 'test'; + + requestStoredProcedure.input('pId', testId); + requestStoredProcedure.input('pString', testString); + requestStoredProcedure.output('output', sql.Int); + + requestStoredProcedure.execute('StoredProcedureName', function (err, recordsets, returnValue) { + if (err != null) { + console.error('Error happened calling Query: ' + err.name + " " + err.message); + } + else { + console.info(requestStoredProcedureWithOutput.parameters.output.value); + } + }); + } +}); diff --git a/mssql/mssql.d.ts b/mssql/mssql.d.ts new file mode 100644 index 000000000..5a6e6a00c --- /dev/null +++ b/mssql/mssql.d.ts @@ -0,0 +1,96 @@ +// Type definitions for mssql +// Project: https://www.npmjs.com/package/mssql +// Definitions by: COLSA Corporation +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module "mssql" { + + export var DateTime: any; + export var NVarChar: any; + export var Int: any; + export var Bit: any; + export var VarBinary: any; + export var TVP: any; + + export interface options { + encrypt: boolean; + } + + export interface pool { + min: number; + max: number; + idleTimeoutMillis: number; + } + + export interface config { + driver?: string; + user?: string; + password?: string; + server: string; + port?: number; + domain?: string; + database: string; + connectionTimeout?: number; + requestTimeout?: number; + stream?: boolean; + options?: options; + pool?: pool; + + } + + export class Connection { + + public constructor(config: config, callback?: (err?: any) => void); + + public connect(callback?: (err?: any) => void): void; + + public close(): void; + } + + class columns { + public add(name: string, type: any, options: any): void; + } + + class rows { + public add(row: any): void; + } + + export class Table { + public create: boolean; + public columns: columns; + public rows: rows; + public constructor(tableName: string); + + } + + export class Request { + public constructor(connection?: Connection); + public execute(procedure: string, callback?: (err?: any, recordsets?: any, returnValue?: any) => void): void; + public input(name: string, value: any): void; + public input(name: string, type: any, value: any): void; + public output(name: string, type: any, value?: any): void; + public pipe(stream: any): void; + public query(command: string, callback?: (err?: any, recordset?: any) => void): void; + public batch(batch: string, callback?: (err?: any, recordset?: any) => void): void; + public bulk(table: Table, callback?: (err?: any, rowCount?: any) => void): void; + public cancel(): void; + public parameters: any; + } + + export class Transaction { + public constructor(connection?: Connection); + public begin(isolationLevel?: any, callback?: (err?: any) => void): void; + public begin(callback?: (err?: any) => void): void; + public commit(callback?: (err?: any) => void): void; + public rollback(callback?: (err?: any) => void): void; + } + + export class PreparedStatement { + public constructor(connection?: Connection); + public input(name: string, type: any): void; + public output(name: string, type: any): void; + public prepare(statement: string, callback?: (err?: any) => void): void; + public execute(values: any, callback?: (err?: any) => void): void; + public unprepare(callback?: (err?: any) => void): void; + } +} diff --git a/mysql/mysql.d.ts b/mysql/mysql.d.ts index 4c701b931..9b6ed7998 100644 --- a/mysql/mysql.d.ts +++ b/mysql/mysql.d.ts @@ -83,6 +83,9 @@ declare module "mysql" { query: IQueryFunction; + end(): void; + end(callback: (err: IError, ...args: any[]) => void): void; + on(ev: string, callback: (...args: any[]) => void): IPool; on(ev: 'connection', callback: (connection: IConnection) => void): IPool; on(ev: 'error', callback: (err: IError) => void): IPool; diff --git a/ngprogress-lite/ngprogress-lite.d.ts b/ngprogress-lite/ngprogress-lite.d.ts index bdee71673..20f0c6c0c 100644 --- a/ngprogress-lite/ngprogress-lite.d.ts +++ b/ngprogress-lite/ngprogress-lite.d.ts @@ -3,7 +3,7 @@ // Definitions by: Luke Forder // Definitions: https://github.com/borisyankov/DefinitelyTyped -declare module ng.progressLite { +declare module angular.progressLite { export interface INgProgressLite { set(num: number): INgProgressLite; @@ -25,4 +25,4 @@ declare module ng.progressLite { export interface INgProgressLiteProvider { settings: IConfigurationOptions; } -} \ No newline at end of file +} diff --git a/node-git/node-git-tests.ts b/node-git/node-git-tests.ts index f1e5e969b..0924bedb9 100644 --- a/node-git/node-git-tests.ts +++ b/node-git/node-git-tests.ts @@ -3,7 +3,7 @@ import base = require("git"); var git = new base.Git("../.git"); -git.call_git("", "clone", "", {}, ["https://github.com/borisyankov/DefinitelyTyped.git", "d.ts"], (err, data) => { +git.call_git("", "clone", "", {}, ["https://github.com/borisyankov/DefinitelyTyped.git", "d.ts"], function (err, data) { console.log(arguments); }); diff --git a/node/node-0.10.d.ts b/node/node-0.10.d.ts index 28f0a3bc5..74e6cd3ea 100644 --- a/node/node-0.10.d.ts +++ b/node/node-0.10.d.ts @@ -79,7 +79,7 @@ declare var Buffer: { ************************************************/ declare module NodeJS { export interface ErrnoException extends Error { - errno?: any; + errno?: number; code?: string; path?: string; syscall?: string; @@ -319,32 +319,26 @@ declare module "http" { end(str: string, encoding?: string, cb?: Function): void; end(data?: any, encoding?: string): void; } - export interface ClientRequest extends events.EventEmitter, stream.Writable { - // Extended base methods - write(buffer: Buffer): boolean; - write(buffer: Buffer, cb?: Function): boolean; - write(str: string, cb?: Function): boolean; - write(str: string, encoding?: string, cb?: Function): boolean; - write(str: string, encoding?: string, fd?: string): boolean; - write(chunk: any, encoding?: string): void; + /** + * Object returned by http.request() + */ + export interface ClientRequest extends events.EventEmitter, NodeJS.WritableStream { abort(): void; setTimeout(timeout: number, callback?: Function): void; setNoDelay(noDelay?: boolean): void; setSocketKeepAlive(enable?: boolean, initialDelay?: number): void; - - // Extended base methods - end(): void; - end(buffer: Buffer, cb?: Function): void; - end(str: string, cb?: Function): void; - end(str: string, encoding?: string, cb?: Function): void; - end(data?: any, encoding?: string): void; } - export interface ClientResponse extends events.EventEmitter, stream.Readable { + + /** + * The client version of http.IncomingMessage + */ + export interface ClientResponse extends events.EventEmitter, NodeJS.ReadableStream { statusCode: number; httpVersion: string; headers: any; trailers: any; + socket: net.Socket; setEncoding(encoding?: string): void; pause(): void; resume(): void; @@ -386,17 +380,65 @@ declare module "http" { destroy(): void; } + /** + * Options for http.request() + */ + export interface RequestOptions { + /** + * A domain name or IP address of the server to issue the request to. Defaults to 'localhost'. + */ + host?: string; + /** + * To support url.parse() hostname is preferred over host + */ + hostname?: string; + /** + * Port of remote server. Defaults to 80. + */ + port?: number; + /** + * Local interface to bind for network connections. + */ + localAddress?: string; + /** + * Unix Domain Socket (use one of host:port or socketPath) + */ + socketPath?: string; + /** + * A string specifying the HTTP request method. Defaults to 'GET'. + */ + method?: string; + /** + * Request path. Defaults to '/'. Should include query string if any. E.G. '/index.html?page=12' + */ + path?: string; + /** + * An object containing request headers. + */ + headers?: { [index: string]: string }; + /** + * Basic authentication i.e. 'user:password' to compute an Authorization header. + */ + auth?: string; + /** + * Controls Agent behavior. When an Agent is used request will default to Connection: keep-alive. Possible values: + * - undefined (default): use global Agent for this host and port. + * - Agent object: explicitly use the passed in Agent. + * - false: opts out of connection pooling with an Agent, defaults request to Connection: close. + */ + agent?: Agent|boolean; + } + export var STATUS_CODES: { [errorCode: number]: string; [errorCode: string]: string; }; export function createServer(requestListener?: (request: ServerRequest, response: ServerResponse) =>void ): Server; export function createClient(port?: number, host?: string): any; - export function request(options: any, callback?: Function): ClientRequest; - export function get(options: any, callback?: Function): ClientRequest; + export function request(options: RequestOptions, callback?: (response: ClientResponse) => void): ClientRequest; + export function get(options: RequestOptions, callback?: (response: ClientResponse) => void): ClientRequest; export var globalAgent: Agent; } - declare module "cluster" { import child = require("child_process"); import events = require("events"); diff --git a/node/node-0.11-tests.ts b/node/node-0.11-tests.ts index 5a0c294d4..38bae0d57 100644 --- a/node/node-0.11-tests.ts +++ b/node/node-0.11-tests.ts @@ -60,6 +60,13 @@ class Networker extends events.EventEmitter { } } +var errno: number; +fs.readFile('testfile', (err, data) => { + if (err && err.errno) { + errno = err.errno; + } +}); + url.format(url.parse('http://www.example.com/xyz')); // https://google.com/search?q=you're%20a%20lizard%2C%20gary diff --git a/node/node-0.11.d.ts b/node/node-0.11.d.ts index 302ba12a9..ec22b92a8 100644 --- a/node/node-0.11.d.ts +++ b/node/node-0.11.d.ts @@ -79,7 +79,7 @@ declare var Buffer: { ************************************************/ declare module NodeJS { export interface ErrnoException extends Error { - errno?: any; + errno?: number; code?: string; path?: string; syscall?: string; diff --git a/node/node-0.8.8.d.ts b/node/node-0.8.8.d.ts index 274a580d8..cf61184a4 100644 --- a/node/node-0.8.8.d.ts +++ b/node/node-0.8.8.d.ts @@ -68,6 +68,12 @@ declare var Buffer: { * INTERFACES * * * ************************************************/ +interface ErrnoException extends Error { + errno?: number; + code?: string; + path?: string; + syscall?: string; +} interface EventEmitter { addListener(event: string, listener: Function); @@ -730,9 +736,9 @@ declare module "fs" { export function fchmodSync(fd: string, mode: string): void; export function lchmod(path: string, mode: string, callback?: Function): void; export function lchmodSync(path: string, mode: string): void; - export function stat(path: string, callback?: (err: Error, stats: Stats) =>any): Stats; - export function lstat(path: string, callback?: (err: Error, stats: Stats) =>any): Stats; - export function fstat(fd: string, callback?: (err: Error, stats: Stats) =>any): Stats; + export function stat(path: string, callback?: (err: ErrnoException, stats: Stats) =>any): Stats; + export function lstat(path: string, callback?: (err: ErrnoException, stats: Stats) =>any): Stats; + export function fstat(fd: string, callback?: (err: ErrnoException, stats: Stats) =>any): Stats; export function statSync(path: string): Stats; export function lstatSync(path: string): Stats; export function fstatSync(fd: string): Stats; @@ -740,9 +746,9 @@ declare module "fs" { export function linkSync(srcpath: string, dstpath: string): void; export function symlink(srcpath: string, dstpath: string, type?: string, callback?: Function): void; export function symlinkSync(srcpath: string, dstpath: string, type?: string): void; - export function readlink(path: string, callback?: (err: Error, linkString: string) =>any): void; - export function realpath(path: string, callback?: (err: Error, resolvedPath: string) =>any): void; - export function realpath(path: string, cache: string, callback: (err: Error, resolvedPath: string) =>any): void; + export function readlink(path: string, callback?: (err: ErrnoException, linkString: string) =>any): void; + export function realpath(path: string, callback?: (err: ErrnoException, resolvedPath: string) =>any): void; + export function realpath(path: string, cache: string, callback: (err: ErrnoException, resolvedPath: string) =>any): void; export function realpathSync(path: string, cache?: string): void; export function unlink(path: string, callback?: Function): void; export function unlinkSync(path: string): void; @@ -750,11 +756,11 @@ declare module "fs" { export function rmdirSync(path: string): void; export function mkdir(path: string, mode?: string, callback?: Function): void; export function mkdirSync(path: string, mode?: string): void; - export function readdir(path: string, callback?: (err: Error, files: string[]) => void): void; + export function readdir(path: string, callback?: (err: ErrnoException, files: string[]) => void): void; export function readdirSync(path: string): string[]; export function close(fd: string, callback?: Function): void; export function closeSync(fd: string): void; - export function open(path: string, flags: string, mode?: string, callback?: (err: Error, fd: string) =>any): void; + export function open(path: string, flags: string, mode?: string, callback?: (err: ErrnoException, fd: string) =>any): void; export function openSync(path: string, flags: string, mode?: string): void; export function utimes(path: string, atime: number, mtime: number, callback?: Function): void; export function utimesSync(path: string, atime: number, mtime: number): void; @@ -766,8 +772,8 @@ declare module "fs" { export function writeSync(fd: string, buffer: Buffer, offset: number, length: number, position: number): void; export function read(fd: string, buffer: Buffer, offset: number, length: number, position: number, callback?: (err: Error, bytesRead: number, buffer: Buffer) => void): void; export function readSync(fd: string, buffer: Buffer, offset: number, length: number, position: number): any[]; - export function readFile(filename: string, encoding: string, callback: (err: Error, data: string) => void ): void; - export function readFile(filename: string, callback: (err: Error, data: Buffer) => void ): void; + export function readFile(filename: string, encoding: string, callback: (err: ErrnoException, data: string) => void ): void; + export function readFile(filename: string, callback: (err: ErrnoException, data: Buffer) => void ): void; export function readFileSync(filename: string): Buffer; export function readFileSync(filename: string, encoding: string): string; export function writeFile(filename: string, data: any, callback?: (err) => void): void; diff --git a/node/node-tests.ts b/node/node-tests.ts index deb5f24ee..8c381bc0e 100644 --- a/node/node-tests.ts +++ b/node/node-tests.ts @@ -61,6 +61,13 @@ class Networker extends events.EventEmitter { } } +var errno: number; +fs.readFile('testfile', (err, data) => { + if (err && err.errno) { + errno = err.errno; + } +}); + //////////////////////////////////////////////////// /// Url tests : http://nodejs.org/api/url.html //////////////////////////////////////////////////// diff --git a/node/node.d.ts b/node/node.d.ts index 0ca514e9e..3838a2952 100644 --- a/node/node.d.ts +++ b/node/node.d.ts @@ -79,7 +79,7 @@ declare var Buffer: { ************************************************/ declare module NodeJS { export interface ErrnoException extends Error { - errno?: any; + errno?: number; code?: string; path?: string; syscall?: string; @@ -98,7 +98,7 @@ declare module NodeJS { export interface ReadableStream extends EventEmitter { readable: boolean; - read(size?: number): any; + read(size?: number): string|Buffer; setEncoding(encoding: string): void; pause(): void; resume(): void; @@ -697,6 +697,18 @@ declare module "child_process" { killSignal?: string; encoding?: string; }): ChildProcess; + export function execFileSync(command: string, args?: string[], options?: { + cwd?: string; + input?: string|Buffer; + stdio?: any; + env?: any; + uid?: number; + gid?: number; + timeout?: number; + maxBuffer?: number; + killSignal?: string; + encoding?: string; + }): ChildProcess; } declare module "url" { @@ -775,7 +787,10 @@ declare module "net" { ref(): void; remoteAddress: string; + remoteFamily: string; remotePort: number; + localAddress: string; + localPort: number; bytesRead: number; bytesWritten: number; @@ -1210,7 +1225,7 @@ declare module "stream" { readable: boolean; constructor(opts?: ReadableOptions); _read(size: number): void; - read(size?: number): any; + read(size?: number): string|Buffer; setEncoding(encoding: string): void; pause(): void; resume(): void; diff --git a/nouislider/nouislider-tests.ts b/nouislider/nouislider-tests.ts new file mode 100644 index 000000000..3a0da493a --- /dev/null +++ b/nouislider/nouislider-tests.ts @@ -0,0 +1,75 @@ +/// +/// + +//basic +var basicSlider = $("
    ").noUiSlider({ + start: 80, + range: { + 'min': 0, + 'max': 10000 + } +}); + +//all options +var allOptions = $("
    ").noUiSlider({ + start: [ 20, 80 ], + step: 10, + margin: 20, + connect: true, + direction: 'rtl', + orientation: 'vertical', + + // Configure tapping, or make the selected range dragable. + behaviour: 'tap-drag', + + // Full number format support. + format: wNumb({ + mark: ',', + decimals: 1 + }), + + // Support for non-linear ranges by adding intervals. + range: { + 'min': 0, + 'max': 100 + } +}); + + +//PIPS +allOptions.noUiSlider_pips({ + mode: 'steps', + density: 3, + filter: function(){return 1}, + format: wNumb({ + decimals: 2, + prefix: '$' + }) +}); + + +basicSlider.noUiSlider_pips({ + mode: 'values', + values: [50, 552, 4651, 4952, 5000, 7080, 9000], + density: 4, + stepped: true +}); + +//functions + +allOptions.val(); + +// Set one value +basicSlider.val(10); +basicSlider.val([150]); + +// Set the upper handle, +// don't change the lower one. +allOptions.val([null, 14]); + +// Set both slider handles +allOptions.val([13.2, 15.7]); + + +//link +allOptions.Link('lower').to($('')); diff --git a/nouislider/nouislider.d.ts b/nouislider/nouislider.d.ts new file mode 100644 index 000000000..5b1700b23 --- /dev/null +++ b/nouislider/nouislider.d.ts @@ -0,0 +1,150 @@ +// Type definitions for nouislider v7.0.10 +// Project: https://github.com/leongersen/noUiSlider +// Definitions by: Corey Jepperson +// Definitions: https://github.com/borisyankov/DefinitelyTyped +/// +/// + + +interface noUiSliderInstance extends JQuery{ + /** + * For one-handle sliders, calling .val() will return the value. + * For two-handle sliders, an array[value, value] will be returned. + */ + val(): number | number[]; + /** + * noUiSlider will keep your values within the slider range, which saves you a bunch of validation. + * If you have set the slider to use one handle, simply set it on the slider using the .val() method. + * If you have two handles, pass an array. One-handled sliders will also accept arrays. + * Within an array, you can set a position to null if you want to leave a handle unchanged. + */ + val(value: any): JQuery; //can't enforce number as it breaks extend + /** + * noUiSlider has full support for libLink, which will let you write values to input elements very easily. + * libLink will update the slider if you change an input as well! + */ + Link(target: string, method?: any, format?:any): any; +} + + + +interface noUiSliderOptions { + /** + * The start option sets the number of handles and their start positions, relative to range. + */ + start: number | number[] | number[][]; + /** + * The connect setting can be used to control the bar between the handles, + * or the edges of the slider. Use "lower" to connect to the lower side, + * or "upper" to connect to the upper side. Setting true sets the bar between the handles. + */ + range: Object; + /** + * noUiSlider offers several ways to handle user interaction. + * The range can be set to drag, and handles can move to taps. + * All these effects are optional, and can be enable by adding their keyword to the behaviour option. + * This option accepts a "-" separated list of "drag", "tap", "fixed", "snap" or "none". + */ + connect?: string | boolean; + /** + * When using two handles, the minimum distance between the handles can be set using the margin option. + * The margin value is relative to the value set in 'range'. + * This option is only available on standard linear sliders. + */ + margin?: number; + /** + * The limit option is the oposite of the margin option, + * limiting the maximum distance between two handles. + * As with the margin option, the limit option can only be used on linear sliders. + */ + limit?: number; + /** + * By default, the slider slides fluently. + * In order to make the handles jump between intervals, you can use this option. + * The step option is relative to the values provided to range. + */ + step?: number; + /** + * The orientation setting can be used to set the slider to "vertical" or "horizontal". + * Set dimensions! Vertical sliders don't assume a default height, so you'll need to set one. + * You can use any unit you want, including % or px. + */ + orientation?: string; + /** + * By default the sliders are top-to-bottom and left-to-right, + * but you can change this using the direction option, + * which decides where the upper side of the slider is. + */ + direction?: string; + /** + * Set the animate option to false to prevent the slider from animating to a new value with when calling .val(). + */ + animate?: boolean; + /** + * All values on the slider are part of a range. The range has a minimum and maximum value. + * + behaviour?: string; + /** + * To format the slider output, noUiSlider offers a format option. + * Simply specify to and from functions to encode and decode the values. + * See manual formatting to the right for usage information. + * By default, noUiSlider will format output with 2 decimals. + * Manual formatting can be very tedious, so noUiSlider has support for the wNumb formatting library. + * wNumb offers a wide range of options and provides number validation. + */ + format?: Object | ((...args:any[]) => any); + +} + +interface noUiSliderPipsOptions { + /** + * The range mode uses the slider range to determine where the pips should be. A pip is generated for every percentage specified. + * + * Like range, the steps mode uses the slider range. In steps mode, a pip is generated for every step. + * The filter option can be used to filter the generated pips. + * The filter function must return 0 (no value), 1 (large value) or 2 (small value). + * + * In positions mode, pips are generated at percentage-based positions on the slider. Optionally, the stepped option can be set to true to match the pips to the slider steps. + * + * The count mode can be used to generate a fixed number of pips. As with positions mode, the stepped option can be used. + * + * The values mode is similar to positions, but it accepts values instead of percentages. The stepped option can be used for this mode. + * + */ + mode: string; + /** + * Range Mode: percentage for range mode + * Step Mode: step number for steps + * Positions Mode: percentage-based positions on the slider + * Count Mode: positions between pips + */ + density?: number; + /** + * Step Mode: The filter option can be used to filter the generated pips. + * The filter function must return 0 (no value), 1 (large value) or 2 (small value). + */ + filter?: (...args:any[]) => number; + /** + * format for step mode + * see noUiSlider format + */ + format?: Object; + /** + * + * values for positions and values mode + * number pips for count mode + */ + values?: number | number[]; + /** + * stepped option for positions, values and count mode + */ + stepped?: boolean; + + +} + + +interface JQuery { + noUiSlider(options?: noUiSliderOptions): noUiSliderInstance; + noUiSlider_pips(options?: noUiSliderPipsOptions): noUiSliderInstance; +} \ No newline at end of file diff --git a/numeraljs/numeraljs-commonjs-tests.ts b/numeraljs/numeraljs-commonjs-tests.ts new file mode 100644 index 000000000..5e9af5388 --- /dev/null +++ b/numeraljs/numeraljs-commonjs-tests.ts @@ -0,0 +1,44 @@ +/// +import numeral = require("numeral"); + +var valueFormat: string = numeral(1000).format('0,0'); +// '1,000' + +var valueUnformat: number = numeral().unformat('($10,000.00)'); +// '-10000' + +var value3: Numeral = numeral(1000); +var added: Numeral = value3.add(10); +// 1010 + +var value4: Numeral = numeral(1000); +var formatValue4a: string = value4.format('0,0'); +// '1,000' +var formatValue4b: number = value4.value(); +// 1000 + +var value5: Numeral = numeral(); +value5.set(1000); +var value5Num: number = value5.value(); +// 1000 + +var value6: Numeral = numeral(1000); +var value: number = 100; +var difference = value6.difference(value); +// 900 + +var value7: Numeral = numeral(0); +numeral.zeroFormat('N/A'); +var zeroString: string = value7.format('0.0'); +// 'N/A' + +var a: Numeral = numeral(1000); +var b: Numeral = numeral(a); +var c: Numeral = a.clone(); + +var aVal: number = a.set(2000).value(); +// 2000 +var bVal: number = b.value(); +// 1000 +var cVal: number = c.add(10).value(); +// 1010 diff --git a/numeraljs/numeraljs-tests.ts b/numeraljs/numeraljs-tests.ts index 4dadb0c0b..0b1bcff67 100644 --- a/numeraljs/numeraljs-tests.ts +++ b/numeraljs/numeraljs-tests.ts @@ -1,4 +1,5 @@ /// + var valueFormat: string = numeral(1000).format('0,0'); // '1,000' @@ -27,7 +28,7 @@ var difference = value6.difference(value); var value7: Numeral = numeral(0); numeral.zeroFormat('N/A'); -var zeroString: string = value7.format('0.0') +var zeroString: string = value7.format('0.0'); // 'N/A' var a: Numeral = numeral(1000); diff --git a/numeraljs/numeraljs.d.ts b/numeraljs/numeraljs.d.ts index e680806d1..779823056 100644 --- a/numeraljs/numeraljs.d.ts +++ b/numeraljs/numeraljs.d.ts @@ -39,4 +39,10 @@ interface Numeral { difference(value: any): number; } -declare var numeral: Numeral; \ No newline at end of file +declare var numeral: Numeral; + +declare module "numeral" { + + export = numeral; + +} diff --git a/object-hash/object-hash-tests.ts b/object-hash/object-hash-tests.ts new file mode 100644 index 000000000..e72c9e489 --- /dev/null +++ b/object-hash/object-hash-tests.ts @@ -0,0 +1,48 @@ +/// + +import hash = require('object-hash'); + +var hashed: string; + +var obj = { any: true }; + +// hash object +hashed = hash(obj); + +hashed = hash.sha1(obj); +hashed = hash.keys(obj); +hashed = hash.MD5(obj); +hashed = hash.keysMD5(obj); + +var options = { + algorithm: 'md5', + encoding: 'utf8', + excludeValues: true +}; + +hashed = hash(obj, options); + +// HashTable +var table: ObjectHash.HashTable; +table = hash.HashTable(); +table = hash.HashTable(options); + +table = table.add(obj); +table = table.add(obj, obj); +table = table.remove(obj); +table = table.remove(obj, obj); + +var has: boolean = table.hasKey('whatEver'); +var value: any = table.getValue('whatEver'); +var count: number = table.getCount('whatEver'); + +var tableObject = table.table(); +tableObject['whatEver'].value; +tableObject['whatEver'].count; + +var tableArray = table.toArray(); +tableArray.shift().value; +tableArray.pop().count; +tableArray[2].hash; + +table = table.reset(); diff --git a/object-hash/object-hash.d.ts b/object-hash/object-hash.d.ts new file mode 100644 index 000000000..8faf058da --- /dev/null +++ b/object-hash/object-hash.d.ts @@ -0,0 +1,52 @@ +// Type definitions for object-hash v0.5.0 +// Project: https://github.com/puleos/object-hash +// Definitions by: Michael Zabka +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module ObjectHash { + export interface IOptions { + algorithm?: string; + encoding?: string; + excludeValues?: boolean; + } + + interface HashTableItem { + value: any; + count: number; + } + + interface HashTableItemWithKey extends HashTableItem { + hash: string; + } + + export interface HashTable { + add(...values: any[]): HashTable; + remove(...values: any[]): HashTable; + hasKey(key: string): boolean; + getValue(key: string): any; + getCount(key: string): number; + table(): { [key: string]: HashTableItem }; + toArray(): HashTableItemWithKey[]; + reset(): HashTable; + } + + export interface HashTableStatic { + (options?: IOptions): HashTable; + } + + export interface Hash { + (object: any, options?: IOptions): string; + sha1(object: any): string; + keys(object: any): string; + MD5(object: any): string; + keysMD5(object: any): string; + HashTable: HashTableStatic; + } + + export var HashStatic: Hash; +} + +declare module 'object-hash' { + import HashStatic = ObjectHash.HashStatic; + export = HashStatic; +} diff --git a/page/page-tests.ts.tscparams b/page/page-tests.ts.tscparams deleted file mode 100644 index 2988d8fd6..000000000 --- a/page/page-tests.ts.tscparams +++ /dev/null @@ -1 +0,0 @@ ---noImplicitAny --module commonjs \ No newline at end of file diff --git a/passport-facebook-token/passport-facebook-token-tests.ts b/passport-facebook-token/passport-facebook-token-tests.ts new file mode 100644 index 000000000..531b7bdce --- /dev/null +++ b/passport-facebook-token/passport-facebook-token-tests.ts @@ -0,0 +1,28 @@ +/// +import passport = require('passport'); +import facebook = require('passport-facebook-token'); + +var User = { + findOrCreate(id: string, provider: string, callback: (err: any, user: any) => void): void { + callback(null, {username: 'ray'}); + } +} + +var options: facebook.StrategyOptions = { + clientID: process.env.PASSPORT_FACEBOOK_CLIENT_ID, + clientSecret: process.env.PASSPORT_FACEBOOK_CLIENT_SECRET +}; + +function verify(accessToken: string, + refreshToken: string, + profile: facebook.Profile, + done: (err: any, user?: any) => void) { + User.findOrCreate(profile.id, profile.provider, function (err, user) { + if (err) { + return done(err); + } + done(null, user); + }); +} + +passport.use(new facebook.Strategy(options, verify)); diff --git a/passport-facebook-token/passport-facebook-token-tests.ts.tscparams b/passport-facebook-token/passport-facebook-token-tests.ts.tscparams new file mode 100644 index 000000000..5f84b9777 --- /dev/null +++ b/passport-facebook-token/passport-facebook-token-tests.ts.tscparams @@ -0,0 +1 @@ +--noImplicitAny --module commonjs --target es5 diff --git a/passport-facebook-token/passport-facebook-token.d.ts b/passport-facebook-token/passport-facebook-token.d.ts new file mode 100644 index 000000000..a5aa11596 --- /dev/null +++ b/passport-facebook-token/passport-facebook-token.d.ts @@ -0,0 +1,38 @@ +// Type definitions for passport-facebook-token 0.4.0 +// Project: https://github.com/drudge/passport-facebook-token +// Definitions by: Ray Martone +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module 'passport-facebook-token' { + + import passport = require('passport'); + import express = require('express'); + + interface Profile extends passport.Profile { + gender: string; + profileUrl: string; + } + + interface StrategyOptions { + clientID: string; + clientSecret: string; + authorizationURL?: string; + tokenURL?: string; + scopeSeparator?: string; + passReqToCallback?: Function; + enableProof?: boolean; + profileFields?: any[]; + } + + class Strategy implements passport.Strategy { + constructor(options: StrategyOptions, + verify: (accessToken: string, + refreshToken: string, + profile: Profile, + done: (err: any, user?: any) => void) => void); + name: string; + authenticate: (req: express.Request, options?: any) => void; + } +} diff --git a/path-to-regexp/path-to-regexp-tests.ts b/path-to-regexp/path-to-regexp-tests.ts new file mode 100644 index 000000000..ef622c602 --- /dev/null +++ b/path-to-regexp/path-to-regexp-tests.ts @@ -0,0 +1,16 @@ +/// + +import pathToRegexp = require('path-to-regexp'); + +var keys: string[] = []; +var re = pathToRegexp('/foo/:bar', keys); + +re = pathToRegexp('/foo/:bar', keys, { + sensitive: true, + strict: false, + end: true +}); + +re = pathToRegexp('/foo/:bar', keys, { + sensitive: true +}); \ No newline at end of file diff --git a/path-to-regexp/path-to-regexp.d.ts b/path-to-regexp/path-to-regexp.d.ts new file mode 100644 index 000000000..1cea46d85 --- /dev/null +++ b/path-to-regexp/path-to-regexp.d.ts @@ -0,0 +1,20 @@ +// Type definitions for path-to-regexp v1.0.3 +// Project: https://github.com/pillarjs/path-to-regexp +// Definitions by: xica +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module "path-to-regexp" { + + function pathToRegexp(path: string, keys: string[], options?: pathToRegexp.Options): RegExp; + + module pathToRegexp { + + interface Options { + sensitive?: boolean; + strict?: boolean; + end?: boolean; + } + } + + export = pathToRegexp; +} diff --git a/pathwatcher/pathwatcher.d.ts b/pathwatcher/pathwatcher.d.ts index a4570e1cb..4ca5f590d 100644 --- a/pathwatcher/pathwatcher.d.ts +++ b/pathwatcher/pathwatcher.d.ts @@ -26,7 +26,8 @@ declare module PathWatcher { write(text:string):void; readSync(flushCache:boolean):string; read(flushCache?:boolean):Q.Promise; - exists():boolean; + // exists():boolean; + existsSync():boolean; setDigest(contents:string):void; getDigest():string; writeFileWithPrivilegeEscalationSync (filePath:string, text:string):void; diff --git a/pdf/pdf.d.ts b/pdf/pdf.d.ts index 8496a6c40..802c0e601 100644 --- a/pdf/pdf.d.ts +++ b/pdf/pdf.d.ts @@ -200,6 +200,11 @@ interface PDFRenderParams { continueCallback?: (_continue: () => void) => void; } +interface PDFViewerParams { + container: HTMLElement; + viewer?: HTMLElement; +} + /** * RenderTask is basically a promise but adds a cancel function to termiate it. **/ @@ -295,12 +300,12 @@ interface PDFObjects { } interface PDFJSStatic { - + /** * The maximum allowed image size in total pixels e.g. width * height. Images above this value will not be drawn. Use -1 for no limit. **/ maxImageSize: number; - + /** * By default fonts are converted to OpenType fonts and loaded via font face rules. If disabled, the font will be rendered using a built in font renderer that constructs the glyphs with primitive path commands. **/ @@ -337,6 +342,8 @@ interface PDFJSStatic { passwordCallback?: (fn: (password: string) => void, reason: string) => string, progressCallback?: (progressData: PDFProgressData) => void) : PDFPromise; + + PDFViewer(params: PDFViewerParams): void; } declare var PDFJS: PDFJSStatic; diff --git a/png-async/png-async-tests.ts b/png-async/png-async-tests.ts new file mode 100644 index 000000000..6523089a2 --- /dev/null +++ b/png-async/png-async-tests.ts @@ -0,0 +1,32 @@ +/// + +import fs = require('fs'); +import png = require('png-async'); + +var devnull = process.platform === 'win32' ? 'nul' : '/dev/null'; + +// stream test +var img = new png.Image({ + width: 1, + height: 1, + fill: true +}) + .pack() + .pipe(png.createImage({ + deflateStrategy: png.EDeflateStrategy.FIXED, + filterType: png.EFilterType.Auto + }) + .on('parsed', function () { + + if (this.data[0] !== 0) { + throw new Error('invalid data'); + } + + this.data[0] = 255; + this.data[3] = 255; + + this.pack().pipe(fs.createWriteStream(devnull)).on('finish', () => { + console.log('done'); + }); + }) + ); diff --git a/png-async/png-async.d.ts b/png-async/png-async.d.ts new file mode 100644 index 000000000..2898c4665 --- /dev/null +++ b/png-async/png-async.d.ts @@ -0,0 +1,58 @@ +// Type definitions for png-async +// Project: https://github.com/kanreisa/node-png-async +// Definitions by: Yuki KAN +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module 'png-async' { + import stream = require('stream'); + + export interface IImageOptions { + width?: number; + height?: number; + fill?: boolean; + checkCRC?: boolean; + deflateChunkSize?: number; + deflateLevel?: number; + deflateStrategy?: EDeflateStrategy; + filterType?: EFilterType; + } + + export enum EDeflateStrategy { + DEFAULT_STRATEGY = 0, + FILTERED = 1, + HUFFMAN_ONLY = 2, + RLE = 3, + FIXED = 4, + } + + export enum EFilterType { + Auto = -1, + None = 0, + Sub = 1, + Up = 2, + Average = 3, + Paeth = 4, + } + + export function createImage(option?: IImageOptions): Image; + + export class Image extends stream.Duplex { + width: number; + height: number; + gamma: number; + data: Buffer; + constructor(option?: IImageOptions); + pack(): Image; + parse(data: Buffer, callback?: (err: Error, image: Image) => void): Image; + write(data: any, cb?: any): boolean; + end(data?: any): void; + bitblt(dst: Image, sx: number, sy: number, w: number, h: number, dx: number, dy: number): Image; + + on(event: string, listener: Function): Image; + once(event: string, listener: Function): Image; + removeListener(event: string, listener: Function): Image; + removeAllListeners(event: string): Image; + } +} diff --git a/polymer/polymer-tests.ts b/polymer/polymer-tests.ts new file mode 100644 index 000000000..a606692fd --- /dev/null +++ b/polymer/polymer-tests.ts @@ -0,0 +1,76 @@ +/// + +class AbstractPolymerElement implements PolymerElement { + $: { [id: string]: HTMLElement }; //polymer object for elements that have an ID + + // inargs is the [args] for the callback.. need to update function def + async(inMethod: () => void, inArgs?: Array, inTimeout?: number): void { } + job(jobName: string, inMethod: () => void, inTimeout?: number): void { } + fire(eventName: string, details?: any, targetNode?: any, bubbles?: boolean, cancelable?: boolean): void { } + asyncFire(eventName: string, details?: any, targetNode?: any, bubbles?: boolean, cancelable?: boolean): void { } + + cancelUnbindAll(): void { } +} + +class AbstractWebComponent extends AbstractPolymerElement { + + public name: string; + + constructor(name: string) { + super(); + this.name = name; + } + + protected get(): HTMLElement { + return this; + } +} + +function registerWebComponent(webComponentClass: Function, ...mixins: any[]): void { + + // we need a flat object, without prototype in order to polymer to work on our components + var flattenedComponent: any = {}; + if (mixins) { + // apply mixins + mixins.forEach(mixin => { + for (var i in mixin) { + if (mixin.hasOwnProperty(i)) { + webComponentClass.prototype[i] = mixin[i]; + } + } + }); + } + var webComponent: AbstractWebComponent = new (webComponentClass)(); + for (var i in webComponent) { + // do not include polymer functions + if (i != "async" && i != "job" && i != "fire" && i != "asyncFire" && i != "cancelUnbindAll") { + var attribute: any = (webComponent)[i]; + flattenedComponent[i] = attribute; + } + } + + console.debug('registering web component', webComponent, flattenedComponent); + Polymer(webComponent.name, flattenedComponent); +} + +class Spinner extends AbstractWebComponent { + private pendingRequestsCount: number; + + constructor() { + super('test-spinner'); + } + + public ready(): void { + this.pendingRequestsCount = 0; + this.updateUI(); + } + + private updateUI(): void { + var spinnerHidden: boolean = this.pendingRequestsCount == 0; + if (spinnerHidden) { + this.get().setAttribute('hidden', 'true'); + } else { + this.get().removeAttribute('hidden'); + } + } +} \ No newline at end of file diff --git a/polymer/polymer.app-router.d.ts b/polymer/polymer.app-router.d.ts new file mode 100644 index 000000000..633479ba2 --- /dev/null +++ b/polymer/polymer.app-router.d.ts @@ -0,0 +1,13 @@ +// Type definitions for app-router +// Project: https://github.com/erikringsmuth/app-router +// Definitions by: Louis Grignon +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module PolymerComponents { + module App { + export interface Router extends HTMLElement { + init(): void; + go(path: string, options?: { replace?: boolean }): void; + } + } +} \ No newline at end of file diff --git a/polymer/polymer.core-drawer-panel.d.ts b/polymer/polymer.core-drawer-panel.d.ts new file mode 100644 index 000000000..2bad7b633 --- /dev/null +++ b/polymer/polymer.core-drawer-panel.d.ts @@ -0,0 +1,70 @@ +// Type definitions for polymer's paper-toast +// Project: https://github.com/Polymer/core-drawer-panel +// Definitions by: Louis Grignon +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module PolymerComponents { + export module Core { + export interface DrawerPanel extends HTMLElement { + /** + * Width of the drawer panel. default: '256px' + */ + drawerWidth: string; + + /** + * Max-width when the panel changes to narrow layout. default: '640px' + */ + responsiveWidth: string; + + /** + * The panel that is being selected. drawer for the drawer panel and main for the main panel. default: null + */ + selected: string; + + /** + * The panel to be selected when core-drawer-panel changes to narrow layout. default: 'main' + */ + defaultSelected: string; + + /** + * Returns true if the panel is in narrow layout. This is useful if you need to show/hide elements based on the layout. default: false + */ + narrow: boolean; + + /** + * If true, position the drawer to the right. default: false + */ + rightDrawer: boolean; + + /** + * If true, swipe to open/close the drawer is disabled. default: false + */ + disableSwipe: boolean; + + /** + * If true, ignore responsiveWidth setting and force the narrow layout. default: false + */ + forceNarrow: boolean; + + /** + * If true, swipe from the edge is disabled. default: false + */ + disableEdgeSwipe: boolean; + + /** + * Toggles the panel open and closed. + */ + togglePanel(): void; + + /** + * Opens the drawer. + */ + openDrawer(): void; + + /** + * Closes the drawer. + */ + closeDrawer(): void; + } + } +} \ No newline at end of file diff --git a/polymer/polymer.d.ts b/polymer/polymer.d.ts new file mode 100644 index 000000000..dfb812f8c --- /dev/null +++ b/polymer/polymer.d.ts @@ -0,0 +1,42 @@ +// Type definitions for polymer +// Project: https://github.com/polymer +// Definitions by: Louis Grignon +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +interface PolymerElement { + + // definition + publish?: Object; + computed?: Object; + // object mapping variable names to functions name + observe?: Object; + + // life time API + created? (): void; + ready? (): void; + attached? (): void; + domReady? (): void; + detached? (): void; + attributeChanged? (attrName: string, oldVal: any, newVal: any): void; +} + +interface Polymer { + + importElements(node: Node, callback: Function): void; + import(url: string, callback?: () => void): void; + + mixin(target: any, ...mixins: any[]): any; + waitingFor(): Array; + // should be an "integer" for milliseconds + forceReady(timeout: number): void; + + (tagName: string, prototype: PolymerElement): void; + (tagName: string, prototype: any): void; + (prototype: PolymerElement): void; + (): void; + // hacks for mixins + CoreResizer: any; + CoreResizable: any; +} + +declare var Polymer: Polymer; diff --git a/polymer/polymer.paper-toast.d.ts b/polymer/polymer.paper-toast.d.ts new file mode 100644 index 000000000..fbf8cd7a6 --- /dev/null +++ b/polymer/polymer.paper-toast.d.ts @@ -0,0 +1,61 @@ +// Type definitions for polymer's paper-toast +// Project: https://github.com/Polymer/paper-toast +// Definitions by: Louis Grignon +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module PolymerComponents { + export module Paper { + export interface Toast extends HTMLElement { + /** + * The text shows in a toast. + * default: '' + */ + text: string; + + /** + * The duration in milliseconds to show the toast. + * default: 3000 + */ + duration: number; + + /** + * Set opened to true to show the toast and to false to hide it. + * default: false + */ + opened: boolean; + + /** + * Min-width when the toast changes to narrow layout. In narrow layout, the toast fits at the bottom of the screen when opened. + * default: '480px' + */ + responsiveWidth: string; + + /** + * If true, the toast can't be swiped. + * default: false + */ + swipeDisabled: boolean; + + /** + * By default, the toast will close automatically if the user taps outside it or presses the escape key. Disable this behavior by setting the autoCloseDisabled property to true. + * default: false + */ + autoCloseDisabled: boolean; + + /** + * Show the toast for the specified duration + */ + show(): void; + + /** + * Dismiss the toast and hide it. + */ + dismiss(): void; + + /** + * Toggle the opened state of the toast. + */ + toggle(): void; + } + } +} \ No newline at end of file diff --git a/q/Q-tests.ts b/q/Q-tests.ts index ff540bd6b..7872f23b2 100644 --- a/q/Q-tests.ts +++ b/q/Q-tests.ts @@ -67,6 +67,7 @@ Q.allResolved([]) declare var arrayPromise: Q.IPromise; declare var stringPromise: Q.IPromise; declare function returnsNumPromise(text: string): Q.Promise; +declare function returnsNumPromise(text: string): JQueryPromise; Q(arrayPromise) // type specification required .then(arr => arr.join(',')) diff --git a/qunit/qunit.d.ts b/qunit/qunit.d.ts index dbf5d9c08..ddbf014e4 100644 --- a/qunit/qunit.d.ts +++ b/qunit/qunit.d.ts @@ -170,7 +170,7 @@ interface QUnitAssert { * resolution callback for each async operation. The callback returned from assert.async() * will throw an Error if is invoked more than once. */ - async(): any; + async(): () => void; /** * A deep recursive comparison assertion, working on primitive types, arrays, objects, diff --git a/ractive/ractive-tests.ts b/ractive/ractive-tests.ts index e206d2e26..df97190c9 100644 --- a/ractive/ractive-tests.ts +++ b/ractive/ractive-tests.ts @@ -8,13 +8,19 @@ function test_transition() { Ractive.transitions['myTransition'] = plugin; } +var adaptor: Ractive.AdaptorPlugin; + + Ractive.defaults = { template: '', - debug: true } var options: Ractive.NewOptions = { + adapt: ['myAdaptor', adaptor], template: '', + data: { + someThing: 'value', + } }; var r: Ractive.Ractive = new Ractive(options); diff --git a/ractive/ractive.d.ts b/ractive/ractive.d.ts index 97ceda993..4c2b1ef14 100644 --- a/ractive/ractive.d.ts +++ b/ractive/ractive.d.ts @@ -1,8 +1,10 @@ -// Type definitions for Ractive 0.7.0 edge f22ab8ad0a640591b1c263f57e21d1565cb26bf5 +// Type definitions for Ractive 0.7.1 // Project: http://ractivejs.org // Definitions by: Han Lin Yap // Definitions: https://github.com/codler/Ractive-TypeScript-Definition -// Version: 0.7.0-1+2015-02-05 +// Version: 0.7.1-1+2015-03-21 + +declare type _RactiveEvent = Event; declare module Ractive { export interface Node extends HTMLElement { @@ -64,13 +66,22 @@ declare module Ractive { export interface Event { context: any; - // TODO: unclear in documantation - index: Object; + component?: Ractive; + index: { [key: string]: number }; keypath: string; + // Since 0.6.0 + name: string; node: HTMLElement; - original: Event; + original: _RactiveEvent; } + // Since 0.7.1 + export interface NodeInfo { + ractive: Ractive; + keypath: string; + index: { [key: string]: number }; + } + // Return value in ractive.observe and ractive.on export interface Observe { cancel(): void; @@ -113,13 +124,17 @@ declare module Ractive { complate?: (t: number, value: number) => void; // TODO: void? } - export interface ObserveOptions { + export interface ObserveOptions extends ObserveOnceOptions { + // Default true + init?: boolean; + } + + // Since 0.7.1 + export interface ObserveOnceOptions { // Default Ractive context?: any; // Default false defer?: boolean; - // Default true - init?: boolean; } // Used in Ractive.parse options @@ -139,7 +154,7 @@ declare module Ractive { /* * @type List of mixed string or Adaptor */ - adapt?: any[]; + adapt?: (string | AdaptorPlugin)[]; adaptors?: AdaptorPlugins; @@ -147,22 +162,20 @@ declare module Ractive { * Default false * @type boolean or any type that option `el` accepts (HTMLElement or String or jQuery-like collection) */ - append?: any; + append?: boolean | any; complete?: Function; components?: ComponentPlugins; computed?: Object; // Since 0.5.5 - // TODO: unclear in documantation + // TODO: unclear in documantation, should this be in ExtendOptions instead? css?: string; /** - * TODO: Question - When is data Array or String? - * - * @type Object, Array, String or Function + * @type Object or Function */ // TODO: undocumented type Function - data?: any; + data?: Object | Function; decorators?: DecoratorPlugins; /** @@ -170,27 +183,53 @@ declare module Ractive { */ delimiters?: string[]; + // TODO: unsure easing?: string | Function; /** * @type HTMLElement or String or jQuery-like collection */ - el?: any; + el?: string | HTMLElement | any; // TODO: undocumented in Initialisation options page events?: EventPlugins; - - // TODO: In next release - // TODO: undocumented GH-429 - // interpolate - + // Since 0.5.5 // TODO: unclear in documantation interpolators?: { [key: string]: any; }; // Since 0.6.0 - onconstruct?: (options: NewOptions) => void; // TODO: void? - // Since 0.6.0 + // TODO: undocumented arguments onchange?: (options: NewOptions) => void; // TODO: void? + // Since 0.6.0 + // TODO: undocumented arguments + oncomplete?: () => void; // TODO: void? + // Since 0.6.0 + // TODO: undocumented arguments + onconfig?: () => void; // TODO: void? + // Since 0.6.0 + // TODO: undocumented arguments + onconstruct?: (options: NewOptions) => void; // TODO: void? + // Since 0.6.0 + // TODO: undocumented arguments + ondetach?: () => void; // TODO: void? + // Since 0.6.0 + // TODO: undocumented arguments + oninit?: () => void; // TODO: void? + // Since 0.6.0 + // TODO: undocumented arguments + oninsert?: () => void; // TODO: void? + // Since 0.6.0 + // TODO: undocumented arguments + onrender?: () => void; // TODO: void? + // Since 0.6.0 + // TODO: undocumented arguments + onunrender?: () => void; // TODO: void? + // Since 0.6.0 + // TODO: undocumented arguments + onupdate?: () => void; // TODO: void? + // Since 0.6.0 + // TODO: undocumented arguments + onteardown?: () => void; // TODO: void? /** * any is same type as template @@ -198,9 +237,8 @@ declare module Ractive { partials?: { [key: string]: any; }; /** * Default false - * @type Boolean or RactiveSanitizeOptions */ - sanitize?: any; + sanitize?: boolean | SanitizeOptions; /** * Default ['[[', ']]'] * @type [open, close] @@ -238,6 +276,9 @@ declare module Ractive { // Since 0.5.5 // Default true stripComments?: boolean; + // Since 0.7.1 + // Default true + transitionsEnabled?: boolean; // Default true twoway?: boolean; @@ -252,17 +293,16 @@ declare module Ractive { * @deprecated */ init?: (options: ExtendOptions) => void; - - // TODO: undocumented arguments - onconstruct?: (options: ExtendOptions) => void; // TODO: void? - onrender?: () => void; // TODO: void? + // Default false, inherit from Ractive.defaults isolated?: boolean; } // See ractive change log "All configuration options, except plugin registries, can be specified on Ractive.defaults and Component.defaults" export interface DefaultsOptions extends ExtendOptions { - // TODO: not correctly documented + /** + * @deprecated since 0.7.1 + */ // Default false debug?: boolean; } @@ -275,6 +315,9 @@ declare module Ractive { extend(options: ExtendOptions): Static; + // Since 0.7.1 + getNodeInfo(node: HTMLElement): NodeInfo; + parse(template: string, options?: ParseOptions): any; // TODO: undocumented @@ -283,6 +326,9 @@ declare module Ractive { // TODO: undocumented components: ComponentPlugins; + // Since 0.7.1 + DEBUG: boolean; + defaults: DefaultsOptions; // TODO: undocumented @@ -327,13 +373,19 @@ declare module Ractive { findComponent(name?: string): Ractive; + // Since 0.7.1 + findContainer(name: string): Ractive; // TODO: Ractive? + + // Since 0.7.1 + findParent(name: string): Ractive; // TODO: Ractive? + fire(eventName: string, ...args: any[]): void; // TODO: void? get(keypath: string): any; - get(): Object; // TODO: undocumented. or do it return function if ractive.data defined as function? + get(): Object; // TODO: Object? - // TODO: target - Node or String or jQuery (see Valid selectors) - // TODO: anchor - Node or String or jQuery + // target - Node or String or jQuery (see Valid selectors) + // anchor - Node or String or jQuery insert(target: any, anchor?: any): void; // TODO: void? merge(keypath: string, value: any[], options?: { compare: boolean | string | Function }): Promise; @@ -342,13 +394,15 @@ declare module Ractive { observe(keypath: string, callback: (newValue: any, oldValue: any, keypath: string) => void, options?: ObserveOptions): Observe; observe(map: Object, options?: ObserveOptions): Observe; - // TODO: check handler type - off(eventName?: string, handler?: () => void): Ractive; - + // Since 0.7.1 + observeOnce(keypath: string, callback: (newValue: any, oldValue: any, keypath: string) => void, options?: ObserveOnceOptions): Observe; + // handler context Ractive - on(eventName: string, handler: (event?: Event, ...args: any[]) => void): Observe; - // TODO: undocumented - on(map: { [eventName: string]: (event?: Event, ...args: any[]) => void }): Observe; + off(eventName?: string, handler?: (event?: Ractive.Event | any, ...args: any[]) => any): Ractive; + on(eventName: string, handler: (event?: Ractive.Event | any, ...args: any[]) => any): Observe; + on(map: { [eventName: string]: (event?: Ractive.Event | any, ...args: any[]) => any }): Observe; + // Since 0.7.1 + once(eventName: string, handler: (event?: Ractive.Event | any, ...args: any[]) => any): Observe; // Since 0.5.5 pop(keypath: string): Promise; @@ -356,13 +410,18 @@ declare module Ractive { // Since 0.5.5 push(keypath: string, value: any): Promise; - // TODO: target - Node or String or jQuery (see Valid selectors) + // target - Node or String or jQuery (see Valid selectors) render(target: any): void; // TODO: void? + // Default {} reset(data?: Object): Promise; + // Since 0.7.1 + resetPartial(name: string, partial: any): Promise; + // Since 0.5.5 // TODO: undocumented, mentioned in ractive change log + // https://github.com/ractivejs/docs.ractivejs.org/issues/188 resetTemplate(): void; // TODO: void? set(keypath: string, value: any): Promise; @@ -382,6 +441,9 @@ declare module Ractive { toHTML(): string; + // Since 0.6.0 + unrender(): void; // TODO: void? + // Since 0.5.5 unshift(keypath: string, value: any): Promise; @@ -395,13 +457,19 @@ declare module Ractive { updateModel(keypath?: string, cascade?: boolean): Promise; // Properties - + // Since 0.7.1 + container: Ractive; // TODO: Ractive? nodes: Object; partials: Object; - transitions: Object; + // Since 0.7.1 + parent: Ractive; // TODO: Ractive? + // Since 0.7.1 + root: Ractive; // TODO: Ractive? + transitions: Object; } } +// used for require() declare module "ractive" { export = Ractive; } diff --git a/react-router/react-router.d.ts b/react-router/react-router.d.ts index 13c573b4b..8f63f2d69 100644 --- a/react-router/react-router.d.ts +++ b/react-router/react-router.d.ts @@ -3,7 +3,7 @@ // Definitions by: Yuichi Murata // Definitions: https://github.com/borisyankov/DefinitelyTyped -/// +/// declare module ReactRouter { // diff --git a/react/future/README.md b/react/README.md similarity index 93% rename from react/future/README.md rename to react/README.md index 07a203920..0c773fd38 100644 --- a/react/future/README.md +++ b/react/README.md @@ -1,4 +1,4 @@ -# React v0.13.0-beta Type Definitions +# React v0.13.0 Type Definitions This folder contains the following `.d.ts` files: * `react-0.13.0.d.ts` declares the external module `"react"` diff --git a/react/future/react-0.13.0-tests.ts b/react/future/react-0.13.0-tests.ts deleted file mode 100644 index b32356119..000000000 --- a/react/future/react-0.13.0-tests.ts +++ /dev/null @@ -1,356 +0,0 @@ -/// -// requiring react/addons instead of react so react.d.ts doesn't get picked up -// TODO: import "react" once 0.13.0 is released -import React = require("react/addons"); - -interface Props extends React.Props { - hello: string; - world?: string; - foo: number; - bar: boolean; -} - -interface State { - inputValue?: string; - seconds?: number; -} - -interface Context { - someValue?: string; -} - -interface ChildContext { - someOtherValue: string; -} - -interface MyComponent extends React.Component { - reset(): void; -} - -var props: Props = { - key: 42, - ref: "myComponent42", - hello: "world", - foo: 42, - bar: true -}; - -var container: Element; -var INPUT_REF: string = "input"; - -// -// Top-Level API -// -------------------------------------------------------------------------- - -var ClassicComponent: React.ClassicComponentClass = - React.createClass({ - getDefaultProps: () => { - return { - hello: undefined, - world: "peace", - foo: undefined, - bar: undefined - }; - }, - getInitialState: () => { - return { - inputValue: this.context.someValue, - seconds: this.props.foo - }; - }, - reset: () => { - this.replaceState(this.getInitialState()); - }, - render: () => { - return React.DOM.div(null, - React.DOM.input({ - ref: INPUT_REF, - value: this.state.inputValue - })); - } - }); - -class ModernComponent extends React.Component - implements React.ChildContextProvider { - - constructor(props: Props, context: Context) { - super(props, context); - this.state = { - inputValue: context.someValue, - seconds: props.foo - }; - } - - static propTypes: React.ValidationMap = { - foo: React.PropTypes.number - } - - static contextTypes: React.ValidationMap = { - someValue: React.PropTypes.string - } - - static childContextTypes: React.ValidationMap = { - someOtherValue: React.PropTypes.string - } - - getChildContext() { - return { - someOtherValue: 'foo' - } - } - - state = { - inputValue: this.context.someValue, - seconds: this.props.foo - } - - reset() { - this.setState({ - inputValue: this.context.someValue, - seconds: this.props.foo - }); - } - - render() { - return React.DOM.div(null, - React.DOM.input({ - ref: INPUT_REF, - value: this.state.inputValue - })); - } -} - -// React.createFactory -var factory: React.Factory = - React.createFactory(ModernComponent); -var factoryElement: React.ReactElement = - factory(props); - -var classicFactory: React.ClassicFactory = - React.createFactory(ClassicComponent); -var classicFactoryElement: React.ReactClassicElement = - classicFactory(props); - -var domFactory: React.DOMFactory = - React.createFactory("foo"); -var domFactoryElement: React.ReactDOMElement = - domFactory(); - -// React.createElement -var element: React.ReactElement = - React.createElement(ModernComponent, props); -var classicElement: React.ReactClassicElement = - React.createElement(ClassicComponent, props); -var domElement: React.ReactHTMLElement = - React.createElement("div"); - -// React.render -var component: React.Component = - React.render(element, container); -var classicComponent: React.ClassicComponent = - React.render(classicElement, container); -var domComponent: React.DOMComponent = - React.render(domElement, container); - -// Other Top-Level API -var unmounted: boolean = React.unmountComponentAtNode(container); -var str: string = React.renderToString(element); -var markup: string = React.renderToStaticMarkup(element); -var notValid: boolean = React.isValidElement(props); // false -var isValid = React.isValidElement(element); // true -React.initializeTouchEvents(true); -var domNode: Element = React.findDOMNode(component); -domNode = React.findDOMNode(domNode); - -// -// React Elements -// -------------------------------------------------------------------------- - -var type = element.type; -var elementProps: Props = element.props; -var key = element.key; -var ref: string = element.ref; - -// -// React Components -// -------------------------------------------------------------------------- - -var displayName: string = ClassicComponent.displayName; -var defaultProps: Props = ClassicComponent.getDefaultProps(); -var propTypes: React.ValidationMap = ClassicComponent.propTypes; - -// -// Component API -// -------------------------------------------------------------------------- - -// modern -var componentState: State = component.state; -component.setState({ inputValue: "!!!" }); -component.forceUpdate(); - -// classic -var htmlElement: Element = classicComponent.getDOMNode(); -var divElement: HTMLDivElement = classicComponent.getDOMNode(); -var isMounted: boolean = classicComponent.isMounted(); -classicComponent.setProps(elementProps); -classicComponent.replaceProps(props); -classicComponent.replaceState({ inputValue: "???", seconds: 60 }); - -var inputRef: React.HTMLComponent = - component.refs[INPUT_REF]; -var value: string = inputRef.getDOMNode().value; - -var myComponent = component; -myComponent.reset(); - -// -// Attributes -// -------------------------------------------------------------------------- - -var children = ["Hello world", [null], React.DOM.span(null)]; -var divStyle = { // CSSProperties - flex: "1 1 main-size", - backgroundImage: "url('hello.png')" -}; -var htmlAttr: React.HTMLAttributes = { - key: 36, - ref: "htmlComponent", - children: children, - className: "test-attr", - style: divStyle, - onClick: (event: React.MouseEvent) => { - event.preventDefault(); - event.stopPropagation(); - }, - dangerouslySetInnerHTML: { - __html: "STRONG" - } -}; -React.DOM.div(htmlAttr); -React.DOM.span(htmlAttr); -React.DOM.input(htmlAttr); - -// -// React.PropTypes -// -------------------------------------------------------------------------- - -var PropTypesSpecification: React.ComponentSpec = { - propTypes: { - optionalArray: React.PropTypes.array, - optionalBool: React.PropTypes.bool, - optionalFunc: React.PropTypes.func, - optionalNumber: React.PropTypes.number, - optionalObject: React.PropTypes.object, - optionalString: React.PropTypes.string, - optionalNode: React.PropTypes.node, - optionalElement: React.PropTypes.element, - optionalMessage: React.PropTypes.instanceOf(Date), - optionalEnum: React.PropTypes.oneOf(["News", "Photos"]), - optionalUnion: React.PropTypes.oneOfType([ - React.PropTypes.string, - React.PropTypes.number, - React.PropTypes.instanceOf(Date) - ]), - optionalArrayOf: React.PropTypes.arrayOf(React.PropTypes.number), - optionalObjectOf: React.PropTypes.objectOf(React.PropTypes.number), - optionalObjectWithShape: React.PropTypes.shape({ - color: React.PropTypes.string, - fontSize: React.PropTypes.number - }), - requiredFunc: React.PropTypes.func.isRequired, - requiredAny: React.PropTypes.any.isRequired, - customProp: function(props: any, propName: string, componentName: string) { - if (!/matchme/.test(props[propName])) { - return new Error("Validation failed!"); - } - return null; - } - }, - render: (): React.ReactHTMLElement => { - return null; - } -}; - -// -// ContextTypes -// -------------------------------------------------------------------------- - -var ContextTypesSpecification: React.ComponentSpec = { - contextTypes: { - optionalArray: React.PropTypes.array, - optionalBool: React.PropTypes.bool, - optionalFunc: React.PropTypes.func, - optionalNumber: React.PropTypes.number, - optionalObject: React.PropTypes.object, - optionalString: React.PropTypes.string, - optionalNode: React.PropTypes.node, - optionalElement: React.PropTypes.element, - optionalMessage: React.PropTypes.instanceOf(Date), - optionalEnum: React.PropTypes.oneOf(["News", "Photos"]), - optionalUnion: React.PropTypes.oneOfType([ - React.PropTypes.string, - React.PropTypes.number, - React.PropTypes.instanceOf(Date) - ]), - optionalArrayOf: React.PropTypes.arrayOf(React.PropTypes.number), - optionalObjectOf: React.PropTypes.objectOf(React.PropTypes.number), - optionalObjectWithShape: React.PropTypes.shape({ - color: React.PropTypes.string, - fontSize: React.PropTypes.number - }), - requiredFunc: React.PropTypes.func.isRequired, - requiredAny: React.PropTypes.any.isRequired, - customProp: function(props: any, propName: string, componentName: string) { - if (!/matchme/.test(props[propName])) { - return new Error("Validation failed!"); - } - return null; - } - }, - render: (): React.ReactHTMLElement => { - return null; - } -}; - -// -// React.Children -// -------------------------------------------------------------------------- - -var childMap: { [key: string]: number } = - React.Children.map(children, (child) => { return 42; }); -React.Children.forEach(children, (child) => {}); -var nChildren: number = React.Children.count(children); -var onlyChild = React.Children.only([null, [[["Hallo"], true]], false]); - -// -// Example from http://facebook.github.io/react/ -// -------------------------------------------------------------------------- - -interface TimerState { - secondsElapsed: number; -} -class Timer extends React.Component<{}, TimerState> { - static state = { - secondsElapsed: 0 - } - private _interval: number; - tick() { - this.setState({ secondsElapsed: this.state.secondsElapsed + 1 }); - } - componentDidMount() { - var me = this; - this._interval = setInterval(() => me.tick(), 1000); - } - componentWillUnmount() { - clearInterval(this._interval); - } - render() { - return React.DOM.div( - null, - "Seconds Elapsed: ", - this.state.secondsElapsed - ); - } -} -React.render(React.createElement(Timer), container); - diff --git a/react/future/react-addons-0.13.0-tests.ts b/react/future/react-addons-0.13.0-tests.ts deleted file mode 100644 index d76097cd6..000000000 --- a/react/future/react-addons-0.13.0-tests.ts +++ /dev/null @@ -1,387 +0,0 @@ -/// -import React = require("react/addons"); - -interface Props extends React.Props { - hello: string; - world?: string; - foo: number; - bar: boolean; -} - -interface State { - inputValue?: string; - seconds?: number; -} - -interface Context { - someValue?: string; -} - -interface ChildContext { - someOtherValue: string; -} - -interface MyComponent extends React.Component { - reset(): void; -} - -var props: Props = { - key: 42, - ref: "myComponent42", - hello: "world", - foo: 42, - bar: true -}; - -var container: Element; -var INPUT_REF: string = "input"; - -// -// Top-Level API -// -------------------------------------------------------------------------- - -var ClassicComponent: React.ClassicComponentClass = - React.createClass({ - getDefaultProps: () => { - return { - hello: undefined, - world: "peace", - foo: undefined, - bar: undefined - }; - }, - getInitialState: () => { - return { - inputValue: this.context.someValue, - seconds: this.props.foo - }; - }, - reset: () => { - this.replaceState(this.getInitialState()); - }, - render: () => { - return React.DOM.div(null, - React.DOM.input({ - ref: INPUT_REF, - value: this.state.inputValue - })); - } - }); - -class ModernComponent extends React.Component - implements React.ChildContextProvider { - - constructor(props: Props, context: Context) { - super(props, context); - this.state = { - inputValue: context.someValue, - seconds: props.foo - }; - } - - static propTypes: React.ValidationMap = { - foo: React.PropTypes.number - } - - static contextTypes: React.ValidationMap = { - someValue: React.PropTypes.string - } - - static childContextTypes: React.ValidationMap = { - someOtherValue: React.PropTypes.string - } - - getChildContext() { - return { - someOtherValue: 'foo' - } - } - - state = { - inputValue: this.context.someValue, - seconds: this.props.foo - } - - reset() { - this.setState({ - inputValue: this.context.someValue, - seconds: this.props.foo - }); - } - - render() { - return React.DOM.div(null, - React.DOM.input({ - ref: INPUT_REF, - value: this.state.inputValue - })); - } -} - -// React.createFactory -var factory: React.Factory = - React.createFactory(ModernComponent); -var factoryElement: React.ReactElement = - factory(props); - -var classicFactory: React.ClassicFactory = - React.createFactory(ClassicComponent); -var classicFactoryElement: React.ReactClassicElement = - classicFactory(props); - -var domFactory: React.DOMFactory = - React.createFactory("foo"); -var domFactoryElement: React.ReactDOMElement = - domFactory(); - -// React.createElement -var element: React.ReactElement = - React.createElement(ModernComponent, props); -var classicElement: React.ReactClassicElement = - React.createElement(ClassicComponent, props); -var domElement: React.ReactHTMLElement = - React.createElement("div"); - -// React.render -var component: React.Component = - React.render(element, container); -var classicComponent: React.ClassicComponent = - React.render(classicElement, container); -var domComponent: React.DOMComponent = - React.render(domElement, container); - -// Other Top-Level API -var unmounted: boolean = React.unmountComponentAtNode(container); -var str: string = React.renderToString(element); -var markup: string = React.renderToStaticMarkup(element); -var notValid: boolean = React.isValidElement(props); // false -var isValid = React.isValidElement(element); // true -React.initializeTouchEvents(true); -var domNode: Element = React.findDOMNode(component); -domNode = React.findDOMNode(domNode); - -// -// React Elements -// -------------------------------------------------------------------------- - -var type = element.type; -var elementProps: Props = element.props; -var key = element.key; -var ref: string = element.ref; - -// -// React Components -// -------------------------------------------------------------------------- - -var displayName: string = ClassicComponent.displayName; -var defaultProps: Props = ClassicComponent.getDefaultProps(); -var propTypes: React.ValidationMap = ClassicComponent.propTypes; - -// -// Component API -// -------------------------------------------------------------------------- - -// modern -var componentState: State = component.state; -component.setState({ inputValue: "!!!" }); -component.forceUpdate(); - -// classic -var htmlElement: Element = classicComponent.getDOMNode(); -var divElement: HTMLDivElement = classicComponent.getDOMNode(); -var isMounted: boolean = classicComponent.isMounted(); -classicComponent.setProps(elementProps); -classicComponent.replaceProps(props); -classicComponent.replaceState({ inputValue: "???", seconds: 60 }); - -var inputRef: React.HTMLComponent = - component.refs[INPUT_REF]; -var value: string = inputRef.getDOMNode().value; - -var myComponent = component; -myComponent.reset(); - -// -// Attributes -// -------------------------------------------------------------------------- - -var children = ["Hello world", [null], React.DOM.span(null)]; -var divStyle = { // CSSProperties - flex: "1 1 main-size", - backgroundImage: "url('hello.png')" -}; -var htmlAttr: React.HTMLAttributes = { - key: 36, - ref: "htmlComponent", - children: children, - className: "test-attr", - style: divStyle, - onClick: (event: React.MouseEvent) => { - event.preventDefault(); - event.stopPropagation(); - }, - dangerouslySetInnerHTML: { - __html: "STRONG" - } -}; -React.DOM.div(htmlAttr); -React.DOM.span(htmlAttr); -React.DOM.input(htmlAttr); - -// -// React.PropTypes -// -------------------------------------------------------------------------- - -var PropTypesSpecification: React.ComponentSpec = { - propTypes: { - optionalArray: React.PropTypes.array, - optionalBool: React.PropTypes.bool, - optionalFunc: React.PropTypes.func, - optionalNumber: React.PropTypes.number, - optionalObject: React.PropTypes.object, - optionalString: React.PropTypes.string, - optionalNode: React.PropTypes.node, - optionalElement: React.PropTypes.element, - optionalMessage: React.PropTypes.instanceOf(Date), - optionalEnum: React.PropTypes.oneOf(["News", "Photos"]), - optionalUnion: React.PropTypes.oneOfType([ - React.PropTypes.string, - React.PropTypes.number, - React.PropTypes.instanceOf(Date) - ]), - optionalArrayOf: React.PropTypes.arrayOf(React.PropTypes.number), - optionalObjectOf: React.PropTypes.objectOf(React.PropTypes.number), - optionalObjectWithShape: React.PropTypes.shape({ - color: React.PropTypes.string, - fontSize: React.PropTypes.number - }), - requiredFunc: React.PropTypes.func.isRequired, - requiredAny: React.PropTypes.any.isRequired, - customProp: function(props: any, propName: string, componentName: string) { - if (!/matchme/.test(props[propName])) { - return new Error("Validation failed!"); - } - return null; - } - }, - render: (): React.ReactHTMLElement => { - return null; - } -}; - -// -// ContextTypes -// -------------------------------------------------------------------------- - -var ContextTypesSpecification: React.ComponentSpec = { - contextTypes: { - optionalArray: React.PropTypes.array, - optionalBool: React.PropTypes.bool, - optionalFunc: React.PropTypes.func, - optionalNumber: React.PropTypes.number, - optionalObject: React.PropTypes.object, - optionalString: React.PropTypes.string, - optionalNode: React.PropTypes.node, - optionalElement: React.PropTypes.element, - optionalMessage: React.PropTypes.instanceOf(Date), - optionalEnum: React.PropTypes.oneOf(["News", "Photos"]), - optionalUnion: React.PropTypes.oneOfType([ - React.PropTypes.string, - React.PropTypes.number, - React.PropTypes.instanceOf(Date) - ]), - optionalArrayOf: React.PropTypes.arrayOf(React.PropTypes.number), - optionalObjectOf: React.PropTypes.objectOf(React.PropTypes.number), - optionalObjectWithShape: React.PropTypes.shape({ - color: React.PropTypes.string, - fontSize: React.PropTypes.number - }), - requiredFunc: React.PropTypes.func.isRequired, - requiredAny: React.PropTypes.any.isRequired, - customProp: function(props: any, propName: string, componentName: string) { - if (!/matchme/.test(props[propName])) { - return new Error("Validation failed!"); - } - return null; - } - }, - render: (): React.ReactHTMLElement => { - return null; - } -}; - -// -// React.Children -// -------------------------------------------------------------------------- - -var childMap: { [key: string]: number } = - React.Children.map(children, (child) => { return 42; }); -React.Children.forEach(children, (child) => {}); -var nChildren: number = React.Children.count(children); -var onlyChild = React.Children.only([null, [[["Hallo"], true]], false]); - -// -// Example from http://facebook.github.io/react/ -// -------------------------------------------------------------------------- - -interface TimerState { - secondsElapsed: number; -} -class Timer extends React.Component<{}, TimerState> { - static state = { - secondsElapsed: 0 - } - private _interval: number; - tick() { - this.setState({ secondsElapsed: this.state.secondsElapsed + 1 }); - } - componentDidMount() { - var me = this; - this._interval = setInterval(() => me.tick(), 1000); - } - componentWillUnmount() { - clearInterval(this._interval); - } - render() { - return React.DOM.div( - null, - "Seconds Elapsed: ", - this.state.secondsElapsed - ); - } -} -React.render(React.createElement(Timer), container); - -// -// React.addons -// -------------------------------------------------------------------------- - -var cx = React.addons.classSet; -var className: string = cx({ a: true, b: false, c: true }); -className = cx("a", null, "b"); - -// -// React.addons (Transitions) -// -------------------------------------------------------------------------- - -React.createFactory(React.addons.TransitionGroup)({ component: "div" }); -React.createFactory(React.addons.CSSTransitionGroup)({ - component: React.createClass({ - render: (): React.ReactElement => null - }), - childFactory: (c) => c, - transitionName: "transition", - transitionAppear: false, - transitionEnter: true, - transitionLeave: true -}); - -// -// React.addons.TestUtils -// -------------------------------------------------------------------------- - -var node: Element; -React.addons.TestUtils.Simulate.click(node); -React.addons.TestUtils.Simulate.change(node); -React.addons.TestUtils.Simulate.keyDown(node, { key: "Enter" }); - diff --git a/react/legacy/react-0.12-tests.ts b/react/legacy/react-0.12-tests.ts new file mode 100644 index 000000000..27eae4c64 --- /dev/null +++ b/react/legacy/react-0.12-tests.ts @@ -0,0 +1,235 @@ +/// +import React = require("react"); + +interface Props { + hello: string; + world?: string; + foo: number; + bar: boolean; +} + +interface State { + inputValue?: string; + seconds?: number; +} + +interface MyComponent extends React.CompositeComponent { + reset(): void; +} + +var props: Props = { + key: 42, + ref: "myComponent42", + hello: "world", + foo: 42, + bar: true +}; + +var container: Element; +var INPUT_REF: string = "input"; + +// +// Top-Level API +// -------------------------------------------------------------------------- + +var reactClass: React.ComponentClass = React.createClass({ + getDefaultProps: () => { + return { + hello: undefined, + world: "peace", + foo: undefined, + bar: undefined + }; + }, + getInitialState: () => { + return { + inputValue: "React.js", + seconds: 0 + }; + }, + reset: () => { + this.replaceState(this.getInitialState()); + }, + render: () => { + return React.DOM.div(null, + React.DOM.input({ + ref: INPUT_REF, + value: this.state.inputValue + })); + } +}); + +var reactElement: React.ReactElement = + React.createElement(reactClass, props); + +var reactFactory: React.ComponentFactory = + React.createFactory(reactClass); + +var component: React.Component = + React.render(reactElement, container); + +var unmounted: boolean = React.unmountComponentAtNode(container); +var str: string = React.renderToString(reactElement); +var markup: string = React.renderToStaticMarkup(reactElement); +var notValid: boolean = React.isValidElement(props); // false +var isValid = React.isValidElement(reactElement); // true +React.initializeTouchEvents(true); + +// +// React Elements +// -------------------------------------------------------------------------- + +var type = reactElement.type; +var elementProps: Props = reactElement.props; +var key = reactElement.key; +var ref: string = reactElement.ref; +var factoryElement: React.ReactElement = reactFactory(elementProps); + +// +// React Components +// -------------------------------------------------------------------------- + +var displayName: string = reactClass.displayName; +var defaultProps: Props = reactClass.getDefaultProps(); +var propTypes: React.ValidationMap = reactClass.propTypes; + +// +// Component API +// -------------------------------------------------------------------------- + +var htmlElement: Element = component.getDOMNode(); +var divElement: HTMLDivElement = component.getDOMNode(); +var isMounted: boolean = component.isMounted(); +component.setProps(elementProps); +component.replaceProps(props); + +var compComponent: React.CompositeComponent = + >component; +var initialState: State = compComponent.state; +compComponent.setState({ inputValue: "!!!" }); +compComponent.replaceState({ inputValue: "???", seconds: 60 }); +compComponent.forceUpdate(); + +var inputRef: React.HTMLComponent = + compComponent.refs[INPUT_REF]; +var value: string = inputRef.getDOMNode().value; + +var myComponent = compComponent; +myComponent.reset(); + +// +// Attributes +// -------------------------------------------------------------------------- + +var children = ["Hello world", [null], React.DOM.span(null)]; +var divStyle = { // CSSProperties + flex: "1 1 main-size", + backgroundImage: "url('hello.png')" +}; +var htmlAttr: React.HTMLAttributes = { + key: 36, + ref: "htmlComponent", + children: children, + className: "test-attr", + style: divStyle, + onClick: (event: React.MouseEvent) => { + event.preventDefault(); + event.stopPropagation(); + }, + dangerouslySetInnerHTML: { + __html: "STRONG" + } +}; +React.DOM.div(htmlAttr); +React.DOM.span(htmlAttr); +React.DOM.input(htmlAttr); + +// +// React.PropTypes +// -------------------------------------------------------------------------- + +var PropTypesSpecification: React.ComponentSpec = { + propTypes: { + optionalArray: React.PropTypes.array, + optionalBool: React.PropTypes.bool, + optionalFunc: React.PropTypes.func, + optionalNumber: React.PropTypes.number, + optionalObject: React.PropTypes.object, + optionalString: React.PropTypes.string, + optionalNode: React.PropTypes.node, + optionalElement: React.PropTypes.element, + optionalMessage: React.PropTypes.instanceOf(Date), + optionalEnum: React.PropTypes.oneOf(["News", "Photos"]), + optionalUnion: React.PropTypes.oneOfType([ + React.PropTypes.string, + React.PropTypes.number, + React.PropTypes.instanceOf(Date) + ]), + optionalArrayOf: React.PropTypes.arrayOf(React.PropTypes.number), + optionalObjectOf: React.PropTypes.objectOf(React.PropTypes.number), + optionalObjectWithShape: React.PropTypes.shape({ + color: React.PropTypes.string, + fontSize: React.PropTypes.number + }), + requiredFunc: React.PropTypes.func.isRequired, + requiredAny: React.PropTypes.any.isRequired, + customProp: function(props: any, propName: string, componentName: string) { + if (!/matchme/.test(props[propName])) { + return new Error("Validation failed!"); + } + return null; + } + }, + render: (): React.ReactHTMLElement => { + return null; + } +}; + +// +// React.Children +// -------------------------------------------------------------------------- + +var childMap: { [key: string]: number } = + React.Children.map(children, (child) => { return 42; }); +React.Children.forEach(children, (child) => {}); +var nChildren: number = React.Children.count(children); +var onlyChild = React.Children.only([null, [[["Hallo"], true]], false]); + +// +// Example from http://facebook.github.io/react/ +// -------------------------------------------------------------------------- + +interface TimerState { + secondsElapsed: number; +} +interface Timer extends React.CompositeComponent<{}, TimerState> { +} +var Timer = React.createClass({ + displayName: "Timer", + getInitialState: () => { + return { secondsElapsed: 0 }; + }, + tick: () => { + var me = this; + me.setState({ + secondsElapsed: me.state.secondsElapsed + 1 + }); + }, + componentDidMount: () => { + this.interval = setInterval(this.tick, 1000); + }, + componentWillUnmount: () => { + clearInterval(this.interval); + }, + render: () => { + var me = this; + return React.DOM.div( + null, + "Seconds Elapsed: ", + me.state.secondsElapsed + ); + } +}); +var mountNode: Element; +React.render(React.createElement(Timer, null), mountNode); + diff --git a/react/future/react-0.13.0.d.ts b/react/legacy/react-0.12.d.ts similarity index 61% rename from react/future/react-0.13.0.d.ts rename to react/legacy/react-0.12.d.ts index fd4b27e98..f2786cbc8 100644 --- a/react/future/react-0.13.0.d.ts +++ b/react/legacy/react-0.12.d.ts @@ -1,208 +1,138 @@ -// Type definitions for React v0.13.0 (external module) +// Type definitions for React 0.12.1 // Project: http://facebook.github.io/react/ -// Definitions by: Asana , AssureSign +// Definitions by: Asana // Definitions: https://github.com/borisyankov/DefinitelyTyped -declare module "react" { +declare module React { // - // React Elements + // React Elements // ---------------------------------------------------------------------- - interface ReactElementBase { - type: T; + type ReactType = ComponentClass | string; + + interface ReactElement

    { + type: ComponentClass

    | string; props: P; key: number | string; ref: string; } - interface ReactElement

    - extends ReactElementBase, P> {} - - interface ReactClassicElement

    - extends ReactElementBase | string, P> {} - - interface ReactDOMElement

    // subtype of ReactClassicElement - extends ReactElementBase {} - - type ReactHTMLElement = ReactDOMElement; - type ReactSVGElement = ReactDOMElement; + interface ReactHTMLElement extends ReactElement {} + interface ReactSVGElement extends ReactElement {} // - // Factories - // ---------------------------------------------------------------------- - - interface Factory

    { - (props?: P, ...children: ReactNode[]): ReactElement

    ; - } - - interface ClassicFactory

    { - (props?: P, ...children: ReactNode[]): ReactClassicElement

    ; - } - - interface DOMFactory

    { - (props?: P, ...children: ReactNode[]): ReactDOMElement

    ; - } - - type HTMLFactory = DOMFactory; - type SVGFactory = DOMFactory; - - // - // React Nodes + // React Nodes // http://facebook.github.io/react/docs/glossary.html // ---------------------------------------------------------------------- type ReactText = string | number; - type ReactChild = ReactElementBase | ReactText; + type ReactChild = ReactElement | ReactText; // Should be Array but type aliases cannot be recursive type ReactFragment = Array; type ReactNode = ReactChild | ReactFragment | boolean; // - // Top Level API + // React Components // ---------------------------------------------------------------------- - function createClass( - spec: ComponentSpec): ClassicComponentClass; + interface ComponentStatics

    { + displayName?: string; + getDefaultProps?(): P; + propTypes?: ValidationMap

    ; + } - function createFactory

    ( - type: string): DOMFactory

    ; - function createFactory

    ( - type: ClassicComponentClass | string): ClassicFactory

    ; - function createFactory

    ( - type: ComponentClass): Factory

    ; + interface ComponentClass

    extends ComponentStatics

    { + // Deprecated in 0.12. See http://fb.me/react-legacyfactory + // new(props: P): ReactElement

    ; + // (props: P): ReactElement

    ; + } - function createElement

    ( - type: string, - props?: P, - ...children: ReactNode[]): ReactDOMElement

    ; - function createElement

    ( - type: ClassicComponentClass | string, - props?: P, - ...children: ReactNode[]): ReactClassicElement

    ; - function createElement

    ( - type: ComponentClass, - props?: P, - ...children: ReactNode[]): ReactElement

    ; + // + // ReactElement Factories + // ---------------------------------------------------------------------- - function render

    ( - element: ReactDOMElement

    , - container: Element, - callback?: () => any): DOMComponent

    ; - function render( - element: ReactClassicElement

    , - container: Element, - callback?: () => any): ClassicComponent; - function render( - element: ReactElement

    , - container: Element, - callback?: () => any): Component; + interface ComponentFactory

    { + (props?: P, ...children: ReactNode[]): ReactElement

    ; + } + + interface HTMLFactory extends ComponentFactory {} + interface SVGFactory extends ComponentFactory {} - function unmountComponentAtNode(container: Element): boolean; - function renderToString(element: ReactElementBase): string; - function renderToStaticMarkup(element: ReactElementBase): string; - function isValidElement(object: {}): boolean; - function initializeTouchEvents(shouldUseTouch: boolean): void; + // + // Top-Level API + // ---------------------------------------------------------------------- - function findDOMNode( - componentOrElement: Component | Element): TElement; - function findDOMNode( - componentOrElement: Component | Element): Element; - - var DOM: ReactDOM; - var PropTypes: ReactPropTypes; - var Children: ReactChildren; + interface TopLevelAPI { + createClass

    (spec: ComponentSpec): ComponentClass

    ; + createElement

    (type: ComponentClass

    | string, props: P, ...children: ReactNode[]): ReactElement

    ; + createFactory

    (componentClass: ComponentClass

    ): ComponentFactory

    ; + render

    (element: ReactElement

    , container: Element, callback?: () => any): Component

    ; + unmountComponentAtNode(container: Element): boolean; + renderToString(element: ReactElement): string; + renderToStaticMarkup(element: ReactElement): string; + isValidElement(object: {}): boolean; + initializeTouchEvents(shouldUseTouch: boolean): void; + } // // Component API // ---------------------------------------------------------------------- - // Base component for plain JS classes - class Component implements ComponentLifecycle { - constructor(props: P, context: any); - setState(state: S, callback?: () => any): void; - forceUpdate(): void; - props: P; - state: S; - context: any; - refs: { - [key: string]: Component - }; - } - - interface ClassicComponent extends Component { - replaceState(nextState: S, callback?: () => any): void; + interface Component

    { + // Use this overload to cast the returned element to a more specific type. + // Eg: var name = this.refs['name'].getDOMNode().value; getDOMNode(): TElement; getDOMNode(): Element; isMounted(): boolean; - getInitialState?(): S; + + props: P; setProps(nextProps: P, callback?: () => any): void; replaceProps(nextProps: P, callback?: () => any): void; } - interface DOMComponent

    extends ClassicComponent { + interface DOMComponent

    extends Component

    { tagName: string; } - type HTMLComponent = DOMComponent; - type SVGComponent = DOMComponent; - - interface ChildContextProvider { - getChildContext(): CC; - } - - // - // Class Interfaces - // ---------------------------------------------------------------------- - - interface ComponentClassBase

    { - propTypes?: ValidationMap

    ; - contextTypes?: ValidationMap; - childContextTypes?: ValidationMap; - } - - interface ComponentClass extends ComponentClassBase

    { - new(props?: P, context?: any): Component; - defaultProps?: P; - } - - interface ClassicComponentClass extends ComponentClassBase

    { - new(props?: P, context?: any): ClassicComponent; - getDefaultProps?(): P; - displayName?: string; + interface HTMLComponent extends DOMComponent {} + interface SVGComponent extends DOMComponent {} + + interface CompositeComponent extends Component

    , ComponentSpec { + state: S; + setState(nextState: S, callback?: () => any): void; + replaceState(nextState: S, callback?: () => any): void; + forceUpdate(callback?: () => any): void; + refs: { + [key: string]: Component + }; } // // Component Specs and Lifecycle // ---------------------------------------------------------------------- - interface ComponentLifecycle { - componentWillMount?(): void; - componentDidMount?(): void; - componentWillReceiveProps?(nextProps: P, nextContext: any): void; - shouldComponentUpdate?(nextProps: P, nextState: S, nextContext: any): boolean; - componentWillUpdate?(nextProps: P, nextState: S, nextContext: any): void; - componentDidUpdate?(prevProps: P, prevState: S, prevContext: any): void; - componentWillUnmount?(): void; - } - - interface Mixin extends ComponentLifecycle { + interface Mixin extends ComponentStatics

    { mixins?: Mixin; statics?: { [key: string]: any; }; - displayName?: string; - propTypes?: ValidationMap; - contextTypes?: ValidationMap; - childContextTypes?: ValidationMap - + // Definition methods getInitialState?(): S; - getDefaultProps?(): P; + + // Delegate methods + componentWillMount?(): void; + componentDidMount?(): void; + componentWillReceiveProps?(nextProps: P): void; + shouldComponentUpdate?(nextProps: P, nextState: S): boolean; + componentWillUpdate?(nextProps: P, nextState: S): void; + componentDidUpdate?(prevProps: P, prevState: S): void; + componentWillUnmount?(): void; } interface ComponentSpec extends Mixin { - render(): ReactElementBase; + render(): ReactElement; } // @@ -308,16 +238,15 @@ declare module "react" { interface WheelEventHandler extends EventHandler {} // - // Props / DOM Attributes + // Attributes // ---------------------------------------------------------------------- - interface Props { + export interface ReactAttributes { children?: ReactNode; key?: number | string; ref?: string; - } - interface DOMAttributes extends Props { + // Event Attributes onCopy?: ClipboardEventHandler; onCut?: ClipboardEventHandler; onPaste?: ClipboardEventHandler; @@ -378,7 +307,7 @@ declare module "react" { strokeOpacity?: number; } - interface HTMLAttributes extends DOMAttributes { + interface HTMLAttributes extends ReactAttributes { accept?: string; acceptCharset?: string; accessKey?: string; @@ -486,9 +415,9 @@ declare module "react" { itemType?: string; } - interface SVGAttributes extends DOMAttributes { + interface SVGAttributes extends ReactAttributes { cx?: SVGLength | SVGAnimatedLength; - cy?: any; + cy?: any; d?: string; dx?: SVGLength | SVGAnimatedLength; dy?: SVGLength | SVGAnimatedLength; @@ -533,7 +462,7 @@ declare module "react" { } // - // React.DOM + // React.DOM // ---------------------------------------------------------------------- interface ReactDOM { @@ -716,6 +645,254 @@ declare module "react" { only(children: ReactNode): ReactChild; } + // + // React.addons + // ---------------------------------------------------------------------- + + interface ClassSet { + [key: string]: boolean; + } + + // + // React.addons (Transitions) + // ---------------------------------------------------------------------- + + interface TransitionGroupProps { + component?: ReactType; + childFactory?: (child: ReactElement) => ReactElement; + } + + interface CSSTransitionGroupProps extends TransitionGroupProps { + transitionName: string; + transitionAppear?: boolean; + transitionEnter?: boolean; + transitionLeave?: boolean; + } + + interface CSSTransitionGroup extends ComponentClass {} + interface TransitionGroup extends ComponentClass {} + + // + // React.addons (Mixins) + // ---------------------------------------------------------------------- + + interface ReactLink { + value: T; + requestChange(newValue: T): void; + } + + interface LinkedStateMixin extends Mixin { + linkState(key: string): ReactLink; + } + + interface PureRenderMixin extends Mixin { + } + + // + // Reat.addons.update + // ---------------------------------------------------------------------- + + interface UpdateSpec { + $set: any; + $merge: {}; + $apply(value: any): any; + // [key: string]: UpdateSpec; + } + + interface UpdateArraySpec extends UpdateSpec { + $push?: any[]; + $unshift?: any[]; + $splice?: any[][]; + } + + // + // React.addons.Perf + // ---------------------------------------------------------------------- + + interface ComponentPerfContext { + current: string; + owner: string; + } + + interface NumericPerfContext { + [key: string]: number; + } + + interface Measurements { + exclusive: NumericPerfContext; + inclusive: NumericPerfContext; + render: NumericPerfContext; + counts: NumericPerfContext; + writes: NumericPerfContext; + displayNames: { + [key: string]: ComponentPerfContext; + }; + totalTime: number; + } + + interface ReactPerf { + start(): void; + stop(): void; + printInclusive(measurements: Measurements[]): void; + printExclusive(measurements: Measurements[]): void; + printWasted(measurements: Measurements[]): void; + printDOM(measurements: Measurements[]): void; + getLastMeasurements(): Measurements[]; + } + + // + // React.addons.TestUtils + // ---------------------------------------------------------------------- + + interface MockedComponentClass { + new(): any; + } + + interface ReactTestUtils { + Simulate: Simulate; + + renderIntoDocument

    (element: ReactElement

    ): Component

    ; + renderIntoDocument>(element: ReactElement): C; + + mockComponent(mocked: MockedComponentClass, mockTagName?: string): ReactTestUtils; + + isElementOfType(element: ReactElement, type: ReactType): boolean; + isDOMComponent(instance: Component): boolean; + isCompositeComponent(instance: Component): boolean; + isCompositeComponentWithType(instance: Component, type: ComponentClass): boolean; + isTextComponent(instance: Component): boolean; + + findAllInRenderedTree(tree: Component, fn: (i: Component) => boolean): Component; + + scryRenderedDOMComponentsWithClass(tree: Component, className: string): DOMComponent[]; + findRenderedDOMComponentWithClass(tree: Component, className: string): DOMComponent; + + scryRenderedDOMComponentsWithTag(tree: Component, tagName: string): DOMComponent[]; + findRenderedDOMComponentWithTag(tree: Component, tagName: string): DOMComponent; + + scryRenderedComponentsWithType( + tree: Component, type: ComponentClass

    ): CompositeComponent[]; + scryRenderedComponentsWithType>( + tree: Component, type: ComponentClass): C[]; + + findRenderedComponentWithType( + tree: Component, type: ComponentClass

    ): CompositeComponent; + findRenderedComponentWithType>( + tree: Component, type: ComponentClass): C; + } + + interface SyntheticEventData { + altKey?: boolean; + button?: number; + buttons?: number; + clientX?: number; + clientY?: number; + changedTouches?: TouchList; + charCode?: boolean; + clipboardData?: DataTransfer; + ctrlKey?: boolean; + deltaMode?: number; + deltaX?: number; + deltaY?: number; + deltaZ?: number; + detail?: number; + getModifierState?(key: string): boolean; + key?: string; + keyCode?: number; + locale?: string; + location?: number; + metaKey?: boolean; + pageX?: number; + pageY?: number; + relatedTarget?: EventTarget; + repeat?: boolean; + screenX?: number; + screenY?: number; + shiftKey?: boolean; + targetTouches?: TouchList; + touches?: TouchList; + view?: AbstractView; + which?: number; + } + + interface EventSimulator { + (element: Element, eventData?: SyntheticEventData): void; + (descriptor: Component, eventData?: SyntheticEventData): void; + } + + interface Simulate { + blur: EventSimulator; + change: EventSimulator; + click: EventSimulator; + cut: EventSimulator; + doubleClick: EventSimulator; + drag: EventSimulator; + dragEnd: EventSimulator; + dragEnter: EventSimulator; + dragExit: EventSimulator; + dragLeave: EventSimulator; + dragOver: EventSimulator; + dragStart: EventSimulator; + drop: EventSimulator; + focus: EventSimulator; + input: EventSimulator; + keyDown: EventSimulator; + keyPress: EventSimulator; + keyUp: EventSimulator; + mouseDown: EventSimulator; + mouseEnter: EventSimulator; + mouseLeave: EventSimulator; + mouseMove: EventSimulator; + mouseOut: EventSimulator; + mouseOver: EventSimulator; + mouseUp: EventSimulator; + paste: EventSimulator; + scroll: EventSimulator; + submit: EventSimulator; + touchCancel: EventSimulator; + touchEnd: EventSimulator; + touchMove: EventSimulator; + touchStart: EventSimulator; + wheel: EventSimulator; + } + + // + // react Exports + // ---------------------------------------------------------------------- + + interface Exports extends TopLevelAPI { + DOM: ReactDOM; + PropTypes: ReactPropTypes; + Children: ReactChildren; + } + + // + // react/addons Exports + // ---------------------------------------------------------------------- + + interface AddonsExports extends Exports { + addons: { + CSSTransitionGroup: CSSTransitionGroup; + LinkedStateMixin: LinkedStateMixin; + PureRenderMixin: PureRenderMixin; + TransitionGroup: TransitionGroup; + + batchedUpdates(callback: (a: A, b: B) => any, a: A, b: B): void; + batchedUpdates(callback: (a: A) => any, a: A): void; + batchedUpdates(callback: () => any): void; + + classSet(cx: ClassSet): string; + cloneWithProps

    (element: ReactElement

    , props: P): ReactElement

    ; + + update(value: any[], spec: UpdateArraySpec): any[]; + update(value: {}, spec: UpdateSpec): any; + + // Development tools + Perf: ReactPerf; + TestUtils: ReactTestUtils; + }; + } + // // Browser Interfaces // https://github.com/nikeee/2048-typescript/blob/master/2048/js/touch.d.ts @@ -745,3 +922,13 @@ declare module "react" { } } +declare module "react" { + var exports: React.Exports; + export = exports; +} + +declare module "react/addons" { + var exports: React.AddonsExports; + export = exports; +} + diff --git a/react/legacy/react-addons-0.12-tests.ts b/react/legacy/react-addons-0.12-tests.ts new file mode 100644 index 000000000..ca05c00ca --- /dev/null +++ b/react/legacy/react-addons-0.12-tests.ts @@ -0,0 +1,68 @@ +/// +import React = require("react/addons"); + +var isImportant: boolean; +var isRead: boolean; +var classSet: React.ClassSet = { + "message": true, + "message-important": isImportant, + "message-read": isRead +}; +var cx = React.addons.classSet; +var classes: string = cx(classSet); + +// +// React.addons (Transitions) +// -------------------------------------------------------------------------- + +React.createFactory(React.addons.TransitionGroup)({ component: "div" }); +React.createFactory(React.addons.CSSTransitionGroup)({ + component: React.createClass({ + render: (): React.ReactElement => null + }), + childFactory: (c) => c, + transitionName: "transition", + transitionAppear: false, + transitionEnter: true, + transitionLeave: true +}); + +// +// React.addons.TestUtils +// -------------------------------------------------------------------------- + +var that: React.CompositeComponent; +var node = that.refs["input"].getDOMNode(); +React.addons.TestUtils.Simulate.click(node); +React.addons.TestUtils.Simulate.change(node); +React.addons.TestUtils.Simulate.keyDown(node, {key: "Enter"}); + +interface GreetingProps { + name: string; +} +interface GreetingState { + morning: boolean; +} +interface Greeting extends React.CompositeComponent { +} +var Greeting = React.createClass({ + displayName: "Greeting", + getInitialState: function() { + return {morning: true}; + }, + render: function() { + var me = this; + return React.DOM.div( + null, + me.state.morning ? "Hello " : "Goodbye ", + me.props.name); + } +}); + +var root = React.addons.TestUtils.renderIntoDocument( + React.createElement(Greeting, {name: "John"})); +var greeting = React.addons.TestUtils + .findRenderedComponentWithType(root, Greeting); +greeting.setState({ + morning: false +}); diff --git a/react/future/react-addons-global-0.13.0.d.ts b/react/react-addons-global.d.ts similarity index 87% rename from react/future/react-addons-global-0.13.0.d.ts rename to react/react-addons-global.d.ts index d11a4ae03..891e0d101 100644 --- a/react/future/react-addons-global-0.13.0.d.ts +++ b/react/react-addons-global.d.ts @@ -1,8 +1,8 @@ -// Type definitions for ReactWithAddons v0.13.0 (internal module) +// Type definitions for ReactWithAddons v0.13.1 (internal module) // Project: http://facebook.github.io/react/ // Definitions by: Asana , AssureSign // Definitions: https://github.com/borisyankov/DefinitelyTyped -/// +/// declare module React { // @@ -23,8 +23,12 @@ declare module React { classSet(cx: { [key: string]: boolean }): string; classSet(...classList: string[]): string; + cloneWithProps

    (element: DOMElement

    , props: P): DOMElement

    ; + cloneWithProps

    (element: ClassicElement

    , props: P): ClassicElement

    ; cloneWithProps

    (element: ReactElement

    , props: P): ReactElement

    ; + createFragment(object: { [key: string]: ReactNode }): ReactFragment; + update(value: any[], spec: UpdateArraySpec): any[]; update(value: {}, spec: UpdateSpec): any; @@ -37,8 +41,6 @@ declare module React { // React.addons (Transitions) // ---------------------------------------------------------------------- - type ReactType = ComponentClass | string; - interface TransitionGroupProps { component?: ReactType; childFactory?: (child: ReactElement) => ReactElement; @@ -51,10 +53,8 @@ declare module React { transitionLeave?: boolean; } - type CSSTransitionGroup = - ComponentClass; - type TransitionGroup = - ComponentClass; + type CSSTransitionGroup = ComponentClass; + type TransitionGroup = ComponentClass; // // React.addons (Mixins) @@ -146,7 +146,7 @@ declare module React { isCompositeComponent(instance: Component): boolean; isCompositeComponentWithType( instance: Component, - type: ComponentClass): boolean; + type: ComponentClass): boolean; findAllInRenderedTree( tree: Component, @@ -166,19 +166,21 @@ declare module React { tree: Component, tagName: string): DOMComponent; - scryRenderedComponentsWithType( + scryRenderedComponentsWithType

    ( tree: Component, - type: ComponentClass): Component[]; + type: ComponentClass

    ): Component[]; scryRenderedComponentsWithType>( tree: Component, - type: ComponentClass): C[]; + type: ComponentClass): C[]; - findRenderedComponentWithType( + findRenderedComponentWithType

    ( tree: Component, - type: ComponentClass): Component; + type: ComponentClass

    ): Component; findRenderedComponentWithType>( tree: Component, - type: ComponentClass): C; + type: ComponentClass): C; + + createRenderer(): ShallowRenderer; } interface SyntheticEventData { @@ -255,5 +257,11 @@ declare module React { touchStart: EventSimulator; wheel: EventSimulator; } + + class ShallowRenderer { + getRenderOutput>(): C; + render(element: ReactElement, context?: any): void; + unmount(): void; + } } diff --git a/react/react-addons-tests.ts b/react/react-addons-tests.ts index 7ce0fa23f..72d6db486 100644 --- a/react/react-addons-tests.ts +++ b/react/react-addons-tests.ts @@ -1,15 +1,380 @@ -/// +/// import React = require("react/addons"); -var isImportant: boolean; -var isRead: boolean; -var classSet: React.ClassSet = { - "message": true, - "message-important": isImportant, - "message-read": isRead +interface Props extends React.Props { + hello: string; + world?: string; + foo: number; + bar: boolean; +} + +interface State { + inputValue?: string; + seconds?: number; +} + +interface Context { + someValue?: string; +} + +interface ChildContext { + someOtherValue: string; +} + +interface MyComponent extends React.Component { + reset(): void; +} + +var props: Props = { + key: 42, + ref: "myComponent42", + hello: "world", + foo: 42, + bar: true }; + +var container: Element; + +// +// Top-Level API +// -------------------------------------------------------------------------- + +var ClassicComponent: React.ClassicComponentClass = + React.createClass({ + getDefaultProps: () => { + return { + hello: undefined, + world: "peace", + foo: undefined, + bar: undefined + }; + }, + getInitialState: () => { + return { + inputValue: this.context.someValue, + seconds: this.props.foo + }; + }, + reset: () => { + this.replaceState(this.getInitialState()); + }, + render: () => { + return React.DOM.div(null, + React.DOM.input({ + ref: input => this._input = input, + value: this.state.inputValue + })); + } + }); + +class ModernComponent extends React.Component + implements React.ChildContextProvider { + + static propTypes: React.ValidationMap = { + foo: React.PropTypes.number + } + + static contextTypes: React.ValidationMap = { + someValue: React.PropTypes.string + } + + static childContextTypes: React.ValidationMap = { + someOtherValue: React.PropTypes.string + } + + getChildContext() { + return { + someOtherValue: 'foo' + } + } + + state = { + inputValue: this.context.someValue, + seconds: this.props.foo + } + + reset() { + this.setState({ + inputValue: this.context.someValue, + seconds: this.props.foo + }); + } + + private _input: React.HTMLComponent; + + render() { + return React.DOM.div(null, + React.DOM.input({ + ref: input => this._input = input, + value: this.state.inputValue + })); + } +} + +// React.createFactory +var factory: React.Factory = + React.createFactory(ModernComponent); +var factoryElement: React.ReactElement = + factory(props); + +var classicFactory: React.ClassicFactory = + React.createFactory(ClassicComponent); +var classicFactoryElement: React.ClassicElement = + classicFactory(props); + +var domFactory: React.DOMFactory = + React.createFactory("foo"); +var domFactoryElement: React.DOMElement = + domFactory(); + +// React.createElement +var element: React.ReactElement = + React.createElement(ModernComponent, props); +var classicElement: React.ClassicElement = + React.createElement(ClassicComponent, props); +var domElement: React.HTMLElement = + React.createElement("div"); + +// React.cloneElement +var clonedElement: React.ReactElement = + React.cloneElement(element, props); +var clonedClassicElement: React.ClassicElement = + React.cloneElement(classicElement, props); +var clonedDOMElement: React.HTMLElement = + React.cloneElement(domElement); + +// React.render +var component: React.Component = + React.render(element, container); +var classicComponent: React.ClassicComponent = + React.render(classicElement, container); +var domComponent: React.DOMComponent = + React.render(domElement, container); + +// Other Top-Level API +var unmounted: boolean = React.unmountComponentAtNode(container); +var str: string = React.renderToString(element); +var markup: string = React.renderToStaticMarkup(element); +var notValid: boolean = React.isValidElement(props); // false +var isValid = React.isValidElement(element); // true +React.initializeTouchEvents(true); +var domNode: Element = React.findDOMNode(component); +domNode = React.findDOMNode(domNode); + +// +// React Elements +// -------------------------------------------------------------------------- + +var type = element.type; +var elementProps: Props = element.props; +var key = element.key; + +// +// React Components +// -------------------------------------------------------------------------- + +var displayName: string = ClassicComponent.displayName; +var defaultProps: Props = ClassicComponent.getDefaultProps(); +var propTypes: React.ValidationMap = ClassicComponent.propTypes; + +// +// Component API +// -------------------------------------------------------------------------- + +// modern +var componentState: State = component.state; +component.setState({ inputValue: "!!!" }); +component.forceUpdate(); + +// classic +var htmlElement: Element = classicComponent.getDOMNode(); +var divElement: HTMLDivElement = classicComponent.getDOMNode(); +var isMounted: boolean = classicComponent.isMounted(); +classicComponent.setProps(elementProps); +classicComponent.replaceProps(props); +classicComponent.replaceState({ inputValue: "???", seconds: 60 }); + +var myComponent = component; +myComponent.reset(); + +// +// Attributes +// -------------------------------------------------------------------------- + +var children = ["Hello world", [null], React.DOM.span(null)]; +var divStyle = { // CSSProperties + flex: "1 1 main-size", + backgroundImage: "url('hello.png')" +}; +var htmlAttr: React.HTMLAttributes = { + key: 36, + ref: "htmlComponent", + children: children, + className: "test-attr", + style: divStyle, + onClick: (event: React.MouseEvent) => { + event.preventDefault(); + event.stopPropagation(); + }, + dangerouslySetInnerHTML: { + __html: "STRONG" + } +}; +React.DOM.div(htmlAttr); +React.DOM.span(htmlAttr); +React.DOM.input(htmlAttr); + +React.DOM.svg({ viewBox: "0 0 48 48" }, + React.DOM.rect({ + x: 22, + y: 10, + width: 4, + height: 28 + }), + React.DOM.rect({ + x: 10, + y: 22, + width: 28, + height: 4 + })); + +// +// React.PropTypes +// -------------------------------------------------------------------------- + +var PropTypesSpecification: React.ComponentSpec = { + propTypes: { + optionalArray: React.PropTypes.array, + optionalBool: React.PropTypes.bool, + optionalFunc: React.PropTypes.func, + optionalNumber: React.PropTypes.number, + optionalObject: React.PropTypes.object, + optionalString: React.PropTypes.string, + optionalNode: React.PropTypes.node, + optionalElement: React.PropTypes.element, + optionalMessage: React.PropTypes.instanceOf(Date), + optionalEnum: React.PropTypes.oneOf(["News", "Photos"]), + optionalUnion: React.PropTypes.oneOfType([ + React.PropTypes.string, + React.PropTypes.number, + React.PropTypes.instanceOf(Date) + ]), + optionalArrayOf: React.PropTypes.arrayOf(React.PropTypes.number), + optionalObjectOf: React.PropTypes.objectOf(React.PropTypes.number), + optionalObjectWithShape: React.PropTypes.shape({ + color: React.PropTypes.string, + fontSize: React.PropTypes.number + }), + requiredFunc: React.PropTypes.func.isRequired, + requiredAny: React.PropTypes.any.isRequired, + customProp: function(props: any, propName: string, componentName: string) { + if (!/matchme/.test(props[propName])) { + return new Error("Validation failed!"); + } + return null; + } + }, + render: (): React.ReactElement => { + return null; + } +}; + +// +// ContextTypes +// -------------------------------------------------------------------------- + +var ContextTypesSpecification: React.ComponentSpec = { + contextTypes: { + optionalArray: React.PropTypes.array, + optionalBool: React.PropTypes.bool, + optionalFunc: React.PropTypes.func, + optionalNumber: React.PropTypes.number, + optionalObject: React.PropTypes.object, + optionalString: React.PropTypes.string, + optionalNode: React.PropTypes.node, + optionalElement: React.PropTypes.element, + optionalMessage: React.PropTypes.instanceOf(Date), + optionalEnum: React.PropTypes.oneOf(["News", "Photos"]), + optionalUnion: React.PropTypes.oneOfType([ + React.PropTypes.string, + React.PropTypes.number, + React.PropTypes.instanceOf(Date) + ]), + optionalArrayOf: React.PropTypes.arrayOf(React.PropTypes.number), + optionalObjectOf: React.PropTypes.objectOf(React.PropTypes.number), + optionalObjectWithShape: React.PropTypes.shape({ + color: React.PropTypes.string, + fontSize: React.PropTypes.number + }), + requiredFunc: React.PropTypes.func.isRequired, + requiredAny: React.PropTypes.any.isRequired, + customProp: function(props: any, propName: string, componentName: string) { + if (!/matchme/.test(props[propName])) { + return new Error("Validation failed!"); + } + return null; + } + }, + render: (): React.ReactElement => { + return null; + } +}; + +// +// React.Children +// -------------------------------------------------------------------------- + +var childMap: { [key: string]: number } = + React.Children.map(children, (child) => { return 42; }); +React.Children.forEach(children, (child) => {}); +var nChildren: number = React.Children.count(children); +var onlyChild = React.Children.only([null, [[["Hallo"], true]], false]); + +// +// Example from http://facebook.github.io/react/ +// -------------------------------------------------------------------------- + +interface TimerState { + secondsElapsed: number; +} +class Timer extends React.Component, TimerState> { + state = { + secondsElapsed: 0 + } + private _interval: number; + tick() { + this.setState((prevState, props) => ({ + secondsElapsed: prevState.secondsElapsed + 1 + })); + } + componentDidMount() { + this._interval = setInterval(() => this.tick(), 1000); + } + componentWillUnmount() { + clearInterval(this._interval); + } + render() { + return React.DOM.div( + null, + "Seconds Elapsed: ", + this.state.secondsElapsed + ); + } +} +React.render(React.createElement(Timer), container); + +// +// React.addons +// -------------------------------------------------------------------------- + var cx = React.addons.classSet; -var classes: string = cx(classSet); +var className: string = cx({ a: true, b: false, c: true }); +className = cx("a", null, "b"); + +React.addons.createFragment({ + a: React.DOM.div(), + b: ["a", false, React.createElement("span")] +}); // // React.addons (Transitions) @@ -31,38 +396,13 @@ React.createFactory(React.addons.CSSTransitionGroup)({ // React.addons.TestUtils // -------------------------------------------------------------------------- -var that: React.CompositeComponent; -var node = that.refs["input"].getDOMNode(); +var node: Element; React.addons.TestUtils.Simulate.click(node); React.addons.TestUtils.Simulate.change(node); -React.addons.TestUtils.Simulate.keyDown(node, {key: "Enter"}); +React.addons.TestUtils.Simulate.keyDown(node, { key: "Enter" }); -interface GreetingProps { - name: string; -} -interface GreetingState { - morning: boolean; -} -interface Greeting extends React.CompositeComponent { -} -var Greeting = React.createClass({ - displayName: "Greeting", - getInitialState: function() { - return {morning: true}; - }, - render: function() { - var me = this; - return React.DOM.div( - null, - me.state.morning ? "Hello " : "Goodbye ", - me.props.name); - } -}); +var renderer: React.ShallowRenderer = + React.addons.TestUtils.createRenderer(); +renderer.render(React.createElement(Timer)); +var output: Timer = renderer.getRenderOutput(); -var root = React.addons.TestUtils.renderIntoDocument( - React.createElement(Greeting, {name: "John"})); -var greeting = React.addons.TestUtils - .findRenderedComponentWithType(root, Greeting); -greeting.setState({ - morning: false -}); diff --git a/react/future/react-addons-0.13.0.d.ts b/react/react-addons.d.ts similarity index 84% rename from react/future/react-addons-0.13.0.d.ts rename to react/react-addons.d.ts index bb4af1d1e..54fce3ada 100644 --- a/react/future/react-addons-0.13.0.d.ts +++ b/react/react-addons.d.ts @@ -1,4 +1,4 @@ -// Type definitions for ReactWithAddons v0.13.0 (external module) +// Type definitions for ReactWithAddons v0.13.1 (external module) // Project: http://facebook.github.io/react/ // Definitions by: Asana , AssureSign // Definitions: https://github.com/borisyankov/DefinitelyTyped @@ -8,24 +8,27 @@ declare module "react/addons" { // React Elements // ---------------------------------------------------------------------- - interface ReactElementBase { - type: T; + type ReactType = ComponentClass | string; + + interface ReactElement

    { + type: string | ComponentClass

    ; props: P; - key: number | string; - ref: string; + key: string | number; + ref: string | ((component: Component) => any); } - interface ReactElement

    - extends ReactElementBase, P> {} + interface ClassicElement

    extends ReactElement

    { + type: string | ClassicComponentClass

    ; + ref: string | ((component: ClassicComponent) => any); + } - interface ReactClassicElement

    - extends ReactElementBase | string, P> {} + interface DOMElement

    extends ClassicElement

    { + type: string; + ref: string | ((component: DOMComponent

    ) => any); + } - interface ReactDOMElement

    // subtype of ReactClassicElement - extends ReactElementBase {} - - type ReactHTMLElement = ReactDOMElement; - type ReactSVGElement = ReactDOMElement; + type HTMLElement = DOMElement; + type SVGElement = DOMElement; // // Factories @@ -35,12 +38,12 @@ declare module "react/addons" { (props?: P, ...children: ReactNode[]): ReactElement

    ; } - interface ClassicFactory

    { - (props?: P, ...children: ReactNode[]): ReactClassicElement

    ; + interface ClassicFactory

    extends Factory

    { + (props?: P, ...children: ReactNode[]): ClassicElement

    ; } - interface DOMFactory

    { - (props?: P, ...children: ReactNode[]): ReactDOMElement

    ; + interface DOMFactory

    extends ClassicFactory

    { + (props?: P, ...children: ReactNode[]): DOMElement

    ; } type HTMLFactory = DOMFactory; @@ -52,45 +55,54 @@ declare module "react/addons" { // ---------------------------------------------------------------------- type ReactText = string | number; - type ReactChild = ReactElementBase | ReactText; + type ReactChild = ReactElement | ReactText; // Should be Array but type aliases cannot be recursive - type ReactFragment = Array; + type ReactFragment = {} | Array; type ReactNode = ReactChild | ReactFragment | boolean; // // Top Level API // ---------------------------------------------------------------------- - function createClass( - spec: ComponentSpec): ClassicComponentClass; + function createClass(spec: ComponentSpec): ClassicComponentClass

    ; - function createFactory

    ( - type: string): DOMFactory

    ; - function createFactory

    ( - type: ClassicComponentClass | string): ClassicFactory

    ; - function createFactory

    ( - type: ComponentClass): Factory

    ; + function createFactory

    (type: string): DOMFactory

    ; + function createFactory

    (type: ClassicComponentClass

    | string): ClassicFactory

    ; + function createFactory

    (type: ComponentClass

    ): Factory

    ; function createElement

    ( type: string, props?: P, - ...children: ReactNode[]): ReactDOMElement

    ; + ...children: ReactNode[]): DOMElement

    ; function createElement

    ( - type: ClassicComponentClass | string, + type: ClassicComponentClass

    | string, props?: P, - ...children: ReactNode[]): ReactClassicElement

    ; + ...children: ReactNode[]): ClassicElement

    ; function createElement

    ( - type: ComponentClass, + type: ComponentClass

    , + props?: P, + ...children: ReactNode[]): ReactElement

    ; + + function cloneElement

    ( + element: DOMElement

    , + props?: P, + ...children: ReactNode[]): DOMElement

    ; + function cloneElement

    ( + element: ClassicElement

    , + props?: P, + ...children: ReactNode[]): ClassicElement

    ; + function cloneElement

    ( + element: ReactElement

    , props?: P, ...children: ReactNode[]): ReactElement

    ; function render

    ( - element: ReactDOMElement

    , + element: DOMElement

    , container: Element, callback?: () => any): DOMComponent

    ; function render( - element: ReactClassicElement

    , + element: ClassicElement

    , container: Element, callback?: () => any): ClassicComponent; function render( @@ -99,8 +111,8 @@ declare module "react/addons" { callback?: () => any): Component; function unmountComponentAtNode(container: Element): boolean; - function renderToString(element: ReactElementBase): string; - function renderToStaticMarkup(element: ReactElementBase): string; + function renderToString(element: ReactElement): string; + function renderToStaticMarkup(element: ReactElement): string; function isValidElement(object: {}): boolean; function initializeTouchEvents(shouldUseTouch: boolean): void; @@ -119,7 +131,8 @@ declare module "react/addons" { // Base component for plain JS classes class Component implements ComponentLifecycle { - constructor(props: P, context: any); + constructor(props?: P, context?: any); + setState(f: (prevState: S, props: P) => S, callback?: () => any): void; setState(state: S, callback?: () => any): void; forceUpdate(): void; props: P; @@ -155,19 +168,16 @@ declare module "react/addons" { // Class Interfaces // ---------------------------------------------------------------------- - interface ComponentClassBase

    { + interface ComponentClass

    { + new(props?: P, context?: any): Component; propTypes?: ValidationMap

    ; contextTypes?: ValidationMap; childContextTypes?: ValidationMap; - } - - interface ComponentClass extends ComponentClassBase

    { - new(props?: P, context?: any): Component; defaultProps?: P; } - interface ClassicComponentClass extends ComponentClassBase

    { - new(props?: P, context?: any): ClassicComponent; + interface ClassicComponentClass

    extends ComponentClass

    { + new(props?: P, context?: any): ClassicComponent; getDefaultProps?(): P; displayName?: string; } @@ -197,12 +207,12 @@ declare module "react/addons" { contextTypes?: ValidationMap; childContextTypes?: ValidationMap - getInitialState?(): S; getDefaultProps?(): P; + getInitialState?(): S; } interface ComponentSpec extends Mixin { - render(): ReactElementBase; + render(): ReactElement; } // @@ -311,13 +321,13 @@ declare module "react/addons" { // Props / DOM Attributes // ---------------------------------------------------------------------- - interface Props { + interface Props { children?: ReactNode; - key?: number | string; - ref?: string; + key?: string | number; + ref?: string | ((component: T) => any); } - interface DOMAttributes extends Props { + interface DOMAttributes extends Props> { onCopy?: ClipboardEventHandler; onCut?: ClipboardEventHandler; onPaste?: ClipboardEventHandler; @@ -358,14 +368,18 @@ declare module "react/addons" { }; } + // This interface is not complete. Only properties accepting + // unitless numbers are listed here (see CSSProperty.js in React) interface CSSProperties { + boxFlex?: number; + boxFlexGroup?: number; columnCount?: number; flex?: number | string; flexGrow?: number; flexShrink?: number; - fontWeight?: number; + fontWeight?: number | string; lineClamp?: number; - lineHeight?: number; + lineHeight?: number | string; opacity?: number; order?: number; orphans?: number; @@ -376,9 +390,12 @@ declare module "react/addons" { // SVG-related properties fillOpacity?: number; strokeOpacity?: number; + strokeWidth?: number; } interface HTMLAttributes extends DOMAttributes { + ref?: string | ((component: HTMLComponent) => void); + accept?: string; acceptCharset?: string; accessKey?: string; @@ -487,18 +504,20 @@ declare module "react/addons" { } interface SVGAttributes extends DOMAttributes { - cx?: SVGLength | SVGAnimatedLength; - cy?: any; + ref?: string | ((component: SVGComponent) => void); + + cx?: number | string; + cy?: number | string; d?: string; - dx?: SVGLength | SVGAnimatedLength; - dy?: SVGLength | SVGAnimatedLength; - fill?: any; // SVGPaint | string + dx?: number | string; + dy?: number | string; + fill?: string; fillOpacity?: number | string; fontFamily?: string; fontSize?: number | string; - fx?: SVGLength | SVGAnimatedLength; - fy?: SVGLength | SVGAnimatedLength; - gradientTransform?: SVGTransformList | SVGAnimatedTransformList; + fx?: number | string; + fy?: number | string; + gradientTransform?: string; gradientUnits?: string; markerEnd?: string; markerMid?: string; @@ -509,27 +528,27 @@ declare module "react/addons" { patternUnits?: string; points?: string; preserveAspectRatio?: string; - r?: SVGLength | SVGAnimatedLength; - rx?: SVGLength | SVGAnimatedLength; - ry?: SVGLength | SVGAnimatedLength; + r?: number | string; + rx?: number | string; + ry?: number | string; spreadMethod?: string; - stopColor?: any; // SVGColor | string + stopColor?: string; stopOpacity?: number | string; - stroke?: any; // SVGPaint + stroke?: string; strokeDasharray?: string; strokeLinecap?: string; strokeOpacity?: number | string; - strokeWidth?: SVGLength | SVGAnimatedLength; + strokeWidth?: number | string; textAnchor?: string; - transform?: SVGTransformList | SVGAnimatedTransformList; + transform?: string; version?: string; viewBox?: string; - x1?: SVGLength | SVGAnimatedLength; - x2?: SVGLength | SVGAnimatedLength; - x?: SVGLength | SVGAnimatedLength; - y1?: SVGLength | SVGAnimatedLength; - y2?: SVGLength | SVGAnimatedLength - y?: SVGLength | SVGAnimatedLength; + x1?: number | string; + x2?: number | string; + x?: number | string; + y1?: number | string; + y2?: number | string + y?: number | string; } // @@ -734,8 +753,12 @@ declare module "react/addons" { classSet(cx: { [key: string]: boolean }): string; classSet(...classList: string[]): string; + cloneWithProps

    (element: DOMElement

    , props: P): DOMElement

    ; + cloneWithProps

    (element: ClassicElement

    , props: P): ClassicElement

    ; cloneWithProps

    (element: ReactElement

    , props: P): ReactElement

    ; + createFragment(object: { [key: string]: ReactNode }): ReactFragment; + update(value: any[], spec: UpdateArraySpec): any[]; update(value: {}, spec: UpdateSpec): any; @@ -748,8 +771,6 @@ declare module "react/addons" { // React.addons (Transitions) // ---------------------------------------------------------------------- - type ReactType = ComponentClass | string; - interface TransitionGroupProps { component?: ReactType; childFactory?: (child: ReactElement) => ReactElement; @@ -762,10 +783,8 @@ declare module "react/addons" { transitionLeave?: boolean; } - type CSSTransitionGroup = - ComponentClass; - type TransitionGroup = - ComponentClass; + type CSSTransitionGroup = ComponentClass; + type TransitionGroup = ComponentClass; // // React.addons (Mixins) @@ -857,7 +876,7 @@ declare module "react/addons" { isCompositeComponent(instance: Component): boolean; isCompositeComponentWithType( instance: Component, - type: ComponentClass): boolean; + type: ComponentClass): boolean; findAllInRenderedTree( tree: Component, @@ -877,19 +896,21 @@ declare module "react/addons" { tree: Component, tagName: string): DOMComponent; - scryRenderedComponentsWithType( + scryRenderedComponentsWithType

    ( tree: Component, - type: ComponentClass): Component[]; + type: ComponentClass

    ): Component[]; scryRenderedComponentsWithType>( tree: Component, - type: ComponentClass): C[]; + type: ComponentClass): C[]; - findRenderedComponentWithType( + findRenderedComponentWithType

    ( tree: Component, - type: ComponentClass): Component; + type: ComponentClass

    ): Component; findRenderedComponentWithType>( tree: Component, - type: ComponentClass): C; + type: ComponentClass): C; + + createRenderer(): ShallowRenderer; } interface SyntheticEventData { @@ -967,6 +988,12 @@ declare module "react/addons" { wheel: EventSimulator; } + class ShallowRenderer { + getRenderOutput>(): C; + render(element: ReactElement, context?: any): void; + unmount(): void; + } + // // Browser Interfaces // https://github.com/nikeee/2048-typescript/blob/master/2048/js/touch.d.ts diff --git a/react/future/react-global-0.13.0.d.ts b/react/react-global.d.ts similarity index 83% rename from react/future/react-global-0.13.0.d.ts rename to react/react-global.d.ts index 60675aec9..f7b7859d4 100644 --- a/react/future/react-global-0.13.0.d.ts +++ b/react/react-global.d.ts @@ -1,4 +1,4 @@ -// Type definitions for React v0.13.0 (internal module) +// Type definitions for React v0.13.1 (internal module) // Project: http://facebook.github.io/react/ // Definitions by: Asana , AssureSign // Definitions: https://github.com/borisyankov/DefinitelyTyped @@ -8,24 +8,27 @@ declare module React { // React Elements // ---------------------------------------------------------------------- - interface ReactElementBase { - type: T; + type ReactType = ComponentClass | string; + + interface ReactElement

    { + type: string | ComponentClass

    ; props: P; - key: number | string; - ref: string; + key: string | number; + ref: string | ((component: Component) => any); } - interface ReactElement

    - extends ReactElementBase, P> {} + interface ClassicElement

    extends ReactElement

    { + type: string | ClassicComponentClass

    ; + ref: string | ((component: ClassicComponent) => any); + } - interface ReactClassicElement

    - extends ReactElementBase | string, P> {} + interface DOMElement

    extends ClassicElement

    { + type: string; + ref: string | ((component: DOMComponent

    ) => any); + } - interface ReactDOMElement

    // subtype of ReactClassicElement - extends ReactElementBase {} - - type ReactHTMLElement = ReactDOMElement; - type ReactSVGElement = ReactDOMElement; + type HTMLElement = DOMElement; + type SVGElement = DOMElement; // // Factories @@ -35,12 +38,12 @@ declare module React { (props?: P, ...children: ReactNode[]): ReactElement

    ; } - interface ClassicFactory

    { - (props?: P, ...children: ReactNode[]): ReactClassicElement

    ; + interface ClassicFactory

    extends Factory

    { + (props?: P, ...children: ReactNode[]): ClassicElement

    ; } - interface DOMFactory

    { - (props?: P, ...children: ReactNode[]): ReactDOMElement

    ; + interface DOMFactory

    extends ClassicFactory

    { + (props?: P, ...children: ReactNode[]): DOMElement

    ; } type HTMLFactory = DOMFactory; @@ -52,45 +55,54 @@ declare module React { // ---------------------------------------------------------------------- type ReactText = string | number; - type ReactChild = ReactElementBase | ReactText; + type ReactChild = ReactElement | ReactText; // Should be Array but type aliases cannot be recursive - type ReactFragment = Array; + type ReactFragment = {} | Array; type ReactNode = ReactChild | ReactFragment | boolean; // // Top Level API // ---------------------------------------------------------------------- - function createClass( - spec: ComponentSpec): ClassicComponentClass; + function createClass(spec: ComponentSpec): ClassicComponentClass

    ; - function createFactory

    ( - type: string): DOMFactory

    ; - function createFactory

    ( - type: ClassicComponentClass | string): ClassicFactory

    ; - function createFactory

    ( - type: ComponentClass): Factory

    ; + function createFactory

    (type: string): DOMFactory

    ; + function createFactory

    (type: ClassicComponentClass

    | string): ClassicFactory

    ; + function createFactory

    (type: ComponentClass

    ): Factory

    ; function createElement

    ( type: string, props?: P, - ...children: ReactNode[]): ReactDOMElement

    ; + ...children: ReactNode[]): DOMElement

    ; function createElement

    ( - type: ClassicComponentClass | string, + type: ClassicComponentClass

    | string, props?: P, - ...children: ReactNode[]): ReactClassicElement

    ; + ...children: ReactNode[]): ClassicElement

    ; function createElement

    ( - type: ComponentClass, + type: ComponentClass

    , + props?: P, + ...children: ReactNode[]): ReactElement

    ; + + function cloneElement

    ( + element: DOMElement

    , + props?: P, + ...children: ReactNode[]): DOMElement

    ; + function cloneElement

    ( + element: ClassicElement

    , + props?: P, + ...children: ReactNode[]): ClassicElement

    ; + function cloneElement

    ( + element: ReactElement

    , props?: P, ...children: ReactNode[]): ReactElement

    ; function render

    ( - element: ReactDOMElement

    , + element: DOMElement

    , container: Element, callback?: () => any): DOMComponent

    ; function render( - element: ReactClassicElement

    , + element: ClassicElement

    , container: Element, callback?: () => any): ClassicComponent; function render( @@ -99,8 +111,8 @@ declare module React { callback?: () => any): Component; function unmountComponentAtNode(container: Element): boolean; - function renderToString(element: ReactElementBase): string; - function renderToStaticMarkup(element: ReactElementBase): string; + function renderToString(element: ReactElement): string; + function renderToStaticMarkup(element: ReactElement): string; function isValidElement(object: {}): boolean; function initializeTouchEvents(shouldUseTouch: boolean): void; @@ -119,7 +131,8 @@ declare module React { // Base component for plain JS classes class Component implements ComponentLifecycle { - constructor(props: P, context: any); + constructor(props?: P, context?: any); + setState(f: (prevState: S, props: P) => S, callback?: () => any): void; setState(state: S, callback?: () => any): void; forceUpdate(): void; props: P; @@ -155,19 +168,16 @@ declare module React { // Class Interfaces // ---------------------------------------------------------------------- - interface ComponentClassBase

    { + interface ComponentClass

    { + new(props?: P, context?: any): Component; propTypes?: ValidationMap

    ; contextTypes?: ValidationMap; childContextTypes?: ValidationMap; - } - - interface ComponentClass extends ComponentClassBase

    { - new(props?: P, context?: any): Component; defaultProps?: P; } - interface ClassicComponentClass extends ComponentClassBase

    { - new(props?: P, context?: any): ClassicComponent; + interface ClassicComponentClass

    extends ComponentClass

    { + new(props?: P, context?: any): ClassicComponent; getDefaultProps?(): P; displayName?: string; } @@ -197,12 +207,12 @@ declare module React { contextTypes?: ValidationMap; childContextTypes?: ValidationMap - getInitialState?(): S; getDefaultProps?(): P; + getInitialState?(): S; } interface ComponentSpec extends Mixin { - render(): ReactElementBase; + render(): ReactElement; } // @@ -311,13 +321,13 @@ declare module React { // Props / DOM Attributes // ---------------------------------------------------------------------- - interface Props { + interface Props { children?: ReactNode; - key?: number | string; - ref?: string; + key?: string | number; + ref?: string | ((component: T) => any); } - interface DOMAttributes extends Props { + interface DOMAttributes extends Props> { onCopy?: ClipboardEventHandler; onCut?: ClipboardEventHandler; onPaste?: ClipboardEventHandler; @@ -358,14 +368,18 @@ declare module React { }; } + // This interface is not complete. Only properties accepting + // unitless numbers are listed here (see CSSProperty.js in React) interface CSSProperties { + boxFlex?: number; + boxFlexGroup?: number; columnCount?: number; flex?: number | string; flexGrow?: number; flexShrink?: number; - fontWeight?: number; + fontWeight?: number | string; lineClamp?: number; - lineHeight?: number; + lineHeight?: number | string; opacity?: number; order?: number; orphans?: number; @@ -376,9 +390,12 @@ declare module React { // SVG-related properties fillOpacity?: number; strokeOpacity?: number; + strokeWidth?: number; } interface HTMLAttributes extends DOMAttributes { + ref?: string | ((component: HTMLComponent) => void); + accept?: string; acceptCharset?: string; accessKey?: string; @@ -487,18 +504,20 @@ declare module React { } interface SVGAttributes extends DOMAttributes { - cx?: SVGLength | SVGAnimatedLength; - cy?: any; + ref?: string | ((component: SVGComponent) => void); + + cx?: number | string; + cy?: number | string; d?: string; - dx?: SVGLength | SVGAnimatedLength; - dy?: SVGLength | SVGAnimatedLength; - fill?: any; // SVGPaint | string + dx?: number | string; + dy?: number | string; + fill?: string; fillOpacity?: number | string; fontFamily?: string; fontSize?: number | string; - fx?: SVGLength | SVGAnimatedLength; - fy?: SVGLength | SVGAnimatedLength; - gradientTransform?: SVGTransformList | SVGAnimatedTransformList; + fx?: number | string; + fy?: number | string; + gradientTransform?: string; gradientUnits?: string; markerEnd?: string; markerMid?: string; @@ -509,27 +528,27 @@ declare module React { patternUnits?: string; points?: string; preserveAspectRatio?: string; - r?: SVGLength | SVGAnimatedLength; - rx?: SVGLength | SVGAnimatedLength; - ry?: SVGLength | SVGAnimatedLength; + r?: number | string; + rx?: number | string; + ry?: number | string; spreadMethod?: string; - stopColor?: any; // SVGColor | string + stopColor?: string; stopOpacity?: number | string; - stroke?: any; // SVGPaint + stroke?: string; strokeDasharray?: string; strokeLinecap?: string; strokeOpacity?: number | string; - strokeWidth?: SVGLength | SVGAnimatedLength; + strokeWidth?: number | string; textAnchor?: string; - transform?: SVGTransformList | SVGAnimatedTransformList; + transform?: string; version?: string; viewBox?: string; - x1?: SVGLength | SVGAnimatedLength; - x2?: SVGLength | SVGAnimatedLength; - x?: SVGLength | SVGAnimatedLength; - y1?: SVGLength | SVGAnimatedLength; - y2?: SVGLength | SVGAnimatedLength - y?: SVGLength | SVGAnimatedLength; + x1?: number | string; + x2?: number | string; + x?: number | string; + y1?: number | string; + y2?: number | string + y?: number | string; } // diff --git a/react/react-tests.ts b/react/react-tests.ts index 07c8a89d4..2802a34cd 100644 --- a/react/react-tests.ts +++ b/react/react-tests.ts @@ -1,7 +1,7 @@ /// import React = require("react"); -interface Props { +interface Props extends React.Props { hello: string; world?: string; foo: number; @@ -13,7 +13,15 @@ interface State { seconds?: number; } -interface MyComponent extends React.CompositeComponent { +interface Context { + someValue?: string; +} + +interface ChildContext { + someOtherValue: string; +} + +interface MyComponent extends React.Component { reset(): void; } @@ -26,95 +34,167 @@ var props: Props = { }; var container: Element; -var INPUT_REF: string = "input"; // // Top-Level API // -------------------------------------------------------------------------- -var reactClass: React.ComponentClass = React.createClass({ - getDefaultProps: () => { - return { - hello: undefined, - world: "peace", - foo: undefined, - bar: undefined - }; - }, - getInitialState: () => { +var ClassicComponent: React.ClassicComponentClass = + React.createClass({ + getDefaultProps: () => { + return { + hello: undefined, + world: "peace", + foo: undefined, + bar: undefined + }; + }, + getInitialState: () => { + return { + inputValue: this.context.someValue, + seconds: this.props.foo + }; + }, + reset: () => { + this.replaceState(this.getInitialState()); + }, + render: () => { + return React.DOM.div(null, + React.DOM.input({ + ref: input => this._input = input, + value: this.state.inputValue + })); + } + }); + +class ModernComponent extends React.Component + implements React.ChildContextProvider { + + static propTypes: React.ValidationMap = { + foo: React.PropTypes.number + } + + static contextTypes: React.ValidationMap = { + someValue: React.PropTypes.string + } + + static childContextTypes: React.ValidationMap = { + someOtherValue: React.PropTypes.string + } + + getChildContext() { return { - inputValue: "React.js", - seconds: 0 - }; - }, - reset: () => { - this.replaceState(this.getInitialState()); - }, - render: () => { + someOtherValue: 'foo' + } + } + + state = { + inputValue: this.context.someValue, + seconds: this.props.foo + } + + reset() { + this.setState({ + inputValue: this.context.someValue, + seconds: this.props.foo + }); + } + + private _input: React.HTMLComponent; + + render() { return React.DOM.div(null, React.DOM.input({ - ref: INPUT_REF, + ref: input => this._input = input, value: this.state.inputValue })); } -}); +} -var reactElement: React.ReactElement = - React.createElement(reactClass, props); +// React.createFactory +var factory: React.Factory = + React.createFactory(ModernComponent); +var factoryElement: React.ReactElement = + factory(props); -var reactFactory: React.ComponentFactory = - React.createFactory(reactClass); +var classicFactory: React.ClassicFactory = + React.createFactory(ClassicComponent); +var classicFactoryElement: React.ClassicElement = + classicFactory(props); -var component: React.Component = - React.render(reactElement, container); +var domFactory: React.DOMFactory = + React.createFactory("foo"); +var domFactoryElement: React.DOMElement = + domFactory(); +// React.createElement +var element: React.ReactElement = + React.createElement(ModernComponent, props); +var classicElement: React.ClassicElement = + React.createElement(ClassicComponent, props); +var domElement: React.HTMLElement = + React.createElement("div"); + +// React.cloneElement +var clonedElement: React.ReactElement = + React.cloneElement(element, props); +var clonedClassicElement: React.ClassicElement = + React.cloneElement(classicElement, props); +var clonedDOMElement: React.HTMLElement = + React.cloneElement(domElement); + +// React.render +var component: React.Component = + React.render(element, container); +var classicComponent: React.ClassicComponent = + React.render(classicElement, container); +var domComponent: React.DOMComponent = + React.render(domElement, container); + +// Other Top-Level API var unmounted: boolean = React.unmountComponentAtNode(container); -var str: string = React.renderToString(reactElement); -var markup: string = React.renderToStaticMarkup(reactElement); +var str: string = React.renderToString(element); +var markup: string = React.renderToStaticMarkup(element); var notValid: boolean = React.isValidElement(props); // false -var isValid = React.isValidElement(reactElement); // true +var isValid = React.isValidElement(element); // true React.initializeTouchEvents(true); +var domNode: Element = React.findDOMNode(component); +domNode = React.findDOMNode(domNode); // // React Elements // -------------------------------------------------------------------------- -var type = reactElement.type; -var elementProps: Props = reactElement.props; -var key = reactElement.key; -var ref: string = reactElement.ref; -var factoryElement: React.ReactElement = reactFactory(elementProps); +var type = element.type; +var elementProps: Props = element.props; +var key = element.key; // // React Components // -------------------------------------------------------------------------- -var displayName: string = reactClass.displayName; -var defaultProps: Props = reactClass.getDefaultProps(); -var propTypes: React.ValidationMap = reactClass.propTypes; +var displayName: string = ClassicComponent.displayName; +var defaultProps: Props = ClassicComponent.getDefaultProps(); +var propTypes: React.ValidationMap = ClassicComponent.propTypes; // // Component API // -------------------------------------------------------------------------- -var htmlElement: Element = component.getDOMNode(); -var divElement: HTMLDivElement = component.getDOMNode(); -var isMounted: boolean = component.isMounted(); -component.setProps(elementProps); -component.replaceProps(props); +// modern +var componentState: State = component.state; +component.setState({ inputValue: "!!!" }); +component.forceUpdate(); -var compComponent: React.CompositeComponent = - >component; -var initialState: State = compComponent.state; -compComponent.setState({ inputValue: "!!!" }); -compComponent.replaceState({ inputValue: "???", seconds: 60 }); -compComponent.forceUpdate(); +// classic +var htmlElement: Element = classicComponent.getDOMNode(); +var divElement: HTMLDivElement = classicComponent.getDOMNode(); +var isMounted: boolean = classicComponent.isMounted(); +classicComponent.setProps(elementProps); +classicComponent.replaceProps(props); +classicComponent.replaceState({ inputValue: "???", seconds: 60 }); -var inputRef: React.HTMLComponent = - compComponent.refs[INPUT_REF]; -var value: string = inputRef.getDOMNode().value; - -var myComponent = compComponent; +var myComponent = component; myComponent.reset(); // @@ -144,6 +224,21 @@ React.DOM.div(htmlAttr); React.DOM.span(htmlAttr); React.DOM.input(htmlAttr); +React.DOM.svg({ viewBox: "0 0 48 48" }, + React.DOM.rect({ + x: 22, + y: 10, + width: 4, + height: 28 + }), + React.DOM.rect({ + x: 10, + y: 22, + width: 28, + height: 4 + })); + + // // React.PropTypes // -------------------------------------------------------------------------- @@ -180,7 +275,48 @@ var PropTypesSpecification: React.ComponentSpec = { return null; } }, - render: (): React.ReactHTMLElement => { + render: (): React.ReactElement => { + return null; + } +}; + +// +// ContextTypes +// -------------------------------------------------------------------------- + +var ContextTypesSpecification: React.ComponentSpec = { + contextTypes: { + optionalArray: React.PropTypes.array, + optionalBool: React.PropTypes.bool, + optionalFunc: React.PropTypes.func, + optionalNumber: React.PropTypes.number, + optionalObject: React.PropTypes.object, + optionalString: React.PropTypes.string, + optionalNode: React.PropTypes.node, + optionalElement: React.PropTypes.element, + optionalMessage: React.PropTypes.instanceOf(Date), + optionalEnum: React.PropTypes.oneOf(["News", "Photos"]), + optionalUnion: React.PropTypes.oneOfType([ + React.PropTypes.string, + React.PropTypes.number, + React.PropTypes.instanceOf(Date) + ]), + optionalArrayOf: React.PropTypes.arrayOf(React.PropTypes.number), + optionalObjectOf: React.PropTypes.objectOf(React.PropTypes.number), + optionalObjectWithShape: React.PropTypes.shape({ + color: React.PropTypes.string, + fontSize: React.PropTypes.number + }), + requiredFunc: React.PropTypes.func.isRequired, + requiredAny: React.PropTypes.any.isRequired, + customProp: function(props: any, propName: string, componentName: string) { + if (!/matchme/.test(props[propName])) { + return new Error("Validation failed!"); + } + return null; + } + }, + render: (): React.ReactElement => { return null; } }; @@ -202,34 +338,29 @@ var onlyChild = React.Children.only([null, [[["Hallo"], true]], false]); interface TimerState { secondsElapsed: number; } -interface Timer extends React.CompositeComponent<{}, TimerState> { -} -var Timer = React.createClass({ - displayName: "Timer", - getInitialState: () => { - return { secondsElapsed: 0 }; - }, - tick: () => { - var me = this; - me.setState({ - secondsElapsed: me.state.secondsElapsed + 1 - }); - }, - componentDidMount: () => { - this.interval = setInterval(this.tick, 1000); - }, - componentWillUnmount: () => { - clearInterval(this.interval); - }, - render: () => { - var me = this; +class Timer extends React.Component<{}, TimerState> { + state = { + secondsElapsed: 0 + } + private _interval: number; + tick() { + this.setState((prevState, props) => ({ + secondsElapsed: prevState.secondsElapsed + 1 + })); + } + componentDidMount() { + this._interval = setInterval(() => this.tick(), 1000); + } + componentWillUnmount() { + clearInterval(this._interval); + } + render() { return React.DOM.div( null, "Seconds Elapsed: ", - me.state.secondsElapsed + this.state.secondsElapsed ); } -}); -var mountNode: Element; -React.render(React.createElement(Timer, null), mountNode); +} +React.render(React.createElement(Timer), container); diff --git a/react/react.d.ts b/react/react.d.ts index f2786cbc8..64796ddf4 100644 --- a/react/react.d.ts +++ b/react/react.d.ts @@ -1,27 +1,56 @@ -// Type definitions for React 0.12.1 +// Type definitions for React v0.13.1 (external module) // Project: http://facebook.github.io/react/ -// Definitions by: Asana +// Definitions by: Asana , AssureSign // Definitions: https://github.com/borisyankov/DefinitelyTyped -declare module React { +declare module "react" { // - // React Elements + // React Elements // ---------------------------------------------------------------------- type ReactType = ComponentClass | string; interface ReactElement

    { - type: ComponentClass

    | string; + type: string | ComponentClass

    ; props: P; - key: number | string; - ref: string; + key: string | number; + ref: string | ((component: Component) => any); } - interface ReactHTMLElement extends ReactElement {} - interface ReactSVGElement extends ReactElement {} + interface ClassicElement

    extends ReactElement

    { + type: string | ClassicComponentClass

    ; + ref: string | ((component: ClassicComponent) => any); + } + + interface DOMElement

    extends ClassicElement

    { + type: string; + ref: string | ((component: DOMComponent

    ) => any); + } + + type HTMLElement = DOMElement; + type SVGElement = DOMElement; // - // React Nodes + // Factories + // ---------------------------------------------------------------------- + + interface Factory

    { + (props?: P, ...children: ReactNode[]): ReactElement

    ; + } + + interface ClassicFactory

    extends Factory

    { + (props?: P, ...children: ReactNode[]): ClassicElement

    ; + } + + interface DOMFactory

    extends ClassicFactory

    { + (props?: P, ...children: ReactNode[]): DOMElement

    ; + } + + type HTMLFactory = DOMFactory; + type SVGFactory = DOMFactory; + + // + // React Nodes // http://facebook.github.io/react/docs/glossary.html // ---------------------------------------------------------------------- @@ -29,106 +58,157 @@ declare module React { type ReactChild = ReactElement | ReactText; // Should be Array but type aliases cannot be recursive - type ReactFragment = Array; + type ReactFragment = {} | Array; type ReactNode = ReactChild | ReactFragment | boolean; // - // React Components + // Top Level API // ---------------------------------------------------------------------- - interface ComponentStatics

    { - displayName?: string; - getDefaultProps?(): P; - propTypes?: ValidationMap

    ; - } + function createClass(spec: ComponentSpec): ClassicComponentClass

    ; - interface ComponentClass

    extends ComponentStatics

    { - // Deprecated in 0.12. See http://fb.me/react-legacyfactory - // new(props: P): ReactElement

    ; - // (props: P): ReactElement

    ; - } + function createFactory

    (type: string): DOMFactory

    ; + function createFactory

    (type: ClassicComponentClass

    | string): ClassicFactory

    ; + function createFactory

    (type: ComponentClass

    ): Factory

    ; - // - // ReactElement Factories - // ---------------------------------------------------------------------- + function createElement

    ( + type: string, + props?: P, + ...children: ReactNode[]): DOMElement

    ; + function createElement

    ( + type: ClassicComponentClass

    | string, + props?: P, + ...children: ReactNode[]): ClassicElement

    ; + function createElement

    ( + type: ComponentClass

    , + props?: P, + ...children: ReactNode[]): ReactElement

    ; - interface ComponentFactory

    { - (props?: P, ...children: ReactNode[]): ReactElement

    ; - } - - interface HTMLFactory extends ComponentFactory {} - interface SVGFactory extends ComponentFactory {} + function cloneElement

    ( + element: DOMElement

    , + props?: P, + ...children: ReactNode[]): DOMElement

    ; + function cloneElement

    ( + element: ClassicElement

    , + props?: P, + ...children: ReactNode[]): ClassicElement

    ; + function cloneElement

    ( + element: ReactElement

    , + props?: P, + ...children: ReactNode[]): ReactElement

    ; - // - // Top-Level API - // ---------------------------------------------------------------------- + function render

    ( + element: DOMElement

    , + container: Element, + callback?: () => any): DOMComponent

    ; + function render( + element: ClassicElement

    , + container: Element, + callback?: () => any): ClassicComponent; + function render( + element: ReactElement

    , + container: Element, + callback?: () => any): Component; - interface TopLevelAPI { - createClass

    (spec: ComponentSpec): ComponentClass

    ; - createElement

    (type: ComponentClass

    | string, props: P, ...children: ReactNode[]): ReactElement

    ; - createFactory

    (componentClass: ComponentClass

    ): ComponentFactory

    ; - render

    (element: ReactElement

    , container: Element, callback?: () => any): Component

    ; - unmountComponentAtNode(container: Element): boolean; - renderToString(element: ReactElement): string; - renderToStaticMarkup(element: ReactElement): string; - isValidElement(object: {}): boolean; - initializeTouchEvents(shouldUseTouch: boolean): void; - } + function unmountComponentAtNode(container: Element): boolean; + function renderToString(element: ReactElement): string; + function renderToStaticMarkup(element: ReactElement): string; + function isValidElement(object: {}): boolean; + function initializeTouchEvents(shouldUseTouch: boolean): void; + + function findDOMNode( + componentOrElement: Component | Element): TElement; + function findDOMNode( + componentOrElement: Component | Element): Element; + + var DOM: ReactDOM; + var PropTypes: ReactPropTypes; + var Children: ReactChildren; // // Component API // ---------------------------------------------------------------------- - interface Component

    { - // Use this overload to cast the returned element to a more specific type. - // Eg: var name = this.refs['name'].getDOMNode().value; + // Base component for plain JS classes + class Component implements ComponentLifecycle { + constructor(props?: P, context?: any); + setState(f: (prevState: S, props: P) => S, callback?: () => any): void; + setState(state: S, callback?: () => any): void; + forceUpdate(): void; + props: P; + state: S; + context: any; + refs: { + [key: string]: Component + }; + } + + interface ClassicComponent extends Component { + replaceState(nextState: S, callback?: () => any): void; getDOMNode(): TElement; getDOMNode(): Element; isMounted(): boolean; - - props: P; + getInitialState?(): S; setProps(nextProps: P, callback?: () => any): void; replaceProps(nextProps: P, callback?: () => any): void; } - interface DOMComponent

    extends Component

    { + interface DOMComponent

    extends ClassicComponent { tagName: string; } - interface HTMLComponent extends DOMComponent {} - interface SVGComponent extends DOMComponent {} - - interface CompositeComponent extends Component

    , ComponentSpec { - state: S; - setState(nextState: S, callback?: () => any): void; - replaceState(nextState: S, callback?: () => any): void; - forceUpdate(callback?: () => any): void; - refs: { - [key: string]: Component - }; + type HTMLComponent = DOMComponent; + type SVGComponent = DOMComponent; + + interface ChildContextProvider { + getChildContext(): CC; + } + + // + // Class Interfaces + // ---------------------------------------------------------------------- + + interface ComponentClass

    { + new(props?: P, context?: any): Component; + propTypes?: ValidationMap

    ; + contextTypes?: ValidationMap; + childContextTypes?: ValidationMap; + defaultProps?: P; + } + + interface ClassicComponentClass

    extends ComponentClass

    { + new(props?: P, context?: any): ClassicComponent; + getDefaultProps?(): P; + displayName?: string; } // // Component Specs and Lifecycle // ---------------------------------------------------------------------- - interface Mixin extends ComponentStatics

    { + interface ComponentLifecycle { + componentWillMount?(): void; + componentDidMount?(): void; + componentWillReceiveProps?(nextProps: P, nextContext: any): void; + shouldComponentUpdate?(nextProps: P, nextState: S, nextContext: any): boolean; + componentWillUpdate?(nextProps: P, nextState: S, nextContext: any): void; + componentDidUpdate?(prevProps: P, prevState: S, prevContext: any): void; + componentWillUnmount?(): void; + } + + interface Mixin extends ComponentLifecycle { mixins?: Mixin; statics?: { [key: string]: any; }; - // Definition methods - getInitialState?(): S; + displayName?: string; + propTypes?: ValidationMap; + contextTypes?: ValidationMap; + childContextTypes?: ValidationMap - // Delegate methods - componentWillMount?(): void; - componentDidMount?(): void; - componentWillReceiveProps?(nextProps: P): void; - shouldComponentUpdate?(nextProps: P, nextState: S): boolean; - componentWillUpdate?(nextProps: P, nextState: S): void; - componentDidUpdate?(prevProps: P, prevState: S): void; - componentWillUnmount?(): void; + getDefaultProps?(): P; + getInitialState?(): S; } interface ComponentSpec extends Mixin { @@ -238,15 +318,16 @@ declare module React { interface WheelEventHandler extends EventHandler {} // - // Attributes + // Props / DOM Attributes // ---------------------------------------------------------------------- - export interface ReactAttributes { + interface Props { children?: ReactNode; - key?: number | string; - ref?: string; + key?: string | number; + ref?: string | ((component: T) => any); + } - // Event Attributes + interface DOMAttributes extends Props> { onCopy?: ClipboardEventHandler; onCut?: ClipboardEventHandler; onPaste?: ClipboardEventHandler; @@ -287,14 +368,18 @@ declare module React { }; } + // This interface is not complete. Only properties accepting + // unitless numbers are listed here (see CSSProperty.js in React) interface CSSProperties { + boxFlex?: number; + boxFlexGroup?: number; columnCount?: number; flex?: number | string; flexGrow?: number; flexShrink?: number; - fontWeight?: number; + fontWeight?: number | string; lineClamp?: number; - lineHeight?: number; + lineHeight?: number | string; opacity?: number; order?: number; orphans?: number; @@ -305,9 +390,12 @@ declare module React { // SVG-related properties fillOpacity?: number; strokeOpacity?: number; + strokeWidth?: number; } - interface HTMLAttributes extends ReactAttributes { + interface HTMLAttributes extends DOMAttributes { + ref?: string | ((component: HTMLComponent) => void); + accept?: string; acceptCharset?: string; accessKey?: string; @@ -415,19 +503,21 @@ declare module React { itemType?: string; } - interface SVGAttributes extends ReactAttributes { - cx?: SVGLength | SVGAnimatedLength; - cy?: any; + interface SVGAttributes extends DOMAttributes { + ref?: string | ((component: SVGComponent) => void); + + cx?: number | string; + cy?: number | string; d?: string; - dx?: SVGLength | SVGAnimatedLength; - dy?: SVGLength | SVGAnimatedLength; - fill?: any; // SVGPaint | string + dx?: number | string; + dy?: number | string; + fill?: string; fillOpacity?: number | string; fontFamily?: string; fontSize?: number | string; - fx?: SVGLength | SVGAnimatedLength; - fy?: SVGLength | SVGAnimatedLength; - gradientTransform?: SVGTransformList | SVGAnimatedTransformList; + fx?: number | string; + fy?: number | string; + gradientTransform?: string; gradientUnits?: string; markerEnd?: string; markerMid?: string; @@ -438,31 +528,31 @@ declare module React { patternUnits?: string; points?: string; preserveAspectRatio?: string; - r?: SVGLength | SVGAnimatedLength; - rx?: SVGLength | SVGAnimatedLength; - ry?: SVGLength | SVGAnimatedLength; + r?: number | string; + rx?: number | string; + ry?: number | string; spreadMethod?: string; - stopColor?: any; // SVGColor | string + stopColor?: string; stopOpacity?: number | string; - stroke?: any; // SVGPaint + stroke?: string; strokeDasharray?: string; strokeLinecap?: string; strokeOpacity?: number | string; - strokeWidth?: SVGLength | SVGAnimatedLength; + strokeWidth?: number | string; textAnchor?: string; - transform?: SVGTransformList | SVGAnimatedTransformList; + transform?: string; version?: string; viewBox?: string; - x1?: SVGLength | SVGAnimatedLength; - x2?: SVGLength | SVGAnimatedLength; - x?: SVGLength | SVGAnimatedLength; - y1?: SVGLength | SVGAnimatedLength; - y2?: SVGLength | SVGAnimatedLength - y?: SVGLength | SVGAnimatedLength; + x1?: number | string; + x2?: number | string; + x?: number | string; + y1?: number | string; + y2?: number | string + y?: number | string; } // - // React.DOM + // React.DOM // ---------------------------------------------------------------------- interface ReactDOM { @@ -645,254 +735,6 @@ declare module React { only(children: ReactNode): ReactChild; } - // - // React.addons - // ---------------------------------------------------------------------- - - interface ClassSet { - [key: string]: boolean; - } - - // - // React.addons (Transitions) - // ---------------------------------------------------------------------- - - interface TransitionGroupProps { - component?: ReactType; - childFactory?: (child: ReactElement) => ReactElement; - } - - interface CSSTransitionGroupProps extends TransitionGroupProps { - transitionName: string; - transitionAppear?: boolean; - transitionEnter?: boolean; - transitionLeave?: boolean; - } - - interface CSSTransitionGroup extends ComponentClass {} - interface TransitionGroup extends ComponentClass {} - - // - // React.addons (Mixins) - // ---------------------------------------------------------------------- - - interface ReactLink { - value: T; - requestChange(newValue: T): void; - } - - interface LinkedStateMixin extends Mixin { - linkState(key: string): ReactLink; - } - - interface PureRenderMixin extends Mixin { - } - - // - // Reat.addons.update - // ---------------------------------------------------------------------- - - interface UpdateSpec { - $set: any; - $merge: {}; - $apply(value: any): any; - // [key: string]: UpdateSpec; - } - - interface UpdateArraySpec extends UpdateSpec { - $push?: any[]; - $unshift?: any[]; - $splice?: any[][]; - } - - // - // React.addons.Perf - // ---------------------------------------------------------------------- - - interface ComponentPerfContext { - current: string; - owner: string; - } - - interface NumericPerfContext { - [key: string]: number; - } - - interface Measurements { - exclusive: NumericPerfContext; - inclusive: NumericPerfContext; - render: NumericPerfContext; - counts: NumericPerfContext; - writes: NumericPerfContext; - displayNames: { - [key: string]: ComponentPerfContext; - }; - totalTime: number; - } - - interface ReactPerf { - start(): void; - stop(): void; - printInclusive(measurements: Measurements[]): void; - printExclusive(measurements: Measurements[]): void; - printWasted(measurements: Measurements[]): void; - printDOM(measurements: Measurements[]): void; - getLastMeasurements(): Measurements[]; - } - - // - // React.addons.TestUtils - // ---------------------------------------------------------------------- - - interface MockedComponentClass { - new(): any; - } - - interface ReactTestUtils { - Simulate: Simulate; - - renderIntoDocument

    (element: ReactElement

    ): Component

    ; - renderIntoDocument>(element: ReactElement): C; - - mockComponent(mocked: MockedComponentClass, mockTagName?: string): ReactTestUtils; - - isElementOfType(element: ReactElement, type: ReactType): boolean; - isDOMComponent(instance: Component): boolean; - isCompositeComponent(instance: Component): boolean; - isCompositeComponentWithType(instance: Component, type: ComponentClass): boolean; - isTextComponent(instance: Component): boolean; - - findAllInRenderedTree(tree: Component, fn: (i: Component) => boolean): Component; - - scryRenderedDOMComponentsWithClass(tree: Component, className: string): DOMComponent[]; - findRenderedDOMComponentWithClass(tree: Component, className: string): DOMComponent; - - scryRenderedDOMComponentsWithTag(tree: Component, tagName: string): DOMComponent[]; - findRenderedDOMComponentWithTag(tree: Component, tagName: string): DOMComponent; - - scryRenderedComponentsWithType( - tree: Component, type: ComponentClass

    ): CompositeComponent[]; - scryRenderedComponentsWithType>( - tree: Component, type: ComponentClass): C[]; - - findRenderedComponentWithType( - tree: Component, type: ComponentClass

    ): CompositeComponent; - findRenderedComponentWithType>( - tree: Component, type: ComponentClass): C; - } - - interface SyntheticEventData { - altKey?: boolean; - button?: number; - buttons?: number; - clientX?: number; - clientY?: number; - changedTouches?: TouchList; - charCode?: boolean; - clipboardData?: DataTransfer; - ctrlKey?: boolean; - deltaMode?: number; - deltaX?: number; - deltaY?: number; - deltaZ?: number; - detail?: number; - getModifierState?(key: string): boolean; - key?: string; - keyCode?: number; - locale?: string; - location?: number; - metaKey?: boolean; - pageX?: number; - pageY?: number; - relatedTarget?: EventTarget; - repeat?: boolean; - screenX?: number; - screenY?: number; - shiftKey?: boolean; - targetTouches?: TouchList; - touches?: TouchList; - view?: AbstractView; - which?: number; - } - - interface EventSimulator { - (element: Element, eventData?: SyntheticEventData): void; - (descriptor: Component, eventData?: SyntheticEventData): void; - } - - interface Simulate { - blur: EventSimulator; - change: EventSimulator; - click: EventSimulator; - cut: EventSimulator; - doubleClick: EventSimulator; - drag: EventSimulator; - dragEnd: EventSimulator; - dragEnter: EventSimulator; - dragExit: EventSimulator; - dragLeave: EventSimulator; - dragOver: EventSimulator; - dragStart: EventSimulator; - drop: EventSimulator; - focus: EventSimulator; - input: EventSimulator; - keyDown: EventSimulator; - keyPress: EventSimulator; - keyUp: EventSimulator; - mouseDown: EventSimulator; - mouseEnter: EventSimulator; - mouseLeave: EventSimulator; - mouseMove: EventSimulator; - mouseOut: EventSimulator; - mouseOver: EventSimulator; - mouseUp: EventSimulator; - paste: EventSimulator; - scroll: EventSimulator; - submit: EventSimulator; - touchCancel: EventSimulator; - touchEnd: EventSimulator; - touchMove: EventSimulator; - touchStart: EventSimulator; - wheel: EventSimulator; - } - - // - // react Exports - // ---------------------------------------------------------------------- - - interface Exports extends TopLevelAPI { - DOM: ReactDOM; - PropTypes: ReactPropTypes; - Children: ReactChildren; - } - - // - // react/addons Exports - // ---------------------------------------------------------------------- - - interface AddonsExports extends Exports { - addons: { - CSSTransitionGroup: CSSTransitionGroup; - LinkedStateMixin: LinkedStateMixin; - PureRenderMixin: PureRenderMixin; - TransitionGroup: TransitionGroup; - - batchedUpdates(callback: (a: A, b: B) => any, a: A, b: B): void; - batchedUpdates(callback: (a: A) => any, a: A): void; - batchedUpdates(callback: () => any): void; - - classSet(cx: ClassSet): string; - cloneWithProps

    (element: ReactElement

    , props: P): ReactElement

    ; - - update(value: any[], spec: UpdateArraySpec): any[]; - update(value: {}, spec: UpdateSpec): any; - - // Development tools - Perf: ReactPerf; - TestUtils: ReactTestUtils; - }; - } - // // Browser Interfaces // https://github.com/nikeee/2048-typescript/blob/master/2048/js/touch.d.ts @@ -922,13 +764,3 @@ declare module React { } } -declare module "react" { - var exports: React.Exports; - export = exports; -} - -declare module "react/addons" { - var exports: React.AddonsExports; - export = exports; -} - diff --git a/redis/redis.d.ts b/redis/redis.d.ts index a3bd49e91..8e9c97856 100644 --- a/redis/redis.d.ts +++ b/redis/redis.d.ts @@ -33,7 +33,7 @@ declare module "redis" { } interface ClientOpts { - parser: string; + parser?: string; return_buffers?: boolean; detect_buffers?: boolean; socket_nodelay?: boolean; @@ -42,7 +42,7 @@ declare module "redis" { retry_max_delay?: number; connect_timeout?: number; max_attempts?: number; - auth_pass?: boolean; + auth_pass?: string; } interface RedisClient extends NodeJS.EventEmitter { diff --git a/response-time/response-time-tests.ts b/response-time/response-time-tests.ts new file mode 100644 index 000000000..b65b8fd19 --- /dev/null +++ b/response-time/response-time-tests.ts @@ -0,0 +1,12 @@ +/// + +import express = require('express'); +import responseTime = require('response-time'); +var app = express(); + +app.use(responseTime()); +app.use(responseTime({ + digits: 3, + header: 'X-Response-Time', + suffix: true +})); diff --git a/response-time/response-time.d.ts b/response-time/response-time.d.ts new file mode 100644 index 000000000..ce9d41f5f --- /dev/null +++ b/response-time/response-time.d.ts @@ -0,0 +1,38 @@ +// Type definitions for response-time 2.2.0 +// Project: https://github.com/expressjs/response-time +// Definitions by: Uros Smolnik +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/* =================== USAGE =================== + + import responseTime = require('response-time'); + app.use(responseTime()); + + =============================================== */ + +/// + +declare module "response-time" { + import express = require('express'); + + /** + * Response time header for node.js + * Returns middleware that adds a X-Response-Time header to responses. + */ + function responseTime(options?: { + /** + * The fixed number of digits to include in the output, which is always in milliseconds, defaults to 3 (ex: 2.300ms). + */ + digits?: number; + /** + * The name of the header to set, defaults to X-Response-Time. + */ + header?: string; + /** + * Boolean to indicate if units of measurement suffix should be added to the output, defaults to true (ex: 2.300ms vs 2.300). + */ + suffix?: boolean; + }): express.RequestHandler; + + export = responseTime; +} \ No newline at end of file diff --git a/restangular/restangular-tests.ts b/restangular/restangular-tests.ts index 11d7a086d..82dfcd805 100644 --- a/restangular/restangular-tests.ts +++ b/restangular/restangular-tests.ts @@ -82,6 +82,9 @@ myApp.controller('TestCtrl', ( Restangular.one('accounts', 123).getList('buildings'); Restangular.one('accounts', 123).getList('buildings'); + var accountData = Restangular.one('accounts', 123).plain(); + var accountClone: restangular.IElement = Restangular.one('accounts', 123).clone(); + baseAccounts.getList().then(function (accounts) { var firstAccount = accounts[0]; $scope.buildings = firstAccount.getList("buildings"); diff --git a/restangular/restangular.d.ts b/restangular/restangular.d.ts index 8b8fd9d2f..c2013f6c4 100644 --- a/restangular/restangular.d.ts +++ b/restangular/restangular.d.ts @@ -112,7 +112,10 @@ declare module restangular { trace(queryParams?: any, headers?: any): IPromise; options(queryParams?: any, headers?: any): IPromise; patch(queryParams?: any, headers?: any): IPromise; + clone(): IElement; + plain(): any; withHttpConfig(httpConfig: IRequestConfig): IElement; + save(queryParams?: any, headers?: any): IPromise; getRestangularUrl(): string; } diff --git a/s3-uploader/s3-uploader-tests.ts b/s3-uploader/s3-uploader-tests.ts new file mode 100644 index 000000000..6fa065866 --- /dev/null +++ b/s3-uploader/s3-uploader-tests.ts @@ -0,0 +1,44 @@ +/// +/// + +//NOTE: Does require GM (https://github.com/aheckmann/gm) thus requires GraphicsMagick (http://www.graphicsmagick.org/) or ImageMagick (http://www.imagemagick.org/) + +import Upload = require('s3-uploader'); + +var s3VersionOriginal: S3UploaderVersion = { + original: true +}; + +var s3VersionHeader: S3UploaderVersion = { + suffix: '-header', + quality: 100, + maxHeight: 300, + maxWidth: 600 +} + +var s3Config: S3UploaderOptions = { + awsAccessKeyId: 'awsKeyId', + awsSecretAccessKey: 'awsSecretAccessKey', + awsBucketPath: '', + awsBucketRegion: 'us-east-1' /*Whatever region s3 is located*/, + awsBucketAcl: 'public-read', + awsHttpTimeout: 60000, + versions: [s3VersionOriginal, s3VersionHeader] +} + +var client = new Upload('bucketName', s3Config); + +client.upload('/images/File.png', s3Config, function (err, images, meta) { + var returnVal: boolean = false; + if (err) { + console.log(err); + } + else { + if (images.length >= 2) { + var originalImageUrl = images[0].url; + var headerImageUrl = images[1].url; + + console.log('Original: ' + originalImageUrl + ' headerImageUrl: ' + headerImageUrl); + } + } +}); diff --git a/s3-uploader/s3-uploader.d.ts b/s3-uploader/s3-uploader.d.ts new file mode 100644 index 000000000..b7c093c3f --- /dev/null +++ b/s3-uploader/s3-uploader.d.ts @@ -0,0 +1,66 @@ +// Type definitions for s3-uploader +// Project: https://www.npmjs.com/package/s3-uploader +// Definitions by: COLSA Corporation +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +//NOTE: Does require GM (https://github.com/aheckmann/gm) thus requires GraphicsMagick (http://www.graphicsmagick.org/) or ImageMagick (http://www.imagemagick.org/) + +declare module "s3-uploader" { + export = Upload; +} +interface S3UploaderVersion { + original?: boolean; + suffix?: string; + quality?: number; + maxWidth?: number; + maxHeight?: number; +} + +interface S3UploaderOptions { + awsAccessKeyId?: string; + awsSecretAccessKey?: string; + awsBucketRegion?: string; + awsBucketPath?: string; + awsBucketAcl?: string; + awsMaxRetries?: number; + awsHttpTimeout?: number; + resizeQuality?: number; + returnExif?: boolean; + tmpDir?: string; + workers?: number; + url?: string; + versions?: S3UploaderVersion; +} + +declare class Meta { + public format: string; + public fileSize: string; + public imageSize: imageSize; + public orientation: string; + public colorSpace: string; + public compression: string; + public quallity: string; +} + +declare class imageSize { + public height: number; + public width: number; +} + +declare class image { + public etag: string; + public format: string; + public height: number; + public original: boolean; + public path: string; + public size: string; + public src: string; + public url: string; + public width: number; +} + +declare class Upload { + public constructor(awsBucketName: string, opts: S3UploaderOptions); + + public upload(src: string, opts?: S3UploaderOptions, cb?: (err: string, images: image[], meta: Meta) => void): void; +} diff --git a/serve-favicon/serve-favicon-tests.ts b/serve-favicon/serve-favicon-tests.ts new file mode 100644 index 000000000..0f99a56fc --- /dev/null +++ b/serve-favicon/serve-favicon-tests.ts @@ -0,0 +1,9 @@ +/// + +import express = require('express'); +import favicon = require('serve-favicon'); +var app = express(); + +app.use(favicon(__dirname + '/public/favicon.ico', { + maxAge: 86400000 +})); diff --git a/serve-favicon/serve-favicon.d.ts b/serve-favicon/serve-favicon.d.ts new file mode 100644 index 000000000..bb19c2f69 --- /dev/null +++ b/serve-favicon/serve-favicon.d.ts @@ -0,0 +1,29 @@ +// Type definitions for serve-favicon 2.1.6 +// Project: https://github.com/expressjs/serve-favicon +// Definitions by: Uros Smolnik +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/* =================== USAGE =================== + + import serveFavicon = require('serve-favicon'); + app.use(serveFavicon(__dirname + '/public/favicon.ico')); + + =============================================== */ + +/// + +declare module "serve-favicon" { + import express = require('express'); + + /** + * Node.js middleware for serving a favicon. + */ + function serveFavicon(path: string, options?: { + /** + * The cache-control max-age directive in ms, defaulting to 1 day. This can also be a string accepted by the ms module. + */ + maxAge?: number; + }): express.RequestHandler; + + export = serveFavicon; +} \ No newline at end of file diff --git a/serve-static/serve-static-tests.ts b/serve-static/serve-static-tests.ts new file mode 100644 index 000000000..6b16e842b --- /dev/null +++ b/serve-static/serve-static-tests.ts @@ -0,0 +1,20 @@ +/// + +import express = require('express'); +import serveStatic = require('serve-static'); +var app = express(); + +app.use(serveStatic('/1')); +app.use(serveStatic('/2', { })); +app.use(serveStatic('/3', { + dotfiles: 'ignore', + etag: true, + extensions: ['html'], + index: true, + lastModified: true, + maxAge: 0, + redirect: true, + setHeaders: function(res: express.Response, path: string, stat: any) { + res.setHeader('Server', 'server-static middleware'); + } +})); diff --git a/serve-static/serve-static.d.ts b/serve-static/serve-static.d.ts new file mode 100644 index 000000000..b116d4384 --- /dev/null +++ b/serve-static/serve-static.d.ts @@ -0,0 +1,79 @@ +// Type definitions for serve-static 1.7.1 +// Project: https://github.com/expressjs/serve-static +// Definitions by: Uros Smolnik +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/* =================== USAGE =================== + + import serveStatic = require('serve-static'); + app.use(serveStatic('public/ftp', {'index': ['default.html', 'default.htm']})) + + =============================================== */ + +/// + +declare module "serve-static" { + import express = require('express'); + + /** + * Create a new middleware function to serve files from within a given root directory. + * The file to serve will be determined by combining req.url with the provided root directory. + * When a file is not found, instead of sending a 404 response, this module will instead call next() to move on to the next middleware, allowing for stacking and fall-backs. + */ + function serveStatic(root: string, options?: { + /** + * Set how "dotfiles" are treated when encountered. A dotfile is a file or directory that begins with a dot ("."). + * Note this check is done on the path itself without checking if the path actually exists on the disk. + * If root is specified, only the dotfiles above the root are checked (i.e. the root itself can be within a dotfile when when set to "deny"). + * The default value is 'ignore'. + * 'allow' No special treatment for dotfiles + * 'deny' Send a 403 for any request for a dotfile + * 'ignore' Pretend like the dotfile does not exist and call next() + */ + dotfiles?: string; + + /** + * Enable or disable etag generation, defaults to true. + */ + etag?: boolean; + + /** + * Set file extension fallbacks. When set, if a file is not found, the given extensions will be added to the file name and search for. + * The first that exists will be served. Example: ['html', 'htm']. + * The default value is false. + */ + extensions?: string[]; + + /** + * By default this module will send "index.html" files in response to a request on a directory. + * To disable this set false or to supply a new index pass a string or an array in preferred order. + */ + index?: boolean; + + /** + * Enable or disable Last-Modified header, defaults to true. Uses the file system's last modified value. + */ + lastModified?: boolean; + + /** + * Provide a max-age in milliseconds for http caching, defaults to 0. This can also be a string accepted by the ms module. + */ + maxAge?: number; + + /** + * Redirect to trailing "/" when the pathname is a dir. Defaults to true. + */ + redirect?: boolean; + + /** + * Function to set custom headers on response. Alterations to the headers need to occur synchronously. + * The function is called as fn(res, path, stat), where the arguments are: + * res the response object + * path the file path that is being sent + * stat the stat object of the file that is being sent + */ + setHeaders?: (res: express.Response, path: string, stat: any) => any; + }): express.Handler; + + export = serveStatic; +} diff --git a/should/should-tests.ts b/should/should-tests.ts index fafb1d7c7..c940f7c13 100644 --- a/should/should-tests.ts +++ b/should/should-tests.ts @@ -75,7 +75,7 @@ false false.should.be.false; (0).should.not.be.false; -var args = (a: string, b: string, c: string) => { return arguments; }; +var args = function (a: string, b: string, c: string) { return arguments; }; args.should.be.arguments; ['a'].should.not.be.arguments; diff --git a/simple-cw-node/simple-cw-node-tests.ts b/simple-cw-node/simple-cw-node-tests.ts index a46eb42c9..d25cc0399 100644 --- a/simple-cw-node/simple-cw-node-tests.ts +++ b/simple-cw-node/simple-cw-node-tests.ts @@ -10,7 +10,7 @@ var Deferred:any = client.Deferred; client.init({ token: 'YOUR_TOKEN' }); // get your info. -client.get('me', (err, res) => { +client.get('me', function (err, res) { console.log(arguments); }); diff --git a/sinon-chai/sinon-chai.d.ts b/sinon-chai/sinon-chai.d.ts index 0f639abb7..d16969dd9 100644 --- a/sinon-chai/sinon-chai.d.ts +++ b/sinon-chai/sinon-chai.d.ts @@ -11,6 +11,7 @@ declare module chai { calledOnce: Expect; calledTwice: Expect; calledThrice: Expect; + callCount(count: number): Expect; calledBefore(spy: Function): Expect; calledAfter(spy: Function): Expect; calledWithNew: Expect; diff --git a/socket.io/socket.io.d.ts b/socket.io/socket.io.d.ts index 677d4fcc2..258b573d5 100644 --- a/socket.io/socket.io.d.ts +++ b/socket.io/socket.io.d.ts @@ -55,7 +55,7 @@ declare module SocketIO { interface Socket { rooms: string[]; client: Client; - conn: Socket; + conn: any; request: any; id: string; emit(name: string, ...args: any[]): Socket; diff --git a/soundjs/soundjs.d.ts b/soundjs/soundjs.d.ts index f719be5b3..90e50200d 100644 --- a/soundjs/soundjs.d.ts +++ b/soundjs/soundjs.d.ts @@ -177,6 +177,7 @@ declare module createjs { static registerManifest(manifest: Object[], basePath: string): Object; static registerPlugins(plugins: any[]): boolean; static registerSound(src: string | Object, id?: string, data?: number | Object, basePath?: string): Object; + static registerSounds(sounds: Object[], basePath?: string): Object[]; static removeAllSounds(): void; static removeManifest(manifest: any[], basePath: string): Object; static removeSound(src: string | Object, basePath: string): boolean; diff --git a/stack-mapper/stack-mapper-tests.ts b/stack-mapper/stack-mapper-tests.ts new file mode 100644 index 000000000..98dd70ef1 --- /dev/null +++ b/stack-mapper/stack-mapper-tests.ts @@ -0,0 +1,8 @@ +/// + +import stackMapper = require("stack-mapper"); + +var map: any = {}; +var sm: stackMapper.StackMapper = stackMapper(map); +var input: stackMapper.Callsite[] = [{ filename: "boo", line: 1, column: 10 }]; +var cs: stackMapper.Callsite[] = sm.map(input); diff --git a/stack-mapper/stack-mapper.d.ts b/stack-mapper/stack-mapper.d.ts new file mode 100644 index 000000000..3426f5b9d --- /dev/null +++ b/stack-mapper/stack-mapper.d.ts @@ -0,0 +1,46 @@ +// Type definitions for stack-mapper 0.2.2 +// Project: https://github.com/thlorenz/stack-mapper +// Definitions by: Rogier Schouten +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module "stack-mapper" { + + module stackMapper { + + export class StackMapper { + + /** + * Maps the trace statements of the given error stack and replaces locations + * referencing code in the generated file with the locations inside the original files. + * + * @name map + * @function + * @param {Array} array of callsite objects (see readme for details about Callsite object) + * @return {Array.} info about the error stack with adapted locations, each with the following properties + * - filename: original filename + * - line: origial line in that filename of the trace + * - column: origial column on that line of the trace + */ + public map(stack: Callsite[]): Callsite[]; + } + + export interface Callsite { + filename: string; + line: number; + column: number; + } + + } + + /** + * Returns a Stackmapper that will use the given source map to map error trace locations. + * + * @name stackMapper + * @function + * @param {Object} sourcemap source map for the generated file + * @return {StackMapper} stack mapper for the particular source map + */ + function stackMapper(sourcemap: any): stackMapper.StackMapper; + + export = stackMapper; +} diff --git a/tether/tether.d.ts b/tether/tether.d.ts index be1200f28..2fffb16c9 100644 --- a/tether/tether.d.ts +++ b/tether/tether.d.ts @@ -14,11 +14,11 @@ declare module tether { classes?: {[className: string]: boolean}; classPrefix?: string; constraints?: ITetherConstraint[]; - element?: Element | string | any /* JQuery */; + element?: HTMLElement | string | any /* JQuery */; enabled?: boolean; offset?: string; optimizations?: any; - target?: Element | string | any /* JQuery */; + target?: HTMLElement | string | any /* JQuery */; targetAttachment?: string; targetOffset?: string; targetModifier?: string; @@ -29,7 +29,7 @@ declare module tether { outOfBoundsClass?: string; pin?: boolean | string[]; pinnedClass?: string; - to?: string | Element | number[]; + to?: string | HTMLElement | number[]; } interface Tether { diff --git a/threejs/three-trackballcontrols.d.ts b/threejs/three-trackballcontrols.d.ts index 21d096812..e969bcb5e 100644 --- a/threejs/three-trackballcontrols.d.ts +++ b/threejs/three-trackballcontrols.d.ts @@ -29,5 +29,13 @@ declare module THREE { keys:number[]; update():void; + reset():void; + checkDistances():void; + zoomCamera():void; + panCamera():void; + rotateCamera():void; + + handleResize():void; + handleEvent(event: any):void; } -} \ No newline at end of file +} diff --git a/timezonecomplete/timezonecomplete-1.10.0-tests.ts b/timezonecomplete/timezonecomplete-1.10.0-tests.ts deleted file mode 100644 index 06f29e3b3..000000000 --- a/timezonecomplete/timezonecomplete-1.10.0-tests.ts +++ /dev/null @@ -1,219 +0,0 @@ -/// - -import tc = require("timezonecomplete-1.10.0"); - -var b: boolean; -var n: number; -var s: string; -var w: tc.WeekDay; - -n = tc.timeUnitToMilliseconds(tc.TimeUnit.Month); -b = tc.isLeapYear(2014); -n = tc.daysInMonth(2014, 10); -n = tc.daysInYear(2014); -n = tc.dayOfYear(2014, 1, 2); -w = tc.firstWeekDayOfMonth(2014, 1, tc.WeekDay.Sunday); -w = tc.lastWeekDayOfMonth(2014, 1, tc.WeekDay.Sunday); -n = tc.weekDayOnOrAfter(2014, 1, 14, tc.WeekDay.Monday); -n = tc.weekDayOnOrBefore(2014, 1, 14, tc.WeekDay.Monday); -n = tc.secondOfDay(13, 59, 59); -n = tc.weekOfMonth(2014, 1, 1); - -// DURATION - -var d: tc.Duration; -var d1: tc.Duration = tc.Duration.hours(24); -var d2: tc.Duration = tc.Duration.minutes(24); -var d3: tc.Duration = tc.Duration.seconds(24); -var d4: tc.Duration = tc.Duration.milliseconds(24); -var d5: tc.Duration = tc.hours(24); -var d6: tc.Duration = tc.minutes(24); -var d7: tc.Duration = tc.seconds(24); -var d8: tc.Duration = tc.milliseconds(24); -var d9: tc.Duration = new tc.Duration(24); -var d10: tc.Duration = new tc.Duration("00:01"); -var d11: tc.Duration = d6.clone(); -var d12: tc.Duration = new tc.Duration(4, tc.TimeUnit.Second); - -n = d7.wholeHours(); -n = d7.hours(); -n = d7.minutes(); -n = d7.minute(); -n = d7.seconds(); -n = d7.second(); -n = d7.milliseconds(); -n = d7.millisecond(); -s = d7.sign(); -b = d7.lessThan(d6); -b = d7.greaterThan(d6); -d = d7.min(d6); -d = d7.max(d6); -d = d7.multiply(3); -d = d7.divide(0.3); -d = d7.add(d6); -d = d7.sub(d6); -s = d7.toString(); - -// TIMEZONE - -var t: tc.TimeZone; -var k: tc.TimeZoneKind; - -t = tc.TimeZone.local(); -t = tc.TimeZone.utc(); -t = tc.TimeZone.zone(2); -t = tc.TimeZone.zone("+01:00"); -t = tc.local(); -t = tc.utc(); -t = tc.zone(2); -t = tc.zone("+01:00"); -t = tc.zone("Europe/Amsterdam", false); -s = t.name(); -k = t.kind(); -b = t.equals(t); -b = t.isUtc(); -b = t.dst(); -n = t.offsetForUtc(2014, 1, 1, 13, 0, 5, 123); -n = t.offsetForZone(2014, 1, 1, 13, 0, 5, 123); -n = t.offsetForUtcDate(new Date(2014, 1, 1, 13, 0, 5, 123), tc.DateFunctions.Get); -n = t.offsetForZoneDate(new Date(2014, 1, 1, 13, 0, 5, 123), tc.DateFunctions.GetUTC); -s = t.toString(); -s = tc.TimeZone.offsetToString(2); -n = tc.TimeZone.stringToOffset("+00:01"); - -// REALTIMESOURCE - -var date: Date = (new tc.RealTimeSource()).now(); - -// DATETIME - -var dt: tc.DateTime; - -var ts: tc.TimeSource = tc.DateTime.timeSource; - -dt = tc.DateTime.nowLocal(); -dt = tc.DateTime.nowUtc(); -dt = tc.DateTime.now(tc.TimeZone.local()); -dt = tc.nowLocal(); -dt = tc.nowUtc(); -dt = tc.now(tc.TimeZone.local()); -dt = new tc.DateTime(); -dt = new tc.DateTime("2014-01-01T13:05:01.123 UTC"); -dt = new tc.DateTime("2014-01-01T13:05:01.123", tc.TimeZone.utc()); -dt = new tc.DateTime(date, tc.DateFunctions.Get); -dt = new tc.DateTime(date, tc.DateFunctions.Get, tc.TimeZone.utc()); -dt = new tc.DateTime(2014, 1, 1, 13, 5, 1, 123); -dt = new tc.DateTime(2014, 1, 1, 13, 5, 1, 123, tc.TimeZone.utc()); -dt = new tc.DateTime(89949284); -dt = new tc.DateTime(89949284, tc.TimeZone.utc()); -dt = dt.clone(); -t = dt.zone(); -n = dt.offset(); -n = dt.year(); -n = dt.month(); -n = dt.day(); -n = dt.hour(); -n = dt.minute(); -n = dt.second(); -n = dt.weekNumber(); -n = dt.weekOfMonth(); -n = dt.secondOfDay(); -n = dt.dayOfYear(); -n = dt.millisecond(); -n = dt.unixUtcMillis(); -n = dt.utcYear(); -n = dt.utcMonth(); -n = dt.utcDay(); -n = dt.utcHour(); -n = dt.utcMinute(); -n = dt.utcSecond(); -n = dt.utcMillisecond(); -n = dt.utcWeekNumber(); -n = dt.utcWeekOfMonth(); -n = dt.utcSecondOfDay(); -n = dt.utcDayOfYear(); -s = dt.format("%Y-%m-%d"); -dt.convert(tc.TimeZone.local()); -dt = dt.toZone(tc.TimeZone.utc()); -date = dt.toDate(); -dt = dt.add(tc.Duration.seconds(2)); -dt = dt.add(2, tc.TimeUnit.Year); -dt = dt.add(2, tc.TimeUnit.Month); -dt = dt.add(2, tc.TimeUnit.Week); -dt = dt.add(2, tc.TimeUnit.Day); -dt = dt.add(2, tc.TimeUnit.Hour); -dt = dt.add(2, tc.TimeUnit.Minute); -dt = dt.add(2, tc.TimeUnit.Second); -dt = dt.addLocal(2, tc.TimeUnit.Second); -dt = dt.sub(tc.Duration.seconds(2)); -dt = dt.sub(2, tc.TimeUnit.Year); -dt = dt.sub(2, tc.TimeUnit.Month); -dt = dt.sub(2, tc.TimeUnit.Week); -dt = dt.sub(2, tc.TimeUnit.Day); -dt = dt.sub(2, tc.TimeUnit.Hour); -dt = dt.sub(2, tc.TimeUnit.Minute); -dt = dt.sub(2, tc.TimeUnit.Second); -dt = dt.subLocal(2, tc.TimeUnit.Second); -d = dt.diff(new tc.DateTime(9289234, tc.TimeZone.local())); -b = dt.lessThan(new tc.DateTime(9289234, tc.TimeZone.local())); -b = dt.lessEqual(new tc.DateTime(9289234, tc.TimeZone.local())); -b = dt.greaterThan(new tc.DateTime(9289234, tc.TimeZone.local())); -b = dt.greaterEqual(new tc.DateTime(9289234, tc.TimeZone.local())); -dt = dt.min(new tc.DateTime(9289234, tc.TimeZone.local())); -dt = dt.max(new tc.DateTime(9289234, tc.TimeZone.local())); -s = dt.toIsoString(); -s = dt.toString(); -s = dt.toUtcString(); -dt = dt.startOfDay(); - -var wd: tc.WeekDay; -wd = dt.weekDay(); -wd = dt.utcWeekDay(); - -// PERIOD - -s = tc.periodDstToString(tc.PeriodDst.RegularIntervals); -s = tc.periodDstToString(tc.PeriodDst.RegularLocalTime); - -var p: tc.Period; - -p = new tc.Period(tc.DateTime.nowLocal(), 1, tc.TimeUnit.Hour, tc.PeriodDst.RegularLocalTime); -dt = p.start(); -n = p.amount(); -var tu: tc.TimeUnit = p.unit(); -var pd: tc.PeriodDst = p.dst(); -dt = p.findFirst(tc.DateTime.nowLocal()); -dt = p.findNext(dt); -s = p.toIsoString(); -s = p.toString(); -b = p.isBoundary(dt); - - -// GLOBALS -d = tc.min(tc.Duration.seconds(2), tc.Duration.seconds(3)); -d = tc.max(tc.Duration.seconds(2), tc.Duration.seconds(3)); - -dt = tc.min(new tc.DateTime(2), new tc.DateTime(3)); -dt = tc.max(new tc.DateTime(2), new tc.DateTime(3)); - - - - - - - - - - - - - - - - - - - - - - diff --git a/timezonecomplete/timezonecomplete-1.10.0.d.ts b/timezonecomplete/timezonecomplete-1.10.0.d.ts deleted file mode 100644 index e34374003..000000000 --- a/timezonecomplete/timezonecomplete-1.10.0.d.ts +++ /dev/null @@ -1,1296 +0,0 @@ -// Type definitions for timezonecomplete 1.10.0 -// Project: https://github.com/SpiritIT/timezonecomplete -// Definitions by: Rogier Schouten -// Definitions: https://github.com/borisyankov/DefinitelyTyped -// Generated by dts-bundle v0.2.0 - -declare module 'timezonecomplete-1.10.0' { - import basics = require("__timezonecomplete/basics"); - export import TimeUnit = basics.TimeUnit; - export import WeekDay = basics.WeekDay; - export import timeUnitToMilliseconds = basics.timeUnitToMilliseconds; - export import isLeapYear = basics.isLeapYear; - export import daysInMonth = basics.daysInMonth; - export import daysInYear = basics.daysInYear; - export import firstWeekDayOfMonth = basics.firstWeekDayOfMonth; - export import lastWeekDayOfMonth = basics.lastWeekDayOfMonth; - export import weekDayOnOrAfter = basics.weekDayOnOrAfter; - export import weekDayOnOrBefore = basics.weekDayOnOrBefore; - export import weekNumber = basics.weekNumber; - export import weekOfMonth = basics.weekOfMonth; - export import dayOfYear = basics.dayOfYear; - export import secondOfDay = basics.secondOfDay; - import datetime = require("__timezonecomplete/datetime"); - export import DateTime = datetime.DateTime; - export import now = datetime.now; - export import nowLocal = datetime.nowLocal; - export import nowUtc = datetime.nowUtc; - import duration = require("__timezonecomplete/duration"); - export import Duration = duration.Duration; - export import hours = duration.hours; - export import minutes = duration.minutes; - export import seconds = duration.seconds; - export import milliseconds = duration.milliseconds; - import javascript = require("__timezonecomplete/javascript"); - export import DateFunctions = javascript.DateFunctions; - import period = require("__timezonecomplete/period"); - export import Period = period.Period; - export import PeriodDst = period.PeriodDst; - export import periodDstToString = period.periodDstToString; - import timesource = require("__timezonecomplete/timesource"); - export import TimeSource = timesource.TimeSource; - export import RealTimeSource = timesource.RealTimeSource; - import timezone = require("__timezonecomplete/timezone"); - export import NormalizeOption = timezone.NormalizeOption; - export import TimeZoneKind = timezone.TimeZoneKind; - export import TimeZone = timezone.TimeZone; - export import local = timezone.local; - export import utc = timezone.utc; - export import zone = timezone.zone; - import globals = require("__timezonecomplete/globals"); - export import min = globals.min; - export import max = globals.max; -} - -declare module '__timezonecomplete/basics' { - import javascript = require("__timezonecomplete/javascript"); - /** - * Day-of-week. Note the enum values correspond to JavaScript day-of-week: - * Sunday = 0, Monday = 1 etc - */ - export enum WeekDay { - Sunday = 0, - Monday = 1, - Tuesday = 2, - Wednesday = 3, - Thursday = 4, - Friday = 5, - Saturday = 6, - } - /** - * Time units - */ - export enum TimeUnit { - Second = 0, - Minute = 1, - Hour = 2, - Day = 3, - Week = 4, - Month = 5, - Year = 6, - } - /** - * Approximate number of milliseconds for a time unit. - * A day is assumed to have 24 hours, a month is assumed to equal 30 days - * and a year is set to 365 days. - * - * @param unit Time unit e.g. TimeUnit.Month - * @returns The number of milliseconds. - */ - export function timeUnitToMilliseconds(unit: TimeUnit): number; - /** - * @return True iff the given year is a leap year. - */ - export function isLeapYear(year: number): boolean; - /** - * The days in a given year - */ - export function daysInYear(year: number): number; - /** - * @param year The full year - * @param month The month 1-12 - * @return The number of days in the given month - */ - export function daysInMonth(year: number, month: number): number; - /** - * Returns the day of the year of the given date [0..365]. January first is 0. - * - * @param year The year e.g. 1986 - * @param month Month 1-12 - * @param day Day of month 1-31 - */ - export function dayOfYear(year: number, month: number, day: number): number; - /** - * Returns the last instance of the given weekday in the given month - * - * @param year The year - * @param month the month 1-12 - * @param weekDay the desired week day - * - * @return the last occurrence of the week day in the month - */ - export function lastWeekDayOfMonth(year: number, month: number, weekDay: WeekDay): number; - /** - * Returns the first instance of the given weekday in the given month - * - * @param year The year - * @param month the month 1-12 - * @param weekDay the desired week day - * - * @return the first occurrence of the week day in the month - */ - export function firstWeekDayOfMonth(year: number, month: number, weekDay: WeekDay): number; - /** - * Returns the day-of-month that is on the given weekday and which is >= the given day. - * Throws if the month has no such day. - */ - export function weekDayOnOrAfter(year: number, month: number, day: number, weekDay: WeekDay): number; - /** - * Returns the day-of-month that is on the given weekday and which is <= the given day. - * Throws if the month has no such day. - */ - export function weekDayOnOrBefore(year: number, month: number, day: number, weekDay: WeekDay): number; - /** - * The week of this month. There is no official standard for this, - * but we assume the same rules for the weekNumber (i.e. - * week 1 is the week that has the 4th day of the month in it) - * - * @param year The year - * @param month The month [1-12] - * @param day The day [1-31] - * @return Week number [1-5] - */ - export function weekOfMonth(year: number, month: number, day: number): number; - /** - * The ISO 8601 week number for the given date. Week 1 is the week - * that has January 4th in it, and it starts on Monday. - * See https://en.wikipedia.org/wiki/ISO_week_date - * - * @param year Year e.g. 1988 - * @param month Month 1-12 - * @param day Day of month 1-31 - * - * @return Week number 1-53 - */ - export function weekNumber(year: number, month: number, day: number): number; - /** - * Convert a unix milli timestamp into a TimeT structure. - * This does NOT take leap seconds into account. - */ - export function unixToTimeNoLeapSecs(unixMillis: number): TimeStruct; - /** - * Convert a year, month, day etc into a unix milli timestamp. - * This does NOT take leap seconds into account. - * - * @param year Year e.g. 1970 - * @param month Month 1-12 - * @param day Day 1-31 - * @param hour Hour 0-23 - * @param minute Minute 0-59 - * @param second Second 0-59 (no leap seconds) - * @param milli Millisecond 0-999 - */ - export function timeToUnixNoLeapSecs(year?: number, month?: number, day?: number, hour?: number, minute?: number, second?: number, milli?: number): number; - /** - * Convert a TimeT structure into a unix milli timestamp. - * This does NOT take leap seconds into account. - */ - export function timeToUnixNoLeapSecs(tm: TimeStruct): number; - /** - * Return the day-of-week. - * This does NOT take leap seconds into account. - */ - export function weekDayNoLeapSecs(unixMillis: number): WeekDay; - /** - * N-th second in the day, counting from 0 - */ - export function secondOfDay(hour: number, minute: number, second: number): number; - /** - * Basic representation of a date and time - */ - export class TimeStruct { - /** - * Year, 1970-... - */ - year: number; - /** - * Month 1-12 - */ - month: number; - /** - * Day of month, 1-31 - */ - day: number; - /** - * Hour 0-23 - */ - hour: number; - /** - * Minute 0-59 - */ - minute: number; - /** - * Seconds, 0-59 - */ - second: number; - /** - * Milliseconds 0-999 - */ - milli: number; - /** - * Create a TimeStruct from a number of unix milliseconds - */ - static fromUnix(unixMillis: number): TimeStruct; - /** - * Create a TimeStruct from a JavaScript date - * - * @param d The date - * @param df Which functions to take (getX() or getUTCX()) - */ - static fromDate(d: Date, df: javascript.DateFunctions): TimeStruct; - /** - * Returns a TimeStruct from an ISO 8601 string WITHOUT time zone - */ - static fromString(s: string): TimeStruct; - /** - * Constructor - * - * @param year Year e.g. 1970 - * @param month Month 1-12 - * @param day Day 1-31 - * @param hour Hour 0-23 - * @param minute Minute 0-59 - * @param second Second 0-59 (no leap seconds) - * @param milli Millisecond 0-999 - */ - constructor(/** - * Year, 1970-... - */ - year?: number, /** - * Month 1-12 - */ - month?: number, /** - * Day of month, 1-31 - */ - day?: number, /** - * Hour 0-23 - */ - hour?: number, /** - * Minute 0-59 - */ - minute?: number, /** - * Seconds, 0-59 - */ - second?: number, /** - * Milliseconds 0-999 - */ - milli?: number); - /** - * Validate a TimeStruct, returns false if invalid. - */ - validate(): boolean; - /** - * The day-of-year 0-365 - */ - yearDay(): number; - /** - * Returns this time as a unix millisecond timestamp - * Does NOT take leap seconds into account. - */ - toUnixNoLeapSecs(): number; - /** - * Deep equals - */ - equals(other: TimeStruct): boolean; - /** - * < operator - */ - lessThan(other: TimeStruct): boolean; - clone(): TimeStruct; - valueOf(): number; - /** - * ISO 8601 string YYYY-MM-DDThh:mm:ss.nnn - */ - toString(): string; - inspect(): string; - } -} - -declare module '__timezonecomplete/datetime' { - import basics = require("__timezonecomplete/basics"); - import duration = require("__timezonecomplete/duration"); - import timesource = require("__timezonecomplete/timesource"); - import javascript = require("__timezonecomplete/javascript"); - import timezone = require("__timezonecomplete/timezone"); - /** - * Current date+time in local time - */ - export function nowLocal(): DateTime; - /** - * Current date+time in UTC time - */ - export function nowUtc(): DateTime; - /** - * Current date+time in the given time zone - * @param timeZone The desired time zone (optional, defaults to UTC). - */ - export function now(timeZone?: timezone.TimeZone): DateTime; - /** - * DateTime class which is time zone-aware - * and which can be mocked for testing purposes. - */ - export class DateTime { - /** - * Actual time source in use. Setting this property allows to - * fake time in tests. DateTime.nowLocal() and DateTime.nowUtc() - * use this property for obtaining the current time. - */ - static timeSource: timesource.TimeSource; - /** - * Current date+time in local time - */ - static nowLocal(): DateTime; - /** - * Current date+time in UTC time - */ - static nowUtc(): DateTime; - /** - * Current date+time in the given time zone - * @param timeZone The desired time zone (optional, defaults to UTC). - */ - static now(timeZone?: timezone.TimeZone): DateTime; - /** - * Constructor. Creates current time in local timezone. - */ - constructor(); - /** - * Constructor - * Non-existing local times are normalized by rounding up to the next DST offset. - * - * @param isoString String in ISO 8601 format. Instead of ISO time zone, - * it may include a space and then and IANA time zone. - * e.g. "2007-04-05T12:30:40.500" (no time zone, naive date) - * e.g. "2007-04-05T12:30:40.500+01:00" (UTC offset without daylight saving time) - * or "2007-04-05T12:30:40.500Z" (UTC) - * or "2007-04-05T12:30:40.500 Europe/Amsterdam" (IANA time zone, with daylight saving time if applicable) - * @param timeZone if given, the date in the string is assumed to be in this time zone. - * Note that it is NOT CONVERTED to the time zone. Useful - * for strings without a time zone - */ - constructor(isoString: string, timeZone?: timezone.TimeZone); - /** - * Constructor. You provide a date, then you say whether to take the - * date.getYear()/getXxx methods or the date.getUTCYear()/date.getUTCXxx methods, - * and then you state which time zone that date is in. - * Non-existing local times are normalized by rounding up to the next DST offset. - * Note that the Date class has bugs and inconsistencies when constructing them with times around - * DST changes. - * - * @param date A date object. - * @param getters Specifies which set of Date getters contains the date in the given time zone: the - * Date.getXxx() methods or the Date.getUTCXxx() methods. - * @param timeZone The time zone that the given date is assumed to be in (may be null for unaware dates) - */ - constructor(date: Date, getFuncs: javascript.DateFunctions, timeZone?: timezone.TimeZone); - /** - * Constructor. Note that unlike JavaScript dates we require fields to be in normal ranges. - * Use the add(duration) or sub(duration) for arithmetic. - * @param year The full year (e.g. 2014) - * @param month The month [1-12] (note this deviates from JavaScript Date) - * @param day The day of the month [1-31] - * @param hour The hour of the day [0-24) - * @param minute The minute of the hour [0-59] - * @param second The second of the minute [0-59] - * @param millisecond The millisecond of the second [0-999] - * @param timeZone The time zone, or null (for unaware dates) - */ - constructor(year: number, month: number, day: number, hour?: number, minute?: number, second?: number, millisecond?: number, timeZone?: timezone.TimeZone); - /** - * Constructor - * @param unixTimestamp milliseconds since 1970-01-01T00:00:00.000 - * @param timeZone the time zone that the timestamp is assumed to be in (usually UTC). - */ - constructor(unixTimestamp: number, timeZone?: timezone.TimeZone); - /** - * @return a copy of this object - */ - clone(): DateTime; - /** - * @return The time zone that the date is in. May be null for unaware dates. - */ - zone(): timezone.TimeZone; - /** - * Zone name abbreviation at this time - * @param dstDependent (default true) set to false for a DST-agnostic abbreviation - * @return The abbreviation - */ - zoneAbbreviation(dstDependent?: boolean): string; - /** - * @return the offset w.r.t. UTC in minutes. Returns 0 for unaware dates and for UTC dates. - */ - offset(): number; - /** - * @return The full year e.g. 2014 - */ - year(): number; - /** - * @return The month 1-12 (note this deviates from JavaScript Date) - */ - month(): number; - /** - * @return The day of the month 1-31 - */ - day(): number; - /** - * @return The hour 0-23 - */ - hour(): number; - /** - * @return the minutes 0-59 - */ - minute(): number; - /** - * @return the seconds 0-59 - */ - second(): number; - /** - * @return the milliseconds 0-999 - */ - millisecond(): number; - /** - * @return the day-of-week (the enum values correspond to JavaScript - * week day numbers) - */ - weekDay(): basics.WeekDay; - /** - * Returns the day number within the year: Jan 1st has number 0, - * Jan 2nd has number 1 etc. - * - * @return the day-of-year [0-366] - */ - dayOfYear(): number; - /** - * The ISO 8601 week number. Week 1 is the week - * that has January 4th in it, and it starts on Monday. - * See https://en.wikipedia.org/wiki/ISO_week_date - * - * @return Week number [1-53] - */ - weekNumber(): number; - /** - * The week of this month. There is no official standard for this, - * but we assume the same rules for the weekNumber (i.e. - * week 1 is the week that has the 4th day of the month in it) - * - * @return Week number [1-5] - */ - weekOfMonth(): number; - /** - * Returns the number of seconds that have passed on the current day - * Does not consider leap seconds - * - * @return seconds [0-86399] - */ - secondOfDay(): number; - /** - * @return Milliseconds since 1970-01-01T00:00:00.000Z - */ - unixUtcMillis(): number; - /** - * @return The full year e.g. 2014 - */ - utcYear(): number; - /** - * @return The UTC month 1-12 (note this deviates from JavaScript Date) - */ - utcMonth(): number; - /** - * @return The UTC day of the month 1-31 - */ - utcDay(): number; - /** - * @return The UTC hour 0-23 - */ - utcHour(): number; - /** - * @return The UTC minutes 0-59 - */ - utcMinute(): number; - /** - * @return The UTC seconds 0-59 - */ - utcSecond(): number; - /** - * Returns the UTC day number within the year: Jan 1st has number 0, - * Jan 2nd has number 1 etc. - * - * @return the day-of-year [0-366] - */ - utcDayOfYear(): number; - /** - * @return The UTC milliseconds 0-999 - */ - utcMillisecond(): number; - /** - * @return the UTC day-of-week (the enum values correspond to JavaScript - * week day numbers) - */ - utcWeekDay(): basics.WeekDay; - /** - * The ISO 8601 UTC week number. Week 1 is the week - * that has January 4th in it, and it starts on Monday. - * See https://en.wikipedia.org/wiki/ISO_week_date - * - * @return Week number [1-53] - */ - utcWeekNumber(): number; - /** - * The week of this month. There is no official standard for this, - * but we assume the same rules for the weekNumber (i.e. - * week 1 is the week that has the 4th day of the month in it) - * - * @return Week number [1-5] - */ - utcWeekOfMonth(): number; - /** - * Returns the number of seconds that have passed on the current day - * Does not consider leap seconds - * - * @return seconds [0-86399] - */ - utcSecondOfDay(): number; - /** - * Convert this date to the given time zone (in-place). - * Throws if this date does not have a time zone. - * @return this (for chaining) - */ - convert(zone?: timezone.TimeZone): DateTime; - /** - * Returns this date converted to the given time zone. - * Unaware dates can only be converted to unaware dates (clone) - * Converting an unaware date to an aware date throws an exception. Use the constructor - * if you really need to do that. - * - * @param zone The new time zone. This may be null to create unaware date. - * @return The converted date - */ - toZone(zone?: timezone.TimeZone): DateTime; - /** - * Convert to JavaScript date with the zone time in the getX() methods. - * Unless the timezone is local, the Date.getUTCX() methods will NOT be correct. - * This is because Date calculates getUTCX() from getX() applying local time zone. - */ - toDate(): Date; - /** - * Add a time duration relative to UTC. Note that this simply adds a number - * of milliseconds to UTC and converts back to zone(), - * There is not DST handling. - * @return this + duration - */ - add(duration: duration.Duration): DateTime; - /** - * Add an amount of time relative to UTC, as regularly as possible. - * - * Adding e.g. 1 hour will increment the utcHour() field, adding 1 month - * increments the utcMonth() field. - * Adding an amount of units leaves lower units intact. E.g. - * adding a month will leave the day() field untouched if possible. - * - * Note adding Months or Years will clamp the date to the end-of-month if - * the start date was at the end of a month, i.e. contrary to JavaScript - * Date#setUTCMonth() it will not overflow into the next month - * - * In case of DST changes, the utc time fields are still untouched but local - * time fields may shift. - */ - add(amount: number, unit: basics.TimeUnit): DateTime; - /** - * Add an amount of time to the zone time, as regularly as possible. - * - * Adding e.g. 1 hour will increment the hour() field of the zone - * date by one. In case of DST changes, the time fields may additionally - * increase by the DST offset, if a non-existing local time would - * be reached otherwise. - * - * Adding a unit of time will leave lower-unit fields intact, unless the result - * would be a non-existing time. Then an extra DST offset is added. - * - * Note adding Months or Years will clamp the date to the end-of-month if - * the start date was at the end of a month, i.e. contrary to JavaScript - * Date#setUTCMonth() it will not overflow into the next month - */ - addLocal(amount: number, unit: basics.TimeUnit): DateTime; - /** - * Same as add(-1*duration); - */ - sub(duration: duration.Duration): DateTime; - /** - * Same as add(-1*amount, unit); - */ - sub(amount: number, unit: basics.TimeUnit): DateTime; - /** - * Same as addLocal(-1*amount, unit); - */ - subLocal(amount: number, unit: basics.TimeUnit): DateTime; - /** - * Time difference between two DateTimes - * @return this - other - */ - diff(other: DateTime): duration.Duration; - /** - * Chops off the time part, yields the same date at 00:00:00.000 - * @return a new DateTime - */ - startOfDay(): DateTime; - /** - * @return True iff (this < other) - */ - lessThan(other: DateTime): boolean; - /** - * @return True iff (this <= other) - */ - lessEqual(other: DateTime): boolean; - /** - * @return True iff this and other represent the same time in UTC - */ - equals(other: DateTime): boolean; - /** - * @return True iff this and other represent the same time and - * have the same zone - */ - identical(other: DateTime): boolean; - /** - * @return True iff this > other - */ - greaterThan(other: DateTime): boolean; - /** - * @return True iff this >= other - */ - greaterEqual(other: DateTime): boolean; - /** - * @return The minimum of this and other - */ - min(other: DateTime): DateTime; - /** - * @return The maximum of this and other - */ - max(other: DateTime): DateTime; - /** - * Proper ISO 8601 format string with any IANA zone converted to ISO offset - * E.g. "2014-01-01T23:15:33+01:00" for Europe/Amsterdam - */ - toIsoString(): string; - /** - * Return a string representation of the DateTime according to the - * specified format. The format is implemented as the LDML standard - * (http://unicode.org/reports/tr35/tr35-dates.html#Date_Format_Patterns) - * - * @param formatString The format specification (e.g. "dd/MM/yyyy HH:mm:ss") - * @return The string representation of this DateTime - */ - format(formatString: string): string; - /** - * Modified ISO 8601 format string with IANA name if applicable. - * E.g. "2014-01-01T23:15:33.000 Europe/Amsterdam" - */ - toString(): string; - /** - * Used by util.inspect() - */ - inspect(): string; - /** - * The valueOf() method returns the primitive value of the specified object. - */ - valueOf(): any; - /** - * Modified ISO 8601 format string in UTC without time zone info - */ - toUtcString(): string; - } -} - -declare module '__timezonecomplete/duration' { - import basics = require("__timezonecomplete/basics"); - /** - * Construct a time duration - * @param n Number of hours (may be fractional or negative) - * @return A duration of n hours - */ - export function hours(n: number): Duration; - /** - * Construct a time duration - * @param n Number of minutes (may be fractional or negative) - * @return A duration of n minutes - */ - export function minutes(n: number): Duration; - /** - * Construct a time duration - * @param n Number of seconds (may be fractional or negative) - * @return A duration of n seconds - */ - export function seconds(n: number): Duration; - /** - * Construct a time duration - * @param n Number of milliseconds (may be fractional or negative) - * @return A duration of n milliseconds - */ - export function milliseconds(n: number): Duration; - /** - * Time duration. Create one e.g. like this: var d = Duration.hours(1). - * Note that time durations do not take leap seconds etc. into account: - * one hour is simply represented as 3600000 milliseconds. - */ - export class Duration { - /** - * Construct a time duration - * @param n Number of hours (may be fractional or negative) - * @return A duration of n hours - */ - static hours(n: number): Duration; - /** - * Construct a time duration - * @param n Number of minutes (may be fractional or negative) - * @return A duration of n minutes - */ - static minutes(n: number): Duration; - /** - * Construct a time duration - * @param n Number of seconds (may be fractional or negative) - * @return A duration of n seconds - */ - static seconds(n: number): Duration; - /** - * Construct a time duration - * @param n Number of milliseconds (may be fractional or negative) - * @return A duration of n milliseconds - */ - static milliseconds(n: number): Duration; - /** - * Construct a time duration of 0 - */ - constructor(); - /** - * Construct a time duration from a number of milliseconds - */ - constructor(milliseconds: number); - /** - * Construct a time duration from a string in format - * [-]h[:m[:s[.n]]] e.g. -01:00:30.501 - */ - constructor(input: string); - /** - * Construct a duration from an amount and a time unit. - * @param amount Number of units - * @param unit A time unit i.e. TimeUnit.Second, TimeUnit.Hour etc. - */ - constructor(amount: number, unit: basics.TimeUnit); - /** - * @return another instance of Duration with the same value. - */ - clone(): Duration; - /** - * The entire duration in milliseconds (negative or positive) - */ - milliseconds(): number; - /** - * The millisecond part of the duration (always positive) - * @return e.g. 400 for a -01:02:03.400 duration - */ - millisecond(): number; - /** - * The entire duration in seconds (negative or positive, fractional) - * @return e.g. 1.5 for a 1500 milliseconds duration - */ - seconds(): number; - /** - * The second part of the duration (always positive) - * @return e.g. 3 for a -01:02:03.400 duration - */ - second(): number; - /** - * The entire duration in minutes (negative or positive, fractional) - * @return e.g. 1.5 for a 90000 milliseconds duration - */ - minutes(): number; - /** - * The minute part of the duration (always positive) - * @return e.g. 2 for a -01:02:03.400 duration - */ - minute(): number; - /** - * The entire duration in hours (negative or positive, fractional) - * @return e.g. 1.5 for a 5400000 milliseconds duration - */ - hours(): number; - /** - * The hour part of the duration (always positive). - * Note that this part can exceed 23 hours, because for - * now, we do not have a days() function - * @return e.g. 25 for a -25:02:03.400 duration - */ - wholeHours(): number; - /** - * Sign - * @return "-" if the duration is negative - */ - sign(): string; - /** - * @return True iff (this < other) - */ - lessThan(other: Duration): boolean; - /** - * @return True iff (this <= other) - */ - lessEqual(other: Duration): boolean; - /** - * @return True iff this and other represent the same time duration - */ - equals(other: Duration): boolean; - /** - * @return True iff this > other - */ - greaterThan(other: Duration): boolean; - /** - * @return True iff this >= other - */ - greaterEqual(other: Duration): boolean; - /** - * @return The minimum (most negative) of this and other - */ - min(other: Duration): Duration; - /** - * @return The maximum (most positive) of this and other - */ - max(other: Duration): Duration; - /** - * Multiply with a fixed number. - * @return a new Duration of (this * value) - */ - multiply(value: number): Duration; - /** - * Divide by a fixed number. - * @return a new Duration of (this / value) - */ - divide(value: number): Duration; - /** - * Add a duration. - * @return a new Duration of (this + value) - */ - add(value: Duration): Duration; - /** - * Subtract a duration. - * @return a new Duration of (this - value) - */ - sub(value: Duration): Duration; - /** - * String in [-]hh:mm:ss.nnn notation. All fields are - * always present except the sign. - */ - toFullString(): string; - /** - * String in [-]hh[:mm[:ss[.nnn]]] notation. Fields are - * added as necessary - */ - toString(): string; - /** - * Used by util.inspect() - */ - inspect(): string; - /** - * The valueOf() method returns the primitive value of the specified object. - */ - valueOf(): any; - } -} - -declare module '__timezonecomplete/javascript' { - /** - * Indicates how a Date object should be interpreted. - * Either we can take getYear(), getMonth() etc for our field - * values, or we can take getUTCYear(), getUtcMonth() etc to do that. - */ - export enum DateFunctions { - /** - * Use the Date.getFullYear(), Date.getMonth(), ... functions. - */ - Get = 0, - /** - * Use the Date.getUTCFullYear(), Date.getUTCMonth(), ... functions. - */ - GetUTC = 1, - } -} - -declare module '__timezonecomplete/period' { - import basics = require("__timezonecomplete/basics"); - import datetime = require("__timezonecomplete/datetime"); - /** - * Specifies how the period should repeat across the day - * during DST changes. - */ - export enum PeriodDst { - /** - * Keep repeating in similar intervals measured in UTC, - * unaffected by Daylight Saving Time. - * E.g. a repetition of one hour will take one real hour - * every time, even in a time zone with DST. - * Leap seconds, leap days and month length - * differences will still make the intervals different. - */ - RegularIntervals = 0, - /** - * Ensure that the time at which the intervals occur stay - * at the same place in the day, local time. So e.g. - * a period of one day, starting at 8:05AM Europe/Amsterdam time - * will always start at 8:05 Europe/Amsterdam. This means that - * in UTC time, some intervals will be 25 hours and some - * 23 hours during DST changes. - * Another example: an hourly interval will be hourly in local time, - * skipping an hour in UTC for a DST backward change. - */ - RegularLocalTime = 1, - } - /** - * Convert a PeriodDst to a string: "regular intervals" or "regular local time" - */ - export function periodDstToString(p: PeriodDst): string; - /** - * Repeating time period: consists of a starting point and - * a time length. This class accounts for leap seconds and leap days. - */ - export class Period { - /** - * Constructor - * LIMITATION: if dst equals RegularLocalTime, and unit is Second, Minute or Hour, - * then the amount must be a factor of 24. So 120 seconds is allowed while 121 seconds is not. - * This is due to the enormous processing power required by these cases. They are not - * implemented and you will get an assert. - * - * @param start The start of the period. If the period is in Months or Years, and - * the day is 29 or 30 or 31, the results are maximised to end-of-month. - * @param amount The amount of units. - * @param unit The unit. - * @param dst Specifies how to handle Daylight Saving Time. Not relevant - * if the time zone of the start datetime does not have DST. - */ - constructor(start: datetime.DateTime, amount: number, unit: basics.TimeUnit, dst: PeriodDst); - /** - * The start date - */ - start(): datetime.DateTime; - /** - * The amount of units - */ - amount(): number; - /** - * The unit - */ - unit(): basics.TimeUnit; - /** - * The dst handling mode - */ - dst(): PeriodDst; - /** - * The first occurrence of the period greater than - * the given date. The given date need not be at a period boundary. - * Pre: the fromdate and startdate must either both have timezones or not - * @param fromDate: the date after which to return the next date - * @return the first date matching the period after fromDate, given - * in the same zone as the fromDate. - */ - findFirst(fromDate: datetime.DateTime): datetime.DateTime; - /** - * Returns the next timestamp in the period. The given timestamp must - * be at a period boundary, otherwise the answer is incorrect. - * This function has MUCH better performance than findFirst. - * Returns the datetime "count" times away from the given datetime. - * @param prev Boundary date. Must have a time zone (any time zone) iff the period start date has one. - * @param count Optional, must be >= 1 and whole. - * @return (prev + count * period), in the same timezone as prev. - */ - findNext(prev: datetime.DateTime, count?: number): datetime.DateTime; - /** - * Checks whether the given date is on a period boundary - * (expensive!) - */ - isBoundary(occurrence: datetime.DateTime): boolean; - /** - * Returns an ISO duration string e.g. - * 2014-01-01T12:00:00.000+01:00/P1H - * 2014-01-01T12:00:00.000+01:00/PT1M (one minute) - * 2014-01-01T12:00:00.000+01:00/P1M (one month) - */ - toIsoString(): string; - /** - * A string representation e.g. - * "10 years, starting at 2014-03-01T12:00:00 Europe/Amsterdam, keeping regular intervals". - */ - toString(): string; - /** - * Used by util.inspect() - */ - inspect(): string; - } -} - -declare module '__timezonecomplete/timesource' { - /** - * For testing purposes, we often need to manipulate what the current - * time is. This is an interface for a custom time source object - * so in tests you can use a custom time source. - */ - export interface TimeSource { - /** - * Return the current date+time as a javascript Date object - */ - now(): Date; - } - /** - * Default time source, returns actual time - */ - export class RealTimeSource implements TimeSource { - now(): Date; - } -} - -declare module '__timezonecomplete/timezone' { - import javascript = require("__timezonecomplete/javascript"); - /** - * The local time zone for a given date as per OS settings. Note that time zones are cached - * so you don't necessarily get a new object each time. - */ - export function local(): TimeZone; - /** - * Coordinated Universal Time zone. Note that time zones are cached - * so you don't necessarily get a new object each time. - */ - export function utc(): TimeZone; - /** - * @param offset offset w.r.t. UTC in minutes, e.g. 90 for +01:30. Note that time zones are cached - * so you don't necessarily get a new object each time. - * @returns a time zone with the given fixed offset - */ - export function zone(offset: number): TimeZone; - /** - * Time zone for an offset string or an IANA time zone string. Note that time zones are cached - * so you don't necessarily get a new object each time. - * @param s Empty string for no time zone (null is returned), - * "localtime" for local time, - * a TZ database time zone name (e.g. Europe/Amsterdam), - * or an offset string (either +01:30, +0130, +01, Z). For a full list of names, see: - * https://en.wikipedia.org/wiki/List_of_tz_database_time_zones - * @param dst Optional, default true: adhere to Daylight Saving Time if applicable. Note for - * "localtime", timezonecomplete will adhere to the computer settings, the DST flag - * does not have any effect. - */ - export function zone(name: string, dst?: boolean): TimeZone; - /** - * The type of time zone - */ - export enum TimeZoneKind { - /** - * Local time offset as determined by JavaScript Date class. - */ - Local = 0, - /** - * Fixed offset from UTC, without DST. - */ - Offset = 1, - /** - * IANA timezone managed through Olsen TZ database. Includes - * DST if applicable. - */ - Proper = 2, - } - /** - * Option for TimeZone#normalizeLocal() - */ - export enum NormalizeOption { - /** - * Normalize non-existing times by ADDING the DST offset - */ - Up = 0, - /** - * Normalize non-existing times by SUBTRACTING the DST offset - */ - Down = 1, - } - /** - * Time zone. The object is immutable because it is cached: - * requesting a time zone twice yields the very same object. - * Note that we use time zone offsets inverted w.r.t. JavaScript Date.getTimezoneOffset(), - * i.e. offset 90 means +01:30. - * - * Time zones come in three flavors: the local time zone, as calculated by JavaScript Date, - * a fixed offset ("+01:30") without DST, or a IANA timezone ("Europe/Amsterdam") with DST - * applied depending on the time zone rules. - */ - export class TimeZone { - /** - * The local time zone for a given date. Note that - * the time zone varies with the date: amsterdam time for - * 2014-01-01 is +01:00 and amsterdam time for 2014-07-01 is +02:00 - */ - static local(): TimeZone; - /** - * The UTC time zone. - */ - static utc(): TimeZone; - /** - * Time zone with a fixed offset - * @param offset offset w.r.t. UTC in minutes, e.g. 90 for +01:30 - */ - static zone(offset: number): TimeZone; - /** - * Time zone for an offset string or an IANA time zone string. Note that time zones are cached - * so you don't necessarily get a new object each time. - * @param s Empty string for no time zone (null is returned), - * "localtime" for local time, - * a TZ database time zone name (e.g. Europe/Amsterdam), - * or an offset string (either +01:30, +0130, +01, Z). For a full list of names, see: - * https://en.wikipedia.org/wiki/List_of_tz_database_time_zones - * @param dst Optional, default true: adhere to Daylight Saving Time if applicable. Note for - * "localtime", timezonecomplete will adhere to the computer settings, the DST flag - * does not have any effect. - */ - static zone(s: string, dst?: boolean): TimeZone; - /** - * Do not use this constructor, use the static - * TimeZone.zone() method instead. - * @param name NORMALIZED name, assumed to be correct - * @param dst Adhere to Daylight Saving Time if applicable, ignored for local time and fixed offsets - */ - constructor(name: string, dst?: boolean); - /** - * The time zone identifier. Can be an offset "-01:30" or an - * IANA time zone name "Europe/Amsterdam", or "localtime" for - * the local time zone. - */ - name(): string; - dst(): boolean; - /** - * The kind of time zone (Local/Offset/Proper) - */ - kind(): TimeZoneKind; - /** - * Equality operator. Maps zero offsets and different names for UTC onto - * each other. Other time zones are not mapped onto each other. - */ - equals(other: TimeZone): boolean; - /** - * Is this zone equivalent to UTC? - */ - isUtc(): boolean; - /** - * Does this zone have Daylight Saving Time at all? - */ - hasDst(): boolean; - /** - * Calculate timezone offset from a UTC time. - * - * @param year Full year - * @param month Month 1-12 (note this deviates from JavaScript date) - * @param day Day of month 1-31 - * @param hour Hour 0-23 - * @param minute Minute 0-59 - * @param second Second 0-59 - * @param millisecond Millisecond 0-999 - * - * @return the offset of this time zone with respect to UTC at the given time, in minutes. - */ - offsetForUtc(year: number, month: number, day: number, hour?: number, minute?: number, second?: number, millisecond?: number): number; - /** - * Calculate timezone offset from a zone-local time (NOT a UTC time). - * @param year local full year - * @param month local month 1-12 (note this deviates from JavaScript date) - * @param day local day of month 1-31 - * @param hour local hour 0-23 - * @param minute local minute 0-59 - * @param second local second 0-59 - * @param millisecond local millisecond 0-999 - * @return the offset of this time zone with respect to UTC at the given time, in minutes. - */ - offsetForZone(year: number, month: number, day: number, hour?: number, minute?: number, second?: number, millisecond?: number): number; - /** - * Note: will be removed in version 2.0.0 - * - * Convenience function, takes values from a Javascript Date - * Calls offsetForUtc() with the contents of the date - * - * @param date: the date - * @param funcs: the set of functions to use: get() or getUTC() - */ - offsetForUtcDate(date: Date, funcs: javascript.DateFunctions): number; - /** - * Note: will be removed in version 2.0.0 - * - * Convenience function, takes values from a Javascript Date - * Calls offsetForUtc() with the contents of the date - * - * @param date: the date - * @param funcs: the set of functions to use: get() or getUTC() - */ - offsetForZoneDate(date: Date, funcs: javascript.DateFunctions): number; - /** - * Zone abbreviation at given UTC timestamp e.g. CEST for Central European Summer Time. - * - * @param year Full year - * @param month Month 1-12 (note this deviates from JavaScript date) - * @param day Day of month 1-31 - * @param hour Hour 0-23 - * @param minute Minute 0-59 - * @param second Second 0-59 - * @param millisecond Millisecond 0-999 - * @param dstDependent (default true) set to false for a DST-agnostic abbreviation - * - * @return "local" for local timezone, the offset for an offset zone, or the abbreviation for a proper zone. - */ - abbreviationForUtc(year: number, month: number, day: number, hour?: number, minute?: number, second?: number, millisecond?: number, dstDependent?: boolean): string; - /** - * Normalizes non-existing local times by adding a forward offset change. - * During a forward standard offset change or DST offset change, some amount of - * local time is skipped. Therefore, this amount of local time does not exist. - * This function adds the amount of forward change to any non-existing time. After all, - * this is probably what the user meant. - * - * @param localUnixMillis Unix timestamp in zone time - * @param opt (optional) Round up or down? Default: up - * - * @returns Unix timestamp in zone time, normalized. - */ - normalizeZoneTime(localUnixMillis: number, opt?: NormalizeOption): number; - /** - * The time zone identifier (normalized). - * Either "localtime", IANA name, or "+hh:mm" offset. - */ - toString(): string; - /** - * Used by util.inspect() - */ - inspect(): string; - /** - * Convert an offset number into an offset string - * @param offset The offset in minutes from UTC e.g. 90 minutes - * @return the offset in ISO notation "+01:30" for +90 minutes - */ - static offsetToString(offset: number): string; - /** - * String to offset conversion. - * @param s Formats: "-01:00", "-0100", "-01", "Z" - * @return offset w.r.t. UTC in minutes - */ - static stringToOffset(s: string): number; - } -} - -declare module '__timezonecomplete/globals' { - import datetime = require("__timezonecomplete/datetime"); - import duration = require("__timezonecomplete/duration"); - /** - * Returns the minimum of two DateTimes - */ - export function min(d1: datetime.DateTime, d2: datetime.DateTime): datetime.DateTime; - /** - * Returns the minimum of two Durations - */ - export function min(d1: duration.Duration, d2: duration.Duration): duration.Duration; - /** - * Returns the maximum of two DateTimes - */ - export function max(d1: datetime.DateTime, d2: datetime.DateTime): datetime.DateTime; - /** - * Returns the maximum of two Durations - */ - export function max(d1: duration.Duration, d2: duration.Duration): duration.Duration; -} - diff --git a/timezonecomplete/timezonecomplete-1.2.0-tests.ts b/timezonecomplete/timezonecomplete-1.2.0-tests.ts deleted file mode 100644 index 3ed4db796..000000000 --- a/timezonecomplete/timezonecomplete-1.2.0-tests.ts +++ /dev/null @@ -1,169 +0,0 @@ -/// - -import tc = require("timezonecomplete-1.2.0"); - -var b: boolean = tc.isLeapYear(2014); -var n: number = tc.daysInMonth(2014, 10); -var s: string = tc.isoString(2014, 6, 30, 22, 10, 11, 230); - -// DURATION - -var d: tc.Duration; -var d1: tc.Duration = tc.Duration.hours(24); -var d2: tc.Duration = tc.Duration.minutes(24); -var d3: tc.Duration = tc.Duration.seconds(24); -var d4: tc.Duration = tc.Duration.milliseconds(24); -var d5: tc.Duration = new tc.Duration(24); -var d6: tc.Duration = new tc.Duration("00:01"); -var d7: tc.Duration = d6.clone(); - -n = d7.wholeHours(); -n = d7.hours(); -n = d7.minutes(); -n = d7.minute(); -n = d7.seconds(); -n = d7.second(); -n = d7.milliseconds(); -n = d7.millisecond(); -s = d7.sign(); -b = d7.lessThan(d6); -b = d7.greaterThan(d6); -d = d7.min(d6); -d = d7.max(d6); -d = d7.multiply(3); -d = d7.add(d6); -d = d7.sub(d6); -s = d7.toString(); - -// TIMEZONE - -var t: tc.TimeZone; -var k: tc.TimeZoneKind; - -t = tc.TimeZone.local(); -t = tc.TimeZone.utc(); -t = tc.TimeZone.zone(2); -t = tc.TimeZone.zone("+01:00"); -s = t.name(); -k = t.kind(); -b = t.equals(t); -b = t.isUtc(); -n = t.offsetForUtc(2014, 1, 1, 13, 0, 5, 123); -n = t.offsetForZone(2014, 1, 1, 13, 0, 5, 123); -n = t.offsetForUtcDate(new Date(2014, 1, 1, 13, 0, 5, 123), tc.DateFunctions.Get); -n = t.offsetForZoneDate(new Date(2014, 1, 1, 13, 0, 5, 123), tc.DateFunctions.GetUTC); -s = t.toString(); -s = tc.TimeZone.offsetToString(2); -n = tc.TimeZone.stringToOffset("+00:01"); - -// REALTIMESOURCE - -var date: Date = (new tc.RealTimeSource()).now(); - -// DATETIME - -var dt: tc.DateTime; - -var ts: tc.TimeSource = tc.DateTime.timeSource; - -dt = tc.DateTime.nowLocal(); -dt = tc.DateTime.nowUtc(); -dt = tc.DateTime.now(tc.TimeZone.local()); -dt = new tc.DateTime(); -dt = new tc.DateTime("2014-01-01T13:05:01.123 UTC"); -dt = new tc.DateTime("2014-01-01T13:05:01.123", tc.TimeZone.utc()); -dt = new tc.DateTime(date, tc.DateFunctions.Get); -dt = new tc.DateTime(date, tc.DateFunctions.Get, tc.TimeZone.utc()); -dt = new tc.DateTime(2014, 1, 1, 13, 5, 1, 123); -dt = new tc.DateTime(2014, 1, 1, 13, 5, 1, 123, tc.TimeZone.utc()); -dt = new tc.DateTime(89949284); -dt = new tc.DateTime(89949284, tc.TimeZone.utc()); -dt = dt.clone(); -t = dt.zone(); -n = dt.offset(); -n = dt.year(); -n = dt.month(); -n = dt.day(); -n = dt.hour(); -n = dt.minute(); -n = dt.second(); -n = dt.millisecond(); -n = dt.unixUtcMillis(); -n = dt.utcYear(); -n = dt.utcMonth(); -n = dt.utcDay(); -n = dt.utcHour(); -n = dt.utcMinute(); -n = dt.utcSecond(); -n = dt.utcMillisecond(); -dt.convert(tc.TimeZone.local()); -dt = dt.toZone(tc.TimeZone.utc()); -date = dt.toDate(); -dt = dt.add(tc.Duration.seconds(2)); -dt = dt.add(2, tc.TimeUnit.Year); -dt = dt.add(2, tc.TimeUnit.Month); -dt = dt.add(2, tc.TimeUnit.Week); -dt = dt.add(2, tc.TimeUnit.Day); -dt = dt.add(2, tc.TimeUnit.Hour); -dt = dt.add(2, tc.TimeUnit.Minute); -dt = dt.add(2, tc.TimeUnit.Second); -dt = dt.addLocal(2, tc.TimeUnit.Second); -dt = dt.sub(tc.Duration.seconds(2)); -dt = dt.sub(2, tc.TimeUnit.Year); -dt = dt.sub(2, tc.TimeUnit.Month); -dt = dt.sub(2, tc.TimeUnit.Week); -dt = dt.sub(2, tc.TimeUnit.Day); -dt = dt.sub(2, tc.TimeUnit.Hour); -dt = dt.sub(2, tc.TimeUnit.Minute); -dt = dt.sub(2, tc.TimeUnit.Second); -dt = dt.subLocal(2, tc.TimeUnit.Second); -d = dt.diff(new tc.DateTime(9289234, tc.TimeZone.local())); -b = dt.lessThan(new tc.DateTime(9289234, tc.TimeZone.local())); -b = dt.lessEqual(new tc.DateTime(9289234, tc.TimeZone.local())); -b = dt.greaterThan(new tc.DateTime(9289234, tc.TimeZone.local())); -b = dt.greaterEqual(new tc.DateTime(9289234, tc.TimeZone.local())); -s = dt.toIsoString(); -s = dt.toString(); -s = dt.toUtcString(); - -// PERIOD - -s = tc.periodDstToString(tc.PeriodDst.RegularIntervals); -s = tc.periodDstToString(tc.PeriodDst.RegularLocalTime); - -var p: tc.Period; - -p = new tc.Period(tc.DateTime.nowLocal(), 1, tc.TimeUnit.Hour, tc.PeriodDst.RegularLocalTime); -dt = p.start(); -n = p.amount(); -var tu: tc.TimeUnit = p.unit(); -var pd: tc.PeriodDst = p.dst(); -dt = p.findFirst(tc.DateTime.nowLocal()); -dt = p.findNext(dt); -s = p.toIsoString(); -s = p.toString(); - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/timezonecomplete/timezonecomplete-1.2.0.d.ts b/timezonecomplete/timezonecomplete-1.2.0.d.ts deleted file mode 100644 index 1a39be00e..000000000 --- a/timezonecomplete/timezonecomplete-1.2.0.d.ts +++ /dev/null @@ -1,681 +0,0 @@ -// Type definitions for timezonecomplete -// Project: https://github.com/SpiritIT/timezonecomplete -// Definitions by: Rogier Schouten -// Definitions: https://github.com/borisyankov/DefinitelyTyped -// Generated by dts-bundle 0.1.1 - -declare module 'timezonecomplete-1.2.0' { - /** - * @return True iff the given year is a leap year. - */ - export function isLeapYear(year: number): boolean; - /** - * @param year The full year - * @param month The month 1-12 - * @return The number of days in the given month - */ - export function daysInMonth(year: number, month: number): number; - /** - * Returns an ISO time string. Note that months are 1-12. - */ - export function isoString(year: number, month: number, day: number, hour: number, minute: number, second: number, millisecond: number): string; - /** - * Time units - */ - export enum TimeUnit { - Second = 0, - Minute = 1, - Hour = 2, - Day = 3, - Week = 4, - Month = 5, - Year = 6, - } - /** - * Time duration. Create one e.g. like this: var d = Duration.hours(1). - * Note that time durations do not take leap seconds etc. into account: - * one hour is simply represented as 3600000 milliseconds. - */ - export class Duration { - /** - * Positive number of milliseconds - * Stored positive because otherwise we constantly have to choose - * between Math.floor() and Math.ceil() - */ - /** - * Sign: 1 or -1 - */ - /** - * Construct a time duration - * @param n Number of hours - * @return A duration of n hours - */ - static hours(n: number): Duration; - /** - * Construct a time duration - * @param n Number of minutes - * @return A duration of n minutes - */ - static minutes(n: number): Duration; - /** - * Construct a time duration - * @param n Number of seconds - * @return A duration of n seconds - */ - static seconds(n: number): Duration; - /** - * Construct a time duration - * @param n Number of milliseconds - * @return A duration of n milliseconds - */ - static milliseconds(n: number): Duration; - /** - * Construct a time duration of 0 - */ - constructor(); - /** - * Construct a time duration from a number of milliseconds - */ - constructor(milliseconds: number); - /** - * Construct a time duration from a string in format - * [-]h[:m[:s[.n]]] e.g. -01:00:30.501 - */ - constructor(input: string); - /** - * @return another instance of Duration with the same value. - */ - clone(): Duration; - /** - * The entire duration in milliseconds (negative or positive) - */ - milliseconds(): number; - /** - * The millisecond part of the duration (always positive) - * @return e.g. 400 for a -01:02:03.400 duration - */ - millisecond(): number; - /** - * The entire duration in seconds (negative or positive, fractional) - * @return e.g. 1.5 for a 1500 milliseconds duration - */ - seconds(): number; - /** - * The second part of the duration (always positive) - * @return e.g. 3 for a -01:02:03.400 duration - */ - second(): number; - /** - * The entire duration in minutes (negative or positive, fractional) - * @return e.g. 1.5 for a 90000 milliseconds duration - */ - minutes(): number; - /** - * The minute part of the duration (always positive) - * @return e.g. 2 for a -01:02:03.400 duration - */ - minute(): number; - /** - * The entire duration in hours (negative or positive, fractional) - * @return e.g. 1.5 for a 5400000 milliseconds duration - */ - hours(): number; - /** - * The hour part of the duration (always positive). - * Note that this part can exceed 23 hours, because for - * now, we do not have a days() function - * @return e.g. 25 for a -25:02:03.400 duration - */ - wholeHours(): number; - /** - * Sign - * @return "-" if the duration is negative - */ - sign(): string; - /** - * @return True iff (this < other) - */ - lessThan(other: Duration): boolean; - /** - * @return True iff this and other represent the same time duration - */ - equals(other: Duration): boolean; - /** - * @return True iff this > other - */ - greaterThan(other: Duration): boolean; - /** - * @return The minimum (most negative) of this and other - */ - min(other: Duration): Duration; - /** - * @return The maximum (most positive) of this and other - */ - max(other: Duration): Duration; - /** - * @return a new Duration of (this * value) - */ - multiply(value: number): Duration; - /** - * Add a duration. - * @return a new Duration of (this + value) - */ - add(value: Duration): Duration; - /** - * Subtract a duration. - * @return a new Duration of (this - value) - */ - sub(value: Duration): Duration; - /** - * String in [-]hh:mm:ss.nnn notation. All fields are - * always present except the sign. - */ - toFullString(): string; - /** - * String in [-]hh[:mm[:ss[.nnn]]] notation. Fields are - * added as necessary - */ - toString(): string; - } - /** - * The type of time zone - */ - export enum TimeZoneKind { - /** - * Local time offset as determined by JavaScript Date class. - */ - Local = 0, - /** - * Fixed offset from UTC, without DST. - */ - Offset = 1, - /** - * IANA timezone managed through Olsen TZ database. Includes - * DST if applicable. - */ - Proper = 2, - } - /** - * Time zone. The object is immutable because it is cached: - * requesting a time zone twice yields the very same object. - * Note that we use time zone offsets inverted w.r.t. JavaScript Date.getTimezoneOffset(), - * i.e. offset 90 means +01:30. - * - * Time zones come in three flavors: the local time zone, as calculated by JavaScript Date, - * a fixed offset ("+01:30") without DST, or a IANA timezone ("Europe/Amsterdam") with DST - * applied depending on the time zone rules. - */ - export class TimeZone { - /** - * The local time zone for a given date. Note that - * the time zone varies with the date: amsterdam time for - * 2014-01-01 is +01:00 and amsterdam time for 2014-07-01 is +02:00 - */ - static local(): TimeZone; - /** - * The UTC time zone. - */ - static utc(): TimeZone; - /** - * Returns a time zone object from the cache. If it does not exist, it is created. - * @return The time zone with the given offset w.r.t. UTC in minutes, e.g. 90 for +01:30 - */ - static zone(offset: number): TimeZone; - /** - * Returns a time zone object from the cache. If it does not exist, it is created. - * @param s: Empty string for local time, a TZ database time zone name (e.g. Europe/Amsterdam) - * or an offset string (either +01:30, +0130, +01, Z). For a full list of names, see: - * https://en.wikipedia.org/wiki/List_of_tz_database_time_zones - */ - static zone(s: string): TimeZone; - /** - * The time zone identifier. Can be an offset "-01:30" or an - * IANA time zone name "Europe/Amsterdam", or "localtime" for - * the local time zone. - */ - name(): string; - /** - * The kind of time zone (Local/Offset/Proper) - */ - kind(): TimeZoneKind; - /** - * Equality operator. Maps zero offsets and different names for UTC onto - * each other. Other time zones are not mapped onto each other. - */ - equals(other: TimeZone): boolean; - /** - * Is this zone equivalent to UTC? - */ - isUtc(): boolean; - /** - * Calculate timezone offset from a UTC time. - * @param year local full year - * @param month local month 1-12 (note this deviates from JavaScript date) - * @param day local day of month 1-31 - * @param hour local hour 0-23 - * @param minute local minute 0-59 - * @param second local second 0-59 - * @param millisecond local millisecond 0-999 - * @return the offset of this time zone with respect to UTC at the given time. - */ - offsetForUtc(year: number, month: number, day: number, hour?: number, minute?: number, second?: number, millisecond?: number): number; - /** - * Calculate timezone offset from a zone-local time (NOT a UTC time). - * @param year local full year - * @param month local month 1-12 (note this deviates from JavaScript date) - * @param day local day of month 1-31 - * @param hour local hour 0-23 - * @param minute local minute 0-59 - * @param second local second 0-59 - * @param millisecond local millisecond 0-999 - * @return the offset of this time zone with respect to UTC at the given time. - */ - offsetForZone(year: number, month: number, day: number, hour?: number, minute?: number, second?: number, millisecond?: number): number; - /** - * Convenience function, takes values from a Javascript Date - * Calls offsetForUtc() with the contents of the date - * @param date: the date - * @param funcs: the set of functions to use: get() or getUTC() - */ - offsetForUtcDate(date: Date, funcs: DateFunctions): number; - /** - * Convenience function, takes values from a Javascript Date - * Calls offsetForUtc() with the contents of the date - * @param date: the date - * @param funcs: the set of functions to use: get() or getUTC() - */ - offsetForZoneDate(date: Date, funcs: DateFunctions): number; - /** - * The time zone identifier (normalized). - * Either "localtime", IANA name, or "+hh:mm" offset. - */ - toString(): string; - /** - * Convert an offset number into an offset string - * @param offset The offset in minutes from UTC e.g. 90 minutes - * @return the offset in ISO notation "+01:30" for +90 minutes - */ - static offsetToString(offset: number): string; - /** - * String to offset conversion. - * @param s Formats: "-01:00", "-0100", "-01", "Z" - * @return offset w.r.t. UTC in minutes - */ - static stringToOffset(s: string): number; - } - /** - * For testing purposes, we often need to manipulate what the current - * time is. This is an interface for a custom time source object - * so in tests you can use a custom time source. - */ - export interface TimeSource { - /** - * Return the current date+time as a javascript Date object - */ - now(): Date; - } - /** - * Default time source, returns actual time - */ - export class RealTimeSource implements TimeSource { - now(): Date; - } - /** - * Indicates how a Date object should be interpreted. - * Either we can take getYear(), getMonth() etc for our field - * values, or we can take getUTCYear() etc to do that. - */ - export enum DateFunctions { - /** - * Use the Date.getFullYear(), Date.getMonth(), ... functions. - */ - Get = 0, - /** - * Use the Date.getUTCFullYear(), Date.getUTCMonth(), ... functions. - */ - GetUTC = 1, - } - /** - * Our very own DateTime class which is time zone-aware - * and which can be mocked for testing purposes - */ - export class DateTime { - /** - * Actual time source in use. Setting this property allows to - * fake time in tests. DateTime.nowLocal() and DateTime.nowUtc() - * use this property for obtaining the current time. - */ - static timeSource: TimeSource; - /** - * Current date+time in local time (derived from DateTime.timeSource.now()). - */ - static nowLocal(): DateTime; - /** - * Current date+time in UTC time (derived from DateTime.timeSource.now()). - */ - static nowUtc(): DateTime; - /** - * Current date+time in the given time zone (derived from DateTime.timeSource.now()). - * @param timeZone The desired time zone. - */ - static now(timeZone: TimeZone): DateTime; - /** - * Constructor. Creates current time in local timezone. - */ - constructor(); - /** - * Constructor - * @param isoString String in ISO 8601 format. Instead of ISO time zone, - * it may include a space and then and IANA time zone. - * e.g. "2007-04-05T12:30:40.500" (no time zone, naive date) - * e.g. "2007-04-05T12:30:40.500+01:00" (UTC offset without daylight saving time) - * or "2007-04-05T12:30:40.500Z" (UTC) - * or "2007-04-05T12:30:40.500 Europe/Amsterdam" (IANA time zone, with daylight saving time if applicable) - * @param timeZone if given, the date in the string is assumed to be in this time zone. - * Note that it is NOT CONVERTED to the time zone. Useful - * for strings without a time zone - */ - constructor(isoString: string, timeZone?: TimeZone); - /** - * Constructor. You provide a date, then you say whether to take the - * date.getYear()/getXxx methods or the date.getUTCYear()/date.getUTCXxx methods, - * and then you state which time zone that date is in. - * - * @param date A date object. - * @param getters Specifies which set of Date getters contains the date in the given time zone: the - * Date.getXxx() methods or the Date.getUTCXxx() methods. - * @param timeZone The time zone that the given date is assumed to be in (may be null for unaware dates) - */ - constructor(date: Date, getFuncs: DateFunctions, timeZone?: TimeZone); - /** - * Constructor. Note that unlike JavaScript dates we require fields to be in normal ranges. - * Use the add(duration) or sub(duration) for arithmetic. - * @param year The full year (e.g. 2014) - * @param month The month [1-12] (note this deviates from JavaScript Date) - * @param day The day of the month [1-31] - * @param hour The hour of the day [0-24) - * @param minute The minute of the hour [0-59] - * @param second The second of the minute [0-59] - * @param millisecond The millisecond of the second [0-999] - * @param timeZone The time zone, or null (for unaware dates) - */ - constructor(year: number, month: number, day: number, hour?: number, minute?: number, second?: number, millisecond?: number, timeZone?: TimeZone); - /** - * Constructor - * @param unixTimestamp milliseconds since 1970-01-01T00:00:00.000 - * @param timeZone the time zone that the timestamp is assumed to be in (usually UTC). - */ - constructor(unixTimestamp: number, timeZone?: TimeZone); - /** - * @return a copy of this object - */ - clone(): DateTime; - /** - * @return The time zone that the date is in. May be null for unaware dates. - */ - zone(): TimeZone; - /** - * @return the offset w.r.t. UTC in minutes. Returns 0 for unaware dates and for UTC dates. - */ - offset(): number; - /** - * @return The full year e.g. 2014 - */ - year(): number; - /** - * @return The month 1-12 (note this deviates from JavaScript Date) - */ - month(): number; - /** - * @return The day of the month 1-31 - */ - day(): number; - /** - * @return The hour 0-23 - */ - hour(): number; - /** - * @return the minutes 0-59 - */ - minute(): number; - /** - * @return the seconds 0-59 - */ - second(): number; - /** - * @return the milliseconds 0-999 - */ - millisecond(): number; - /** - * @return Milliseconds since 1970-01-01T00:00:00.000Z - */ - unixUtcMillis(): number; - /** - * @return The full year e.g. 2014 - */ - utcYear(): number; - /** - * @return The UTC month 1-12 (note this deviates from JavaScript Date) - */ - utcMonth(): number; - /** - * @return The UTC day of the month 1-31 - */ - utcDay(): number; - /** - * @return The UTC hour 0-23 - */ - utcHour(): number; - /** - * @return The UTC minutes 0-59 - */ - utcMinute(): number; - /** - * @return The UTC seconds 0-59 - */ - utcSecond(): number; - /** - * @return The UTC milliseconds 0-999 - */ - utcMillisecond(): number; - /** - * Convert this date to the given time zone (in-place). - * Throws if this date does not have a time zone. - * @return this (for chaining) - */ - convert(zone?: TimeZone): DateTime; - /** - * Returns this date converted to the given time zone. - * Unaware dates can only be converted to unaware dates (clone) - * For unaware dates, an exception is thrown - * @param zone The new time zone. This may be null to create unaware date. - * @return The converted date - */ - toZone(zone?: TimeZone): DateTime; - /** - * Convert to JavaScript date with the zone time in the getX() methods. - * Unless the timezone is local, the Date.getUTCX() methods will NOT be correct. - */ - toDate(): Date; - /** - * Add a time duration. Note that this simply adds a number - * of milliseconds to UTC and converts back to zone(), - * so in the presence of e.g. leap seconds there may be a - * shift in the seconds field if you add an hour. - * There is not DST handling and no leap second handling. - * @return this + duration - */ - add(duration: Duration): DateTime; - /** - * Add an amount of time to UTC, taking leap seconds etc into account. - * Adding e.g. 1 hour will increment the utcHour() field - * date by one. In case of DST changes, the local hour() field - * may not increase or increase by 2 hours. So if you add a month, the - * local time may vary by an hour. There will not be a shift - * in seconds due to leap seconds. - */ - add(amount: number, unit: TimeUnit): DateTime; - /** - * Add an amount of time to the zone time, as regularly as possible. - * Adding e.g. 1 hour will increment the hour() field of the zone - * date by one. In case of DST changes, the utcHour() field may - * increase by 1 or increase by 2. Adding a day will leave the time portion - * intact. However, adding an hour around a forward DST change adds two hours, - * since there is a zone time (2AM in Holland) that does not exist. - */ - addLocal(amount: number, unit: TimeUnit): DateTime; - /** - * Same as add(-1*duration); - */ - sub(duration: Duration): DateTime; - /** - * Same as add(-1*amount, unit); - */ - sub(amount: number, unit: TimeUnit): DateTime; - /** - * Same as addLocal(-1*amount, unit); - */ - subLocal(amount: number, unit: TimeUnit): DateTime; - /** - * Time difference between two DateTimes - * @return this - other - */ - diff(other: DateTime): Duration; - /** - * @return True iff (this < other) - */ - lessThan(other: DateTime): boolean; - /** - * @return True iff (this <= other) - */ - lessEqual(other: DateTime): boolean; - /** - * @return True iff this and other represent the same time in UTC - */ - equals(other: DateTime): boolean; - /** - * @return True iff this and other represent the same time and - * have the same zone - */ - identical(other: DateTime): boolean; - /** - * @return True iff this > other - */ - greaterThan(other: DateTime): boolean; - /** - * @return True iff this >= other - */ - greaterEqual(other: DateTime): boolean; - /** - * Proper ISO 8601 format string with any IANA zone converted to ISO offset - * E.g. "2014-01-01T23:15:33+01:00" for Europe/Amsterdam - */ - toIsoString(): string; - /** - * Modified ISO 8601 format string with IANA name if applicable. - * E.g. "2014-01-01T23:15:33.000 Europe/Amsterdam" - */ - toString(): string; - /** - * Modified ISO 8601 format string in UTC without time zone info - */ - toUtcString(): string; - } - /** - * Specifies how the period should repeat across the day - * during DST changes. - */ - export enum PeriodDst { - /** - * Keep repeating in similar intervals measured in UTC, - * unaffected by Daylight Saving Time. - * E.g. a repetition of one hour will take one real hour - * every time, even in a time zone with DST. - * Leap seconds, leap days and month length - * differences will still make the intervals different. - */ - RegularIntervals = 0, - /** - * Ensure that the time at which the intervals occur stay - * at the same place in the day, local time. So e.g. - * a period of one day, starting at 8:05AM Europe/Amsterdam time - * will always start at 8:05 Europe/Amsterdam. This means that - * in UTC time, some intervals will be 25 hours and some - * 23 hours during DST changes. - * Another example: an hourly interval will be hourly in local time, - * skipping an hour in UTC for a DST backward change. - */ - RegularLocalTime = 1, - } - /** - * Convert a PeriodDst to a string: "regular intervals" or "regular local time" - */ - export function periodDstToString(p: PeriodDst): string; - /** - * Repeating time period: consists of a starting point and - * a time length. This class accounts for leap seconds and leap days. - */ - export class Period { - /** - * Constructor - * LIMITATION: if dst equals RegularLocalTime, and unit is Second, Minute or Hour, - * then the amount must be a factor of 24. So 120 seconds is allowed while 121 seconds is not. - * This is due to the enormous processing power required by these cases. They are not - * implemented and you will get an assert. - * - * @param start The start of the period. If the period is in Months or Years, and - * the day is 29 or 30 or 31, the results are maximised to end-of-month. - * @param amount The amount of units. - * @param unit The unit. - * @param dst Specifies how to handle Daylight Saving Time. Not relevant - * if the time zone of the start datetime does not have DST. - */ - constructor(start: DateTime, amount: number, unit: TimeUnit, dst: PeriodDst); - /** - * The start date - */ - start(): DateTime; - /** - * The amount of units - */ - amount(): number; - /** - * The unit - */ - unit(): TimeUnit; - /** - * The dst handling mode - */ - dst(): PeriodDst; - /** - * The first occurrence of the period greater than - * the given date. The given date need not be at a period boundary. - * Pre: the fromdate and startdate must either both have timezones or not - * @param fromDate: the date after which to return the next date - * @return the first date matching the period after fromDate, given - * in the same zone as the fromDate. - */ - findFirst(fromDate: DateTime): DateTime; - /** - * Returns the next timestamp in the period. The given timestamp must - * be at a period boundary, otherwise the answer is incorrect. - * This function has MUCH better performance than findFirst. - * Returns the datetime "count" times away from the given datetime. - * @param prev Boundary date. Must have a time zone (any time zone) iff the period start date has one. - * @param count Optional, must be >= 1 and whole. - * @return (prev + count * period), in the same timezone as prev. - */ - findNext(prev: DateTime, count?: number): DateTime; - /** - * Returns an ISO duration string - * P[n]Y[n]M[n]DT[n]H[n]M[n][.n]S or P[n]W - */ - toIsoString(): string; - /** - * A string representation e.g. - * "10 years, starting at 2014-03-01T12:00:00 Europe/Amsterdam keeping regular intervals". - */ - toString(): string; - } -} - diff --git a/timezonecomplete/timezonecomplete-1.3.0-tests.ts b/timezonecomplete/timezonecomplete-1.3.0-tests.ts deleted file mode 100644 index 08145d275..000000000 --- a/timezonecomplete/timezonecomplete-1.3.0-tests.ts +++ /dev/null @@ -1,174 +0,0 @@ -/// - -import tc = require("timezonecomplete-1.3.0"); - -var b: boolean = tc.isLeapYear(2014); -var n: number = tc.daysInMonth(2014, 10); -var s: string = tc.isoString(2014, 6, 30, 22, 10, 11, 230); - -// DURATION - -var d: tc.Duration; -var d1: tc.Duration = tc.Duration.hours(24); -var d2: tc.Duration = tc.Duration.minutes(24); -var d3: tc.Duration = tc.Duration.seconds(24); -var d4: tc.Duration = tc.Duration.milliseconds(24); -var d5: tc.Duration = new tc.Duration(24); -var d6: tc.Duration = new tc.Duration("00:01"); -var d7: tc.Duration = d6.clone(); - -n = d7.wholeHours(); -n = d7.hours(); -n = d7.minutes(); -n = d7.minute(); -n = d7.seconds(); -n = d7.second(); -n = d7.milliseconds(); -n = d7.millisecond(); -s = d7.sign(); -b = d7.lessThan(d6); -b = d7.greaterThan(d6); -d = d7.min(d6); -d = d7.max(d6); -d = d7.multiply(3); -d = d7.divide(0.3); -d = d7.add(d6); -d = d7.sub(d6); -s = d7.toString(); - -// TIMEZONE - -var t: tc.TimeZone; -var k: tc.TimeZoneKind; - -t = tc.TimeZone.local(); -t = tc.TimeZone.utc(); -t = tc.TimeZone.zone(2); -t = tc.TimeZone.zone("+01:00"); -s = t.name(); -k = t.kind(); -b = t.equals(t); -b = t.isUtc(); -n = t.offsetForUtc(2014, 1, 1, 13, 0, 5, 123); -n = t.offsetForZone(2014, 1, 1, 13, 0, 5, 123); -n = t.offsetForUtcDate(new Date(2014, 1, 1, 13, 0, 5, 123), tc.DateFunctions.Get); -n = t.offsetForZoneDate(new Date(2014, 1, 1, 13, 0, 5, 123), tc.DateFunctions.GetUTC); -s = t.toString(); -s = tc.TimeZone.offsetToString(2); -n = tc.TimeZone.stringToOffset("+00:01"); - -// REALTIMESOURCE - -var date: Date = (new tc.RealTimeSource()).now(); - -// DATETIME - -var dt: tc.DateTime; - -var ts: tc.TimeSource = tc.DateTime.timeSource; - -dt = tc.DateTime.nowLocal(); -dt = tc.DateTime.nowUtc(); -dt = tc.DateTime.now(tc.TimeZone.local()); -dt = new tc.DateTime(); -dt = new tc.DateTime("2014-01-01T13:05:01.123 UTC"); -dt = new tc.DateTime("2014-01-01T13:05:01.123", tc.TimeZone.utc()); -dt = new tc.DateTime(date, tc.DateFunctions.Get); -dt = new tc.DateTime(date, tc.DateFunctions.Get, tc.TimeZone.utc()); -dt = new tc.DateTime(2014, 1, 1, 13, 5, 1, 123); -dt = new tc.DateTime(2014, 1, 1, 13, 5, 1, 123, tc.TimeZone.utc()); -dt = new tc.DateTime(89949284); -dt = new tc.DateTime(89949284, tc.TimeZone.utc()); -dt = dt.clone(); -t = dt.zone(); -n = dt.offset(); -n = dt.year(); -n = dt.month(); -n = dt.day(); -n = dt.hour(); -n = dt.minute(); -n = dt.second(); -n = dt.millisecond(); -n = dt.unixUtcMillis(); -n = dt.utcYear(); -n = dt.utcMonth(); -n = dt.utcDay(); -n = dt.utcHour(); -n = dt.utcMinute(); -n = dt.utcSecond(); -n = dt.utcMillisecond(); -dt.convert(tc.TimeZone.local()); -dt = dt.toZone(tc.TimeZone.utc()); -date = dt.toDate(); -dt = dt.add(tc.Duration.seconds(2)); -dt = dt.add(2, tc.TimeUnit.Year); -dt = dt.add(2, tc.TimeUnit.Month); -dt = dt.add(2, tc.TimeUnit.Week); -dt = dt.add(2, tc.TimeUnit.Day); -dt = dt.add(2, tc.TimeUnit.Hour); -dt = dt.add(2, tc.TimeUnit.Minute); -dt = dt.add(2, tc.TimeUnit.Second); -dt = dt.addLocal(2, tc.TimeUnit.Second); -dt = dt.sub(tc.Duration.seconds(2)); -dt = dt.sub(2, tc.TimeUnit.Year); -dt = dt.sub(2, tc.TimeUnit.Month); -dt = dt.sub(2, tc.TimeUnit.Week); -dt = dt.sub(2, tc.TimeUnit.Day); -dt = dt.sub(2, tc.TimeUnit.Hour); -dt = dt.sub(2, tc.TimeUnit.Minute); -dt = dt.sub(2, tc.TimeUnit.Second); -dt = dt.subLocal(2, tc.TimeUnit.Second); -d = dt.diff(new tc.DateTime(9289234, tc.TimeZone.local())); -b = dt.lessThan(new tc.DateTime(9289234, tc.TimeZone.local())); -b = dt.lessEqual(new tc.DateTime(9289234, tc.TimeZone.local())); -b = dt.greaterThan(new tc.DateTime(9289234, tc.TimeZone.local())); -b = dt.greaterEqual(new tc.DateTime(9289234, tc.TimeZone.local())); -s = dt.toIsoString(); -s = dt.toString(); -s = dt.toUtcString(); - -var wd: tc.WeekDay; -wd = dt.weekDay(); -wd = dt.utcWeekDay(); - -// PERIOD - -s = tc.periodDstToString(tc.PeriodDst.RegularIntervals); -s = tc.periodDstToString(tc.PeriodDst.RegularLocalTime); - -var p: tc.Period; - -p = new tc.Period(tc.DateTime.nowLocal(), 1, tc.TimeUnit.Hour, tc.PeriodDst.RegularLocalTime); -dt = p.start(); -n = p.amount(); -var tu: tc.TimeUnit = p.unit(); -var pd: tc.PeriodDst = p.dst(); -dt = p.findFirst(tc.DateTime.nowLocal()); -dt = p.findNext(dt); -s = p.toIsoString(); -s = p.toString(); - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/timezonecomplete/timezonecomplete-1.3.0.d.ts b/timezonecomplete/timezonecomplete-1.3.0.d.ts deleted file mode 100644 index 602a44084..000000000 --- a/timezonecomplete/timezonecomplete-1.3.0.d.ts +++ /dev/null @@ -1,702 +0,0 @@ -// Type definitions for timezonecomplete 1.3.0 -// Project: https://github.com/SpiritIT/timezonecomplete -// Definitions by: Rogier Schouten -// Definitions: https://github.com/borisyankov/DefinitelyTyped -// Generated by dts-bundle v0.2.0 - -declare module 'timezonecomplete-1.3.0' { - /** - * @return True iff the given year is a leap year. - */ - export function isLeapYear(year: number): boolean; - /** - * @param year The full year - * @param month The month 1-12 - * @return The number of days in the given month - */ - export function daysInMonth(year: number, month: number): number; - /** - * Returns an ISO time string. Note that months are 1-12. - */ - export function isoString(year: number, month: number, day: number, hour: number, minute: number, second: number, millisecond: number): string; - /** - * Time units - */ - export enum TimeUnit { - Second = 0, - Minute = 1, - Hour = 2, - Day = 3, - Week = 4, - Month = 5, - Year = 6, - } - /** - * Time duration. Create one e.g. like this: var d = Duration.hours(1). - * Note that time durations do not take leap seconds etc. into account: - * one hour is simply represented as 3600000 milliseconds. - */ - export class Duration { - /** - * Construct a time duration - * @param n Number of hours - * @return A duration of n hours - */ - static hours(n: number): Duration; - /** - * Construct a time duration - * @param n Number of minutes - * @return A duration of n minutes - */ - static minutes(n: number): Duration; - /** - * Construct a time duration - * @param n Number of seconds - * @return A duration of n seconds - */ - static seconds(n: number): Duration; - /** - * Construct a time duration - * @param n Number of milliseconds - * @return A duration of n milliseconds - */ - static milliseconds(n: number): Duration; - /** - * Construct a time duration of 0 - */ - constructor(); - /** - * Construct a time duration from a number of milliseconds - */ - constructor(milliseconds: number); - /** - * Construct a time duration from a string in format - * [-]h[:m[:s[.n]]] e.g. -01:00:30.501 - */ - constructor(input: string); - /** - * @return another instance of Duration with the same value. - */ - clone(): Duration; - /** - * The entire duration in milliseconds (negative or positive) - */ - milliseconds(): number; - /** - * The millisecond part of the duration (always positive) - * @return e.g. 400 for a -01:02:03.400 duration - */ - millisecond(): number; - /** - * The entire duration in seconds (negative or positive, fractional) - * @return e.g. 1.5 for a 1500 milliseconds duration - */ - seconds(): number; - /** - * The second part of the duration (always positive) - * @return e.g. 3 for a -01:02:03.400 duration - */ - second(): number; - /** - * The entire duration in minutes (negative or positive, fractional) - * @return e.g. 1.5 for a 90000 milliseconds duration - */ - minutes(): number; - /** - * The minute part of the duration (always positive) - * @return e.g. 2 for a -01:02:03.400 duration - */ - minute(): number; - /** - * The entire duration in hours (negative or positive, fractional) - * @return e.g. 1.5 for a 5400000 milliseconds duration - */ - hours(): number; - /** - * The hour part of the duration (always positive). - * Note that this part can exceed 23 hours, because for - * now, we do not have a days() function - * @return e.g. 25 for a -25:02:03.400 duration - */ - wholeHours(): number; - /** - * Sign - * @return "-" if the duration is negative - */ - sign(): string; - /** - * @return True iff (this < other) - */ - lessThan(other: Duration): boolean; - /** - * @return True iff this and other represent the same time duration - */ - equals(other: Duration): boolean; - /** - * @return True iff this > other - */ - greaterThan(other: Duration): boolean; - /** - * @return The minimum (most negative) of this and other - */ - min(other: Duration): Duration; - /** - * @return The maximum (most positive) of this and other - */ - max(other: Duration): Duration; - /** - * Multiply with a fixed number. - * @return a new Duration of (this * value) - */ - multiply(value: number): Duration; - /** - * Divide by a fixed number. - * @return a new Duration of (this / value) - */ - divide(value: number): Duration; - /** - * Add a duration. - * @return a new Duration of (this + value) - */ - add(value: Duration): Duration; - /** - * Subtract a duration. - * @return a new Duration of (this - value) - */ - sub(value: Duration): Duration; - /** - * String in [-]hh:mm:ss.nnn notation. All fields are - * always present except the sign. - */ - toFullString(): string; - /** - * String in [-]hh[:mm[:ss[.nnn]]] notation. Fields are - * added as necessary - */ - toString(): string; - } - /** - * The type of time zone - */ - export enum TimeZoneKind { - /** - * Local time offset as determined by JavaScript Date class. - */ - Local = 0, - /** - * Fixed offset from UTC, without DST. - */ - Offset = 1, - /** - * IANA timezone managed through Olsen TZ database. Includes - * DST if applicable. - */ - Proper = 2, - } - /** - * Time zone. The object is immutable because it is cached: - * requesting a time zone twice yields the very same object. - * Note that we use time zone offsets inverted w.r.t. JavaScript Date.getTimezoneOffset(), - * i.e. offset 90 means +01:30. - * - * Time zones come in three flavors: the local time zone, as calculated by JavaScript Date, - * a fixed offset ("+01:30") without DST, or a IANA timezone ("Europe/Amsterdam") with DST - * applied depending on the time zone rules. - */ - export class TimeZone { - /** - * The local time zone for a given date. Note that - * the time zone varies with the date: amsterdam time for - * 2014-01-01 is +01:00 and amsterdam time for 2014-07-01 is +02:00 - */ - static local(): TimeZone; - /** - * The UTC time zone. - */ - static utc(): TimeZone; - /** - * Returns a time zone object from the cache. If it does not exist, it is created. - * @return The time zone with the given offset w.r.t. UTC in minutes, e.g. 90 for +01:30 - */ - static zone(offset: number): TimeZone; - /** - * Returns a time zone object from the cache. If it does not exist, it is created. - * @param s: Empty string for local time, a TZ database time zone name (e.g. Europe/Amsterdam) - * or an offset string (either +01:30, +0130, +01, Z). For a full list of names, see: - * https://en.wikipedia.org/wiki/List_of_tz_database_time_zones - */ - static zone(s: string): TimeZone; - /** - * The time zone identifier. Can be an offset "-01:30" or an - * IANA time zone name "Europe/Amsterdam", or "localtime" for - * the local time zone. - */ - name(): string; - /** - * The kind of time zone (Local/Offset/Proper) - */ - kind(): TimeZoneKind; - /** - * Equality operator. Maps zero offsets and different names for UTC onto - * each other. Other time zones are not mapped onto each other. - */ - equals(other: TimeZone): boolean; - /** - * Is this zone equivalent to UTC? - */ - isUtc(): boolean; - /** - * Calculate timezone offset from a UTC time. - * @param year local full year - * @param month local month 1-12 (note this deviates from JavaScript date) - * @param day local day of month 1-31 - * @param hour local hour 0-23 - * @param minute local minute 0-59 - * @param second local second 0-59 - * @param millisecond local millisecond 0-999 - * @return the offset of this time zone with respect to UTC at the given time. - */ - offsetForUtc(year: number, month: number, day: number, hour?: number, minute?: number, second?: number, millisecond?: number): number; - /** - * Calculate timezone offset from a zone-local time (NOT a UTC time). - * @param year local full year - * @param month local month 1-12 (note this deviates from JavaScript date) - * @param day local day of month 1-31 - * @param hour local hour 0-23 - * @param minute local minute 0-59 - * @param second local second 0-59 - * @param millisecond local millisecond 0-999 - * @return the offset of this time zone with respect to UTC at the given time. - */ - offsetForZone(year: number, month: number, day: number, hour?: number, minute?: number, second?: number, millisecond?: number): number; - /** - * Convenience function, takes values from a Javascript Date - * Calls offsetForUtc() with the contents of the date - * @param date: the date - * @param funcs: the set of functions to use: get() or getUTC() - */ - offsetForUtcDate(date: Date, funcs: DateFunctions): number; - /** - * Convenience function, takes values from a Javascript Date - * Calls offsetForUtc() with the contents of the date - * @param date: the date - * @param funcs: the set of functions to use: get() or getUTC() - */ - offsetForZoneDate(date: Date, funcs: DateFunctions): number; - /** - * The time zone identifier (normalized). - * Either "localtime", IANA name, or "+hh:mm" offset. - */ - toString(): string; - /** - * Convert an offset number into an offset string - * @param offset The offset in minutes from UTC e.g. 90 minutes - * @return the offset in ISO notation "+01:30" for +90 minutes - */ - static offsetToString(offset: number): string; - /** - * String to offset conversion. - * @param s Formats: "-01:00", "-0100", "-01", "Z" - * @return offset w.r.t. UTC in minutes - */ - static stringToOffset(s: string): number; - } - /** - * For testing purposes, we often need to manipulate what the current - * time is. This is an interface for a custom time source object - * so in tests you can use a custom time source. - */ - export interface TimeSource { - /** - * Return the current date+time as a javascript Date object - */ - now(): Date; - } - /** - * Default time source, returns actual time - */ - export class RealTimeSource implements TimeSource { - now(): Date; - } - /** - * Indicates how a Date object should be interpreted. - * Either we can take getYear(), getMonth() etc for our field - * values, or we can take getUTCYear() etc to do that. - */ - export enum DateFunctions { - /** - * Use the Date.getFullYear(), Date.getMonth(), ... functions. - */ - Get = 0, - /** - * Use the Date.getUTCFullYear(), Date.getUTCMonth(), ... functions. - */ - GetUTC = 1, - } - /** - * Day-of-week. Note the enum values correspond to JavaScript day-of-week: - * Sunday = 0, Monday = 1 etc - */ - export enum WeekDay { - Sunday = 0, - Monday = 1, - Tuesday = 2, - Wednesday = 3, - Thursday = 4, - Friday = 5, - Saturday = 6, - } - /** - * Our very own DateTime class which is time zone-aware - * and which can be mocked for testing purposes - */ - export class DateTime { - /** - * Actual time source in use. Setting this property allows to - * fake time in tests. DateTime.nowLocal() and DateTime.nowUtc() - * use this property for obtaining the current time. - */ - static timeSource: TimeSource; - /** - * Current date+time in local time (derived from DateTime.timeSource.now()). - */ - static nowLocal(): DateTime; - /** - * Current date+time in UTC time (derived from DateTime.timeSource.now()). - */ - static nowUtc(): DateTime; - /** - * Current date+time in the given time zone (derived from DateTime.timeSource.now()). - * @param timeZone The desired time zone. - */ - static now(timeZone: TimeZone): DateTime; - /** - * Constructor. Creates current time in local timezone. - */ - constructor(); - /** - * Constructor - * @param isoString String in ISO 8601 format. Instead of ISO time zone, - * it may include a space and then and IANA time zone. - * e.g. "2007-04-05T12:30:40.500" (no time zone, naive date) - * e.g. "2007-04-05T12:30:40.500+01:00" (UTC offset without daylight saving time) - * or "2007-04-05T12:30:40.500Z" (UTC) - * or "2007-04-05T12:30:40.500 Europe/Amsterdam" (IANA time zone, with daylight saving time if applicable) - * @param timeZone if given, the date in the string is assumed to be in this time zone. - * Note that it is NOT CONVERTED to the time zone. Useful - * for strings without a time zone - */ - constructor(isoString: string, timeZone?: TimeZone); - /** - * Constructor. You provide a date, then you say whether to take the - * date.getYear()/getXxx methods or the date.getUTCYear()/date.getUTCXxx methods, - * and then you state which time zone that date is in. - * - * @param date A date object. - * @param getters Specifies which set of Date getters contains the date in the given time zone: the - * Date.getXxx() methods or the Date.getUTCXxx() methods. - * @param timeZone The time zone that the given date is assumed to be in (may be null for unaware dates) - */ - constructor(date: Date, getFuncs: DateFunctions, timeZone?: TimeZone); - /** - * Constructor. Note that unlike JavaScript dates we require fields to be in normal ranges. - * Use the add(duration) or sub(duration) for arithmetic. - * @param year The full year (e.g. 2014) - * @param month The month [1-12] (note this deviates from JavaScript Date) - * @param day The day of the month [1-31] - * @param hour The hour of the day [0-24) - * @param minute The minute of the hour [0-59] - * @param second The second of the minute [0-59] - * @param millisecond The millisecond of the second [0-999] - * @param timeZone The time zone, or null (for unaware dates) - */ - constructor(year: number, month: number, day: number, hour?: number, minute?: number, second?: number, millisecond?: number, timeZone?: TimeZone); - /** - * Constructor - * @param unixTimestamp milliseconds since 1970-01-01T00:00:00.000 - * @param timeZone the time zone that the timestamp is assumed to be in (usually UTC). - */ - constructor(unixTimestamp: number, timeZone?: TimeZone); - /** - * @return a copy of this object - */ - clone(): DateTime; - /** - * @return The time zone that the date is in. May be null for unaware dates. - */ - zone(): TimeZone; - /** - * @return the offset w.r.t. UTC in minutes. Returns 0 for unaware dates and for UTC dates. - */ - offset(): number; - /** - * @return The full year e.g. 2014 - */ - year(): number; - /** - * @return The month 1-12 (note this deviates from JavaScript Date) - */ - month(): number; - /** - * @return The day of the month 1-31 - */ - day(): number; - /** - * @return The hour 0-23 - */ - hour(): number; - /** - * @return the minutes 0-59 - */ - minute(): number; - /** - * @return the seconds 0-59 - */ - second(): number; - /** - * @return the milliseconds 0-999 - */ - millisecond(): number; - /** - * @return the day-of-week (the enum values correspond to JavaScript - * week day numbers) - */ - weekDay(): WeekDay; - /** - * @return Milliseconds since 1970-01-01T00:00:00.000Z - */ - unixUtcMillis(): number; - /** - * @return The full year e.g. 2014 - */ - utcYear(): number; - /** - * @return The UTC month 1-12 (note this deviates from JavaScript Date) - */ - utcMonth(): number; - /** - * @return The UTC day of the month 1-31 - */ - utcDay(): number; - /** - * @return The UTC hour 0-23 - */ - utcHour(): number; - /** - * @return The UTC minutes 0-59 - */ - utcMinute(): number; - /** - * @return The UTC seconds 0-59 - */ - utcSecond(): number; - /** - * @return The UTC milliseconds 0-999 - */ - utcMillisecond(): number; - /** - * @return the UTC day-of-week (the enum values correspond to JavaScript - * week day numbers) - */ - utcWeekDay(): WeekDay; - /** - * Convert this date to the given time zone (in-place). - * Throws if this date does not have a time zone. - * @return this (for chaining) - */ - convert(zone?: TimeZone): DateTime; - /** - * Returns this date converted to the given time zone. - * Unaware dates can only be converted to unaware dates (clone) - * For unaware dates, an exception is thrown - * @param zone The new time zone. This may be null to create unaware date. - * @return The converted date - */ - toZone(zone?: TimeZone): DateTime; - /** - * Convert to JavaScript date with the zone time in the getX() methods. - * Unless the timezone is local, the Date.getUTCX() methods will NOT be correct. - */ - toDate(): Date; - /** - * Add a time duration. Note that this simply adds a number - * of milliseconds to UTC and converts back to zone(), - * so in the presence of e.g. leap seconds there may be a - * shift in the seconds field if you add an hour. - * There is not DST handling and no leap second handling. - * @return this + duration - */ - add(duration: Duration): DateTime; - /** - * Add an amount of time to UTC, taking leap seconds etc into account. - * Adding e.g. 1 hour will increment the utcHour() field - * date by one. In case of DST changes, the local hour() field - * may not increase or increase by 2 hours. So if you add a month, the - * local time may vary by an hour. There will not be a shift - * in seconds due to leap seconds. - */ - add(amount: number, unit: TimeUnit): DateTime; - /** - * Add an amount of time to the zone time, as regularly as possible. - * Adding e.g. 1 hour will increment the hour() field of the zone - * date by one. In case of DST changes, the utcHour() field may - * increase by 1 or increase by 2. Adding a day will leave the time portion - * intact. However, adding an hour around a forward DST change adds two hours, - * since there is a zone time (2AM in Holland) that does not exist. - */ - addLocal(amount: number, unit: TimeUnit): DateTime; - /** - * Same as add(-1*duration); - */ - sub(duration: Duration): DateTime; - /** - * Same as add(-1*amount, unit); - */ - sub(amount: number, unit: TimeUnit): DateTime; - /** - * Same as addLocal(-1*amount, unit); - */ - subLocal(amount: number, unit: TimeUnit): DateTime; - /** - * Time difference between two DateTimes - * @return this - other - */ - diff(other: DateTime): Duration; - /** - * @return True iff (this < other) - */ - lessThan(other: DateTime): boolean; - /** - * @return True iff (this <= other) - */ - lessEqual(other: DateTime): boolean; - /** - * @return True iff this and other represent the same time in UTC - */ - equals(other: DateTime): boolean; - /** - * @return True iff this and other represent the same time and - * have the same zone - */ - identical(other: DateTime): boolean; - /** - * @return True iff this > other - */ - greaterThan(other: DateTime): boolean; - /** - * @return True iff this >= other - */ - greaterEqual(other: DateTime): boolean; - /** - * Proper ISO 8601 format string with any IANA zone converted to ISO offset - * E.g. "2014-01-01T23:15:33+01:00" for Europe/Amsterdam - */ - toIsoString(): string; - /** - * Modified ISO 8601 format string with IANA name if applicable. - * E.g. "2014-01-01T23:15:33.000 Europe/Amsterdam" - */ - toString(): string; - /** - * Modified ISO 8601 format string in UTC without time zone info - */ - toUtcString(): string; - } - /** - * Specifies how the period should repeat across the day - * during DST changes. - */ - export enum PeriodDst { - /** - * Keep repeating in similar intervals measured in UTC, - * unaffected by Daylight Saving Time. - * E.g. a repetition of one hour will take one real hour - * every time, even in a time zone with DST. - * Leap seconds, leap days and month length - * differences will still make the intervals different. - */ - RegularIntervals = 0, - /** - * Ensure that the time at which the intervals occur stay - * at the same place in the day, local time. So e.g. - * a period of one day, starting at 8:05AM Europe/Amsterdam time - * will always start at 8:05 Europe/Amsterdam. This means that - * in UTC time, some intervals will be 25 hours and some - * 23 hours during DST changes. - * Another example: an hourly interval will be hourly in local time, - * skipping an hour in UTC for a DST backward change. - */ - RegularLocalTime = 1, - } - /** - * Convert a PeriodDst to a string: "regular intervals" or "regular local time" - */ - export function periodDstToString(p: PeriodDst): string; - /** - * Repeating time period: consists of a starting point and - * a time length. This class accounts for leap seconds and leap days. - */ - export class Period { - /** - * Constructor - * LIMITATION: if dst equals RegularLocalTime, and unit is Second, Minute or Hour, - * then the amount must be a factor of 24. So 120 seconds is allowed while 121 seconds is not. - * This is due to the enormous processing power required by these cases. They are not - * implemented and you will get an assert. - * - * @param start The start of the period. If the period is in Months or Years, and - * the day is 29 or 30 or 31, the results are maximised to end-of-month. - * @param amount The amount of units. - * @param unit The unit. - * @param dst Specifies how to handle Daylight Saving Time. Not relevant - * if the time zone of the start datetime does not have DST. - */ - constructor(start: DateTime, amount: number, unit: TimeUnit, dst: PeriodDst); - /** - * The start date - */ - start(): DateTime; - /** - * The amount of units - */ - amount(): number; - /** - * The unit - */ - unit(): TimeUnit; - /** - * The dst handling mode - */ - dst(): PeriodDst; - /** - * The first occurrence of the period greater than - * the given date. The given date need not be at a period boundary. - * Pre: the fromdate and startdate must either both have timezones or not - * @param fromDate: the date after which to return the next date - * @return the first date matching the period after fromDate, given - * in the same zone as the fromDate. - */ - findFirst(fromDate: DateTime): DateTime; - /** - * Returns the next timestamp in the period. The given timestamp must - * be at a period boundary, otherwise the answer is incorrect. - * This function has MUCH better performance than findFirst. - * Returns the datetime "count" times away from the given datetime. - * @param prev Boundary date. Must have a time zone (any time zone) iff the period start date has one. - * @param count Optional, must be >= 1 and whole. - * @return (prev + count * period), in the same timezone as prev. - */ - findNext(prev: DateTime, count?: number): DateTime; - /** - * Returns an ISO duration string - * P[n]Y[n]M[n]DT[n]H[n]M[n][.n]S or P[n]W - */ - toIsoString(): string; - /** - * A string representation e.g. - * "10 years, starting at 2014-03-01T12:00:00 Europe/Amsterdam keeping regular intervals". - */ - toString(): string; - } -} - diff --git a/timezonecomplete/timezonecomplete-1.4.6-tests.ts b/timezonecomplete/timezonecomplete-1.4.6-tests.ts deleted file mode 100644 index de0b73048..000000000 --- a/timezonecomplete/timezonecomplete-1.4.6-tests.ts +++ /dev/null @@ -1,183 +0,0 @@ -/// - -import tc = require("timezonecomplete-1.4.6"); - -var b: boolean; -var n: number; -var s: string; -var w: tc.WeekDay; - -b = tc.isLeapYear(2014); -n = tc.daysInMonth(2014, 10); -n = tc.daysInYear(2014); -n = tc.dayOfYear(2014, 1, 2); -w = tc.lastWeekDayOfMonth(2014, 1, tc.WeekDay.Sunday); -n = tc.weekDayOnOrAfter(2014, 1, 14, tc.WeekDay.Monday); -n = tc.weekDayOnOrBefore(2014, 1, 14, tc.WeekDay.Monday); - -// DURATION - -var d: tc.Duration; -var d1: tc.Duration = tc.Duration.hours(24); -var d2: tc.Duration = tc.Duration.minutes(24); -var d3: tc.Duration = tc.Duration.seconds(24); -var d4: tc.Duration = tc.Duration.milliseconds(24); -var d5: tc.Duration = new tc.Duration(24); -var d6: tc.Duration = new tc.Duration("00:01"); -var d7: tc.Duration = d6.clone(); - -n = d7.wholeHours(); -n = d7.hours(); -n = d7.minutes(); -n = d7.minute(); -n = d7.seconds(); -n = d7.second(); -n = d7.milliseconds(); -n = d7.millisecond(); -s = d7.sign(); -b = d7.lessThan(d6); -b = d7.greaterThan(d6); -d = d7.min(d6); -d = d7.max(d6); -d = d7.multiply(3); -d = d7.divide(0.3); -d = d7.add(d6); -d = d7.sub(d6); -s = d7.toString(); - -// TIMEZONE - -var t: tc.TimeZone; -var k: tc.TimeZoneKind; - -t = tc.TimeZone.local(); -t = tc.TimeZone.utc(); -t = tc.TimeZone.zone(2); -t = tc.TimeZone.zone("+01:00"); -s = t.name(); -k = t.kind(); -b = t.equals(t); -b = t.isUtc(); -n = t.offsetForUtc(2014, 1, 1, 13, 0, 5, 123); -n = t.offsetForZone(2014, 1, 1, 13, 0, 5, 123); -n = t.offsetForUtcDate(new Date(2014, 1, 1, 13, 0, 5, 123), tc.DateFunctions.Get); -n = t.offsetForZoneDate(new Date(2014, 1, 1, 13, 0, 5, 123), tc.DateFunctions.GetUTC); -s = t.toString(); -s = tc.TimeZone.offsetToString(2); -n = tc.TimeZone.stringToOffset("+00:01"); - -// REALTIMESOURCE - -var date: Date = (new tc.RealTimeSource()).now(); - -// DATETIME - -var dt: tc.DateTime; - -var ts: tc.TimeSource = tc.DateTime.timeSource; - -dt = tc.DateTime.nowLocal(); -dt = tc.DateTime.nowUtc(); -dt = tc.DateTime.now(tc.TimeZone.local()); -dt = new tc.DateTime(); -dt = new tc.DateTime("2014-01-01T13:05:01.123 UTC"); -dt = new tc.DateTime("2014-01-01T13:05:01.123", tc.TimeZone.utc()); -dt = new tc.DateTime(date, tc.DateFunctions.Get); -dt = new tc.DateTime(date, tc.DateFunctions.Get, tc.TimeZone.utc()); -dt = new tc.DateTime(2014, 1, 1, 13, 5, 1, 123); -dt = new tc.DateTime(2014, 1, 1, 13, 5, 1, 123, tc.TimeZone.utc()); -dt = new tc.DateTime(89949284); -dt = new tc.DateTime(89949284, tc.TimeZone.utc()); -dt = dt.clone(); -t = dt.zone(); -n = dt.offset(); -n = dt.year(); -n = dt.month(); -n = dt.day(); -n = dt.hour(); -n = dt.minute(); -n = dt.second(); -n = dt.millisecond(); -n = dt.unixUtcMillis(); -n = dt.utcYear(); -n = dt.utcMonth(); -n = dt.utcDay(); -n = dt.utcHour(); -n = dt.utcMinute(); -n = dt.utcSecond(); -n = dt.utcMillisecond(); -dt.convert(tc.TimeZone.local()); -dt = dt.toZone(tc.TimeZone.utc()); -date = dt.toDate(); -dt = dt.add(tc.Duration.seconds(2)); -dt = dt.add(2, tc.TimeUnit.Year); -dt = dt.add(2, tc.TimeUnit.Month); -dt = dt.add(2, tc.TimeUnit.Week); -dt = dt.add(2, tc.TimeUnit.Day); -dt = dt.add(2, tc.TimeUnit.Hour); -dt = dt.add(2, tc.TimeUnit.Minute); -dt = dt.add(2, tc.TimeUnit.Second); -dt = dt.addLocal(2, tc.TimeUnit.Second); -dt = dt.sub(tc.Duration.seconds(2)); -dt = dt.sub(2, tc.TimeUnit.Year); -dt = dt.sub(2, tc.TimeUnit.Month); -dt = dt.sub(2, tc.TimeUnit.Week); -dt = dt.sub(2, tc.TimeUnit.Day); -dt = dt.sub(2, tc.TimeUnit.Hour); -dt = dt.sub(2, tc.TimeUnit.Minute); -dt = dt.sub(2, tc.TimeUnit.Second); -dt = dt.subLocal(2, tc.TimeUnit.Second); -d = dt.diff(new tc.DateTime(9289234, tc.TimeZone.local())); -b = dt.lessThan(new tc.DateTime(9289234, tc.TimeZone.local())); -b = dt.lessEqual(new tc.DateTime(9289234, tc.TimeZone.local())); -b = dt.greaterThan(new tc.DateTime(9289234, tc.TimeZone.local())); -b = dt.greaterEqual(new tc.DateTime(9289234, tc.TimeZone.local())); -s = dt.toIsoString(); -s = dt.toString(); -s = dt.toUtcString(); - -var wd: tc.WeekDay; -wd = dt.weekDay(); -wd = dt.utcWeekDay(); - -// PERIOD - -s = tc.periodDstToString(tc.PeriodDst.RegularIntervals); -s = tc.periodDstToString(tc.PeriodDst.RegularLocalTime); - -var p: tc.Period; - -p = new tc.Period(tc.DateTime.nowLocal(), 1, tc.TimeUnit.Hour, tc.PeriodDst.RegularLocalTime); -dt = p.start(); -n = p.amount(); -var tu: tc.TimeUnit = p.unit(); -var pd: tc.PeriodDst = p.dst(); -dt = p.findFirst(tc.DateTime.nowLocal()); -dt = p.findNext(dt); -s = p.toIsoString(); -s = p.toString(); - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/timezonecomplete/timezonecomplete-1.4.6.d.ts b/timezonecomplete/timezonecomplete-1.4.6.d.ts deleted file mode 100644 index afec37d0f..000000000 --- a/timezonecomplete/timezonecomplete-1.4.6.d.ts +++ /dev/null @@ -1,1004 +0,0 @@ -// Type definitions for timezonecomplete 1.4.6 -// Project: https://github.com/SpiritIT/timezonecomplete -// Definitions by: Rogier Schouten -// Definitions: https://github.com/borisyankov/DefinitelyTyped -// Generated by dts-bundle v0.2.0 - -declare module 'timezonecomplete-1.4.6' { - import basics = require("__timezonecomplete/basics"); - export import TimeUnit = basics.TimeUnit; - export import WeekDay = basics.WeekDay; - export import isLeapYear = basics.isLeapYear; - export import daysInMonth = basics.daysInMonth; - export import daysInYear = basics.daysInYear; - export import dayOfYear = basics.dayOfYear; - export import lastWeekDayOfMonth = basics.lastWeekDayOfMonth; - export import weekDayOnOrAfter = basics.weekDayOnOrAfter; - export import weekDayOnOrBefore = basics.weekDayOnOrBefore; - import datetime = require("__timezonecomplete/datetime"); - export import DateTime = datetime.DateTime; - import duration = require("__timezonecomplete/duration"); - export import Duration = duration.Duration; - import javascript = require("__timezonecomplete/javascript"); - export import DateFunctions = javascript.DateFunctions; - import period = require("__timezonecomplete/period"); - export import Period = period.Period; - export import PeriodDst = period.PeriodDst; - export import periodDstToString = period.periodDstToString; - import timesource = require("__timezonecomplete/timesource"); - export import TimeSource = timesource.TimeSource; - export import RealTimeSource = timesource.RealTimeSource; - import timezone = require("__timezonecomplete/timezone"); - export import NormalizeOption = timezone.NormalizeOption; - export import TimeZoneKind = timezone.TimeZoneKind; - export import TimeZone = timezone.TimeZone; -} - -declare module '__timezonecomplete/basics' { - import javascript = require("__timezonecomplete/javascript"); - /** - * Day-of-week. Note the enum values correspond to JavaScript day-of-week: - * Sunday = 0, Monday = 1 etc - */ - export enum WeekDay { - Sunday = 0, - Monday = 1, - Tuesday = 2, - Wednesday = 3, - Thursday = 4, - Friday = 5, - Saturday = 6, - } - /** - * Time units - */ - export enum TimeUnit { - Second = 0, - Minute = 1, - Hour = 2, - Day = 3, - Week = 4, - Month = 5, - Year = 6, - } - /** - * @return True iff the given year is a leap year. - */ - export function isLeapYear(year: number): boolean; - /** - * The days in a given year - */ - export function daysInYear(year: number): number; - /** - * @param year The full year - * @param month The month 1-12 - * @return The number of days in the given month - */ - export function daysInMonth(year: number, month: number): number; - /** - * Returns the day of the year of the given date [0..365]. January first is 0. - * - * @param year The year e.g. 1986 - * @param month Month 1-12 - * @param day Day of month 1-31 - */ - export function dayOfYear(year: number, month: number, day: number): number; - /** - * Returns the last instance of the given weekday in the given month - * - * @param year The year - * @param month the month 1-12 - * @param weekDay the desired week day - * - * @return the last occurrence of the week day in the month - */ - export function lastWeekDayOfMonth(year: number, month: number, weekDay: WeekDay): number; - /** - * Returns the day-of-month that is on the given weekday and which is >= the given day. - * Throws if the month has no such day. - */ - export function weekDayOnOrAfter(year: number, month: number, day: number, weekDay: WeekDay): number; - /** - * Returns the day-of-month that is on the given weekday and which is <= the given day. - * Throws if the month has no such day. - */ - export function weekDayOnOrBefore(year: number, month: number, day: number, weekDay: WeekDay): number; - /** - * Convert a unix milli timestamp into a TimeT structure. - * This does NOT take leap seconds into account. - */ - export function unixToTimeNoLeapSecs(unixMillis: number): TimeStruct; - /** - * Convert a year, month, day etc into a unix milli timestamp. - * This does NOT take leap seconds into account. - * - * @param year Year e.g. 1970 - * @param month Month 1-12 - * @param day Day 1-31 - * @param hour Hour 0-23 - * @param minute Minute 0-59 - * @param second Second 0-59 (no leap seconds) - * @param milli Millisecond 0-999 - */ - export function timeToUnixNoLeapSecs(year?: number, month?: number, day?: number, hour?: number, minute?: number, second?: number, milli?: number): number; - /** - * Convert a TimeT structure into a unix milli timestamp. - * This does NOT take leap seconds into account. - */ - export function timeToUnixNoLeapSecs(tm: TimeStruct): number; - /** - * Return the day-of-week. - * This does NOT take leap seconds into account. - */ - export function weekDayNoLeapSecs(unixMillis: number): WeekDay; - /** - * Basic representation of a date and time - */ - export class TimeStruct { - /** - * Year, 1970-... - */ - year: number; - /** - * Month 1-12 - */ - month: number; - /** - * Day of month, 1-31 - */ - day: number; - /** - * Hour 0-23 - */ - hour: number; - /** - * Minute 0-59 - */ - minute: number; - /** - * Seconds, 0-59 - */ - second: number; - /** - * Milliseconds 0-999 - */ - milli: number; - /** - * Create a TimeStruct from a number of unix milliseconds - */ - static fromUnix(unixMillis: number): TimeStruct; - /** - * Create a TimeStruct from a JavaScript date - * - * @param d The date - * @param df Which functions to take (getX() or getUTCX()) - */ - static fromDate(d: Date, df: javascript.DateFunctions): TimeStruct; - /** - * Returns a TimeStruct from an ISO 8601 string WITHOUT time zone - */ - static fromString(s: string): TimeStruct; - /** - * Constructor - * - * @param year Year e.g. 1970 - * @param month Month 1-12 - * @param day Day 1-31 - * @param hour Hour 0-23 - * @param minute Minute 0-59 - * @param second Second 0-59 (no leap seconds) - * @param milli Millisecond 0-999 - */ - constructor(/** - * Year, 1970-... - */ - year?: number, /** - * Month 1-12 - */ - month?: number, /** - * Day of month, 1-31 - */ - day?: number, /** - * Hour 0-23 - */ - hour?: number, /** - * Minute 0-59 - */ - minute?: number, /** - * Seconds, 0-59 - */ - second?: number, /** - * Milliseconds 0-999 - */ - milli?: number); - /** - * Validate a TimeStruct, returns false if invalid. - */ - validate(): boolean; - /** - * The day-of-year 0-365 - */ - yearDay(): number; - /** - * Returns this time as a unix millisecond timestamp - * Does NOT take leap seconds into account. - */ - toUnixNoLeapSecs(): number; - /** - * Deep equals - */ - equals(other: TimeStruct): boolean; - /** - * < operator - */ - lessThan(other: TimeStruct): boolean; - clone(): TimeStruct; - valueOf(): number; - /** - * ISO 8601 string YYYY-MM-DDThh:mm:ss.nnn - */ - toString(): string; - inspect(): string; - } -} - -declare module '__timezonecomplete/datetime' { - import basics = require("__timezonecomplete/basics"); - import duration = require("__timezonecomplete/duration"); - import javascript = require("__timezonecomplete/javascript"); - import timesource = require("__timezonecomplete/timesource"); - import timezone = require("__timezonecomplete/timezone"); - /** - * DateTime class which is time zone-aware - * and which can be mocked for testing purposes. - */ - export class DateTime { - /** - * Actual time source in use. Setting this property allows to - * fake time in tests. DateTime.nowLocal() and DateTime.nowUtc() - * use this property for obtaining the current time. - */ - static timeSource: timesource.TimeSource; - /** - * Current date+time in local time (derived from DateTime.timeSource.now()). - */ - static nowLocal(): DateTime; - /** - * Current date+time in UTC time (derived from DateTime.timeSource.now()). - */ - static nowUtc(): DateTime; - /** - * Current date+time in the given time zone (derived from DateTime.timeSource.now()). - * @param timeZone The desired time zone. - */ - static now(timeZone: timezone.TimeZone): DateTime; - /** - * Constructor. Creates current time in local timezone. - */ - constructor(); - /** - * Constructor - * Non-existing local times are normalized by rounding up to the next DST offset. - * - * @param isoString String in ISO 8601 format. Instead of ISO time zone, - * it may include a space and then and IANA time zone. - * e.g. "2007-04-05T12:30:40.500" (no time zone, naive date) - * e.g. "2007-04-05T12:30:40.500+01:00" (UTC offset without daylight saving time) - * or "2007-04-05T12:30:40.500Z" (UTC) - * or "2007-04-05T12:30:40.500 Europe/Amsterdam" (IANA time zone, with daylight saving time if applicable) - * @param timeZone if given, the date in the string is assumed to be in this time zone. - * Note that it is NOT CONVERTED to the time zone. Useful - * for strings without a time zone - */ - constructor(isoString: string, timeZone?: timezone.TimeZone); - /** - * Constructor. You provide a date, then you say whether to take the - * date.getYear()/getXxx methods or the date.getUTCYear()/date.getUTCXxx methods, - * and then you state which time zone that date is in. - * Non-existing local times are normalized by rounding up to the next DST offset. - * Note that the Date class has bugs and inconsistencies when constructing them with times around - * DST changes. - * - * @param date A date object. - * @param getters Specifies which set of Date getters contains the date in the given time zone: the - * Date.getXxx() methods or the Date.getUTCXxx() methods. - * @param timeZone The time zone that the given date is assumed to be in (may be null for unaware dates) - */ - constructor(date: Date, getFuncs: javascript.DateFunctions, timeZone?: timezone.TimeZone); - /** - * Constructor. Note that unlike JavaScript dates we require fields to be in normal ranges. - * Use the add(duration) or sub(duration) for arithmetic. - * @param year The full year (e.g. 2014) - * @param month The month [1-12] (note this deviates from JavaScript Date) - * @param day The day of the month [1-31] - * @param hour The hour of the day [0-24) - * @param minute The minute of the hour [0-59] - * @param second The second of the minute [0-59] - * @param millisecond The millisecond of the second [0-999] - * @param timeZone The time zone, or null (for unaware dates) - */ - constructor(year: number, month: number, day: number, hour?: number, minute?: number, second?: number, millisecond?: number, timeZone?: timezone.TimeZone); - /** - * Constructor - * @param unixTimestamp milliseconds since 1970-01-01T00:00:00.000 - * @param timeZone the time zone that the timestamp is assumed to be in (usually UTC). - */ - constructor(unixTimestamp: number, timeZone?: timezone.TimeZone); - /** - * @return a copy of this object - */ - clone(): DateTime; - /** - * @return The time zone that the date is in. May be null for unaware dates. - */ - zone(): timezone.TimeZone; - /** - * @return the offset w.r.t. UTC in minutes. Returns 0 for unaware dates and for UTC dates. - */ - offset(): number; - /** - * @return The full year e.g. 2014 - */ - year(): number; - /** - * @return The month 1-12 (note this deviates from JavaScript Date) - */ - month(): number; - /** - * @return The day of the month 1-31 - */ - day(): number; - /** - * @return The hour 0-23 - */ - hour(): number; - /** - * @return the minutes 0-59 - */ - minute(): number; - /** - * @return the seconds 0-59 - */ - second(): number; - /** - * @return the milliseconds 0-999 - */ - millisecond(): number; - /** - * @return the day-of-week (the enum values correspond to JavaScript - * week day numbers) - */ - weekDay(): basics.WeekDay; - /** - * @return Milliseconds since 1970-01-01T00:00:00.000Z - */ - unixUtcMillis(): number; - /** - * @return The full year e.g. 2014 - */ - utcYear(): number; - /** - * @return The UTC month 1-12 (note this deviates from JavaScript Date) - */ - utcMonth(): number; - /** - * @return The UTC day of the month 1-31 - */ - utcDay(): number; - /** - * @return The UTC hour 0-23 - */ - utcHour(): number; - /** - * @return The UTC minutes 0-59 - */ - utcMinute(): number; - /** - * @return The UTC seconds 0-59 - */ - utcSecond(): number; - /** - * @return The UTC milliseconds 0-999 - */ - utcMillisecond(): number; - /** - * @return the UTC day-of-week (the enum values correspond to JavaScript - * week day numbers) - */ - utcWeekDay(): basics.WeekDay; - /** - * Convert this date to the given time zone (in-place). - * Throws if this date does not have a time zone. - * @return this (for chaining) - */ - convert(zone?: timezone.TimeZone): DateTime; - /** - * Returns this date converted to the given time zone. - * Unaware dates can only be converted to unaware dates (clone) - * Converting an unaware date to an aware date throws an exception. Use the constructor - * if you really need to do that. - * - * @param zone The new time zone. This may be null to create unaware date. - * @return The converted date - */ - toZone(zone?: timezone.TimeZone): DateTime; - /** - * Convert to JavaScript date with the zone time in the getX() methods. - * Unless the timezone is local, the Date.getUTCX() methods will NOT be correct. - * This is because Date calculates getUTCX() from getX() applying local time zone. - */ - toDate(): Date; - /** - * Add a time duration relative to UTC. Note that this simply adds a number - * of milliseconds to UTC and converts back to zone(), - * There is not DST handling. - * @return this + duration - */ - add(duration: duration.Duration): DateTime; - /** - * Add an amount of time relative to UTC, as regularly as possible. - * - * Adding e.g. 1 hour will increment the utcHour() field, adding 1 month - * increments the utcMonth() field. - * Adding an amount of units leaves lower units intact. E.g. - * adding a month will leave the day() field untouched if possible. - * - * Note adding Months or Years will clamp the date to the end-of-month if - * the start date was at the end of a month, i.e. contrary to JavaScript - * Date#setUTCMonth() it will not overflow into the next month - * - * In case of DST changes, the utc time fields are still untouched but local - * time fields may shift. - */ - add(amount: number, unit: basics.TimeUnit): DateTime; - /** - * Add an amount of time to the zone time, as regularly as possible. - * - * Adding e.g. 1 hour will increment the hour() field of the zone - * date by one. In case of DST changes, the time fields may additionally - * increase by the DST offset, if a non-existing local time would - * be reached otherwise. - * - * Adding a unit of time will leave lower-unit fields intact, unless the result - * would be a non-existing time. Then an extra DST offset is added. - * - * Note adding Months or Years will clamp the date to the end-of-month if - * the start date was at the end of a month, i.e. contrary to JavaScript - * Date#setUTCMonth() it will not overflow into the next month - */ - addLocal(amount: number, unit: basics.TimeUnit): DateTime; - /** - * Same as add(-1*duration); - */ - sub(duration: duration.Duration): DateTime; - /** - * Same as add(-1*amount, unit); - */ - sub(amount: number, unit: basics.TimeUnit): DateTime; - /** - * Same as addLocal(-1*amount, unit); - */ - subLocal(amount: number, unit: basics.TimeUnit): DateTime; - /** - * Time difference between two DateTimes - * @return this - other - */ - diff(other: DateTime): duration.Duration; - /** - * @return True iff (this < other) - */ - lessThan(other: DateTime): boolean; - /** - * @return True iff (this <= other) - */ - lessEqual(other: DateTime): boolean; - /** - * @return True iff this and other represent the same time in UTC - */ - equals(other: DateTime): boolean; - /** - * @return True iff this and other represent the same time and - * have the same zone - */ - identical(other: DateTime): boolean; - /** - * @return True iff this > other - */ - greaterThan(other: DateTime): boolean; - /** - * @return True iff this >= other - */ - greaterEqual(other: DateTime): boolean; - /** - * Proper ISO 8601 format string with any IANA zone converted to ISO offset - * E.g. "2014-01-01T23:15:33+01:00" for Europe/Amsterdam - */ - toIsoString(): string; - /** - * Modified ISO 8601 format string with IANA name if applicable. - * E.g. "2014-01-01T23:15:33.000 Europe/Amsterdam" - */ - toString(): string; - /** - * Used by util.inspect() - */ - inspect(): string; - /** - * Modified ISO 8601 format string in UTC without time zone info - */ - toUtcString(): string; - } -} - -declare module '__timezonecomplete/duration' { - /** - * Time duration. Create one e.g. like this: var d = Duration.hours(1). - * Note that time durations do not take leap seconds etc. into account: - * one hour is simply represented as 3600000 milliseconds. - */ - export class Duration { - /** - * Construct a time duration - * @param n Number of hours - * @return A duration of n hours - */ - static hours(n: number): Duration; - /** - * Construct a time duration - * @param n Number of minutes - * @return A duration of n minutes - */ - static minutes(n: number): Duration; - /** - * Construct a time duration - * @param n Number of seconds - * @return A duration of n seconds - */ - static seconds(n: number): Duration; - /** - * Construct a time duration - * @param n Number of milliseconds - * @return A duration of n milliseconds - */ - static milliseconds(n: number): Duration; - /** - * Construct a time duration of 0 - */ - constructor(); - /** - * Construct a time duration from a number of milliseconds - */ - constructor(milliseconds: number); - /** - * Construct a time duration from a string in format - * [-]h[:m[:s[.n]]] e.g. -01:00:30.501 - */ - constructor(input: string); - /** - * @return another instance of Duration with the same value. - */ - clone(): Duration; - /** - * The entire duration in milliseconds (negative or positive) - */ - milliseconds(): number; - /** - * The millisecond part of the duration (always positive) - * @return e.g. 400 for a -01:02:03.400 duration - */ - millisecond(): number; - /** - * The entire duration in seconds (negative or positive, fractional) - * @return e.g. 1.5 for a 1500 milliseconds duration - */ - seconds(): number; - /** - * The second part of the duration (always positive) - * @return e.g. 3 for a -01:02:03.400 duration - */ - second(): number; - /** - * The entire duration in minutes (negative or positive, fractional) - * @return e.g. 1.5 for a 90000 milliseconds duration - */ - minutes(): number; - /** - * The minute part of the duration (always positive) - * @return e.g. 2 for a -01:02:03.400 duration - */ - minute(): number; - /** - * The entire duration in hours (negative or positive, fractional) - * @return e.g. 1.5 for a 5400000 milliseconds duration - */ - hours(): number; - /** - * The hour part of the duration (always positive). - * Note that this part can exceed 23 hours, because for - * now, we do not have a days() function - * @return e.g. 25 for a -25:02:03.400 duration - */ - wholeHours(): number; - /** - * Sign - * @return "-" if the duration is negative - */ - sign(): string; - /** - * @return True iff (this < other) - */ - lessThan(other: Duration): boolean; - /** - * @return True iff this and other represent the same time duration - */ - equals(other: Duration): boolean; - /** - * @return True iff this > other - */ - greaterThan(other: Duration): boolean; - /** - * @return The minimum (most negative) of this and other - */ - min(other: Duration): Duration; - /** - * @return The maximum (most positive) of this and other - */ - max(other: Duration): Duration; - /** - * Multiply with a fixed number. - * @return a new Duration of (this * value) - */ - multiply(value: number): Duration; - /** - * Divide by a fixed number. - * @return a new Duration of (this / value) - */ - divide(value: number): Duration; - /** - * Add a duration. - * @return a new Duration of (this + value) - */ - add(value: Duration): Duration; - /** - * Subtract a duration. - * @return a new Duration of (this - value) - */ - sub(value: Duration): Duration; - /** - * String in [-]hh:mm:ss.nnn notation. All fields are - * always present except the sign. - */ - toFullString(): string; - /** - * String in [-]hh[:mm[:ss[.nnn]]] notation. Fields are - * added as necessary - */ - toString(): string; - /** - * Used by util.inspect() - */ - inspect(): string; - } -} - -declare module '__timezonecomplete/javascript' { - /** - * Indicates how a Date object should be interpreted. - * Either we can take getYear(), getMonth() etc for our field - * values, or we can take getUTCYear(), getUtcMonth() etc to do that. - */ - export enum DateFunctions { - /** - * Use the Date.getFullYear(), Date.getMonth(), ... functions. - */ - Get = 0, - /** - * Use the Date.getUTCFullYear(), Date.getUTCMonth(), ... functions. - */ - GetUTC = 1, - } -} - -declare module '__timezonecomplete/period' { - import basics = require("__timezonecomplete/basics"); - import datetime = require("__timezonecomplete/datetime"); - /** - * Specifies how the period should repeat across the day - * during DST changes. - */ - export enum PeriodDst { - /** - * Keep repeating in similar intervals measured in UTC, - * unaffected by Daylight Saving Time. - * E.g. a repetition of one hour will take one real hour - * every time, even in a time zone with DST. - * Leap seconds, leap days and month length - * differences will still make the intervals different. - */ - RegularIntervals = 0, - /** - * Ensure that the time at which the intervals occur stay - * at the same place in the day, local time. So e.g. - * a period of one day, starting at 8:05AM Europe/Amsterdam time - * will always start at 8:05 Europe/Amsterdam. This means that - * in UTC time, some intervals will be 25 hours and some - * 23 hours during DST changes. - * Another example: an hourly interval will be hourly in local time, - * skipping an hour in UTC for a DST backward change. - */ - RegularLocalTime = 1, - } - /** - * Convert a PeriodDst to a string: "regular intervals" or "regular local time" - */ - export function periodDstToString(p: PeriodDst): string; - /** - * Repeating time period: consists of a starting point and - * a time length. This class accounts for leap seconds and leap days. - */ - export class Period { - /** - * Constructor - * LIMITATION: if dst equals RegularLocalTime, and unit is Second, Minute or Hour, - * then the amount must be a factor of 24. So 120 seconds is allowed while 121 seconds is not. - * This is due to the enormous processing power required by these cases. They are not - * implemented and you will get an assert. - * - * @param start The start of the period. If the period is in Months or Years, and - * the day is 29 or 30 or 31, the results are maximised to end-of-month. - * @param amount The amount of units. - * @param unit The unit. - * @param dst Specifies how to handle Daylight Saving Time. Not relevant - * if the time zone of the start datetime does not have DST. - */ - constructor(start: datetime.DateTime, amount: number, unit: basics.TimeUnit, dst: PeriodDst); - /** - * The start date - */ - start(): datetime.DateTime; - /** - * The amount of units - */ - amount(): number; - /** - * The unit - */ - unit(): basics.TimeUnit; - /** - * The dst handling mode - */ - dst(): PeriodDst; - /** - * The first occurrence of the period greater than - * the given date. The given date need not be at a period boundary. - * Pre: the fromdate and startdate must either both have timezones or not - * @param fromDate: the date after which to return the next date - * @return the first date matching the period after fromDate, given - * in the same zone as the fromDate. - */ - findFirst(fromDate: datetime.DateTime): datetime.DateTime; - /** - * Returns the next timestamp in the period. The given timestamp must - * be at a period boundary, otherwise the answer is incorrect. - * This function has MUCH better performance than findFirst. - * Returns the datetime "count" times away from the given datetime. - * @param prev Boundary date. Must have a time zone (any time zone) iff the period start date has one. - * @param count Optional, must be >= 1 and whole. - * @return (prev + count * period), in the same timezone as prev. - */ - findNext(prev: datetime.DateTime, count?: number): datetime.DateTime; - /** - * Returns an ISO duration string e.g. - * 2014-01-01T12:00:00.000+01:00/P1H - * 2014-01-01T12:00:00.000+01:00/PT1M (one minute) - * 2014-01-01T12:00:00.000+01:00/P1M (one month) - */ - toIsoString(): string; - /** - * A string representation e.g. - * "10 years, starting at 2014-03-01T12:00:00 Europe/Amsterdam, keeping regular intervals". - */ - toString(): string; - /** - * Used by util.inspect() - */ - inspect(): string; - } -} - -declare module '__timezonecomplete/timesource' { - /** - * For testing purposes, we often need to manipulate what the current - * time is. This is an interface for a custom time source object - * so in tests you can use a custom time source. - */ - export interface TimeSource { - /** - * Return the current date+time as a javascript Date object - */ - now(): Date; - } - /** - * Default time source, returns actual time - */ - export class RealTimeSource implements TimeSource { - now(): Date; - } -} - -declare module '__timezonecomplete/timezone' { - import javascript = require("__timezonecomplete/javascript"); - /** - * The type of time zone - */ - export enum TimeZoneKind { - /** - * Local time offset as determined by JavaScript Date class. - */ - Local = 0, - /** - * Fixed offset from UTC, without DST. - */ - Offset = 1, - /** - * IANA timezone managed through Olsen TZ database. Includes - * DST if applicable. - */ - Proper = 2, - } - /** - * Option for TimeZone#normalizeLocal() - */ - export enum NormalizeOption { - /** - * Normalize non-existing times by ADDING the DST offset - */ - Up = 0, - /** - * Normalize non-existing times by SUBTRACTING the DST offset - */ - Down = 1, - } - /** - * Time zone. The object is immutable because it is cached: - * requesting a time zone twice yields the very same object. - * Note that we use time zone offsets inverted w.r.t. JavaScript Date.getTimezoneOffset(), - * i.e. offset 90 means +01:30. - * - * Time zones come in three flavors: the local time zone, as calculated by JavaScript Date, - * a fixed offset ("+01:30") without DST, or a IANA timezone ("Europe/Amsterdam") with DST - * applied depending on the time zone rules. - */ - export class TimeZone { - /** - * The local time zone for a given date. Note that - * the time zone varies with the date: amsterdam time for - * 2014-01-01 is +01:00 and amsterdam time for 2014-07-01 is +02:00 - */ - static local(): TimeZone; - /** - * The UTC time zone. - */ - static utc(): TimeZone; - /** - * Returns a time zone object from the cache. If it does not exist, it is created. - * @return The time zone with the given offset w.r.t. UTC in minutes, e.g. 90 for +01:30 - */ - static zone(offset: number): TimeZone; - /** - * Returns a time zone object from the cache. If it does not exist, it is created. - * @param s: Empty string for local time, a TZ database time zone name (e.g. Europe/Amsterdam) - * or an offset string (either +01:30, +0130, +01, Z). For a full list of names, see: - * https://en.wikipedia.org/wiki/List_of_tz_database_time_zones - */ - static zone(s: string): TimeZone; - /** - * Do not use this constructor, use the static - * TimeZone.zone() method instead. - * @param name NORMALIZED name, assumed to be correct - */ - constructor(name: string); - /** - * The time zone identifier. Can be an offset "-01:30" or an - * IANA time zone name "Europe/Amsterdam", or "localtime" for - * the local time zone. - */ - name(): string; - /** - * The kind of time zone (Local/Offset/Proper) - */ - kind(): TimeZoneKind; - /** - * Equality operator. Maps zero offsets and different names for UTC onto - * each other. Other time zones are not mapped onto each other. - */ - equals(other: TimeZone): boolean; - /** - * Is this zone equivalent to UTC? - */ - isUtc(): boolean; - /** - * Does this zone have Daylight Saving Time at all? - */ - hasDst(): boolean; - /** - * Calculate timezone offset from a UTC time. - * @param year local full year - * @param month local month 1-12 (note this deviates from JavaScript date) - * @param day local day of month 1-31 - * @param hour local hour 0-23 - * @param minute local minute 0-59 - * @param second local second 0-59 - * @param millisecond local millisecond 0-999 - * @return the offset of this time zone with respect to UTC at the given time, in minutes. - */ - offsetForUtc(year: number, month: number, day: number, hour?: number, minute?: number, second?: number, millisecond?: number): number; - /** - * Calculate timezone offset from a zone-local time (NOT a UTC time). - * @param year local full year - * @param month local month 1-12 (note this deviates from JavaScript date) - * @param day local day of month 1-31 - * @param hour local hour 0-23 - * @param minute local minute 0-59 - * @param second local second 0-59 - * @param millisecond local millisecond 0-999 - * @return the offset of this time zone with respect to UTC at the given time, in minutes. - */ - offsetForZone(year: number, month: number, day: number, hour?: number, minute?: number, second?: number, millisecond?: number): number; - /** - * Note: will be removed in version 2.0.0 - * - * Convenience function, takes values from a Javascript Date - * Calls offsetForUtc() with the contents of the date - * - * @param date: the date - * @param funcs: the set of functions to use: get() or getUTC() - */ - offsetForUtcDate(date: Date, funcs: javascript.DateFunctions): number; - /** - * Note: will be removed in version 2.0.0 - * - * Convenience function, takes values from a Javascript Date - * Calls offsetForUtc() with the contents of the date - * - * @param date: the date - * @param funcs: the set of functions to use: get() or getUTC() - */ - offsetForZoneDate(date: Date, funcs: javascript.DateFunctions): number; - /** - * Normalizes non-existing local times by adding a forward offset change. - * During a forward standard offset change or DST offset change, some amount of - * local time is skipped. Therefore, this amount of local time does not exist. - * This function adds the amount of forward change to any non-existing time. After all, - * this is probably what the user meant. - * - * @param localUnixMillis Unix timestamp in zone time - * @param opt (optional) Round up or down? Default: up - * - * @returns Unix timestamp in zone time, normalized. - */ - normalizeZoneTime(localUnixMillis: number, opt?: NormalizeOption): number; - /** - * The time zone identifier (normalized). - * Either "localtime", IANA name, or "+hh:mm" offset. - */ - toString(): string; - /** - * Used by util.inspect() - */ - inspect(): string; - /** - * Convert an offset number into an offset string - * @param offset The offset in minutes from UTC e.g. 90 minutes - * @return the offset in ISO notation "+01:30" for +90 minutes - */ - static offsetToString(offset: number): string; - /** - * String to offset conversion. - * @param s Formats: "-01:00", "-0100", "-01", "Z" - * @return offset w.r.t. UTC in minutes - */ - static stringToOffset(s: string): number; - } -} - diff --git a/timezonecomplete/timezonecomplete-1.5.1-tests.ts b/timezonecomplete/timezonecomplete-1.5.1-tests.ts deleted file mode 100644 index c76db9836..000000000 --- a/timezonecomplete/timezonecomplete-1.5.1-tests.ts +++ /dev/null @@ -1,195 +0,0 @@ -/// - -import tc = require("timezonecomplete-1.5.1"); - -var b: boolean; -var n: number; -var s: string; -var w: tc.WeekDay; - -b = tc.isLeapYear(2014); -n = tc.daysInMonth(2014, 10); -n = tc.daysInYear(2014); -n = tc.dayOfYear(2014, 1, 2); -w = tc.firstWeekDayOfMonth(2014, 1, tc.WeekDay.Sunday); -w = tc.lastWeekDayOfMonth(2014, 1, tc.WeekDay.Sunday); -n = tc.weekDayOnOrAfter(2014, 1, 14, tc.WeekDay.Monday); -n = tc.weekDayOnOrBefore(2014, 1, 14, tc.WeekDay.Monday); -n = tc.secondOfDay(13, 59, 59); -n = tc.weekOfMonth(2014, 1, 1); - -// DURATION - -var d: tc.Duration; -var d1: tc.Duration = tc.Duration.hours(24); -var d2: tc.Duration = tc.Duration.minutes(24); -var d3: tc.Duration = tc.Duration.seconds(24); -var d4: tc.Duration = tc.Duration.milliseconds(24); -var d5: tc.Duration = new tc.Duration(24); -var d6: tc.Duration = new tc.Duration("00:01"); -var d7: tc.Duration = d6.clone(); - -n = d7.wholeHours(); -n = d7.hours(); -n = d7.minutes(); -n = d7.minute(); -n = d7.seconds(); -n = d7.second(); -n = d7.milliseconds(); -n = d7.millisecond(); -s = d7.sign(); -b = d7.lessThan(d6); -b = d7.greaterThan(d6); -d = d7.min(d6); -d = d7.max(d6); -d = d7.multiply(3); -d = d7.divide(0.3); -d = d7.add(d6); -d = d7.sub(d6); -s = d7.toString(); - -// TIMEZONE - -var t: tc.TimeZone; -var k: tc.TimeZoneKind; - -t = tc.TimeZone.local(); -t = tc.TimeZone.utc(); -t = tc.TimeZone.zone(2); -t = tc.TimeZone.zone("+01:00"); -s = t.name(); -k = t.kind(); -b = t.equals(t); -b = t.isUtc(); -n = t.offsetForUtc(2014, 1, 1, 13, 0, 5, 123); -n = t.offsetForZone(2014, 1, 1, 13, 0, 5, 123); -n = t.offsetForUtcDate(new Date(2014, 1, 1, 13, 0, 5, 123), tc.DateFunctions.Get); -n = t.offsetForZoneDate(new Date(2014, 1, 1, 13, 0, 5, 123), tc.DateFunctions.GetUTC); -s = t.toString(); -s = tc.TimeZone.offsetToString(2); -n = tc.TimeZone.stringToOffset("+00:01"); - -// REALTIMESOURCE - -var date: Date = (new tc.RealTimeSource()).now(); - -// DATETIME - -var dt: tc.DateTime; - -var ts: tc.TimeSource = tc.DateTime.timeSource; - -dt = tc.DateTime.nowLocal(); -dt = tc.DateTime.nowUtc(); -dt = tc.DateTime.now(tc.TimeZone.local()); -dt = new tc.DateTime(); -dt = new tc.DateTime("2014-01-01T13:05:01.123 UTC"); -dt = new tc.DateTime("2014-01-01T13:05:01.123", tc.TimeZone.utc()); -dt = new tc.DateTime(date, tc.DateFunctions.Get); -dt = new tc.DateTime(date, tc.DateFunctions.Get, tc.TimeZone.utc()); -dt = new tc.DateTime(2014, 1, 1, 13, 5, 1, 123); -dt = new tc.DateTime(2014, 1, 1, 13, 5, 1, 123, tc.TimeZone.utc()); -dt = new tc.DateTime(89949284); -dt = new tc.DateTime(89949284, tc.TimeZone.utc()); -dt = dt.clone(); -t = dt.zone(); -n = dt.offset(); -n = dt.year(); -n = dt.month(); -n = dt.day(); -n = dt.hour(); -n = dt.minute(); -n = dt.second(); -n = dt.weekNumber(); -n = dt.weekOfMonth(); -n = dt.secondOfDay(); -n = dt.dayOfYear(); -n = dt.millisecond(); -n = dt.unixUtcMillis(); -n = dt.utcYear(); -n = dt.utcMonth(); -n = dt.utcDay(); -n = dt.utcHour(); -n = dt.utcMinute(); -n = dt.utcSecond(); -n = dt.utcMillisecond(); -n = dt.utcWeekNumber(); -n = dt.utcWeekOfMonth(); -n = dt.utcSecondOfDay(); -n = dt.utcDayOfYear(); -s = dt.format("%Y-%m-%d"); -dt.convert(tc.TimeZone.local()); -dt = dt.toZone(tc.TimeZone.utc()); -date = dt.toDate(); -dt = dt.add(tc.Duration.seconds(2)); -dt = dt.add(2, tc.TimeUnit.Year); -dt = dt.add(2, tc.TimeUnit.Month); -dt = dt.add(2, tc.TimeUnit.Week); -dt = dt.add(2, tc.TimeUnit.Day); -dt = dt.add(2, tc.TimeUnit.Hour); -dt = dt.add(2, tc.TimeUnit.Minute); -dt = dt.add(2, tc.TimeUnit.Second); -dt = dt.addLocal(2, tc.TimeUnit.Second); -dt = dt.sub(tc.Duration.seconds(2)); -dt = dt.sub(2, tc.TimeUnit.Year); -dt = dt.sub(2, tc.TimeUnit.Month); -dt = dt.sub(2, tc.TimeUnit.Week); -dt = dt.sub(2, tc.TimeUnit.Day); -dt = dt.sub(2, tc.TimeUnit.Hour); -dt = dt.sub(2, tc.TimeUnit.Minute); -dt = dt.sub(2, tc.TimeUnit.Second); -dt = dt.subLocal(2, tc.TimeUnit.Second); -d = dt.diff(new tc.DateTime(9289234, tc.TimeZone.local())); -b = dt.lessThan(new tc.DateTime(9289234, tc.TimeZone.local())); -b = dt.lessEqual(new tc.DateTime(9289234, tc.TimeZone.local())); -b = dt.greaterThan(new tc.DateTime(9289234, tc.TimeZone.local())); -b = dt.greaterEqual(new tc.DateTime(9289234, tc.TimeZone.local())); -s = dt.toIsoString(); -s = dt.toString(); -s = dt.toUtcString(); - -var wd: tc.WeekDay; -wd = dt.weekDay(); -wd = dt.utcWeekDay(); - -// PERIOD - -s = tc.periodDstToString(tc.PeriodDst.RegularIntervals); -s = tc.periodDstToString(tc.PeriodDst.RegularLocalTime); - -var p: tc.Period; - -p = new tc.Period(tc.DateTime.nowLocal(), 1, tc.TimeUnit.Hour, tc.PeriodDst.RegularLocalTime); -dt = p.start(); -n = p.amount(); -var tu: tc.TimeUnit = p.unit(); -var pd: tc.PeriodDst = p.dst(); -dt = p.findFirst(tc.DateTime.nowLocal()); -dt = p.findNext(dt); -s = p.toIsoString(); -s = p.toString(); - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/timezonecomplete/timezonecomplete-1.5.1.d.ts b/timezonecomplete/timezonecomplete-1.5.1.d.ts deleted file mode 100644 index bfe0a2bec..000000000 --- a/timezonecomplete/timezonecomplete-1.5.1.d.ts +++ /dev/null @@ -1,1127 +0,0 @@ -// Type definitions for timezonecomplete 1.5.1 -// Project: https://github.com/SpiritIT/timezonecomplete -// Definitions by: Rogier Schouten -// Definitions: https://github.com/borisyankov/DefinitelyTyped -// Generated by dts-bundle v0.2.0 - -declare module 'timezonecomplete-1.5.1' { - import basics = require("__timezonecomplete/basics"); - export import TimeUnit = basics.TimeUnit; - export import WeekDay = basics.WeekDay; - export import isLeapYear = basics.isLeapYear; - export import daysInMonth = basics.daysInMonth; - export import daysInYear = basics.daysInYear; - export import firstWeekDayOfMonth = basics.firstWeekDayOfMonth; - export import lastWeekDayOfMonth = basics.lastWeekDayOfMonth; - export import weekDayOnOrAfter = basics.weekDayOnOrAfter; - export import weekDayOnOrBefore = basics.weekDayOnOrBefore; - export import weekNumber = basics.weekNumber; - export import weekOfMonth = basics.weekOfMonth; - export import dayOfYear = basics.dayOfYear; - export import secondOfDay = basics.secondOfDay; - import datetime = require("__timezonecomplete/datetime"); - export import DateTime = datetime.DateTime; - import duration = require("__timezonecomplete/duration"); - export import Duration = duration.Duration; - import javascript = require("__timezonecomplete/javascript"); - export import DateFunctions = javascript.DateFunctions; - import period = require("__timezonecomplete/period"); - export import Period = period.Period; - export import PeriodDst = period.PeriodDst; - export import periodDstToString = period.periodDstToString; - import timesource = require("__timezonecomplete/timesource"); - export import TimeSource = timesource.TimeSource; - export import RealTimeSource = timesource.RealTimeSource; - import timezone = require("__timezonecomplete/timezone"); - export import NormalizeOption = timezone.NormalizeOption; - export import TimeZoneKind = timezone.TimeZoneKind; - export import TimeZone = timezone.TimeZone; -} - -declare module '__timezonecomplete/basics' { - import javascript = require("__timezonecomplete/javascript"); - /** - * Day-of-week. Note the enum values correspond to JavaScript day-of-week: - * Sunday = 0, Monday = 1 etc - */ - export enum WeekDay { - Sunday = 0, - Monday = 1, - Tuesday = 2, - Wednesday = 3, - Thursday = 4, - Friday = 5, - Saturday = 6, - } - /** - * Time units - */ - export enum TimeUnit { - Second = 0, - Minute = 1, - Hour = 2, - Day = 3, - Week = 4, - Month = 5, - Year = 6, - } - /** - * @return True iff the given year is a leap year. - */ - export function isLeapYear(year: number): boolean; - /** - * The days in a given year - */ - export function daysInYear(year: number): number; - /** - * @param year The full year - * @param month The month 1-12 - * @return The number of days in the given month - */ - export function daysInMonth(year: number, month: number): number; - /** - * Returns the day of the year of the given date [0..365]. January first is 0. - * - * @param year The year e.g. 1986 - * @param month Month 1-12 - * @param day Day of month 1-31 - */ - export function dayOfYear(year: number, month: number, day: number): number; - /** - * Returns the last instance of the given weekday in the given month - * - * @param year The year - * @param month the month 1-12 - * @param weekDay the desired week day - * - * @return the last occurrence of the week day in the month - */ - export function lastWeekDayOfMonth(year: number, month: number, weekDay: WeekDay): number; - /** - * Returns the first instance of the given weekday in the given month - * - * @param year The year - * @param month the month 1-12 - * @param weekDay the desired week day - * - * @return the first occurrence of the week day in the month - */ - export function firstWeekDayOfMonth(year: number, month: number, weekDay: WeekDay): number; - /** - * Returns the day-of-month that is on the given weekday and which is >= the given day. - * Throws if the month has no such day. - */ - export function weekDayOnOrAfter(year: number, month: number, day: number, weekDay: WeekDay): number; - /** - * Returns the day-of-month that is on the given weekday and which is <= the given day. - * Throws if the month has no such day. - */ - export function weekDayOnOrBefore(year: number, month: number, day: number, weekDay: WeekDay): number; - export function weekOfMonth(year: number, month: number, day: number): number; - /** - * The ISO 8601 week number for the given date. Week 1 is the week - * that has January 4th in it, and it starts on Monday. - * See https://en.wikipedia.org/wiki/ISO_week_date - * - * @param year Year e.g. 1988 - * @param month Month 1-12 - * @param day Day of month 1-31 - * - * @return Week number 1-53 - */ - export function weekNumber(year: number, month: number, day: number): number; - /** - * Convert a unix milli timestamp into a TimeT structure. - * This does NOT take leap seconds into account. - */ - export function unixToTimeNoLeapSecs(unixMillis: number): TimeStruct; - /** - * Convert a year, month, day etc into a unix milli timestamp. - * This does NOT take leap seconds into account. - * - * @param year Year e.g. 1970 - * @param month Month 1-12 - * @param day Day 1-31 - * @param hour Hour 0-23 - * @param minute Minute 0-59 - * @param second Second 0-59 (no leap seconds) - * @param milli Millisecond 0-999 - */ - export function timeToUnixNoLeapSecs(year?: number, month?: number, day?: number, hour?: number, minute?: number, second?: number, milli?: number): number; - /** - * Convert a TimeT structure into a unix milli timestamp. - * This does NOT take leap seconds into account. - */ - export function timeToUnixNoLeapSecs(tm: TimeStruct): number; - /** - * Return the day-of-week. - * This does NOT take leap seconds into account. - */ - export function weekDayNoLeapSecs(unixMillis: number): WeekDay; - /** - * N-th second in the day, counting from 0 - */ - export function secondOfDay(hour: number, minute: number, second: number): number; - /** - * Basic representation of a date and time - */ - export class TimeStruct { - /** - * Year, 1970-... - */ - year: number; - /** - * Month 1-12 - */ - month: number; - /** - * Day of month, 1-31 - */ - day: number; - /** - * Hour 0-23 - */ - hour: number; - /** - * Minute 0-59 - */ - minute: number; - /** - * Seconds, 0-59 - */ - second: number; - /** - * Milliseconds 0-999 - */ - milli: number; - /** - * Create a TimeStruct from a number of unix milliseconds - */ - static fromUnix(unixMillis: number): TimeStruct; - /** - * Create a TimeStruct from a JavaScript date - * - * @param d The date - * @param df Which functions to take (getX() or getUTCX()) - */ - static fromDate(d: Date, df: javascript.DateFunctions): TimeStruct; - /** - * Returns a TimeStruct from an ISO 8601 string WITHOUT time zone - */ - static fromString(s: string): TimeStruct; - /** - * Constructor - * - * @param year Year e.g. 1970 - * @param month Month 1-12 - * @param day Day 1-31 - * @param hour Hour 0-23 - * @param minute Minute 0-59 - * @param second Second 0-59 (no leap seconds) - * @param milli Millisecond 0-999 - */ - constructor(/** - * Year, 1970-... - */ - year?: number, /** - * Month 1-12 - */ - month?: number, /** - * Day of month, 1-31 - */ - day?: number, /** - * Hour 0-23 - */ - hour?: number, /** - * Minute 0-59 - */ - minute?: number, /** - * Seconds, 0-59 - */ - second?: number, /** - * Milliseconds 0-999 - */ - milli?: number); - /** - * Validate a TimeStruct, returns false if invalid. - */ - validate(): boolean; - /** - * The day-of-year 0-365 - */ - yearDay(): number; - /** - * Returns this time as a unix millisecond timestamp - * Does NOT take leap seconds into account. - */ - toUnixNoLeapSecs(): number; - /** - * Deep equals - */ - equals(other: TimeStruct): boolean; - /** - * < operator - */ - lessThan(other: TimeStruct): boolean; - clone(): TimeStruct; - valueOf(): number; - /** - * ISO 8601 string YYYY-MM-DDThh:mm:ss.nnn - */ - toString(): string; - inspect(): string; - } -} - -declare module '__timezonecomplete/datetime' { - import basics = require("__timezonecomplete/basics"); - import duration = require("__timezonecomplete/duration"); - import javascript = require("__timezonecomplete/javascript"); - import timesource = require("__timezonecomplete/timesource"); - import timezone = require("__timezonecomplete/timezone"); - /** - * DateTime class which is time zone-aware - * and which can be mocked for testing purposes. - */ - export class DateTime { - /** - * Actual time source in use. Setting this property allows to - * fake time in tests. DateTime.nowLocal() and DateTime.nowUtc() - * use this property for obtaining the current time. - */ - static timeSource: timesource.TimeSource; - /** - * Current date+time in local time (derived from DateTime.timeSource.now()). - */ - static nowLocal(): DateTime; - /** - * Current date+time in UTC time (derived from DateTime.timeSource.now()). - */ - static nowUtc(): DateTime; - /** - * Current date+time in the given time zone (derived from DateTime.timeSource.now()). - * @param timeZone The desired time zone. - */ - static now(timeZone: timezone.TimeZone): DateTime; - /** - * Constructor. Creates current time in local timezone. - */ - constructor(); - /** - * Constructor - * Non-existing local times are normalized by rounding up to the next DST offset. - * - * @param isoString String in ISO 8601 format. Instead of ISO time zone, - * it may include a space and then and IANA time zone. - * e.g. "2007-04-05T12:30:40.500" (no time zone, naive date) - * e.g. "2007-04-05T12:30:40.500+01:00" (UTC offset without daylight saving time) - * or "2007-04-05T12:30:40.500Z" (UTC) - * or "2007-04-05T12:30:40.500 Europe/Amsterdam" (IANA time zone, with daylight saving time if applicable) - * @param timeZone if given, the date in the string is assumed to be in this time zone. - * Note that it is NOT CONVERTED to the time zone. Useful - * for strings without a time zone - */ - constructor(isoString: string, timeZone?: timezone.TimeZone); - /** - * Constructor. You provide a date, then you say whether to take the - * date.getYear()/getXxx methods or the date.getUTCYear()/date.getUTCXxx methods, - * and then you state which time zone that date is in. - * Non-existing local times are normalized by rounding up to the next DST offset. - * Note that the Date class has bugs and inconsistencies when constructing them with times around - * DST changes. - * - * @param date A date object. - * @param getters Specifies which set of Date getters contains the date in the given time zone: the - * Date.getXxx() methods or the Date.getUTCXxx() methods. - * @param timeZone The time zone that the given date is assumed to be in (may be null for unaware dates) - */ - constructor(date: Date, getFuncs: javascript.DateFunctions, timeZone?: timezone.TimeZone); - /** - * Constructor. Note that unlike JavaScript dates we require fields to be in normal ranges. - * Use the add(duration) or sub(duration) for arithmetic. - * @param year The full year (e.g. 2014) - * @param month The month [1-12] (note this deviates from JavaScript Date) - * @param day The day of the month [1-31] - * @param hour The hour of the day [0-24) - * @param minute The minute of the hour [0-59] - * @param second The second of the minute [0-59] - * @param millisecond The millisecond of the second [0-999] - * @param timeZone The time zone, or null (for unaware dates) - */ - constructor(year: number, month: number, day: number, hour?: number, minute?: number, second?: number, millisecond?: number, timeZone?: timezone.TimeZone); - /** - * Constructor - * @param unixTimestamp milliseconds since 1970-01-01T00:00:00.000 - * @param timeZone the time zone that the timestamp is assumed to be in (usually UTC). - */ - constructor(unixTimestamp: number, timeZone?: timezone.TimeZone); - /** - * @return a copy of this object - */ - clone(): DateTime; - /** - * @return The time zone that the date is in. May be null for unaware dates. - */ - zone(): timezone.TimeZone; - /** - * Zone name abbreviation at this time - * @param dstDependent (default true) set to false for a DST-agnostic abbreviation - * @return The abbreviation - */ - zoneAbbreviation(dstDependent?: boolean): string; - /** - * @return the offset w.r.t. UTC in minutes. Returns 0 for unaware dates and for UTC dates. - */ - offset(): number; - /** - * @return The full year e.g. 2014 - */ - year(): number; - /** - * @return The month 1-12 (note this deviates from JavaScript Date) - */ - month(): number; - /** - * @return The day of the month 1-31 - */ - day(): number; - /** - * @return The hour 0-23 - */ - hour(): number; - /** - * @return the minutes 0-59 - */ - minute(): number; - /** - * @return the seconds 0-59 - */ - second(): number; - /** - * @return the milliseconds 0-999 - */ - millisecond(): number; - /** - * @return the day-of-week (the enum values correspond to JavaScript - * week day numbers) - */ - weekDay(): basics.WeekDay; - /** - * Returns the day number within the year: Jan 1st has number 0, - * Jan 2nd has number 1 etc. - * - * @return the day-of-year [0-366] - */ - dayOfYear(): number; - /** - * The ISO 8601 week number. Week 1 is the week - * that has January 4th in it, and it starts on Monday. - * See https://en.wikipedia.org/wiki/ISO_week_date - * - * @return Week number [1-53] - */ - weekNumber(): number; - /** - * The week of this month. There is no official standard for this, - * but we assume the same rules for the weekNumber (i.e. - * week 1 is the week that has the 4th day of the month in it) - * - * @return Week number [1-5] - */ - weekOfMonth(): number; - /** - * Returns the number of seconds that have passed on the current day - * Does not consider leap seconds - * - * @return seconds [0-86399] - */ - secondOfDay(): number; - /** - * @return Milliseconds since 1970-01-01T00:00:00.000Z - */ - unixUtcMillis(): number; - /** - * @return The full year e.g. 2014 - */ - utcYear(): number; - /** - * @return The UTC month 1-12 (note this deviates from JavaScript Date) - */ - utcMonth(): number; - /** - * @return The UTC day of the month 1-31 - */ - utcDay(): number; - /** - * @return The UTC hour 0-23 - */ - utcHour(): number; - /** - * @return The UTC minutes 0-59 - */ - utcMinute(): number; - /** - * @return The UTC seconds 0-59 - */ - utcSecond(): number; - /** - * Returns the UTC day number within the year: Jan 1st has number 0, - * Jan 2nd has number 1 etc. - * - * @return the day-of-year [0-366] - */ - utcDayOfYear(): number; - /** - * @return The UTC milliseconds 0-999 - */ - utcMillisecond(): number; - /** - * @return the UTC day-of-week (the enum values correspond to JavaScript - * week day numbers) - */ - utcWeekDay(): basics.WeekDay; - /** - * The ISO 8601 UTC week number. Week 1 is the week - * that has January 4th in it, and it starts on Monday. - * See https://en.wikipedia.org/wiki/ISO_week_date - * - * @return Week number [1-53] - */ - utcWeekNumber(): number; - /** - * The week of this month. There is no official standard for this, - * but we assume the same rules for the weekNumber (i.e. - * week 1 is the week that has the 4th day of the month in it) - * - * @return Week number [1-5] - */ - utcWeekOfMonth(): number; - /** - * Returns the number of seconds that have passed on the current day - * Does not consider leap seconds - * - * @return seconds [0-86399] - */ - utcSecondOfDay(): number; - /** - * Convert this date to the given time zone (in-place). - * Throws if this date does not have a time zone. - * @return this (for chaining) - */ - convert(zone?: timezone.TimeZone): DateTime; - /** - * Returns this date converted to the given time zone. - * Unaware dates can only be converted to unaware dates (clone) - * Converting an unaware date to an aware date throws an exception. Use the constructor - * if you really need to do that. - * - * @param zone The new time zone. This may be null to create unaware date. - * @return The converted date - */ - toZone(zone?: timezone.TimeZone): DateTime; - /** - * Convert to JavaScript date with the zone time in the getX() methods. - * Unless the timezone is local, the Date.getUTCX() methods will NOT be correct. - * This is because Date calculates getUTCX() from getX() applying local time zone. - */ - toDate(): Date; - /** - * Add a time duration relative to UTC. Note that this simply adds a number - * of milliseconds to UTC and converts back to zone(), - * There is not DST handling. - * @return this + duration - */ - add(duration: duration.Duration): DateTime; - /** - * Add an amount of time relative to UTC, as regularly as possible. - * - * Adding e.g. 1 hour will increment the utcHour() field, adding 1 month - * increments the utcMonth() field. - * Adding an amount of units leaves lower units intact. E.g. - * adding a month will leave the day() field untouched if possible. - * - * Note adding Months or Years will clamp the date to the end-of-month if - * the start date was at the end of a month, i.e. contrary to JavaScript - * Date#setUTCMonth() it will not overflow into the next month - * - * In case of DST changes, the utc time fields are still untouched but local - * time fields may shift. - */ - add(amount: number, unit: basics.TimeUnit): DateTime; - /** - * Add an amount of time to the zone time, as regularly as possible. - * - * Adding e.g. 1 hour will increment the hour() field of the zone - * date by one. In case of DST changes, the time fields may additionally - * increase by the DST offset, if a non-existing local time would - * be reached otherwise. - * - * Adding a unit of time will leave lower-unit fields intact, unless the result - * would be a non-existing time. Then an extra DST offset is added. - * - * Note adding Months or Years will clamp the date to the end-of-month if - * the start date was at the end of a month, i.e. contrary to JavaScript - * Date#setUTCMonth() it will not overflow into the next month - */ - addLocal(amount: number, unit: basics.TimeUnit): DateTime; - /** - * Same as add(-1*duration); - */ - sub(duration: duration.Duration): DateTime; - /** - * Same as add(-1*amount, unit); - */ - sub(amount: number, unit: basics.TimeUnit): DateTime; - /** - * Same as addLocal(-1*amount, unit); - */ - subLocal(amount: number, unit: basics.TimeUnit): DateTime; - /** - * Time difference between two DateTimes - * @return this - other - */ - diff(other: DateTime): duration.Duration; - /** - * @return True iff (this < other) - */ - lessThan(other: DateTime): boolean; - /** - * @return True iff (this <= other) - */ - lessEqual(other: DateTime): boolean; - /** - * @return True iff this and other represent the same time in UTC - */ - equals(other: DateTime): boolean; - /** - * @return True iff this and other represent the same time and - * have the same zone - */ - identical(other: DateTime): boolean; - /** - * @return True iff this > other - */ - greaterThan(other: DateTime): boolean; - /** - * @return True iff this >= other - */ - greaterEqual(other: DateTime): boolean; - /** - * Proper ISO 8601 format string with any IANA zone converted to ISO offset - * E.g. "2014-01-01T23:15:33+01:00" for Europe/Amsterdam - */ - toIsoString(): string; - format(formatString: string): string; - /** - * Modified ISO 8601 format string with IANA name if applicable. - * E.g. "2014-01-01T23:15:33.000 Europe/Amsterdam" - */ - toString(): string; - /** - * Used by util.inspect() - */ - inspect(): string; - /** - * The valueOf() method returns the primitive value of the specified object. - */ - valueOf(): any; - /** - * Modified ISO 8601 format string in UTC without time zone info - */ - toUtcString(): string; - } -} - -declare module '__timezonecomplete/duration' { - /** - * Time duration. Create one e.g. like this: var d = Duration.hours(1). - * Note that time durations do not take leap seconds etc. into account: - * one hour is simply represented as 3600000 milliseconds. - */ - export class Duration { - /** - * Construct a time duration - * @param n Number of hours - * @return A duration of n hours - */ - static hours(n: number): Duration; - /** - * Construct a time duration - * @param n Number of minutes - * @return A duration of n minutes - */ - static minutes(n: number): Duration; - /** - * Construct a time duration - * @param n Number of seconds - * @return A duration of n seconds - */ - static seconds(n: number): Duration; - /** - * Construct a time duration - * @param n Number of milliseconds - * @return A duration of n milliseconds - */ - static milliseconds(n: number): Duration; - /** - * Construct a time duration of 0 - */ - constructor(); - /** - * Construct a time duration from a number of milliseconds - */ - constructor(milliseconds: number); - /** - * Construct a time duration from a string in format - * [-]h[:m[:s[.n]]] e.g. -01:00:30.501 - */ - constructor(input: string); - /** - * @return another instance of Duration with the same value. - */ - clone(): Duration; - /** - * The entire duration in milliseconds (negative or positive) - */ - milliseconds(): number; - /** - * The millisecond part of the duration (always positive) - * @return e.g. 400 for a -01:02:03.400 duration - */ - millisecond(): number; - /** - * The entire duration in seconds (negative or positive, fractional) - * @return e.g. 1.5 for a 1500 milliseconds duration - */ - seconds(): number; - /** - * The second part of the duration (always positive) - * @return e.g. 3 for a -01:02:03.400 duration - */ - second(): number; - /** - * The entire duration in minutes (negative or positive, fractional) - * @return e.g. 1.5 for a 90000 milliseconds duration - */ - minutes(): number; - /** - * The minute part of the duration (always positive) - * @return e.g. 2 for a -01:02:03.400 duration - */ - minute(): number; - /** - * The entire duration in hours (negative or positive, fractional) - * @return e.g. 1.5 for a 5400000 milliseconds duration - */ - hours(): number; - /** - * The hour part of the duration (always positive). - * Note that this part can exceed 23 hours, because for - * now, we do not have a days() function - * @return e.g. 25 for a -25:02:03.400 duration - */ - wholeHours(): number; - /** - * Sign - * @return "-" if the duration is negative - */ - sign(): string; - /** - * @return True iff (this < other) - */ - lessThan(other: Duration): boolean; - /** - * @return True iff this and other represent the same time duration - */ - equals(other: Duration): boolean; - /** - * @return True iff this > other - */ - greaterThan(other: Duration): boolean; - /** - * @return The minimum (most negative) of this and other - */ - min(other: Duration): Duration; - /** - * @return The maximum (most positive) of this and other - */ - max(other: Duration): Duration; - /** - * Multiply with a fixed number. - * @return a new Duration of (this * value) - */ - multiply(value: number): Duration; - /** - * Divide by a fixed number. - * @return a new Duration of (this / value) - */ - divide(value: number): Duration; - /** - * Add a duration. - * @return a new Duration of (this + value) - */ - add(value: Duration): Duration; - /** - * Subtract a duration. - * @return a new Duration of (this - value) - */ - sub(value: Duration): Duration; - /** - * String in [-]hh:mm:ss.nnn notation. All fields are - * always present except the sign. - */ - toFullString(): string; - /** - * String in [-]hh[:mm[:ss[.nnn]]] notation. Fields are - * added as necessary - */ - toString(): string; - /** - * Used by util.inspect() - */ - inspect(): string; - /** - * The valueOf() method returns the primitive value of the specified object. - */ - valueOf(): any; - } -} - -declare module '__timezonecomplete/javascript' { - /** - * Indicates how a Date object should be interpreted. - * Either we can take getYear(), getMonth() etc for our field - * values, or we can take getUTCYear(), getUtcMonth() etc to do that. - */ - export enum DateFunctions { - /** - * Use the Date.getFullYear(), Date.getMonth(), ... functions. - */ - Get = 0, - /** - * Use the Date.getUTCFullYear(), Date.getUTCMonth(), ... functions. - */ - GetUTC = 1, - } -} - -declare module '__timezonecomplete/period' { - import basics = require("__timezonecomplete/basics"); - import datetime = require("__timezonecomplete/datetime"); - /** - * Specifies how the period should repeat across the day - * during DST changes. - */ - export enum PeriodDst { - /** - * Keep repeating in similar intervals measured in UTC, - * unaffected by Daylight Saving Time. - * E.g. a repetition of one hour will take one real hour - * every time, even in a time zone with DST. - * Leap seconds, leap days and month length - * differences will still make the intervals different. - */ - RegularIntervals = 0, - /** - * Ensure that the time at which the intervals occur stay - * at the same place in the day, local time. So e.g. - * a period of one day, starting at 8:05AM Europe/Amsterdam time - * will always start at 8:05 Europe/Amsterdam. This means that - * in UTC time, some intervals will be 25 hours and some - * 23 hours during DST changes. - * Another example: an hourly interval will be hourly in local time, - * skipping an hour in UTC for a DST backward change. - */ - RegularLocalTime = 1, - } - /** - * Convert a PeriodDst to a string: "regular intervals" or "regular local time" - */ - export function periodDstToString(p: PeriodDst): string; - /** - * Repeating time period: consists of a starting point and - * a time length. This class accounts for leap seconds and leap days. - */ - export class Period { - /** - * Constructor - * LIMITATION: if dst equals RegularLocalTime, and unit is Second, Minute or Hour, - * then the amount must be a factor of 24. So 120 seconds is allowed while 121 seconds is not. - * This is due to the enormous processing power required by these cases. They are not - * implemented and you will get an assert. - * - * @param start The start of the period. If the period is in Months or Years, and - * the day is 29 or 30 or 31, the results are maximised to end-of-month. - * @param amount The amount of units. - * @param unit The unit. - * @param dst Specifies how to handle Daylight Saving Time. Not relevant - * if the time zone of the start datetime does not have DST. - */ - constructor(start: datetime.DateTime, amount: number, unit: basics.TimeUnit, dst: PeriodDst); - /** - * The start date - */ - start(): datetime.DateTime; - /** - * The amount of units - */ - amount(): number; - /** - * The unit - */ - unit(): basics.TimeUnit; - /** - * The dst handling mode - */ - dst(): PeriodDst; - /** - * The first occurrence of the period greater than - * the given date. The given date need not be at a period boundary. - * Pre: the fromdate and startdate must either both have timezones or not - * @param fromDate: the date after which to return the next date - * @return the first date matching the period after fromDate, given - * in the same zone as the fromDate. - */ - findFirst(fromDate: datetime.DateTime): datetime.DateTime; - /** - * Returns the next timestamp in the period. The given timestamp must - * be at a period boundary, otherwise the answer is incorrect. - * This function has MUCH better performance than findFirst. - * Returns the datetime "count" times away from the given datetime. - * @param prev Boundary date. Must have a time zone (any time zone) iff the period start date has one. - * @param count Optional, must be >= 1 and whole. - * @return (prev + count * period), in the same timezone as prev. - */ - findNext(prev: datetime.DateTime, count?: number): datetime.DateTime; - /** - * Returns an ISO duration string e.g. - * 2014-01-01T12:00:00.000+01:00/P1H - * 2014-01-01T12:00:00.000+01:00/PT1M (one minute) - * 2014-01-01T12:00:00.000+01:00/P1M (one month) - */ - toIsoString(): string; - /** - * A string representation e.g. - * "10 years, starting at 2014-03-01T12:00:00 Europe/Amsterdam, keeping regular intervals". - */ - toString(): string; - /** - * Used by util.inspect() - */ - inspect(): string; - } -} - -declare module '__timezonecomplete/timesource' { - /** - * For testing purposes, we often need to manipulate what the current - * time is. This is an interface for a custom time source object - * so in tests you can use a custom time source. - */ - export interface TimeSource { - /** - * Return the current date+time as a javascript Date object - */ - now(): Date; - } - /** - * Default time source, returns actual time - */ - export class RealTimeSource implements TimeSource { - now(): Date; - } -} - -declare module '__timezonecomplete/timezone' { - import javascript = require("__timezonecomplete/javascript"); - /** - * The type of time zone - */ - export enum TimeZoneKind { - /** - * Local time offset as determined by JavaScript Date class. - */ - Local = 0, - /** - * Fixed offset from UTC, without DST. - */ - Offset = 1, - /** - * IANA timezone managed through Olsen TZ database. Includes - * DST if applicable. - */ - Proper = 2, - } - /** - * Option for TimeZone#normalizeLocal() - */ - export enum NormalizeOption { - /** - * Normalize non-existing times by ADDING the DST offset - */ - Up = 0, - /** - * Normalize non-existing times by SUBTRACTING the DST offset - */ - Down = 1, - } - /** - * Time zone. The object is immutable because it is cached: - * requesting a time zone twice yields the very same object. - * Note that we use time zone offsets inverted w.r.t. JavaScript Date.getTimezoneOffset(), - * i.e. offset 90 means +01:30. - * - * Time zones come in three flavors: the local time zone, as calculated by JavaScript Date, - * a fixed offset ("+01:30") without DST, or a IANA timezone ("Europe/Amsterdam") with DST - * applied depending on the time zone rules. - */ - export class TimeZone { - /** - * The local time zone for a given date. Note that - * the time zone varies with the date: amsterdam time for - * 2014-01-01 is +01:00 and amsterdam time for 2014-07-01 is +02:00 - */ - static local(): TimeZone; - /** - * The UTC time zone. - */ - static utc(): TimeZone; - /** - * Returns a time zone object from the cache. If it does not exist, it is created. - * @return The time zone with the given offset w.r.t. UTC in minutes, e.g. 90 for +01:30 - */ - static zone(offset: number): TimeZone; - /** - * Returns a time zone object from the cache. If it does not exist, it is created. - * @param s: Empty string for local time, a TZ database time zone name (e.g. Europe/Amsterdam) - * or an offset string (either +01:30, +0130, +01, Z). For a full list of names, see: - * https://en.wikipedia.org/wiki/List_of_tz_database_time_zones - */ - static zone(s: string): TimeZone; - /** - * Do not use this constructor, use the static - * TimeZone.zone() method instead. - * @param name NORMALIZED name, assumed to be correct - */ - constructor(name: string); - /** - * The time zone identifier. Can be an offset "-01:30" or an - * IANA time zone name "Europe/Amsterdam", or "localtime" for - * the local time zone. - */ - name(): string; - /** - * The kind of time zone (Local/Offset/Proper) - */ - kind(): TimeZoneKind; - /** - * Equality operator. Maps zero offsets and different names for UTC onto - * each other. Other time zones are not mapped onto each other. - */ - equals(other: TimeZone): boolean; - /** - * Is this zone equivalent to UTC? - */ - isUtc(): boolean; - /** - * Does this zone have Daylight Saving Time at all? - */ - hasDst(): boolean; - /** - * Calculate timezone offset from a UTC time. - * - * @param year Full year - * @param month Month 1-12 (note this deviates from JavaScript date) - * @param day Day of month 1-31 - * @param hour Hour 0-23 - * @param minute Minute 0-59 - * @param second Second 0-59 - * @param millisecond Millisecond 0-999 - * - * @return the offset of this time zone with respect to UTC at the given time, in minutes. - */ - offsetForUtc(year: number, month: number, day: number, hour?: number, minute?: number, second?: number, millisecond?: number): number; - /** - * Calculate timezone offset from a zone-local time (NOT a UTC time). - * @param year local full year - * @param month local month 1-12 (note this deviates from JavaScript date) - * @param day local day of month 1-31 - * @param hour local hour 0-23 - * @param minute local minute 0-59 - * @param second local second 0-59 - * @param millisecond local millisecond 0-999 - * @return the offset of this time zone with respect to UTC at the given time, in minutes. - */ - offsetForZone(year: number, month: number, day: number, hour?: number, minute?: number, second?: number, millisecond?: number): number; - /** - * Note: will be removed in version 2.0.0 - * - * Convenience function, takes values from a Javascript Date - * Calls offsetForUtc() with the contents of the date - * - * @param date: the date - * @param funcs: the set of functions to use: get() or getUTC() - */ - offsetForUtcDate(date: Date, funcs: javascript.DateFunctions): number; - /** - * Note: will be removed in version 2.0.0 - * - * Convenience function, takes values from a Javascript Date - * Calls offsetForUtc() with the contents of the date - * - * @param date: the date - * @param funcs: the set of functions to use: get() or getUTC() - */ - offsetForZoneDate(date: Date, funcs: javascript.DateFunctions): number; - /** - * Zone abbreviation at given UTC timestamp e.g. CEST for Central European Summer Time. - * - * @param year Full year - * @param month Month 1-12 (note this deviates from JavaScript date) - * @param day Day of month 1-31 - * @param hour Hour 0-23 - * @param minute Minute 0-59 - * @param second Second 0-59 - * @param millisecond Millisecond 0-999 - * @param dstDependent (default true) set to false for a DST-agnostic abbreviation - * - * @return "local" for local timezone, the offset for an offset zone, or the abbreviation for a proper zone. - */ - abbreviationForUtc(year: number, month: number, day: number, hour?: number, minute?: number, second?: number, millisecond?: number, dstDependent?: boolean): string; - /** - * Normalizes non-existing local times by adding a forward offset change. - * During a forward standard offset change or DST offset change, some amount of - * local time is skipped. Therefore, this amount of local time does not exist. - * This function adds the amount of forward change to any non-existing time. After all, - * this is probably what the user meant. - * - * @param localUnixMillis Unix timestamp in zone time - * @param opt (optional) Round up or down? Default: up - * - * @returns Unix timestamp in zone time, normalized. - */ - normalizeZoneTime(localUnixMillis: number, opt?: NormalizeOption): number; - /** - * The time zone identifier (normalized). - * Either "localtime", IANA name, or "+hh:mm" offset. - */ - toString(): string; - /** - * Used by util.inspect() - */ - inspect(): string; - /** - * Convert an offset number into an offset string - * @param offset The offset in minutes from UTC e.g. 90 minutes - * @return the offset in ISO notation "+01:30" for +90 minutes - */ - static offsetToString(offset: number): string; - /** - * String to offset conversion. - * @param s Formats: "-01:00", "-0100", "-01", "Z" - * @return offset w.r.t. UTC in minutes - */ - static stringToOffset(s: string): number; - } -} - diff --git a/timezonecomplete/timezonecomplete-1.6.0-tests.ts b/timezonecomplete/timezonecomplete-1.6.0-tests.ts deleted file mode 100644 index 7282083f5..000000000 --- a/timezonecomplete/timezonecomplete-1.6.0-tests.ts +++ /dev/null @@ -1,197 +0,0 @@ -/// - -import tc = require("timezonecomplete-1.6.0"); - -var b: boolean; -var n: number; -var s: string; -var w: tc.WeekDay; - -b = tc.isLeapYear(2014); -n = tc.daysInMonth(2014, 10); -n = tc.daysInYear(2014); -n = tc.dayOfYear(2014, 1, 2); -w = tc.firstWeekDayOfMonth(2014, 1, tc.WeekDay.Sunday); -w = tc.lastWeekDayOfMonth(2014, 1, tc.WeekDay.Sunday); -n = tc.weekDayOnOrAfter(2014, 1, 14, tc.WeekDay.Monday); -n = tc.weekDayOnOrBefore(2014, 1, 14, tc.WeekDay.Monday); -n = tc.secondOfDay(13, 59, 59); -n = tc.weekOfMonth(2014, 1, 1); - -// DURATION - -var d: tc.Duration; -var d1: tc.Duration = tc.Duration.hours(24); -var d2: tc.Duration = tc.Duration.minutes(24); -var d3: tc.Duration = tc.Duration.seconds(24); -var d4: tc.Duration = tc.Duration.milliseconds(24); -var d5: tc.Duration = new tc.Duration(24); -var d6: tc.Duration = new tc.Duration("00:01"); -var d7: tc.Duration = d6.clone(); - -n = d7.wholeHours(); -n = d7.hours(); -n = d7.minutes(); -n = d7.minute(); -n = d7.seconds(); -n = d7.second(); -n = d7.milliseconds(); -n = d7.millisecond(); -s = d7.sign(); -b = d7.lessThan(d6); -b = d7.greaterThan(d6); -d = d7.min(d6); -d = d7.max(d6); -d = d7.multiply(3); -d = d7.divide(0.3); -d = d7.add(d6); -d = d7.sub(d6); -s = d7.toString(); - -// TIMEZONE - -var t: tc.TimeZone; -var k: tc.TimeZoneKind; - -t = tc.TimeZone.local(); -t = tc.TimeZone.utc(); -t = tc.TimeZone.zone(2); -t = tc.TimeZone.zone("+01:00"); -s = t.name(); -k = t.kind(); -b = t.equals(t); -b = t.isUtc(); -n = t.offsetForUtc(2014, 1, 1, 13, 0, 5, 123); -n = t.offsetForZone(2014, 1, 1, 13, 0, 5, 123); -n = t.offsetForUtcDate(new Date(2014, 1, 1, 13, 0, 5, 123), tc.DateFunctions.Get); -n = t.offsetForZoneDate(new Date(2014, 1, 1, 13, 0, 5, 123), tc.DateFunctions.GetUTC); -s = t.toString(); -s = tc.TimeZone.offsetToString(2); -n = tc.TimeZone.stringToOffset("+00:01"); - -// REALTIMESOURCE - -var date: Date = (new tc.RealTimeSource()).now(); - -// DATETIME - -var dt: tc.DateTime; - -var ts: tc.TimeSource = tc.DateTime.timeSource; - -dt = tc.DateTime.nowLocal(); -dt = tc.DateTime.nowUtc(); -dt = tc.DateTime.now(tc.TimeZone.local()); -dt = new tc.DateTime(); -dt = new tc.DateTime("2014-01-01T13:05:01.123 UTC"); -dt = new tc.DateTime("2014-01-01T13:05:01.123", tc.TimeZone.utc()); -dt = new tc.DateTime(date, tc.DateFunctions.Get); -dt = new tc.DateTime(date, tc.DateFunctions.Get, tc.TimeZone.utc()); -dt = new tc.DateTime(2014, 1, 1, 13, 5, 1, 123); -dt = new tc.DateTime(2014, 1, 1, 13, 5, 1, 123, tc.TimeZone.utc()); -dt = new tc.DateTime(89949284); -dt = new tc.DateTime(89949284, tc.TimeZone.utc()); -dt = dt.clone(); -t = dt.zone(); -n = dt.offset(); -n = dt.year(); -n = dt.month(); -n = dt.day(); -n = dt.hour(); -n = dt.minute(); -n = dt.second(); -n = dt.weekNumber(); -n = dt.weekOfMonth(); -n = dt.secondOfDay(); -n = dt.dayOfYear(); -n = dt.millisecond(); -n = dt.unixUtcMillis(); -n = dt.utcYear(); -n = dt.utcMonth(); -n = dt.utcDay(); -n = dt.utcHour(); -n = dt.utcMinute(); -n = dt.utcSecond(); -n = dt.utcMillisecond(); -n = dt.utcWeekNumber(); -n = dt.utcWeekOfMonth(); -n = dt.utcSecondOfDay(); -n = dt.utcDayOfYear(); -s = dt.format("%Y-%m-%d"); -dt.convert(tc.TimeZone.local()); -dt = dt.toZone(tc.TimeZone.utc()); -date = dt.toDate(); -dt = dt.add(tc.Duration.seconds(2)); -dt = dt.add(2, tc.TimeUnit.Year); -dt = dt.add(2, tc.TimeUnit.Month); -dt = dt.add(2, tc.TimeUnit.Week); -dt = dt.add(2, tc.TimeUnit.Day); -dt = dt.add(2, tc.TimeUnit.Hour); -dt = dt.add(2, tc.TimeUnit.Minute); -dt = dt.add(2, tc.TimeUnit.Second); -dt = dt.addLocal(2, tc.TimeUnit.Second); -dt = dt.sub(tc.Duration.seconds(2)); -dt = dt.sub(2, tc.TimeUnit.Year); -dt = dt.sub(2, tc.TimeUnit.Month); -dt = dt.sub(2, tc.TimeUnit.Week); -dt = dt.sub(2, tc.TimeUnit.Day); -dt = dt.sub(2, tc.TimeUnit.Hour); -dt = dt.sub(2, tc.TimeUnit.Minute); -dt = dt.sub(2, tc.TimeUnit.Second); -dt = dt.subLocal(2, tc.TimeUnit.Second); -d = dt.diff(new tc.DateTime(9289234, tc.TimeZone.local())); -b = dt.lessThan(new tc.DateTime(9289234, tc.TimeZone.local())); -b = dt.lessEqual(new tc.DateTime(9289234, tc.TimeZone.local())); -b = dt.greaterThan(new tc.DateTime(9289234, tc.TimeZone.local())); -b = dt.greaterEqual(new tc.DateTime(9289234, tc.TimeZone.local())); -s = dt.toIsoString(); -s = dt.toString(); -s = dt.toUtcString(); - -var wd: tc.WeekDay; -wd = dt.weekDay(); -wd = dt.utcWeekDay(); - -// PERIOD - -s = tc.periodDstToString(tc.PeriodDst.RegularIntervals); -s = tc.periodDstToString(tc.PeriodDst.RegularLocalTime); - -var p: tc.Period; - -p = new tc.Period(tc.DateTime.nowLocal(), 1, tc.TimeUnit.Hour, tc.PeriodDst.RegularLocalTime); -dt = p.start(); -n = p.amount(); -var tu: tc.TimeUnit = p.unit(); -var pd: tc.PeriodDst = p.dst(); -dt = p.findFirst(tc.DateTime.nowLocal()); -dt = p.findNext(dt); -s = p.toIsoString(); -s = p.toString(); -b = p.isBoundary(dt); - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/timezonecomplete/timezonecomplete-1.6.0.d.ts b/timezonecomplete/timezonecomplete-1.6.0.d.ts deleted file mode 100644 index 2b281d23d..000000000 --- a/timezonecomplete/timezonecomplete-1.6.0.d.ts +++ /dev/null @@ -1,1132 +0,0 @@ -// Type definitions for timezonecomplete 1.6.0 -// Project: https://github.com/SpiritIT/timezonecomplete -// Definitions by: Rogier Schouten -// Definitions: https://github.com/borisyankov/DefinitelyTyped -// Generated by dts-bundle v0.2.0 - -declare module 'timezonecomplete-1.6.0' { - import basics = require("__timezonecomplete/basics"); - export import TimeUnit = basics.TimeUnit; - export import WeekDay = basics.WeekDay; - export import isLeapYear = basics.isLeapYear; - export import daysInMonth = basics.daysInMonth; - export import daysInYear = basics.daysInYear; - export import firstWeekDayOfMonth = basics.firstWeekDayOfMonth; - export import lastWeekDayOfMonth = basics.lastWeekDayOfMonth; - export import weekDayOnOrAfter = basics.weekDayOnOrAfter; - export import weekDayOnOrBefore = basics.weekDayOnOrBefore; - export import weekNumber = basics.weekNumber; - export import weekOfMonth = basics.weekOfMonth; - export import dayOfYear = basics.dayOfYear; - export import secondOfDay = basics.secondOfDay; - import datetime = require("__timezonecomplete/datetime"); - export import DateTime = datetime.DateTime; - import duration = require("__timezonecomplete/duration"); - export import Duration = duration.Duration; - import javascript = require("__timezonecomplete/javascript"); - export import DateFunctions = javascript.DateFunctions; - import period = require("__timezonecomplete/period"); - export import Period = period.Period; - export import PeriodDst = period.PeriodDst; - export import periodDstToString = period.periodDstToString; - import timesource = require("__timezonecomplete/timesource"); - export import TimeSource = timesource.TimeSource; - export import RealTimeSource = timesource.RealTimeSource; - import timezone = require("__timezonecomplete/timezone"); - export import NormalizeOption = timezone.NormalizeOption; - export import TimeZoneKind = timezone.TimeZoneKind; - export import TimeZone = timezone.TimeZone; -} - -declare module '__timezonecomplete/basics' { - import javascript = require("__timezonecomplete/javascript"); - /** - * Day-of-week. Note the enum values correspond to JavaScript day-of-week: - * Sunday = 0, Monday = 1 etc - */ - export enum WeekDay { - Sunday = 0, - Monday = 1, - Tuesday = 2, - Wednesday = 3, - Thursday = 4, - Friday = 5, - Saturday = 6, - } - /** - * Time units - */ - export enum TimeUnit { - Second = 0, - Minute = 1, - Hour = 2, - Day = 3, - Week = 4, - Month = 5, - Year = 6, - } - /** - * @return True iff the given year is a leap year. - */ - export function isLeapYear(year: number): boolean; - /** - * The days in a given year - */ - export function daysInYear(year: number): number; - /** - * @param year The full year - * @param month The month 1-12 - * @return The number of days in the given month - */ - export function daysInMonth(year: number, month: number): number; - /** - * Returns the day of the year of the given date [0..365]. January first is 0. - * - * @param year The year e.g. 1986 - * @param month Month 1-12 - * @param day Day of month 1-31 - */ - export function dayOfYear(year: number, month: number, day: number): number; - /** - * Returns the last instance of the given weekday in the given month - * - * @param year The year - * @param month the month 1-12 - * @param weekDay the desired week day - * - * @return the last occurrence of the week day in the month - */ - export function lastWeekDayOfMonth(year: number, month: number, weekDay: WeekDay): number; - /** - * Returns the first instance of the given weekday in the given month - * - * @param year The year - * @param month the month 1-12 - * @param weekDay the desired week day - * - * @return the first occurrence of the week day in the month - */ - export function firstWeekDayOfMonth(year: number, month: number, weekDay: WeekDay): number; - /** - * Returns the day-of-month that is on the given weekday and which is >= the given day. - * Throws if the month has no such day. - */ - export function weekDayOnOrAfter(year: number, month: number, day: number, weekDay: WeekDay): number; - /** - * Returns the day-of-month that is on the given weekday and which is <= the given day. - * Throws if the month has no such day. - */ - export function weekDayOnOrBefore(year: number, month: number, day: number, weekDay: WeekDay): number; - export function weekOfMonth(year: number, month: number, day: number): number; - /** - * The ISO 8601 week number for the given date. Week 1 is the week - * that has January 4th in it, and it starts on Monday. - * See https://en.wikipedia.org/wiki/ISO_week_date - * - * @param year Year e.g. 1988 - * @param month Month 1-12 - * @param day Day of month 1-31 - * - * @return Week number 1-53 - */ - export function weekNumber(year: number, month: number, day: number): number; - /** - * Convert a unix milli timestamp into a TimeT structure. - * This does NOT take leap seconds into account. - */ - export function unixToTimeNoLeapSecs(unixMillis: number): TimeStruct; - /** - * Convert a year, month, day etc into a unix milli timestamp. - * This does NOT take leap seconds into account. - * - * @param year Year e.g. 1970 - * @param month Month 1-12 - * @param day Day 1-31 - * @param hour Hour 0-23 - * @param minute Minute 0-59 - * @param second Second 0-59 (no leap seconds) - * @param milli Millisecond 0-999 - */ - export function timeToUnixNoLeapSecs(year?: number, month?: number, day?: number, hour?: number, minute?: number, second?: number, milli?: number): number; - /** - * Convert a TimeT structure into a unix milli timestamp. - * This does NOT take leap seconds into account. - */ - export function timeToUnixNoLeapSecs(tm: TimeStruct): number; - /** - * Return the day-of-week. - * This does NOT take leap seconds into account. - */ - export function weekDayNoLeapSecs(unixMillis: number): WeekDay; - /** - * N-th second in the day, counting from 0 - */ - export function secondOfDay(hour: number, minute: number, second: number): number; - /** - * Basic representation of a date and time - */ - export class TimeStruct { - /** - * Year, 1970-... - */ - year: number; - /** - * Month 1-12 - */ - month: number; - /** - * Day of month, 1-31 - */ - day: number; - /** - * Hour 0-23 - */ - hour: number; - /** - * Minute 0-59 - */ - minute: number; - /** - * Seconds, 0-59 - */ - second: number; - /** - * Milliseconds 0-999 - */ - milli: number; - /** - * Create a TimeStruct from a number of unix milliseconds - */ - static fromUnix(unixMillis: number): TimeStruct; - /** - * Create a TimeStruct from a JavaScript date - * - * @param d The date - * @param df Which functions to take (getX() or getUTCX()) - */ - static fromDate(d: Date, df: javascript.DateFunctions): TimeStruct; - /** - * Returns a TimeStruct from an ISO 8601 string WITHOUT time zone - */ - static fromString(s: string): TimeStruct; - /** - * Constructor - * - * @param year Year e.g. 1970 - * @param month Month 1-12 - * @param day Day 1-31 - * @param hour Hour 0-23 - * @param minute Minute 0-59 - * @param second Second 0-59 (no leap seconds) - * @param milli Millisecond 0-999 - */ - constructor(/** - * Year, 1970-... - */ - year?: number, /** - * Month 1-12 - */ - month?: number, /** - * Day of month, 1-31 - */ - day?: number, /** - * Hour 0-23 - */ - hour?: number, /** - * Minute 0-59 - */ - minute?: number, /** - * Seconds, 0-59 - */ - second?: number, /** - * Milliseconds 0-999 - */ - milli?: number); - /** - * Validate a TimeStruct, returns false if invalid. - */ - validate(): boolean; - /** - * The day-of-year 0-365 - */ - yearDay(): number; - /** - * Returns this time as a unix millisecond timestamp - * Does NOT take leap seconds into account. - */ - toUnixNoLeapSecs(): number; - /** - * Deep equals - */ - equals(other: TimeStruct): boolean; - /** - * < operator - */ - lessThan(other: TimeStruct): boolean; - clone(): TimeStruct; - valueOf(): number; - /** - * ISO 8601 string YYYY-MM-DDThh:mm:ss.nnn - */ - toString(): string; - inspect(): string; - } -} - -declare module '__timezonecomplete/datetime' { - import basics = require("__timezonecomplete/basics"); - import duration = require("__timezonecomplete/duration"); - import javascript = require("__timezonecomplete/javascript"); - import timesource = require("__timezonecomplete/timesource"); - import timezone = require("__timezonecomplete/timezone"); - /** - * DateTime class which is time zone-aware - * and which can be mocked for testing purposes. - */ - export class DateTime { - /** - * Actual time source in use. Setting this property allows to - * fake time in tests. DateTime.nowLocal() and DateTime.nowUtc() - * use this property for obtaining the current time. - */ - static timeSource: timesource.TimeSource; - /** - * Current date+time in local time (derived from DateTime.timeSource.now()). - */ - static nowLocal(): DateTime; - /** - * Current date+time in UTC time (derived from DateTime.timeSource.now()). - */ - static nowUtc(): DateTime; - /** - * Current date+time in the given time zone (derived from DateTime.timeSource.now()). - * @param timeZone The desired time zone. - */ - static now(timeZone: timezone.TimeZone): DateTime; - /** - * Constructor. Creates current time in local timezone. - */ - constructor(); - /** - * Constructor - * Non-existing local times are normalized by rounding up to the next DST offset. - * - * @param isoString String in ISO 8601 format. Instead of ISO time zone, - * it may include a space and then and IANA time zone. - * e.g. "2007-04-05T12:30:40.500" (no time zone, naive date) - * e.g. "2007-04-05T12:30:40.500+01:00" (UTC offset without daylight saving time) - * or "2007-04-05T12:30:40.500Z" (UTC) - * or "2007-04-05T12:30:40.500 Europe/Amsterdam" (IANA time zone, with daylight saving time if applicable) - * @param timeZone if given, the date in the string is assumed to be in this time zone. - * Note that it is NOT CONVERTED to the time zone. Useful - * for strings without a time zone - */ - constructor(isoString: string, timeZone?: timezone.TimeZone); - /** - * Constructor. You provide a date, then you say whether to take the - * date.getYear()/getXxx methods or the date.getUTCYear()/date.getUTCXxx methods, - * and then you state which time zone that date is in. - * Non-existing local times are normalized by rounding up to the next DST offset. - * Note that the Date class has bugs and inconsistencies when constructing them with times around - * DST changes. - * - * @param date A date object. - * @param getters Specifies which set of Date getters contains the date in the given time zone: the - * Date.getXxx() methods or the Date.getUTCXxx() methods. - * @param timeZone The time zone that the given date is assumed to be in (may be null for unaware dates) - */ - constructor(date: Date, getFuncs: javascript.DateFunctions, timeZone?: timezone.TimeZone); - /** - * Constructor. Note that unlike JavaScript dates we require fields to be in normal ranges. - * Use the add(duration) or sub(duration) for arithmetic. - * @param year The full year (e.g. 2014) - * @param month The month [1-12] (note this deviates from JavaScript Date) - * @param day The day of the month [1-31] - * @param hour The hour of the day [0-24) - * @param minute The minute of the hour [0-59] - * @param second The second of the minute [0-59] - * @param millisecond The millisecond of the second [0-999] - * @param timeZone The time zone, or null (for unaware dates) - */ - constructor(year: number, month: number, day: number, hour?: number, minute?: number, second?: number, millisecond?: number, timeZone?: timezone.TimeZone); - /** - * Constructor - * @param unixTimestamp milliseconds since 1970-01-01T00:00:00.000 - * @param timeZone the time zone that the timestamp is assumed to be in (usually UTC). - */ - constructor(unixTimestamp: number, timeZone?: timezone.TimeZone); - /** - * @return a copy of this object - */ - clone(): DateTime; - /** - * @return The time zone that the date is in. May be null for unaware dates. - */ - zone(): timezone.TimeZone; - /** - * Zone name abbreviation at this time - * @param dstDependent (default true) set to false for a DST-agnostic abbreviation - * @return The abbreviation - */ - zoneAbbreviation(dstDependent?: boolean): string; - /** - * @return the offset w.r.t. UTC in minutes. Returns 0 for unaware dates and for UTC dates. - */ - offset(): number; - /** - * @return The full year e.g. 2014 - */ - year(): number; - /** - * @return The month 1-12 (note this deviates from JavaScript Date) - */ - month(): number; - /** - * @return The day of the month 1-31 - */ - day(): number; - /** - * @return The hour 0-23 - */ - hour(): number; - /** - * @return the minutes 0-59 - */ - minute(): number; - /** - * @return the seconds 0-59 - */ - second(): number; - /** - * @return the milliseconds 0-999 - */ - millisecond(): number; - /** - * @return the day-of-week (the enum values correspond to JavaScript - * week day numbers) - */ - weekDay(): basics.WeekDay; - /** - * Returns the day number within the year: Jan 1st has number 0, - * Jan 2nd has number 1 etc. - * - * @return the day-of-year [0-366] - */ - dayOfYear(): number; - /** - * The ISO 8601 week number. Week 1 is the week - * that has January 4th in it, and it starts on Monday. - * See https://en.wikipedia.org/wiki/ISO_week_date - * - * @return Week number [1-53] - */ - weekNumber(): number; - /** - * The week of this month. There is no official standard for this, - * but we assume the same rules for the weekNumber (i.e. - * week 1 is the week that has the 4th day of the month in it) - * - * @return Week number [1-5] - */ - weekOfMonth(): number; - /** - * Returns the number of seconds that have passed on the current day - * Does not consider leap seconds - * - * @return seconds [0-86399] - */ - secondOfDay(): number; - /** - * @return Milliseconds since 1970-01-01T00:00:00.000Z - */ - unixUtcMillis(): number; - /** - * @return The full year e.g. 2014 - */ - utcYear(): number; - /** - * @return The UTC month 1-12 (note this deviates from JavaScript Date) - */ - utcMonth(): number; - /** - * @return The UTC day of the month 1-31 - */ - utcDay(): number; - /** - * @return The UTC hour 0-23 - */ - utcHour(): number; - /** - * @return The UTC minutes 0-59 - */ - utcMinute(): number; - /** - * @return The UTC seconds 0-59 - */ - utcSecond(): number; - /** - * Returns the UTC day number within the year: Jan 1st has number 0, - * Jan 2nd has number 1 etc. - * - * @return the day-of-year [0-366] - */ - utcDayOfYear(): number; - /** - * @return The UTC milliseconds 0-999 - */ - utcMillisecond(): number; - /** - * @return the UTC day-of-week (the enum values correspond to JavaScript - * week day numbers) - */ - utcWeekDay(): basics.WeekDay; - /** - * The ISO 8601 UTC week number. Week 1 is the week - * that has January 4th in it, and it starts on Monday. - * See https://en.wikipedia.org/wiki/ISO_week_date - * - * @return Week number [1-53] - */ - utcWeekNumber(): number; - /** - * The week of this month. There is no official standard for this, - * but we assume the same rules for the weekNumber (i.e. - * week 1 is the week that has the 4th day of the month in it) - * - * @return Week number [1-5] - */ - utcWeekOfMonth(): number; - /** - * Returns the number of seconds that have passed on the current day - * Does not consider leap seconds - * - * @return seconds [0-86399] - */ - utcSecondOfDay(): number; - /** - * Convert this date to the given time zone (in-place). - * Throws if this date does not have a time zone. - * @return this (for chaining) - */ - convert(zone?: timezone.TimeZone): DateTime; - /** - * Returns this date converted to the given time zone. - * Unaware dates can only be converted to unaware dates (clone) - * Converting an unaware date to an aware date throws an exception. Use the constructor - * if you really need to do that. - * - * @param zone The new time zone. This may be null to create unaware date. - * @return The converted date - */ - toZone(zone?: timezone.TimeZone): DateTime; - /** - * Convert to JavaScript date with the zone time in the getX() methods. - * Unless the timezone is local, the Date.getUTCX() methods will NOT be correct. - * This is because Date calculates getUTCX() from getX() applying local time zone. - */ - toDate(): Date; - /** - * Add a time duration relative to UTC. Note that this simply adds a number - * of milliseconds to UTC and converts back to zone(), - * There is not DST handling. - * @return this + duration - */ - add(duration: duration.Duration): DateTime; - /** - * Add an amount of time relative to UTC, as regularly as possible. - * - * Adding e.g. 1 hour will increment the utcHour() field, adding 1 month - * increments the utcMonth() field. - * Adding an amount of units leaves lower units intact. E.g. - * adding a month will leave the day() field untouched if possible. - * - * Note adding Months or Years will clamp the date to the end-of-month if - * the start date was at the end of a month, i.e. contrary to JavaScript - * Date#setUTCMonth() it will not overflow into the next month - * - * In case of DST changes, the utc time fields are still untouched but local - * time fields may shift. - */ - add(amount: number, unit: basics.TimeUnit): DateTime; - /** - * Add an amount of time to the zone time, as regularly as possible. - * - * Adding e.g. 1 hour will increment the hour() field of the zone - * date by one. In case of DST changes, the time fields may additionally - * increase by the DST offset, if a non-existing local time would - * be reached otherwise. - * - * Adding a unit of time will leave lower-unit fields intact, unless the result - * would be a non-existing time. Then an extra DST offset is added. - * - * Note adding Months or Years will clamp the date to the end-of-month if - * the start date was at the end of a month, i.e. contrary to JavaScript - * Date#setUTCMonth() it will not overflow into the next month - */ - addLocal(amount: number, unit: basics.TimeUnit): DateTime; - /** - * Same as add(-1*duration); - */ - sub(duration: duration.Duration): DateTime; - /** - * Same as add(-1*amount, unit); - */ - sub(amount: number, unit: basics.TimeUnit): DateTime; - /** - * Same as addLocal(-1*amount, unit); - */ - subLocal(amount: number, unit: basics.TimeUnit): DateTime; - /** - * Time difference between two DateTimes - * @return this - other - */ - diff(other: DateTime): duration.Duration; - /** - * @return True iff (this < other) - */ - lessThan(other: DateTime): boolean; - /** - * @return True iff (this <= other) - */ - lessEqual(other: DateTime): boolean; - /** - * @return True iff this and other represent the same time in UTC - */ - equals(other: DateTime): boolean; - /** - * @return True iff this and other represent the same time and - * have the same zone - */ - identical(other: DateTime): boolean; - /** - * @return True iff this > other - */ - greaterThan(other: DateTime): boolean; - /** - * @return True iff this >= other - */ - greaterEqual(other: DateTime): boolean; - /** - * Proper ISO 8601 format string with any IANA zone converted to ISO offset - * E.g. "2014-01-01T23:15:33+01:00" for Europe/Amsterdam - */ - toIsoString(): string; - format(formatString: string): string; - /** - * Modified ISO 8601 format string with IANA name if applicable. - * E.g. "2014-01-01T23:15:33.000 Europe/Amsterdam" - */ - toString(): string; - /** - * Used by util.inspect() - */ - inspect(): string; - /** - * The valueOf() method returns the primitive value of the specified object. - */ - valueOf(): any; - /** - * Modified ISO 8601 format string in UTC without time zone info - */ - toUtcString(): string; - } -} - -declare module '__timezonecomplete/duration' { - /** - * Time duration. Create one e.g. like this: var d = Duration.hours(1). - * Note that time durations do not take leap seconds etc. into account: - * one hour is simply represented as 3600000 milliseconds. - */ - export class Duration { - /** - * Construct a time duration - * @param n Number of hours - * @return A duration of n hours - */ - static hours(n: number): Duration; - /** - * Construct a time duration - * @param n Number of minutes - * @return A duration of n minutes - */ - static minutes(n: number): Duration; - /** - * Construct a time duration - * @param n Number of seconds - * @return A duration of n seconds - */ - static seconds(n: number): Duration; - /** - * Construct a time duration - * @param n Number of milliseconds - * @return A duration of n milliseconds - */ - static milliseconds(n: number): Duration; - /** - * Construct a time duration of 0 - */ - constructor(); - /** - * Construct a time duration from a number of milliseconds - */ - constructor(milliseconds: number); - /** - * Construct a time duration from a string in format - * [-]h[:m[:s[.n]]] e.g. -01:00:30.501 - */ - constructor(input: string); - /** - * @return another instance of Duration with the same value. - */ - clone(): Duration; - /** - * The entire duration in milliseconds (negative or positive) - */ - milliseconds(): number; - /** - * The millisecond part of the duration (always positive) - * @return e.g. 400 for a -01:02:03.400 duration - */ - millisecond(): number; - /** - * The entire duration in seconds (negative or positive, fractional) - * @return e.g. 1.5 for a 1500 milliseconds duration - */ - seconds(): number; - /** - * The second part of the duration (always positive) - * @return e.g. 3 for a -01:02:03.400 duration - */ - second(): number; - /** - * The entire duration in minutes (negative or positive, fractional) - * @return e.g. 1.5 for a 90000 milliseconds duration - */ - minutes(): number; - /** - * The minute part of the duration (always positive) - * @return e.g. 2 for a -01:02:03.400 duration - */ - minute(): number; - /** - * The entire duration in hours (negative or positive, fractional) - * @return e.g. 1.5 for a 5400000 milliseconds duration - */ - hours(): number; - /** - * The hour part of the duration (always positive). - * Note that this part can exceed 23 hours, because for - * now, we do not have a days() function - * @return e.g. 25 for a -25:02:03.400 duration - */ - wholeHours(): number; - /** - * Sign - * @return "-" if the duration is negative - */ - sign(): string; - /** - * @return True iff (this < other) - */ - lessThan(other: Duration): boolean; - /** - * @return True iff this and other represent the same time duration - */ - equals(other: Duration): boolean; - /** - * @return True iff this > other - */ - greaterThan(other: Duration): boolean; - /** - * @return The minimum (most negative) of this and other - */ - min(other: Duration): Duration; - /** - * @return The maximum (most positive) of this and other - */ - max(other: Duration): Duration; - /** - * Multiply with a fixed number. - * @return a new Duration of (this * value) - */ - multiply(value: number): Duration; - /** - * Divide by a fixed number. - * @return a new Duration of (this / value) - */ - divide(value: number): Duration; - /** - * Add a duration. - * @return a new Duration of (this + value) - */ - add(value: Duration): Duration; - /** - * Subtract a duration. - * @return a new Duration of (this - value) - */ - sub(value: Duration): Duration; - /** - * String in [-]hh:mm:ss.nnn notation. All fields are - * always present except the sign. - */ - toFullString(): string; - /** - * String in [-]hh[:mm[:ss[.nnn]]] notation. Fields are - * added as necessary - */ - toString(): string; - /** - * Used by util.inspect() - */ - inspect(): string; - /** - * The valueOf() method returns the primitive value of the specified object. - */ - valueOf(): any; - } -} - -declare module '__timezonecomplete/javascript' { - /** - * Indicates how a Date object should be interpreted. - * Either we can take getYear(), getMonth() etc for our field - * values, or we can take getUTCYear(), getUtcMonth() etc to do that. - */ - export enum DateFunctions { - /** - * Use the Date.getFullYear(), Date.getMonth(), ... functions. - */ - Get = 0, - /** - * Use the Date.getUTCFullYear(), Date.getUTCMonth(), ... functions. - */ - GetUTC = 1, - } -} - -declare module '__timezonecomplete/period' { - import basics = require("__timezonecomplete/basics"); - import datetime = require("__timezonecomplete/datetime"); - /** - * Specifies how the period should repeat across the day - * during DST changes. - */ - export enum PeriodDst { - /** - * Keep repeating in similar intervals measured in UTC, - * unaffected by Daylight Saving Time. - * E.g. a repetition of one hour will take one real hour - * every time, even in a time zone with DST. - * Leap seconds, leap days and month length - * differences will still make the intervals different. - */ - RegularIntervals = 0, - /** - * Ensure that the time at which the intervals occur stay - * at the same place in the day, local time. So e.g. - * a period of one day, starting at 8:05AM Europe/Amsterdam time - * will always start at 8:05 Europe/Amsterdam. This means that - * in UTC time, some intervals will be 25 hours and some - * 23 hours during DST changes. - * Another example: an hourly interval will be hourly in local time, - * skipping an hour in UTC for a DST backward change. - */ - RegularLocalTime = 1, - } - /** - * Convert a PeriodDst to a string: "regular intervals" or "regular local time" - */ - export function periodDstToString(p: PeriodDst): string; - /** - * Repeating time period: consists of a starting point and - * a time length. This class accounts for leap seconds and leap days. - */ - export class Period { - /** - * Constructor - * LIMITATION: if dst equals RegularLocalTime, and unit is Second, Minute or Hour, - * then the amount must be a factor of 24. So 120 seconds is allowed while 121 seconds is not. - * This is due to the enormous processing power required by these cases. They are not - * implemented and you will get an assert. - * - * @param start The start of the period. If the period is in Months or Years, and - * the day is 29 or 30 or 31, the results are maximised to end-of-month. - * @param amount The amount of units. - * @param unit The unit. - * @param dst Specifies how to handle Daylight Saving Time. Not relevant - * if the time zone of the start datetime does not have DST. - */ - constructor(start: datetime.DateTime, amount: number, unit: basics.TimeUnit, dst: PeriodDst); - /** - * The start date - */ - start(): datetime.DateTime; - /** - * The amount of units - */ - amount(): number; - /** - * The unit - */ - unit(): basics.TimeUnit; - /** - * The dst handling mode - */ - dst(): PeriodDst; - /** - * The first occurrence of the period greater than - * the given date. The given date need not be at a period boundary. - * Pre: the fromdate and startdate must either both have timezones or not - * @param fromDate: the date after which to return the next date - * @return the first date matching the period after fromDate, given - * in the same zone as the fromDate. - */ - findFirst(fromDate: datetime.DateTime): datetime.DateTime; - /** - * Returns the next timestamp in the period. The given timestamp must - * be at a period boundary, otherwise the answer is incorrect. - * This function has MUCH better performance than findFirst. - * Returns the datetime "count" times away from the given datetime. - * @param prev Boundary date. Must have a time zone (any time zone) iff the period start date has one. - * @param count Optional, must be >= 1 and whole. - * @return (prev + count * period), in the same timezone as prev. - */ - findNext(prev: datetime.DateTime, count?: number): datetime.DateTime; - /** - * Checks whether the given date is on a period boundary - * (expensive!) - */ - isBoundary(occurrence: datetime.DateTime): boolean; - /** - * Returns an ISO duration string e.g. - * 2014-01-01T12:00:00.000+01:00/P1H - * 2014-01-01T12:00:00.000+01:00/PT1M (one minute) - * 2014-01-01T12:00:00.000+01:00/P1M (one month) - */ - toIsoString(): string; - /** - * A string representation e.g. - * "10 years, starting at 2014-03-01T12:00:00 Europe/Amsterdam, keeping regular intervals". - */ - toString(): string; - /** - * Used by util.inspect() - */ - inspect(): string; - } -} - -declare module '__timezonecomplete/timesource' { - /** - * For testing purposes, we often need to manipulate what the current - * time is. This is an interface for a custom time source object - * so in tests you can use a custom time source. - */ - export interface TimeSource { - /** - * Return the current date+time as a javascript Date object - */ - now(): Date; - } - /** - * Default time source, returns actual time - */ - export class RealTimeSource implements TimeSource { - now(): Date; - } -} - -declare module '__timezonecomplete/timezone' { - import javascript = require("__timezonecomplete/javascript"); - /** - * The type of time zone - */ - export enum TimeZoneKind { - /** - * Local time offset as determined by JavaScript Date class. - */ - Local = 0, - /** - * Fixed offset from UTC, without DST. - */ - Offset = 1, - /** - * IANA timezone managed through Olsen TZ database. Includes - * DST if applicable. - */ - Proper = 2, - } - /** - * Option for TimeZone#normalizeLocal() - */ - export enum NormalizeOption { - /** - * Normalize non-existing times by ADDING the DST offset - */ - Up = 0, - /** - * Normalize non-existing times by SUBTRACTING the DST offset - */ - Down = 1, - } - /** - * Time zone. The object is immutable because it is cached: - * requesting a time zone twice yields the very same object. - * Note that we use time zone offsets inverted w.r.t. JavaScript Date.getTimezoneOffset(), - * i.e. offset 90 means +01:30. - * - * Time zones come in three flavors: the local time zone, as calculated by JavaScript Date, - * a fixed offset ("+01:30") without DST, or a IANA timezone ("Europe/Amsterdam") with DST - * applied depending on the time zone rules. - */ - export class TimeZone { - /** - * The local time zone for a given date. Note that - * the time zone varies with the date: amsterdam time for - * 2014-01-01 is +01:00 and amsterdam time for 2014-07-01 is +02:00 - */ - static local(): TimeZone; - /** - * The UTC time zone. - */ - static utc(): TimeZone; - /** - * Returns a time zone object from the cache. If it does not exist, it is created. - * @return The time zone with the given offset w.r.t. UTC in minutes, e.g. 90 for +01:30 - */ - static zone(offset: number): TimeZone; - /** - * Returns a time zone object from the cache. If it does not exist, it is created. - * @param s: Empty string for local time, a TZ database time zone name (e.g. Europe/Amsterdam) - * or an offset string (either +01:30, +0130, +01, Z). For a full list of names, see: - * https://en.wikipedia.org/wiki/List_of_tz_database_time_zones - */ - static zone(s: string): TimeZone; - /** - * Do not use this constructor, use the static - * TimeZone.zone() method instead. - * @param name NORMALIZED name, assumed to be correct - */ - constructor(name: string); - /** - * The time zone identifier. Can be an offset "-01:30" or an - * IANA time zone name "Europe/Amsterdam", or "localtime" for - * the local time zone. - */ - name(): string; - /** - * The kind of time zone (Local/Offset/Proper) - */ - kind(): TimeZoneKind; - /** - * Equality operator. Maps zero offsets and different names for UTC onto - * each other. Other time zones are not mapped onto each other. - */ - equals(other: TimeZone): boolean; - /** - * Is this zone equivalent to UTC? - */ - isUtc(): boolean; - /** - * Does this zone have Daylight Saving Time at all? - */ - hasDst(): boolean; - /** - * Calculate timezone offset from a UTC time. - * - * @param year Full year - * @param month Month 1-12 (note this deviates from JavaScript date) - * @param day Day of month 1-31 - * @param hour Hour 0-23 - * @param minute Minute 0-59 - * @param second Second 0-59 - * @param millisecond Millisecond 0-999 - * - * @return the offset of this time zone with respect to UTC at the given time, in minutes. - */ - offsetForUtc(year: number, month: number, day: number, hour?: number, minute?: number, second?: number, millisecond?: number): number; - /** - * Calculate timezone offset from a zone-local time (NOT a UTC time). - * @param year local full year - * @param month local month 1-12 (note this deviates from JavaScript date) - * @param day local day of month 1-31 - * @param hour local hour 0-23 - * @param minute local minute 0-59 - * @param second local second 0-59 - * @param millisecond local millisecond 0-999 - * @return the offset of this time zone with respect to UTC at the given time, in minutes. - */ - offsetForZone(year: number, month: number, day: number, hour?: number, minute?: number, second?: number, millisecond?: number): number; - /** - * Note: will be removed in version 2.0.0 - * - * Convenience function, takes values from a Javascript Date - * Calls offsetForUtc() with the contents of the date - * - * @param date: the date - * @param funcs: the set of functions to use: get() or getUTC() - */ - offsetForUtcDate(date: Date, funcs: javascript.DateFunctions): number; - /** - * Note: will be removed in version 2.0.0 - * - * Convenience function, takes values from a Javascript Date - * Calls offsetForUtc() with the contents of the date - * - * @param date: the date - * @param funcs: the set of functions to use: get() or getUTC() - */ - offsetForZoneDate(date: Date, funcs: javascript.DateFunctions): number; - /** - * Zone abbreviation at given UTC timestamp e.g. CEST for Central European Summer Time. - * - * @param year Full year - * @param month Month 1-12 (note this deviates from JavaScript date) - * @param day Day of month 1-31 - * @param hour Hour 0-23 - * @param minute Minute 0-59 - * @param second Second 0-59 - * @param millisecond Millisecond 0-999 - * @param dstDependent (default true) set to false for a DST-agnostic abbreviation - * - * @return "local" for local timezone, the offset for an offset zone, or the abbreviation for a proper zone. - */ - abbreviationForUtc(year: number, month: number, day: number, hour?: number, minute?: number, second?: number, millisecond?: number, dstDependent?: boolean): string; - /** - * Normalizes non-existing local times by adding a forward offset change. - * During a forward standard offset change or DST offset change, some amount of - * local time is skipped. Therefore, this amount of local time does not exist. - * This function adds the amount of forward change to any non-existing time. After all, - * this is probably what the user meant. - * - * @param localUnixMillis Unix timestamp in zone time - * @param opt (optional) Round up or down? Default: up - * - * @returns Unix timestamp in zone time, normalized. - */ - normalizeZoneTime(localUnixMillis: number, opt?: NormalizeOption): number; - /** - * The time zone identifier (normalized). - * Either "localtime", IANA name, or "+hh:mm" offset. - */ - toString(): string; - /** - * Used by util.inspect() - */ - inspect(): string; - /** - * Convert an offset number into an offset string - * @param offset The offset in minutes from UTC e.g. 90 minutes - * @return the offset in ISO notation "+01:30" for +90 minutes - */ - static offsetToString(offset: number): string; - /** - * String to offset conversion. - * @param s Formats: "-01:00", "-0100", "-01", "Z" - * @return offset w.r.t. UTC in minutes - */ - static stringToOffset(s: string): number; - } -} - diff --git a/timezonecomplete/timezonecomplete-1.8.0-tests.ts b/timezonecomplete/timezonecomplete-1.8.0-tests.ts deleted file mode 100644 index 5ab586475..000000000 --- a/timezonecomplete/timezonecomplete-1.8.0-tests.ts +++ /dev/null @@ -1,203 +0,0 @@ -/// - -import tc = require("timezonecomplete-1.8.0"); - -var b: boolean; -var n: number; -var s: string; -var w: tc.WeekDay; - -b = tc.isLeapYear(2014); -n = tc.daysInMonth(2014, 10); -n = tc.daysInYear(2014); -n = tc.dayOfYear(2014, 1, 2); -w = tc.firstWeekDayOfMonth(2014, 1, tc.WeekDay.Sunday); -w = tc.lastWeekDayOfMonth(2014, 1, tc.WeekDay.Sunday); -n = tc.weekDayOnOrAfter(2014, 1, 14, tc.WeekDay.Monday); -n = tc.weekDayOnOrBefore(2014, 1, 14, tc.WeekDay.Monday); -n = tc.secondOfDay(13, 59, 59); -n = tc.weekOfMonth(2014, 1, 1); - -// DURATION - -var d: tc.Duration; -var d1: tc.Duration = tc.Duration.hours(24); -var d2: tc.Duration = tc.Duration.minutes(24); -var d3: tc.Duration = tc.Duration.seconds(24); -var d4: tc.Duration = tc.Duration.milliseconds(24); -var d5: tc.Duration = new tc.Duration(24); -var d6: tc.Duration = new tc.Duration("00:01"); -var d7: tc.Duration = d6.clone(); - -n = d7.wholeHours(); -n = d7.hours(); -n = d7.minutes(); -n = d7.minute(); -n = d7.seconds(); -n = d7.second(); -n = d7.milliseconds(); -n = d7.millisecond(); -s = d7.sign(); -b = d7.lessThan(d6); -b = d7.greaterThan(d6); -d = d7.min(d6); -d = d7.max(d6); -d = d7.multiply(3); -d = d7.divide(0.3); -d = d7.add(d6); -d = d7.sub(d6); -s = d7.toString(); - -// TIMEZONE - -var t: tc.TimeZone; -var k: tc.TimeZoneKind; - -t = tc.TimeZone.local(); -t = tc.TimeZone.utc(); -t = tc.TimeZone.zone(2); -t = tc.TimeZone.zone("+01:00"); -s = t.name(); -k = t.kind(); -b = t.equals(t); -b = t.isUtc(); -n = t.offsetForUtc(2014, 1, 1, 13, 0, 5, 123); -n = t.offsetForZone(2014, 1, 1, 13, 0, 5, 123); -n = t.offsetForUtcDate(new Date(2014, 1, 1, 13, 0, 5, 123), tc.DateFunctions.Get); -n = t.offsetForZoneDate(new Date(2014, 1, 1, 13, 0, 5, 123), tc.DateFunctions.GetUTC); -s = t.toString(); -s = tc.TimeZone.offsetToString(2); -n = tc.TimeZone.stringToOffset("+00:01"); - -// REALTIMESOURCE - -var date: Date = (new tc.RealTimeSource()).now(); - -// DATETIME - -var dt: tc.DateTime; - -var ts: tc.TimeSource = tc.DateTime.timeSource; - -dt = tc.DateTime.nowLocal(); -dt = tc.DateTime.nowUtc(); -dt = tc.DateTime.now(tc.TimeZone.local()); -dt = new tc.DateTime(); -dt = new tc.DateTime("2014-01-01T13:05:01.123 UTC"); -dt = new tc.DateTime("2014-01-01T13:05:01.123", tc.TimeZone.utc()); -dt = new tc.DateTime(date, tc.DateFunctions.Get); -dt = new tc.DateTime(date, tc.DateFunctions.Get, tc.TimeZone.utc()); -dt = new tc.DateTime(2014, 1, 1, 13, 5, 1, 123); -dt = new tc.DateTime(2014, 1, 1, 13, 5, 1, 123, tc.TimeZone.utc()); -dt = new tc.DateTime(89949284); -dt = new tc.DateTime(89949284, tc.TimeZone.utc()); -dt = dt.clone(); -t = dt.zone(); -n = dt.offset(); -n = dt.year(); -n = dt.month(); -n = dt.day(); -n = dt.hour(); -n = dt.minute(); -n = dt.second(); -n = dt.weekNumber(); -n = dt.weekOfMonth(); -n = dt.secondOfDay(); -n = dt.dayOfYear(); -n = dt.millisecond(); -n = dt.unixUtcMillis(); -n = dt.utcYear(); -n = dt.utcMonth(); -n = dt.utcDay(); -n = dt.utcHour(); -n = dt.utcMinute(); -n = dt.utcSecond(); -n = dt.utcMillisecond(); -n = dt.utcWeekNumber(); -n = dt.utcWeekOfMonth(); -n = dt.utcSecondOfDay(); -n = dt.utcDayOfYear(); -s = dt.format("%Y-%m-%d"); -dt.convert(tc.TimeZone.local()); -dt = dt.toZone(tc.TimeZone.utc()); -date = dt.toDate(); -dt = dt.add(tc.Duration.seconds(2)); -dt = dt.add(2, tc.TimeUnit.Year); -dt = dt.add(2, tc.TimeUnit.Month); -dt = dt.add(2, tc.TimeUnit.Week); -dt = dt.add(2, tc.TimeUnit.Day); -dt = dt.add(2, tc.TimeUnit.Hour); -dt = dt.add(2, tc.TimeUnit.Minute); -dt = dt.add(2, tc.TimeUnit.Second); -dt = dt.addLocal(2, tc.TimeUnit.Second); -dt = dt.sub(tc.Duration.seconds(2)); -dt = dt.sub(2, tc.TimeUnit.Year); -dt = dt.sub(2, tc.TimeUnit.Month); -dt = dt.sub(2, tc.TimeUnit.Week); -dt = dt.sub(2, tc.TimeUnit.Day); -dt = dt.sub(2, tc.TimeUnit.Hour); -dt = dt.sub(2, tc.TimeUnit.Minute); -dt = dt.sub(2, tc.TimeUnit.Second); -dt = dt.subLocal(2, tc.TimeUnit.Second); -d = dt.diff(new tc.DateTime(9289234, tc.TimeZone.local())); -b = dt.lessThan(new tc.DateTime(9289234, tc.TimeZone.local())); -b = dt.lessEqual(new tc.DateTime(9289234, tc.TimeZone.local())); -b = dt.greaterThan(new tc.DateTime(9289234, tc.TimeZone.local())); -b = dt.greaterEqual(new tc.DateTime(9289234, tc.TimeZone.local())); -dt = dt.min(new tc.DateTime(9289234, tc.TimeZone.local())); -dt = dt.max(new tc.DateTime(9289234, tc.TimeZone.local())); -s = dt.toIsoString(); -s = dt.toString(); -s = dt.toUtcString(); - -var wd: tc.WeekDay; -wd = dt.weekDay(); -wd = dt.utcWeekDay(); - -// PERIOD - -s = tc.periodDstToString(tc.PeriodDst.RegularIntervals); -s = tc.periodDstToString(tc.PeriodDst.RegularLocalTime); - -var p: tc.Period; - -p = new tc.Period(tc.DateTime.nowLocal(), 1, tc.TimeUnit.Hour, tc.PeriodDst.RegularLocalTime); -dt = p.start(); -n = p.amount(); -var tu: tc.TimeUnit = p.unit(); -var pd: tc.PeriodDst = p.dst(); -dt = p.findFirst(tc.DateTime.nowLocal()); -dt = p.findNext(dt); -s = p.toIsoString(); -s = p.toString(); -b = p.isBoundary(dt); - - -// GLOBALS -d = tc.min(tc.Duration.seconds(2), tc.Duration.seconds(3)); -d = tc.max(tc.Duration.seconds(2), tc.Duration.seconds(3)); - -dt = tc.min(new tc.DateTime(2), new tc.DateTime(3)); -dt = tc.max(new tc.DateTime(2), new tc.DateTime(3)); - - - - - - - - - - - - - - - - - - - - - - diff --git a/timezonecomplete/timezonecomplete-1.8.0.d.ts b/timezonecomplete/timezonecomplete-1.8.0.d.ts deleted file mode 100644 index c8ff2310b..000000000 --- a/timezonecomplete/timezonecomplete-1.8.0.d.ts +++ /dev/null @@ -1,1190 +0,0 @@ -// Type definitions for timezonecomplete 1.8.0 -// Project: https://github.com/SpiritIT/timezonecomplete -// Definitions by: Rogier Schouten -// Definitions: https://github.com/borisyankov/DefinitelyTyped -// Generated by dts-bundle v0.2.0 - -declare module 'timezonecomplete-1.8.0' { - import basics = require("__timezonecomplete/basics"); - export import TimeUnit = basics.TimeUnit; - export import WeekDay = basics.WeekDay; - export import isLeapYear = basics.isLeapYear; - export import daysInMonth = basics.daysInMonth; - export import daysInYear = basics.daysInYear; - export import firstWeekDayOfMonth = basics.firstWeekDayOfMonth; - export import lastWeekDayOfMonth = basics.lastWeekDayOfMonth; - export import weekDayOnOrAfter = basics.weekDayOnOrAfter; - export import weekDayOnOrBefore = basics.weekDayOnOrBefore; - export import weekNumber = basics.weekNumber; - export import weekOfMonth = basics.weekOfMonth; - export import dayOfYear = basics.dayOfYear; - export import secondOfDay = basics.secondOfDay; - import datetime = require("__timezonecomplete/datetime"); - export import DateTime = datetime.DateTime; - import duration = require("__timezonecomplete/duration"); - export import Duration = duration.Duration; - import javascript = require("__timezonecomplete/javascript"); - export import DateFunctions = javascript.DateFunctions; - import period = require("__timezonecomplete/period"); - export import Period = period.Period; - export import PeriodDst = period.PeriodDst; - export import periodDstToString = period.periodDstToString; - import timesource = require("__timezonecomplete/timesource"); - export import TimeSource = timesource.TimeSource; - export import RealTimeSource = timesource.RealTimeSource; - import timezone = require("__timezonecomplete/timezone"); - export import NormalizeOption = timezone.NormalizeOption; - export import TimeZoneKind = timezone.TimeZoneKind; - export import TimeZone = timezone.TimeZone; - import globals = require("__timezonecomplete/globals"); - export import min = globals.min; - export import max = globals.max; -} - -declare module '__timezonecomplete/basics' { - import javascript = require("__timezonecomplete/javascript"); - /** - * Day-of-week. Note the enum values correspond to JavaScript day-of-week: - * Sunday = 0, Monday = 1 etc - */ - export enum WeekDay { - Sunday = 0, - Monday = 1, - Tuesday = 2, - Wednesday = 3, - Thursday = 4, - Friday = 5, - Saturday = 6, - } - /** - * Time units - */ - export enum TimeUnit { - Second = 0, - Minute = 1, - Hour = 2, - Day = 3, - Week = 4, - Month = 5, - Year = 6, - } - /** - * @return True iff the given year is a leap year. - */ - export function isLeapYear(year: number): boolean; - /** - * The days in a given year - */ - export function daysInYear(year: number): number; - /** - * @param year The full year - * @param month The month 1-12 - * @return The number of days in the given month - */ - export function daysInMonth(year: number, month: number): number; - /** - * Returns the day of the year of the given date [0..365]. January first is 0. - * - * @param year The year e.g. 1986 - * @param month Month 1-12 - * @param day Day of month 1-31 - */ - export function dayOfYear(year: number, month: number, day: number): number; - /** - * Returns the last instance of the given weekday in the given month - * - * @param year The year - * @param month the month 1-12 - * @param weekDay the desired week day - * - * @return the last occurrence of the week day in the month - */ - export function lastWeekDayOfMonth(year: number, month: number, weekDay: WeekDay): number; - /** - * Returns the first instance of the given weekday in the given month - * - * @param year The year - * @param month the month 1-12 - * @param weekDay the desired week day - * - * @return the first occurrence of the week day in the month - */ - export function firstWeekDayOfMonth(year: number, month: number, weekDay: WeekDay): number; - /** - * Returns the day-of-month that is on the given weekday and which is >= the given day. - * Throws if the month has no such day. - */ - export function weekDayOnOrAfter(year: number, month: number, day: number, weekDay: WeekDay): number; - /** - * Returns the day-of-month that is on the given weekday and which is <= the given day. - * Throws if the month has no such day. - */ - export function weekDayOnOrBefore(year: number, month: number, day: number, weekDay: WeekDay): number; - /** - * The week of this month. There is no official standard for this, - * but we assume the same rules for the weekNumber (i.e. - * week 1 is the week that has the 4th day of the month in it) - * - * @param year The year - * @param month The month [1-12] - * @param day The day [1-31] - * @return Week number [1-5] - */ - export function weekOfMonth(year: number, month: number, day: number): number; - /** - * The ISO 8601 week number for the given date. Week 1 is the week - * that has January 4th in it, and it starts on Monday. - * See https://en.wikipedia.org/wiki/ISO_week_date - * - * @param year Year e.g. 1988 - * @param month Month 1-12 - * @param day Day of month 1-31 - * - * @return Week number 1-53 - */ - export function weekNumber(year: number, month: number, day: number): number; - /** - * Convert a unix milli timestamp into a TimeT structure. - * This does NOT take leap seconds into account. - */ - export function unixToTimeNoLeapSecs(unixMillis: number): TimeStruct; - /** - * Convert a year, month, day etc into a unix milli timestamp. - * This does NOT take leap seconds into account. - * - * @param year Year e.g. 1970 - * @param month Month 1-12 - * @param day Day 1-31 - * @param hour Hour 0-23 - * @param minute Minute 0-59 - * @param second Second 0-59 (no leap seconds) - * @param milli Millisecond 0-999 - */ - export function timeToUnixNoLeapSecs(year?: number, month?: number, day?: number, hour?: number, minute?: number, second?: number, milli?: number): number; - /** - * Convert a TimeT structure into a unix milli timestamp. - * This does NOT take leap seconds into account. - */ - export function timeToUnixNoLeapSecs(tm: TimeStruct): number; - /** - * Return the day-of-week. - * This does NOT take leap seconds into account. - */ - export function weekDayNoLeapSecs(unixMillis: number): WeekDay; - /** - * N-th second in the day, counting from 0 - */ - export function secondOfDay(hour: number, minute: number, second: number): number; - /** - * Basic representation of a date and time - */ - export class TimeStruct { - /** - * Year, 1970-... - */ - year: number; - /** - * Month 1-12 - */ - month: number; - /** - * Day of month, 1-31 - */ - day: number; - /** - * Hour 0-23 - */ - hour: number; - /** - * Minute 0-59 - */ - minute: number; - /** - * Seconds, 0-59 - */ - second: number; - /** - * Milliseconds 0-999 - */ - milli: number; - /** - * Create a TimeStruct from a number of unix milliseconds - */ - static fromUnix(unixMillis: number): TimeStruct; - /** - * Create a TimeStruct from a JavaScript date - * - * @param d The date - * @param df Which functions to take (getX() or getUTCX()) - */ - static fromDate(d: Date, df: javascript.DateFunctions): TimeStruct; - /** - * Returns a TimeStruct from an ISO 8601 string WITHOUT time zone - */ - static fromString(s: string): TimeStruct; - /** - * Constructor - * - * @param year Year e.g. 1970 - * @param month Month 1-12 - * @param day Day 1-31 - * @param hour Hour 0-23 - * @param minute Minute 0-59 - * @param second Second 0-59 (no leap seconds) - * @param milli Millisecond 0-999 - */ - constructor(/** - * Year, 1970-... - */ - year?: number, /** - * Month 1-12 - */ - month?: number, /** - * Day of month, 1-31 - */ - day?: number, /** - * Hour 0-23 - */ - hour?: number, /** - * Minute 0-59 - */ - minute?: number, /** - * Seconds, 0-59 - */ - second?: number, /** - * Milliseconds 0-999 - */ - milli?: number); - /** - * Validate a TimeStruct, returns false if invalid. - */ - validate(): boolean; - /** - * The day-of-year 0-365 - */ - yearDay(): number; - /** - * Returns this time as a unix millisecond timestamp - * Does NOT take leap seconds into account. - */ - toUnixNoLeapSecs(): number; - /** - * Deep equals - */ - equals(other: TimeStruct): boolean; - /** - * < operator - */ - lessThan(other: TimeStruct): boolean; - clone(): TimeStruct; - valueOf(): number; - /** - * ISO 8601 string YYYY-MM-DDThh:mm:ss.nnn - */ - toString(): string; - inspect(): string; - } -} - -declare module '__timezonecomplete/datetime' { - import basics = require("__timezonecomplete/basics"); - import duration = require("__timezonecomplete/duration"); - import javascript = require("__timezonecomplete/javascript"); - import timesource = require("__timezonecomplete/timesource"); - import timezone = require("__timezonecomplete/timezone"); - /** - * DateTime class which is time zone-aware - * and which can be mocked for testing purposes. - */ - export class DateTime { - /** - * Actual time source in use. Setting this property allows to - * fake time in tests. DateTime.nowLocal() and DateTime.nowUtc() - * use this property for obtaining the current time. - */ - static timeSource: timesource.TimeSource; - /** - * Current date+time in local time (derived from DateTime.timeSource.now()). - */ - static nowLocal(): DateTime; - /** - * Current date+time in UTC time (derived from DateTime.timeSource.now()). - */ - static nowUtc(): DateTime; - /** - * Current date+time in the given time zone (derived from DateTime.timeSource.now()). - * @param timeZone The desired time zone. - */ - static now(timeZone: timezone.TimeZone): DateTime; - /** - * Constructor. Creates current time in local timezone. - */ - constructor(); - /** - * Constructor - * Non-existing local times are normalized by rounding up to the next DST offset. - * - * @param isoString String in ISO 8601 format. Instead of ISO time zone, - * it may include a space and then and IANA time zone. - * e.g. "2007-04-05T12:30:40.500" (no time zone, naive date) - * e.g. "2007-04-05T12:30:40.500+01:00" (UTC offset without daylight saving time) - * or "2007-04-05T12:30:40.500Z" (UTC) - * or "2007-04-05T12:30:40.500 Europe/Amsterdam" (IANA time zone, with daylight saving time if applicable) - * @param timeZone if given, the date in the string is assumed to be in this time zone. - * Note that it is NOT CONVERTED to the time zone. Useful - * for strings without a time zone - */ - constructor(isoString: string, timeZone?: timezone.TimeZone); - /** - * Constructor. You provide a date, then you say whether to take the - * date.getYear()/getXxx methods or the date.getUTCYear()/date.getUTCXxx methods, - * and then you state which time zone that date is in. - * Non-existing local times are normalized by rounding up to the next DST offset. - * Note that the Date class has bugs and inconsistencies when constructing them with times around - * DST changes. - * - * @param date A date object. - * @param getters Specifies which set of Date getters contains the date in the given time zone: the - * Date.getXxx() methods or the Date.getUTCXxx() methods. - * @param timeZone The time zone that the given date is assumed to be in (may be null for unaware dates) - */ - constructor(date: Date, getFuncs: javascript.DateFunctions, timeZone?: timezone.TimeZone); - /** - * Constructor. Note that unlike JavaScript dates we require fields to be in normal ranges. - * Use the add(duration) or sub(duration) for arithmetic. - * @param year The full year (e.g. 2014) - * @param month The month [1-12] (note this deviates from JavaScript Date) - * @param day The day of the month [1-31] - * @param hour The hour of the day [0-24) - * @param minute The minute of the hour [0-59] - * @param second The second of the minute [0-59] - * @param millisecond The millisecond of the second [0-999] - * @param timeZone The time zone, or null (for unaware dates) - */ - constructor(year: number, month: number, day: number, hour?: number, minute?: number, second?: number, millisecond?: number, timeZone?: timezone.TimeZone); - /** - * Constructor - * @param unixTimestamp milliseconds since 1970-01-01T00:00:00.000 - * @param timeZone the time zone that the timestamp is assumed to be in (usually UTC). - */ - constructor(unixTimestamp: number, timeZone?: timezone.TimeZone); - /** - * @return a copy of this object - */ - clone(): DateTime; - /** - * @return The time zone that the date is in. May be null for unaware dates. - */ - zone(): timezone.TimeZone; - /** - * Zone name abbreviation at this time - * @param dstDependent (default true) set to false for a DST-agnostic abbreviation - * @return The abbreviation - */ - zoneAbbreviation(dstDependent?: boolean): string; - /** - * @return the offset w.r.t. UTC in minutes. Returns 0 for unaware dates and for UTC dates. - */ - offset(): number; - /** - * @return The full year e.g. 2014 - */ - year(): number; - /** - * @return The month 1-12 (note this deviates from JavaScript Date) - */ - month(): number; - /** - * @return The day of the month 1-31 - */ - day(): number; - /** - * @return The hour 0-23 - */ - hour(): number; - /** - * @return the minutes 0-59 - */ - minute(): number; - /** - * @return the seconds 0-59 - */ - second(): number; - /** - * @return the milliseconds 0-999 - */ - millisecond(): number; - /** - * @return the day-of-week (the enum values correspond to JavaScript - * week day numbers) - */ - weekDay(): basics.WeekDay; - /** - * Returns the day number within the year: Jan 1st has number 0, - * Jan 2nd has number 1 etc. - * - * @return the day-of-year [0-366] - */ - dayOfYear(): number; - /** - * The ISO 8601 week number. Week 1 is the week - * that has January 4th in it, and it starts on Monday. - * See https://en.wikipedia.org/wiki/ISO_week_date - * - * @return Week number [1-53] - */ - weekNumber(): number; - /** - * The week of this month. There is no official standard for this, - * but we assume the same rules for the weekNumber (i.e. - * week 1 is the week that has the 4th day of the month in it) - * - * @return Week number [1-5] - */ - weekOfMonth(): number; - /** - * Returns the number of seconds that have passed on the current day - * Does not consider leap seconds - * - * @return seconds [0-86399] - */ - secondOfDay(): number; - /** - * @return Milliseconds since 1970-01-01T00:00:00.000Z - */ - unixUtcMillis(): number; - /** - * @return The full year e.g. 2014 - */ - utcYear(): number; - /** - * @return The UTC month 1-12 (note this deviates from JavaScript Date) - */ - utcMonth(): number; - /** - * @return The UTC day of the month 1-31 - */ - utcDay(): number; - /** - * @return The UTC hour 0-23 - */ - utcHour(): number; - /** - * @return The UTC minutes 0-59 - */ - utcMinute(): number; - /** - * @return The UTC seconds 0-59 - */ - utcSecond(): number; - /** - * Returns the UTC day number within the year: Jan 1st has number 0, - * Jan 2nd has number 1 etc. - * - * @return the day-of-year [0-366] - */ - utcDayOfYear(): number; - /** - * @return The UTC milliseconds 0-999 - */ - utcMillisecond(): number; - /** - * @return the UTC day-of-week (the enum values correspond to JavaScript - * week day numbers) - */ - utcWeekDay(): basics.WeekDay; - /** - * The ISO 8601 UTC week number. Week 1 is the week - * that has January 4th in it, and it starts on Monday. - * See https://en.wikipedia.org/wiki/ISO_week_date - * - * @return Week number [1-53] - */ - utcWeekNumber(): number; - /** - * The week of this month. There is no official standard for this, - * but we assume the same rules for the weekNumber (i.e. - * week 1 is the week that has the 4th day of the month in it) - * - * @return Week number [1-5] - */ - utcWeekOfMonth(): number; - /** - * Returns the number of seconds that have passed on the current day - * Does not consider leap seconds - * - * @return seconds [0-86399] - */ - utcSecondOfDay(): number; - /** - * Convert this date to the given time zone (in-place). - * Throws if this date does not have a time zone. - * @return this (for chaining) - */ - convert(zone?: timezone.TimeZone): DateTime; - /** - * Returns this date converted to the given time zone. - * Unaware dates can only be converted to unaware dates (clone) - * Converting an unaware date to an aware date throws an exception. Use the constructor - * if you really need to do that. - * - * @param zone The new time zone. This may be null to create unaware date. - * @return The converted date - */ - toZone(zone?: timezone.TimeZone): DateTime; - /** - * Convert to JavaScript date with the zone time in the getX() methods. - * Unless the timezone is local, the Date.getUTCX() methods will NOT be correct. - * This is because Date calculates getUTCX() from getX() applying local time zone. - */ - toDate(): Date; - /** - * Add a time duration relative to UTC. Note that this simply adds a number - * of milliseconds to UTC and converts back to zone(), - * There is not DST handling. - * @return this + duration - */ - add(duration: duration.Duration): DateTime; - /** - * Add an amount of time relative to UTC, as regularly as possible. - * - * Adding e.g. 1 hour will increment the utcHour() field, adding 1 month - * increments the utcMonth() field. - * Adding an amount of units leaves lower units intact. E.g. - * adding a month will leave the day() field untouched if possible. - * - * Note adding Months or Years will clamp the date to the end-of-month if - * the start date was at the end of a month, i.e. contrary to JavaScript - * Date#setUTCMonth() it will not overflow into the next month - * - * In case of DST changes, the utc time fields are still untouched but local - * time fields may shift. - */ - add(amount: number, unit: basics.TimeUnit): DateTime; - /** - * Add an amount of time to the zone time, as regularly as possible. - * - * Adding e.g. 1 hour will increment the hour() field of the zone - * date by one. In case of DST changes, the time fields may additionally - * increase by the DST offset, if a non-existing local time would - * be reached otherwise. - * - * Adding a unit of time will leave lower-unit fields intact, unless the result - * would be a non-existing time. Then an extra DST offset is added. - * - * Note adding Months or Years will clamp the date to the end-of-month if - * the start date was at the end of a month, i.e. contrary to JavaScript - * Date#setUTCMonth() it will not overflow into the next month - */ - addLocal(amount: number, unit: basics.TimeUnit): DateTime; - /** - * Same as add(-1*duration); - */ - sub(duration: duration.Duration): DateTime; - /** - * Same as add(-1*amount, unit); - */ - sub(amount: number, unit: basics.TimeUnit): DateTime; - /** - * Same as addLocal(-1*amount, unit); - */ - subLocal(amount: number, unit: basics.TimeUnit): DateTime; - /** - * Time difference between two DateTimes - * @return this - other - */ - diff(other: DateTime): duration.Duration; - /** - * @return True iff (this < other) - */ - lessThan(other: DateTime): boolean; - /** - * @return True iff (this <= other) - */ - lessEqual(other: DateTime): boolean; - /** - * @return True iff this and other represent the same time in UTC - */ - equals(other: DateTime): boolean; - /** - * @return True iff this and other represent the same time and - * have the same zone - */ - identical(other: DateTime): boolean; - /** - * @return True iff this > other - */ - greaterThan(other: DateTime): boolean; - /** - * @return True iff this >= other - */ - greaterEqual(other: DateTime): boolean; - /** - * @return The minimum of this and other - */ - min(other: DateTime): DateTime; - /** - * @return The maximum of this and other - */ - max(other: DateTime): DateTime; - /** - * Proper ISO 8601 format string with any IANA zone converted to ISO offset - * E.g. "2014-01-01T23:15:33+01:00" for Europe/Amsterdam - */ - toIsoString(): string; - /** - * Return a string representation of the DateTime according to the - * specified format. The format is implemented as the LDML standard - * (http://unicode.org/reports/tr35/tr35-dates.html#Date_Format_Patterns) - * - * @param formatString The format specification (e.g. "dd/MM/yyyy HH:mm:ss") - * @return The string representation of this DateTime - */ - format(formatString: string): string; - /** - * Modified ISO 8601 format string with IANA name if applicable. - * E.g. "2014-01-01T23:15:33.000 Europe/Amsterdam" - */ - toString(): string; - /** - * Used by util.inspect() - */ - inspect(): string; - /** - * The valueOf() method returns the primitive value of the specified object. - */ - valueOf(): any; - /** - * Modified ISO 8601 format string in UTC without time zone info - */ - toUtcString(): string; - } -} - -declare module '__timezonecomplete/duration' { - /** - * Time duration. Create one e.g. like this: var d = Duration.hours(1). - * Note that time durations do not take leap seconds etc. into account: - * one hour is simply represented as 3600000 milliseconds. - */ - export class Duration { - /** - * Construct a time duration - * @param n Number of hours - * @return A duration of n hours - */ - static hours(n: number): Duration; - /** - * Construct a time duration - * @param n Number of minutes - * @return A duration of n minutes - */ - static minutes(n: number): Duration; - /** - * Construct a time duration - * @param n Number of seconds - * @return A duration of n seconds - */ - static seconds(n: number): Duration; - /** - * Construct a time duration - * @param n Number of milliseconds - * @return A duration of n milliseconds - */ - static milliseconds(n: number): Duration; - /** - * Construct a time duration of 0 - */ - constructor(); - /** - * Construct a time duration from a number of milliseconds - */ - constructor(milliseconds: number); - /** - * Construct a time duration from a string in format - * [-]h[:m[:s[.n]]] e.g. -01:00:30.501 - */ - constructor(input: string); - /** - * @return another instance of Duration with the same value. - */ - clone(): Duration; - /** - * The entire duration in milliseconds (negative or positive) - */ - milliseconds(): number; - /** - * The millisecond part of the duration (always positive) - * @return e.g. 400 for a -01:02:03.400 duration - */ - millisecond(): number; - /** - * The entire duration in seconds (negative or positive, fractional) - * @return e.g. 1.5 for a 1500 milliseconds duration - */ - seconds(): number; - /** - * The second part of the duration (always positive) - * @return e.g. 3 for a -01:02:03.400 duration - */ - second(): number; - /** - * The entire duration in minutes (negative or positive, fractional) - * @return e.g. 1.5 for a 90000 milliseconds duration - */ - minutes(): number; - /** - * The minute part of the duration (always positive) - * @return e.g. 2 for a -01:02:03.400 duration - */ - minute(): number; - /** - * The entire duration in hours (negative or positive, fractional) - * @return e.g. 1.5 for a 5400000 milliseconds duration - */ - hours(): number; - /** - * The hour part of the duration (always positive). - * Note that this part can exceed 23 hours, because for - * now, we do not have a days() function - * @return e.g. 25 for a -25:02:03.400 duration - */ - wholeHours(): number; - /** - * Sign - * @return "-" if the duration is negative - */ - sign(): string; - /** - * @return True iff (this < other) - */ - lessThan(other: Duration): boolean; - /** - * @return True iff (this <= other) - */ - lessEqual(other: Duration): boolean; - /** - * @return True iff this and other represent the same time duration - */ - equals(other: Duration): boolean; - /** - * @return True iff this > other - */ - greaterThan(other: Duration): boolean; - /** - * @return True iff this >= other - */ - greaterEqual(other: Duration): boolean; - /** - * @return The minimum (most negative) of this and other - */ - min(other: Duration): Duration; - /** - * @return The maximum (most positive) of this and other - */ - max(other: Duration): Duration; - /** - * Multiply with a fixed number. - * @return a new Duration of (this * value) - */ - multiply(value: number): Duration; - /** - * Divide by a fixed number. - * @return a new Duration of (this / value) - */ - divide(value: number): Duration; - /** - * Add a duration. - * @return a new Duration of (this + value) - */ - add(value: Duration): Duration; - /** - * Subtract a duration. - * @return a new Duration of (this - value) - */ - sub(value: Duration): Duration; - /** - * String in [-]hh:mm:ss.nnn notation. All fields are - * always present except the sign. - */ - toFullString(): string; - /** - * String in [-]hh[:mm[:ss[.nnn]]] notation. Fields are - * added as necessary - */ - toString(): string; - /** - * Used by util.inspect() - */ - inspect(): string; - /** - * The valueOf() method returns the primitive value of the specified object. - */ - valueOf(): any; - } -} - -declare module '__timezonecomplete/javascript' { - /** - * Indicates how a Date object should be interpreted. - * Either we can take getYear(), getMonth() etc for our field - * values, or we can take getUTCYear(), getUtcMonth() etc to do that. - */ - export enum DateFunctions { - /** - * Use the Date.getFullYear(), Date.getMonth(), ... functions. - */ - Get = 0, - /** - * Use the Date.getUTCFullYear(), Date.getUTCMonth(), ... functions. - */ - GetUTC = 1, - } -} - -declare module '__timezonecomplete/period' { - import basics = require("__timezonecomplete/basics"); - import datetime = require("__timezonecomplete/datetime"); - /** - * Specifies how the period should repeat across the day - * during DST changes. - */ - export enum PeriodDst { - /** - * Keep repeating in similar intervals measured in UTC, - * unaffected by Daylight Saving Time. - * E.g. a repetition of one hour will take one real hour - * every time, even in a time zone with DST. - * Leap seconds, leap days and month length - * differences will still make the intervals different. - */ - RegularIntervals = 0, - /** - * Ensure that the time at which the intervals occur stay - * at the same place in the day, local time. So e.g. - * a period of one day, starting at 8:05AM Europe/Amsterdam time - * will always start at 8:05 Europe/Amsterdam. This means that - * in UTC time, some intervals will be 25 hours and some - * 23 hours during DST changes. - * Another example: an hourly interval will be hourly in local time, - * skipping an hour in UTC for a DST backward change. - */ - RegularLocalTime = 1, - } - /** - * Convert a PeriodDst to a string: "regular intervals" or "regular local time" - */ - export function periodDstToString(p: PeriodDst): string; - /** - * Repeating time period: consists of a starting point and - * a time length. This class accounts for leap seconds and leap days. - */ - export class Period { - /** - * Constructor - * LIMITATION: if dst equals RegularLocalTime, and unit is Second, Minute or Hour, - * then the amount must be a factor of 24. So 120 seconds is allowed while 121 seconds is not. - * This is due to the enormous processing power required by these cases. They are not - * implemented and you will get an assert. - * - * @param start The start of the period. If the period is in Months or Years, and - * the day is 29 or 30 or 31, the results are maximised to end-of-month. - * @param amount The amount of units. - * @param unit The unit. - * @param dst Specifies how to handle Daylight Saving Time. Not relevant - * if the time zone of the start datetime does not have DST. - */ - constructor(start: datetime.DateTime, amount: number, unit: basics.TimeUnit, dst: PeriodDst); - /** - * The start date - */ - start(): datetime.DateTime; - /** - * The amount of units - */ - amount(): number; - /** - * The unit - */ - unit(): basics.TimeUnit; - /** - * The dst handling mode - */ - dst(): PeriodDst; - /** - * The first occurrence of the period greater than - * the given date. The given date need not be at a period boundary. - * Pre: the fromdate and startdate must either both have timezones or not - * @param fromDate: the date after which to return the next date - * @return the first date matching the period after fromDate, given - * in the same zone as the fromDate. - */ - findFirst(fromDate: datetime.DateTime): datetime.DateTime; - /** - * Returns the next timestamp in the period. The given timestamp must - * be at a period boundary, otherwise the answer is incorrect. - * This function has MUCH better performance than findFirst. - * Returns the datetime "count" times away from the given datetime. - * @param prev Boundary date. Must have a time zone (any time zone) iff the period start date has one. - * @param count Optional, must be >= 1 and whole. - * @return (prev + count * period), in the same timezone as prev. - */ - findNext(prev: datetime.DateTime, count?: number): datetime.DateTime; - /** - * Checks whether the given date is on a period boundary - * (expensive!) - */ - isBoundary(occurrence: datetime.DateTime): boolean; - /** - * Returns an ISO duration string e.g. - * 2014-01-01T12:00:00.000+01:00/P1H - * 2014-01-01T12:00:00.000+01:00/PT1M (one minute) - * 2014-01-01T12:00:00.000+01:00/P1M (one month) - */ - toIsoString(): string; - /** - * A string representation e.g. - * "10 years, starting at 2014-03-01T12:00:00 Europe/Amsterdam, keeping regular intervals". - */ - toString(): string; - /** - * Used by util.inspect() - */ - inspect(): string; - } -} - -declare module '__timezonecomplete/timesource' { - /** - * For testing purposes, we often need to manipulate what the current - * time is. This is an interface for a custom time source object - * so in tests you can use a custom time source. - */ - export interface TimeSource { - /** - * Return the current date+time as a javascript Date object - */ - now(): Date; - } - /** - * Default time source, returns actual time - */ - export class RealTimeSource implements TimeSource { - now(): Date; - } -} - -declare module '__timezonecomplete/timezone' { - import javascript = require("__timezonecomplete/javascript"); - /** - * The type of time zone - */ - export enum TimeZoneKind { - /** - * Local time offset as determined by JavaScript Date class. - */ - Local = 0, - /** - * Fixed offset from UTC, without DST. - */ - Offset = 1, - /** - * IANA timezone managed through Olsen TZ database. Includes - * DST if applicable. - */ - Proper = 2, - } - /** - * Option for TimeZone#normalizeLocal() - */ - export enum NormalizeOption { - /** - * Normalize non-existing times by ADDING the DST offset - */ - Up = 0, - /** - * Normalize non-existing times by SUBTRACTING the DST offset - */ - Down = 1, - } - /** - * Time zone. The object is immutable because it is cached: - * requesting a time zone twice yields the very same object. - * Note that we use time zone offsets inverted w.r.t. JavaScript Date.getTimezoneOffset(), - * i.e. offset 90 means +01:30. - * - * Time zones come in three flavors: the local time zone, as calculated by JavaScript Date, - * a fixed offset ("+01:30") without DST, or a IANA timezone ("Europe/Amsterdam") with DST - * applied depending on the time zone rules. - */ - export class TimeZone { - /** - * The local time zone for a given date. Note that - * the time zone varies with the date: amsterdam time for - * 2014-01-01 is +01:00 and amsterdam time for 2014-07-01 is +02:00 - */ - static local(): TimeZone; - /** - * The UTC time zone. - */ - static utc(): TimeZone; - /** - * Returns a time zone object from the cache. If it does not exist, it is created. - * @return The time zone with the given offset w.r.t. UTC in minutes, e.g. 90 for +01:30 - */ - static zone(offset: number): TimeZone; - /** - * Returns a time zone object from the cache. If it does not exist, it is created. - * @param s: Empty string for local time, a TZ database time zone name (e.g. Europe/Amsterdam) - * or an offset string (either +01:30, +0130, +01, Z). For a full list of names, see: - * https://en.wikipedia.org/wiki/List_of_tz_database_time_zones - */ - static zone(s: string): TimeZone; - /** - * Do not use this constructor, use the static - * TimeZone.zone() method instead. - * @param name NORMALIZED name, assumed to be correct - */ - constructor(name: string); - /** - * The time zone identifier. Can be an offset "-01:30" or an - * IANA time zone name "Europe/Amsterdam", or "localtime" for - * the local time zone. - */ - name(): string; - /** - * The kind of time zone (Local/Offset/Proper) - */ - kind(): TimeZoneKind; - /** - * Equality operator. Maps zero offsets and different names for UTC onto - * each other. Other time zones are not mapped onto each other. - */ - equals(other: TimeZone): boolean; - /** - * Is this zone equivalent to UTC? - */ - isUtc(): boolean; - /** - * Does this zone have Daylight Saving Time at all? - */ - hasDst(): boolean; - /** - * Calculate timezone offset from a UTC time. - * - * @param year Full year - * @param month Month 1-12 (note this deviates from JavaScript date) - * @param day Day of month 1-31 - * @param hour Hour 0-23 - * @param minute Minute 0-59 - * @param second Second 0-59 - * @param millisecond Millisecond 0-999 - * - * @return the offset of this time zone with respect to UTC at the given time, in minutes. - */ - offsetForUtc(year: number, month: number, day: number, hour?: number, minute?: number, second?: number, millisecond?: number): number; - /** - * Calculate timezone offset from a zone-local time (NOT a UTC time). - * @param year local full year - * @param month local month 1-12 (note this deviates from JavaScript date) - * @param day local day of month 1-31 - * @param hour local hour 0-23 - * @param minute local minute 0-59 - * @param second local second 0-59 - * @param millisecond local millisecond 0-999 - * @return the offset of this time zone with respect to UTC at the given time, in minutes. - */ - offsetForZone(year: number, month: number, day: number, hour?: number, minute?: number, second?: number, millisecond?: number): number; - /** - * Note: will be removed in version 2.0.0 - * - * Convenience function, takes values from a Javascript Date - * Calls offsetForUtc() with the contents of the date - * - * @param date: the date - * @param funcs: the set of functions to use: get() or getUTC() - */ - offsetForUtcDate(date: Date, funcs: javascript.DateFunctions): number; - /** - * Note: will be removed in version 2.0.0 - * - * Convenience function, takes values from a Javascript Date - * Calls offsetForUtc() with the contents of the date - * - * @param date: the date - * @param funcs: the set of functions to use: get() or getUTC() - */ - offsetForZoneDate(date: Date, funcs: javascript.DateFunctions): number; - /** - * Zone abbreviation at given UTC timestamp e.g. CEST for Central European Summer Time. - * - * @param year Full year - * @param month Month 1-12 (note this deviates from JavaScript date) - * @param day Day of month 1-31 - * @param hour Hour 0-23 - * @param minute Minute 0-59 - * @param second Second 0-59 - * @param millisecond Millisecond 0-999 - * @param dstDependent (default true) set to false for a DST-agnostic abbreviation - * - * @return "local" for local timezone, the offset for an offset zone, or the abbreviation for a proper zone. - */ - abbreviationForUtc(year: number, month: number, day: number, hour?: number, minute?: number, second?: number, millisecond?: number, dstDependent?: boolean): string; - /** - * Normalizes non-existing local times by adding a forward offset change. - * During a forward standard offset change or DST offset change, some amount of - * local time is skipped. Therefore, this amount of local time does not exist. - * This function adds the amount of forward change to any non-existing time. After all, - * this is probably what the user meant. - * - * @param localUnixMillis Unix timestamp in zone time - * @param opt (optional) Round up or down? Default: up - * - * @returns Unix timestamp in zone time, normalized. - */ - normalizeZoneTime(localUnixMillis: number, opt?: NormalizeOption): number; - /** - * The time zone identifier (normalized). - * Either "localtime", IANA name, or "+hh:mm" offset. - */ - toString(): string; - /** - * Used by util.inspect() - */ - inspect(): string; - /** - * Convert an offset number into an offset string - * @param offset The offset in minutes from UTC e.g. 90 minutes - * @return the offset in ISO notation "+01:30" for +90 minutes - */ - static offsetToString(offset: number): string; - /** - * String to offset conversion. - * @param s Formats: "-01:00", "-0100", "-01", "Z" - * @return offset w.r.t. UTC in minutes - */ - static stringToOffset(s: string): number; - } -} - -declare module '__timezonecomplete/globals' { - import datetime = require("__timezonecomplete/datetime"); - import duration = require("__timezonecomplete/duration"); - /** - * Returns the minimum of two DateTimes - */ - export function min(d1: datetime.DateTime, d2: datetime.DateTime): datetime.DateTime; - /** - * Returns the minimum of two Durations - */ - export function min(d1: duration.Duration, d2: duration.Duration): duration.Duration; - /** - * Returns the maximum of two DateTimes - */ - export function max(d1: datetime.DateTime, d2: datetime.DateTime): datetime.DateTime; - /** - * Returns the maximum of two Durations - */ - export function max(d1: duration.Duration, d2: duration.Duration): duration.Duration; -} - diff --git a/timezonecomplete/timezonecomplete-1.9.0.d.ts b/timezonecomplete/timezonecomplete-1.9.0.d.ts deleted file mode 100644 index 0490ee94d..000000000 --- a/timezonecomplete/timezonecomplete-1.9.0.d.ts +++ /dev/null @@ -1,1207 +0,0 @@ -// Type definitions for timezonecomplete 1.9.0 -// Project: https://github.com/SpiritIT/timezonecomplete -// Definitions by: Rogier Schouten -// Definitions: https://github.com/borisyankov/DefinitelyTyped -// Generated by dts-bundle v0.2.0 - -declare module 'timezonecomplete-1.9.0' { - import basics = require("__timezonecomplete/basics"); - export import TimeUnit = basics.TimeUnit; - export import WeekDay = basics.WeekDay; - export import timeUnitToMilliseconds = basics.timeUnitToMilliseconds; - export import isLeapYear = basics.isLeapYear; - export import daysInMonth = basics.daysInMonth; - export import daysInYear = basics.daysInYear; - export import firstWeekDayOfMonth = basics.firstWeekDayOfMonth; - export import lastWeekDayOfMonth = basics.lastWeekDayOfMonth; - export import weekDayOnOrAfter = basics.weekDayOnOrAfter; - export import weekDayOnOrBefore = basics.weekDayOnOrBefore; - export import weekNumber = basics.weekNumber; - export import weekOfMonth = basics.weekOfMonth; - export import dayOfYear = basics.dayOfYear; - export import secondOfDay = basics.secondOfDay; - import datetime = require("__timezonecomplete/datetime"); - export import DateTime = datetime.DateTime; - import duration = require("__timezonecomplete/duration"); - export import Duration = duration.Duration; - import javascript = require("__timezonecomplete/javascript"); - export import DateFunctions = javascript.DateFunctions; - import period = require("__timezonecomplete/period"); - export import Period = period.Period; - export import PeriodDst = period.PeriodDst; - export import periodDstToString = period.periodDstToString; - import timesource = require("__timezonecomplete/timesource"); - export import TimeSource = timesource.TimeSource; - export import RealTimeSource = timesource.RealTimeSource; - import timezone = require("__timezonecomplete/timezone"); - export import NormalizeOption = timezone.NormalizeOption; - export import TimeZoneKind = timezone.TimeZoneKind; - export import TimeZone = timezone.TimeZone; - import globals = require("__timezonecomplete/globals"); - export import min = globals.min; - export import max = globals.max; -} - -declare module '__timezonecomplete/basics' { - import javascript = require("__timezonecomplete/javascript"); - /** - * Day-of-week. Note the enum values correspond to JavaScript day-of-week: - * Sunday = 0, Monday = 1 etc - */ - export enum WeekDay { - Sunday = 0, - Monday = 1, - Tuesday = 2, - Wednesday = 3, - Thursday = 4, - Friday = 5, - Saturday = 6, - } - /** - * Time units - */ - export enum TimeUnit { - Second = 0, - Minute = 1, - Hour = 2, - Day = 3, - Week = 4, - Month = 5, - Year = 6, - } - /** - * Approximate number of milliseconds for a time unit. - * A day is assumed to have 24 hours, a month is assumed to equal 30 days - * and a year is set to 365 days. - * - * @param unit Time unit e.g. TimeUnit.Month - * @returns The number of milliseconds. - */ - export function timeUnitToMilliseconds(unit: TimeUnit): number; - /** - * @return True iff the given year is a leap year. - */ - export function isLeapYear(year: number): boolean; - /** - * The days in a given year - */ - export function daysInYear(year: number): number; - /** - * @param year The full year - * @param month The month 1-12 - * @return The number of days in the given month - */ - export function daysInMonth(year: number, month: number): number; - /** - * Returns the day of the year of the given date [0..365]. January first is 0. - * - * @param year The year e.g. 1986 - * @param month Month 1-12 - * @param day Day of month 1-31 - */ - export function dayOfYear(year: number, month: number, day: number): number; - /** - * Returns the last instance of the given weekday in the given month - * - * @param year The year - * @param month the month 1-12 - * @param weekDay the desired week day - * - * @return the last occurrence of the week day in the month - */ - export function lastWeekDayOfMonth(year: number, month: number, weekDay: WeekDay): number; - /** - * Returns the first instance of the given weekday in the given month - * - * @param year The year - * @param month the month 1-12 - * @param weekDay the desired week day - * - * @return the first occurrence of the week day in the month - */ - export function firstWeekDayOfMonth(year: number, month: number, weekDay: WeekDay): number; - /** - * Returns the day-of-month that is on the given weekday and which is >= the given day. - * Throws if the month has no such day. - */ - export function weekDayOnOrAfter(year: number, month: number, day: number, weekDay: WeekDay): number; - /** - * Returns the day-of-month that is on the given weekday and which is <= the given day. - * Throws if the month has no such day. - */ - export function weekDayOnOrBefore(year: number, month: number, day: number, weekDay: WeekDay): number; - /** - * The week of this month. There is no official standard for this, - * but we assume the same rules for the weekNumber (i.e. - * week 1 is the week that has the 4th day of the month in it) - * - * @param year The year - * @param month The month [1-12] - * @param day The day [1-31] - * @return Week number [1-5] - */ - export function weekOfMonth(year: number, month: number, day: number): number; - /** - * The ISO 8601 week number for the given date. Week 1 is the week - * that has January 4th in it, and it starts on Monday. - * See https://en.wikipedia.org/wiki/ISO_week_date - * - * @param year Year e.g. 1988 - * @param month Month 1-12 - * @param day Day of month 1-31 - * - * @return Week number 1-53 - */ - export function weekNumber(year: number, month: number, day: number): number; - /** - * Convert a unix milli timestamp into a TimeT structure. - * This does NOT take leap seconds into account. - */ - export function unixToTimeNoLeapSecs(unixMillis: number): TimeStruct; - /** - * Convert a year, month, day etc into a unix milli timestamp. - * This does NOT take leap seconds into account. - * - * @param year Year e.g. 1970 - * @param month Month 1-12 - * @param day Day 1-31 - * @param hour Hour 0-23 - * @param minute Minute 0-59 - * @param second Second 0-59 (no leap seconds) - * @param milli Millisecond 0-999 - */ - export function timeToUnixNoLeapSecs(year?: number, month?: number, day?: number, hour?: number, minute?: number, second?: number, milli?: number): number; - /** - * Convert a TimeT structure into a unix milli timestamp. - * This does NOT take leap seconds into account. - */ - export function timeToUnixNoLeapSecs(tm: TimeStruct): number; - /** - * Return the day-of-week. - * This does NOT take leap seconds into account. - */ - export function weekDayNoLeapSecs(unixMillis: number): WeekDay; - /** - * N-th second in the day, counting from 0 - */ - export function secondOfDay(hour: number, minute: number, second: number): number; - /** - * Basic representation of a date and time - */ - export class TimeStruct { - /** - * Year, 1970-... - */ - year: number; - /** - * Month 1-12 - */ - month: number; - /** - * Day of month, 1-31 - */ - day: number; - /** - * Hour 0-23 - */ - hour: number; - /** - * Minute 0-59 - */ - minute: number; - /** - * Seconds, 0-59 - */ - second: number; - /** - * Milliseconds 0-999 - */ - milli: number; - /** - * Create a TimeStruct from a number of unix milliseconds - */ - static fromUnix(unixMillis: number): TimeStruct; - /** - * Create a TimeStruct from a JavaScript date - * - * @param d The date - * @param df Which functions to take (getX() or getUTCX()) - */ - static fromDate(d: Date, df: javascript.DateFunctions): TimeStruct; - /** - * Returns a TimeStruct from an ISO 8601 string WITHOUT time zone - */ - static fromString(s: string): TimeStruct; - /** - * Constructor - * - * @param year Year e.g. 1970 - * @param month Month 1-12 - * @param day Day 1-31 - * @param hour Hour 0-23 - * @param minute Minute 0-59 - * @param second Second 0-59 (no leap seconds) - * @param milli Millisecond 0-999 - */ - constructor(/** - * Year, 1970-... - */ - year?: number, /** - * Month 1-12 - */ - month?: number, /** - * Day of month, 1-31 - */ - day?: number, /** - * Hour 0-23 - */ - hour?: number, /** - * Minute 0-59 - */ - minute?: number, /** - * Seconds, 0-59 - */ - second?: number, /** - * Milliseconds 0-999 - */ - milli?: number); - /** - * Validate a TimeStruct, returns false if invalid. - */ - validate(): boolean; - /** - * The day-of-year 0-365 - */ - yearDay(): number; - /** - * Returns this time as a unix millisecond timestamp - * Does NOT take leap seconds into account. - */ - toUnixNoLeapSecs(): number; - /** - * Deep equals - */ - equals(other: TimeStruct): boolean; - /** - * < operator - */ - lessThan(other: TimeStruct): boolean; - clone(): TimeStruct; - valueOf(): number; - /** - * ISO 8601 string YYYY-MM-DDThh:mm:ss.nnn - */ - toString(): string; - inspect(): string; - } -} - -declare module '__timezonecomplete/datetime' { - import basics = require("__timezonecomplete/basics"); - import duration = require("__timezonecomplete/duration"); - import javascript = require("__timezonecomplete/javascript"); - import timesource = require("__timezonecomplete/timesource"); - import timezone = require("__timezonecomplete/timezone"); - /** - * DateTime class which is time zone-aware - * and which can be mocked for testing purposes. - */ - export class DateTime { - /** - * Actual time source in use. Setting this property allows to - * fake time in tests. DateTime.nowLocal() and DateTime.nowUtc() - * use this property for obtaining the current time. - */ - static timeSource: timesource.TimeSource; - /** - * Current date+time in local time (derived from DateTime.timeSource.now()). - */ - static nowLocal(): DateTime; - /** - * Current date+time in UTC time (derived from DateTime.timeSource.now()). - */ - static nowUtc(): DateTime; - /** - * Current date+time in the given time zone (derived from DateTime.timeSource.now()). - * @param timeZone The desired time zone. - */ - static now(timeZone: timezone.TimeZone): DateTime; - /** - * Constructor. Creates current time in local timezone. - */ - constructor(); - /** - * Constructor - * Non-existing local times are normalized by rounding up to the next DST offset. - * - * @param isoString String in ISO 8601 format. Instead of ISO time zone, - * it may include a space and then and IANA time zone. - * e.g. "2007-04-05T12:30:40.500" (no time zone, naive date) - * e.g. "2007-04-05T12:30:40.500+01:00" (UTC offset without daylight saving time) - * or "2007-04-05T12:30:40.500Z" (UTC) - * or "2007-04-05T12:30:40.500 Europe/Amsterdam" (IANA time zone, with daylight saving time if applicable) - * @param timeZone if given, the date in the string is assumed to be in this time zone. - * Note that it is NOT CONVERTED to the time zone. Useful - * for strings without a time zone - */ - constructor(isoString: string, timeZone?: timezone.TimeZone); - /** - * Constructor. You provide a date, then you say whether to take the - * date.getYear()/getXxx methods or the date.getUTCYear()/date.getUTCXxx methods, - * and then you state which time zone that date is in. - * Non-existing local times are normalized by rounding up to the next DST offset. - * Note that the Date class has bugs and inconsistencies when constructing them with times around - * DST changes. - * - * @param date A date object. - * @param getters Specifies which set of Date getters contains the date in the given time zone: the - * Date.getXxx() methods or the Date.getUTCXxx() methods. - * @param timeZone The time zone that the given date is assumed to be in (may be null for unaware dates) - */ - constructor(date: Date, getFuncs: javascript.DateFunctions, timeZone?: timezone.TimeZone); - /** - * Constructor. Note that unlike JavaScript dates we require fields to be in normal ranges. - * Use the add(duration) or sub(duration) for arithmetic. - * @param year The full year (e.g. 2014) - * @param month The month [1-12] (note this deviates from JavaScript Date) - * @param day The day of the month [1-31] - * @param hour The hour of the day [0-24) - * @param minute The minute of the hour [0-59] - * @param second The second of the minute [0-59] - * @param millisecond The millisecond of the second [0-999] - * @param timeZone The time zone, or null (for unaware dates) - */ - constructor(year: number, month: number, day: number, hour?: number, minute?: number, second?: number, millisecond?: number, timeZone?: timezone.TimeZone); - /** - * Constructor - * @param unixTimestamp milliseconds since 1970-01-01T00:00:00.000 - * @param timeZone the time zone that the timestamp is assumed to be in (usually UTC). - */ - constructor(unixTimestamp: number, timeZone?: timezone.TimeZone); - /** - * @return a copy of this object - */ - clone(): DateTime; - /** - * @return The time zone that the date is in. May be null for unaware dates. - */ - zone(): timezone.TimeZone; - /** - * Zone name abbreviation at this time - * @param dstDependent (default true) set to false for a DST-agnostic abbreviation - * @return The abbreviation - */ - zoneAbbreviation(dstDependent?: boolean): string; - /** - * @return the offset w.r.t. UTC in minutes. Returns 0 for unaware dates and for UTC dates. - */ - offset(): number; - /** - * @return The full year e.g. 2014 - */ - year(): number; - /** - * @return The month 1-12 (note this deviates from JavaScript Date) - */ - month(): number; - /** - * @return The day of the month 1-31 - */ - day(): number; - /** - * @return The hour 0-23 - */ - hour(): number; - /** - * @return the minutes 0-59 - */ - minute(): number; - /** - * @return the seconds 0-59 - */ - second(): number; - /** - * @return the milliseconds 0-999 - */ - millisecond(): number; - /** - * @return the day-of-week (the enum values correspond to JavaScript - * week day numbers) - */ - weekDay(): basics.WeekDay; - /** - * Returns the day number within the year: Jan 1st has number 0, - * Jan 2nd has number 1 etc. - * - * @return the day-of-year [0-366] - */ - dayOfYear(): number; - /** - * The ISO 8601 week number. Week 1 is the week - * that has January 4th in it, and it starts on Monday. - * See https://en.wikipedia.org/wiki/ISO_week_date - * - * @return Week number [1-53] - */ - weekNumber(): number; - /** - * The week of this month. There is no official standard for this, - * but we assume the same rules for the weekNumber (i.e. - * week 1 is the week that has the 4th day of the month in it) - * - * @return Week number [1-5] - */ - weekOfMonth(): number; - /** - * Returns the number of seconds that have passed on the current day - * Does not consider leap seconds - * - * @return seconds [0-86399] - */ - secondOfDay(): number; - /** - * @return Milliseconds since 1970-01-01T00:00:00.000Z - */ - unixUtcMillis(): number; - /** - * @return The full year e.g. 2014 - */ - utcYear(): number; - /** - * @return The UTC month 1-12 (note this deviates from JavaScript Date) - */ - utcMonth(): number; - /** - * @return The UTC day of the month 1-31 - */ - utcDay(): number; - /** - * @return The UTC hour 0-23 - */ - utcHour(): number; - /** - * @return The UTC minutes 0-59 - */ - utcMinute(): number; - /** - * @return The UTC seconds 0-59 - */ - utcSecond(): number; - /** - * Returns the UTC day number within the year: Jan 1st has number 0, - * Jan 2nd has number 1 etc. - * - * @return the day-of-year [0-366] - */ - utcDayOfYear(): number; - /** - * @return The UTC milliseconds 0-999 - */ - utcMillisecond(): number; - /** - * @return the UTC day-of-week (the enum values correspond to JavaScript - * week day numbers) - */ - utcWeekDay(): basics.WeekDay; - /** - * The ISO 8601 UTC week number. Week 1 is the week - * that has January 4th in it, and it starts on Monday. - * See https://en.wikipedia.org/wiki/ISO_week_date - * - * @return Week number [1-53] - */ - utcWeekNumber(): number; - /** - * The week of this month. There is no official standard for this, - * but we assume the same rules for the weekNumber (i.e. - * week 1 is the week that has the 4th day of the month in it) - * - * @return Week number [1-5] - */ - utcWeekOfMonth(): number; - /** - * Returns the number of seconds that have passed on the current day - * Does not consider leap seconds - * - * @return seconds [0-86399] - */ - utcSecondOfDay(): number; - /** - * Convert this date to the given time zone (in-place). - * Throws if this date does not have a time zone. - * @return this (for chaining) - */ - convert(zone?: timezone.TimeZone): DateTime; - /** - * Returns this date converted to the given time zone. - * Unaware dates can only be converted to unaware dates (clone) - * Converting an unaware date to an aware date throws an exception. Use the constructor - * if you really need to do that. - * - * @param zone The new time zone. This may be null to create unaware date. - * @return The converted date - */ - toZone(zone?: timezone.TimeZone): DateTime; - /** - * Convert to JavaScript date with the zone time in the getX() methods. - * Unless the timezone is local, the Date.getUTCX() methods will NOT be correct. - * This is because Date calculates getUTCX() from getX() applying local time zone. - */ - toDate(): Date; - /** - * Add a time duration relative to UTC. Note that this simply adds a number - * of milliseconds to UTC and converts back to zone(), - * There is not DST handling. - * @return this + duration - */ - add(duration: duration.Duration): DateTime; - /** - * Add an amount of time relative to UTC, as regularly as possible. - * - * Adding e.g. 1 hour will increment the utcHour() field, adding 1 month - * increments the utcMonth() field. - * Adding an amount of units leaves lower units intact. E.g. - * adding a month will leave the day() field untouched if possible. - * - * Note adding Months or Years will clamp the date to the end-of-month if - * the start date was at the end of a month, i.e. contrary to JavaScript - * Date#setUTCMonth() it will not overflow into the next month - * - * In case of DST changes, the utc time fields are still untouched but local - * time fields may shift. - */ - add(amount: number, unit: basics.TimeUnit): DateTime; - /** - * Add an amount of time to the zone time, as regularly as possible. - * - * Adding e.g. 1 hour will increment the hour() field of the zone - * date by one. In case of DST changes, the time fields may additionally - * increase by the DST offset, if a non-existing local time would - * be reached otherwise. - * - * Adding a unit of time will leave lower-unit fields intact, unless the result - * would be a non-existing time. Then an extra DST offset is added. - * - * Note adding Months or Years will clamp the date to the end-of-month if - * the start date was at the end of a month, i.e. contrary to JavaScript - * Date#setUTCMonth() it will not overflow into the next month - */ - addLocal(amount: number, unit: basics.TimeUnit): DateTime; - /** - * Same as add(-1*duration); - */ - sub(duration: duration.Duration): DateTime; - /** - * Same as add(-1*amount, unit); - */ - sub(amount: number, unit: basics.TimeUnit): DateTime; - /** - * Same as addLocal(-1*amount, unit); - */ - subLocal(amount: number, unit: basics.TimeUnit): DateTime; - /** - * Time difference between two DateTimes - * @return this - other - */ - diff(other: DateTime): duration.Duration; - /** - * @return True iff (this < other) - */ - lessThan(other: DateTime): boolean; - /** - * @return True iff (this <= other) - */ - lessEqual(other: DateTime): boolean; - /** - * @return True iff this and other represent the same time in UTC - */ - equals(other: DateTime): boolean; - /** - * @return True iff this and other represent the same time and - * have the same zone - */ - identical(other: DateTime): boolean; - /** - * @return True iff this > other - */ - greaterThan(other: DateTime): boolean; - /** - * @return True iff this >= other - */ - greaterEqual(other: DateTime): boolean; - /** - * @return The minimum of this and other - */ - min(other: DateTime): DateTime; - /** - * @return The maximum of this and other - */ - max(other: DateTime): DateTime; - /** - * Proper ISO 8601 format string with any IANA zone converted to ISO offset - * E.g. "2014-01-01T23:15:33+01:00" for Europe/Amsterdam - */ - toIsoString(): string; - /** - * Return a string representation of the DateTime according to the - * specified format. The format is implemented as the LDML standard - * (http://unicode.org/reports/tr35/tr35-dates.html#Date_Format_Patterns) - * - * @param formatString The format specification (e.g. "dd/MM/yyyy HH:mm:ss") - * @return The string representation of this DateTime - */ - format(formatString: string): string; - /** - * Modified ISO 8601 format string with IANA name if applicable. - * E.g. "2014-01-01T23:15:33.000 Europe/Amsterdam" - */ - toString(): string; - /** - * Used by util.inspect() - */ - inspect(): string; - /** - * The valueOf() method returns the primitive value of the specified object. - */ - valueOf(): any; - /** - * Modified ISO 8601 format string in UTC without time zone info - */ - toUtcString(): string; - } -} - -declare module '__timezonecomplete/duration' { - import basics = require("__timezonecomplete/basics"); - /** - * Time duration. Create one e.g. like this: var d = Duration.hours(1). - * Note that time durations do not take leap seconds etc. into account: - * one hour is simply represented as 3600000 milliseconds. - */ - export class Duration { - /** - * Construct a time duration - * @param n Number of hours - * @return A duration of n hours - */ - static hours(n: number): Duration; - /** - * Construct a time duration - * @param n Number of minutes - * @return A duration of n minutes - */ - static minutes(n: number): Duration; - /** - * Construct a time duration - * @param n Number of seconds - * @return A duration of n seconds - */ - static seconds(n: number): Duration; - /** - * Construct a time duration - * @param n Number of milliseconds - * @return A duration of n milliseconds - */ - static milliseconds(n: number): Duration; - /** - * Construct a time duration of 0 - */ - constructor(); - /** - * Construct a time duration from a number of milliseconds - */ - constructor(milliseconds: number); - /** - * Construct a time duration from a string in format - * [-]h[:m[:s[.n]]] e.g. -01:00:30.501 - */ - constructor(input: string); - /** - * Construct a duration from an amount and a time unit. - * @param amount Number of units - * @param unit A time unit i.e. TimeUnit.Second, TimeUnit.Hour etc. - */ - constructor(amount: number, unit: basics.TimeUnit); - /** - * @return another instance of Duration with the same value. - */ - clone(): Duration; - /** - * The entire duration in milliseconds (negative or positive) - */ - milliseconds(): number; - /** - * The millisecond part of the duration (always positive) - * @return e.g. 400 for a -01:02:03.400 duration - */ - millisecond(): number; - /** - * The entire duration in seconds (negative or positive, fractional) - * @return e.g. 1.5 for a 1500 milliseconds duration - */ - seconds(): number; - /** - * The second part of the duration (always positive) - * @return e.g. 3 for a -01:02:03.400 duration - */ - second(): number; - /** - * The entire duration in minutes (negative or positive, fractional) - * @return e.g. 1.5 for a 90000 milliseconds duration - */ - minutes(): number; - /** - * The minute part of the duration (always positive) - * @return e.g. 2 for a -01:02:03.400 duration - */ - minute(): number; - /** - * The entire duration in hours (negative or positive, fractional) - * @return e.g. 1.5 for a 5400000 milliseconds duration - */ - hours(): number; - /** - * The hour part of the duration (always positive). - * Note that this part can exceed 23 hours, because for - * now, we do not have a days() function - * @return e.g. 25 for a -25:02:03.400 duration - */ - wholeHours(): number; - /** - * Sign - * @return "-" if the duration is negative - */ - sign(): string; - /** - * @return True iff (this < other) - */ - lessThan(other: Duration): boolean; - /** - * @return True iff (this <= other) - */ - lessEqual(other: Duration): boolean; - /** - * @return True iff this and other represent the same time duration - */ - equals(other: Duration): boolean; - /** - * @return True iff this > other - */ - greaterThan(other: Duration): boolean; - /** - * @return True iff this >= other - */ - greaterEqual(other: Duration): boolean; - /** - * @return The minimum (most negative) of this and other - */ - min(other: Duration): Duration; - /** - * @return The maximum (most positive) of this and other - */ - max(other: Duration): Duration; - /** - * Multiply with a fixed number. - * @return a new Duration of (this * value) - */ - multiply(value: number): Duration; - /** - * Divide by a fixed number. - * @return a new Duration of (this / value) - */ - divide(value: number): Duration; - /** - * Add a duration. - * @return a new Duration of (this + value) - */ - add(value: Duration): Duration; - /** - * Subtract a duration. - * @return a new Duration of (this - value) - */ - sub(value: Duration): Duration; - /** - * String in [-]hh:mm:ss.nnn notation. All fields are - * always present except the sign. - */ - toFullString(): string; - /** - * String in [-]hh[:mm[:ss[.nnn]]] notation. Fields are - * added as necessary - */ - toString(): string; - /** - * Used by util.inspect() - */ - inspect(): string; - /** - * The valueOf() method returns the primitive value of the specified object. - */ - valueOf(): any; - } -} - -declare module '__timezonecomplete/javascript' { - /** - * Indicates how a Date object should be interpreted. - * Either we can take getYear(), getMonth() etc for our field - * values, or we can take getUTCYear(), getUtcMonth() etc to do that. - */ - export enum DateFunctions { - /** - * Use the Date.getFullYear(), Date.getMonth(), ... functions. - */ - Get = 0, - /** - * Use the Date.getUTCFullYear(), Date.getUTCMonth(), ... functions. - */ - GetUTC = 1, - } -} - -declare module '__timezonecomplete/period' { - import basics = require("__timezonecomplete/basics"); - import datetime = require("__timezonecomplete/datetime"); - /** - * Specifies how the period should repeat across the day - * during DST changes. - */ - export enum PeriodDst { - /** - * Keep repeating in similar intervals measured in UTC, - * unaffected by Daylight Saving Time. - * E.g. a repetition of one hour will take one real hour - * every time, even in a time zone with DST. - * Leap seconds, leap days and month length - * differences will still make the intervals different. - */ - RegularIntervals = 0, - /** - * Ensure that the time at which the intervals occur stay - * at the same place in the day, local time. So e.g. - * a period of one day, starting at 8:05AM Europe/Amsterdam time - * will always start at 8:05 Europe/Amsterdam. This means that - * in UTC time, some intervals will be 25 hours and some - * 23 hours during DST changes. - * Another example: an hourly interval will be hourly in local time, - * skipping an hour in UTC for a DST backward change. - */ - RegularLocalTime = 1, - } - /** - * Convert a PeriodDst to a string: "regular intervals" or "regular local time" - */ - export function periodDstToString(p: PeriodDst): string; - /** - * Repeating time period: consists of a starting point and - * a time length. This class accounts for leap seconds and leap days. - */ - export class Period { - /** - * Constructor - * LIMITATION: if dst equals RegularLocalTime, and unit is Second, Minute or Hour, - * then the amount must be a factor of 24. So 120 seconds is allowed while 121 seconds is not. - * This is due to the enormous processing power required by these cases. They are not - * implemented and you will get an assert. - * - * @param start The start of the period. If the period is in Months or Years, and - * the day is 29 or 30 or 31, the results are maximised to end-of-month. - * @param amount The amount of units. - * @param unit The unit. - * @param dst Specifies how to handle Daylight Saving Time. Not relevant - * if the time zone of the start datetime does not have DST. - */ - constructor(start: datetime.DateTime, amount: number, unit: basics.TimeUnit, dst: PeriodDst); - /** - * The start date - */ - start(): datetime.DateTime; - /** - * The amount of units - */ - amount(): number; - /** - * The unit - */ - unit(): basics.TimeUnit; - /** - * The dst handling mode - */ - dst(): PeriodDst; - /** - * The first occurrence of the period greater than - * the given date. The given date need not be at a period boundary. - * Pre: the fromdate and startdate must either both have timezones or not - * @param fromDate: the date after which to return the next date - * @return the first date matching the period after fromDate, given - * in the same zone as the fromDate. - */ - findFirst(fromDate: datetime.DateTime): datetime.DateTime; - /** - * Returns the next timestamp in the period. The given timestamp must - * be at a period boundary, otherwise the answer is incorrect. - * This function has MUCH better performance than findFirst. - * Returns the datetime "count" times away from the given datetime. - * @param prev Boundary date. Must have a time zone (any time zone) iff the period start date has one. - * @param count Optional, must be >= 1 and whole. - * @return (prev + count * period), in the same timezone as prev. - */ - findNext(prev: datetime.DateTime, count?: number): datetime.DateTime; - /** - * Checks whether the given date is on a period boundary - * (expensive!) - */ - isBoundary(occurrence: datetime.DateTime): boolean; - /** - * Returns an ISO duration string e.g. - * 2014-01-01T12:00:00.000+01:00/P1H - * 2014-01-01T12:00:00.000+01:00/PT1M (one minute) - * 2014-01-01T12:00:00.000+01:00/P1M (one month) - */ - toIsoString(): string; - /** - * A string representation e.g. - * "10 years, starting at 2014-03-01T12:00:00 Europe/Amsterdam, keeping regular intervals". - */ - toString(): string; - /** - * Used by util.inspect() - */ - inspect(): string; - } -} - -declare module '__timezonecomplete/timesource' { - /** - * For testing purposes, we often need to manipulate what the current - * time is. This is an interface for a custom time source object - * so in tests you can use a custom time source. - */ - export interface TimeSource { - /** - * Return the current date+time as a javascript Date object - */ - now(): Date; - } - /** - * Default time source, returns actual time - */ - export class RealTimeSource implements TimeSource { - now(): Date; - } -} - -declare module '__timezonecomplete/timezone' { - import javascript = require("__timezonecomplete/javascript"); - /** - * The type of time zone - */ - export enum TimeZoneKind { - /** - * Local time offset as determined by JavaScript Date class. - */ - Local = 0, - /** - * Fixed offset from UTC, without DST. - */ - Offset = 1, - /** - * IANA timezone managed through Olsen TZ database. Includes - * DST if applicable. - */ - Proper = 2, - } - /** - * Option for TimeZone#normalizeLocal() - */ - export enum NormalizeOption { - /** - * Normalize non-existing times by ADDING the DST offset - */ - Up = 0, - /** - * Normalize non-existing times by SUBTRACTING the DST offset - */ - Down = 1, - } - /** - * Time zone. The object is immutable because it is cached: - * requesting a time zone twice yields the very same object. - * Note that we use time zone offsets inverted w.r.t. JavaScript Date.getTimezoneOffset(), - * i.e. offset 90 means +01:30. - * - * Time zones come in three flavors: the local time zone, as calculated by JavaScript Date, - * a fixed offset ("+01:30") without DST, or a IANA timezone ("Europe/Amsterdam") with DST - * applied depending on the time zone rules. - */ - export class TimeZone { - /** - * The local time zone for a given date. Note that - * the time zone varies with the date: amsterdam time for - * 2014-01-01 is +01:00 and amsterdam time for 2014-07-01 is +02:00 - */ - static local(): TimeZone; - /** - * The UTC time zone. - */ - static utc(): TimeZone; - /** - * Returns a time zone object from the cache. If it does not exist, it is created. - * @return The time zone with the given offset w.r.t. UTC in minutes, e.g. 90 for +01:30 - */ - static zone(offset: number): TimeZone; - /** - * Returns a time zone object from the cache. If it does not exist, it is created. - * @param s: Empty string for local time, a TZ database time zone name (e.g. Europe/Amsterdam) - * or an offset string (either +01:30, +0130, +01, Z). For a full list of names, see: - * https://en.wikipedia.org/wiki/List_of_tz_database_time_zones - */ - static zone(s: string): TimeZone; - /** - * Do not use this constructor, use the static - * TimeZone.zone() method instead. - * @param name NORMALIZED name, assumed to be correct - */ - constructor(name: string); - /** - * The time zone identifier. Can be an offset "-01:30" or an - * IANA time zone name "Europe/Amsterdam", or "localtime" for - * the local time zone. - */ - name(): string; - /** - * The kind of time zone (Local/Offset/Proper) - */ - kind(): TimeZoneKind; - /** - * Equality operator. Maps zero offsets and different names for UTC onto - * each other. Other time zones are not mapped onto each other. - */ - equals(other: TimeZone): boolean; - /** - * Is this zone equivalent to UTC? - */ - isUtc(): boolean; - /** - * Does this zone have Daylight Saving Time at all? - */ - hasDst(): boolean; - /** - * Calculate timezone offset from a UTC time. - * - * @param year Full year - * @param month Month 1-12 (note this deviates from JavaScript date) - * @param day Day of month 1-31 - * @param hour Hour 0-23 - * @param minute Minute 0-59 - * @param second Second 0-59 - * @param millisecond Millisecond 0-999 - * - * @return the offset of this time zone with respect to UTC at the given time, in minutes. - */ - offsetForUtc(year: number, month: number, day: number, hour?: number, minute?: number, second?: number, millisecond?: number): number; - /** - * Calculate timezone offset from a zone-local time (NOT a UTC time). - * @param year local full year - * @param month local month 1-12 (note this deviates from JavaScript date) - * @param day local day of month 1-31 - * @param hour local hour 0-23 - * @param minute local minute 0-59 - * @param second local second 0-59 - * @param millisecond local millisecond 0-999 - * @return the offset of this time zone with respect to UTC at the given time, in minutes. - */ - offsetForZone(year: number, month: number, day: number, hour?: number, minute?: number, second?: number, millisecond?: number): number; - /** - * Note: will be removed in version 2.0.0 - * - * Convenience function, takes values from a Javascript Date - * Calls offsetForUtc() with the contents of the date - * - * @param date: the date - * @param funcs: the set of functions to use: get() or getUTC() - */ - offsetForUtcDate(date: Date, funcs: javascript.DateFunctions): number; - /** - * Note: will be removed in version 2.0.0 - * - * Convenience function, takes values from a Javascript Date - * Calls offsetForUtc() with the contents of the date - * - * @param date: the date - * @param funcs: the set of functions to use: get() or getUTC() - */ - offsetForZoneDate(date: Date, funcs: javascript.DateFunctions): number; - /** - * Zone abbreviation at given UTC timestamp e.g. CEST for Central European Summer Time. - * - * @param year Full year - * @param month Month 1-12 (note this deviates from JavaScript date) - * @param day Day of month 1-31 - * @param hour Hour 0-23 - * @param minute Minute 0-59 - * @param second Second 0-59 - * @param millisecond Millisecond 0-999 - * @param dstDependent (default true) set to false for a DST-agnostic abbreviation - * - * @return "local" for local timezone, the offset for an offset zone, or the abbreviation for a proper zone. - */ - abbreviationForUtc(year: number, month: number, day: number, hour?: number, minute?: number, second?: number, millisecond?: number, dstDependent?: boolean): string; - /** - * Normalizes non-existing local times by adding a forward offset change. - * During a forward standard offset change or DST offset change, some amount of - * local time is skipped. Therefore, this amount of local time does not exist. - * This function adds the amount of forward change to any non-existing time. After all, - * this is probably what the user meant. - * - * @param localUnixMillis Unix timestamp in zone time - * @param opt (optional) Round up or down? Default: up - * - * @returns Unix timestamp in zone time, normalized. - */ - normalizeZoneTime(localUnixMillis: number, opt?: NormalizeOption): number; - /** - * The time zone identifier (normalized). - * Either "localtime", IANA name, or "+hh:mm" offset. - */ - toString(): string; - /** - * Used by util.inspect() - */ - inspect(): string; - /** - * Convert an offset number into an offset string - * @param offset The offset in minutes from UTC e.g. 90 minutes - * @return the offset in ISO notation "+01:30" for +90 minutes - */ - static offsetToString(offset: number): string; - /** - * String to offset conversion. - * @param s Formats: "-01:00", "-0100", "-01", "Z" - * @return offset w.r.t. UTC in minutes - */ - static stringToOffset(s: string): number; - } -} - -declare module '__timezonecomplete/globals' { - import datetime = require("__timezonecomplete/datetime"); - import duration = require("__timezonecomplete/duration"); - /** - * Returns the minimum of two DateTimes - */ - export function min(d1: datetime.DateTime, d2: datetime.DateTime): datetime.DateTime; - /** - * Returns the minimum of two Durations - */ - export function min(d1: duration.Duration, d2: duration.Duration): duration.Duration; - /** - * Returns the maximum of two DateTimes - */ - export function max(d1: datetime.DateTime, d2: datetime.DateTime): datetime.DateTime; - /** - * Returns the maximum of two Durations - */ - export function max(d1: duration.Duration, d2: duration.Duration): duration.Duration; -} - diff --git a/timezonecomplete/timezonecomplete-tests-1.9.0.ts b/timezonecomplete/timezonecomplete-tests-1.9.0.ts deleted file mode 100644 index 1e05cf7dc..000000000 --- a/timezonecomplete/timezonecomplete-tests-1.9.0.ts +++ /dev/null @@ -1,205 +0,0 @@ -/// - -import tc = require("timezonecomplete-1.9.0"); - -var b: boolean; -var n: number; -var s: string; -var w: tc.WeekDay; - -n = tc.timeUnitToMilliseconds(tc.TimeUnit.Month); -b = tc.isLeapYear(2014); -n = tc.daysInMonth(2014, 10); -n = tc.daysInYear(2014); -n = tc.dayOfYear(2014, 1, 2); -w = tc.firstWeekDayOfMonth(2014, 1, tc.WeekDay.Sunday); -w = tc.lastWeekDayOfMonth(2014, 1, tc.WeekDay.Sunday); -n = tc.weekDayOnOrAfter(2014, 1, 14, tc.WeekDay.Monday); -n = tc.weekDayOnOrBefore(2014, 1, 14, tc.WeekDay.Monday); -n = tc.secondOfDay(13, 59, 59); -n = tc.weekOfMonth(2014, 1, 1); - -// DURATION - -var d: tc.Duration; -var d1: tc.Duration = tc.Duration.hours(24); -var d2: tc.Duration = tc.Duration.minutes(24); -var d3: tc.Duration = tc.Duration.seconds(24); -var d4: tc.Duration = tc.Duration.milliseconds(24); -var d5: tc.Duration = new tc.Duration(24); -var d6: tc.Duration = new tc.Duration("00:01"); -var d7: tc.Duration = d6.clone(); -var d8: tc.Duration = new tc.Duration(4, tc.TimeUnit.Second); - -n = d7.wholeHours(); -n = d7.hours(); -n = d7.minutes(); -n = d7.minute(); -n = d7.seconds(); -n = d7.second(); -n = d7.milliseconds(); -n = d7.millisecond(); -s = d7.sign(); -b = d7.lessThan(d6); -b = d7.greaterThan(d6); -d = d7.min(d6); -d = d7.max(d6); -d = d7.multiply(3); -d = d7.divide(0.3); -d = d7.add(d6); -d = d7.sub(d6); -s = d7.toString(); - -// TIMEZONE - -var t: tc.TimeZone; -var k: tc.TimeZoneKind; - -t = tc.TimeZone.local(); -t = tc.TimeZone.utc(); -t = tc.TimeZone.zone(2); -t = tc.TimeZone.zone("+01:00"); -s = t.name(); -k = t.kind(); -b = t.equals(t); -b = t.isUtc(); -n = t.offsetForUtc(2014, 1, 1, 13, 0, 5, 123); -n = t.offsetForZone(2014, 1, 1, 13, 0, 5, 123); -n = t.offsetForUtcDate(new Date(2014, 1, 1, 13, 0, 5, 123), tc.DateFunctions.Get); -n = t.offsetForZoneDate(new Date(2014, 1, 1, 13, 0, 5, 123), tc.DateFunctions.GetUTC); -s = t.toString(); -s = tc.TimeZone.offsetToString(2); -n = tc.TimeZone.stringToOffset("+00:01"); - -// REALTIMESOURCE - -var date: Date = (new tc.RealTimeSource()).now(); - -// DATETIME - -var dt: tc.DateTime; - -var ts: tc.TimeSource = tc.DateTime.timeSource; - -dt = tc.DateTime.nowLocal(); -dt = tc.DateTime.nowUtc(); -dt = tc.DateTime.now(tc.TimeZone.local()); -dt = new tc.DateTime(); -dt = new tc.DateTime("2014-01-01T13:05:01.123 UTC"); -dt = new tc.DateTime("2014-01-01T13:05:01.123", tc.TimeZone.utc()); -dt = new tc.DateTime(date, tc.DateFunctions.Get); -dt = new tc.DateTime(date, tc.DateFunctions.Get, tc.TimeZone.utc()); -dt = new tc.DateTime(2014, 1, 1, 13, 5, 1, 123); -dt = new tc.DateTime(2014, 1, 1, 13, 5, 1, 123, tc.TimeZone.utc()); -dt = new tc.DateTime(89949284); -dt = new tc.DateTime(89949284, tc.TimeZone.utc()); -dt = dt.clone(); -t = dt.zone(); -n = dt.offset(); -n = dt.year(); -n = dt.month(); -n = dt.day(); -n = dt.hour(); -n = dt.minute(); -n = dt.second(); -n = dt.weekNumber(); -n = dt.weekOfMonth(); -n = dt.secondOfDay(); -n = dt.dayOfYear(); -n = dt.millisecond(); -n = dt.unixUtcMillis(); -n = dt.utcYear(); -n = dt.utcMonth(); -n = dt.utcDay(); -n = dt.utcHour(); -n = dt.utcMinute(); -n = dt.utcSecond(); -n = dt.utcMillisecond(); -n = dt.utcWeekNumber(); -n = dt.utcWeekOfMonth(); -n = dt.utcSecondOfDay(); -n = dt.utcDayOfYear(); -s = dt.format("%Y-%m-%d"); -dt.convert(tc.TimeZone.local()); -dt = dt.toZone(tc.TimeZone.utc()); -date = dt.toDate(); -dt = dt.add(tc.Duration.seconds(2)); -dt = dt.add(2, tc.TimeUnit.Year); -dt = dt.add(2, tc.TimeUnit.Month); -dt = dt.add(2, tc.TimeUnit.Week); -dt = dt.add(2, tc.TimeUnit.Day); -dt = dt.add(2, tc.TimeUnit.Hour); -dt = dt.add(2, tc.TimeUnit.Minute); -dt = dt.add(2, tc.TimeUnit.Second); -dt = dt.addLocal(2, tc.TimeUnit.Second); -dt = dt.sub(tc.Duration.seconds(2)); -dt = dt.sub(2, tc.TimeUnit.Year); -dt = dt.sub(2, tc.TimeUnit.Month); -dt = dt.sub(2, tc.TimeUnit.Week); -dt = dt.sub(2, tc.TimeUnit.Day); -dt = dt.sub(2, tc.TimeUnit.Hour); -dt = dt.sub(2, tc.TimeUnit.Minute); -dt = dt.sub(2, tc.TimeUnit.Second); -dt = dt.subLocal(2, tc.TimeUnit.Second); -d = dt.diff(new tc.DateTime(9289234, tc.TimeZone.local())); -b = dt.lessThan(new tc.DateTime(9289234, tc.TimeZone.local())); -b = dt.lessEqual(new tc.DateTime(9289234, tc.TimeZone.local())); -b = dt.greaterThan(new tc.DateTime(9289234, tc.TimeZone.local())); -b = dt.greaterEqual(new tc.DateTime(9289234, tc.TimeZone.local())); -dt = dt.min(new tc.DateTime(9289234, tc.TimeZone.local())); -dt = dt.max(new tc.DateTime(9289234, tc.TimeZone.local())); -s = dt.toIsoString(); -s = dt.toString(); -s = dt.toUtcString(); - -var wd: tc.WeekDay; -wd = dt.weekDay(); -wd = dt.utcWeekDay(); - -// PERIOD - -s = tc.periodDstToString(tc.PeriodDst.RegularIntervals); -s = tc.periodDstToString(tc.PeriodDst.RegularLocalTime); - -var p: tc.Period; - -p = new tc.Period(tc.DateTime.nowLocal(), 1, tc.TimeUnit.Hour, tc.PeriodDst.RegularLocalTime); -dt = p.start(); -n = p.amount(); -var tu: tc.TimeUnit = p.unit(); -var pd: tc.PeriodDst = p.dst(); -dt = p.findFirst(tc.DateTime.nowLocal()); -dt = p.findNext(dt); -s = p.toIsoString(); -s = p.toString(); -b = p.isBoundary(dt); - - -// GLOBALS -d = tc.min(tc.Duration.seconds(2), tc.Duration.seconds(3)); -d = tc.max(tc.Duration.seconds(2), tc.Duration.seconds(3)); - -dt = tc.min(new tc.DateTime(2), new tc.DateTime(3)); -dt = tc.max(new tc.DateTime(2), new tc.DateTime(3)); - - - - - - - - - - - - - - - - - - - - - - diff --git a/timezonecomplete/timezonecomplete-tests.ts b/timezonecomplete/timezonecomplete-tests.ts index 4db54a11d..cb1c69282 100644 --- a/timezonecomplete/timezonecomplete-tests.ts +++ b/timezonecomplete/timezonecomplete-tests.ts @@ -19,6 +19,9 @@ n = tc.weekDayOnOrBefore(2014, 1, 14, tc.WeekDay.Monday); n = tc.secondOfDay(13, 59, 59); n = tc.weekOfMonth(2014, 1, 1); +s = tc.timeUnitToString(tc.TimeUnit.Second); +var tu: tc.TimeUnit = tc.stringToTimeUnit("bla"); + // DURATION var d: tc.Duration; @@ -54,6 +57,10 @@ d = d7.add(d6); d = d7.sub(d6); s = d7.toString(); +b = d7.equals(d6); +b = d7.equalsExact(d6); +b = d7.identical(d6); + // TIMEZONE var t: tc.TimeZone; @@ -96,6 +103,7 @@ var ts: tc.TimeSource = tc.DateTime.timeSource; dt = tc.DateTime.nowLocal(); dt = tc.DateTime.nowUtc(); dt = tc.DateTime.now(tc.TimeZone.local()); +dt = tc.DateTime.fromExcel(1.5); dt = tc.nowLocal(); dt = tc.nowUtc(); dt = tc.now(tc.TimeZone.local()); @@ -147,6 +155,7 @@ dt = dt.add(2, tc.TimeUnit.Hour); dt = dt.add(2, tc.TimeUnit.Minute); dt = dt.add(2, tc.TimeUnit.Second); dt = dt.addLocal(2, tc.TimeUnit.Second); +dt = dt.addLocal(tc.minutes(2)); dt = dt.sub(tc.Duration.seconds(2)); dt = dt.sub(2, tc.TimeUnit.Year); dt = dt.sub(2, tc.TimeUnit.Month); @@ -156,6 +165,7 @@ dt = dt.sub(2, tc.TimeUnit.Hour); dt = dt.sub(2, tc.TimeUnit.Minute); dt = dt.sub(2, tc.TimeUnit.Second); dt = dt.subLocal(2, tc.TimeUnit.Second); +dt = dt.subLocal(tc.minutes(2)); d = dt.diff(new tc.DateTime(9289234, tc.TimeZone.local())); b = dt.lessThan(new tc.DateTime(9289234, tc.TimeZone.local())); b = dt.lessEqual(new tc.DateTime(9289234, tc.TimeZone.local())); @@ -180,6 +190,7 @@ s = tc.periodDstToString(tc.PeriodDst.RegularLocalTime); var p: tc.Period; p = new tc.Period(tc.DateTime.nowLocal(), 1, tc.TimeUnit.Hour, tc.PeriodDst.RegularLocalTime); +p = new tc.Period(tc.DateTime.nowLocal(), tc.hours(1), tc.PeriodDst.RegularLocalTime); dt = p.start(); n = p.amount(); var tu: tc.TimeUnit = p.unit(); diff --git a/timezonecomplete/timezonecomplete.d.ts b/timezonecomplete/timezonecomplete.d.ts index 4132eb838..7a605a555 100644 --- a/timezonecomplete/timezonecomplete.d.ts +++ b/timezonecomplete/timezonecomplete.d.ts @@ -1,8 +1,7 @@ -// Type definitions for timezonecomplete 1.12.0 +// Type definitions for timezonecomplete 1.15.0 // Project: https://github.com/SpiritIT/timezonecomplete // Definitions by: Rogier Schouten // Definitions: https://github.com/borisyankov/DefinitelyTyped -// Generated by dts-bundle v0.2.0 declare module 'timezonecomplete' { import basics = require("__timezonecomplete/basics"); @@ -20,6 +19,8 @@ declare module 'timezonecomplete' { export import weekOfMonth = basics.weekOfMonth; export import dayOfYear = basics.dayOfYear; export import secondOfDay = basics.secondOfDay; + export import timeUnitToString = basics.timeUnitToString; + export import stringToTimeUnit = basics.stringToTimeUnit; import datetime = require("__timezonecomplete/datetime"); export import DateTime = datetime.DateTime; export import now = datetime.now; @@ -27,6 +28,9 @@ declare module 'timezonecomplete' { export import nowUtc = datetime.nowUtc; import duration = require("__timezonecomplete/duration"); export import Duration = duration.Duration; + export import years = duration.years; + export import months = duration.months; + export import days = duration.days; export import hours = duration.hours; export import minutes = duration.minutes; export import seconds = duration.seconds; @@ -54,1257 +58,1463 @@ declare module 'timezonecomplete' { declare module '__timezonecomplete/basics' { import javascript = require("__timezonecomplete/javascript"); + import DateFunctions = javascript.DateFunctions; /** - * Day-of-week. Note the enum values correspond to JavaScript day-of-week: - * Sunday = 0, Monday = 1 etc - */ + * Day-of-week. Note the enum values correspond to JavaScript day-of-week: + * Sunday = 0, Monday = 1 etc + */ export enum WeekDay { - Sunday = 0, - Monday = 1, - Tuesday = 2, - Wednesday = 3, - Thursday = 4, - Friday = 5, - Saturday = 6, + Sunday = 0, + Monday = 1, + Tuesday = 2, + Wednesday = 3, + Thursday = 4, + Friday = 5, + Saturday = 6, } /** - * Time units - */ + * Time units + */ export enum TimeUnit { - Second = 0, - Minute = 1, - Hour = 2, - Day = 3, - Week = 4, - Month = 5, - Year = 6, + Millisecond = 0, + Second = 1, + Minute = 2, + Hour = 3, + Day = 4, + Week = 5, + Month = 6, + Year = 7, + /** + * End-of-enum marker, do not use + */ + MAX = 8, } /** - * Approximate number of milliseconds for a time unit. - * A day is assumed to have 24 hours, a month is assumed to equal 30 days - * and a year is set to 365 days. - * - * @param unit Time unit e.g. TimeUnit.Month - * @returns The number of milliseconds. - */ + * Approximate number of milliseconds for a time unit. + * A day is assumed to have 24 hours, a month is assumed to equal 30 days + * and a year is set to 360 days (because 12 months of 30 days). + * + * @param unit Time unit e.g. TimeUnit.Month + * @returns The number of milliseconds. + */ export function timeUnitToMilliseconds(unit: TimeUnit): number; /** - * @return True iff the given year is a leap year. - */ + * Time unit to lowercase string. If amount is specified, then the string is put in plural form + * if necessary. + * @param unit The unit + * @param amount If this is unequal to -1 and 1, then the result is pluralized + */ + export function timeUnitToString(unit: TimeUnit, amount?: number): string; + export function stringToTimeUnit(s: string): TimeUnit; + /** + * @return True iff the given year is a leap year. + */ export function isLeapYear(year: number): boolean; /** - * The days in a given year - */ + * The days in a given year + */ export function daysInYear(year: number): number; /** - * @param year The full year - * @param month The month 1-12 - * @return The number of days in the given month - */ + * @param year The full year + * @param month The month 1-12 + * @return The number of days in the given month + */ export function daysInMonth(year: number, month: number): number; /** - * Returns the day of the year of the given date [0..365]. January first is 0. - * - * @param year The year e.g. 1986 - * @param month Month 1-12 - * @param day Day of month 1-31 - */ + * Returns the day of the year of the given date [0..365]. January first is 0. + * + * @param year The year e.g. 1986 + * @param month Month 1-12 + * @param day Day of month 1-31 + */ export function dayOfYear(year: number, month: number, day: number): number; /** - * Returns the last instance of the given weekday in the given month - * - * @param year The year - * @param month the month 1-12 - * @param weekDay the desired week day - * - * @return the last occurrence of the week day in the month - */ + * Returns the last instance of the given weekday in the given month + * + * @param year The year + * @param month the month 1-12 + * @param weekDay the desired week day + * + * @return the last occurrence of the week day in the month + */ export function lastWeekDayOfMonth(year: number, month: number, weekDay: WeekDay): number; /** - * Returns the first instance of the given weekday in the given month - * - * @param year The year - * @param month the month 1-12 - * @param weekDay the desired week day - * - * @return the first occurrence of the week day in the month - */ + * Returns the first instance of the given weekday in the given month + * + * @param year The year + * @param month the month 1-12 + * @param weekDay the desired week day + * + * @return the first occurrence of the week day in the month + */ export function firstWeekDayOfMonth(year: number, month: number, weekDay: WeekDay): number; /** - * Returns the day-of-month that is on the given weekday and which is >= the given day. - * Throws if the month has no such day. - */ + * Returns the day-of-month that is on the given weekday and which is >= the given day. + * Throws if the month has no such day. + */ export function weekDayOnOrAfter(year: number, month: number, day: number, weekDay: WeekDay): number; /** - * Returns the day-of-month that is on the given weekday and which is <= the given day. - * Throws if the month has no such day. - */ + * Returns the day-of-month that is on the given weekday and which is <= the given day. + * Throws if the month has no such day. + */ export function weekDayOnOrBefore(year: number, month: number, day: number, weekDay: WeekDay): number; /** - * The week of this month. There is no official standard for this, - * but we assume the same rules for the weekNumber (i.e. - * week 1 is the week that has the 4th day of the month in it) - * - * @param year The year - * @param month The month [1-12] - * @param day The day [1-31] - * @return Week number [1-5] - */ + * The week of this month. There is no official standard for this, + * but we assume the same rules for the weekNumber (i.e. + * week 1 is the week that has the 4th day of the month in it) + * + * @param year The year + * @param month The month [1-12] + * @param day The day [1-31] + * @return Week number [1-5] + */ export function weekOfMonth(year: number, month: number, day: number): number; /** - * The ISO 8601 week number for the given date. Week 1 is the week - * that has January 4th in it, and it starts on Monday. - * See https://en.wikipedia.org/wiki/ISO_week_date - * - * @param year Year e.g. 1988 - * @param month Month 1-12 - * @param day Day of month 1-31 - * - * @return Week number 1-53 - */ + * The ISO 8601 week number for the given date. Week 1 is the week + * that has January 4th in it, and it starts on Monday. + * See https://en.wikipedia.org/wiki/ISO_week_date + * + * @param year Year e.g. 1988 + * @param month Month 1-12 + * @param day Day of month 1-31 + * + * @return Week number 1-53 + */ export function weekNumber(year: number, month: number, day: number): number; /** - * Convert a unix milli timestamp into a TimeT structure. - * This does NOT take leap seconds into account. - */ + * Convert a unix milli timestamp into a TimeT structure. + * This does NOT take leap seconds into account. + */ export function unixToTimeNoLeapSecs(unixMillis: number): TimeStruct; /** - * Convert a year, month, day etc into a unix milli timestamp. - * This does NOT take leap seconds into account. - * - * @param year Year e.g. 1970 - * @param month Month 1-12 - * @param day Day 1-31 - * @param hour Hour 0-23 - * @param minute Minute 0-59 - * @param second Second 0-59 (no leap seconds) - * @param milli Millisecond 0-999 - */ + * Convert a year, month, day etc into a unix milli timestamp. + * This does NOT take leap seconds into account. + * + * @param year Year e.g. 1970 + * @param month Month 1-12 + * @param day Day 1-31 + * @param hour Hour 0-23 + * @param minute Minute 0-59 + * @param second Second 0-59 (no leap seconds) + * @param milli Millisecond 0-999 + */ export function timeToUnixNoLeapSecs(year?: number, month?: number, day?: number, hour?: number, minute?: number, second?: number, milli?: number): number; /** - * Convert a TimeT structure into a unix milli timestamp. - * This does NOT take leap seconds into account. - */ + * Convert a TimeT structure into a unix milli timestamp. + * This does NOT take leap seconds into account. + */ export function timeToUnixNoLeapSecs(tm: TimeStruct): number; /** - * Return the day-of-week. - * This does NOT take leap seconds into account. - */ + * Return the day-of-week. + * This does NOT take leap seconds into account. + */ export function weekDayNoLeapSecs(unixMillis: number): WeekDay; /** - * N-th second in the day, counting from 0 - */ + * N-th second in the day, counting from 0 + */ export function secondOfDay(hour: number, minute: number, second: number): number; /** - * Basic representation of a date and time - */ + * Basic representation of a date and time + */ export class TimeStruct { - /** - * Year, 1970-... - */ - year: number; - /** - * Month 1-12 - */ - month: number; - /** - * Day of month, 1-31 - */ - day: number; - /** - * Hour 0-23 - */ - hour: number; - /** - * Minute 0-59 - */ - minute: number; - /** - * Seconds, 0-59 - */ - second: number; - /** - * Milliseconds 0-999 - */ - milli: number; - /** - * Create a TimeStruct from a number of unix milliseconds - */ - static fromUnix(unixMillis: number): TimeStruct; - /** - * Create a TimeStruct from a JavaScript date - * - * @param d The date - * @param df Which functions to take (getX() or getUTCX()) - */ - static fromDate(d: Date, df: javascript.DateFunctions): TimeStruct; - /** - * Returns a TimeStruct from an ISO 8601 string WITHOUT time zone - */ - static fromString(s: string): TimeStruct; - /** - * Constructor - * - * @param year Year e.g. 1970 - * @param month Month 1-12 - * @param day Day 1-31 - * @param hour Hour 0-23 - * @param minute Minute 0-59 - * @param second Second 0-59 (no leap seconds) - * @param milli Millisecond 0-999 - */ - constructor(/** - * Year, 1970-... - */ - year?: number, /** - * Month 1-12 - */ - month?: number, /** - * Day of month, 1-31 - */ - day?: number, /** - * Hour 0-23 - */ - hour?: number, /** - * Minute 0-59 - */ - minute?: number, /** - * Seconds, 0-59 - */ - second?: number, /** - * Milliseconds 0-999 - */ - milli?: number); - /** - * Validate a TimeStruct, returns false if invalid. - */ - validate(): boolean; - /** - * The day-of-year 0-365 - */ - yearDay(): number; - /** - * Returns this time as a unix millisecond timestamp - * Does NOT take leap seconds into account. - */ - toUnixNoLeapSecs(): number; - /** - * Deep equals - */ - equals(other: TimeStruct): boolean; - /** - * < operator - */ - lessThan(other: TimeStruct): boolean; - clone(): TimeStruct; - valueOf(): number; - /** - * ISO 8601 string YYYY-MM-DDThh:mm:ss.nnn - */ - toString(): string; - inspect(): string; + /** + * Year, 1970-... + */ + year: number; + /** + * Month 1-12 + */ + month: number; + /** + * Day of month, 1-31 + */ + day: number; + /** + * Hour 0-23 + */ + hour: number; + /** + * Minute 0-59 + */ + minute: number; + /** + * Seconds, 0-59 + */ + second: number; + /** + * Milliseconds 0-999 + */ + milli: number; + /** + * Create a TimeStruct from a number of unix milliseconds + */ + static fromUnix(unixMillis: number): TimeStruct; + /** + * Create a TimeStruct from a JavaScript date + * + * @param d The date + * @param df Which functions to take (getX() or getUTCX()) + */ + static fromDate(d: Date, df: DateFunctions): TimeStruct; + /** + * Returns a TimeStruct from an ISO 8601 string WITHOUT time zone + */ + static fromString(s: string): TimeStruct; + /** + * Constructor + * + * @param year Year e.g. 1970 + * @param month Month 1-12 + * @param day Day 1-31 + * @param hour Hour 0-23 + * @param minute Minute 0-59 + * @param second Second 0-59 (no leap seconds) + * @param milli Millisecond 0-999 + */ + constructor( + /** + * Year, 1970-... + */ + year?: number, + /** + * Month 1-12 + */ + month?: number, + /** + * Day of month, 1-31 + */ + day?: number, + /** + * Hour 0-23 + */ + hour?: number, + /** + * Minute 0-59 + */ + minute?: number, + /** + * Seconds, 0-59 + */ + second?: number, + /** + * Milliseconds 0-999 + */ + milli?: number); + /** + * Validate a TimeStruct, returns false if invalid. + */ + validate(): boolean; + /** + * The day-of-year 0-365 + */ + yearDay(): number; + /** + * Returns this time as a unix millisecond timestamp + * Does NOT take leap seconds into account. + */ + toUnixNoLeapSecs(): number; + /** + * Deep equals + */ + equals(other: TimeStruct): boolean; + /** + * < operator + */ + lessThan(other: TimeStruct): boolean; + clone(): TimeStruct; + valueOf(): number; + /** + * ISO 8601 string YYYY-MM-DDThh:mm:ss.nnn + */ + toString(): string; + inspect(): string; } } declare module '__timezonecomplete/datetime' { import basics = require("__timezonecomplete/basics"); + import WeekDay = basics.WeekDay; + import TimeUnit = basics.TimeUnit; import duration = require("__timezonecomplete/duration"); - import timesource = require("__timezonecomplete/timesource"); + import Duration = duration.Duration; import javascript = require("__timezonecomplete/javascript"); + import DateFunctions = javascript.DateFunctions; + import timesource = require("__timezonecomplete/timesource"); + import TimeSource = timesource.TimeSource; import timezone = require("__timezonecomplete/timezone"); + import TimeZone = timezone.TimeZone; /** - * Current date+time in local time - */ + * Current date+time in local time + */ export function nowLocal(): DateTime; /** - * Current date+time in UTC time - */ + * Current date+time in UTC time + */ export function nowUtc(): DateTime; /** - * Current date+time in the given time zone - * @param timeZone The desired time zone (optional, defaults to UTC). - */ - export function now(timeZone?: timezone.TimeZone): DateTime; + * Current date+time in the given time zone + * @param timeZone The desired time zone (optional, defaults to UTC). + */ + export function now(timeZone?: TimeZone): DateTime; /** - * DateTime class which is time zone-aware - * and which can be mocked for testing purposes. - */ + * DateTime class which is time zone-aware + * and which can be mocked for testing purposes. + */ export class DateTime { - /** - * Actual time source in use. Setting this property allows to - * fake time in tests. DateTime.nowLocal() and DateTime.nowUtc() - * use this property for obtaining the current time. - */ - static timeSource: timesource.TimeSource; - /** - * Current date+time in local time - */ - static nowLocal(): DateTime; - /** - * Current date+time in UTC time - */ - static nowUtc(): DateTime; - /** - * Current date+time in the given time zone - * @param timeZone The desired time zone (optional, defaults to UTC). - */ - static now(timeZone?: timezone.TimeZone): DateTime; - /** - * Constructor. Creates current time in local timezone. - */ - constructor(); - /** - * Constructor - * Non-existing local times are normalized by rounding up to the next DST offset. - * - * @param isoString String in ISO 8601 format. Instead of ISO time zone, - * it may include a space and then and IANA time zone. - * e.g. "2007-04-05T12:30:40.500" (no time zone, naive date) - * e.g. "2007-04-05T12:30:40.500+01:00" (UTC offset without daylight saving time) - * or "2007-04-05T12:30:40.500Z" (UTC) - * or "2007-04-05T12:30:40.500 Europe/Amsterdam" (IANA time zone, with daylight saving time if applicable) - * @param timeZone if given, the date in the string is assumed to be in this time zone. - * Note that it is NOT CONVERTED to the time zone. Useful - * for strings without a time zone - */ - constructor(isoString: string, timeZone?: timezone.TimeZone); - /** - * Constructor. You provide a date, then you say whether to take the - * date.getYear()/getXxx methods or the date.getUTCYear()/date.getUTCXxx methods, - * and then you state which time zone that date is in. - * Non-existing local times are normalized by rounding up to the next DST offset. - * Note that the Date class has bugs and inconsistencies when constructing them with times around - * DST changes. - * - * @param date A date object. - * @param getters Specifies which set of Date getters contains the date in the given time zone: the - * Date.getXxx() methods or the Date.getUTCXxx() methods. - * @param timeZone The time zone that the given date is assumed to be in (may be null for unaware dates) - */ - constructor(date: Date, getFuncs: javascript.DateFunctions, timeZone?: timezone.TimeZone); - /** - * Constructor. Note that unlike JavaScript dates we require fields to be in normal ranges. - * Use the add(duration) or sub(duration) for arithmetic. - * @param year The full year (e.g. 2014) - * @param month The month [1-12] (note this deviates from JavaScript Date) - * @param day The day of the month [1-31] - * @param hour The hour of the day [0-24) - * @param minute The minute of the hour [0-59] - * @param second The second of the minute [0-59] - * @param millisecond The millisecond of the second [0-999] - * @param timeZone The time zone, or null (for unaware dates) - */ - constructor(year: number, month: number, day: number, hour?: number, minute?: number, second?: number, millisecond?: number, timeZone?: timezone.TimeZone); - /** - * Constructor - * @param unixTimestamp milliseconds since 1970-01-01T00:00:00.000 - * @param timeZone the time zone that the timestamp is assumed to be in (usually UTC). - */ - constructor(unixTimestamp: number, timeZone?: timezone.TimeZone); - /** - * @return a copy of this object - */ - clone(): DateTime; - /** - * @return The time zone that the date is in. May be null for unaware dates. - */ - zone(): timezone.TimeZone; - /** - * Zone name abbreviation at this time - * @param dstDependent (default true) set to false for a DST-agnostic abbreviation - * @return The abbreviation - */ - zoneAbbreviation(dstDependent?: boolean): string; - /** - * @return the offset w.r.t. UTC in minutes. Returns 0 for unaware dates and for UTC dates. - */ - offset(): number; - /** - * @return The full year e.g. 2014 - */ - year(): number; - /** - * @return The month 1-12 (note this deviates from JavaScript Date) - */ - month(): number; - /** - * @return The day of the month 1-31 - */ - day(): number; - /** - * @return The hour 0-23 - */ - hour(): number; - /** - * @return the minutes 0-59 - */ - minute(): number; - /** - * @return the seconds 0-59 - */ - second(): number; - /** - * @return the milliseconds 0-999 - */ - millisecond(): number; - /** - * @return the day-of-week (the enum values correspond to JavaScript - * week day numbers) - */ - weekDay(): basics.WeekDay; - /** - * Returns the day number within the year: Jan 1st has number 0, - * Jan 2nd has number 1 etc. - * - * @return the day-of-year [0-366] - */ - dayOfYear(): number; - /** - * The ISO 8601 week number. Week 1 is the week - * that has January 4th in it, and it starts on Monday. - * See https://en.wikipedia.org/wiki/ISO_week_date - * - * @return Week number [1-53] - */ - weekNumber(): number; - /** - * The week of this month. There is no official standard for this, - * but we assume the same rules for the weekNumber (i.e. - * week 1 is the week that has the 4th day of the month in it) - * - * @return Week number [1-5] - */ - weekOfMonth(): number; - /** - * Returns the number of seconds that have passed on the current day - * Does not consider leap seconds - * - * @return seconds [0-86399] - */ - secondOfDay(): number; - /** - * @return Milliseconds since 1970-01-01T00:00:00.000Z - */ - unixUtcMillis(): number; - /** - * @return The full year e.g. 2014 - */ - utcYear(): number; - /** - * @return The UTC month 1-12 (note this deviates from JavaScript Date) - */ - utcMonth(): number; - /** - * @return The UTC day of the month 1-31 - */ - utcDay(): number; - /** - * @return The UTC hour 0-23 - */ - utcHour(): number; - /** - * @return The UTC minutes 0-59 - */ - utcMinute(): number; - /** - * @return The UTC seconds 0-59 - */ - utcSecond(): number; - /** - * Returns the UTC day number within the year: Jan 1st has number 0, - * Jan 2nd has number 1 etc. - * - * @return the day-of-year [0-366] - */ - utcDayOfYear(): number; - /** - * @return The UTC milliseconds 0-999 - */ - utcMillisecond(): number; - /** - * @return the UTC day-of-week (the enum values correspond to JavaScript - * week day numbers) - */ - utcWeekDay(): basics.WeekDay; - /** - * The ISO 8601 UTC week number. Week 1 is the week - * that has January 4th in it, and it starts on Monday. - * See https://en.wikipedia.org/wiki/ISO_week_date - * - * @return Week number [1-53] - */ - utcWeekNumber(): number; - /** - * The week of this month. There is no official standard for this, - * but we assume the same rules for the weekNumber (i.e. - * week 1 is the week that has the 4th day of the month in it) - * - * @return Week number [1-5] - */ - utcWeekOfMonth(): number; - /** - * Returns the number of seconds that have passed on the current day - * Does not consider leap seconds - * - * @return seconds [0-86399] - */ - utcSecondOfDay(): number; - /** - * Convert this date to the given time zone (in-place). - * Throws if this date does not have a time zone. - * @return this (for chaining) - */ - convert(zone?: timezone.TimeZone): DateTime; - /** - * Returns this date converted to the given time zone. - * Unaware dates can only be converted to unaware dates (clone) - * Converting an unaware date to an aware date throws an exception. Use the constructor - * if you really need to do that. - * - * @param zone The new time zone. This may be null to create unaware date. - * @return The converted date - */ - toZone(zone?: timezone.TimeZone): DateTime; - /** - * Convert to JavaScript date with the zone time in the getX() methods. - * Unless the timezone is local, the Date.getUTCX() methods will NOT be correct. - * This is because Date calculates getUTCX() from getX() applying local time zone. - */ - toDate(): Date; - /** - * Add a time duration relative to UTC. Note that this simply adds a number - * of milliseconds to UTC and converts back to zone(), - * There is not DST handling. - * @return this + duration - */ - add(duration: duration.Duration): DateTime; - /** - * Add an amount of time relative to UTC, as regularly as possible. - * - * Adding e.g. 1 hour will increment the utcHour() field, adding 1 month - * increments the utcMonth() field. - * Adding an amount of units leaves lower units intact. E.g. - * adding a month will leave the day() field untouched if possible. - * - * Note adding Months or Years will clamp the date to the end-of-month if - * the start date was at the end of a month, i.e. contrary to JavaScript - * Date#setUTCMonth() it will not overflow into the next month - * - * In case of DST changes, the utc time fields are still untouched but local - * time fields may shift. - */ - add(amount: number, unit: basics.TimeUnit): DateTime; - /** - * Add an amount of time to the zone time, as regularly as possible. - * - * Adding e.g. 1 hour will increment the hour() field of the zone - * date by one. In case of DST changes, the time fields may additionally - * increase by the DST offset, if a non-existing local time would - * be reached otherwise. - * - * Adding a unit of time will leave lower-unit fields intact, unless the result - * would be a non-existing time. Then an extra DST offset is added. - * - * Note adding Months or Years will clamp the date to the end-of-month if - * the start date was at the end of a month, i.e. contrary to JavaScript - * Date#setUTCMonth() it will not overflow into the next month - */ - addLocal(amount: number, unit: basics.TimeUnit): DateTime; - /** - * Same as add(-1*duration); - */ - sub(duration: duration.Duration): DateTime; - /** - * Same as add(-1*amount, unit); - */ - sub(amount: number, unit: basics.TimeUnit): DateTime; - /** - * Same as addLocal(-1*amount, unit); - */ - subLocal(amount: number, unit: basics.TimeUnit): DateTime; - /** - * Time difference between two DateTimes - * @return this - other - */ - diff(other: DateTime): duration.Duration; - /** - * Chops off the time part, yields the same date at 00:00:00.000 - * @return a new DateTime - */ - startOfDay(): DateTime; - /** - * @return True iff (this < other) - */ - lessThan(other: DateTime): boolean; - /** - * @return True iff (this <= other) - */ - lessEqual(other: DateTime): boolean; - /** - * @return True iff this and other represent the same moment in time in UTC - */ - equals(other: DateTime): boolean; - /** - * @return True iff this and other represent the same time and the same zone - */ - identical(other: DateTime): boolean; - /** - * @return True iff this > other - */ - greaterThan(other: DateTime): boolean; - /** - * @return True iff this >= other - */ - greaterEqual(other: DateTime): boolean; - /** - * @return The minimum of this and other - */ - min(other: DateTime): DateTime; - /** - * @return The maximum of this and other - */ - max(other: DateTime): DateTime; - /** - * Proper ISO 8601 format string with any IANA zone converted to ISO offset - * E.g. "2014-01-01T23:15:33+01:00" for Europe/Amsterdam - */ - toIsoString(): string; - /** - * Return a string representation of the DateTime according to the - * specified format. The format is implemented as the LDML standard - * (http://unicode.org/reports/tr35/tr35-dates.html#Date_Format_Patterns) - * - * @param formatString The format specification (e.g. "dd/MM/yyyy HH:mm:ss") - * @return The string representation of this DateTime - */ - format(formatString: string): string; - /** - * Modified ISO 8601 format string with IANA name if applicable. - * E.g. "2014-01-01T23:15:33.000 Europe/Amsterdam" - */ - toString(): string; - /** - * Used by util.inspect() - */ - inspect(): string; - /** - * The valueOf() method returns the primitive value of the specified object. - */ - valueOf(): any; - /** - * Modified ISO 8601 format string in UTC without time zone info - */ - toUtcString(): string; + /** + * Actual time source in use. Setting this property allows to + * fake time in tests. DateTime.nowLocal() and DateTime.nowUtc() + * use this property for obtaining the current time. + */ + static timeSource: TimeSource; + /** + * Current date+time in local time + */ + static nowLocal(): DateTime; + /** + * Current date+time in UTC time + */ + static nowUtc(): DateTime; + /** + * Current date+time in the given time zone + * @param timeZone The desired time zone (optional, defaults to UTC). + */ + static now(timeZone?: TimeZone): DateTime; + /** + * Create a DateTime from a Lotus 123 / Microsoft Excel date-time value + * i.e. a double representing days since 1-1-1900 where 1900 is incorrectly seen as leap year + */ + static fromExcel(n: number, timeZone?: TimeZone): DateTime; + /** + * Constructor. Creates current time in local timezone. + */ + constructor(); + /** + * Constructor + * Non-existing local times are normalized by rounding up to the next DST offset. + * + * @param isoString String in ISO 8601 format. Instead of ISO time zone, + * it may include a space and then and IANA time zone. + * e.g. "2007-04-05T12:30:40.500" (no time zone, naive date) + * e.g. "2007-04-05T12:30:40.500+01:00" (UTC offset without daylight saving time) + * or "2007-04-05T12:30:40.500Z" (UTC) + * or "2007-04-05T12:30:40.500 Europe/Amsterdam" (IANA time zone, with daylight saving time if applicable) + * @param timeZone if given, the date in the string is assumed to be in this time zone. + * Note that it is NOT CONVERTED to the time zone. Useful + * for strings without a time zone + */ + constructor(isoString: string, timeZone?: TimeZone); + /** + * Constructor. You provide a date, then you say whether to take the + * date.getYear()/getXxx methods or the date.getUTCYear()/date.getUTCXxx methods, + * and then you state which time zone that date is in. + * Non-existing local times are normalized by rounding up to the next DST offset. + * Note that the Date class has bugs and inconsistencies when constructing them with times around + * DST changes. + * + * @param date A date object. + * @param getters Specifies which set of Date getters contains the date in the given time zone: the + * Date.getXxx() methods or the Date.getUTCXxx() methods. + * @param timeZone The time zone that the given date is assumed to be in (may be null for unaware dates) + */ + constructor(date: Date, getFuncs: DateFunctions, timeZone?: TimeZone); + /** + * Constructor. Note that unlike JavaScript dates we require fields to be in normal ranges. + * Use the add(duration) or sub(duration) for arithmetic. + * @param year The full year (e.g. 2014) + * @param month The month [1-12] (note this deviates from JavaScript Date) + * @param day The day of the month [1-31] + * @param hour The hour of the day [0-24) + * @param minute The minute of the hour [0-59] + * @param second The second of the minute [0-59] + * @param millisecond The millisecond of the second [0-999] + * @param timeZone The time zone, or null (for unaware dates) + */ + constructor(year: number, month: number, day: number, hour?: number, minute?: number, second?: number, millisecond?: number, timeZone?: TimeZone); + /** + * Constructor + * @param unixTimestamp milliseconds since 1970-01-01T00:00:00.000 + * @param timeZone the time zone that the timestamp is assumed to be in (usually UTC). + */ + constructor(unixTimestamp: number, timeZone?: TimeZone); + /** + * @return a copy of this object + */ + clone(): DateTime; + /** + * @return The time zone that the date is in. May be null for unaware dates. + */ + zone(): TimeZone; + /** + * Zone name abbreviation at this time + * @param dstDependent (default true) set to false for a DST-agnostic abbreviation + * @return The abbreviation + */ + zoneAbbreviation(dstDependent?: boolean): string; + /** + * @return the offset w.r.t. UTC in minutes. Returns 0 for unaware dates and for UTC dates. + */ + offset(): number; + /** + * @return The full year e.g. 2014 + */ + year(): number; + /** + * @return The month 1-12 (note this deviates from JavaScript Date) + */ + month(): number; + /** + * @return The day of the month 1-31 + */ + day(): number; + /** + * @return The hour 0-23 + */ + hour(): number; + /** + * @return the minutes 0-59 + */ + minute(): number; + /** + * @return the seconds 0-59 + */ + second(): number; + /** + * @return the milliseconds 0-999 + */ + millisecond(): number; + /** + * @return the day-of-week (the enum values correspond to JavaScript + * week day numbers) + */ + weekDay(): WeekDay; + /** + * Returns the day number within the year: Jan 1st has number 0, + * Jan 2nd has number 1 etc. + * + * @return the day-of-year [0-366] + */ + dayOfYear(): number; + /** + * The ISO 8601 week number. Week 1 is the week + * that has January 4th in it, and it starts on Monday. + * See https://en.wikipedia.org/wiki/ISO_week_date + * + * @return Week number [1-53] + */ + weekNumber(): number; + /** + * The week of this month. There is no official standard for this, + * but we assume the same rules for the weekNumber (i.e. + * week 1 is the week that has the 4th day of the month in it) + * + * @return Week number [1-5] + */ + weekOfMonth(): number; + /** + * Returns the number of seconds that have passed on the current day + * Does not consider leap seconds + * + * @return seconds [0-86399] + */ + secondOfDay(): number; + /** + * @return Milliseconds since 1970-01-01T00:00:00.000Z + */ + unixUtcMillis(): number; + /** + * @return The full year e.g. 2014 + */ + utcYear(): number; + /** + * @return The UTC month 1-12 (note this deviates from JavaScript Date) + */ + utcMonth(): number; + /** + * @return The UTC day of the month 1-31 + */ + utcDay(): number; + /** + * @return The UTC hour 0-23 + */ + utcHour(): number; + /** + * @return The UTC minutes 0-59 + */ + utcMinute(): number; + /** + * @return The UTC seconds 0-59 + */ + utcSecond(): number; + /** + * Returns the UTC day number within the year: Jan 1st has number 0, + * Jan 2nd has number 1 etc. + * + * @return the day-of-year [0-366] + */ + utcDayOfYear(): number; + /** + * @return The UTC milliseconds 0-999 + */ + utcMillisecond(): number; + /** + * @return the UTC day-of-week (the enum values correspond to JavaScript + * week day numbers) + */ + utcWeekDay(): WeekDay; + /** + * The ISO 8601 UTC week number. Week 1 is the week + * that has January 4th in it, and it starts on Monday. + * See https://en.wikipedia.org/wiki/ISO_week_date + * + * @return Week number [1-53] + */ + utcWeekNumber(): number; + /** + * The week of this month. There is no official standard for this, + * but we assume the same rules for the weekNumber (i.e. + * week 1 is the week that has the 4th day of the month in it) + * + * @return Week number [1-5] + */ + utcWeekOfMonth(): number; + /** + * Returns the number of seconds that have passed on the current day + * Does not consider leap seconds + * + * @return seconds [0-86399] + */ + utcSecondOfDay(): number; + /** + * Convert this date to the given time zone (in-place). + * Throws if this date does not have a time zone. + * @return this (for chaining) + */ + convert(zone?: TimeZone): DateTime; + /** + * Returns this date converted to the given time zone. + * Unaware dates can only be converted to unaware dates (clone) + * Converting an unaware date to an aware date throws an exception. Use the constructor + * if you really need to do that. + * + * @param zone The new time zone. This may be null to create unaware date. + * @return The converted date + */ + toZone(zone?: TimeZone): DateTime; + /** + * Convert to JavaScript date with the zone time in the getX() methods. + * Unless the timezone is local, the Date.getUTCX() methods will NOT be correct. + * This is because Date calculates getUTCX() from getX() applying local time zone. + */ + toDate(): Date; + /** + * Add a time duration relative to UTC. + * @return this + duration + */ + add(duration: Duration): DateTime; + /** + * Add an amount of time relative to UTC, as regularly as possible. + * + * Adding e.g. 1 hour will increment the utcHour() field, adding 1 month + * increments the utcMonth() field. + * Adding an amount of units leaves lower units intact. E.g. + * adding a month will leave the day() field untouched if possible. + * + * Note adding Months or Years will clamp the date to the end-of-month if + * the start date was at the end of a month, i.e. contrary to JavaScript + * Date#setUTCMonth() it will not overflow into the next month + * + * In case of DST changes, the utc time fields are still untouched but local + * time fields may shift. + */ + add(amount: number, unit: TimeUnit): DateTime; + /** + * Add an amount of time to the zone time, as regularly as possible. + * + * Adding e.g. 1 hour will increment the hour() field of the zone + * date by one. In case of DST changes, the time fields may additionally + * increase by the DST offset, if a non-existing local time would + * be reached otherwise. + * + * Adding a unit of time will leave lower-unit fields intact, unless the result + * would be a non-existing time. Then an extra DST offset is added. + * + * Note adding Months or Years will clamp the date to the end-of-month if + * the start date was at the end of a month, i.e. contrary to JavaScript + * Date#setUTCMonth() it will not overflow into the next month + */ + addLocal(duration: Duration): DateTime; + addLocal(amount: number, unit: TimeUnit): DateTime; + /** + * Same as add(-1*duration); + */ + sub(duration: Duration): DateTime; + /** + * Same as add(-1*amount, unit); + */ + sub(amount: number, unit: TimeUnit): DateTime; + /** + * Same as addLocal(-1*amount, unit); + */ + subLocal(duration: Duration): DateTime; + subLocal(amount: number, unit: TimeUnit): DateTime; + /** + * Time difference between two DateTimes + * @return this - other + */ + diff(other: DateTime): Duration; + /** + * Chops off the time part, yields the same date at 00:00:00.000 + * @return a new DateTime + */ + startOfDay(): DateTime; + /** + * @return True iff (this < other) + */ + lessThan(other: DateTime): boolean; + /** + * @return True iff (this <= other) + */ + lessEqual(other: DateTime): boolean; + /** + * @return True iff this and other represent the same moment in time in UTC + */ + equals(other: DateTime): boolean; + /** + * @return True iff this and other represent the same time and the same zone + */ + identical(other: DateTime): boolean; + /** + * @return True iff this > other + */ + greaterThan(other: DateTime): boolean; + /** + * @return True iff this >= other + */ + greaterEqual(other: DateTime): boolean; + /** + * @return The minimum of this and other + */ + min(other: DateTime): DateTime; + /** + * @return The maximum of this and other + */ + max(other: DateTime): DateTime; + /** + * Proper ISO 8601 format string with any IANA zone converted to ISO offset + * E.g. "2014-01-01T23:15:33+01:00" for Europe/Amsterdam + */ + toIsoString(): string; + /** + * Return a string representation of the DateTime according to the + * specified format. The format is implemented as the LDML standard + * (http://unicode.org/reports/tr35/tr35-dates.html#Date_Format_Patterns) + * + * @param formatString The format specification (e.g. "dd/MM/yyyy HH:mm:ss") + * @return The string representation of this DateTime + */ + format(formatString: string): string; + /** + * Modified ISO 8601 format string with IANA name if applicable. + * E.g. "2014-01-01T23:15:33.000 Europe/Amsterdam" + */ + toString(): string; + /** + * Used by util.inspect() + */ + inspect(): string; + /** + * The valueOf() method returns the primitive value of the specified object. + */ + valueOf(): any; + /** + * Modified ISO 8601 format string in UTC without time zone info + */ + toUtcString(): string; } } declare module '__timezonecomplete/duration' { import basics = require("__timezonecomplete/basics"); + import TimeUnit = basics.TimeUnit; /** - * Construct a time duration - * @param n Number of hours (may be fractional or negative) - * @return A duration of n hours - */ + * Construct a time duration + * @param n Number of years (may be fractional or negative) + * @return A duration of n years + */ + export function years(n: number): Duration; + /** + * Construct a time duration + * @param n Number of months (may be fractional or negative) + * @return A duration of n months + */ + export function months(n: number): Duration; + /** + * Construct a time duration + * @param n Number of days (may be fractional or negative) + * @return A duration of n days + */ + export function days(n: number): Duration; + /** + * Construct a time duration + * @param n Number of hours (may be fractional or negative) + * @return A duration of n hours + */ export function hours(n: number): Duration; /** - * Construct a time duration - * @param n Number of minutes (may be fractional or negative) - * @return A duration of n minutes - */ + * Construct a time duration + * @param n Number of minutes (may be fractional or negative) + * @return A duration of n minutes + */ export function minutes(n: number): Duration; /** - * Construct a time duration - * @param n Number of seconds (may be fractional or negative) - * @return A duration of n seconds - */ + * Construct a time duration + * @param n Number of seconds (may be fractional or negative) + * @return A duration of n seconds + */ export function seconds(n: number): Duration; /** - * Construct a time duration - * @param n Number of milliseconds (may be fractional or negative) - * @return A duration of n milliseconds - */ + * Construct a time duration + * @param n Number of milliseconds (may be fractional or negative) + * @return A duration of n milliseconds + */ export function milliseconds(n: number): Duration; /** - * Time duration. Create one e.g. like this: var d = Duration.hours(1). - * Note that time durations do not take leap seconds etc. into account: - * one hour is simply represented as 3600000 milliseconds. - */ + * Time duration which is represented as an amount and a unit e.g. + * '1 Month' or '166 Seconds'. The unit is preserved through calculations. + * + * It has two sets of getter functions: + * - second(), minute(), hour() etc, singular form: these can be used to create string representations. + * These return a part of your string representation. E.g. for 2500 milliseconds, the millisecond() part would be 500 + * - seconds(), minutes(), hours() etc, plural form: these return the total amount represented in the corresponding unit. + */ export class Duration { - /** - * Construct a time duration - * @param n Number of hours (may be fractional or negative) - * @return A duration of n hours - */ - static hours(n: number): Duration; - /** - * Construct a time duration - * @param n Number of minutes (may be fractional or negative) - * @return A duration of n minutes - */ - static minutes(n: number): Duration; - /** - * Construct a time duration - * @param n Number of seconds (may be fractional or negative) - * @return A duration of n seconds - */ - static seconds(n: number): Duration; - /** - * Construct a time duration - * @param n Number of milliseconds (may be fractional or negative) - * @return A duration of n milliseconds - */ - static milliseconds(n: number): Duration; - /** - * Construct a time duration of 0 - */ - constructor(); - /** - * Construct a time duration from a number of milliseconds - */ - constructor(milliseconds: number); - /** - * Construct a time duration from a string in format - * [-]h[:m[:s[.n]]] e.g. -01:00:30.501 - */ - constructor(input: string); - /** - * Construct a duration from an amount and a time unit. - * @param amount Number of units - * @param unit A time unit i.e. TimeUnit.Second, TimeUnit.Hour etc. - */ - constructor(amount: number, unit: basics.TimeUnit); - /** - * @return another instance of Duration with the same value. - */ - clone(): Duration; - /** - * The entire duration in milliseconds (negative or positive) - */ - milliseconds(): number; - /** - * The millisecond part of the duration (always positive) - * @return e.g. 400 for a -01:02:03.400 duration - */ - millisecond(): number; - /** - * The entire duration in seconds (negative or positive, fractional) - * @return e.g. 1.5 for a 1500 milliseconds duration - */ - seconds(): number; - /** - * The second part of the duration (always positive) - * @return e.g. 3 for a -01:02:03.400 duration - */ - second(): number; - /** - * The entire duration in minutes (negative or positive, fractional) - * @return e.g. 1.5 for a 90000 milliseconds duration - */ - minutes(): number; - /** - * The minute part of the duration (always positive) - * @return e.g. 2 for a -01:02:03.400 duration - */ - minute(): number; - /** - * The entire duration in hours (negative or positive, fractional) - * @return e.g. 1.5 for a 5400000 milliseconds duration - */ - hours(): number; - /** - * The hour part of the duration (always positive). - * Note that this part can exceed 23 hours, because for - * now, we do not have a days() function - * @return e.g. 25 for a -25:02:03.400 duration - */ - wholeHours(): number; - /** - * Sign - * @return "-" if the duration is negative - */ - sign(): string; - /** - * @return True iff (this < other) - */ - lessThan(other: Duration): boolean; - /** - * @return True iff (this <= other) - */ - lessEqual(other: Duration): boolean; - /** - * @return True iff this and other represent the same time duration - */ - equals(other: Duration): boolean; - /** - * @return True iff this > other - */ - greaterThan(other: Duration): boolean; - /** - * @return True iff this >= other - */ - greaterEqual(other: Duration): boolean; - /** - * @return The minimum (most negative) of this and other - */ - min(other: Duration): Duration; - /** - * @return The maximum (most positive) of this and other - */ - max(other: Duration): Duration; - /** - * Multiply with a fixed number. - * @return a new Duration of (this * value) - */ - multiply(value: number): Duration; - /** - * Divide by a fixed number. - * @return a new Duration of (this / value) - */ - divide(value: number): Duration; - /** - * Add a duration. - * @return a new Duration of (this + value) - */ - add(value: Duration): Duration; - /** - * Subtract a duration. - * @return a new Duration of (this - value) - */ - sub(value: Duration): Duration; - /** - * String in [-]hh:mm:ss.nnn notation. All fields are - * always present except the sign. - */ - toFullString(): string; - /** - * String in [-]hh[:mm[:ss[.nnn]]] notation. Fields are - * added as necessary - */ - toString(): string; - /** - * Used by util.inspect() - */ - inspect(): string; - /** - * The valueOf() method returns the primitive value of the specified object. - */ - valueOf(): any; + /** + * Construct a time duration + * @param n Number of years (may be fractional or negative) + * @return A duration of n years + */ + static years(n: number): Duration; + /** + * Construct a time duration + * @param n Number of months (may be fractional or negative) + * @return A duration of n months + */ + static months(n: number): Duration; + /** + * Construct a time duration + * @param n Number of days (may be fractional or negative) + * @return A duration of n days + */ + static days(n: number): Duration; + /** + * Construct a time duration + * @param n Number of hours (may be fractional or negative) + * @return A duration of n hours + */ + static hours(n: number): Duration; + /** + * Construct a time duration + * @param n Number of minutes (may be fractional or negative) + * @return A duration of n minutes + */ + static minutes(n: number): Duration; + /** + * Construct a time duration + * @param n Number of seconds (may be fractional or negative) + * @return A duration of n seconds + */ + static seconds(n: number): Duration; + /** + * Construct a time duration + * @param n Number of milliseconds (may be fractional or negative) + * @return A duration of n milliseconds + */ + static milliseconds(n: number): Duration; + /** + * Construct a time duration of 0 + */ + constructor(); + /** + * Construct a time duration from a string in one of two formats: + * 1) [-]hhhh[:mm[:ss[.nnn]]] e.g. '-01:00:30.501' + * 2) amount and unit e.g. '-1 days' or '1 year'. The unit may be in singular or plural form and is case-insensitive + */ + constructor(input: string); + /** + * Construct a duration from an amount and a time unit. + * @param amount Number of units + * @param unit A time unit i.e. TimeUnit.Second, TimeUnit.Hour etc. Default Millisecond. + */ + constructor(amount: number, unit?: TimeUnit); + /** + * @return another instance of Duration with the same value. + */ + clone(): Duration; + /** + * Returns this duration expressed in different unit (positive or negative, fractional). + * This is precise for Year <-> Month and for time-to-time conversion (i.e. Hour-or-less to Hour-or-less). + * It is approximate for any other conversion + */ + as(unit: TimeUnit): number; + /** + * Convert this duration to a Duration in another unit. You always get a clone even if you specify + * the same unit. + * This is precise for Year <-> Month and for time-to-time conversion (i.e. Hour-or-less to Hour-or-less). + * It is approximate for any other conversion + */ + convert(unit: TimeUnit): Duration; + /** + * The entire duration in milliseconds (negative or positive) + * For Day/Month/Year durations, this is approximate! + */ + milliseconds(): number; + /** + * The millisecond part of the duration (always positive) + * For Day/Month/Year durations, this is approximate! + * @return e.g. 400 for a -01:02:03.400 duration + */ + millisecond(): number; + /** + * The entire duration in seconds (negative or positive, fractional) + * For Day/Month/Year durations, this is approximate! + * @return e.g. 1.5 for a 1500 milliseconds duration + */ + seconds(): number; + /** + * The second part of the duration (always positive) + * For Day/Month/Year durations, this is approximate! + * @return e.g. 3 for a -01:02:03.400 duration + */ + second(): number; + /** + * The entire duration in minutes (negative or positive, fractional) + * For Day/Month/Year durations, this is approximate! + * @return e.g. 1.5 for a 90000 milliseconds duration + */ + minutes(): number; + /** + * The minute part of the duration (always positive) + * For Day/Month/Year durations, this is approximate! + * @return e.g. 2 for a -01:02:03.400 duration + */ + minute(): number; + /** + * The entire duration in hours (negative or positive, fractional) + * For Day/Month/Year durations, this is approximate! + * @return e.g. 1.5 for a 5400000 milliseconds duration + */ + hours(): number; + /** + * The hour part of a duration. This assumes that a day has 24 hours (which is not the case + * during DST changes). + */ + hour(): number; + /** + * DEPRECATED + * The hour part of the duration (always positive). + * Note that this part can exceed 23 hours, because for + * now, we do not have a days() function + * For Day/Month/Year durations, this is approximate! + * @return e.g. 25 for a -25:02:03.400 duration + */ + wholeHours(): number; + /** + * The entire duration in days (negative or positive, fractional) + * This is approximate if this duration is not in days! + */ + days(): number; + /** + * The day part of a duration. This assumes that a month has 30 days. + */ + day(): number; + /** + * The entire duration in days (negative or positive, fractional) + * This is approximate if this duration is not in Months or Years! + */ + months(): number; + /** + * The month part of a duration. + */ + month(): number; + /** + * The entire duration in years (negative or positive, fractional) + * This is approximate if this duration is not in Months or Years! + */ + years(): number; + /** + * Non-fractional positive years + */ + wholeYears(): number; + /** + * Amount of units (positive or negative, fractional) + */ + amount(): number; + /** + * The unit this duration was created with + */ + unit(): TimeUnit; + /** + * Sign + * @return "-" if the duration is negative + */ + sign(): string; + /** + * Approximate if the durations have units that cannot be converted + * @return True iff (this < other) + */ + lessThan(other: Duration): boolean; + /** + * Approximate if the durations have units that cannot be converted + * @return True iff (this <= other) + */ + lessEqual(other: Duration): boolean; + /** + * Similar but not identical + * Approximate if the durations have units that cannot be converted + * @return True iff this and other represent the same time duration + */ + equals(other: Duration): boolean; + /** + * Similar but not identical + * Returns false if we cannot determine whether they are equal in all time zones + * so e.g. 60 minutes equals 1 hour, but 24 hours do NOT equal 1 day + * + * @return True iff this and other represent the same time duration + */ + equalsExact(other: Duration): boolean; + /** + * Same unit and same amount + */ + identical(other: Duration): boolean; + /** + * Approximate if the durations have units that cannot be converted + * @return True iff this > other + */ + greaterThan(other: Duration): boolean; + /** + * Approximate if the durations have units that cannot be converted + * @return True iff this >= other + */ + greaterEqual(other: Duration): boolean; + /** + * Approximate if the durations have units that cannot be converted + * @return The minimum (most negative) of this and other + */ + min(other: Duration): Duration; + /** + * Approximate if the durations have units that cannot be converted + * @return The maximum (most positive) of this and other + */ + max(other: Duration): Duration; + /** + * Approximate if the durations have units that cannot be converted + * Multiply with a fixed number. + * @return a new Duration of (this * value) + */ + multiply(value: number): Duration; + /** + * Approximate if the durations have units that cannot be converted + * Divide by a fixed number. + * @return a new Duration of (this / value) + */ + divide(value: number): Duration; + /** + * Add a duration. + * @return a new Duration of (this + value) with the unit of this duration + */ + add(value: Duration): Duration; + /** + * Subtract a duration. + * @return a new Duration of (this - value) with the unit of this duration + */ + sub(value: Duration): Duration; + /** + * Return the absolute value of the duration i.e. remove the sign. + */ + abs(): Duration; + /** + * DEPRECATED + * String in [-]hhhh:mm:ss.nnn notation. All fields are + * always present except the sign. + */ + toFullString(): string; + /** + * String in [-]hhhh:mm[:ss[.nnn]] notation. + * @param full If true, then all fields are always present except the sign. Otherwise, seconds and milliseconds + * are chopped off if zero + */ + toHmsString(full?: boolean): string; + /** + * String in ISO 8601 notation e.g. 'P1M' for one month or 'PT1M' for one minute + */ + toIsoString(): string; + /** + * String representation with amount and unit e.g. '1.5 years' or '-1 day' + */ + toString(): string; + /** + * Used by util.inspect() + */ + inspect(): string; + /** + * The valueOf() method returns the primitive value of the specified object. + */ + valueOf(): any; } } declare module '__timezonecomplete/javascript' { /** - * Indicates how a Date object should be interpreted. - * Either we can take getYear(), getMonth() etc for our field - * values, or we can take getUTCYear(), getUtcMonth() etc to do that. - */ + * Indicates how a Date object should be interpreted. + * Either we can take getYear(), getMonth() etc for our field + * values, or we can take getUTCYear(), getUtcMonth() etc to do that. + */ export enum DateFunctions { - /** - * Use the Date.getFullYear(), Date.getMonth(), ... functions. - */ - Get = 0, - /** - * Use the Date.getUTCFullYear(), Date.getUTCMonth(), ... functions. - */ - GetUTC = 1, + /** + * Use the Date.getFullYear(), Date.getMonth(), ... functions. + */ + Get = 0, + /** + * Use the Date.getUTCFullYear(), Date.getUTCMonth(), ... functions. + */ + GetUTC = 1, } } declare module '__timezonecomplete/period' { import basics = require("__timezonecomplete/basics"); + import TimeUnit = basics.TimeUnit; + import duration = require("__timezonecomplete/duration"); + import Duration = duration.Duration; import datetime = require("__timezonecomplete/datetime"); + import DateTime = datetime.DateTime; /** - * Specifies how the period should repeat across the day - * during DST changes. - */ + * Specifies how the period should repeat across the day + * during DST changes. + */ export enum PeriodDst { - /** - * Keep repeating in similar intervals measured in UTC, - * unaffected by Daylight Saving Time. - * E.g. a repetition of one hour will take one real hour - * every time, even in a time zone with DST. - * Leap seconds, leap days and month length - * differences will still make the intervals different. - */ - RegularIntervals = 0, - /** - * Ensure that the time at which the intervals occur stay - * at the same place in the day, local time. So e.g. - * a period of one day, starting at 8:05AM Europe/Amsterdam time - * will always start at 8:05 Europe/Amsterdam. This means that - * in UTC time, some intervals will be 25 hours and some - * 23 hours during DST changes. - * Another example: an hourly interval will be hourly in local time, - * skipping an hour in UTC for a DST backward change. - */ - RegularLocalTime = 1, + /** + * Keep repeating in similar intervals measured in UTC, + * unaffected by Daylight Saving Time. + * E.g. a repetition of one hour will take one real hour + * every time, even in a time zone with DST. + * Leap seconds, leap days and month length + * differences will still make the intervals different. + */ + RegularIntervals = 0, + /** + * Ensure that the time at which the intervals occur stay + * at the same place in the day, local time. So e.g. + * a period of one day, starting at 8:05AM Europe/Amsterdam time + * will always start at 8:05 Europe/Amsterdam. This means that + * in UTC time, some intervals will be 25 hours and some + * 23 hours during DST changes. + * Another example: an hourly interval will be hourly in local time, + * skipping an hour in UTC for a DST backward change. + */ + RegularLocalTime = 1, + /** + * End-of-enum marker + */ + MAX = 2, } /** - * Convert a PeriodDst to a string: "regular intervals" or "regular local time" - */ + * Convert a PeriodDst to a string: "regular intervals" or "regular local time" + */ export function periodDstToString(p: PeriodDst): string; /** - * Repeating time period: consists of a starting point and - * a time length. This class accounts for leap seconds and leap days. - */ + * Repeating time period: consists of a starting point and + * a time length. This class accounts for leap seconds and leap days. + */ export class Period { - /** - * Constructor - * LIMITATION: if dst equals RegularLocalTime, and unit is Second, Minute or Hour, - * then the amount must be a factor of 24. So 120 seconds is allowed while 121 seconds is not. - * This is due to the enormous processing power required by these cases. They are not - * implemented and you will get an assert. - * - * @param start The start of the period. If the period is in Months or Years, and - * the day is 29 or 30 or 31, the results are maximised to end-of-month. - * @param amount The amount of units. - * @param unit The unit. - * @param dst Specifies how to handle Daylight Saving Time. Not relevant - * if the time zone of the start datetime does not have DST. - * Defaults to RegularLocalTime. - */ - constructor(start: datetime.DateTime, amount: number, unit: basics.TimeUnit, dst?: PeriodDst); - /** - * The start date - */ - start(): datetime.DateTime; - /** - * The amount of units - */ - amount(): number; - /** - * The unit - */ - unit(): basics.TimeUnit; - /** - * The dst handling mode - */ - dst(): PeriodDst; - /** - * The first occurrence of the period greater than - * the given date. The given date need not be at a period boundary. - * Pre: the fromdate and startdate must either both have timezones or not - * @param fromDate: the date after which to return the next date - * @return the first date matching the period after fromDate, given - * in the same zone as the fromDate. - */ - findFirst(fromDate: datetime.DateTime): datetime.DateTime; - /** - * Returns the next timestamp in the period. The given timestamp must - * be at a period boundary, otherwise the answer is incorrect. - * This function has MUCH better performance than findFirst. - * Returns the datetime "count" times away from the given datetime. - * @param prev Boundary date. Must have a time zone (any time zone) iff the period start date has one. - * @param count Optional, must be >= 1 and whole. - * @return (prev + count * period), in the same timezone as prev. - */ - findNext(prev: datetime.DateTime, count?: number): datetime.DateTime; - /** - * Checks whether the given date is on a period boundary - * (expensive!) - */ - isBoundary(occurrence: datetime.DateTime): boolean; - /** - * Returns true iff this period has the same effect as the given one. - * i.e. a period of 24 hours is equal to one of 1 day if they have the same UTC start moment - * and same dst. - */ - equals(other: Period): boolean; - /** - * Returns true iff this period was constructed with identical arguments to the other one. - */ - identical(other: Period): boolean; - /** - * Returns an ISO duration string e.g. - * 2014-01-01T12:00:00.000+01:00/P1H - * 2014-01-01T12:00:00.000+01:00/PT1M (one minute) - * 2014-01-01T12:00:00.000+01:00/P1M (one month) - */ - toIsoString(): string; - /** - * A string representation e.g. - * "10 years, starting at 2014-03-01T12:00:00 Europe/Amsterdam, keeping regular intervals". - */ - toString(): string; - /** - * Used by util.inspect() - */ - inspect(): string; + /** + * Constructor + * LIMITATION: if dst equals RegularLocalTime, and unit is Second, Minute or Hour, + * then the amount must be a factor of 24. So 120 seconds is allowed while 121 seconds is not. + * This is due to the enormous processing power required by these cases. They are not + * implemented and you will get an assert. + * + * @param start The start of the period. If the period is in Months or Years, and + * the day is 29 or 30 or 31, the results are maximised to end-of-month. + * @param interval The interval of the period + * @param dst Specifies how to handle Daylight Saving Time. Not relevant + * if the time zone of the start datetime does not have DST. + * Defaults to RegularLocalTime. + */ + constructor(start: DateTime, interval: Duration, dst?: PeriodDst); + /** + * Constructor + * LIMITATION: if dst equals RegularLocalTime, and unit is Second, Minute or Hour, + * then the amount must be a factor of 24. So 120 seconds is allowed while 121 seconds is not. + * This is due to the enormous processing power required by these cases. They are not + * implemented and you will get an assert. + * + * @param start The start of the period. If the period is in Months or Years, and + * the day is 29 or 30 or 31, the results are maximised to end-of-month. + * @param amount The amount of units. + * @param unit The unit. + * @param dst Specifies how to handle Daylight Saving Time. Not relevant + * if the time zone of the start datetime does not have DST. + * Defaults to RegularLocalTime. + */ + constructor(start: DateTime, amount: number, unit: TimeUnit, dst?: PeriodDst); + /** + * The start date + */ + start(): DateTime; + /** + * The interval + */ + interval(): Duration; + /** + * DEPRECATED + * The amount of units of the interval + */ + amount(): number; + /** + * DEPRECATED + * The unit of the interval + */ + unit(): TimeUnit; + /** + * The dst handling mode + */ + dst(): PeriodDst; + /** + * The first occurrence of the period greater than + * the given date. The given date need not be at a period boundary. + * Pre: the fromdate and startdate must either both have timezones or not + * @param fromDate: the date after which to return the next date + * @return the first date matching the period after fromDate, given + * in the same zone as the fromDate. + */ + findFirst(fromDate: DateTime): DateTime; + /** + * Returns the next timestamp in the period. The given timestamp must + * be at a period boundary, otherwise the answer is incorrect. + * This function has MUCH better performance than findFirst. + * Returns the datetime "count" times away from the given datetime. + * @param prev Boundary date. Must have a time zone (any time zone) iff the period start date has one. + * @param count Optional, must be >= 1 and whole. + * @return (prev + count * period), in the same timezone as prev. + */ + findNext(prev: DateTime, count?: number): DateTime; + /** + * Checks whether the given date is on a period boundary + * (expensive!) + */ + isBoundary(occurrence: DateTime): boolean; + /** + * Returns true iff this period has the same effect as the given one. + * i.e. a period of 24 hours is equal to one of 1 day if they have the same UTC start moment + * and same dst. + */ + equals(other: Period): boolean; + /** + * Returns true iff this period was constructed with identical arguments to the other one. + */ + identical(other: Period): boolean; + /** + * Returns an ISO duration string e.g. + * 2014-01-01T12:00:00.000+01:00/P1H + * 2014-01-01T12:00:00.000+01:00/PT1M (one minute) + * 2014-01-01T12:00:00.000+01:00/P1M (one month) + */ + toIsoString(): string; + /** + * A string representation e.g. + * "10 years, starting at 2014-03-01T12:00:00 Europe/Amsterdam, keeping regular intervals". + */ + toString(): string; + /** + * Used by util.inspect() + */ + inspect(): string; } } declare module '__timezonecomplete/timesource' { /** - * For testing purposes, we often need to manipulate what the current - * time is. This is an interface for a custom time source object - * so in tests you can use a custom time source. - */ + * For testing purposes, we often need to manipulate what the current + * time is. This is an interface for a custom time source object + * so in tests you can use a custom time source. + */ export interface TimeSource { - /** - * Return the current date+time as a javascript Date object - */ - now(): Date; + /** + * Return the current date+time as a javascript Date object + */ + now(): Date; } /** - * Default time source, returns actual time - */ + * Default time source, returns actual time + */ export class RealTimeSource implements TimeSource { - now(): Date; + now(): Date; } } declare module '__timezonecomplete/timezone' { import javascript = require("__timezonecomplete/javascript"); + import DateFunctions = javascript.DateFunctions; /** - * The local time zone for a given date as per OS settings. Note that time zones are cached - * so you don't necessarily get a new object each time. - */ + * The local time zone for a given date as per OS settings. Note that time zones are cached + * so you don't necessarily get a new object each time. + */ export function local(): TimeZone; /** - * Coordinated Universal Time zone. Note that time zones are cached - * so you don't necessarily get a new object each time. - */ + * Coordinated Universal Time zone. Note that time zones are cached + * so you don't necessarily get a new object each time. + */ export function utc(): TimeZone; /** - * @param offset offset w.r.t. UTC in minutes, e.g. 90 for +01:30. Note that time zones are cached - * so you don't necessarily get a new object each time. - * @returns a time zone with the given fixed offset - */ + * @param offset offset w.r.t. UTC in minutes, e.g. 90 for +01:30. Note that time zones are cached + * so you don't necessarily get a new object each time. + * @returns a time zone with the given fixed offset + */ export function zone(offset: number): TimeZone; /** - * Time zone for an offset string or an IANA time zone string. Note that time zones are cached - * so you don't necessarily get a new object each time. - * @param s Empty string for no time zone (null is returned), - * "localtime" for local time, - * a TZ database time zone name (e.g. Europe/Amsterdam), - * or an offset string (either +01:30, +0130, +01, Z). For a full list of names, see: - * https://en.wikipedia.org/wiki/List_of_tz_database_time_zones - * @param dst Optional, default true: adhere to Daylight Saving Time if applicable. Note for - * "localtime", timezonecomplete will adhere to the computer settings, the DST flag - * does not have any effect. - */ + * Time zone for an offset string or an IANA time zone string. Note that time zones are cached + * so you don't necessarily get a new object each time. + * @param s Empty string for no time zone (null is returned), + * "localtime" for local time, + * a TZ database time zone name (e.g. Europe/Amsterdam), + * or an offset string (either +01:30, +0130, +01, Z). For a full list of names, see: + * https://en.wikipedia.org/wiki/List_of_tz_database_time_zones + * @param dst Optional, default true: adhere to Daylight Saving Time if applicable. Note for + * "localtime", timezonecomplete will adhere to the computer settings, the DST flag + * does not have any effect. + */ export function zone(name: string, dst?: boolean): TimeZone; /** - * The type of time zone - */ + * The type of time zone + */ export enum TimeZoneKind { - /** - * Local time offset as determined by JavaScript Date class. - */ - Local = 0, - /** - * Fixed offset from UTC, without DST. - */ - Offset = 1, - /** - * IANA timezone managed through Olsen TZ database. Includes - * DST if applicable. - */ - Proper = 2, + /** + * Local time offset as determined by JavaScript Date class. + */ + Local = 0, + /** + * Fixed offset from UTC, without DST. + */ + Offset = 1, + /** + * IANA timezone managed through Olsen TZ database. Includes + * DST if applicable. + */ + Proper = 2, } /** - * Option for TimeZone#normalizeLocal() - */ + * Option for TimeZone#normalizeLocal() + */ export enum NormalizeOption { - /** - * Normalize non-existing times by ADDING the DST offset - */ - Up = 0, - /** - * Normalize non-existing times by SUBTRACTING the DST offset - */ - Down = 1, + /** + * Normalize non-existing times by ADDING the DST offset + */ + Up = 0, + /** + * Normalize non-existing times by SUBTRACTING the DST offset + */ + Down = 1, } /** - * Time zone. The object is immutable because it is cached: - * requesting a time zone twice yields the very same object. - * Note that we use time zone offsets inverted w.r.t. JavaScript Date.getTimezoneOffset(), - * i.e. offset 90 means +01:30. - * - * Time zones come in three flavors: the local time zone, as calculated by JavaScript Date, - * a fixed offset ("+01:30") without DST, or a IANA timezone ("Europe/Amsterdam") with DST - * applied depending on the time zone rules. - */ + * Time zone. The object is immutable because it is cached: + * requesting a time zone twice yields the very same object. + * Note that we use time zone offsets inverted w.r.t. JavaScript Date.getTimezoneOffset(), + * i.e. offset 90 means +01:30. + * + * Time zones come in three flavors: the local time zone, as calculated by JavaScript Date, + * a fixed offset ("+01:30") without DST, or a IANA timezone ("Europe/Amsterdam") with DST + * applied depending on the time zone rules. + */ export class TimeZone { - /** - * The local time zone for a given date. Note that - * the time zone varies with the date: amsterdam time for - * 2014-01-01 is +01:00 and amsterdam time for 2014-07-01 is +02:00 - */ - static local(): TimeZone; - /** - * The UTC time zone. - */ - static utc(): TimeZone; - /** - * Time zone with a fixed offset - * @param offset offset w.r.t. UTC in minutes, e.g. 90 for +01:30 - */ - static zone(offset: number): TimeZone; - /** - * Time zone for an offset string or an IANA time zone string. Note that time zones are cached - * so you don't necessarily get a new object each time. - * @param s Empty string for no time zone (null is returned), - * "localtime" for local time, - * a TZ database time zone name (e.g. Europe/Amsterdam), - * or an offset string (either +01:30, +0130, +01, Z). For a full list of names, see: - * https://en.wikipedia.org/wiki/List_of_tz_database_time_zones - * @param dst Optional, default true: adhere to Daylight Saving Time if applicable. Note for - * "localtime", timezonecomplete will adhere to the computer settings, the DST flag - * does not have any effect. - */ - static zone(s: string, dst?: boolean): TimeZone; - /** - * Do not use this constructor, use the static - * TimeZone.zone() method instead. - * @param name NORMALIZED name, assumed to be correct - * @param dst Adhere to Daylight Saving Time if applicable, ignored for local time and fixed offsets - */ - constructor(name: string, dst?: boolean); - /** - * The time zone identifier. Can be an offset "-01:30" or an - * IANA time zone name "Europe/Amsterdam", or "localtime" for - * the local time zone. - */ - name(): string; - dst(): boolean; - /** - * The kind of time zone (Local/Offset/Proper) - */ - kind(): TimeZoneKind; - /** - * Equality operator. Maps zero offsets and different names for UTC onto - * each other. Other time zones are not mapped onto each other. - */ - equals(other: TimeZone): boolean; - /** - * Returns true iff the constructor arguments were identical, so UTC !== GMT - */ - identical(other: TimeZone): boolean; - /** - * Is this zone equivalent to UTC? - */ - isUtc(): boolean; - /** - * Does this zone have Daylight Saving Time at all? - */ - hasDst(): boolean; - /** - * Calculate timezone offset from a UTC time. - * - * @param year Full year - * @param month Month 1-12 (note this deviates from JavaScript date) - * @param day Day of month 1-31 - * @param hour Hour 0-23 - * @param minute Minute 0-59 - * @param second Second 0-59 - * @param millisecond Millisecond 0-999 - * - * @return the offset of this time zone with respect to UTC at the given time, in minutes. - */ - offsetForUtc(year: number, month: number, day: number, hour?: number, minute?: number, second?: number, millisecond?: number): number; - /** - * Calculate timezone offset from a zone-local time (NOT a UTC time). - * @param year local full year - * @param month local month 1-12 (note this deviates from JavaScript date) - * @param day local day of month 1-31 - * @param hour local hour 0-23 - * @param minute local minute 0-59 - * @param second local second 0-59 - * @param millisecond local millisecond 0-999 - * @return the offset of this time zone with respect to UTC at the given time, in minutes. - */ - offsetForZone(year: number, month: number, day: number, hour?: number, minute?: number, second?: number, millisecond?: number): number; - /** - * Note: will be removed in version 2.0.0 - * - * Convenience function, takes values from a Javascript Date - * Calls offsetForUtc() with the contents of the date - * - * @param date: the date - * @param funcs: the set of functions to use: get() or getUTC() - */ - offsetForUtcDate(date: Date, funcs: javascript.DateFunctions): number; - /** - * Note: will be removed in version 2.0.0 - * - * Convenience function, takes values from a Javascript Date - * Calls offsetForUtc() with the contents of the date - * - * @param date: the date - * @param funcs: the set of functions to use: get() or getUTC() - */ - offsetForZoneDate(date: Date, funcs: javascript.DateFunctions): number; - /** - * Zone abbreviation at given UTC timestamp e.g. CEST for Central European Summer Time. - * - * @param year Full year - * @param month Month 1-12 (note this deviates from JavaScript date) - * @param day Day of month 1-31 - * @param hour Hour 0-23 - * @param minute Minute 0-59 - * @param second Second 0-59 - * @param millisecond Millisecond 0-999 - * @param dstDependent (default true) set to false for a DST-agnostic abbreviation - * - * @return "local" for local timezone, the offset for an offset zone, or the abbreviation for a proper zone. - */ - abbreviationForUtc(year: number, month: number, day: number, hour?: number, minute?: number, second?: number, millisecond?: number, dstDependent?: boolean): string; - /** - * Normalizes non-existing local times by adding a forward offset change. - * During a forward standard offset change or DST offset change, some amount of - * local time is skipped. Therefore, this amount of local time does not exist. - * This function adds the amount of forward change to any non-existing time. After all, - * this is probably what the user meant. - * - * @param localUnixMillis Unix timestamp in zone time - * @param opt (optional) Round up or down? Default: up - * - * @returns Unix timestamp in zone time, normalized. - */ - normalizeZoneTime(localUnixMillis: number, opt?: NormalizeOption): number; - /** - * The time zone identifier (normalized). - * Either "localtime", IANA name, or "+hh:mm" offset. - */ - toString(): string; - /** - * Used by util.inspect() - */ - inspect(): string; - /** - * Convert an offset number into an offset string - * @param offset The offset in minutes from UTC e.g. 90 minutes - * @return the offset in ISO notation "+01:30" for +90 minutes - */ - static offsetToString(offset: number): string; - /** - * String to offset conversion. - * @param s Formats: "-01:00", "-0100", "-01", "Z" - * @return offset w.r.t. UTC in minutes - */ - static stringToOffset(s: string): number; + /** + * The local time zone for a given date. Note that + * the time zone varies with the date: amsterdam time for + * 2014-01-01 is +01:00 and amsterdam time for 2014-07-01 is +02:00 + */ + static local(): TimeZone; + /** + * The UTC time zone. + */ + static utc(): TimeZone; + /** + * Time zone with a fixed offset + * @param offset offset w.r.t. UTC in minutes, e.g. 90 for +01:30 + */ + static zone(offset: number): TimeZone; + /** + * Time zone for an offset string or an IANA time zone string. Note that time zones are cached + * so you don't necessarily get a new object each time. + * @param s Empty string for no time zone (null is returned), + * "localtime" for local time, + * a TZ database time zone name (e.g. Europe/Amsterdam), + * or an offset string (either +01:30, +0130, +01, Z). For a full list of names, see: + * https://en.wikipedia.org/wiki/List_of_tz_database_time_zones + * TZ database zone name may be suffixed with " without DST" to indicate no DST should be applied. + * In that case, the dst parameter is ignored. + * @param dst Optional, default true: adhere to Daylight Saving Time if applicable. Note for + * "localtime", timezonecomplete will adhere to the computer settings, the DST flag + * does not have any effect. + */ + static zone(s: string, dst?: boolean): TimeZone; + /** + * Do not use this constructor, use the static + * TimeZone.zone() method instead. + * @param name NORMALIZED name, assumed to be correct + * @param dst Adhere to Daylight Saving Time if applicable, ignored for local time and fixed offsets + */ + constructor(name: string, dst?: boolean); + /** + * The time zone identifier. Can be an offset "-01:30" or an + * IANA time zone name "Europe/Amsterdam", or "localtime" for + * the local time zone. + */ + name(): string; + dst(): boolean; + /** + * The kind of time zone (Local/Offset/Proper) + */ + kind(): TimeZoneKind; + /** + * Equality operator. Maps zero offsets and different names for UTC onto + * each other. Other time zones are not mapped onto each other. + */ + equals(other: TimeZone): boolean; + /** + * Returns true iff the constructor arguments were identical, so UTC !== GMT + */ + identical(other: TimeZone): boolean; + /** + * Is this zone equivalent to UTC? + */ + isUtc(): boolean; + /** + * Does this zone have Daylight Saving Time at all? + */ + hasDst(): boolean; + /** + * Calculate timezone offset from a UTC time. + * + * @param year Full year + * @param month Month 1-12 (note this deviates from JavaScript date) + * @param day Day of month 1-31 + * @param hour Hour 0-23 + * @param minute Minute 0-59 + * @param second Second 0-59 + * @param millisecond Millisecond 0-999 + * + * @return the offset of this time zone with respect to UTC at the given time, in minutes. + */ + offsetForUtc(year: number, month: number, day: number, hour?: number, minute?: number, second?: number, millisecond?: number): number; + /** + * Calculate timezone offset from a zone-local time (NOT a UTC time). + * @param year local full year + * @param month local month 1-12 (note this deviates from JavaScript date) + * @param day local day of month 1-31 + * @param hour local hour 0-23 + * @param minute local minute 0-59 + * @param second local second 0-59 + * @param millisecond local millisecond 0-999 + * @return the offset of this time zone with respect to UTC at the given time, in minutes. + */ + offsetForZone(year: number, month: number, day: number, hour?: number, minute?: number, second?: number, millisecond?: number): number; + /** + * Note: will be removed in version 2.0.0 + * + * Convenience function, takes values from a Javascript Date + * Calls offsetForUtc() with the contents of the date + * + * @param date: the date + * @param funcs: the set of functions to use: get() or getUTC() + */ + offsetForUtcDate(date: Date, funcs: DateFunctions): number; + /** + * Note: will be removed in version 2.0.0 + * + * Convenience function, takes values from a Javascript Date + * Calls offsetForUtc() with the contents of the date + * + * @param date: the date + * @param funcs: the set of functions to use: get() or getUTC() + */ + offsetForZoneDate(date: Date, funcs: DateFunctions): number; + /** + * Zone abbreviation at given UTC timestamp e.g. CEST for Central European Summer Time. + * + * @param year Full year + * @param month Month 1-12 (note this deviates from JavaScript date) + * @param day Day of month 1-31 + * @param hour Hour 0-23 + * @param minute Minute 0-59 + * @param second Second 0-59 + * @param millisecond Millisecond 0-999 + * @param dstDependent (default true) set to false for a DST-agnostic abbreviation + * + * @return "local" for local timezone, the offset for an offset zone, or the abbreviation for a proper zone. + */ + abbreviationForUtc(year: number, month: number, day: number, hour?: number, minute?: number, second?: number, millisecond?: number, dstDependent?: boolean): string; + /** + * Normalizes non-existing local times by adding a forward offset change. + * During a forward standard offset change or DST offset change, some amount of + * local time is skipped. Therefore, this amount of local time does not exist. + * This function adds the amount of forward change to any non-existing time. After all, + * this is probably what the user meant. + * + * @param localUnixMillis Unix timestamp in zone time + * @param opt (optional) Round up or down? Default: up + * + * @returns Unix timestamp in zone time, normalized. + */ + normalizeZoneTime(localUnixMillis: number, opt?: NormalizeOption): number; + /** + * The time zone identifier (normalized). + * Either "localtime", IANA name, or "+hh:mm" offset. + */ + toString(): string; + /** + * Used by util.inspect() + */ + inspect(): string; + /** + * Convert an offset number into an offset string + * @param offset The offset in minutes from UTC e.g. 90 minutes + * @return the offset in ISO notation "+01:30" for +90 minutes + */ + static offsetToString(offset: number): string; + /** + * String to offset conversion. + * @param s Formats: "-01:00", "-0100", "-01", "Z" + * @return offset w.r.t. UTC in minutes + */ + static stringToOffset(s: string): number; } } declare module '__timezonecomplete/globals' { import datetime = require("__timezonecomplete/datetime"); + import DateTime = datetime.DateTime; import duration = require("__timezonecomplete/duration"); + import Duration = duration.Duration; /** - * Returns the minimum of two DateTimes - */ - export function min(d1: datetime.DateTime, d2: datetime.DateTime): datetime.DateTime; + * Returns the minimum of two DateTimes + */ + export function min(d1: DateTime, d2: DateTime): DateTime; /** - * Returns the minimum of two Durations - */ - export function min(d1: duration.Duration, d2: duration.Duration): duration.Duration; + * Returns the minimum of two Durations + */ + export function min(d1: Duration, d2: Duration): Duration; /** - * Returns the maximum of two DateTimes - */ - export function max(d1: datetime.DateTime, d2: datetime.DateTime): datetime.DateTime; + * Returns the maximum of two DateTimes + */ + export function max(d1: DateTime, d2: DateTime): DateTime; /** - * Returns the maximum of two Durations - */ - export function max(d1: duration.Duration, d2: duration.Duration): duration.Duration; + * Returns the maximum of two Durations + */ + export function max(d1: Duration, d2: Duration): Duration; + /** + * Returns the absolute value of a Duration + */ + export function abs(d: Duration): Duration; } diff --git a/typescript-deferred/typescript-deferred-tests.ts b/typescript-deferred/typescript-deferred-tests.ts new file mode 100644 index 000000000..0bfa82582 --- /dev/null +++ b/typescript-deferred/typescript-deferred-tests.ts @@ -0,0 +1,61 @@ +/// + +import tsd = require('typescript-deferred'); + +var t1: tsd.PromiseInterface = tsd.when(10) + .then(() => tsd.when('foo')); + +var t2: tsd. PromiseInterface = tsd.when(10) + .then(() => 'foo'); + +var t3: tsd.PromiseInterface = tsd.when(10) + .then(() => 'foo', () => tsd.when('bar')); + +var t4: tsd.PromiseInterface = tsd.when(10) + .then(() => 'foo', () => 'bar'); + +var t5: tsd.PromiseInterface = tsd.when(10) + .then(() => tsd.when('foo'), () => 'bar'); + +var t6: tsd.PromiseInterface = tsd.when(10) + .then(() => tsd.when('foo'), () => tsd.when('bar')); + +var t7: tsd.PromiseInterface = tsd.when(10) + .always(() => 'foo'); + +var t8: tsd.PromiseInterface = tsd.when(10) + .always(() => tsd.when('foo')); + +var t9: tsd.PromiseInterface = tsd.when(10) + .otherwise(() => 11); + +var t10: tsd.PromiseInterface = tsd.when(10) + .otherwise(() => tsd.when(11)); + +var t11: tsd.PromiseInterface = tsd.when('foo'); + +var t12: tsd.PromiseInterface = tsd.when(tsd.when('foo')); + +var t13: tsd.PromiseInterface = tsd.create() + .promise; + +var t14: tsd.DeferredInterface = tsd.create(); + +var t15: tsd.ThenableInterface = tsd.when('foo'); + +var t16: tsd.PromiseInterface = tsd.when( >tsd.when('foo')); + +var t17: tsd.PromiseInterface = tsd.when(10) + .then(() => >tsd.when('foo'), () => >tsd.when('bar')); + +var t18: tsd.PromiseInterface = tsd.create() + .resolve('foo') + .promise; + +var t19: tsd.PromiseInterface = tsd.create() + .resolve(tsd.when('foo')) + .promise; + +var t20: tsd.PromiseInterface = tsd.create() + .reject(new Error('foo')) + .promise; diff --git a/typescript-deferred/typescript-deferred.d.ts b/typescript-deferred/typescript-deferred.d.ts new file mode 100644 index 000000000..bffc65b70 --- /dev/null +++ b/typescript-deferred/typescript-deferred.d.ts @@ -0,0 +1,47 @@ +// Type definitions for typescript-deferred v0.1.5 +// Project: https://github.com/DirtyHairy/typescript-deferred +// Definitions by: Christian Speckner +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module "typescript-deferred" { + + export interface ImmediateSuccessCB { + (value: T): TP; + } + export interface ImmediateErrorCB { + (err: any): TP; + } + export interface DeferredSuccessCB { + (value: T): ThenableInterface; + } + export interface DeferredErrorCB { + (error: any): ThenableInterface; + } + export interface ThenableInterface { + then(successCB?: DeferredSuccessCB, errorCB?: DeferredErrorCB): ThenableInterface; + then(successCB?: DeferredSuccessCB, errorCB?: ImmediateErrorCB): ThenableInterface; + then(successCB?: ImmediateSuccessCB, errorCB?: DeferredErrorCB): ThenableInterface; + then(successCB?: ImmediateSuccessCB, errorCB?: ImmediateErrorCB): ThenableInterface; + } + export interface PromiseInterface extends ThenableInterface { + then(successCB?: DeferredSuccessCB, errorCB?: DeferredErrorCB): PromiseInterface; + then(successCB?: DeferredSuccessCB, errorCB?: ImmediateErrorCB): PromiseInterface; + then(successCB?: ImmediateSuccessCB, errorCB?: DeferredErrorCB): PromiseInterface; + then(successCB?: ImmediateSuccessCB, errorCB?: ImmediateErrorCB): PromiseInterface; + otherwise(errorCB?: DeferredErrorCB): PromiseInterface; + otherwise(errorCB?: ImmediateErrorCB): PromiseInterface; + always(errorCB?: DeferredErrorCB): PromiseInterface; + always(errorCB?: ImmediateErrorCB): PromiseInterface; + } + export interface DeferredInterface { + resolve(value?: ThenableInterface): DeferredInterface; + resolve(value?: T): DeferredInterface; + reject(error?: any): DeferredInterface; + promise: PromiseInterface; + } + export function create(): DeferredInterface; + export function when(value?: ThenableInterface): PromiseInterface; + export function when(value?: T): PromiseInterface; + + +} diff --git a/underscore.string/underscore.string.d.ts b/underscore.string/underscore.string.d.ts index 38271f3de..1b08dcf85 100644 --- a/underscore.string/underscore.string.d.ts +++ b/underscore.string/underscore.string.d.ts @@ -10,6 +10,8 @@ interface UnderscoreStatic { string: UnderscoreStringStatic; } +declare var s : UnderscoreStringStatic; + interface UnderscoreStringStatic extends UnderscoreStringStaticExports { /** * Tests if string contains a substring. diff --git a/underscore/underscore.d.ts b/underscore/underscore.d.ts index 9f49bc47a..7ff9aa5eb 100644 --- a/underscore/underscore.d.ts +++ b/underscore/underscore.d.ts @@ -278,7 +278,7 @@ interface UnderscoreStatic { findIndex( list: _.List, iterator: _.ListIterator, - context?: any): T; + context?: any): number; /** diff --git a/urijs/URI.d.ts b/urijs/URI.d.ts index 818c24a56..448365762 100644 --- a/urijs/URI.d.ts +++ b/urijs/URI.d.ts @@ -95,7 +95,7 @@ declare class URI { removeQuery(qry: Object): URI; addFragment(fragment: string): URI; //fragmentPrefix: string; - fragmentPrefix(prefix: string); + fragmentPrefix(prefix: string): URI; normalize(): URI; normalizeProtocol(): URI; normalizeHostname(): URI; diff --git a/urijs/URI.d.ts.tscparams b/urijs/URI.d.ts.tscparams deleted file mode 100644 index d3f5a12fa..000000000 --- a/urijs/URI.d.ts.tscparams +++ /dev/null @@ -1 +0,0 @@ - diff --git a/webix/webix-tests.ts b/webix/webix-tests.ts new file mode 100644 index 000000000..128bc666c --- /dev/null +++ b/webix/webix-tests.ts @@ -0,0 +1,66 @@ +/// + +//ajax operations +webix.ready(function(){ + webix.ajax().get("te").then(function(){ + webix.message( webix.env.isFF ? "FireFox" : "Other" ); + }); +}); + +//webix helpers +webix.html.addCss(document.body, "text"); +webix.storage.local.get("mydata"); + +var proxy = webix.proxy("meteor", "books"); + +//webix ui helpers +webix.ui.zIndexBase = 101; +webix.ui.zIndex(); +webix.ui.resize(); + +//webix ui constructor +//basic view +var ui = webix.ui({ + view:"list", id:"l1" +}); +ui.adjust(); +$$("l1").adjust(); + +var l1 = {}; +var l2 = {}; + +//specific view types +var ui2 = webix.ui({ + view:"list", id:"21" +}); +ui2.add({ value:"100" }); + +//specific types by id +var list = $$("l1"); +list.add({ value:"100" }); +list.config.height = 100; + + + + +//config typing +var table:webix.ui.datatableConfig = {}; +table.columns = []; +table.autowidth = true; + +webix.ui({ rows:[ table ] }); + +//events +list.attachEvent("onItemClick", function(id:string, e:Event){ + var item = (this).getItem(id); + var self = webix.$$(e); + return true; +}); + +//data collections +var data = new webix.DataCollection(); +data.config["test"]= 123; + +//mixins +var t = webix.DataDriver.json; + diff --git a/webix/webix.d.ts b/webix/webix.d.ts new file mode 100644 index 000000000..a1761c63b --- /dev/null +++ b/webix/webix.d.ts @@ -0,0 +1,7533 @@ +// Type definitions for Webix UI v2.3.0 +// Project: http://webix.com +// Definitions by: Maksim Kozhukh +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module webix { + +type WebixTemplate = (...args: any[])=>string; +type WebixCallback = (...args: any[])=>any; +interface PromisedData { + then(handler:(data:any)=>any):PromisedData; +} + +function ajax():webix._ajax; +function $$(id: string|Event|HTMLElement):webix.ui.view; + + +interface _ajax{ + bind(master:any):webix._ajax; + del(url:string, params?:any, callback?:WebixCallback):PromisedData; + get(url:string, params?:any, callback?:WebixCallback):PromisedData; + getXHR():any; + headers(values:any):webix._ajax; + post(url:string, params?:any, callback?:WebixCallback):PromisedData; + put(url:string, params?:any, callback?:WebixCallback):PromisedData; + response(type:string):void; + stringify():void; + sync():webix._ajax; + master: any; +} +interface clipbuffer{ + destructor():void; + focus():void; + init():void; + set(text:string):void; +} +interface color{ + hexToDec(hex:string):number; + hsvToRgb(h:number, s:number, v:number):any[]; + rgbToHsv(r:number, g:number, b:number):any[]; + toHex(number:number, length?:number):string; + toRgb(rgb:string):any[]; +} +interface csv{ + parse(text:string, delimiter?:any):any[]; + stringify(data:any[], delimiter?:any):string; + delimiter: any; + escape: boolean; +} +interface editors{ + $popup: any; + checkbox: string; + color: string; + combo: string; + date: string; + "inline-checkbox": any; + "inline-text": any; + multiselect: string; + password: string; + popup: string; + richselect: string; + select: string; + text: string; +} +interface env{ + cssPrefix: string; + isFF: boolean; + isIE: boolean; + isSafari: boolean; + isWebKit: boolean; + jsPrefix: string; + mouse: any; + strict: boolean; + svg: boolean; + transform: boolean; + transition: boolean; + transitionDuration: string; + transitionEnd: string; + translate: string; +} +interface history{ + push(view:string, url:string, value:any):void; + track(view:string, url:string):void; +} +interface html{ + addCss(node:HTMLElement, name:string):void; + addMeta(name:string, value:string):void; + addStyle(css:string):void; + allowSelect():void; + create(name:string, attrs:any, html?:string):HTMLElement; + createCss(data:any):string; + denySelect():void; + getValue(node:HTMLElement):string; + index(node:HTMLElement):number; + insertBefore(node:HTMLElement, before:HTMLElement, rescue?:HTMLElement):void; + locate(ev:Event|HTMLElement, name:string):string; + offset(node:HTMLElement):any; + pos(ev:Event):any; + posRelative(ev:Event):any; + preventEvent(ev:Event):boolean; + remove(node:HTMLElement|HTMLElement[]):void; + removeCss(node:HTMLElement, name:string):void; + stopEvent(ev:Event):boolean; +} +interface i18n{ + dateFormatDate(date:string):any; + dateFormatStr(date:any):string; + fullDateFormatDate(date:string):any; + fullDateFormatStr(date:Date):string; + intFormat(num:number):string; + longDateFormatDate(date:string):any; + longDateFormatStr(date:any):string; + numberFormat(number:number):string; + parseFormatDate(date:string):any; + parseFormatStr(date:any):string; + parseTimeFormatDate(date:string):void; + parseTimeFormatStr(date:any):void; + priceFormat(number:number):string; + setLocale(name:string):void; + timeFormatDate(time:string):any; + timeFormatStr(date:any):string; + calendar: any; + controls: any; + dateFormat: string; + decimalDelimiter: string; + decimalSize: number; + fileSize: any[]; + fullDateFormat: string; + groupDelimiter: string; + groupSize: number; + locales: any; + longDateFormat: string; + parseFormat: string; + parseTimeFormat: string; + price: string; + priceSettings: any; + timeFormat: string; +} +interface locale{ + pager: any; +} +interface markup{ + init(node:string, target:string):webix.ui.baseview; + parse(data:any, datatype:string):void; + attribute: any; + dataTag: any; + namespace: any; +} +interface promise{ + all(promise:PromisedData, morepromises?:PromisedData):void; + defer():PromisedData; + fcall():PromisedData; + nfcall():PromisedData; +} +interface rules{ + isEmail():void; + isNotEmpty():void; + isNumber():void; +} +interface cookie{ + clear():void; + get(name:string):any; + put(name:string, value:any):void; + remove(name:string):void; +} +interface local{ + clear():void; + get(name:string):any; + put(name:string, value:any):void; + remove(name:string):void; +} +interface session{ + clear():void; + get(name:string):any; + put(name:string, value:any):void; + remove(name:string):void; +} +interface storage{ + cookie:webix.cookie; + local:webix.local; + session:webix.session; +} + +function alert(text:string, callback:WebixCallback):HTMLElement; +function animate(html_element:HTMLElement, animation:any):void; +function attachEvent(type:string, functor:WebixCallback, id?:string):string; +function bind(code:WebixCallback, master:any):WebixCallback; +function blockEvent():void; +function callEvent(name:string, params:any[]):boolean; +function clone(source:any):any; +function confirm(text:string, callback:WebixCallback):HTMLElement; +function copy(source:any):any; +function delay(code:WebixCallback, owner?:any, params?:any[], delay?:number):number; +function detachEvent(id:string):void; +function dp(name:string):any; +function editStop():void; +function event(node:HTMLElement, event:string, handler:WebixCallback, master?:any):string; +function eventRemove(id:string):void; +function exec(code:string):void; +function extend(target:any, source:any, overwrite:boolean):any; +function hasEvent(name:string):boolean; +function isArray(check:any):boolean; +function isDate(check:any):boolean; +function isUndefined(check:any):boolean; +function jsonp(url:string, params?:any, callback?:WebixCallback, master?:any):void; +function mapEvent(map:any):void; +function message(text:string):void; +function modalbox(text:string, callback:WebixCallback):HTMLElement; +function once(code:WebixCallback):void; +function proto(target:any, mixin1?:any, mixinN?:any):any; +function protoUI(target:any, view:any, mixin1?:any, mixinN?:any):any; +function proxy(type:string, source:string):any; +function ready(code:WebixCallback):void; +function remote():void; +function require(url:string):void; +function send(url:string, values:any, method:string, target:string):void; +function single(source:WebixCallback):WebixCallback; +function template(template:string):WebixCallback; +function toArray(array:any[]):any[]; +function toFunctor(name:string):WebixCallback; +function toNode(id:string):HTMLElement; +function type(config:any):void; +function ui(config:any, parent?:any, replacement?:any):webix.ui.baseview; +function uid():string; +function unblockEvent():void; +function wrap(target:WebixCallback, source:WebixCallback):WebixCallback; +var codebase: string; +var name: string; +var version: string; +var clipbuffer:webix.clipbuffer; +var color:webix.color; +var csv:webix.csv; +var editors:webix.editors; +var env:webix.env; +var history:webix.history; +var html:webix.html; +var i18n:webix.i18n; +var locale:webix.locale; +var markup:webix.markup; +var promise:webix.promise; +var rules:webix.rules; +var storage:webix.storage; + +interface ActiveContent{ + } +var ActiveContent:ActiveContent; + +interface AtomDataLoader{ + load(url:string, type?:string, callback?:WebixCallback):PromisedData; + parse(data:any, type:string):void; +} +var AtomDataLoader:AtomDataLoader; + +interface AtomRender{ + render(id:string, data:any, type:string):void; + sync(source:any, filter:WebixCallback, silent:boolean):void; +} +var AtomRender:AtomRender; + +interface AutoTooltip{ + } +var AutoTooltip:AutoTooltip; + +interface BaseBind{ + bind(target:any, rule?:WebixCallback, format?:string):void; + unbind():void; +} +var BaseBind:BaseBind; + +interface BindSource{ + addBind(source:any, rule:string, format:string):void; + getBindData(key:string, update:boolean):void; + removeBind(source:any):void; + saveBatch(func:WebixCallback):void; + setBindData(data:any, key:string):void; +} +var BindSource:BindSource; + +interface Canvas{ + clearCanvas():void; + getCanvas(context:string):any; + hideCanvas():void; + renderText(x:number, y:number, text:string, css:string, w:number):void; + renderTextAt(valign:string, align:string, x:number, y:number, t:string, c:string, w:number):void; + showCanvas():void; + toggleCanvas():void; +} +var Canvas:Canvas; + +interface CollectionBind{ + getCursor():number; + refreshCursor():void; + setCursor(cursor:string):void; +} +var CollectionBind:CollectionBind; + +interface ContextHelper{ + attachTo(view:any):void; + getContext():any; +} +var ContextHelper:ContextHelper; + +interface CopyPaste{ + } +var CopyPaste:CopyPaste; + +interface CustomScroll{ + enable(html_node:HTMLElement|webix.ui.baseview):void; + init():void; + scrollStep: number; +} +var CustomScroll:CustomScroll; + +interface DataCollection{ + add(obj:any, index?:number):string; + addBind(source:any, rule:string, format:string):void; + attachEvent(type:string, functor:WebixCallback, id?:string):string; + bind(target:any, rule?:WebixCallback, format?:string):void; + blockEvent():void; + callEvent(name:string, params:any[]):boolean; + clearAll():void; + clearValidation():void; + count():number; + define(property:string, value:any):void; + destructor():void; + detachEvent(id:string):void; + exists(id:string):boolean; + filter(text:string|WebixTemplate|WebixCallback, value:string, preserve:boolean):void; + getBindData(key:string, update:boolean):void; + getCursor():number; + getFirstId():string; + getIdByIndex(index:number):string; + getIndexById(id:string):number; + getItem(id:string):any; + getLastId():string; + getNextId(id:string, step:number):string; + getPrevId(id:string, step:number):string; + hasEvent(name:string):boolean; + isVisible():boolean; + load(url:string, type?:string, callback?:WebixCallback):PromisedData; + loadNext(count:number, start:number, callback:WebixCallback, url:string, now:boolean):void; + mapEvent(map:any):void; + parse(data:any, type:string):void; + refresh(id?:string):void; + refreshCursor():void; + remove(id:string):void; + removeBind(source:any):void; + saveBatch(func:WebixCallback):void; + serialize():any; + setBindData(data:any, key:string):void; + setCursor(cursor:string):void; + sort(by:string, dir?:string, as?:string):void; + sync(source:any, filter:WebixCallback, silent:boolean):void; + unbind():void; + unblockEvent():void; + updateItem(id:string, data:any):void; + validate(id?:string):boolean; + config: { [key: string]: any; }; + name: string; +} +interface DataCollectionFactory{ + new():DataCollection; +} +var DataCollection:DataCollectionFactory; + +interface DataDriver{ + csv: any; + html: any; + htmltable: any; + jsarray: any; + json: any; + xml: any; +} +var DataDriver:DataDriver; + +interface DataLoader{ + add(obj:any, index?:number):string; + clearAll():void; + count():number; + exists(id:string):boolean; + filter(text:string|WebixTemplate|WebixCallback, value:string, preserve:boolean):void; + getFirstId():string; + getIdByIndex(index:number):string; + getIndexById(id:string):number; + getItem(id:string):any; + getLastId():string; + getNextId(id:string, step:number):string; + getPrevId(id:string, step:number):string; + load(url:string, type?:string, callback?:WebixCallback):PromisedData; + loadNext(count:number, start:number, callback:WebixCallback, url:string, now:boolean):void; + parse(data:any, type:string):void; + refresh(id?:string):void; + remove(id:string):void; + serialize():any; + sort(by:string, dir?:string, as?:string):void; + sync(source:any, filter:WebixCallback, silent:boolean):void; + updateItem(id:string, data:any):void; +} +var DataLoader:DataLoader; + +interface DataMarks{ + addCss(id:string|number, css:string, silent?:boolean):void; + clearCss(css:string, silent?:boolean):void; + hasCss(id:string, css:string):boolean; + removeCss(id:string|number, css:string, silent?:boolean):void; +} +var DataMarks:DataMarks; + +interface DataMove{ + copy(sid:string, tindex:number, tobj?:any, details?:any):void; + move(sid:string, tindex:number, tobj?:any, details?:any):string; + moveBottom(id:string):void; + moveDown(id:string, step:number):void; + moveTop(id:string):void; + moveUp(id:string, step:number):void; +} +var DataMove:DataMove; + +interface DataProcessor{ + attachEvent(type:string, functor:WebixCallback, id?:string):string; + attachProgress(start:WebixCallback, end:WebixCallback, error:WebixCallback):void; + blockEvent():void; + callEvent(name:string, params:any[]):boolean; + clearValidation():void; + define(property:string, value:any):void; + detachEvent(id:string):void; + escape(value:string):string; + getItemState(itemId:string):any; + getState():string|boolean; + hasEvent(name:string):boolean; + ignore(code:WebixCallback, master:any):void; + mapEvent(map:any):void; + off():void; + on():void; + processResult(data:any):void; + reset():void; + save(id:string, operation:string):void; + send():void; + setItemState(itemId:string, state:boolean):void; + unblockEvent():void; + validate():boolean; + config: { [key: string]: any; }; + name: string; +} +var DataProcessor:DataProcessor; + +interface DataRecord{ + attachEvent(type:string, functor:WebixCallback, id?:string):string; + bind(target:any, rule?:WebixCallback, format?:string):void; + blockEvent():void; + callEvent(name:string, params:any[]):boolean; + define(property:string, value:any):void; + detachEvent(id:string):void; + getValues():any; + hasEvent(name:string):boolean; + isVisible():boolean; + load(url:string, type?:string, callback?:WebixCallback):PromisedData; + mapEvent(map:any):void; + parse(data:any, type:string):void; + refresh(id?:string):void; + setValues(values:any, update?:boolean):void; + unbind():void; + unblockEvent():void; + config: { [key: string]: any; }; + name: string; +} +var DataRecord:DataRecord; + +interface DataState{ + getState():any; + setState(state:any):void; +} +var DataState:DataState; + +interface DataStore{ + add(obj:any, index?:number):string; + addMark(id:string, name:string, css?:boolean, value?:any):any; + attachEvent(type:string, functor:WebixCallback, id?:string):string; + blockEvent():void; + callEvent(name:string, params:any[]):boolean; + changeId(old:string, newid:string):void; + clearAll():void; + clearMark(name:string):void; + count():number; + destructor():void; + detachEvent(id:string):void; + each(method:WebixCallback, master?:any, all?:boolean):void; + exists(id:string):boolean; + filter(text:string|WebixTemplate|WebixCallback, value:string, preserve:boolean):void; + getFirstId():string; + getIdByIndex(index:number):string; + getIndexById(id:string):number; + getIndexRange(from:string, to:string):any[]; + getItem(id:string):any; + getLastId():string; + getMark(id:string, mark_name:string):any; + getNextId(id:string, step:number):string; + getPrevId(id:string, step:number):string; + getRange(from:string, to:string):any[]; + hasEvent(name:string):boolean; + id(item:any):string; + importData(source:webix.ui.baseview):void; + mapEvent(map:any):void; + move(sid:string, tindex:number, tobj?:any, details?:any):string; + provideApi(target:any, eventable:boolean):void; + refresh(id?:string):void; + remove(id:string):void; + removeMark(id:string, name:string, css:boolean):void; + scheme(config:any):void; + serialize():any; + setDriver(type:string):void; + silent(code:WebixCallback):void; + sort(by:string, dir?:string, as?:string):void; + sync(source:any, filter:WebixCallback, silent:boolean):void; + unblockEvent():void; + unsync():void; + updateItem(id:string, data:any):void; + driver: any; + name: string; + order: any[]; + pull: any; +} +var DataStore:DataStore; + +interface DataValue{ + attachEvent(type:string, functor:WebixCallback, id?:string):string; + bind(target:any, rule?:WebixCallback, format?:string):void; + blockEvent():void; + callEvent(name:string, params:any[]):boolean; + detachEvent(id:string):void; + getValue():string; + hasEvent(name:string):boolean; + isVisible():boolean; + mapEvent(map:any):void; + refresh():void; + setValue(value:string):void; + unbind():void; + unblockEvent():void; + name: string; +} +var DataValue:DataValue; + +interface Date{ + add(date:any, inc:number, mode:string):any; + copy(date:any):any; + datePart(date:any):any; + dateToStr(format:string, utc:boolean):WebixCallback; + dayStart(date:any):any; + equal(datea:any, dateb:any):boolean; + getISOWeek(date:any):number; + getUTCISOWeek(data:any):number; + isHoliday(date:any):boolean; + monthStart(date:any):any; + strToDate(format:string, utc:boolean):WebixCallback; + timePart(date:any):number; + toFixed(num:number):number; + weekStart(date:any):any; + yearStart(date:any):any; + startOnMonday: boolean; +} +var Date:Date; + +interface Destruction{ + destructor():void; +} +var Destruction:Destruction; + +interface DragControl{ + addDrag(node:string|HTMLElement, ctrl:any):void; + addDrop(node:string|HTMLElement, ctrl:any, master_mode:boolean):void; + createDrag(event:Event):void; + destroyDrag():void; + getContext():any; + getMaster(target:any):any; + getNode():HTMLElement; + sendSignal(signal:string):void; + $drag(s:any, e:Event):HTMLElement; + $dragIn(s:any, t:any, e:Event):void; + $dragOut(s:any, t:any, n:any, e:Event):void; + $dragPos: WebixCallback; + $drop(s:any, t:any, d:any, e:Event):void; + left: number; + top: number; +} +var DragControl:DragControl; + +interface DragItem{ + $drag(source:HTMLElement, ev:Event):string; + $dragHTML: WebixCallback; + $dragIn(source:HTMLElement, target:HTMLElement, ev:Event):HTMLElement; + $dragMark(context:any, ev:Event):boolean; + $dragOut(source:HTMLElement, old_target:HTMLElement, new_target:HTMLElement, ev:Event):void; + $drop(source:HTMLElement, target:HTMLElement, ev:any):void; + $dropAllow: WebixCallback; +} +var DragItem:DragItem; + +interface DragOrder{ + $drag(source:HTMLElement, ev:Event):string; + $dragIn(source:HTMLElement, target:HTMLElement, ev:Event):HTMLElement; + $dragPos: WebixCallback; + $drop(source:HTMLElement, target:HTMLElement, ev:any):void; +} +var DragOrder:DragOrder; + +interface EditAbility{ + edit(id:any):void; + editCancel():void; + editNext():boolean; + editStop():void; + focusEditor():void; + getEditState():any; + getEditor(id?:string):any; + getEditorValue():string; + validateEditor(id?:string):boolean; +} +var EditAbility:EditAbility; + +interface EventSystem{ + attachEvent(type:string, functor:WebixCallback, id?:string):string; + blockEvent():void; + callEvent(name:string, params:any[]):boolean; + detachEvent(id:string):void; + hasEvent(name:string):boolean; + mapEvent(map:any):void; + unblockEvent():void; +} +var EventSystem:EventSystem; + +interface Group{ + group(config:any, mode:boolean):void; + ungroup(mode:boolean):void; +} +var Group:Group; + +interface GroupMethods{ + any(property:string, data:any):void; + count(property:string, data:any):void; + max(property:string, data:any):void; + min(property:string, data:any):void; + string(property:string, data:any):void; + sum(property:string, data:any):void; +} +var GroupMethods:GroupMethods; + +interface GroupStore{ + group(stats:any):void; + ungroup():void; +} +var GroupStore:GroupStore; + +interface HtmlMap{ + addPoly(id:string, points:any[]):void; + addRect(id:string, points:any[], userdata?:string):void; + addSector(id:string, aplha0:number, aplha1:number, x:number, y:number, R:number, ky:number):void; + render(html:HTMLElement):void; +} +var HtmlMap:HtmlMap; + +interface IdSpace{ + innerId(id:string):string; + ui(view:any):webix.ui.baseview; + $$: any; +} +var IdSpace:IdSpace; + +interface KeysNavigation{ + moveSelection(direction:string):void; +} +var KeysNavigation:KeysNavigation; + +interface MapCollection{ + } +var MapCollection:MapCollection; + +interface Modality{ + } +var Modality:Modality; + +interface MouseEvents{ + on_click: WebixCallback; + on_context: { [key: string]: any; }; + on_dblclick: WebixCallback; + on_mouse_move: WebixCallback; +} +var MouseEvents:MouseEvents; + +interface Movable{ + } +var Movable:Movable; + +interface NavigationButtons{ + } +var NavigationButtons:NavigationButtons; + +interface Number{ + format(value:number, config:any):string; + numToStr(config:any):WebixCallback; +} +var Number:Number; + +interface OverlayBox{ + hideOverlay():void; + showOverlay():void; +} +var OverlayBox:OverlayBox; + +interface PagingAbility{ + getPage():number; + getPager():any; + setPage(page:number):void; +} +var PagingAbility:PagingAbility; + +interface PowerArray{ + each(functor:WebixCallback, master:any):void; + filter(functor:WebixCallback, master:any):any[]; + find(data:any):number; + insertAt(data:any, pos:number):void; + map(functor:WebixCallback, master:any):any[]; + remove(value:any):void; + removeAt(pos:number, len:number):void; +} +var PowerArray:PowerArray; + +interface ProgressBar{ + hideProgress():void; + showProgress(config?:any):void; +} +var ProgressBar:ProgressBar; + +interface RecordBind{ + } +var RecordBind:RecordBind; + +interface RenderStack{ + customize(obj:any):void; + getItemNode(id:string):void; + locate(e:Event):string; + render(id:string, data:any, type:string):void; + showItem(id:string):void; + type: { [key: string]: any; }; + types: { [key: string]: any; }; +} +var RenderStack:RenderStack; + +interface Scrollable{ + getScrollState():any; + scrollTo(x:number, y:number):void; +} +var Scrollable:Scrollable; + +interface SelectionModel{ + getSelectedId(as_array:boolean):string|any[]; + getSelectedItem(as_array?:boolean):any; + isSelected(id:string):boolean; + select(id:string|any[], preserve:boolean):void; + selectAll(from?:string, to?:string):void; + unselect(id?:string):void; + unselectAll():void; +} +var SelectionModel:SelectionModel; + +interface Settings{ + define(property:string, value:any):void; + config: { [key: string]: any; }; + name: string; +} +var Settings:Settings; + +interface SingleRender{ + customize(obj:any):void; + render(id:string, data:any, type:string):void; + sync(source:any, filter:WebixCallback, silent:boolean):void; + type: { [key: string]: any; }; +} +var SingleRender:SingleRender; + +interface TablePaste{ + } +var TablePaste:TablePaste; + +interface Touch{ + disable():void; + enable():void; + limit(mode:boolean):void; + scrollTo(node:HTMLElement, x:number, y:number, speed:string):void; + config: any; +} +var Touch:Touch; + +interface TreeAPI{ + close(id:string):void; + closeAll():void; + getOpenItems():any[]; + getState():any; + isBranchOpen(id:string):boolean; + open(id:string):void; + openAll():void; + setState(state:any):void; +} +var TreeAPI:TreeAPI; + +interface TreeClick{ + webix_tree_checkbox(obj:any, common:{ [key: string]: any; }):string; + webix_tree_close(obj:any, common:{ [key: string]: any; }):string; + webix_tree_open(obj:any, common:{ [key: string]: any; }):string; +} +var TreeClick:TreeClick; + +interface TreeCollection{ + add(obj:any, index?:number):string; + addBind(source:any, rule:string, format:string):void; + attachEvent(type:string, functor:WebixCallback, id?:string):string; + bind(target:any, rule?:WebixCallback, format?:string):void; + blockEvent():void; + callEvent(name:string, params:any[]):boolean; + clearAll():void; + clearValidation():void; + count():number; + define(property:string, value:any):void; + destructor():void; + detachEvent(id:string):void; + exists(id:string):boolean; + filter(text:string|WebixTemplate|WebixCallback, value:string, preserve:boolean):void; + getBindData(key:string, update:boolean):void; + getBranchIndex(id:string, parent?:string):number; + getCursor():number; + getFirstChildId(id:string):string; + getFirstId():string; + getIdByIndex(index:number):string; + getIndexById(id:string):number; + getItem(id:string):any; + getLastId():string; + getNextId(id:string, step:number):string; + getNextSiblingId(id:any):string; + getParentId(id:string):string; + getPrevId(id:string, step:number):string; + getPrevSiblingId(id:any):string; + hasEvent(name:string):boolean; + isBranch(id:string):boolean; + isVisible():boolean; + load(url:string, type?:string, callback?:WebixCallback):PromisedData; + loadBranch(id:string, callback:WebixCallback, url:string):void; + loadNext(count:number, start:number, callback:WebixCallback, url:string, now:boolean):void; + mapEvent(map:any):void; + parse(data:any, type:string):void; + refresh(id?:string):void; + refreshCursor():void; + remove(id:string):void; + removeBind(source:any):void; + saveBatch(func:WebixCallback):void; + serialize():any; + setBindData(data:any, key:string):void; + setCursor(cursor:string):void; + sort(by:string, dir?:string, as?:string):void; + sync(source:any, filter:WebixCallback, silent:boolean):void; + unbind():void; + unblockEvent():void; + updateItem(id:string, data:any):void; + validate(id?:string):boolean; + config: { [key: string]: any; }; + name: string; +} +var TreeCollection:TreeCollection; + +interface TreeDataLoader{ + loadBranch(id:string, callback:WebixCallback, url:string):void; +} +var TreeDataLoader:TreeDataLoader; + +interface TreeDataMove{ + copy(sid:string, tindex:number, tobj?:webix.ui.baseview, details?:any):string; + move(sid:string, tindex:number, tobj?:webix.ui.baseview, details?:any):string; + $dropAllow: WebixCallback; +} +var TreeDataMove:TreeDataMove; + +interface TreeRenderStack{ + getItemNode(id:string):void; + getItemNode(id:string):HTMLElement; +} +var TreeRenderStack:TreeRenderStack; + +interface TreeStateCheckbox{ + checkAll(id?:string):void; + checkItem(id:string):void; + getChecked():any[]; + isChecked(id:string):boolean; + uncheckAll(id?:string):void; + uncheckItem(id:string):void; +} +var TreeStateCheckbox:TreeStateCheckbox; + +interface TreeStore{ + add(obj:any, index:number, pid:string):string; + changeId(old:string, newid:string):void; + clearAll():void; + count():number; + each(code:WebixCallback, master:any, all:boolean, pid:string):void; + eachChild(pid:string, code:WebixCallback, master?:any, all?:boolean):void; + eachOpen(code:WebixCallback, master?:any, pid?:string):void; + eachSubItem(pid:string, code:WebixCallback):void; + getBranch(id:string):any[]; + getBranchIndex(id:string, parent?:string):number; + getFirstChildId(id:string):string; + getNextSiblingId(id:any):string; + getParentId(id:string):string; + getPrevSiblingId(id:any):string; + getTopRange():any[]; + isBranch(id:string):boolean; + provideApi(target:any, eventable:boolean):void; + remove(id:string):void; + serialize():any; + name: string; +} +var TreeStore:TreeStore; + +interface TreeTableClick{ + } +var TreeTableClick:TreeTableClick; + +interface TreeTablePaste{ + insert(data:any[]):void; +} +var TreeTablePaste:TreeTablePaste; + +interface TreeType{ + checkbox(obj:any, common:any):string; + folder(obj:any, common:any):string; + icon(obj:any, common:any):string; + space(obj:any, common:any):string; +} +var TreeType:TreeType; + +interface UIExtension{ + } +var UIExtension:UIExtension; + +interface UIManager{ + addHotKey(key:string, handler:WebixCallback, obj?:any):void; + canFocus(id:string):boolean; + destructor():void; + getFocus():webix.ui.baseview; + getNext(view:any):any; + getPrev(view:any):any; + getState(id:string, childs:boolean):any; + getTop(id:string):any; + hasFocus(id:string):boolean; + removeHotKey(key:string, handler?:WebixCallback, obj?:any):void; + setFocus(id:string):void; + setState(state:any):void; +} +var UIManager:UIManager; + +interface UploadDriver{ + flash: any; + html5: any; +} +var UploadDriver:UploadDriver; + +interface ValidateCollection{ + clearValidation():void; + validate(id?:string):boolean; +} +var ValidateCollection:ValidateCollection; + +interface ValidateData{ + clearValidation():void; + validate():boolean; +} +var ValidateData:ValidateData; + +interface ValueBind{ + } +var ValueBind:ValueBind; + +interface Values{ + clear():void; + focus(item:string):void; + getCleanValues():any; + getDirtyValues():any; + getValues(details?:any):any[]; + isDirty():boolean; + setDirty(mark?:boolean):void; + setValues(values:any, update?:boolean):void; +} +var Values:Values; + +interface VirtualRenderStack{ + getItemNode(id:string):void; + render(id:string, data:any, type:string):void; + showItem(id:string):void; +} +var VirtualRenderStack:VirtualRenderStack; + + +module ui { + + + +function delay(config:any):void; +function fullScreen():void; +function hasMethod(name:string, method_name:string):boolean; +function resize():void; +function zIndex():number; +var scrollSize: number; +var zIndexBase: number; + +interface baselayoutConfig{ + animate?: any; + borderless?: boolean; + cols?: any[]; + container?: HTMLElement; + css?: string; + disabled?: boolean; + gravity?: number; + height?: number; + hidden?: boolean; + id?: string; + maxHeight?: number; + maxWidth?: number; + minHeight?: number; + minWidth?: number; + on?: any; + responsive?: string; + rows?: any[]; + visibleBatch?: string; + width?: number; +} +interface baselayout extends webix.ui.baseview{ + addView(view:any, index?:number):webix.ui.baseview; + adjust():void; + attachEvent(type:string, functor:WebixCallback, id?:string):string; + bind(target:any, rule?:WebixCallback, format?:string):void; + blockEvent():void; + callEvent(name:string, params:any[]):boolean; + define(property:string, value:any):void; + destructor():void; + detachEvent(id:string):void; + disable():void; + enable():void; + getChildViews():any[]; + getFormView():webix.ui.baseview; + getNode():any; + getParentView():any; + getTopParentView():webix.ui.baseview; + hasEvent(name:string):boolean; + hide():void; + index(obj:any):number; + isEnabled():boolean; + isVisible():boolean; + mapEvent(map:any):void; + reconstruct():void; + removeView(id:string):void; + resize():void; + resizeChildren():void; + show(force?:boolean, animation?:boolean):void; + showBatch(name:string):void; + unbind():void; + unblockEvent():void; + $getSize():any[]; + $height: number; + $setSize(x:number, y:number):boolean; + $skin: any; + $view: HTMLElement; + $width: number; + config: baselayoutConfig; + name: string; +} +interface baseviewConfig{ + animate?: any; + borderless?: boolean; + container?: HTMLElement; + css?: string; + disabled?: boolean; + gravity?: number; + height?: number; + hidden?: boolean; + id?: string; + maxHeight?: number; + maxWidth?: number; + minHeight?: number; + minWidth?: number; + width?: number; +} +interface baseview{ + adjust():void; + bind(target:any, rule?:WebixCallback, format?:string):void; + define(property:string, value:any):void; + destructor():void; + disable():void; + enable():void; + getChildViews():any[]; + getFormView():webix.ui.baseview; + getNode():any; + getParentView():any; + getTopParentView():webix.ui.baseview; + hide():void; + isEnabled():boolean; + isVisible():boolean; + resize():void; + show(force?:boolean, animation?:boolean):void; + unbind():void; + $getSize():any[]; + $height: number; + $setSize(x:number, y:number):boolean; + $skin: any; + $view: HTMLElement; + $width: number; + config: baseviewConfig; + name: string; +} +interface protoConfig{ + animate?: any; + borderless?: boolean; + click?: string|WebixCallback; + container?: HTMLElement; + css?: string; + data?: string|any[]; + dataFeed?: string|WebixCallback; + datathrottle?: number; + datatype?: string; + disabled?: boolean; + gravity?: number; + height?: number; + hidden?: boolean; + id?: string; + maxHeight?: number; + maxWidth?: number; + minHeight?: number; + minWidth?: number; + on?: any; + pager?: any; + ready?: WebixCallback; + removeMissed?: boolean; + rules?: any; + save?: string; + scheme?: any; + template?: string|WebixCallback; + tooltip?: any; + type?: any; + url?: string; + width?: number; +} +interface proto extends webix.ui.baseview{ + add(obj:any, index?:number):string; + addCss(id:string|number, css:string, silent?:boolean):void; + adjust():void; + attachEvent(type:string, functor:WebixCallback, id?:string):string; + bind(target:any, rule?:WebixCallback, format?:string):void; + blockEvent():void; + callEvent(name:string, params:any[]):boolean; + clearAll():void; + clearCss(css:string, silent?:boolean):void; + clearValidation():void; + count():number; + customize(obj:any):void; + define(property:string, value:any):void; + destructor():void; + detachEvent(id:string):void; + disable():void; + enable():void; + exists(id:string):boolean; + filter(text:string|WebixTemplate|WebixCallback, value:string, preserve:boolean):void; + getChildViews():any[]; + getFirstId():string; + getFormView():webix.ui.baseview; + getIdByIndex(index:number):string; + getIndexById(id:string):number; + getItem(id:string):any; + getItemNode(id:string):void; + getLastId():string; + getNextId(id:string, step:number):string; + getNode():any; + getPage():number; + getPager():any; + getParentView():any; + getPrevId(id:string, step:number):string; + getTopParentView():webix.ui.baseview; + hasCss(id:string, css:string):boolean; + hasEvent(name:string):boolean; + hide():void; + isEnabled():boolean; + isVisible():boolean; + load(url:string, type?:string, callback?:WebixCallback):PromisedData; + loadNext(count:number, start:number, callback:WebixCallback, url:string, now:boolean):void; + locate(e:Event):string; + mapEvent(map:any):void; + parse(data:any, type:string):void; + refresh(id?:string):void; + remove(id:string):void; + removeCss(id:string|number, css:string, silent?:boolean):void; + render(id:string, data:any, type:string):void; + resize():void; + serialize():any; + setPage(page:number):void; + show(force?:boolean, animation?:boolean):void; + showItem(id:string):void; + sort(by:string, dir?:string, as?:string):void; + sync(source:any, filter:WebixCallback, silent:boolean):void; + unbind():void; + unblockEvent():void; + updateItem(id:string, data:any):void; + validate(id?:string):boolean; + $getSize():any[]; + $height: number; + $scope: any; + $setSize(x:number, y:number):boolean; + $skin: any; + $view: HTMLElement; + $width: number; + config: protoConfig; + name: string; + type: { [key: string]: any; }; + types: { [key: string]: any; }; +} +interface resizeareaConfig{ + border?: boolean; + container?: string|HTMLElement; + cursor?: string; + dir?: string; + eventPos?: number; + height?: number; + id?: string; + on?: any; + start?: number; + width?: number; +} +interface resizearea{ + attachEvent(type:string, functor:WebixCallback, id?:string):string; + blockEvent():void; + callEvent(name:string, params:any[]):boolean; + define(property:string, value:any):void; + detachEvent(id:string):void; + hasEvent(name:string):boolean; + mapEvent(map:any):void; + unblockEvent():void; + config: resizeareaConfig; + name: string; +} +interface viewConfig{ + animate?: any; + borderless?: boolean; + container?: HTMLElement; + css?: string; + disabled?: boolean; + gravity?: number; + height?: number; + hidden?: boolean; + id?: string; + maxHeight?: number; + maxWidth?: number; + minHeight?: number; + minWidth?: number; + width?: number; +} +interface view extends webix.ui.baseview{ + adjust():void; + bind(target:any, rule?:WebixCallback, format?:string):void; + define(property:string, value:any):void; + destructor():void; + disable():void; + enable():void; + getChildViews():any[]; + getFormView():webix.ui.baseview; + getNode():any; + getParentView():any; + getTopParentView():webix.ui.baseview; + hide():void; + isEnabled():boolean; + isVisible():boolean; + resize():void; + show(force?:boolean, animation?:boolean):void; + unbind():void; + $getSize():any[]; + $height: number; + $scope: any; + $setSize(x:number, y:number):boolean; + $skin: any; + $view: HTMLElement; + $width: number; + config: viewConfig; + name: string; +} +interface vscrollConfig{ + container?: HTMLElement; + id?: string; + on?: any; + scroll?: string; + scrollHeight?: number; + scrollPos?: number; + scrollSize?: number; + scrollStep?: number; + scrollVisible?: boolean; + scrollWidth?: number; + zoom?: number; +} +interface vscroll extends webix.ui.baseview{ + activeArea(node:HTMLElement):void; + attachEvent(type:string, functor:WebixCallback, id?:string):string; + blockEvent():void; + callEvent(name:string, params:any[]):boolean; + define(property:string, value:any):void; + detachEvent(id:string):void; + getScroll():number; + getSize():number; + hasEvent(name:string):boolean; + mapEvent(map:any):void; + scrollTo(pos:number):void; + sizeTo(size:number):void; + unblockEvent():void; + config: vscrollConfig; + name: string; +} +interface accordionConfig{ + animate?: any; + borderless?: boolean; + collapsed?: boolean; + cols?: any[]; + container?: HTMLElement; + css?: string; + disabled?: boolean; + gravity?: number; + height?: number; + hidden?: boolean; + id?: string; + isolate?: boolean; + margin?: number; + maxHeight?: number; + maxWidth?: number; + minHeight?: number; + minWidth?: number; + multi?: boolean|string; + on?: any; + padding?: number; + paddingX?: number; + paddingY?: number; + panelClass?: string; + responsive?: string; + rows?: any[]; + type?: string; + visibleBatch?: string; + width?: number; +} +interface accordion extends webix.ui.baseview{ + addView(view:any, index?:number):webix.ui.baseview; + adjust():void; + attachEvent(type:string, functor:WebixCallback, id?:string):string; + bind(target:any, rule?:WebixCallback, format?:string):void; + blockEvent():void; + callEvent(name:string, params:any[]):boolean; + define(property:string, value:any):void; + destructor():void; + detachEvent(id:string):void; + disable():void; + enable():void; + getChildViews():any[]; + getFormView():webix.ui.baseview; + getNode():any; + getParentView():any; + getTopParentView():webix.ui.baseview; + hasEvent(name:string):boolean; + hide():void; + index(obj:any):number; + isEnabled():boolean; + isVisible():boolean; + mapEvent(map:any):void; + reconstruct():void; + removeView(id:string):void; + resize():void; + resizeChildren():void; + show(force?:boolean, animation?:boolean):void; + showBatch(name:string):void; + unbind():void; + unblockEvent():void; + $getSize():any[]; + $height: number; + $setSize(x:number, y:number):boolean; + $skin: any; + $view: HTMLElement; + $width: number; + config: accordionConfig; + name: string; +} +interface accordionitemConfig{ + animate?: any; + body?: string|webix.ui.baseview; + borderless?: boolean; + collapsed?: boolean; + container?: HTMLElement; + css?: string; + disabled?: boolean; + gravity?: number; + header?: boolean|string|WebixCallback; + headerAlt?: string|WebixCallback; + headerAltHeight?: number; + headerHeight?: number; + height?: number; + hidden?: boolean; + id?: string; + maxHeight?: number; + maxWidth?: number; + minHeight?: number; + minWidth?: number; + mouseEventDelay?: number; + on?: any; + onClick?: { [key: string]: any; }; + onContext?: { [key: string]: any; }; + onDblClick?: WebixCallback; + onMouseMove?: WebixCallback; + width?: number; +} +interface accordionitem extends webix.ui.baseview{ + adjust():void; + attachEvent(type:string, functor:WebixCallback, id?:string):string; + bind(target:any, rule?:WebixCallback, format?:string):void; + blockEvent():void; + callEvent(name:string, params:any[]):boolean; + collapse():void; + define(property:string, value:any):void; + destructor():void; + detachEvent(id:string):void; + disable():void; + enable():void; + expand():void; + getChildViews():any[]; + getFormView():webix.ui.baseview; + getNode():any; + getParentView():any; + getTopParentView():webix.ui.baseview; + hasEvent(name:string):boolean; + hide():void; + isEnabled():boolean; + isVisible():boolean; + mapEvent(map:any):void; + refresh():void; + resize():void; + show(force?:boolean, animation?:boolean):void; + unbind():void; + unblockEvent():void; + $getSize():any[]; + $height: number; + $scope: any; + $setSize(x:number, y:number):boolean; + $skin: any; + $view: HTMLElement; + $width: number; + config: accordionitemConfig; + name: string; + on_click: WebixCallback; + on_context: { [key: string]: any; }; + on_dblclick: WebixCallback; + on_mouse_move: WebixCallback; +} +interface barcodeConfig{ + animate?: any; + borderless?: boolean; + color?: string; + container?: HTMLElement; + css?: string; + disabled?: boolean; + gravity?: number; + height?: number; + hidden?: boolean; + id?: string; + maxHeight?: number; + maxWidth?: number; + minHeight?: number; + minWidth?: number; + paddingX?: number; + paddingY?: number; + textHeight?: number; + type?: any; + value?: string; + width?: number; +} +interface barcode extends webix.ui.baseview{ + adjust():void; + bind(target:any, rule?:WebixCallback, format?:string):void; + define(property:string, value:any):void; + destructor():void; + disable():void; + enable():void; + getChildViews():any[]; + getFormView():webix.ui.baseview; + getNode():any; + getParentView():any; + getTopParentView():webix.ui.baseview; + getValue():string; + hide():void; + isEnabled():boolean; + isVisible():boolean; + render():void; + resize():void; + setValue(value:string):void; + show(force?:boolean, animation?:boolean):void; + unbind():void; + $getSize():any[]; + $height: number; + $scope: any; + $setSize(x:number, y:number):boolean; + $skin: any; + $view: HTMLElement; + $width: number; + config: barcodeConfig; + name: string; + types: any[]; +} +interface buttonConfig{ + align?: string; + animate?: any; + borderless?: boolean; + click?: WebixCallback; + container?: HTMLElement; + content?: string|HTMLElement; + css?: string; + disabled?: boolean; + gravity?: number; + height?: number; + hidden?: boolean; + hotkey?: string; + id?: string; + inputHeight?: number; + inputWidth?: number; + label?: string; + labelPosition?: string; + maxHeight?: number; + maxWidth?: number; + minHeight?: number; + minWidth?: number; + name?: string; + on?: any; + placeholder?: any; + popup?: any; + tabFocus?: boolean; + template?: string|WebixCallback; + tooltip?: string; + type?: string; + value?: string; + width?: number; +} +interface button extends webix.ui.baseview{ + adjust():void; + attachEvent(type:string, functor:WebixCallback, id?:string):string; + bind(target:any, rule?:WebixCallback, format?:string):void; + blockEvent():void; + blur():void; + callEvent(name:string, params:any[]):boolean; + define(property:string, value:any):void; + destructor():void; + detachEvent(id:string):void; + disable():void; + enable():void; + focus():void; + getChildViews():any[]; + getFormView():webix.ui.baseview; + getInputNode():HTMLElement; + getNode():any; + getParentView():any; + getTopParentView():webix.ui.baseview; + getValue():string; + hasEvent(name:string):boolean; + hide():void; + isEnabled():boolean; + isVisible():boolean; + mapEvent(map:any):void; + refresh():void; + render(id:string, data:any, type:string):void; + resize():void; + setValue(value:string):void; + show(force?:boolean, animation?:boolean):void; + sync(source:any, filter:WebixCallback, silent:boolean):void; + unbind():void; + unblockEvent():void; + $getSize():any[]; + $getValue():string; + $height: number; + $scope: any; + $setSize(x:number, y:number):boolean; + $setValue(value:string):void; + $skin: any; + $view: HTMLElement; + $width: number; + config: buttonConfig; + name: string; + on_click: WebixCallback; + touchable: any; +} +interface calendarConfig{ + animate?: any; + blockDates?: WebixCallback; + borderless?: boolean; + calendarHeader?: string; + calendarTime?: string; + calendarWeekHeader?: string; + cellHeight?: number; + container?: HTMLElement; + css?: string; + date?: any; + dayTemplate?: WebixCallback; + disabled?: boolean; + events?: WebixCallback; + gravity?: number; + headerHeight?: number; + height?: number; + hidden?: boolean; + icons?: any; + id?: string; + maxDate?: Date|string; + maxHeight?: number; + maxWidth?: number; + minDate?: Date|string; + minHeight?: number; + minWidth?: number; + minuteStep?: number; + monthSelect?: boolean; + mouseEventDelay?: number; + navigation?: boolean; + on?: any; + onClick?: { [key: string]: any; }; + onContext?: { [key: string]: any; }; + onDblClick?: WebixCallback; + onMouseMove?: WebixCallback; + select?: boolean; + skipEmptyWeeks?: boolean; + timepicker?: boolean; + timepickerHeight?: number; + type?: string; + weekHeader?: boolean; + weekNumber?: boolean; + width?: number; +} +interface calendar extends webix.ui.baseview{ + adjust():void; + attachEvent(type:string, functor:WebixCallback, id?:string):string; + bind(target:any, rule?:WebixCallback, format?:string):void; + blockEvent():void; + callEvent(name:string, params:any[]):boolean; + define(property:string, value:any):void; + destructor():void; + detachEvent(id:string):void; + disable():void; + enable():void; + getChildViews():any[]; + getFormView():webix.ui.baseview; + getNode():any; + getParentView():any; + getSelectedDate():any; + getTopParentView():webix.ui.baseview; + getValue():any; + getVisibleDate():any; + hasEvent(name:string):boolean; + hide():void; + isEnabled():boolean; + isVisible():boolean; + locate(e:Event):string; + mapEvent(map:any):void; + refresh():void; + render(id:string, data:any, type:string):void; + resize():void; + selectDate(date:any):void; + setValue(date:any):void; + show(force?:boolean, animation?:boolean):void; + showCalendar(date:any):void; + unbind():void; + unblockEvent():void; + $getSize():any[]; + $height: number; + $scope: any; + $setSize(x:number, y:number):boolean; + $skin: any; + $view: HTMLElement; + $width: number; + config: calendarConfig; + name: string; + on_click: WebixCallback; + on_context: { [key: string]: any; }; + on_dblclick: WebixCallback; + on_mouse_move: WebixCallback; +} +interface chartConfig{ + alpha?: number; + animate?: any; + barWidth?: number; + border?: boolean; + borderColor?: string; + borderless?: boolean; + cant?: number; + color?: string|WebixCallback; + container?: HTMLElement; + css?: string; + data?: string|any[]; + dataFeed?: string|WebixCallback; + datathrottle?: number; + datatype?: string; + disableLines?: boolean; + disabled?: boolean; + eventRadius?: number; + fill?: string; + fixOverflow?: boolean; + gradient?: boolean|string|WebixCallback; + gravity?: number; + height?: number; + hidden?: boolean; + id?: string; + item?: any; + label?: string|WebixCallback; + labelOffset?: number; + legend?: any; + line?: any; + lineColor?: string; + maxHeight?: number; + maxWidth?: number; + minHeight?: number; + minWidth?: number; + mouseEventDelay?: number; + offset?: boolean; + on?: any; + onClick?: { [key: string]: any; }; + onContext?: { [key: string]: any; }; + onDblClick?: WebixCallback; + onMouseMove?: WebixCallback; + origin?: number; + padding?: any; + pieHeight?: number; + pieInnerText?: string|WebixCallback; + preset?: string; + radius?: number; + ready?: WebixCallback; + removeMissed?: boolean; + save?: string; + scale?: string; + scheme?: any; + series?: any[]; + shadow?: boolean; + tooltip?: any; + type?: string; + url?: string; + value?: string|WebixTemplate; + width?: number; + x?: number; + xAxis?: any; + xValue?: string; + y?: number; + yAxis?: any; + yValue?: string; +} +interface chart extends webix.ui.baseview{ + add(obj:any, index?:number):string; + addSeries(obj:any):void; + adjust():void; + attachEvent(type:string, functor:WebixCallback, id?:string):string; + bind(target:any, rule?:WebixCallback, format?:string):void; + blockEvent():void; + callEvent(name:string, params:any[]):boolean; + clearAll():void; + clearCanvas():void; + count():number; + define(property:string, value:any):void; + destructor():void; + detachEvent(id:string):void; + disable():void; + enable():void; + exists(id:string):boolean; + filter(text:string|WebixTemplate|WebixCallback, value:string, preserve:boolean):void; + getChildViews():any[]; + getFirstId():string; + getFormView():webix.ui.baseview; + getIdByIndex(index:number):string; + getIndexById(id:string):number; + getItem(id:string):any; + getLastId():string; + getNextId(id:string, step:number):string; + getNode():any; + getParentView():any; + getPrevId(id:string, step:number):string; + getTopParentView():webix.ui.baseview; + group(config:any, mode:boolean):void; + hasEvent(name:string):boolean; + hide():void; + hideSeries(series:string):void; + isEnabled():boolean; + isVisible():boolean; + load(url:string, type?:string, callback?:WebixCallback):PromisedData; + loadNext(count:number, start:number, callback:WebixCallback, url:string, now:boolean):void; + locate(e:Event):string; + mapEvent(map:any):void; + parse(data:any, type:string):void; + refresh(id?:string):void; + remove(id:string):void; + removeAllSeries():void; + render(id:string, data:any, type:string):void; + resize():void; + serialize():any; + show(force?:boolean, animation?:boolean):void; + showSeries(series:string):void; + sort(by:string, dir?:string, as?:string):void; + sync(source:any, filter:WebixCallback, silent:boolean):void; + unbind():void; + unblockEvent():void; + ungroup(mode:boolean):void; + updateItem(id:string, data:any):void; + $getSize():any[]; + $height: number; + $scope: any; + $setSize(x:number, y:number):boolean; + $skin: any; + $view: HTMLElement; + $width: number; + colormap: { [key: string]: any; }; + config: chartConfig; + name: string; + on_click: WebixCallback; + on_context: { [key: string]: any; }; + on_dblclick: WebixCallback; + on_mouse_move: WebixCallback; + presets: { [key: string]: any; }; +} +interface checkboxConfig{ + align?: string; + animate?: any; + attributes?: { [key: string]: any; }; + borderless?: boolean; + checkValue?: string; + click?: WebixCallback; + container?: HTMLElement; + content?: string|HTMLElement; + css?: string; + customCheckbox?: boolean; + disabled?: boolean; + gravity?: number; + height?: number; + hidden?: boolean; + hotkey?: string; + id?: string; + inputHeight?: number; + inputPadding?: number; + inputWidth?: number; + label?: string; + labelPosition?: string; + labelWidth?: number; + maxHeight?: number; + maxWidth?: number; + minHeight?: number; + minWidth?: number; + name?: string; + on?: any; + placeholder?: string; + popup?: any; + readonly?: boolean; + relatedAction?: string; + relatedView?: string; + required?: boolean; + suggest?: string|webix.ui.baseview; + tabFocus?: boolean; + template?: string|WebixCallback; + tooltip?: string; + type?: string; + uncheckValue?: string; + validate?: boolean; + validateEvent?: string; + value?: string; + width?: number; +} +interface checkbox extends webix.ui.baseview{ + adjust():void; + attachEvent(type:string, functor:WebixCallback, id?:string):string; + bind(target:any, rule?:WebixCallback, format?:string):void; + blockEvent():void; + blur():void; + callEvent(name:string, params:any[]):boolean; + define(property:string, value:any):void; + destructor():void; + detachEvent(id:string):void; + disable():void; + enable():void; + focus():void; + getChildViews():any[]; + getFormView():webix.ui.baseview; + getInputNode():HTMLElement; + getNode():any; + getParentView():any; + getTopParentView():webix.ui.baseview; + getValue():string; + hasEvent(name:string):boolean; + hide():void; + isEnabled():boolean; + isVisible():boolean; + mapEvent(map:any):void; + refresh():void; + render(id:string, data:any, type:string):void; + resize():void; + setValue(value:string):void; + show(force?:boolean, animation?:boolean):void; + sync(source:any, filter:WebixCallback, silent:boolean):void; + toggle():void; + unbind():void; + unblockEvent():void; + validate():boolean; + $getSize():any[]; + $getValue():string; + $height: number; + $render: WebixCallback; + $renderIcon: WebixCallback; + $renderInput(obj:any, html:string, id:string):string; + $renderLabel(config:any, id:string):string; + $scope: any; + $setSize(x:number, y:number):boolean; + $setValue(value:string):void; + $skin: any; + $view: HTMLElement; + $width: number; + config: checkboxConfig; + name: string; + on_click: WebixCallback; + touchable: any; +} +interface carouselConfig{ + animate?: any; + borderless?: boolean; + cols?: any[]; + container?: HTMLElement; + css?: string; + disabled?: boolean; + gravity?: number; + height?: number; + hidden?: boolean; + id?: string; + maxHeight?: number; + maxWidth?: number; + minHeight?: number; + minWidth?: number; + navigation?: any; + on?: any; + rows?: any[]; + scrollSpeed?: string; + type?: string; + width?: number; +} +interface carousel extends webix.ui.baseview{ + adjust():void; + adjustScroll(matrix:any):void; + attachEvent(type:string, functor:WebixCallback, id?:string):string; + bind(target:any, rule?:WebixCallback, format?:string):void; + blockEvent():void; + callEvent(name:string, params:any[]):boolean; + define(property:string, value:any):void; + destructor():void; + detachEvent(id:string):void; + disable():void; + enable():void; + getActiveId():string; + getActiveIndex():number; + getChildViews():any[]; + getFormView():webix.ui.baseview; + getLayout():any; + getNode():any; + getParentView():any; + getTopParentView():webix.ui.baseview; + hasEvent(name:string):boolean; + hide():void; + isEnabled():boolean; + isVisible():boolean; + mapEvent(map:any):void; + resize():void; + scrollTo(x:number, y:number):void; + setActive(id:string):void; + setActiveIndex(index:number):void; + show(force?:boolean, animation?:boolean):void; + showNext():void; + showPrev():void; + unbind():void; + unblockEvent():void; + $getSize():any[]; + $height: number; + $scope: any; + $setSize(x:number, y:number):boolean; + $skin: any; + $view: HTMLElement; + $width: number; + config: carouselConfig; + name: string; +} +interface colorboardConfig{ + animate?: any; + borderless?: boolean; + cols?: number; + container?: HTMLElement; + css?: string; + disabled?: boolean; + gravity?: number; + height?: number; + hidden?: boolean; + id?: string; + maxHeight?: number; + maxLightness?: number; + maxWidth?: number; + minHeight?: number; + minLightness?: number; + minWidth?: number; + on?: any; + palette?: any[]; + rows?: number; + template?: WebixCallback; + value?: string; + width?: number; +} +interface colorboard extends webix.ui.baseview{ + adjust():void; + attachEvent(type:string, functor:WebixCallback, id?:string):string; + bind(target:any, rule?:WebixCallback, format?:string):void; + blockEvent():void; + callEvent(name:string, params:any[]):boolean; + define(property:string, value:any):void; + destructor():void; + detachEvent(id:string):void; + disable():void; + enable():void; + getChildViews():any[]; + getFormView():webix.ui.baseview; + getNode():any; + getParentView():any; + getTopParentView():webix.ui.baseview; + getValue():string; + hasEvent(name:string):boolean; + hide():void; + isEnabled():boolean; + isVisible():boolean; + mapEvent(map:any):void; + refresh():void; + render(id:string, data:any, type:string):void; + resize():void; + setValue(value:string):string; + show(force?:boolean, animation?:boolean):void; + unbind():void; + unblockEvent():void; + $getSize():any[]; + $height: number; + $scope: any; + $setSize(x:number, y:number):boolean; + $skin: any; + $view: HTMLElement; + $width: number; + config: colorboardConfig; + name: string; +} +interface colorpickerConfig{ + align?: string; + animate?: any; + attributes?: { [key: string]: any; }; + borderless?: boolean; + click?: WebixCallback; + container?: HTMLElement; + content?: string|HTMLElement; + css?: string; + disabled?: boolean; + editable?: boolean; + format?: string; + gravity?: number; + height?: number; + hidden?: boolean; + hotkey?: string; + icon?: string; + icons?: any; + id?: string; + inputHeight?: number; + inputPadding?: number; + inputWidth?: number; + label?: string; + labelPosition?: string; + labelWidth?: number; + maxHeight?: number; + maxWidth?: number; + minHeight?: number; + minWidth?: number; + name?: string; + on?: any; + placeholder?: string; + popup?: any; + readonly?: boolean; + relatedAction?: string; + relatedView?: string; + required?: boolean; + stringResult?: any; + suggest?: string|webix.ui.baseview; + tabFocus?: boolean; + template?: string|WebixCallback; + timeIcon?: string; + timepicker?: boolean; + tooltip?: string; + type?: string; + validate?: boolean; + validateEvent?: string; + value?: string; + width?: number; +} +interface colorpicker extends webix.ui.baseview{ + adjust():void; + attachEvent(type:string, functor:WebixCallback, id?:string):string; + bind(target:any, rule?:WebixCallback, format?:string):void; + blockEvent():void; + blur():void; + callEvent(name:string, params:any[]):boolean; + define(property:string, value:any):void; + destructor():void; + detachEvent(id:string):void; + disable():void; + enable():void; + focus():void; + getChildViews():any[]; + getFormView():webix.ui.baseview; + getInputNode():HTMLElement; + getNode():any; + getParentView():any; + getPopup():webix.ui.baseview; + getText():void; + getTopParentView():webix.ui.baseview; + getValue():string; + hasEvent(name:string):boolean; + hide():void; + isEnabled():boolean; + isVisible():boolean; + mapEvent(map:any):void; + refresh():void; + render(id:string, data:any, type:string):void; + resize():void; + setValue(value:string):void; + show(force?:boolean, animation?:boolean):void; + sync(source:any, filter:WebixCallback, silent:boolean):void; + unbind():void; + unblockEvent():void; + validate():boolean; + $getSize():any[]; + $getValue():string; + $height: number; + $render: WebixCallback; + $renderIcon: WebixCallback; + $renderInput(obj:any, html:string, id:string):string; + $renderLabel(config:any, id:string):string; + $scope: any; + $setSize(x:number, y:number):boolean; + $setValue(value:string):void; + $skin: any; + $view: HTMLElement; + $width: number; + config: colorpickerConfig; + name: string; + on_click: WebixCallback; + touchable: any; +} +interface comboConfig{ + align?: string; + animate?: any; + attributes?: { [key: string]: any; }; + borderless?: boolean; + click?: WebixCallback; + container?: HTMLElement; + content?: string|HTMLElement; + css?: string; + disabled?: boolean; + gravity?: number; + height?: number; + hidden?: boolean; + hotkey?: string; + icon?: string; + id?: string; + inputHeight?: number; + inputPadding?: number; + inputWidth?: number; + label?: string; + labelPosition?: string; + labelWidth?: number; + maxHeight?: number; + maxWidth?: number; + minHeight?: number; + minWidth?: number; + name?: string; + on?: any; + options?: any; + placeholder?: string; + popup?: any; + popupWidth?: number; + readonly?: boolean; + relatedAction?: string; + relatedView?: string; + required?: boolean; + suggest?: string|webix.ui.baseview; + tabFocus?: boolean; + template?: string|WebixCallback; + text?: string; + tooltip?: string; + type?: string; + validate?: boolean; + validateEvent?: string; + value?: string; + width?: number; +} +interface combo extends webix.ui.baseview{ + adjust():void; + attachEvent(type:string, functor:WebixCallback, id?:string):string; + bind(target:any, rule?:WebixCallback, format?:string):void; + blockEvent():void; + blur():void; + callEvent(name:string, params:any[]):boolean; + define(property:string, value:any):void; + destructor():void; + detachEvent(id:string):void; + disable():void; + enable():void; + focus():void; + getChildViews():any[]; + getFormView():webix.ui.baseview; + getInputNode():HTMLElement; + getNode():any; + getParentView():any; + getPopup():webix.ui.baseview; + getText():string; + getTopParentView():webix.ui.baseview; + getValue():string; + hasEvent(name:string):boolean; + hide():void; + isEnabled():boolean; + isVisible():boolean; + mapEvent(map:any):void; + refresh():void; + render(id:string, data:any, type:string):void; + resize():void; + setValue(value:string):void; + show(force?:boolean, animation?:boolean):void; + sync(source:any, filter:WebixCallback, silent:boolean):void; + unbind():void; + unblockEvent():void; + validate():boolean; + $getSize():any[]; + $getValue():string; + $height: number; + $render: WebixCallback; + $renderIcon: WebixCallback; + $renderInput(obj:any, html:string, id:string):string; + $renderLabel(config:any, id:string):string; + $scope: any; + $setSize(x:number, y:number):boolean; + $setValue(value:string):void; + $skin: any; + $view: HTMLElement; + $width: number; + config: comboConfig; + name: string; + on_click: WebixCallback; + touchable: any; +} +interface contextConfig{ + animate?: any; + autofit?: boolean; + autofocus?: boolean; + body?: string|webix.ui.baseview; + borderless?: boolean; + container?: HTMLElement; + css?: string; + disabled?: boolean; + gravity?: number; + head?: any; + headHeight?: number; + height?: number; + hidden?: boolean; + id?: string; + left?: number; + master?: string; + maxHeight?: number; + maxWidth?: number; + minHeight?: number; + minWidth?: number; + modal?: boolean; + move?: boolean; + on?: any; + padding?: any; + position?: string|WebixCallback; + relative?: string; + top?: number; + width?: number; + zIndex?: number; +} +interface context extends webix.ui.baseview{ + adjust():void; + attachEvent(type:string, functor:WebixCallback, id?:string):string; + attachTo(view:any):void; + bind(target:any, rule?:WebixCallback, format?:string):void; + blockEvent():void; + callEvent(name:string, params:any[]):boolean; + close():void; + define(property:string, value:any):void; + destructor():void; + detachEvent(id:string):void; + disable():void; + enable():void; + getBody():any; + getChildViews():any[]; + getContext():any; + getFormView():webix.ui.baseview; + getHead():any; + getNode():any; + getParentView():any; + getTopParentView():webix.ui.baseview; + hasEvent(name:string):boolean; + hide():void; + isEnabled():boolean; + isVisible():boolean; + mapEvent(map:any):void; + resize():void; + resizeChildren():void; + setPosition(x:number, y:number):void; + show(force?:boolean, animation?:boolean):void; + unbind():void; + unblockEvent():void; + $getSize():any[]; + $height: number; + $scope: any; + $setSize(x:number, y:number):boolean; + $skin: any; + $view: HTMLElement; + $width: number; + config: contextConfig; + name: string; +} +interface contextmenuConfig{ + animate?: any; + autofit?: boolean; + autofocus?: boolean; + autoheight?: boolean; + autowidth?: boolean; + body?: string|webix.ui.baseview; + borderless?: boolean; + click?: string|WebixCallback; + clipboard?: boolean|string; + container?: HTMLElement; + css?: string; + data?: string|any[]; + dataFeed?: string|WebixCallback; + datathrottle?: number; + datatype?: string; + disabled?: boolean; + drag?: boolean|string; + dragscroll?: boolean|string; + externalData?: WebixCallback; + gravity?: number; + head?: any; + headHeight?: number; + height?: number; + hidden?: boolean; + id?: string; + layout?: string; + left?: number; + master?: string; + maxHeight?: number; + maxWidth?: number; + minHeight?: number; + minWidth?: number; + modal?: boolean; + mouseEventDelay?: number; + move?: boolean; + navigation?: boolean; + on?: any; + onClick?: { [key: string]: any; }; + onContext?: { [key: string]: any; }; + onDblClick?: WebixCallback; + onMouseMove?: WebixCallback; + padding?: any; + pager?: any; + position?: string|WebixCallback; + ready?: WebixCallback; + relative?: string; + removeMissed?: boolean; + rules?: any; + save?: string; + scheme?: any; + scroll?: boolean|string; + scrollSpeed?: string; + select?: boolean|string; + subMenuPos?: string; + submenu?: any; + template?: string|WebixCallback; + templateCopy?: WebixCallback; + tooltip?: any; + top?: number; + type?: any; + url?: string; + width?: number; + xCount?: number; + yCount?: number; + zIndex?: number; +} +interface contextmenu extends webix.ui.baseview{ + add(obj:any, index?:number):string; + addCss(id:string|number, css:string, silent?:boolean):void; + adjust():void; + attachEvent(type:string, functor:WebixCallback, id?:string):string; + attachTo(view:any):void; + bind(target:any, rule?:WebixCallback, format?:string):void; + blockEvent():void; + callEvent(name:string, params:any[]):boolean; + clearAll():void; + clearCss(css:string, silent?:boolean):void; + clearValidation():void; + close():void; + copy(sid:string, tindex:number, tobj?:any, details?:any):void; + count():number; + customize(obj:any):void; + define(property:string, value:any):void; + destructor():void; + detachEvent(id:string):void; + disable():void; + disableItem(id:string):void; + enable():void; + enableItem(id:string):void; + exists(id:string):boolean; + filter(text:string|WebixTemplate|WebixCallback, value:string, preserve:boolean):void; + getBody():any; + getChildViews():any[]; + getContext():any; + getFirstId():string; + getFormView():webix.ui.baseview; + getHead():any; + getIdByIndex(index:number):string; + getIndexById(id:string):number; + getItem(id:string):any; + getItemNode(id:string):void; + getLastId():string; + getMenu(id:string|number):any; + getMenuItem(id:string):any; + getNextId(id:string, step:number):string; + getNode():any; + getPage():number; + getPager():any; + getParentView():any; + getPrevId(id:string, step:number):string; + getScrollState():any; + getSelectedId(as_array:boolean):string|any[]; + getSelectedItem(as_array?:boolean):any; + getSubMenu(id:string|number):any; + getTopMenu():any; + getTopParentView():webix.ui.baseview; + getVisibleCount():number; + hasCss(id:string, css:string):boolean; + hasEvent(name:string):boolean; + hide():void; + hideItem(id:string):void; + isEnabled():boolean; + isSelected(id:string):boolean; + isVisible():boolean; + load(url:string, type?:string, callback?:WebixCallback):PromisedData; + loadNext(count:number, start:number, callback:WebixCallback, url:string, now:boolean):void; + locate(e:Event):string; + mapEvent(map:any):void; + move(sid:string, tindex:number, tobj?:any, details?:any):string; + moveBottom(id:string):void; + moveDown(id:string, step:number):void; + moveSelection(direction:string):void; + moveTop(id:string):void; + moveUp(id:string, step:number):void; + parse(data:any, type:string):void; + refresh(id?:string):void; + remove(id:string):void; + removeCss(id:string|number, css:string, silent?:boolean):void; + render(id:string, data:any, type:string):void; + resize():void; + resizeChildren():void; + scrollTo(x:number, y:number):void; + select(id:string|any[], preserve:boolean):void; + selectAll(from?:string, to?:string):void; + serialize():any; + setPage(page:number):void; + setPosition(x:number, y:number):void; + show(force?:boolean, animation?:boolean):void; + showItem(id:string):void; + sort(by:string, dir?:string, as?:string):void; + sync(source:any, filter:WebixCallback, silent:boolean):void; + unbind():void; + unblockEvent():void; + unselect(id?:string):void; + unselectAll():void; + updateItem(id:string, data:any):void; + validate(id?:string):boolean; + $drag(source:HTMLElement, ev:Event):string; + $dragHTML: WebixCallback; + $dragIn(source:HTMLElement, target:HTMLElement, ev:Event):HTMLElement; + $dragMark(context:any, ev:Event):boolean; + $dragOut(source:HTMLElement, old_target:HTMLElement, new_target:HTMLElement, ev:Event):void; + $drop(source:HTMLElement, target:HTMLElement, ev:any):void; + $dropAllow: WebixCallback; + $getSize():any[]; + $height: number; + $scope: any; + $setSize(x:number, y:number):boolean; + $skin: any; + $view: HTMLElement; + $width: number; + config: contextmenuConfig; + name: string; + on_click: WebixCallback; + on_context: { [key: string]: any; }; + on_dblclick: WebixCallback; + on_mouse_move: WebixCallback; + type: { [key: string]: any; }; + types: { [key: string]: any; }; +} +interface counterConfig{ + align?: string; + animate?: any; + attributes?: { [key: string]: any; }; + borderless?: boolean; + click?: WebixCallback; + container?: HTMLElement; + content?: string|HTMLElement; + css?: string; + disabled?: boolean; + gravity?: number; + height?: number; + hidden?: boolean; + hotkey?: string; + id?: string; + inputHeight?: number; + inputPadding?: number; + inputWidth?: number; + label?: string; + labelPosition?: string; + labelWidth?: number; + max?: number; + maxHeight?: number; + maxWidth?: number; + min?: number; + minHeight?: number; + minWidth?: number; + name?: string; + on?: any; + placeholder?: string; + popup?: any; + readonly?: boolean; + relatedAction?: string; + relatedView?: string; + required?: boolean; + step?: number; + suggest?: string|webix.ui.baseview; + tabFocus?: boolean; + template?: string|WebixCallback; + tooltip?: string; + type?: string; + validate?: boolean; + validateEvent?: string; + value?: string; + width?: number; +} +interface counter extends webix.ui.baseview{ + adjust():void; + attachEvent(type:string, functor:WebixCallback, id?:string):string; + bind(target:any, rule?:WebixCallback, format?:string):void; + blockEvent():void; + blur():void; + callEvent(name:string, params:any[]):boolean; + define(property:string, value:any):void; + destructor():void; + detachEvent(id:string):void; + disable():void; + enable():void; + focus():void; + getChildViews():any[]; + getFormView():webix.ui.baseview; + getInputNode():HTMLElement; + getNode():any; + getParentView():any; + getTopParentView():webix.ui.baseview; + getValue():number; + hasEvent(name:string):boolean; + hide():void; + isEnabled():boolean; + isVisible():boolean; + mapEvent(map:any):void; + next(step?:number):void; + prev(step?:number):void; + refresh():void; + render(id:string, data:any, type:string):void; + resize():void; + setValue(value:number):void; + shift(value?:number):void; + show(force?:boolean, animation?:boolean):void; + sync(source:any, filter:WebixCallback, silent:boolean):void; + unbind():void; + unblockEvent():void; + validate():boolean; + $getSize():any[]; + $getValue():string; + $height: number; + $render: WebixCallback; + $renderIcon: WebixCallback; + $renderInput(obj:any, html:string, id:string):string; + $renderLabel(config:any, id:string):string; + $scope: any; + $setSize(x:number, y:number):boolean; + $setValue(value:string):void; + $skin: any; + $view: HTMLElement; + $width: number; + config: counterConfig; + name: string; + on_click: WebixCallback; + touchable: any; +} +interface datatableConfig{ + animate?: any; + autoConfig?: boolean; + autoheight?: boolean; + autowidth?: boolean; + blockselect?: boolean; + borderless?: boolean; + checkboxRefresh?: boolean; + clipboard?: boolean|string; + columnWidth?: number; + columns?: any[]; + container?: HTMLElement; + css?: string; + data?: string|any[]; + dataFeed?: string|WebixCallback; + datafetch?: number; + datathrottle?: number; + datatype?: string; + delimiter?: any; + disabled?: boolean; + drag?: boolean|string; + dragColumn?: boolean|string; + dragscroll?: boolean|string; + editMath?: boolean; + editValue?: string; + editable?: boolean; + editaction?: string; + externalData?: WebixCallback; + filterMode?: any; + fixedRowHeight?: boolean; + footer?: boolean; + form?: string; + gravity?: number; + header?: boolean; + headerRowHeight?: number; + headermenu?: any; + height?: number; + hidden?: boolean; + hover?: string; + id?: string; + leftSplit?: number; + liveValidation?: boolean; + loadahead?: number; + math?: boolean; + maxHeight?: number; + maxWidth?: number; + minColumnHeight?: number; + minColumnWidth?: number; + minHeight?: number; + minWidth?: number; + mouseEventDelay?: number; + multiselect?: boolean; + navigation?: boolean; + on?: any; + onClick?: { [key: string]: any; }; + onContext?: { [key: string]: any; }; + onDblClick?: WebixCallback; + onMouseMove?: WebixCallback; + pager?: any; + prerender?: boolean; + ready?: WebixCallback; + removeMissed?: boolean; + resizeColumn?: boolean; + resizeRow?: boolean; + rightSplit?: number; + rowHeight?: number; + rowLineHeight?: number; + rules?: any; + save?: string; + scheme?: any; + scroll?: boolean; + scrollAlignY?: boolean; + scrollX?: boolean; + scrollY?: boolean; + select?: boolean|string; + spans?: any[]; + tooltip?: any; + type?: any; + url?: string; + width?: number; + yCount?: number; +} +interface datatable extends webix.ui.baseview{ + add(obj:any, index?:number):string; + addCellCss(id:string, name:string, css:string):void; + addCss(id:string|number, css:string, silent?:boolean):void; + addRowCss(id:string, css:string):void; + addSpan(id:any, column:string, width:number, height:number, value?:string, css?:string):void; + adjust():void; + adjustColumn(id:string|number, header?:string):void; + adjustRowHeight(columnId:string, silent:boolean):void; + attachEvent(type:string, functor:WebixCallback, id?:string):string; + bind(target:any, rule?:WebixCallback, format?:string):void; + blockEvent():void; + callEvent(name:string, params:any[]):boolean; + clearAll():void; + clearCss(css:string, silent?:boolean):void; + clearSelection():void; + clearValidation():void; + collectValues(id:string):any[]; + columnId(index:number):string; + copy(sid:string, tindex:number, tobj?:any, details?:any):void; + count():number; + define(property:string, value:any):void; + destructor():void; + detachEvent(id:string):void; + disable():void; + eachColumn(handler:WebixCallback, all?:boolean):void; + eachRow(handler:WebixCallback, all?:boolean):void; + edit(id:any):void; + editCancel():void; + editCell(row:string, col:string, preserve?:boolean, show?:boolean):void; + editColumn(id:string):void; + editNext():boolean; + editRow(id:string):void; + editStop():void; + enable():void; + exists(id:string):boolean; + exportToExcel(url?:string):void; + exportToPDF(url?:string):void; + filter(text:string|WebixTemplate|WebixCallback, value:string, preserve:boolean):void; + filterByAll():void; + find(criterion:WebixCallback, first?:boolean):any; + focusEditor():void; + getChildViews():any[]; + getColumnConfig(id:string):any; + getColumnIndex(id:string):number; + getEditState():any; + getEditor(row?:any, column?:string|number):any; + getEditorValue():string; + getFilter(columnID:string):any; + getFirstId():string; + getFormView():webix.ui.baseview; + getHeaderContent(id:string):{ [key: string]: any; }; + getHeaderNode(columnId:string, rowIndex?:number):HTMLElement; + getIdByIndex(index:number):string; + getIndexById(id:string):number; + getItem(id:string):any; + getItemNode(id:string):void; + getLastId():string; + getNextId(id:string, step:number):string; + getNode():any; + getPage():number; + getPager():any; + getParentView():any; + getPrevId(id:string, step:number):string; + getScrollState():any; + getSelectedId(asArray?:boolean, asString?:boolean):any; + getSelectedItem(mode?:boolean):void; + getState():any; + getText(rowid:string, colid:string):string; + getTopParentView():webix.ui.baseview; + getVisibleCount():number; + group(config:any, mode:boolean):void; + hasCss(id:string, css:string):boolean; + hasEvent(name:string):boolean; + hide():void; + hideColumn(id:string):void; + hideOverlay():void; + isColumnVisible(id:string):boolean; + isEnabled():boolean; + isVisible():boolean; + load(url:string, type?:string, callback?:WebixCallback):PromisedData; + loadNext(count:number, start:number, callback:WebixCallback, url:string, now:boolean):void; + locate(node:HTMLElement|Event):any; + mapCells(startrow:number, startcol:string, numrows:number, numcols:number, callback:WebixCallback):void; + mapEvent(map:any):void; + mapSelection(callback:WebixCallback):void; + markSorting(column_id:string, dir:string):void; + move(sid:string, tindex:number, tobj?:any, details?:any):string; + moveBottom(id:string):void; + moveColumn(id:string, index:number):void; + moveDown(id:string, step:number):void; + moveSelection(direction:string):void; + moveTop(id:string):void; + moveUp(id:string, step:number):void; + parse(data:any, type:string):void; + refresh(id?:string):void; + refreshColumns(config?:any[]):void; + refreshFilter(id:string):void; + refreshHeaderContent():void; + registerFilter(node:HTMLElement, config:any, obj:any):void; + remove(id:string):void; + removeCellCss(id:string, name:string, css_name:string):void; + removeCss(id:string|number, css:string, silent?:boolean):void; + removeRowCss(id:string, css_name:string):void; + removeSpan(id:string|number, column:string):void; + render(id:string, data:any, operation:string):void; + resize():void; + scrollTo(x:number, y:number):void; + select(row_id:string, preserve:boolean):void; + selectRange(row_id:any, end_row_id:any):void; + serialize():any; + setColumnWidth(id:string, width:number):void; + setPage(page:number):void; + setRowHeight(id:string, height:number):void; + setState(state:any):void; + show(force?:boolean, animation?:boolean):void; + showCell(row:string, column:string):void; + showColumn(id:string):void; + showColumnBatch(batch:string|number):void; + showItem(id:string):void; + showItemByIndex(index:number):void; + showOverlay(message:string):void; + sort(by:string, dir?:string, as?:string):void; + sync(source:any, filter:WebixCallback, silent:boolean):void; + unbind():void; + unblockEvent():void; + ungroup(mode:boolean):void; + unselect(row_id:string):void; + updateItem(id:string, data:any):void; + validate(id?:string):boolean; + validateEditor(id?:string):boolean; + $drag(source:HTMLElement, ev:Event):string; + $dragHTML: WebixCallback; + $dragIn(source:HTMLElement, target:HTMLElement, ev:Event):HTMLElement; + $dragMark(context:any, ev:Event):boolean; + $dragOut(source:HTMLElement, old_target:HTMLElement, new_target:HTMLElement, ev:Event):void; + $drop(source:HTMLElement, target:HTMLElement, ev:any):void; + $dropAllow: WebixCallback; + $getSize():any[]; + $height: number; + $scope: any; + $setSize(x:number, y:number):boolean; + $skin: any; + $view: HTMLElement; + $width: number; + config: datatableConfig; + headerContent: any; + name: string; + on_click: WebixCallback; + on_context: { [key: string]: any; }; + on_dblclick: WebixCallback; + on_mouse_move: WebixCallback; + waitData: PromisedData; +} +interface dataviewConfig{ + animate?: any; + autoheight?: boolean; + borderless?: boolean; + click?: string|WebixCallback; + container?: HTMLElement; + css?: string; + data?: string|any[]; + dataFeed?: string|WebixCallback; + datafetch?: number; + datathrottle?: number; + datatype?: string; + disabled?: boolean; + drag?: boolean|string; + dragscroll?: boolean|string; + externalData?: WebixCallback; + gravity?: number; + height?: number; + hidden?: boolean; + id?: string; + loadahead?: number; + maxHeight?: number; + maxWidth?: number; + minHeight?: number; + minWidth?: number; + mouseEventDelay?: number; + navigation?: boolean; + on?: any; + onClick?: { [key: string]: any; }; + onContext?: { [key: string]: any; }; + onDblClick?: WebixCallback; + onMouseMove?: WebixCallback; + pager?: any; + ready?: WebixCallback; + removeMissed?: boolean; + rules?: any; + save?: string; + scheme?: any; + scroll?: boolean|string; + scrollSpeed?: string; + select?: boolean|string; + template?: string|WebixCallback; + tooltip?: any; + type?: any; + url?: string; + width?: number; + xCount?: number; + yCount?: number; +} +interface dataview extends webix.ui.baseview{ + add(obj:any, index?:number):string; + addCss(id:string|number, css:string, silent?:boolean):void; + adjust():void; + attachEvent(type:string, functor:WebixCallback, id?:string):string; + bind(target:any, rule?:WebixCallback, format?:string):void; + blockEvent():void; + callEvent(name:string, params:any[]):boolean; + clearAll():void; + clearCss(css:string, silent?:boolean):void; + clearValidation():void; + copy(sid:string, tindex:number, tobj?:any, details?:any):void; + count():number; + customize(obj:any):void; + define(property:string, value:any):void; + destructor():void; + detachEvent(id:string):void; + disable():void; + enable():void; + exists(id:string):boolean; + filter(text:string|WebixTemplate|WebixCallback, value:string, preserve:boolean):void; + getChildViews():any[]; + getFirstId():string; + getFormView():webix.ui.baseview; + getIdByIndex(index:number):string; + getIndexById(id:string):number; + getItem(id:string):any; + getItemNode(id:string):void; + getLastId():string; + getNextId(id:string, step:number):string; + getNode():any; + getPage():number; + getPager():any; + getParentView():any; + getPrevId(id:string, step:number):string; + getScrollState():any; + getSelectedId(as_array:boolean):string|any[]; + getSelectedItem(as_array?:boolean):any; + getTopParentView():webix.ui.baseview; + hasCss(id:string, css:string):boolean; + hasEvent(name:string):boolean; + hide():void; + isEnabled():boolean; + isSelected(id:string):boolean; + isVisible():boolean; + load(url:string, type?:string, callback?:WebixCallback):PromisedData; + loadNext(count:number, start:number, callback:WebixCallback, url:string, now:boolean):void; + locate(e:Event):string; + mapEvent(map:any):void; + move(sid:string, tindex:number, tobj?:any, details?:any):string; + moveBottom(id:string):void; + moveDown(id:string, step:number):void; + moveSelection(direction:string):void; + moveTop(id:string):void; + moveUp(id:string, step:number):void; + parse(data:any, type:string):void; + refresh(id?:string):void; + remove(id:string):void; + removeCss(id:string|number, css:string, silent?:boolean):void; + render(id:string, data:any, type:string):void; + resize():void; + scrollTo(x:number, y:number):void; + select(id:string|any[], preserve:boolean):void; + selectAll(from?:string, to?:string):void; + serialize():any; + setPage(page:number):void; + show(force?:boolean, animation?:boolean):void; + showItem(id:string):void; + sort(by:string, dir?:string, as?:string):void; + sync(source:any, filter:WebixCallback, silent:boolean):void; + unbind():void; + unblockEvent():void; + unselect(id?:string):void; + unselectAll():void; + updateItem(id:string, data:any):void; + validate(id?:string):boolean; + $drag(source:HTMLElement, ev:Event):string; + $dragHTML: WebixCallback; + $dragIn(source:HTMLElement, target:HTMLElement, ev:Event):HTMLElement; + $dragMark(context:any, ev:Event):boolean; + $dragOut(source:HTMLElement, old_target:HTMLElement, new_target:HTMLElement, ev:Event):void; + $drop(source:HTMLElement, target:HTMLElement, ev:any):void; + $dropAllow: WebixCallback; + $getSize():any[]; + $height: number; + $scope: any; + $setSize(x:number, y:number):boolean; + $skin: any; + $view: HTMLElement; + $width: number; + config: dataviewConfig; + name: string; + on_click: WebixCallback; + on_context: { [key: string]: any; }; + on_dblclick: WebixCallback; + on_mouse_move: WebixCallback; + type: { [key: string]: any; }; + types: { [key: string]: any; }; + waitData: PromisedData; +} +interface datepickerConfig{ + align?: string; + animate?: any; + attributes?: { [key: string]: any; }; + borderless?: boolean; + click?: WebixCallback; + container?: HTMLElement; + content?: string|HTMLElement; + css?: string; + disabled?: boolean; + editable?: boolean; + format?: string; + gravity?: number; + height?: number; + hidden?: boolean; + hotkey?: string; + icon?: string; + icons?: any; + id?: string; + inputHeight?: number; + inputPadding?: number; + inputWidth?: number; + label?: string; + labelPosition?: string; + labelWidth?: number; + maxHeight?: number; + maxWidth?: number; + minHeight?: number; + minWidth?: number; + name?: string; + on?: any; + placeholder?: string; + popup?: any; + readonly?: boolean; + relatedAction?: string; + relatedView?: string; + required?: boolean; + stringResult?: any; + suggest?: string|webix.ui.baseview; + tabFocus?: boolean; + template?: string|WebixCallback; + text?: string; + timeIcon?: string; + timepicker?: boolean; + tooltip?: string; + type?: string; + validate?: boolean; + validateEvent?: string; + value?: string; + width?: number; +} +interface datepicker extends webix.ui.baseview{ + adjust():void; + attachEvent(type:string, functor:WebixCallback, id?:string):string; + bind(target:any, rule?:WebixCallback, format?:string):void; + blockEvent():void; + blur():void; + callEvent(name:string, params:any[]):boolean; + define(property:string, value:any):void; + destructor():void; + detachEvent(id:string):void; + disable():void; + enable():void; + focus():void; + getChildViews():any[]; + getFormView():webix.ui.baseview; + getInputNode():HTMLElement; + getNode():any; + getParentView():any; + getPopup():webix.ui.baseview; + getText():void; + getTopParentView():webix.ui.baseview; + getValue():string; + hasEvent(name:string):boolean; + hide():void; + isEnabled():boolean; + isVisible():boolean; + mapEvent(map:any):void; + refresh():void; + render(id:string, data:any, type:string):void; + resize():void; + setValue(value:string):void; + show(force?:boolean, animation?:boolean):void; + sync(source:any, filter:WebixCallback, silent:boolean):void; + unbind():void; + unblockEvent():void; + validate():boolean; + $getSize():any[]; + $getValue():string; + $height: number; + $render: WebixCallback; + $renderIcon: WebixCallback; + $renderInput(obj:any, html:string, id:string):string; + $renderLabel(config:any, id:string):string; + $scope: any; + $setSize(x:number, y:number):boolean; + $setValue(value:string):void; + $skin: any; + $view: HTMLElement; + $width: number; + config: datepickerConfig; + name: string; + on_click: WebixCallback; + touchable: any; +} +interface fieldsetConfig{ + animate?: any; + body?: webix.ui.baseview; + borderless?: boolean; + container?: HTMLElement; + css?: string; + disabled?: boolean; + gravity?: number; + height?: number; + hidden?: boolean; + id?: string; + label?: any; + maxHeight?: number; + maxWidth?: number; + minHeight?: number; + minWidth?: number; + width?: number; +} +interface fieldset extends webix.ui.baseview{ + adjust():void; + bind(target:any, rule?:WebixCallback, format?:string):void; + define(property:string, value:any):void; + destructor():void; + disable():void; + enable():void; + getBody():any; + getChildViews():any[]; + getFormView():webix.ui.baseview; + getNode():any; + getParentView():any; + getTopParentView():webix.ui.baseview; + hide():void; + isEnabled():boolean; + isVisible():boolean; + resize():void; + show(force?:boolean, animation?:boolean):void; + unbind():void; + $getSize():any[]; + $height: number; + $scope: any; + $setSize(x:number, y:number):boolean; + $skin: any; + $view: HTMLElement; + $width: number; + config: fieldsetConfig; + name: string; +} +interface formConfig{ + animate?: any; + autoheight?: boolean; + borderless?: boolean; + cols?: any[]; + container?: HTMLElement; + css?: string; + data?: string|any[]; + dataFeed?: string|WebixCallback; + datatype?: string; + disabled?: boolean; + elements?: any[]; + elementsConfig?: { [key: string]: any; }; + gravity?: number; + height?: number; + hidden?: boolean; + id?: string; + isolate?: boolean; + margin?: number; + maxHeight?: number; + maxWidth?: number; + minHeight?: number; + minWidth?: number; + on?: any; + padding?: number; + paddingX?: number; + paddingY?: number; + responsive?: string; + rows?: any[]; + rules?: any; + scroll?: boolean|string; + scrollSpeed?: string; + type?: string; + url?: string; + visibleBatch?: string; + width?: number; +} +interface form extends webix.ui.baseview{ + addView(view:any, index?:number):webix.ui.baseview; + adjust():void; + attachEvent(type:string, functor:WebixCallback, id?:string):string; + bind(target:any, rule?:WebixCallback, format?:string):void; + blockEvent():void; + callEvent(name:string, params:any[]):boolean; + clear():void; + clearValidation():void; + define(property:string, value:any):void; + destructor():void; + detachEvent(id:string):void; + disable():void; + enable():void; + focus(item:string):void; + getChildViews():any[]; + getCleanValues():any; + getDirtyValues():any; + getFormView():webix.ui.baseview; + getNode():any; + getParentView():any; + getScrollState():any; + getTopParentView():webix.ui.baseview; + getValues(details?:any):any[]; + hasEvent(name:string):boolean; + hide():void; + index(obj:any):number; + isDirty():boolean; + isEnabled():boolean; + isVisible():boolean; + load(url:string, type?:string, callback?:WebixCallback):PromisedData; + mapEvent(map:any):void; + parse(data:any, type:string):void; + reconstruct():void; + refresh():void; + removeView(id:string):void; + render(id:string, data:any, type:string):void; + resize():void; + resizeChildren():void; + scrollTo(x:number, y:number):void; + setDirty(mark?:boolean):void; + setValues(values:any, update?:boolean):void; + show(force?:boolean, animation?:boolean):void; + showBatch(name:string):void; + unbind():void; + unblockEvent():void; + validate():boolean; + $getSize():any[]; + $height: number; + $setSize(x:number, y:number):boolean; + $skin: any; + $view: HTMLElement; + $width: number; + config: formConfig; + name: string; +} +interface grouplistConfig{ + animate?: any; + autoheight?: boolean; + autowidth?: boolean; + borderless?: boolean; + click?: string|WebixCallback; + clipboard?: boolean|string; + container?: HTMLElement; + css?: string; + data?: string|any[]; + dataFeed?: string|WebixCallback; + datathrottle?: number; + datatype?: string; + disabled?: boolean; + drag?: boolean|string; + dragscroll?: boolean|string; + externalData?: WebixCallback; + gravity?: number; + height?: number; + hidden?: boolean; + id?: string; + layout?: string; + maxHeight?: number; + maxWidth?: number; + minHeight?: number; + minWidth?: number; + mouseEventDelay?: number; + navigation?: boolean; + on?: any; + onClick?: { [key: string]: any; }; + onContext?: { [key: string]: any; }; + onDblClick?: WebixCallback; + onMouseMove?: WebixCallback; + pager?: any; + ready?: WebixCallback; + removeMissed?: boolean; + rules?: any; + save?: string; + scheme?: any; + scroll?: boolean|string; + scrollSpeed?: string; + select?: boolean|string; + template?: string|WebixCallback; + templateBack?: string|WebixTemplate; + templateCopy?: WebixCallback; + templateGroup?: string|WebixTemplate; + templateItem?: string|WebixTemplate; + tooltip?: any; + type?: any; + url?: string; + width?: number; + xCount?: number; + yCount?: number; +} +interface grouplist extends webix.ui.baseview{ + add(obj:any, index?:number):string; + addCss(id:string|number, css:string, silent?:boolean):void; + adjust():void; + attachEvent(type:string, functor:WebixCallback, id?:string):string; + bind(target:any, rule?:WebixCallback, format?:string):void; + blockEvent():void; + callEvent(name:string, params:any[]):boolean; + clearAll():void; + clearCss(css:string, silent?:boolean):void; + clearValidation():void; + copy(sid:string, tindex:number, tobj?:any, details?:any):void; + count():number; + customize(obj:any):void; + define(property:string, value:any):void; + destructor():void; + detachEvent(id:string):void; + disable():void; + enable():void; + exists(id:string):boolean; + filter(text:string|WebixTemplate|WebixCallback, value:string, preserve:boolean):void; + getChildViews():any[]; + getFirstId():string; + getFormView():webix.ui.baseview; + getIdByIndex(index:number):string; + getIndexById(id:string):number; + getItem(id:string):any; + getItemNode(id:string):void; + getLastId():string; + getNextId(id:string, step:number):string; + getNode():any; + getOpenState():any; + getPage():number; + getPager():any; + getParentView():any; + getPrevId(id:string, step:number):string; + getScrollState():any; + getSelectedId(as_array:boolean):string|any[]; + getSelectedItem(as_array?:boolean):any; + getTopParentView():webix.ui.baseview; + getVisibleCount():number; + group(config:any, mode:boolean):void; + hasCss(id:string, css:string):boolean; + hasEvent(name:string):boolean; + hide():void; + isEnabled():boolean; + isSelected(id:string):boolean; + isVisible():boolean; + load(url:string, type?:string, callback?:WebixCallback):PromisedData; + loadNext(count:number, start:number, callback:WebixCallback, url:string, now:boolean):void; + locate(e:Event):string; + mapEvent(map:any):void; + move(sid:string, tindex:number, tobj?:any, details?:any):string; + moveBottom(id:string):void; + moveDown(id:string, step:number):void; + moveSelection(direction:string):void; + moveTop(id:string):void; + moveUp(id:string, step:number):void; + parse(data:any, type:string):void; + refresh(id?:string):void; + remove(id:string):void; + removeCss(id:string|number, css:string, silent?:boolean):void; + render(id:string, data:any, type:string):void; + resize():void; + scrollTo(x:number, y:number):void; + select(id:string|any[], preserve:boolean):void; + selectAll(from?:string, to?:string):void; + serialize():any; + setPage(page:number):void; + show(force?:boolean, animation?:boolean):void; + showItem(id:string):void; + sort(by:string, dir?:string, as?:string):void; + sync(source:any, filter:WebixCallback, silent:boolean):void; + unbind():void; + unblockEvent():void; + ungroup(mode:boolean):void; + unselect(id?:string):void; + unselectAll():void; + updateItem(id:string, data:any):void; + validate(id?:string):boolean; + $drag(source:HTMLElement, ev:Event):string; + $dragHTML: WebixCallback; + $dragIn(source:HTMLElement, target:HTMLElement, ev:Event):HTMLElement; + $dragMark(context:any, ev:Event):boolean; + $dragOut(source:HTMLElement, old_target:HTMLElement, new_target:HTMLElement, ev:Event):void; + $drop(source:HTMLElement, target:HTMLElement, ev:any):void; + $dropAllow: WebixCallback; + $getSize():any[]; + $height: number; + $scope: any; + $setSize(x:number, y:number):boolean; + $skin: any; + $view: HTMLElement; + $width: number; + config: grouplistConfig; + name: string; + on_click: WebixCallback; + on_context: { [key: string]: any; }; + on_dblclick: WebixCallback; + on_mouse_move: WebixCallback; + type: { [key: string]: any; }; + types: { [key: string]: any; }; +} +interface headerlayoutConfig{ + animate?: any; + borderless?: boolean; + collapsed?: boolean; + cols?: any[]; + container?: HTMLElement; + css?: string; + disabled?: boolean; + gravity?: number; + height?: number; + hidden?: boolean; + id?: string; + isolate?: boolean; + margin?: number; + maxHeight?: number; + maxWidth?: number; + minHeight?: number; + minWidth?: number; + multi?: boolean|string; + on?: any; + padding?: number; + paddingX?: number; + paddingY?: number; + panelClass?: string; + responsive?: string; + rows?: any[]; + type?: string; + visibleBatch?: string; + width?: number; +} +interface headerlayout extends webix.ui.baseview{ + addView(view:any, index?:number):webix.ui.baseview; + adjust():void; + attachEvent(type:string, functor:WebixCallback, id?:string):string; + bind(target:any, rule?:WebixCallback, format?:string):void; + blockEvent():void; + callEvent(name:string, params:any[]):boolean; + define(property:string, value:any):void; + destructor():void; + detachEvent(id:string):void; + disable():void; + enable():void; + getChildViews():any[]; + getFormView():webix.ui.baseview; + getNode():any; + getParentView():any; + getTopParentView():webix.ui.baseview; + hasEvent(name:string):boolean; + hide():void; + index(obj:any):number; + isEnabled():boolean; + isVisible():boolean; + mapEvent(map:any):void; + reconstruct():void; + removeView(id:string):void; + resize():void; + resizeChildren():void; + show(force?:boolean, animation?:boolean):void; + showBatch(name:string):void; + unbind():void; + unblockEvent():void; + $getSize():any[]; + $height: number; + $setSize(x:number, y:number):boolean; + $skin: any; + $view: HTMLElement; + $width: number; + config: headerlayoutConfig; + name: string; +} +interface htmlformConfig{ + animate?: any; + autoheight?: any; + borderless?: boolean; + container?: HTMLElement; + content?: string|HTMLElement; + css?: string; + data?: string|any[]; + dataFeed?: string|WebixCallback; + datatype?: string; + disabled?: boolean; + gravity?: number; + height?: number; + hidden?: boolean; + id?: string; + maxHeight?: number; + maxWidth?: number; + minHeight?: number; + minWidth?: number; + on?: any; + onClick?: { [key: string]: any; }; + scroll?: boolean|string; + scrollSpeed?: string; + src?: string; + template?: string|WebixCallback; + type?: string; + url?: string; + width?: number; +} +interface htmlform extends webix.ui.baseview{ + adjust():void; + attachEvent(type:string, functor:WebixCallback, id?:string):string; + bind(target:any, rule?:WebixCallback, format?:string):void; + blockEvent():void; + callEvent(name:string, params:any[]):boolean; + clear(all?:boolean):void; + define(property:string, value:any):void; + destructor():void; + detachEvent(id:string):void; + disable():void; + enable():void; + focus(item:string):void; + getChildViews():any[]; + getCleanValues():any; + getDirtyValues():any; + getFormView():webix.ui.baseview; + getNode():any; + getParentView():any; + getScrollState():any; + getTopParentView():webix.ui.baseview; + getValues(details?:any):any[]; + hasEvent(name:string):boolean; + hide():void; + isDirty():boolean; + isEnabled():boolean; + isVisible():boolean; + load(url:string, type?:string, callback?:WebixCallback):PromisedData; + mapEvent(map:any):void; + parse(data:any, type:string):void; + refresh():void; + render(id:string, data:any, type:string):void; + resize():void; + scrollTo(x:number, y:number):void; + setContent(node:any):void; + setDirty(mark?:boolean):void; + setHTML(html:string):void; + setValues(values:any, update?:boolean):void; + show(force?:boolean, animation?:boolean):void; + sync(source:any, filter:WebixCallback, silent:boolean):void; + unbind():void; + unblockEvent():void; + $getSize():any[]; + $height: number; + $scope: any; + $setSize(x:number, y:number):boolean; + $skin: any; + $view: HTMLElement; + $width: number; + config: htmlformConfig; + name: string; +} +interface iconConfig{ + align?: string; + animate?: any; + borderless?: boolean; + click?: WebixCallback; + container?: HTMLElement; + content?: string|HTMLElement; + css?: string; + disabled?: boolean; + gravity?: number; + height?: number; + hidden?: boolean; + hotkey?: string; + id?: string; + inputHeight?: number; + inputWidth?: number; + label?: string; + labelPosition?: string; + maxHeight?: number; + maxWidth?: number; + minHeight?: number; + minWidth?: number; + name?: string; + on?: any; + placeholder?: any; + popup?: any; + tabFocus?: boolean; + template?: string|WebixCallback; + tooltip?: string; + type?: string; + value?: string; + width?: number; +} +interface icon extends webix.ui.baseview{ + adjust():void; + attachEvent(type:string, functor:WebixCallback, id?:string):string; + bind(target:any, rule?:WebixCallback, format?:string):void; + blockEvent():void; + blur():void; + callEvent(name:string, params:any[]):boolean; + define(property:string, value:any):void; + destructor():void; + detachEvent(id:string):void; + disable():void; + enable():void; + focus():void; + getChildViews():any[]; + getFormView():webix.ui.baseview; + getInputNode():HTMLElement; + getNode():any; + getParentView():any; + getTopParentView():webix.ui.baseview; + getValue():string; + hasEvent(name:string):boolean; + hide():void; + isEnabled():boolean; + isVisible():boolean; + mapEvent(map:any):void; + refresh():void; + render(id:string, data:any, type:string):void; + resize():void; + setValue(value:string):void; + show(force?:boolean, animation?:boolean):void; + sync(source:any, filter:WebixCallback, silent:boolean):void; + unbind():void; + unblockEvent():void; + $getSize():any[]; + $getValue():string; + $height: number; + $scope: any; + $setSize(x:number, y:number):boolean; + $setValue(value:string):void; + $skin: any; + $view: HTMLElement; + $width: number; + config: iconConfig; + name: string; + on_click: WebixCallback; + touchable: any; +} +interface iframeConfig{ + animate?: any; + borderless?: boolean; + container?: HTMLElement; + css?: string; + disabled?: boolean; + gravity?: number; + height?: number; + hidden?: boolean; + id?: string; + maxHeight?: number; + maxWidth?: number; + minHeight?: number; + minWidth?: number; + on?: any; + src?: string; + width?: number; +} +interface iframe extends webix.ui.baseview{ + adjust():void; + attachEvent(type:string, functor:WebixCallback, id?:string):string; + bind(target:any, rule?:WebixCallback, format?:string):void; + blockEvent():void; + callEvent(name:string, params:any[]):boolean; + define(property:string, value:any):void; + destructor():void; + detachEvent(id:string):void; + disable():void; + enable():void; + getChildViews():any[]; + getFormView():webix.ui.baseview; + getIframe():HTMLElement; + getNode():any; + getParentView():any; + getTopParentView():webix.ui.baseview; + getWindow():HTMLElement; + hasEvent(name:string):boolean; + hide():void; + isEnabled():boolean; + isVisible():boolean; + load(value:string):void; + mapEvent(map:any):void; + resize():void; + show(force?:boolean, animation?:boolean):void; + unbind():void; + unblockEvent():void; + $getSize():any[]; + $height: number; + $scope: any; + $setSize(x:number, y:number):boolean; + $skin: any; + $view: HTMLElement; + $width: number; + config: iframeConfig; + name: string; +} +interface labelConfig{ + align?: string; + animate?: any; + borderless?: boolean; + click?: WebixCallback; + container?: HTMLElement; + content?: string|HTMLElement; + css?: string; + disabled?: boolean; + gravity?: number; + height?: number; + hidden?: boolean; + hotkey?: string; + id?: string; + inputHeight?: number; + inputWidth?: number; + label?: string; + labelPosition?: string; + maxHeight?: number; + maxWidth?: number; + minHeight?: number; + minWidth?: number; + name?: string; + on?: any; + placeholder?: any; + popup?: any; + tabFocus?: boolean; + template?: string|WebixCallback; + tooltip?: string; + type?: string; + value?: string; + width?: number; +} +interface label extends webix.ui.baseview{ + adjust():void; + attachEvent(type:string, functor:WebixCallback, id?:string):string; + bind(target:any, rule?:WebixCallback, format?:string):void; + blockEvent():void; + blur():void; + callEvent(name:string, params:any[]):boolean; + define(property:string, value:any):void; + destructor():void; + detachEvent(id:string):void; + disable():void; + enable():void; + focus():void; + getChildViews():any[]; + getFormView():webix.ui.baseview; + getInputNode():HTMLElement; + getNode():any; + getParentView():any; + getTopParentView():webix.ui.baseview; + getValue():string; + hasEvent(name:string):boolean; + hide():void; + isEnabled():boolean; + isVisible():boolean; + mapEvent(map:any):void; + refresh():void; + render(id:string, data:any, type:string):void; + resize():void; + setHTML(html:string):void; + setValue(value:string):void; + show(force?:boolean, animation?:boolean):void; + sync(source:any, filter:WebixCallback, silent:boolean):void; + unbind():void; + unblockEvent():void; + $getSize():any[]; + $getValue():string; + $height: number; + $scope: any; + $setSize(x:number, y:number):boolean; + $setValue(value:string):void; + $skin: any; + $view: HTMLElement; + $width: number; + config: labelConfig; + name: string; + on_click: WebixCallback; + touchable: any; +} +interface layoutConfig{ + animate?: any; + borderless?: boolean; + cols?: any[]; + container?: HTMLElement; + css?: string; + disabled?: boolean; + gravity?: number; + height?: number; + hidden?: boolean; + id?: string; + isolate?: boolean; + margin?: number; + maxHeight?: number; + maxWidth?: number; + minHeight?: number; + minWidth?: number; + on?: any; + padding?: number; + paddingX?: number; + paddingY?: number; + responsive?: string; + rows?: any[]; + type?: string; + visibleBatch?: string; + width?: number; +} +interface layout extends webix.ui.baseview{ + addView(view:any, index?:number):webix.ui.baseview; + adjust():void; + attachEvent(type:string, functor:WebixCallback, id?:string):string; + bind(target:any, rule?:WebixCallback, format?:string):void; + blockEvent():void; + callEvent(name:string, params:any[]):boolean; + define(property:string, value:any):void; + destructor():void; + detachEvent(id:string):void; + disable():void; + enable():void; + getChildViews():any[]; + getFormView():webix.ui.baseview; + getNode():any; + getParentView():any; + getTopParentView():webix.ui.baseview; + hasEvent(name:string):boolean; + hide():void; + index(obj:any):number; + isEnabled():boolean; + isVisible():boolean; + mapEvent(map:any):void; + reconstruct():void; + removeView(id:string):void; + resize():void; + resizeChildren():void; + show(force?:boolean, animation?:boolean):void; + showBatch(name:string):void; + unbind():void; + unblockEvent():void; + $getSize():any[]; + $height: number; + $setSize(x:number, y:number):boolean; + $skin: any; + $view: HTMLElement; + $width: number; + config: layoutConfig; + name: string; +} +interface listConfig{ + animate?: any; + autoheight?: boolean; + autowidth?: boolean; + borderless?: boolean; + click?: string|WebixCallback; + clipboard?: boolean|string; + container?: HTMLElement; + css?: string; + data?: string|any[]; + dataFeed?: string|WebixCallback; + datathrottle?: number; + datatype?: string; + disabled?: boolean; + drag?: boolean|string; + dragscroll?: boolean|string; + externalData?: WebixCallback; + gravity?: number; + height?: number; + hidden?: boolean; + id?: string; + layout?: string; + maxHeight?: number; + maxWidth?: number; + minHeight?: number; + minWidth?: number; + mouseEventDelay?: number; + navigation?: boolean; + on?: any; + onClick?: { [key: string]: any; }; + onContext?: { [key: string]: any; }; + onDblClick?: WebixCallback; + onMouseMove?: WebixCallback; + pager?: any; + ready?: WebixCallback; + removeMissed?: boolean; + rules?: any; + save?: string; + scheme?: any; + scroll?: boolean|string; + scrollSpeed?: string; + select?: boolean|string; + template?: string|WebixCallback; + templateCopy?: WebixCallback; + tooltip?: any; + type?: any; + url?: string; + width?: number; + xCount?: number; + yCount?: number; +} +interface list extends webix.ui.baseview{ + add(obj:any, index?:number):string; + addCss(id:string|number, css:string, silent?:boolean):void; + adjust():void; + attachEvent(type:string, functor:WebixCallback, id?:string):string; + bind(target:any, rule?:WebixCallback, format?:string):void; + blockEvent():void; + callEvent(name:string, params:any[]):boolean; + clearAll():void; + clearCss(css:string, silent?:boolean):void; + clearValidation():void; + copy(sid:string, tindex:number, tobj?:any, details?:any):void; + count():number; + customize(obj:any):void; + define(property:string, value:any):void; + destructor():void; + detachEvent(id:string):void; + disable():void; + enable():void; + exists(id:string):boolean; + filter(text:string|WebixTemplate|WebixCallback, value:string, preserve:boolean):void; + getChildViews():any[]; + getFirstId():string; + getFormView():webix.ui.baseview; + getIdByIndex(index:number):string; + getIndexById(id:string):number; + getItem(id:string):any; + getItemNode(id:string):void; + getLastId():string; + getNextId(id:string, step:number):string; + getNode():any; + getPage():number; + getPager():any; + getParentView():any; + getPrevId(id:string, step:number):string; + getScrollState():any; + getSelectedId(as_array:boolean):string|any[]; + getSelectedItem(as_array?:boolean):any; + getTopParentView():webix.ui.baseview; + getVisibleCount():number; + hasCss(id:string, css:string):boolean; + hasEvent(name:string):boolean; + hide():void; + isEnabled():boolean; + isSelected(id:string):boolean; + isVisible():boolean; + load(url:string, type?:string, callback?:WebixCallback):PromisedData; + loadNext(count:number, start:number, callback:WebixCallback, url:string, now:boolean):void; + locate(e:Event):string; + mapEvent(map:any):void; + move(sid:string, tindex:number, tobj?:any, details?:any):string; + moveBottom(id:string):void; + moveDown(id:string, step:number):void; + moveSelection(direction:string):void; + moveTop(id:string):void; + moveUp(id:string, step:number):void; + parse(data:any, type:string):void; + refresh(id?:string):void; + remove(id:string):void; + removeCss(id:string|number, css:string, silent?:boolean):void; + render(id:string, data:any, type:string):void; + resize():void; + scrollTo(x:number, y:number):void; + select(id:string|any[], preserve:boolean):void; + selectAll(from?:string, to?:string):void; + serialize():any; + setPage(page:number):void; + show(force?:boolean, animation?:boolean):void; + showItem(id:string):void; + sort(by:string, dir?:string, as?:string):void; + sync(source:any, filter:WebixCallback, silent:boolean):void; + unbind():void; + unblockEvent():void; + unselect(id?:string):void; + unselectAll():void; + updateItem(id:string, data:any):void; + validate(id?:string):boolean; + $drag(source:HTMLElement, ev:Event):string; + $dragHTML: WebixCallback; + $dragIn(source:HTMLElement, target:HTMLElement, ev:Event):HTMLElement; + $dragMark(context:any, ev:Event):boolean; + $dragOut(source:HTMLElement, old_target:HTMLElement, new_target:HTMLElement, ev:Event):void; + $drop(source:HTMLElement, target:HTMLElement, ev:any):void; + $dropAllow: WebixCallback; + $getSize():any[]; + $height: number; + $scope: any; + $setSize(x:number, y:number):boolean; + $skin: any; + $view: HTMLElement; + $width: number; + config: listConfig; + name: string; + on_click: WebixCallback; + on_context: { [key: string]: any; }; + on_dblclick: WebixCallback; + on_mouse_move: WebixCallback; + type: { [key: string]: any; }; + types: { [key: string]: any; }; +} +interface menuConfig{ + animate?: any; + autoheight?: boolean; + autowidth?: boolean; + borderless?: boolean; + click?: string|WebixCallback; + clipboard?: boolean|string; + container?: HTMLElement; + css?: string; + data?: string|any[]; + dataFeed?: string|WebixCallback; + datathrottle?: number; + datatype?: string; + disabled?: boolean; + drag?: boolean|string; + dragscroll?: boolean|string; + externalData?: WebixCallback; + gravity?: number; + height?: number; + hidden?: boolean; + id?: string; + layout?: string; + maxHeight?: number; + maxWidth?: number; + minHeight?: number; + minWidth?: number; + mouseEventDelay?: number; + navigation?: boolean; + on?: any; + onClick?: { [key: string]: any; }; + onContext?: { [key: string]: any; }; + onDblClick?: WebixCallback; + onMouseMove?: WebixCallback; + pager?: any; + ready?: WebixCallback; + removeMissed?: boolean; + rules?: any; + save?: string; + scheme?: any; + scroll?: boolean|string; + scrollSpeed?: string; + select?: boolean|string; + subMenuPos?: string; + submenu?: any; + template?: string|WebixCallback; + templateCopy?: WebixCallback; + tooltip?: any; + type?: any; + url?: string; + width?: number; + xCount?: number; + yCount?: number; +} +interface menu extends webix.ui.baseview{ + add(obj:any, index?:number):string; + addCss(id:string|number, css:string, silent?:boolean):void; + adjust():void; + attachEvent(type:string, functor:WebixCallback, id?:string):string; + bind(target:any, rule?:WebixCallback, format?:string):void; + blockEvent():void; + callEvent(name:string, params:any[]):boolean; + clearAll():void; + clearCss(css:string, silent?:boolean):void; + clearValidation():void; + copy(sid:string, tindex:number, tobj?:any, details?:any):void; + count():number; + customize(obj:any):void; + define(property:string, value:any):void; + destructor():void; + detachEvent(id:string):void; + disable():void; + disableItem(id:string):void; + enable():void; + enableItem(id:string):void; + exists(id:string):boolean; + filter(text:string|WebixTemplate|WebixCallback, value:string, preserve:boolean):void; + getChildViews():any[]; + getFirstId():string; + getFormView():webix.ui.baseview; + getIdByIndex(index:number):string; + getIndexById(id:string):number; + getItem(id:string):any; + getItemNode(id:string):void; + getLastId():string; + getMenu(id:string|number):any; + getMenuItem(id:string):any; + getNextId(id:string, step:number):string; + getNode():any; + getPage():number; + getPager():any; + getParentView():any; + getPrevId(id:string, step:number):string; + getScrollState():any; + getSelectedId(as_array:boolean):string|any[]; + getSelectedItem(as_array?:boolean):any; + getSubMenu(id:string|number):any; + getTopMenu():any; + getTopParentView():webix.ui.baseview; + getVisibleCount():number; + hasCss(id:string, css:string):boolean; + hasEvent(name:string):boolean; + hide():void; + hideItem(id:string):void; + isEnabled():boolean; + isSelected(id:string):boolean; + isVisible():boolean; + load(url:string, type?:string, callback?:WebixCallback):PromisedData; + loadNext(count:number, start:number, callback:WebixCallback, url:string, now:boolean):void; + locate(e:Event):string; + mapEvent(map:any):void; + move(sid:string, tindex:number, tobj?:any, details?:any):string; + moveBottom(id:string):void; + moveDown(id:string, step:number):void; + moveSelection(direction:string):void; + moveTop(id:string):void; + moveUp(id:string, step:number):void; + parse(data:any, type:string):void; + refresh(id?:string):void; + remove(id:string):void; + removeCss(id:string|number, css:string, silent?:boolean):void; + render(id:string, data:any, type:string):void; + resize():void; + scrollTo(x:number, y:number):void; + select(id:string|any[], preserve:boolean):void; + selectAll(from?:string, to?:string):void; + serialize():any; + setPage(page:number):void; + show(force?:boolean, animation?:boolean):void; + showItem(id:string):void; + sort(by:string, dir?:string, as?:string):void; + sync(source:any, filter:WebixCallback, silent:boolean):void; + unbind():void; + unblockEvent():void; + unselect(id?:string):void; + unselectAll():void; + updateItem(id:string, data:any):void; + validate(id?:string):boolean; + $drag(source:HTMLElement, ev:Event):string; + $dragHTML: WebixCallback; + $dragIn(source:HTMLElement, target:HTMLElement, ev:Event):HTMLElement; + $dragMark(context:any, ev:Event):boolean; + $dragOut(source:HTMLElement, old_target:HTMLElement, new_target:HTMLElement, ev:Event):void; + $drop(source:HTMLElement, target:HTMLElement, ev:any):void; + $dropAllow: WebixCallback; + $getSize():any[]; + $height: number; + $scope: any; + $setSize(x:number, y:number):boolean; + $skin: any; + $view: HTMLElement; + $width: number; + config: menuConfig; + name: string; + on_click: WebixCallback; + on_context: { [key: string]: any; }; + on_dblclick: WebixCallback; + on_mouse_move: WebixCallback; + type: { [key: string]: any; }; + types: { [key: string]: any; }; +} +interface multiviewConfig{ + animate?: any; + borderless?: boolean; + cells?: any; + cols?: any[]; + container?: HTMLElement; + css?: string; + disabled?: boolean; + fitBiggest?: boolean; + gravity?: number; + height?: number; + hidden?: boolean; + id?: string; + maxHeight?: number; + maxWidth?: number; + minHeight?: number; + minWidth?: number; + on?: any; + responsive?: string; + rows?: any[]; + visibleBatch?: string; + width?: number; +} +interface multiview extends webix.ui.baseview{ + addView(view:any, index?:number):webix.ui.baseview; + adjust():void; + attachEvent(type:string, functor:WebixCallback, id?:string):string; + back(step:number):void; + bind(target:any, rule?:WebixCallback, format?:string):void; + blockEvent():void; + callEvent(name:string, params:any[]):boolean; + define(property:string, value:any):void; + destructor():void; + detachEvent(id:string):void; + disable():void; + enable():void; + getActiveId():void; + getChildViews():any[]; + getFormView():webix.ui.baseview; + getNode():any; + getParentView():any; + getTopParentView():webix.ui.baseview; + getValue():string; + hasEvent(name:string):boolean; + hide():void; + index(obj:any):number; + isEnabled():boolean; + isVisible():boolean; + mapEvent(map:any):void; + reconstruct():void; + removeView(id:string):void; + resize():void; + resizeChildren():void; + setValue(toshow:string):void; + show(force?:boolean, animation?:boolean):void; + showBatch(name:string):void; + unbind():void; + unblockEvent():void; + $getSize():any[]; + $height: number; + $setSize(x:number, y:number):boolean; + $skin: any; + $view: HTMLElement; + $width: number; + config: multiviewConfig; + name: string; +} +interface organogramConfig{ + animate?: any; + autoheight?: boolean; + autowidth?: boolean; + borderless?: boolean; + click?: string|WebixCallback; + container?: HTMLElement; + css?: string; + data?: string|any[]; + dataFeed?: string|WebixCallback; + datathrottle?: number; + datatype?: string; + disabled?: boolean; + filterMode?: any; + gravity?: number; + height?: number; + hidden?: boolean; + id?: string; + maxHeight?: number; + maxWidth?: number; + minHeight?: number; + minWidth?: number; + mouseEventDelay?: number; + on?: any; + onClick?: { [key: string]: any; }; + onContext?: { [key: string]: any; }; + onDblClick?: WebixCallback; + onMouseMove?: WebixCallback; + ready?: WebixCallback; + removeMissed?: boolean; + save?: string; + scheme?: any; + scroll?: boolean|string; + scrollSpeed?: string; + select?: boolean|string; + template?: string|WebixCallback; + threeState?: boolean; + tooltip?: any; + type?: any; + url?: string; + width?: number; +} +interface organogram extends webix.ui.baseview{ + add(obj:any, index?:number):string; + addCss(id:string|number, css:string, silent?:boolean):void; + adjust():void; + attachEvent(type:string, functor:WebixCallback, id?:string):string; + bind(target:any, rule?:WebixCallback, format?:string):void; + blockEvent():void; + callEvent(name:string, params:any[]):boolean; + clearAll():void; + clearCss(css:string, silent?:boolean):void; + close(id:string):void; + closeAll():void; + count():number; + customize(obj:any):void; + define(property:string, value:any):void; + destructor():void; + detachEvent(id:string):void; + disable():void; + enable():void; + exists(id:string):boolean; + filter(text:string|WebixTemplate|WebixCallback, value:string, preserve:boolean):void; + getBranchIndex(id:string, parent?:string):number; + getChildViews():any[]; + getFirstChildId(id:string):string; + getFirstId():string; + getFormView():webix.ui.baseview; + getIdByIndex(index:number):string; + getIndexById(id:string):number; + getItem(id:string):any; + getItemNode(id:string):void; + getLastId():string; + getNextId(id:string, step:number):string; + getNextSiblingId(id:any):string; + getNode():any; + getOpenItems():any[]; + getParentId(id:string):string; + getParentView():any; + getPrevId(id:string, step:number):string; + getPrevSiblingId(id:any):string; + getScrollState():any; + getSelectedId(as_array:boolean):string|any[]; + getSelectedItem(as_array?:boolean):any; + getState():any; + getTopParentView():webix.ui.baseview; + group(config:any, mode:boolean):void; + hasCss(id:string, css:string):boolean; + hasEvent(name:string):boolean; + hide():void; + isBranch(id:string):boolean; + isBranchOpen(id:string):boolean; + isEnabled():boolean; + isSelected(id:string):boolean; + isVisible():boolean; + load(url:string, type?:string, callback?:WebixCallback):PromisedData; + loadBranch(id:string, callback:WebixCallback, url:string):void; + loadNext(count:number, start:number, callback:WebixCallback, url:string, now:boolean):void; + locate(e:Event):string; + mapEvent(map:any):void; + open(id:string):void; + openAll():void; + parse(data:any, type:string):void; + refresh(id?:string):void; + remove(id:string):void; + removeCss(id:string|number, css:string, silent?:boolean):void; + render(id:string, data:any, type:string):void; + resize():void; + scrollTo(x:number, y:number):void; + select(id:string|any[], preserve:boolean):void; + selectAll(from?:string, to?:string):void; + serialize():any; + setState(state:any):void; + show(force?:boolean, animation?:boolean):void; + showItem(id:string):void; + sort(by:string, dir?:string, as?:string):void; + sync(source:any, filter:WebixCallback, silent:boolean):void; + unbind():void; + unblockEvent():void; + ungroup(mode:boolean):void; + unselect(id?:string):void; + unselectAll():void; + updateItem(id:string, data:any):void; + $getSize():any[]; + $height: number; + $scope: any; + $setSize(x:number, y:number):boolean; + $skin: any; + $view: HTMLElement; + $width: number; + config: organogramConfig; + name: string; + on_click: WebixCallback; + on_context: { [key: string]: any; }; + on_dblclick: WebixCallback; + on_mouse_move: WebixCallback; + type: { [key: string]: any; }; + types: { [key: string]: any; }; +} +interface pagerConfig{ + animate?: any; + apiOnly?: any; + borderless?: boolean; + container?: HTMLElement; + content?: string|HTMLElement; + count?: number; + css?: string; + disabled?: boolean; + gravity?: number; + group?: number; + height?: number; + hidden?: boolean; + id?: string; + limit?: number; + maxHeight?: number; + maxWidth?: number; + minHeight?: number; + minWidth?: number; + mouseEventDelay?: number; + on?: any; + onClick?: { [key: string]: any; }; + onContext?: { [key: string]: any; }; + onDblClick?: WebixCallback; + onMouseMove?: WebixCallback; + page?: number; + size?: number; + template?: string|WebixCallback; + width?: number; +} +interface pager extends webix.ui.baseview{ + adjust():void; + attachEvent(type:string, functor:WebixCallback, id?:string):string; + bind(target:any, rule?:WebixCallback, format?:string):void; + blockEvent():void; + callEvent(name:string, params:any[]):boolean; + clone(config:any):any; + customize(obj:any):void; + define(property:string, value:any):void; + destructor():void; + detachEvent(id:string):void; + disable():void; + enable():void; + getChildViews():any[]; + getFormView():webix.ui.baseview; + getNode():any; + getParentView():any; + getTopParentView():webix.ui.baseview; + hasEvent(name:string):boolean; + hide():void; + isEnabled():boolean; + isVisible():boolean; + mapEvent(map:any):void; + refresh(id?:string):void; + render(id:string, data:any, type:string):void; + resize():void; + select(page:number):void; + show(force?:boolean, animation?:boolean):void; + sync(source:any, filter:WebixCallback, silent:boolean):void; + unbind():void; + unblockEvent():void; + $getSize():any[]; + $height: number; + $scope: any; + $setSize(x:number, y:number):boolean; + $skin: any; + $view: HTMLElement; + $width: number; + config: pagerConfig; + name: string; + on_click: WebixCallback; + on_context: { [key: string]: any; }; + on_dblclick: WebixCallback; + on_mouse_move: WebixCallback; + type: { [key: string]: any; }; +} +interface popupConfig{ + animate?: any; + autofit?: boolean; + autofocus?: boolean; + body?: string|webix.ui.baseview; + borderless?: boolean; + container?: HTMLElement; + css?: string; + disabled?: boolean; + gravity?: number; + head?: any; + headHeight?: number; + height?: number; + hidden?: boolean; + id?: string; + left?: number; + maxHeight?: number; + maxWidth?: number; + minHeight?: number; + minWidth?: number; + modal?: boolean; + move?: boolean; + on?: any; + padding?: any; + position?: string|WebixCallback; + relative?: string; + top?: number; + width?: number; + zIndex?: number; +} +interface popup extends webix.ui.baseview{ + adjust():void; + attachEvent(type:string, functor:WebixCallback, id?:string):string; + bind(target:any, rule?:WebixCallback, format?:string):void; + blockEvent():void; + callEvent(name:string, params:any[]):boolean; + close():void; + define(property:string, value:any):void; + destructor():void; + detachEvent(id:string):void; + disable():void; + enable():void; + getBody():any; + getChildViews():any[]; + getFormView():webix.ui.baseview; + getHead():any; + getNode():any; + getParentView():any; + getTopParentView():webix.ui.baseview; + hasEvent(name:string):boolean; + hide():void; + isEnabled():boolean; + isVisible():boolean; + mapEvent(map:any):void; + resize():void; + resizeChildren():void; + setPosition(x:number, y:number):void; + show(force?:boolean, animation?:boolean):void; + unbind():void; + unblockEvent():void; + $getSize():any[]; + $height: number; + $scope: any; + $setSize(x:number, y:number):boolean; + $skin: any; + $view: HTMLElement; + $width: number; + config: popupConfig; + name: string; +} +interface propertyConfig{ + animate?: any; + autoheight?: boolean; + borderless?: boolean; + container?: HTMLElement; + content?: string|HTMLElement; + css?: string; + data?: string|any[]; + dataFeed?: string|WebixCallback; + datatype?: string; + disabled?: boolean; + editValue?: string; + editable?: boolean; + editaction?: string; + elements?: any; + form?: string; + gravity?: number; + height?: number; + hidden?: boolean; + id?: string; + maxHeight?: number; + maxWidth?: number; + minHeight?: number; + minWidth?: number; + mouseEventDelay?: number; + nameWidth?: number; + on?: any; + onClick?: { [key: string]: any; }; + onContext?: { [key: string]: any; }; + onDblClick?: WebixCallback; + onMouseMove?: WebixCallback; + scroll?: boolean|string; + scrollSpeed?: string; + template?: string|WebixCallback; + url?: string; + width?: number; +} +interface property extends webix.ui.baseview{ + adjust():void; + attachEvent(type:string, functor:WebixCallback, id?:string):string; + bind(target:any, rule?:WebixCallback, format?:string):void; + blockEvent():void; + callEvent(name:string, params:any[]):boolean; + customize(obj:any):void; + define(property:string, value:any):void; + destructor():void; + detachEvent(id:string):void; + disable():void; + edit(id:any):void; + editCancel():void; + editNext():boolean; + editStop():void; + enable():void; + focusEditor():void; + getChildViews():any[]; + getEditState():any; + getEditor(id?:string):any; + getEditorValue():string; + getFormView():webix.ui.baseview; + getItem(id:string):any; + getItemNode(id:string):void; + getNode():any; + getParentView():any; + getScrollState():any; + getTopParentView():webix.ui.baseview; + getValues():any[]; + hasEvent(name:string):boolean; + hide():void; + isEnabled():boolean; + isVisible():boolean; + load(url:string, type?:string, callback?:WebixCallback):PromisedData; + locate(e:Event):string; + mapEvent(map:any):void; + parse(data:any, type:string):void; + refresh(id?:string):void; + registerType(name:string, data:any):void; + render(id:string, data:any, type:string):void; + resize():void; + scrollTo(x:number, y:number):void; + setValues(values:any, update?:boolean):void; + show(force?:boolean, animation?:boolean):void; + showItem(id:string):void; + sync(source:any, filter:WebixCallback, silent:boolean):void; + unbind():void; + unblockEvent():void; + updateItem():void; + validateEditor(id?:string):boolean; + $getSize():any[]; + $height: number; + $scope: any; + $setSize(x:number, y:number):boolean; + $skin: any; + $view: HTMLElement; + $width: number; + config: propertyConfig; + name: string; + on_click: WebixCallback; + on_context: { [key: string]: any; }; + on_dblclick: WebixCallback; + on_edit: { [key: string]: any; }; + on_mouse_move: WebixCallback; + on_render: { [key: string]: any; }; + type: { [key: string]: any; }; +} +interface radioConfig{ + align?: string; + animate?: any; + attributes?: { [key: string]: any; }; + borderless?: boolean; + click?: WebixCallback; + container?: HTMLElement; + content?: string|HTMLElement; + css?: string; + customRadio?: boolean; + disabled?: boolean; + gravity?: number; + height?: number; + hidden?: boolean; + hotkey?: string; + id?: string; + inputHeight?: number; + inputPadding?: number; + inputWidth?: number; + label?: string; + labelPosition?: string; + labelWidth?: number; + maxHeight?: number; + maxWidth?: number; + minHeight?: number; + minWidth?: number; + name?: string; + on?: any; + optionHeight?: number; + options?: any[]; + placeholder?: string; + popup?: any; + readonly?: boolean; + relatedAction?: string; + relatedView?: string; + required?: boolean; + suggest?: string|webix.ui.baseview; + tabFocus?: boolean; + template?: string|WebixCallback; + tooltip?: string; + type?: string; + validate?: boolean; + validateEvent?: string; + value?: string; + vertical?: boolean; + width?: number; +} +interface radio extends webix.ui.baseview{ + adjust():void; + attachEvent(type:string, functor:WebixCallback, id?:string):string; + bind(target:any, rule?:WebixCallback, format?:string):void; + blockEvent():void; + blur():void; + callEvent(name:string, params:any[]):boolean; + define(property:string, value:any):void; + destructor():void; + detachEvent(id:string):void; + disable():void; + enable():void; + focus():void; + getChildViews():any[]; + getFormView():webix.ui.baseview; + getInputNode():HTMLElement; + getNode():any; + getParentView():any; + getTopParentView():webix.ui.baseview; + getValue():string; + hasEvent(name:string):boolean; + hide():void; + isEnabled():boolean; + isVisible():boolean; + mapEvent(map:any):void; + refresh():void; + render(id:string, data:any, type:string):void; + resize():void; + setValue(value:string):void; + show(force?:boolean, animation?:boolean):void; + sync(source:any, filter:WebixCallback, silent:boolean):void; + unbind():void; + unblockEvent():void; + validate():boolean; + $getSize():any[]; + $getValue():string; + $height: number; + $render: WebixCallback; + $renderIcon: WebixCallback; + $renderInput(obj:any, html:string, id:string):string; + $renderLabel(config:any, id:string):string; + $scope: any; + $setSize(x:number, y:number):boolean; + $setValue(value:string):void; + $skin: any; + $view: HTMLElement; + $width: number; + config: radioConfig; + name: string; + on_click: WebixCallback; + touchable: any; +} +interface resizerConfig{ + animate?: any; + borderless?: boolean; + container?: HTMLElement; + css?: string; + disabled?: boolean; + gravity?: number; + height?: number; + hidden?: boolean; + id?: string; + maxHeight?: number; + maxWidth?: number; + minHeight?: number; + minWidth?: number; + mouseEventDelay?: number; + onClick?: { [key: string]: any; }; + onContext?: { [key: string]: any; }; + onDblClick?: WebixCallback; + onMouseMove?: WebixCallback; + width?: number; +} +interface resizer extends webix.ui.baseview{ + adjust():void; + bind(target:any, rule?:WebixCallback, format?:string):void; + define(property:string, value:any):void; + destructor():void; + disable():void; + enable():void; + getChildViews():any[]; + getFormView():webix.ui.baseview; + getNode():any; + getParentView():any; + getTopParentView():webix.ui.baseview; + hide():void; + isEnabled():boolean; + isVisible():boolean; + resize():void; + show(force?:boolean, animation?:boolean):void; + unbind():void; + $getSize():any[]; + $height: number; + $scope: any; + $setSize(x:number, y:number):boolean; + $skin: any; + $view: HTMLElement; + $width: number; + config: resizerConfig; + name: string; + on_click: WebixCallback; + on_context: { [key: string]: any; }; + on_dblclick: WebixCallback; + on_mouse_move: WebixCallback; +} +interface richselectConfig{ + align?: string; + animate?: any; + attributes?: { [key: string]: any; }; + borderless?: boolean; + click?: WebixCallback; + container?: HTMLElement; + content?: string|HTMLElement; + css?: string; + disabled?: boolean; + gravity?: number; + height?: number; + hidden?: boolean; + hotkey?: string; + icon?: string; + id?: string; + inputHeight?: number; + inputPadding?: number; + inputWidth?: number; + label?: string; + labelPosition?: string; + labelWidth?: number; + maxHeight?: number; + maxWidth?: number; + minHeight?: number; + minWidth?: number; + name?: string; + on?: any; + options?: any; + placeholder?: string; + popup?: any; + popupWidth?: number; + readonly?: boolean; + relatedAction?: string; + relatedView?: string; + required?: boolean; + suggest?: string|webix.ui.baseview; + tabFocus?: boolean; + template?: string|WebixCallback; + text?: string; + tooltip?: string; + type?: string; + validate?: boolean; + validateEvent?: string; + value?: string; + width?: number; +} +interface richselect extends webix.ui.baseview{ + adjust():void; + attachEvent(type:string, functor:WebixCallback, id?:string):string; + bind(target:any, rule?:WebixCallback, format?:string):void; + blockEvent():void; + blur():void; + callEvent(name:string, params:any[]):boolean; + define(property:string, value:any):void; + destructor():void; + detachEvent(id:string):void; + disable():void; + enable():void; + focus():void; + getChildViews():any[]; + getFormView():webix.ui.baseview; + getInputNode():HTMLElement; + getNode():any; + getParentView():any; + getPopup():webix.ui.baseview; + getText():string; + getTopParentView():webix.ui.baseview; + getValue():string; + hasEvent(name:string):boolean; + hide():void; + isEnabled():boolean; + isVisible():boolean; + mapEvent(map:any):void; + refresh():void; + render(id:string, data:any, type:string):void; + resize():void; + setValue(value:string):void; + show(force?:boolean, animation?:boolean):void; + sync(source:any, filter:WebixCallback, silent:boolean):void; + unbind():void; + unblockEvent():void; + validate():boolean; + $getSize():any[]; + $getValue():string; + $height: number; + $render: WebixCallback; + $renderIcon: WebixCallback; + $renderInput(obj:any, html:string, id:string):string; + $renderLabel(config:any, id:string):string; + $scope: any; + $setSize(x:number, y:number):boolean; + $setValue(value:string):void; + $skin: any; + $view: HTMLElement; + $width: number; + config: richselectConfig; + name: string; + on_click: WebixCallback; + touchable: any; +} +interface multitextConfig{ + align?: string; + animate?: any; + attributes?: { [key: string]: any; }; + borderless?: boolean; + click?: WebixCallback; + container?: HTMLElement; + content?: string|HTMLElement; + css?: string; + disabled?: boolean; + gravity?: number; + height?: number; + hidden?: boolean; + hotkey?: string; + icon?: string; + iconWidth?: string; + id?: string; + inputHeight?: number; + inputPadding?: number; + inputWidth?: number; + label?: string; + labelPosition?: string; + labelWidth?: number; + maxHeight?: number; + maxWidth?: number; + minHeight?: number; + minWidth?: number; + name?: string; + on?: any; + placeholder?: string; + popup?: any; + readonly?: boolean; + relatedAction?: string; + relatedView?: string; + required?: boolean; + separator?: string; + suggest?: string|webix.ui.baseview; + tabFocus?: boolean; + template?: string|WebixCallback; + tooltip?: string; + type?: string; + validate?: boolean; + validateEvent?: string; + value?: string; + width?: number; +} +interface multitext extends webix.ui.baseview{ + addSection():string|number; + adjust():void; + attachEvent(type:string, functor:WebixCallback, id?:string):string; + bind(target:any, rule?:WebixCallback, format?:string):void; + blockEvent():void; + blur():void; + callEvent(name:string, params:any[]):boolean; + define(property:string, value:any):void; + destructor():void; + detachEvent(id:string):void; + disable():void; + enable():void; + focus():void; + getChildViews():any[]; + getFormView():webix.ui.baseview; + getInputNode():HTMLElement; + getNode():any; + getParentView():any; + getTopParentView():webix.ui.baseview; + getValue():string; + getValueHere():string; + hasEvent(name:string):boolean; + hide():void; + isEnabled():boolean; + isVisible():boolean; + mapEvent(map:any):void; + refresh():void; + removeSection(id?:string|number):void; + render(id:string, data:any, type:string):void; + resize():void; + setValue(value:string):void; + setValueHere(value:string|number):void; + show(force?:boolean, animation?:boolean):void; + sync(source:any, filter:WebixCallback, silent:boolean):void; + unbind():void; + unblockEvent():void; + validate():boolean; + $cssName: string; + $getSize():any[]; + $getValue():string; + $height: number; + $render: WebixCallback; + $renderIcon: WebixCallback; + $renderInput(obj:any, html:string, id:string):string; + $renderLabel(config:any, id:string):string; + $scope: any; + $setSize(x:number, y:number):boolean; + $setValue(value:string):void; + $skin: any; + $view: HTMLElement; + $width: number; + config: multitextConfig; + name: string; + on_click: WebixCallback; + touchable: any; +} +interface multiselectConfig{ + align?: string; + animate?: any; + attributes?: { [key: string]: any; }; + borderless?: boolean; + click?: WebixCallback; + container?: HTMLElement; + content?: string|HTMLElement; + css?: string; + disabled?: boolean; + gravity?: number; + height?: number; + hidden?: boolean; + hotkey?: string; + icon?: string; + id?: string; + inputHeight?: number; + inputPadding?: number; + inputWidth?: number; + label?: string; + labelPosition?: string; + labelWidth?: number; + maxHeight?: number; + maxWidth?: number; + minHeight?: number; + minWidth?: number; + name?: string; + on?: any; + optionWidth?: number; + options?: any; + placeholder?: string; + popup?: any; + popupWidth?: number; + readonly?: boolean; + relatedAction?: string; + relatedView?: string; + required?: boolean; + separator?: string; + suggest?: string|webix.ui.baseview; + tabFocus?: boolean; + template?: string|WebixCallback; + text?: string; + tooltip?: string; + type?: string; + validate?: boolean; + validateEvent?: string; + value?: string; + width?: number; +} +interface multiselect extends webix.ui.baseview{ + adjust():void; + attachEvent(type:string, functor:WebixCallback, id?:string):string; + bind(target:any, rule?:WebixCallback, format?:string):void; + blockEvent():void; + blur():void; + callEvent(name:string, params:any[]):boolean; + define(property:string, value:any):void; + destructor():void; + detachEvent(id:string):void; + disable():void; + enable():void; + focus():void; + getChildViews():any[]; + getFormView():webix.ui.baseview; + getInputNode():HTMLElement; + getNode():any; + getParentView():any; + getPopup():webix.ui.baseview; + getText():string; + getTopParentView():webix.ui.baseview; + getValue():string; + hasEvent(name:string):boolean; + hide():void; + isEnabled():boolean; + isVisible():boolean; + mapEvent(map:any):void; + refresh():void; + render(id:string, data:any, type:string):void; + resize():void; + setValue(value:string):void; + show(force?:boolean, animation?:boolean):void; + sync(source:any, filter:WebixCallback, silent:boolean):void; + unbind():void; + unblockEvent():void; + validate():boolean; + $cssName: string; + $getSize():any[]; + $getValue():string; + $height: number; + $render: WebixCallback; + $renderIcon: WebixCallback; + $renderInput(obj:any, html:string, id:string):string; + $renderLabel(config:any, id:string):string; + $scope: any; + $setSize(x:number, y:number):boolean; + $setValue(value:string):void; + $skin: any; + $view: HTMLElement; + $width: number; + config: multiselectConfig; + name: string; + on_click: WebixCallback; + touchable: any; +} +interface scrollviewConfig{ + animate?: any; + body?: any; + borderless?: boolean; + container?: HTMLElement; + css?: string; + disabled?: boolean; + gravity?: number; + height?: number; + hidden?: boolean; + id?: string; + maxHeight?: number; + maxWidth?: number; + minHeight?: number; + minWidth?: number; + scroll?: boolean|string; + scrollSpeed?: string; + width?: number; +} +interface scrollview extends webix.ui.baseview{ + adjust():void; + bind(target:any, rule?:WebixCallback, format?:string):void; + define(property:string, value:any):void; + destructor():void; + disable():void; + enable():void; + getBody():any; + getChildViews():any[]; + getFormView():webix.ui.baseview; + getNode():any; + getParentView():any; + getScrollState():any; + getTopParentView():webix.ui.baseview; + hide():void; + isEnabled():boolean; + isVisible():boolean; + resize():void; + resizeChildren():void; + scrollTo(x:number, y:number):void; + show(force?:boolean, animation?:boolean):void; + showView(id:string):void; + unbind():void; + $getSize():any[]; + $height: number; + $scope: any; + $setSize(x:number, y:number):boolean; + $skin: any; + $view: HTMLElement; + $width: number; + config: scrollviewConfig; + name: string; +} +interface searchConfig{ + align?: string; + animate?: any; + attributes?: { [key: string]: any; }; + borderless?: boolean; + click?: WebixCallback; + container?: HTMLElement; + content?: string|HTMLElement; + css?: string; + disabled?: boolean; + gravity?: number; + height?: number; + hidden?: boolean; + hotkey?: string; + icon?: string; + id?: string; + inputHeight?: number; + inputPadding?: number; + inputWidth?: number; + label?: string; + labelPosition?: string; + labelWidth?: number; + maxHeight?: number; + maxWidth?: number; + minHeight?: number; + minWidth?: number; + name?: string; + on?: any; + placeholder?: string; + popup?: any; + readonly?: boolean; + relatedAction?: string; + relatedView?: string; + required?: boolean; + suggest?: string|webix.ui.baseview; + tabFocus?: boolean; + template?: string|WebixCallback; + tooltip?: string; + type?: string; + validate?: boolean; + validateEvent?: string; + value?: string; + width?: number; +} +interface search extends webix.ui.baseview{ + adjust():void; + attachEvent(type:string, functor:WebixCallback, id?:string):string; + bind(target:any, rule?:WebixCallback, format?:string):void; + blockEvent():void; + blur():void; + callEvent(name:string, params:any[]):boolean; + define(property:string, value:any):void; + destructor():void; + detachEvent(id:string):void; + disable():void; + enable():void; + focus():void; + getChildViews():any[]; + getFormView():webix.ui.baseview; + getInputNode():HTMLElement; + getNode():any; + getParentView():any; + getTopParentView():webix.ui.baseview; + getValue():string; + hasEvent(name:string):boolean; + hide():void; + isEnabled():boolean; + isVisible():boolean; + mapEvent(map:any):void; + refresh():void; + render(id:string, data:any, type:string):void; + resize():void; + setValue(value:string):void; + show(force?:boolean, animation?:boolean):void; + sync(source:any, filter:WebixCallback, silent:boolean):void; + unbind():void; + unblockEvent():void; + validate():boolean; + $getSize():any[]; + $getValue():string; + $height: number; + $render: WebixCallback; + $renderIcon: WebixCallback; + $renderInput(obj:any, html:string, id:string):string; + $renderLabel(config:any, id:string):string; + $scope: any; + $setSize(x:number, y:number):boolean; + $setValue(value:string):void; + $skin: any; + $view: HTMLElement; + $width: number; + config: searchConfig; + name: string; + on_click: WebixCallback; + touchable: any; +} +interface segmentedConfig{ + align?: string; + animate?: any; + attributes?: { [key: string]: any; }; + borderless?: boolean; + click?: WebixCallback; + container?: HTMLElement; + content?: string|HTMLElement; + css?: string; + disabled?: boolean; + gravity?: number; + height?: number; + hidden?: boolean; + hotkey?: string; + id?: string; + inputHeight?: number; + inputPadding?: number; + inputWidth?: number; + label?: string; + labelPosition?: string; + labelWidth?: number; + maxHeight?: number; + maxWidth?: number; + minHeight?: number; + minWidth?: number; + multiview?: boolean; + name?: string; + on?: any; + options?: any; + placeholder?: string; + popup?: any; + readonly?: boolean; + relatedAction?: string; + relatedView?: string; + required?: boolean; + suggest?: string|webix.ui.baseview; + tabFocus?: boolean; + template?: string|WebixCallback; + tooltip?: string; + type?: string; + validate?: boolean; + validateEvent?: string; + value?: string; + width?: number; +} +interface segmented extends webix.ui.baseview{ + addOption(id:string, value:any, show?:boolean, index?:number):void; + adjust():void; + attachEvent(type:string, functor:WebixCallback, id?:string):string; + bind(target:any, rule?:WebixCallback, format?:string):void; + blockEvent():void; + blur():void; + callEvent(name:string, params:any[]):boolean; + define(property:string, value:any):void; + destructor():void; + detachEvent(id:string):void; + disable():void; + enable():void; + focus():void; + getChildViews():any[]; + getFormView():webix.ui.baseview; + getInputNode():HTMLElement; + getNode():any; + getParentView():any; + getTopParentView():webix.ui.baseview; + getValue():string; + hasEvent(name:string):boolean; + hide():void; + isEnabled():boolean; + isVisible():boolean; + mapEvent(map:any):void; + optionIndex(ID:string):number; + refresh():void; + removeOption(id:string):void; + render(id:string, data:any, type:string):void; + resize():void; + setValue(value:string):void; + show(force?:boolean, animation?:boolean):void; + sync(source:any, filter:WebixCallback, silent:boolean):void; + unbind():void; + unblockEvent():void; + validate():boolean; + $getSize():any[]; + $getValue():string; + $height: number; + $render: WebixCallback; + $renderIcon: WebixCallback; + $renderInput(obj:any, html:string, id:string):string; + $renderLabel(config:any, id:string):string; + $scope: any; + $setSize(x:number, y:number):boolean; + $setValue(value:string):void; + $skin: any; + $view: HTMLElement; + $width: number; + config: segmentedConfig; + name: string; + on_click: WebixCallback; + touchable: any; +} +interface selectConfig{ + align?: string; + animate?: any; + attributes?: { [key: string]: any; }; + borderless?: boolean; + click?: WebixCallback; + container?: HTMLElement; + content?: string|HTMLElement; + css?: string; + disabled?: boolean; + gravity?: number; + height?: number; + hidden?: boolean; + hotkey?: string; + id?: string; + inputHeight?: number; + inputPadding?: number; + inputWidth?: number; + label?: string; + labelPosition?: string; + labelWidth?: number; + maxHeight?: number; + maxWidth?: number; + minHeight?: number; + minWidth?: number; + name?: string; + on?: any; + options?: any[]|string; + placeholder?: string; + popup?: any; + readonly?: boolean; + relatedAction?: string; + relatedView?: string; + required?: boolean; + suggest?: string|webix.ui.baseview; + tabFocus?: boolean; + template?: string|WebixCallback; + tooltip?: string; + type?: string; + validate?: boolean; + validateEvent?: string; + value?: string; + width?: number; +} +interface select extends webix.ui.baseview{ + adjust():void; + attachEvent(type:string, functor:WebixCallback, id?:string):string; + bind(target:any, rule?:WebixCallback, format?:string):void; + blockEvent():void; + blur():void; + callEvent(name:string, params:any[]):boolean; + define(property:string, value:any):void; + destructor():void; + detachEvent(id:string):void; + disable():void; + enable():void; + focus():void; + getChildViews():any[]; + getFormView():webix.ui.baseview; + getInputNode():HTMLElement; + getNode():any; + getParentView():any; + getTopParentView():webix.ui.baseview; + getValue():string; + hasEvent(name:string):boolean; + hide():void; + isEnabled():boolean; + isVisible():boolean; + mapEvent(map:any):void; + refresh():void; + render(id:string, data:any, type:string):void; + resize():void; + setValue(value:string):void; + show(force?:boolean, animation?:boolean):void; + sync(source:any, filter:WebixCallback, silent:boolean):void; + unbind():void; + unblockEvent():void; + validate():boolean; + $getSize():any[]; + $getValue():string; + $height: number; + $render: WebixCallback; + $renderIcon: WebixCallback; + $renderInput(obj:any, html:string, id:string):string; + $renderLabel(config:any, id:string):string; + $scope: any; + $setSize(x:number, y:number):boolean; + $setValue(value:string):void; + $skin: any; + $view: HTMLElement; + $width: number; + config: selectConfig; + name: string; + on_click: WebixCallback; + touchable: any; +} +interface sliderConfig{ + align?: string; + animate?: any; + attributes?: { [key: string]: any; }; + borderless?: boolean; + click?: WebixCallback; + container?: HTMLElement; + content?: string|HTMLElement; + css?: string; + disabled?: boolean; + gravity?: number; + height?: number; + hidden?: boolean; + hotkey?: string; + id?: string; + inputHeight?: number; + inputPadding?: number; + inputWidth?: number; + label?: string; + labelPosition?: string; + labelWidth?: number; + max?: any; + maxHeight?: number; + maxWidth?: number; + min?: number; + minHeight?: number; + minWidth?: number; + name?: string; + on?: any; + placeholder?: string; + popup?: any; + readonly?: boolean; + relatedAction?: string; + relatedView?: string; + required?: boolean; + step?: number; + suggest?: string|webix.ui.baseview; + tabFocus?: boolean; + template?: string|WebixCallback; + title?: string|WebixCallback; + tooltip?: string; + type?: string; + validate?: boolean; + validateEvent?: string; + value?: string; + width?: number; +} +interface slider extends webix.ui.baseview{ + adjust():void; + attachEvent(type:string, functor:WebixCallback, id?:string):string; + bind(target:any, rule?:WebixCallback, format?:string):void; + blockEvent():void; + blur():void; + callEvent(name:string, params:any[]):boolean; + define(property:string, value:any):void; + destructor():void; + detachEvent(id:string):void; + disable():void; + enable():void; + focus():void; + getChildViews():any[]; + getFormView():webix.ui.baseview; + getInputNode():HTMLElement; + getNode():any; + getParentView():any; + getTopParentView():webix.ui.baseview; + getValue():string; + hasEvent(name:string):boolean; + hide():void; + isEnabled():boolean; + isVisible():boolean; + mapEvent(map:any):void; + refresh():void; + render(id:string, data:any, type:string):void; + resize():void; + setValue(value:string):void; + show(force?:boolean, animation?:boolean):void; + sync(source:any, filter:WebixCallback, silent:boolean):void; + unbind():void; + unblockEvent():void; + validate():boolean; + $getSize():any[]; + $getValue():string; + $height: number; + $render: WebixCallback; + $renderIcon: WebixCallback; + $renderInput(obj:any, html:string, id:string):string; + $renderLabel(config:any, id:string):string; + $scope: any; + $setSize(x:number, y:number):boolean; + $setValue(value:string):void; + $skin: any; + $touchCapture: any; + $view: HTMLElement; + $width: number; + config: sliderConfig; + name: string; + on_click: WebixCallback; + touchable: any; +} +interface spacerConfig{ + animate?: any; + borderless?: boolean; + container?: HTMLElement; + css?: string; + disabled?: boolean; + gravity?: number; + height?: number; + hidden?: boolean; + id?: string; + maxHeight?: number; + maxWidth?: number; + minHeight?: number; + minWidth?: number; + width?: number; +} +interface spacer extends webix.ui.baseview{ + adjust():void; + bind(target:any, rule?:WebixCallback, format?:string):void; + define(property:string, value:any):void; + destructor():void; + disable():void; + enable():void; + getChildViews():any[]; + getFormView():webix.ui.baseview; + getNode():any; + getParentView():any; + getTopParentView():webix.ui.baseview; + hide():void; + isEnabled():boolean; + isVisible():boolean; + resize():void; + show(force?:boolean, animation?:boolean):void; + unbind():void; + $getSize():any[]; + $height: number; + $scope: any; + $setSize(x:number, y:number):boolean; + $skin: any; + $view: HTMLElement; + $width: number; + config: spacerConfig; + name: string; +} +interface submenuConfig{ + animate?: any; + autofit?: boolean; + autofocus?: boolean; + autoheight?: boolean; + autowidth?: boolean; + body?: string|webix.ui.baseview; + borderless?: boolean; + click?: string|WebixCallback; + clipboard?: boolean|string; + container?: HTMLElement; + css?: string; + data?: string|any[]; + dataFeed?: string|WebixCallback; + datathrottle?: number; + datatype?: string; + disabled?: boolean; + drag?: boolean|string; + dragscroll?: boolean|string; + externalData?: WebixCallback; + gravity?: number; + head?: any; + headHeight?: number; + height?: number; + hidden?: boolean; + id?: string; + layout?: string; + left?: number; + maxHeight?: number; + maxWidth?: number; + minHeight?: number; + minWidth?: number; + modal?: boolean; + mouseEventDelay?: number; + move?: boolean; + navigation?: boolean; + on?: any; + onClick?: { [key: string]: any; }; + onContext?: { [key: string]: any; }; + onDblClick?: WebixCallback; + onMouseMove?: WebixCallback; + padding?: any; + pager?: any; + position?: string|WebixCallback; + ready?: WebixCallback; + relative?: string; + removeMissed?: boolean; + rules?: any; + save?: string; + scheme?: any; + scroll?: boolean|string; + scrollSpeed?: string; + select?: boolean|string; + subMenuPos?: string; + submenu?: any; + template?: string|WebixCallback; + templateCopy?: WebixCallback; + tooltip?: any; + top?: number; + type?: any; + url?: string; + width?: number; + xCount?: number; + yCount?: number; + zIndex?: number; +} +interface submenu extends webix.ui.baseview{ + add(obj:any, index?:number):string; + addCss(id:string|number, css:string, silent?:boolean):void; + adjust():void; + attachEvent(type:string, functor:WebixCallback, id?:string):string; + bind(target:any, rule?:WebixCallback, format?:string):void; + blockEvent():void; + callEvent(name:string, params:any[]):boolean; + clearAll():void; + clearCss(css:string, silent?:boolean):void; + clearValidation():void; + close():void; + copy(sid:string, tindex:number, tobj?:any, details?:any):void; + count():number; + customize(obj:any):void; + define(property:string, value:any):void; + destructor():void; + detachEvent(id:string):void; + disable():void; + disableItem(id:string):void; + enable():void; + enableItem(id:string):void; + exists(id:string):boolean; + filter(text:string|WebixTemplate|WebixCallback, value:string, preserve:boolean):void; + getBody():any; + getChildViews():any[]; + getFirstId():string; + getFormView():webix.ui.baseview; + getHead():any; + getIdByIndex(index:number):string; + getIndexById(id:string):number; + getItem(id:string):any; + getItemNode(id:string):void; + getLastId():string; + getMenu(id:string|number):any; + getMenuItem(id:string):any; + getNextId(id:string, step:number):string; + getNode():any; + getPage():number; + getPager():any; + getParentView():any; + getPrevId(id:string, step:number):string; + getScrollState():any; + getSelectedId(as_array:boolean):string|any[]; + getSelectedItem(as_array?:boolean):any; + getSubMenu(id:string|number):any; + getTopMenu():any; + getTopParentView():webix.ui.baseview; + getVisibleCount():number; + hasCss(id:string, css:string):boolean; + hasEvent(name:string):boolean; + hide():void; + hideItem(id:string):void; + isEnabled():boolean; + isSelected(id:string):boolean; + isVisible():boolean; + load(url:string, type?:string, callback?:WebixCallback):PromisedData; + loadNext(count:number, start:number, callback:WebixCallback, url:string, now:boolean):void; + locate(e:Event):string; + mapEvent(map:any):void; + move(sid:string, tindex:number, tobj?:any, details?:any):string; + moveBottom(id:string):void; + moveDown(id:string, step:number):void; + moveSelection(direction:string):void; + moveTop(id:string):void; + moveUp(id:string, step:number):void; + parse(data:any, type:string):void; + refresh(id?:string):void; + remove(id:string):void; + removeCss(id:string|number, css:string, silent?:boolean):void; + render(id:string, data:any, type:string):void; + resize():void; + resizeChildren():void; + scrollTo(x:number, y:number):void; + select(id:string|any[], preserve:boolean):void; + selectAll(from?:string, to?:string):void; + serialize():any; + setPage(page:number):void; + setPosition(x:number, y:number):void; + show(force?:boolean, animation?:boolean):void; + showItem(id:string):void; + sort(by:string, dir?:string, as?:string):void; + sync(source:any, filter:WebixCallback, silent:boolean):void; + unbind():void; + unblockEvent():void; + unselect(id?:string):void; + unselectAll():void; + updateItem(id:string, data:any):void; + validate(id?:string):boolean; + $drag(source:HTMLElement, ev:Event):string; + $dragHTML: WebixCallback; + $dragIn(source:HTMLElement, target:HTMLElement, ev:Event):HTMLElement; + $dragMark(context:any, ev:Event):boolean; + $dragOut(source:HTMLElement, old_target:HTMLElement, new_target:HTMLElement, ev:Event):void; + $drop(source:HTMLElement, target:HTMLElement, ev:any):void; + $dropAllow: WebixCallback; + $getSize():any[]; + $height: number; + $scope: any; + $setSize(x:number, y:number):boolean; + $skin: any; + $view: HTMLElement; + $width: number; + config: submenuConfig; + name: string; + on_click: WebixCallback; + on_context: { [key: string]: any; }; + on_dblclick: WebixCallback; + on_mouse_move: WebixCallback; + type: { [key: string]: any; }; + types: { [key: string]: any; }; +} +interface suggestConfig{ + animate?: any; + autofit?: boolean; + autofocus?: boolean; + body?: string|webix.ui.baseview; + borderless?: boolean; + container?: HTMLElement; + css?: string; + disabled?: boolean; + filter?: WebixCallback; + fitMaster?: boolean; + gravity?: number; + head?: any; + headHeight?: number; + height?: number; + hidden?: boolean; + id?: string; + input?: any; + keyPressTimeout?: number; + left?: number; + master?: webix.ui.baseview; + maxHeight?: number; + maxWidth?: number; + minHeight?: number; + minWidth?: number; + modal?: boolean; + move?: boolean; + on?: any; + padding?: any; + position?: string|WebixCallback; + relative?: string; + template?: string|WebixTemplate; + textValue?: string; + top?: number; + type?: string; + width?: number; + zIndex?: number; +} +interface suggest extends webix.ui.baseview{ + adjust():void; + attachEvent(type:string, functor:WebixCallback, id?:string):string; + bind(target:any, rule?:WebixCallback, format?:string):void; + blockEvent():void; + callEvent(name:string, params:any[]):boolean; + close():void; + define(property:string, value:any):void; + destructor():void; + detachEvent(id:string):void; + disable():void; + enable():void; + getBody():any; + getChildViews():any[]; + getFormView():webix.ui.baseview; + getHead():any; + getItemText(id:string):string; + getList():webix.ui.baseview; + getMasterValue():any; + getNode():any; + getParentView():any; + getSuggestion():string; + getTopParentView():webix.ui.baseview; + getValue():string|number; + hasEvent(name:string):boolean; + hide():void; + isEnabled():boolean; + isVisible():boolean; + linkInput(input:HTMLElement):void; + mapEvent(map:any):void; + resize():void; + resizeChildren():void; + setMasterValue(value:any):void; + setPosition(x:number, y:number):void; + setValue(value:string|number):void; + show(force?:boolean, animation?:boolean):void; + unbind():void; + unblockEvent():void; + $getSize():any[]; + $height: number; + $scope: any; + $setSize(x:number, y:number):boolean; + $skin: any; + $view: HTMLElement; + $width: number; + config: suggestConfig; + name: string; +} +interface multisuggestConfig{ + animate?: any; + autofit?: boolean; + autofocus?: boolean; + body?: string|webix.ui.baseview; + borderless?: boolean; + buttonText?: string; + container?: HTMLElement; + css?: string; + disabled?: boolean; + filter?: WebixCallback; + fitMaster?: boolean; + gravity?: number; + head?: any; + headHeight?: number; + height?: number; + hidden?: boolean; + id?: string; + input?: any; + keyPressTimeout?: number; + left?: number; + master?: webix.ui.baseview; + maxHeight?: number; + maxWidth?: number; + minHeight?: number; + minWidth?: number; + modal?: boolean; + move?: boolean; + on?: any; + padding?: any; + position?: string|WebixCallback; + relative?: string; + separator?: string; + template?: string|WebixTemplate; + textValue?: string; + top?: number; + type?: string; + width?: number; + zIndex?: number; +} +interface multisuggest extends webix.ui.baseview{ + adjust():void; + attachEvent(type:string, functor:WebixCallback, id?:string):string; + bind(target:any, rule?:WebixCallback, format?:string):void; + blockEvent():void; + callEvent(name:string, params:any[]):boolean; + close():void; + define(property:string, value:any):void; + destructor():void; + detachEvent(id:string):void; + disable():void; + enable():void; + getBody():any; + getButton():webix.ui.baseview; + getChildViews():any[]; + getFormView():webix.ui.baseview; + getHead():any; + getItemText(id:string):string; + getList():webix.ui.baseview; + getMasterValue():any; + getNode():any; + getParentView():any; + getSuggestion():string; + getTopParentView():webix.ui.baseview; + getValue():string|number; + hasEvent(name:string):boolean; + hide():void; + isEnabled():boolean; + isVisible():boolean; + linkInput(input:HTMLElement):void; + mapEvent(map:any):void; + resize():void; + resizeChildren():void; + setMasterValue(value:any):void; + setPosition(x:number, y:number):void; + setValue(value:string|number):void; + show(force?:boolean, animation?:boolean):void; + unbind():void; + unblockEvent():void; + $getSize():any[]; + $height: number; + $scope: any; + $setSize(x:number, y:number):boolean; + $skin: any; + $view: HTMLElement; + $width: number; + config: multisuggestConfig; + name: string; +} +interface datasuggestConfig{ + animate?: any; + autofit?: boolean; + autofocus?: boolean; + body?: string|webix.ui.baseview; + borderless?: boolean; + container?: HTMLElement; + css?: string; + disabled?: boolean; + filter?: WebixCallback; + fitMaster?: boolean; + gravity?: number; + head?: any; + headHeight?: number; + height?: number; + hidden?: boolean; + id?: string; + input?: any; + keyPressTimeout?: number; + left?: number; + master?: webix.ui.baseview; + maxHeight?: number; + maxWidth?: number; + minHeight?: number; + minWidth?: number; + modal?: boolean; + move?: boolean; + on?: any; + padding?: any; + position?: string|WebixCallback; + relative?: string; + template?: string|WebixTemplate; + textValue?: string; + top?: number; + type?: string; + width?: number; + zIndex?: number; +} +interface datasuggest extends webix.ui.baseview{ + adjust():void; + attachEvent(type:string, functor:WebixCallback, id?:string):string; + bind(target:any, rule?:WebixCallback, format?:string):void; + blockEvent():void; + callEvent(name:string, params:any[]):boolean; + close():void; + define(property:string, value:any):void; + destructor():void; + detachEvent(id:string):void; + disable():void; + enable():void; + getBody():any; + getChildViews():any[]; + getFormView():webix.ui.baseview; + getHead():any; + getItemText(id:string):string; + getList():webix.ui.baseview; + getMasterValue():any; + getNode():any; + getParentView():any; + getSuggestion():string; + getTopParentView():webix.ui.baseview; + getValue():string|number; + hasEvent(name:string):boolean; + hide():void; + isEnabled():boolean; + isVisible():boolean; + linkInput(input:HTMLElement):void; + mapEvent(map:any):void; + resize():void; + resizeChildren():void; + setMasterValue(value:any):void; + setPosition(x:number, y:number):void; + setValue(value:string|number):void; + show(force?:boolean, animation?:boolean):void; + unbind():void; + unblockEvent():void; + $getSize():any[]; + $height: number; + $scope: any; + $setSize(x:number, y:number):boolean; + $skin: any; + $view: HTMLElement; + $width: number; + config: datasuggestConfig; + name: string; +} +interface gridsuggestConfig{ + animate?: any; + autofit?: boolean; + autofocus?: boolean; + body?: string|webix.ui.baseview; + borderless?: boolean; + container?: HTMLElement; + css?: string; + disabled?: boolean; + filter?: WebixCallback; + fitMaster?: boolean; + gravity?: number; + head?: any; + headHeight?: number; + height?: number; + hidden?: boolean; + id?: string; + input?: any; + keyPressTimeout?: number; + left?: number; + master?: webix.ui.baseview; + maxHeight?: number; + maxWidth?: number; + minHeight?: number; + minWidth?: number; + modal?: boolean; + move?: boolean; + on?: any; + padding?: any; + position?: string|WebixCallback; + relative?: string; + template?: string|WebixTemplate; + textValue?: string; + top?: number; + type?: string; + width?: number; + zIndex?: number; +} +interface gridsuggest extends webix.ui.baseview{ + adjust():void; + attachEvent(type:string, functor:WebixCallback, id?:string):string; + bind(target:any, rule?:WebixCallback, format?:string):void; + blockEvent():void; + callEvent(name:string, params:any[]):boolean; + close():void; + define(property:string, value:any):void; + destructor():void; + detachEvent(id:string):void; + disable():void; + enable():void; + getBody():any; + getChildViews():any[]; + getFormView():webix.ui.baseview; + getHead():any; + getItemText(id:string):string; + getList():webix.ui.baseview; + getMasterValue():any; + getNode():any; + getParentView():any; + getSuggestion():string; + getTopParentView():webix.ui.baseview; + getValue():string|number; + hasEvent(name:string):boolean; + hide():void; + isEnabled():boolean; + isVisible():boolean; + linkInput(input:HTMLElement):void; + mapEvent(map:any):void; + resize():void; + resizeChildren():void; + setMasterValue(value:any):void; + setPosition(x:number, y:number):void; + setValue(value:string|number):void; + show(force?:boolean, animation?:boolean):void; + unbind():void; + unblockEvent():void; + $getSize():any[]; + $height: number; + $scope: any; + $setSize(x:number, y:number):boolean; + $skin: any; + $view: HTMLElement; + $width: number; + config: gridsuggestConfig; + name: string; +} +interface tabbarConfig{ + align?: string; + animate?: any; + attributes?: { [key: string]: any; }; + borderless?: boolean; + bottomOffset?: number; + click?: WebixCallback; + container?: HTMLElement; + content?: string|HTMLElement; + css?: string; + disabled?: boolean; + gravity?: number; + height?: number; + hidden?: boolean; + hotkey?: string; + id?: string; + inputHeight?: number; + inputPadding?: number; + inputWidth?: number; + label?: string; + labelPosition?: string; + labelWidth?: number; + maxHeight?: number; + maxWidth?: number; + minHeight?: number; + minWidth?: number; + moreTemplate?: WebixCallback; + multiview?: boolean; + name?: string; + on?: any; + options?: any; + placeholder?: string; + popup?: any; + popupTemplate?: WebixCallback; + popupWidth?: number; + readonly?: boolean; + relatedAction?: string; + relatedView?: string; + required?: boolean; + suggest?: string|webix.ui.baseview; + tabFocus?: boolean; + tabMargin?: number; + tabMinWidth?: number; + tabMoreWidth?: number; + tabOffset?: number; + tabbarPopup?: webix.ui.baseview; + template?: string|WebixCallback; + tooltip?: string; + topOffset?: number; + type?: string; + validate?: boolean; + validateEvent?: string; + value?: string; + width?: number; + yCount?: number; +} +interface tabbar extends webix.ui.baseview{ + addOption(id:string, value:any, show?:boolean, index?:number):void; + adjust():void; + attachEvent(type:string, functor:WebixCallback, id?:string):string; + bind(target:any, rule?:WebixCallback, format?:string):void; + blockEvent():void; + blur():void; + callEvent(name:string, params:any[]):boolean; + define(property:string, value:any):void; + destructor():void; + detachEvent(id:string):void; + disable():void; + enable():void; + focus():void; + getChildViews():any[]; + getFormView():webix.ui.baseview; + getInputNode():HTMLElement; + getNode():any; + getParentView():any; + getPopup():webix.ui.baseview; + getTopParentView():webix.ui.baseview; + getValue():string; + hasEvent(name:string):boolean; + hide():void; + isEnabled():boolean; + isVisible():boolean; + mapEvent(map:any):void; + optionIndex(ID:string):number; + refresh():void; + removeOption(id:string):void; + render(id:string, data:any, type:string):void; + resize():void; + setValue(value:string):void; + show(force?:boolean, animation?:boolean):void; + sync(source:any, filter:WebixCallback, silent:boolean):void; + unbind():void; + unblockEvent():void; + validate():boolean; + $getSize():any[]; + $getValue():string; + $height: number; + $render: WebixCallback; + $renderIcon: WebixCallback; + $renderInput(obj:any, html:string, id:string):string; + $renderLabel(config:any, id:string):string; + $scope: any; + $setSize(x:number, y:number):boolean; + $setValue(value:string):void; + $skin: any; + $view: HTMLElement; + $width: number; + config: tabbarConfig; + name: string; + on_click: WebixCallback; + touchable: any; +} +interface tabviewConfig{ + animate?: any; + borderless?: boolean; + cells?: any[]; + cols?: any[]; + container?: HTMLElement; + css?: string; + disabled?: boolean; + gravity?: number; + height?: number; + hidden?: boolean; + id?: string; + isolate?: boolean; + margin?: number; + maxHeight?: number; + maxWidth?: number; + minHeight?: number; + minWidth?: number; + multiview?: any; + on?: any; + padding?: number; + paddingX?: number; + paddingY?: number; + responsive?: string; + rows?: any[]; + tabbar?: any; + type?: string; + visibleBatch?: string; + width?: number; +} +interface tabview extends webix.ui.baseview{ + addView(view:any, index?:number):webix.ui.baseview; + adjust():void; + attachEvent(type:string, functor:WebixCallback, id?:string):string; + bind(target:any, rule?:WebixCallback, format?:string):void; + blockEvent():void; + callEvent(name:string, params:any[]):boolean; + define(property:string, value:any):void; + destructor():void; + detachEvent(id:string):void; + disable():void; + enable():void; + getChildViews():any[]; + getFormView():webix.ui.baseview; + getMultiview():any; + getNode():any; + getParentView():any; + getTabbar():any; + getTopParentView():webix.ui.baseview; + getValue():string; + hasEvent(name:string):boolean; + hide():void; + index(obj:any):number; + isEnabled():boolean; + isVisible():boolean; + mapEvent(map:any):void; + reconstruct():void; + removeView(id:string):void; + resize():void; + resizeChildren():void; + setValue(value:string):void; + show(force?:boolean, animation?:boolean):void; + showBatch(name:string):void; + unbind():void; + unblockEvent():void; + $getSize():any[]; + $height: number; + $setSize(x:number, y:number):boolean; + $skin: any; + $view: HTMLElement; + $width: number; + config: tabviewConfig; + name: string; +} +interface templateConfig{ + animate?: any; + autoheight?: any; + borderless?: boolean; + container?: HTMLElement; + content?: string|HTMLElement; + css?: string; + data?: string|any[]; + dataFeed?: string|WebixCallback; + datatype?: string; + disabled?: boolean; + gravity?: number; + height?: number; + hidden?: boolean; + id?: string; + maxHeight?: number; + maxWidth?: number; + minHeight?: number; + minWidth?: number; + on?: any; + onClick?: { [key: string]: any; }; + scroll?: boolean|string; + scrollSpeed?: string; + src?: string; + template?: string|WebixCallback; + type?: string; + url?: string; + width?: number; +} +interface template extends webix.ui.baseview{ + adjust():void; + attachEvent(type:string, functor:WebixCallback, id?:string):string; + bind(target:any, rule?:WebixCallback, format?:string):void; + blockEvent():void; + callEvent(name:string, params:any[]):boolean; + define(property:string, value:any):void; + destructor():void; + detachEvent(id:string):void; + disable():void; + enable():void; + getChildViews():any[]; + getFormView():webix.ui.baseview; + getNode():any; + getParentView():any; + getScrollState():any; + getTopParentView():webix.ui.baseview; + hasEvent(name:string):boolean; + hide():void; + isEnabled():boolean; + isVisible():boolean; + load(url:string, type?:string, callback?:WebixCallback):PromisedData; + mapEvent(map:any):void; + parse(data:any, type:string):void; + refresh():void; + render(id:string, data:any, type:string):void; + resize():void; + scrollTo(x:number, y:number):void; + setContent(node:any):void; + setHTML(html:string):void; + setValues(obj:any, update?:boolean):void; + show(force?:boolean, animation?:boolean):void; + sync(source:any, filter:WebixCallback, silent:boolean):void; + unbind():void; + unblockEvent():void; + $getSize():any[]; + $height: number; + $scope: any; + $setSize(x:number, y:number):boolean; + $skin: any; + $view: HTMLElement; + $width: number; + config: templateConfig; + name: string; +} +interface textConfig{ + align?: string; + animate?: any; + attributes?: { [key: string]: any; }; + borderless?: boolean; + click?: WebixCallback; + container?: HTMLElement; + content?: string|HTMLElement; + css?: string; + disabled?: boolean; + gravity?: number; + height?: number; + hidden?: boolean; + hotkey?: string; + id?: string; + inputHeight?: number; + inputPadding?: number; + inputWidth?: number; + label?: string; + labelPosition?: string; + labelWidth?: number; + maxHeight?: number; + maxWidth?: number; + minHeight?: number; + minWidth?: number; + name?: string; + on?: any; + placeholder?: string; + popup?: any; + readonly?: boolean; + relatedAction?: string; + relatedView?: string; + required?: boolean; + suggest?: string|webix.ui.baseview; + tabFocus?: boolean; + template?: string|WebixCallback; + tooltip?: string; + type?: string; + validate?: boolean; + validateEvent?: string; + value?: string; + width?: number; +} +interface text extends webix.ui.baseview{ + adjust():void; + attachEvent(type:string, functor:WebixCallback, id?:string):string; + bind(target:any, rule?:WebixCallback, format?:string):void; + blockEvent():void; + blur():void; + callEvent(name:string, params:any[]):boolean; + define(property:string, value:any):void; + destructor():void; + detachEvent(id:string):void; + disable():void; + enable():void; + focus():void; + getChildViews():any[]; + getFormView():webix.ui.baseview; + getInputNode():HTMLElement; + getNode():any; + getParentView():any; + getTopParentView():webix.ui.baseview; + getValue():string; + hasEvent(name:string):boolean; + hide():void; + isEnabled():boolean; + isVisible():boolean; + mapEvent(map:any):void; + refresh():void; + render(id:string, data:any, type:string):void; + resize():void; + setValue(value:string):void; + show(force?:boolean, animation?:boolean):void; + sync(source:any, filter:WebixCallback, silent:boolean):void; + unbind():void; + unblockEvent():void; + validate():boolean; + $getSize():any[]; + $getValue():string; + $height: number; + $render: WebixCallback; + $renderIcon: WebixCallback; + $renderInput(obj:any, html:string, id:string):string; + $renderLabel(config:any, id:string):string; + $scope: any; + $setSize(x:number, y:number):boolean; + $setValue(value:string):void; + $skin: any; + $view: HTMLElement; + $width: number; + config: textConfig; + name: string; + on_click: WebixCallback; + touchable: any; +} +interface textareaConfig{ + align?: string; + animate?: any; + attributes?: { [key: string]: any; }; + borderless?: boolean; + click?: WebixCallback; + container?: HTMLElement; + content?: string|HTMLElement; + css?: string; + disabled?: boolean; + gravity?: number; + height?: number; + hidden?: boolean; + hotkey?: string; + id?: string; + inputHeight?: number; + inputPadding?: number; + inputWidth?: number; + label?: string; + labelPosition?: string; + labelWidth?: number; + maxHeight?: number; + maxWidth?: number; + minHeight?: number; + minWidth?: number; + name?: string; + on?: any; + placeholder?: string; + popup?: any; + readonly?: boolean; + relatedAction?: string; + relatedView?: string; + required?: boolean; + suggest?: string|webix.ui.baseview; + tabFocus?: boolean; + template?: string|WebixCallback; + tooltip?: string; + type?: string; + validate?: boolean; + validateEvent?: string; + value?: string; + width?: number; +} +interface textarea extends webix.ui.baseview{ + adjust():void; + attachEvent(type:string, functor:WebixCallback, id?:string):string; + bind(target:any, rule?:WebixCallback, format?:string):void; + blockEvent():void; + blur():void; + callEvent(name:string, params:any[]):boolean; + define(property:string, value:any):void; + destructor():void; + detachEvent(id:string):void; + disable():void; + enable():void; + focus():void; + getChildViews():any[]; + getFormView():webix.ui.baseview; + getInputNode():HTMLElement; + getNode():any; + getParentView():any; + getTopParentView():webix.ui.baseview; + getValue():string; + hasEvent(name:string):boolean; + hide():void; + isEnabled():boolean; + isVisible():boolean; + mapEvent(map:any):void; + refresh():void; + render(id:string, data:any, type:string):void; + resize():void; + setValue(value:string):void; + show(force?:boolean, animation?:boolean):void; + sync(source:any, filter:WebixCallback, silent:boolean):void; + unbind():void; + unblockEvent():void; + validate():boolean; + $getSize():any[]; + $getValue():string; + $height: number; + $render: WebixCallback; + $renderIcon: WebixCallback; + $renderInput(obj:any, html:string, id:string):string; + $renderLabel(config:any, id:string):string; + $scope: any; + $setSize(x:number, y:number):boolean; + $setValue(value:string):void; + $skin: any; + $view: HTMLElement; + $width: number; + config: textareaConfig; + name: string; + on_click: WebixCallback; + touchable: any; +} +interface toggleConfig{ + align?: string; + animate?: any; + borderless?: boolean; + click?: WebixCallback; + container?: HTMLElement; + content?: string|HTMLElement; + css?: string; + disabled?: boolean; + gravity?: number; + height?: number; + hidden?: boolean; + hotkey?: string; + id?: string; + inputHeight?: number; + inputWidth?: number; + label?: string; + labelPosition?: string; + maxHeight?: number; + maxWidth?: number; + minHeight?: number; + minWidth?: number; + name?: string; + on?: any; + placeholder?: any; + popup?: any; + tabFocus?: boolean; + template?: string|WebixCallback; + tooltip?: string; + type?: string; + value?: string; + width?: number; +} +interface toggle extends webix.ui.baseview{ + adjust():void; + attachEvent(type:string, functor:WebixCallback, id?:string):string; + bind(target:any, rule?:WebixCallback, format?:string):void; + blockEvent():void; + blur():void; + callEvent(name:string, params:any[]):boolean; + define(property:string, value:any):void; + destructor():void; + detachEvent(id:string):void; + disable():void; + enable():void; + focus():void; + getChildViews():any[]; + getFormView():webix.ui.baseview; + getInputNode():HTMLElement; + getNode():any; + getParentView():any; + getTopParentView():webix.ui.baseview; + getValue():string; + hasEvent(name:string):boolean; + hide():void; + isEnabled():boolean; + isVisible():boolean; + mapEvent(map:any):void; + refresh():void; + render(id:string, data:any, type:string):void; + resize():void; + setValue(value:string):void; + show(force?:boolean, animation?:boolean):void; + sync(source:any, filter:WebixCallback, silent:boolean):void; + toggle():void; + unbind():void; + unblockEvent():void; + $getSize():any[]; + $getValue():string; + $height: number; + $scope: any; + $setSize(x:number, y:number):boolean; + $setValue(value:string):void; + $skin: any; + $view: HTMLElement; + $width: number; + config: toggleConfig; + name: string; + on_click: WebixCallback; + touchable: any; +} +interface toolbarConfig{ + animate?: any; + borderless?: boolean; + cols?: any[]; + container?: HTMLElement; + css?: string; + data?: string|any[]; + dataFeed?: string|WebixCallback; + datatype?: string; + disabled?: boolean; + elements?: any[]; + elementsConfig?: { [key: string]: any; }; + gravity?: number; + height?: number; + hidden?: boolean; + id?: string; + isolate?: boolean; + margin?: number; + maxHeight?: number; + maxWidth?: number; + minHeight?: number; + minWidth?: number; + on?: any; + padding?: number; + paddingX?: number; + paddingY?: number; + responsive?: string; + rows?: any[]; + rules?: any; + scroll?: boolean|string; + scrollSpeed?: string; + type?: string; + url?: string; + visibleBatch?: string; + width?: number; +} +interface toolbar extends webix.ui.baseview{ + addView(view:any, index?:number):webix.ui.baseview; + adjust():void; + attachEvent(type:string, functor:WebixCallback, id?:string):string; + bind(target:any, rule?:WebixCallback, format?:string):void; + blockEvent():void; + callEvent(name:string, params:any[]):boolean; + clear():void; + clearValidation():void; + define(property:string, value:any):void; + destructor():void; + detachEvent(id:string):void; + disable():void; + enable():void; + focus(item:string):void; + getChildViews():any[]; + getCleanValues():any; + getDirtyValues():any; + getFormView():webix.ui.baseview; + getNode():any; + getParentView():any; + getScrollState():any; + getTopParentView():webix.ui.baseview; + getValues(details?:any):any[]; + hasEvent(name:string):boolean; + hide():void; + index(obj:any):number; + isDirty():boolean; + isEnabled():boolean; + isVisible():boolean; + load(url:string, type?:string, callback?:WebixCallback):PromisedData; + mapEvent(map:any):void; + parse(data:any, type:string):void; + reconstruct():void; + refresh():void; + removeView(id:string):void; + render(id:string, data:any, type:string):void; + resize():void; + resizeChildren():void; + scrollTo(x:number, y:number):void; + setDirty(mark?:boolean):void; + setValues(values:any, update?:boolean):void; + show(force?:boolean, animation?:boolean):void; + showBatch(name:string):void; + unbind():void; + unblockEvent():void; + validate():boolean; + $getSize():any[]; + $height: number; + $setSize(x:number, y:number):boolean; + $skin: any; + $view: HTMLElement; + $width: number; + config: toolbarConfig; + name: string; +} +interface tooltipConfig{ + animate?: any; + borderless?: boolean; + container?: HTMLElement; + content?: string|HTMLElement; + css?: string; + disabled?: boolean; + dx?: number; + dy?: number; + gravity?: number; + height?: number; + hidden?: boolean; + id?: string; + maxHeight?: number; + maxWidth?: number; + minHeight?: number; + minWidth?: number; + on?: any; + template?: string|WebixCallback; + width?: number; +} +interface tooltip extends webix.ui.baseview{ + adjust():void; + attachEvent(type:string, functor:WebixCallback, id?:string):string; + bind(target:any, rule?:WebixCallback, format?:string):void; + blockEvent():void; + callEvent(name:string, params:any[]):boolean; + customize(obj:any):void; + define(property:string, value:any):void; + destructor():void; + detachEvent(id:string):void; + disable():void; + enable():void; + getChildViews():any[]; + getFormView():webix.ui.baseview; + getNode():any; + getParentView():any; + getTopParentView():webix.ui.baseview; + hasEvent(name:string):boolean; + hide():void; + isEnabled():boolean; + isVisible():boolean; + mapEvent(map:any):void; + render(id:string, data:any, type:string):void; + resize():void; + show(force?:boolean, animation?:boolean):void; + sync(source:any, filter:WebixCallback, silent:boolean):void; + unbind():void; + unblockEvent():void; + $getSize():any[]; + $height: number; + $scope: any; + $setSize(x:number, y:number):boolean; + $skin: any; + $view: HTMLElement; + $width: number; + config: tooltipConfig; + name: string; + type: { [key: string]: any; }; +} +interface treeConfig{ + animate?: any; + borderless?: boolean; + click?: string|WebixCallback; + clipboard?: boolean|string; + container?: HTMLElement; + css?: string; + data?: string|any[]; + dataFeed?: string|WebixCallback; + datathrottle?: number; + datatype?: string; + disabled?: boolean; + drag?: boolean; + dragscroll?: boolean|string; + filterMode?: any; + gravity?: number; + height?: number; + hidden?: boolean; + id?: string; + maxHeight?: number; + maxWidth?: number; + minHeight?: number; + minWidth?: number; + mouseEventDelay?: number; + navigation?: boolean; + on?: any; + onClick?: { [key: string]: any; }; + onContext?: { [key: string]: any; }; + onDblClick?: WebixCallback; + onMouseMove?: WebixCallback; + pager?: any; + ready?: WebixCallback; + removeMissed?: boolean; + rules?: any; + save?: string; + scheme?: any; + scroll?: boolean|string; + scrollSpeed?: string; + select?: boolean; + template?: string|WebixCallback; + templateCopy?: WebixCallback; + threeState?: boolean; + tooltip?: any; + type?: any; + url?: string; + width?: number; +} +interface tree extends webix.ui.baseview{ + add(obj:any, index?:number):string; + addCss(id:string|number, css:string, silent?:boolean):void; + adjust():void; + attachEvent(type:string, functor:WebixCallback, id?:string):string; + bind(target:any, rule?:WebixCallback, format?:string):void; + blockEvent():void; + callEvent(name:string, params:any[]):boolean; + checkAll(id?:string):void; + checkItem(id:string):void; + clearAll():void; + clearCss(css:string, silent?:boolean):void; + clearValidation():void; + close(id:string):void; + closeAll():void; + copy(sid:string, tindex:number, tobj?:webix.ui.baseview, details?:any):string; + count():number; + customize(obj:any):void; + define(property:string, value:any):void; + destructor():void; + detachEvent(id:string):void; + disable():void; + enable():void; + exists(id:string):boolean; + filter(text:string|WebixTemplate|WebixCallback, value:string, preserve:boolean):void; + getBranchIndex(id:string, parent?:string):number; + getChecked():any[]; + getChildViews():any[]; + getFirstChildId(id:string):string; + getFirstId():string; + getFormView():webix.ui.baseview; + getIdByIndex(index:number):string; + getIndexById(id:string):number; + getItem(id:string):any; + getItemNode(id:string):void; + getLastId():string; + getNextId(id:string, step:number):string; + getNextSiblingId(id:any):string; + getNode():any; + getOpenItems():any[]; + getParentId(id:string):string; + getParentView():any; + getPrevId(id:string, step:number):string; + getPrevSiblingId(id:any):string; + getScrollState():any; + getSelectedId(as_array:boolean):string|any[]; + getSelectedItem(as_array?:boolean):any; + getState():any; + getTopParentView():webix.ui.baseview; + group(config:any, mode:boolean):void; + hasCss(id:string, css:string):boolean; + hasEvent(name:string):boolean; + hide():void; + isBranch(id:string):boolean; + isBranchOpen(id:string):boolean; + isChecked(id:string):boolean; + isEnabled():boolean; + isSelected(id:string):boolean; + isVisible():boolean; + load(url:string, type?:string, callback?:WebixCallback):PromisedData; + loadBranch(id:string, callback:WebixCallback, url:string):void; + loadNext(count:number, start:number, callback:WebixCallback, url:string, now:boolean):void; + locate(e:Event):string; + mapEvent(map:any):void; + move(sid:string, tindex:number, tobj?:any, details?:any):string; + moveSelection(direction:string):void; + open(id:string):void; + openAll():void; + parse(data:any, type:string):void; + refresh(id?:string):void; + remove(id:string):void; + removeCss(id:string|number, css:string, silent?:boolean):void; + render(id:string, data:any, type:string):void; + resize():void; + scrollTo(x:number, y:number):void; + select(id:string|any[], preserve:boolean):void; + selectAll(from?:string, to?:string):void; + serialize():any; + setState(state:any):void; + show(force?:boolean, animation?:boolean):void; + showItem(id:string):void; + sort(by:string, dir?:string, as?:string):void; + sync(source:any, filter:WebixCallback, silent:boolean):void; + unbind():void; + unblockEvent():void; + uncheckAll(id?:string):void; + uncheckItem(id:string):void; + ungroup(mode:boolean):void; + unselect(id?:string):void; + unselectAll():void; + updateItem(id:string, data:any):void; + validate(id?:string):boolean; + $drag(source:HTMLElement, ev:Event):string; + $dragHTML: WebixCallback; + $dragIn(source:HTMLElement, target:HTMLElement, ev:Event):HTMLElement; + $dragMark(context:any, ev:Event):boolean; + $dragOut(source:HTMLElement, old_target:HTMLElement, new_target:HTMLElement, ev:Event):void; + $drop(source:HTMLElement, target:HTMLElement, ev:any):void; + $dropAllow: WebixCallback; + $getSize():any[]; + $height: number; + $scope: any; + $setSize(x:number, y:number):boolean; + $skin: any; + $view: HTMLElement; + $width: number; + config: treeConfig; + name: string; + on_click: WebixCallback; + on_context: { [key: string]: any; }; + on_dblclick: WebixCallback; + on_mouse_move: WebixCallback; + type: { [key: string]: any; }; + types: { [key: string]: any; }; +} +interface treetableConfig{ + animate?: any; + autoConfig?: boolean; + autoheight?: boolean; + autowidth?: boolean; + blockselect?: boolean; + borderless?: boolean; + checkboxRefresh?: boolean; + clipboard?: boolean|string; + columnWidth?: number; + columns?: any[]; + container?: HTMLElement; + css?: string; + data?: string|any[]; + dataFeed?: string|WebixCallback; + datafetch?: number; + datathrottle?: number; + datatype?: string; + delimiter?: any; + disabled?: boolean; + drag?: boolean|string; + dragColumn?: boolean|string; + dragscroll?: boolean|string; + editMath?: boolean; + editValue?: string; + editable?: boolean; + editaction?: string; + externalData?: WebixCallback; + filterMode?: any; + fixedRowHeight?: boolean; + footer?: boolean; + form?: string; + gravity?: number; + header?: boolean; + headerRowHeight?: number; + headermenu?: any; + height?: number; + hidden?: boolean; + hover?: string; + id?: string; + leftSplit?: number; + liveValidation?: boolean; + loadahead?: number; + math?: boolean; + maxHeight?: number; + maxWidth?: number; + minColumnHeight?: number; + minColumnWidth?: number; + minHeight?: number; + minWidth?: number; + mouseEventDelay?: number; + multiselect?: boolean; + navigation?: boolean; + on?: any; + onClick?: { [key: string]: any; }; + onContext?: { [key: string]: any; }; + onDblClick?: WebixCallback; + onMouseMove?: WebixCallback; + pager?: any; + prerender?: boolean; + ready?: WebixCallback; + removeMissed?: boolean; + resizeColumn?: boolean; + resizeRow?: boolean; + rightSplit?: number; + rowHeight?: number; + rowLineHeight?: number; + rules?: any; + save?: string; + scheme?: any; + scroll?: boolean; + scrollAlignY?: boolean; + scrollX?: boolean; + scrollY?: boolean; + select?: boolean|string; + spans?: any[]; + threeState?: boolean; + tooltip?: any; + type?: any; + url?: string; + width?: number; + yCount?: number; +} +interface treetable extends webix.ui.baseview{ + add(obj:any, index?:number):string; + addCellCss(id:string, name:string, css:string):void; + addCss(id:string|number, css:string, silent?:boolean):void; + addRowCss(id:string, css:string):void; + adjust():void; + adjustColumn(id:string|number, header?:string):void; + adjustRowHeight(columnId:string, silent:boolean):void; + attachEvent(type:string, functor:WebixCallback, id?:string):string; + bind(target:any, rule?:WebixCallback, format?:string):void; + blockEvent():void; + callEvent(name:string, params:any[]):boolean; + checkAll(id?:string):void; + checkItem(id:string):void; + clearAll():void; + clearCss(css:string, silent?:boolean):void; + clearValidation():void; + close(id:string):void; + closeAll():void; + collectValues(id:string):any[]; + columnId(index:number):string; + copy(sid:string, tindex:number, tobj?:webix.ui.baseview, details?:any):string; + count():number; + define(property:string, value:any):void; + destructor():void; + detachEvent(id:string):void; + disable():void; + eachColumn(handler:WebixCallback, all?:boolean):void; + eachRow(handler:WebixCallback, all?:boolean):void; + edit(id:any):void; + editCancel():void; + editCell(row:string, col:string, preserve?:boolean, show?:boolean):void; + editColumn(id:string):void; + editNext():boolean; + editRow(id:string):void; + editStop():void; + enable():void; + exists(id:string):boolean; + exportToExcel(url?:string):void; + exportToPDF(url?:string):void; + filter(text:string|WebixTemplate|WebixCallback, value:string, preserve:boolean):void; + filterByAll():void; + find(criterion:WebixCallback, first?:boolean):any; + focusEditor():void; + getBranchIndex(id:string, parent?:string):number; + getChecked():any[]; + getChildViews():any[]; + getColumnConfig(id:string):any; + getColumnIndex(id:string):number; + getEditState():any; + getEditor(row?:any, column?:string|number):any; + getEditorValue():string; + getFilter(columnID:string):any; + getFirstChildId(id:string):string; + getFirstId():string; + getFormView():webix.ui.baseview; + getHeaderContent(id:string):{ [key: string]: any; }; + getHeaderNode(columnId:string, rowIndex?:number):HTMLElement; + getIdByIndex(index:number):string; + getIndexById(id:string):number; + getItem(id:string):any; + getItemNode(id:string):void; + getLastId():string; + getNextId(id:string, step:number):string; + getNextSiblingId(id:any):string; + getNode():any; + getOpenItems():any[]; + getPage():number; + getPager():any; + getParentId(id:string):string; + getParentView():any; + getPrevId(id:string, step:number):string; + getPrevSiblingId(id:any):string; + getScrollState():any; + getSelectedId(asArray?:boolean, asString?:boolean):any; + getSelectedItem(mode?:boolean):void; + getState():any; + getText(rowid:string, colid:string):string; + getTopParentView():webix.ui.baseview; + getVisibleCount():number; + group(config:any, mode:boolean):void; + hasCss(id:string, css:string):boolean; + hasEvent(name:string):boolean; + hide():void; + hideColumn(id:string):void; + hideOverlay():void; + isBranch(id:string):boolean; + isBranchOpen(id:string):boolean; + isChecked(id:string):boolean; + isColumnVisible(id:string):boolean; + isEnabled():boolean; + isVisible():boolean; + load(url:string, type?:string, callback?:WebixCallback):PromisedData; + loadBranch(id:string, callback:WebixCallback, url:string):void; + loadNext(count:number, start:number, callback:WebixCallback, url:string, now:boolean):void; + locate(node:HTMLElement|Event):any; + mapCells(startrow:number, startcol:string, numrows:number, numcols:number, callback:WebixCallback):void; + mapEvent(map:any):void; + markSorting(column_id:string, dir:string):void; + move(sid:string, tindex:number, tobj?:webix.ui.baseview, details?:any):string; + moveBottom(id:string):void; + moveColumn(id:string, index:number):void; + moveDown(id:string, step:number):void; + moveSelection(direction:string):void; + moveTop(id:string):void; + moveUp(id:string, step:number):void; + open(id:string):void; + openAll():void; + parse(data:any, type:string):void; + refresh(id?:string):void; + refreshColumns(config?:any[]):void; + refreshFilter(id:string):void; + refreshHeaderContent():void; + registerFilter(node:HTMLElement, config:any, obj:any):void; + remove(id:string):void; + removeCellCss(id:string, name:string, css_name:string):void; + removeCss(id:string|number, css:string, silent?:boolean):void; + removeRowCss(id:string, css_name:string):void; + render(id:string, data:any, operation:string):void; + resize():void; + scrollTo(x:number, y:number):void; + serialize():any; + setColumnWidth(id:string, width:number):void; + setPage(page:number):void; + setRowHeight(id:string, height:number):void; + setState(state:any):void; + show(force?:boolean, animation?:boolean):void; + showCell(row:string, column:string):void; + showColumn(id:string):void; + showColumnBatch(batch:string|number):void; + showItem(id:string):void; + showItemByIndex(index:number):void; + showOverlay(message:string):void; + sort(by:string, dir?:string, as?:string):void; + sync(source:any, filter:WebixCallback, silent:boolean):void; + unbind():void; + unblockEvent():void; + uncheckAll(id?:string):void; + uncheckItem(id:string):void; + ungroup(mode:boolean):void; + updateItem(id:string, data:any):void; + validate(id?:string):boolean; + validateEditor(id?:string):boolean; + $drag(source:HTMLElement, ev:Event):string; + $dragHTML: WebixCallback; + $dragIn(source:HTMLElement, target:HTMLElement, ev:Event):HTMLElement; + $dragMark(context:any, ev:Event):boolean; + $dragOut(source:HTMLElement, old_target:HTMLElement, new_target:HTMLElement, ev:Event):void; + $drop(source:HTMLElement, target:HTMLElement, ev:any):void; + $dropAllow: WebixCallback; + $getSize():any[]; + $height: number; + $scope: any; + $setSize(x:number, y:number):boolean; + $skin: any; + $view: HTMLElement; + $width: number; + config: treetableConfig; + headerContent: any; + name: string; + on_click: WebixCallback; + on_context: { [key: string]: any; }; + on_dblclick: WebixCallback; + on_mouse_move: WebixCallback; + waitData: PromisedData; +} +interface unitlistConfig{ + animate?: any; + autoheight?: boolean; + autowidth?: boolean; + borderless?: boolean; + click?: string|WebixCallback; + clipboard?: boolean|string; + container?: HTMLElement; + css?: string; + data?: string|any[]; + dataFeed?: string|WebixCallback; + datathrottle?: number; + datatype?: string; + disabled?: boolean; + drag?: boolean|string; + dragscroll?: boolean|string; + externalData?: WebixCallback; + gravity?: number; + height?: number; + hidden?: boolean; + id?: string; + layout?: string; + maxHeight?: number; + maxWidth?: number; + minHeight?: number; + minWidth?: number; + mouseEventDelay?: number; + navigation?: boolean; + on?: any; + onClick?: { [key: string]: any; }; + onContext?: { [key: string]: any; }; + onDblClick?: WebixCallback; + onMouseMove?: WebixCallback; + pager?: any; + ready?: WebixCallback; + removeMissed?: boolean; + rules?: any; + save?: string; + scheme?: any; + scroll?: boolean|string; + scrollSpeed?: string; + select?: boolean|string; + sort?: WebixCallback; + template?: string|WebixCallback; + templateCopy?: WebixCallback; + tooltip?: any; + type?: any; + uniteBy?: WebixCallback; + url?: string; + width?: number; + xCount?: number; + yCount?: number; +} +interface unitlist extends webix.ui.baseview{ + add(obj:any, index?:number):string; + addCss(id:string|number, css:string, silent?:boolean):void; + adjust():void; + attachEvent(type:string, functor:WebixCallback, id?:string):string; + bind(target:any, rule?:WebixCallback, format?:string):void; + blockEvent():void; + callEvent(name:string, params:any[]):boolean; + clearAll():void; + clearCss(css:string, silent?:boolean):void; + clearValidation():void; + copy(sid:string, tindex:number, tobj?:any, details?:any):void; + count():number; + customize(obj:any):void; + define(property:string, value:any):void; + destructor():void; + detachEvent(id:string):void; + disable():void; + enable():void; + exists(id:string):boolean; + filter(text:string|WebixTemplate|WebixCallback, value:string, preserve:boolean):void; + getChildViews():any[]; + getFirstId():string; + getFormView():webix.ui.baseview; + getIdByIndex(index:number):string; + getIndexById(id:string):number; + getItem(id:string):any; + getItemNode(id:string):void; + getLastId():string; + getNextId(id:string, step:number):string; + getNode():any; + getPage():number; + getPager():any; + getParentView():any; + getPrevId(id:string, step:number):string; + getScrollState():any; + getSelectedId(as_array:boolean):string|any[]; + getSelectedItem(as_array?:boolean):any; + getTopParentView():webix.ui.baseview; + getUnitList(name:string):any[]; + getUnits():any[]; + getVisibleCount():number; + hasCss(id:string, css:string):boolean; + hasEvent(name:string):boolean; + hide():void; + isEnabled():boolean; + isSelected(id:string):boolean; + isVisible():boolean; + load(url:string, type?:string, callback?:WebixCallback):PromisedData; + loadNext(count:number, start:number, callback:WebixCallback, url:string, now:boolean):void; + locate(e:Event):string; + mapEvent(map:any):void; + move(sid:string, tindex:number, tobj?:any, details?:any):string; + moveBottom(id:string):void; + moveDown(id:string, step:number):void; + moveSelection(direction:string):void; + moveTop(id:string):void; + moveUp(id:string, step:number):void; + parse(data:any, type:string):void; + refresh(id?:string):void; + remove(id:string):void; + removeCss(id:string|number, css:string, silent?:boolean):void; + render(id:string, data:any, type:string):void; + resize():void; + scrollTo(x:number, y:number):void; + select(id:string|any[], preserve:boolean):void; + selectAll(from?:string, to?:string):void; + serialize():any; + setPage(page:number):void; + show(force?:boolean, animation?:boolean):void; + showItem(id:string):void; + sort(by:string, dir?:string, as?:string):void; + sync(source:any, filter:WebixCallback, silent:boolean):void; + unbind():void; + unblockEvent():void; + unselect(id?:string):void; + unselectAll():void; + updateItem(id:string, data:any):void; + validate(id?:string):boolean; + $drag(source:HTMLElement, ev:Event):string; + $dragHTML: WebixCallback; + $dragIn(source:HTMLElement, target:HTMLElement, ev:Event):HTMLElement; + $dragMark(context:any, ev:Event):boolean; + $dragOut(source:HTMLElement, old_target:HTMLElement, new_target:HTMLElement, ev:Event):void; + $drop(source:HTMLElement, target:HTMLElement, ev:any):void; + $dropAllow: WebixCallback; + $getSize():any[]; + $height: number; + $scope: any; + $setSize(x:number, y:number):boolean; + $skin: any; + $view: HTMLElement; + $width: number; + config: unitlistConfig; + name: string; + on_click: WebixCallback; + on_context: { [key: string]: any; }; + on_dblclick: WebixCallback; + on_mouse_move: WebixCallback; + type: { [key: string]: any; }; + types: { [key: string]: any; }; +} +interface uploaderConfig{ + align?: string; + animate?: any; + apiOnly?: boolean; + autosend?: boolean; + borderless?: boolean; + click?: WebixCallback; + container?: HTMLElement; + content?: string|HTMLElement; + css?: string; + disabled?: boolean; + formData?: { [key: string]: any; }; + getValue():string; + gravity?: number; + height?: number; + hidden?: boolean; + hotkey?: string; + id?: string; + inputHeight?: number; + inputWidth?: number; + label?: string; + labelPosition?: string; + link?: string; + maxHeight?: number; + maxWidth?: number; + minHeight?: number; + minWidth?: number; + multiple?: boolean; + name?: string; + on?: any; + placeholder?: any; + popup?: any; + tabFocus?: boolean; + template?: string|WebixCallback; + tooltip?: string; + type?: string; + value?: string; + width?: number; +} +interface uploader extends webix.ui.baseview{ + addDropZone(element:HTMLElement):void; + addFile(name:string, size:number, type?:string):void; + adjust():void; + attachEvent(type:string, functor:WebixCallback, id?:string):string; + bind(target:any, rule?:WebixCallback, format?:string):void; + blockEvent():void; + blur():void; + callEvent(name:string, params:any[]):boolean; + define(property:string, value:any):void; + destructor():void; + detachEvent(id:string):void; + disable():void; + enable():void; + fileDialog(content?:any):void; + focus():void; + getChildViews():any[]; + getFormView():webix.ui.baseview; + getInputNode():HTMLElement; + getNode():any; + getParentView():any; + getTopParentView():webix.ui.baseview; + getValue():string; + hasEvent(name:string):boolean; + hide():void; + isEnabled():boolean; + isUploaded():boolean; + isVisible():boolean; + mapEvent(map:any):void; + refresh():void; + render(id:string, data:any, type:string):void; + resize():void; + send(id:number|string|WebixCallback, details:any):void; + setValue(value:string):void; + show(force?:boolean, animation?:boolean):void; + stopUpload(id:string):void; + sync(source:any, filter:WebixCallback, silent:boolean):void; + unbind():void; + unblockEvent():void; + $cssName: string; + $getSize():any[]; + $getValue():string; + $height: number; + $scope: any; + $setSize(x:number, y:number):boolean; + $setValue(value:string):void; + $skin: any; + $view: HTMLElement; + $width: number; + config: uploaderConfig; + name: string; + on_click: WebixCallback; + touchable: any; +} +interface videoConfig{ + animate?: any; + borderless?: boolean; + container?: HTMLElement; + controls?: boolean; + css?: string; + disabled?: boolean; + gravity?: number; + height?: number; + hidden?: boolean; + id?: string; + maxHeight?: number; + maxWidth?: number; + minHeight?: number; + minWidth?: number; + src?: any; + width?: number; +} +interface video extends webix.ui.baseview{ + adjust():void; + bind(target:any, rule?:WebixCallback, format?:string):void; + define(property:string, value:any):void; + destructor():void; + disable():void; + enable():void; + getChildViews():any[]; + getFormView():webix.ui.baseview; + getNode():any; + getParentView():any; + getTopParentView():webix.ui.baseview; + getVideo():void; + hide():void; + isEnabled():boolean; + isVisible():boolean; + resize():void; + show(force?:boolean, animation?:boolean):void; + unbind():void; + $getSize():any[]; + $height: number; + $scope: any; + $setSize(x:number, y:number):boolean; + $skin: any; + $view: HTMLElement; + $width: number; + config: videoConfig; + name: string; +} +interface windowConfig{ + animate?: any; + autofit?: boolean; + autofocus?: boolean; + body?: string|webix.ui.baseview; + borderless?: boolean; + container?: HTMLElement; + css?: string; + disabled?: boolean; + fullscreen?: boolean; + gravity?: number; + head?: any; + headHeight?: number; + height?: number; + hidden?: boolean; + id?: string; + left?: number; + maxHeight?: number; + maxWidth?: number; + minHeight?: number; + minWidth?: number; + modal?: boolean; + move?: boolean; + on?: any; + padding?: any; + position?: string|WebixCallback; + relative?: string; + top?: number; + width?: number; + zIndex?: number; +} +interface window extends webix.ui.baseview{ + adjust():void; + attachEvent(type:string, functor:WebixCallback, id?:string):string; + bind(target:any, rule?:WebixCallback, format?:string):void; + blockEvent():void; + callEvent(name:string, params:any[]):boolean; + close():void; + define(property:string, value:any):void; + destructor():void; + detachEvent(id:string):void; + disable():void; + enable():void; + getBody():any; + getChildViews():any[]; + getFormView():webix.ui.baseview; + getHead():any; + getNode():any; + getParentView():any; + getTopParentView():webix.ui.baseview; + hasEvent(name:string):boolean; + hide():void; + isEnabled():boolean; + isVisible():boolean; + mapEvent(map:any):void; + resize():void; + resizeChildren():void; + setPosition(x:number, y:number):void; + show(force?:boolean, animation?:boolean):void; + unbind():void; + unblockEvent():void; + $getSize():any[]; + $height: number; + $scope: any; + $setSize(x:number, y:number):boolean; + $skin: any; + $view: HTMLElement; + $width: number; + config: windowConfig; + name: string; +} + +}} + +declare function $$(id: string|Event|HTMLElement):webix.ui.view; diff --git a/webrtc/RTCPeerConnection-tests.ts b/webrtc/RTCPeerConnection-tests.ts index dd8174148..f25ad81df 100644 --- a/webrtc/RTCPeerConnection-tests.ts +++ b/webrtc/RTCPeerConnection-tests.ts @@ -4,7 +4,7 @@ var config: RTCConfiguration = { iceServers: [{ url: "stun.l.google.com:19302" }] }; var constraints: RTCMediaConstraints = - { mandatory: { OfferToReceiveAudio: true, OfferToReceiveVideo: true } }; + { mandatory: { offerToReceiveAudio: true, offerToReceiveVideo: true } }; var peerConnection: RTCPeerConnection = new RTCPeerConnection(config, constraints); diff --git a/webrtc/RTCPeerConnection.d.ts b/webrtc/RTCPeerConnection.d.ts index fee9e95d4..9e96a86c8 100644 --- a/webrtc/RTCPeerConnection.d.ts +++ b/webrtc/RTCPeerConnection.d.ts @@ -71,8 +71,8 @@ interface RTCMediaConstraints { } interface RTCMediaOfferConstraints { - OfferToReceiveAudio: boolean; - OfferToReceiveVideo: boolean; + offerToReceiveAudio: boolean; + offerToReceiveVideo: boolean; } interface RTCSessionDescriptionInit { @@ -261,7 +261,9 @@ interface RTCPeerConnection { signalingState: string; // RTCSignalingState; see TODO(1) updateIce(configuration?: RTCConfiguration, constraints?: RTCMediaConstraints): void; - addIceCandidate(candidate: RTCIceCandidate): void; + addIceCandidate(candidate:RTCIceCandidate, + successCallback:() => void, + failureCallback:RTCPeerConnectionErrorCallback): void; iceGatheringState: string; // RTCIceGatheringState; see TODO(1) iceConnectionState: string; // RTCIceConnectionState; see TODO(1) getLocalStreams(): MediaStream[]; diff --git a/whatwg-fetch/whatwg-fetch-tests.ts b/whatwg-fetch/whatwg-fetch-tests.ts new file mode 100644 index 000000000..cc3e6320a --- /dev/null +++ b/whatwg-fetch/whatwg-fetch-tests.ts @@ -0,0 +1,24 @@ +/// +/// + +function test_fetchUrlWithOptions() { + var headers = new Headers(); + headers.append("Content-Type", "application/json"); + var requestOptions: RequestInit = { + method: "POST", + headers: headers + }; + handlePromise(window.fetch("http://www.andlabs.net/html5/uCOR.php", requestOptions)); +} + +function test_fetchUrl() { + handlePromise(window.fetch("http://www.andlabs.net/html5/uCOR.php")); +} + +function handlePromise(promise: Promise) { + promise.then((response) => { + return response.text(); + }).then((text) => { + console.log(text); + }); +} \ No newline at end of file diff --git a/whatwg-fetch/whatwg-fetch.d.ts b/whatwg-fetch/whatwg-fetch.d.ts new file mode 100644 index 000000000..d847463bd --- /dev/null +++ b/whatwg-fetch/whatwg-fetch.d.ts @@ -0,0 +1,84 @@ +// Type definitions for fetch API +// Project: https://github.com/github/fetch +// Definitions by: Ryan Graham +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare class Request { + constructor(input: string|Request, init?:RequestInit); + method: string; + url: string; + headers: Headers; + context: RequestContext; + referrer: string; + mode: RequestMode; + credentials: RequestCredentials; + cache: RequestCache; +} + +interface RequestInit { + method?: string; + headers?: HeaderInit; + body?: BodyInit; + mode?: RequestMode; + credentials?: RequestCredentials; + cache?: RequestCache; +} + +declare enum RequestContext { + "audio", "beacon", "cspreport", "download", "embed", "eventsource", "favicon", "fetch", + "font", "form", "frame", "hyperlink", "iframe", "image", "imageset", "import", + "internal", "location", "manifest", "object", "ping", "plugin", "prefetch", "script", + "serviceworker", "sharedworker", "subresource", "style", "track", "video", "worker", + "xmlhttprequest", "xslt" +} +declare enum RequestMode { "same-origin", "no-cors", "cors" } +declare enum RequestCredentials { "omit", "same-origin", "include" } +declare enum RequestCache { "default", "no-store", "reload", "no-cache", "force-cache", "only-if-cached" } + +declare class Headers { + append(name: string, value: string): void; + delete(name: string):void; + get(name: string): string; + getAll(name: string): Array; + has(name: string): boolean; + set(name: string, value: string): void; +} + +declare class Body { + bodyUsed: boolean; + arrayBuffer(): Promise; + blob(): Promise; + formData(): Promise; + json(): Promise; + text(): Promise; +} +declare class Response extends Body { + constructor(body?: BodyInit, init?: ResponseInit); + error(): Response; + redirect(url: string, status: number): Response; + type: ResponseType; + url: string; + status: number; + ok: boolean; + statusText: string; + headers: Headers; + clone(): Response; +} + +declare enum ResponseType { "basic", "cors", "default", "error", "opaque" } + +declare class ResponseInit { + status: number; + statusText: string; + headers: HeaderInit; +} + +declare type HeaderInit = Headers|Array; +declare type BodyInit = Blob|FormData|string; +declare type RequestInfo = Request|string; + +interface Window { + fetch(url: string, init?: RequestInit): Promise; +} \ No newline at end of file diff --git a/wnumb/wnumb-tests.ts b/wnumb/wnumb-tests.ts new file mode 100644 index 000000000..d8b3b5269 --- /dev/null +++ b/wnumb/wnumb-tests.ts @@ -0,0 +1,42 @@ +/// + + +var moneyFormat = wNumb({ + mark: '.', + thousand: ',', + prefix: '$ ', + postfix: ' p.p.' +}); + +moneyFormat.to( 301980.62 ); + +moneyFormat.from( '$ 301,980.62 p.p.' ); + +var Format = wNumb({ + prefix: '$ ', + decimals: 3, + thousand: ',' +}); + +Format = wNumb({ + thousand: '.', + encoder: function( a ){ + return a * 1E7; + }, + decoder: function( a ){ + return a / 1E7; + } +}); + +Format = wNumb({ + prefix: '$', + postfix: ',-', + thousand: ',' +}); + + +Format = wNumb({ + prefix: '$', + negativeBefore: '[NEGATIVE] ' +}); + diff --git a/wnumb/wnumb.d.ts b/wnumb/wnumb.d.ts new file mode 100644 index 000000000..d3645768c --- /dev/null +++ b/wnumb/wnumb.d.ts @@ -0,0 +1,86 @@ +// Type definitions for nouislider v1.0.0 +// Project: https://github.com/leongersen/wnumb +// Definitions by: Corey Jepperson +// Definitions: https://github.com/borisyankov/DefinitelyTyped +declare var wNumb: wNumb; + +interface wNumbOptions { + /** + * decimals The number of decimals to include in the result. Limited to 7. + */ + decimals?: number; + /** + * The decimal separator. + * Defaults to '.' if thousand isn't already set to '.'. + */ + mark?: string; + /** + * Separator for large numbers. For example: ' ' would result in a formatted number of 1 000 000. + */ + thousand?: string; + /** + * A string to prepend to the number. Use cases include prefixing with money symbols such as '$' or '€'. + */ + prefix?: string; + /** + * A number to append to a number. For example: ',-'. + */ + postfix?: string; + /** + * The prefix for negative values. Defaults to '-' if negativeBefore isn't set. + */ + negative?: string; + /** + * The prefix for a negative number. Inserted before prefix. + */ + negativeBefore?: string; + /**This is a powerful option to manually modify the slider output. + * + *For example, to show a number in another currency: + * function( value ){ + * return value * 1.32; + * } + */ + encoder?: (value: number) => number; + /** + * Reverse the operations set in encoder. + * Use this option to undo modifications made while encoding the value. + * function( value ){ + * return value / 1.32; + * } + */ + decoder?: (value: number) => number; + /** + * Similar to encoder, but applied after all other formatting options are applied. + */ + edit?: (value: number) => number; + /** + * Similar to decoder and the reverse for edit. + * Applied before all other formatting options are applied. + */ + undo?: (value: number) => number; +} + + +interface wNumb { + /** + * Create a wNumb + * + * @param options - the options + */ + (options?: wNumbOptions): wNumbInstance; +} + +interface wNumbInstance { + + + + /** + * format to string + */ + to(val: number): string; + /** + * get number from formatted string + */ + from(val: string): number; +} \ No newline at end of file diff --git a/xml2js/xml2js-tests.ts b/xml2js/xml2js-tests.ts index f2d9dc41e..45472c0aa 100644 --- a/xml2js/xml2js-tests.ts +++ b/xml2js/xml2js-tests.ts @@ -15,3 +15,5 @@ var builder = new xml2js.Builder({ var outString = builder.buildObject({ 'hello': 'xml2js!' }); + +var parser = new xml2js.Parser(); diff --git a/xml2js/xml2js.d.ts b/xml2js/xml2js.d.ts index f734e4ba0..33ad64978 100644 --- a/xml2js/xml2js.d.ts +++ b/xml2js/xml2js.d.ts @@ -16,6 +16,14 @@ declare module 'xml2js' { buildObject(rootObj: any): string; } + class Parser { + constructor(options?: Options); + processAsync(): any; + assignOrPush(obj: any, key: string, newValue: any): any; + reset(): any; + parseString(str: string , cb?: Function): void; + } + interface RenderOptions { indent?: string; newline?: string; diff --git a/youtube/youtube.d.ts b/youtube/youtube.d.ts index cfdba0efb..85f96b22f 100644 --- a/youtube/youtube.d.ts +++ b/youtube/youtube.d.ts @@ -146,7 +146,7 @@ declare module YT { getPlaylistIndex(): number; // Event Listener - addEventListener(event: string, listener: string): void; + addEventListener(event: string, handler: EventHandler): void; } export enum PlayerState {