diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 000000000..5ebf4a129 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,9 @@ +root = true + +[*] +trim_trailing_whitespace = true +insert_final_newline = true + +[{*.json,*.yml}] +indent_style = space +indent_size = 2 diff --git a/.gitignore b/.gitignore index 71251cf8a..2ea470b9e 100644 --- a/.gitignore +++ b/.gitignore @@ -28,13 +28,9 @@ _infrastructure/tests/build .idea *.iml *.js.map - -#rx.js -!rx.js - -#zip.js -!zip.js +!*.js/ node_modules .sublimets +.settings/launch.json diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 7d495dca8..a41d225ec 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -16,17 +16,18 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](angular-growl-v2/angular-growl-v2.d.ts) [Angular Growl 2 v.0.7.3](http://janstevens.github.io/angular-growl-2) by [Tadeusz Hucal](https://github.com/mkp05) * [: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), [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-cookies.d.ts) [Angular JS (ngCookies module)](http://angularjs.org) by [Diego Vilar](http://github.com/diegovilar), [Anthony Ciccarello](http://github.com/aciccarello) * [: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-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-material/angular-material.d.ts) [Angular Material (angular.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) * [:link:](angular-ui-bootstrap/angular-ui-bootstrap.d.ts) [Angular UI Bootstrap](https://github.com/angular-ui/bootstrap) by [Brian Surowiec](https://github.com/xt0rted) +* [:link:](angular-wizard/angular-wizard.d.ts) [Angular Wizard](https://github.com/mgonto/angular-wizard) by [Marko Jurisic](https://github.com/mjurisic) * [:link:](angular-bootstrap-lightbox/angular-bootstrap-lightbox.d.ts) [angular-bootstrap-lightbox](https://github.com/compact/angular-bootstrap-lightbox) by [Roland Zwaga](https://github.com/rolandzwaga) * [:link:](angular-hotkeys/angular-hotkeys.d.ts) [angular-hotkeys](https://github.com/chieffancypants/angular-hotkeys) by [Jason Zhao](https://github.com/jlz27), [Stefan Steinhart](https://github.com/reppners) * [:link:](angular-http-auth/angular-http-auth.d.ts) [angular-http-auth](https://github.com/witoldsz/angular-http-auth) by [vvakame](https://github.com/vvakame) @@ -39,6 +40,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [: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) * [:link:](animation-frame/animation-frame.d.ts) [animation-frame](https://github.com/kof/animation-frame) by [Qinfeng Chen](https://github.com/qinfchen) +* [:link:](ansi-styles/ansi-styles.d.ts) [ansi-styles](https://github.com/sindresorhus/ansi-styles) by [bryn austin bellomy](https://github.com/brynbellomy) * [:link:](ansicolors/ansicolors.d.ts) [ansicolors](https://github.com/thlorenz/ansicolors) by [rogierschouten](https://github.com/rogierschouten) * [: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) @@ -57,10 +59,11 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](asyncblock/asyncblock.d.ts) [asyncblock](https://github.com/scriby/asyncblock) by [Hiroki Horiuchi](https://github.com/horiuchi) * [:link:](atmosphere/atmosphere.d.ts) [Atmosphere](https://github.com/Atmosphere/atmosphere-javascript) by [Kai Toedter](https://github.com/toedter) * [:link:](atom/atom.d.ts) [Atom](https://atom.io) by [vvakame](https://github.com/vvakame) +* [:link:](atom/api-docs.d.ts) [Atom API docs](https://github.com/atom/atom/blob/master/build/tasks/docs-task.coffee) by [vvakame](https://github.com/vvakame) * [: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:](auth0.lock/auth0.lock.d.ts) [Auth0Widget.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) @@ -85,11 +88,12 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](bootbox/bootbox.d.ts) [Bootbox](https://github.com/makeusabrew/bootbox) by [Vincent Bortone](https://github.com/vbortone), [Kon Pik](https://github.com/konpikwastaken) * [:link:](bootstrap/bootstrap.d.ts) [Bootstrap](http://twitter.github.com/bootstrap) by [Boris Yankov](https://github.com/borisyankov) * [:link:](bootstrap.v3.datetimepicker/bootstrap.v3.datetimepicker.d.ts) [Bootstrap datetimepicker v3](http://eonasdan.github.io/bootstrap-datetimepicker) by [Jesica N. Fera](https://github.com/bayitajesi) +* [:link:](bootstrap-touchspin/bootstrap-touchspin.d.ts) [Bootstrap TouchSpin](http://www.virtuosoft.eu/code/bootstrap-touchspin) by [Albin Sunnanbo](https://github.com/albinsunnanbo) * [: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:](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:](box2d/box2dweb.d.ts) [bootstrap.timepicker](http://code.google.com/p/box2dweb) by [jbaldwin](https://github.com/jbaldwin) * [: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) @@ -97,14 +101,16 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](bucks/bucks.d.ts) [bucks.js](https://github.com/CyberAgent/bucks.js) by [Shunsuke Ohtani](https://github.com/zaneli) * [:link:](buffer-equal/buffer-equal.d.ts) [buffer-equal](https://github.com/substack/node-buffer-equal) by [Bart van der Schoor](https://github.com/Bartvds) * [:link:](bl/bl.d.ts) [BufferList](https://github.com/rvagg/bl) by [Bart van der Schoor](https://github.com/Bartvds) +* [:link:](buffers/buffers.d.ts) [buffers](https://github.com/substack/node-buffers) by [Robert Hencke](https://github.com/rhencke) * [:link:](bufferstream/bufferstream.d.ts) [bufferstream](https://github.com/dodo/node-bufferstream) by [Bart van der Schoor](https://github.com/Bartvds) * [:link:](bunyan-prettystream/bunyan-prettystream.d.ts) [bunyan-prettystream](https://www.npmjs.com/package/bunyan-prettystream) by [Jason Swearingen](https://github.com/jasonswearingen) * [:link:](business-rules-engine/business-rules-engine.d.ts) [business-rules-engine](https://github.com/rsamec/form) by [Roman Samec](https://github.com/rsamec) * [:link:](byline/byline.d.ts) [byline](https://github.com/jahewson/node-byline) by [Stefan Steinhart](https://github.com/reppners) +* [:link:](calq/calq.d.ts) [calq](https://calq.io/docs/client/javascript/reference) by [Eirik Hoem](https://github.com/eirikhm) * [:link:](camljs/camljs.d.ts) [camljs](http://camljs.codeplex.com) by [Andrey Markeev](http://markeev.com) * [:link:](canvasjs/canvasjs.d.ts) [CanvasJS](http://canvasjs.com) by [Mark Overholt](https://github.com/mover5) * [:link:](casperjs/casperjs.d.ts) [CasperJS](http://casperjs.org) by [Jed Mao](https://github.com/jedmao) -* [:link:](chai/chai.d.ts) [chai](http://chaijs.com) by [Jed Hunsaker](https://github.com/jedhunsaker), [Bart van der Schoor](https://github.com/Bartvds) +* [:link:](chai/chai.d.ts) [chai](http://chaijs.com) by [Jed Mao](https://github.com/jedmao), [Bart van der Schoor](https://github.com/Bartvds) * [:link:](chai-as-promised/chai-as-promised.d.ts) [chai-as-promised](https://github.com/domenic/chai-as-promised) by [jt000](https://github.com/jt000) * [:link:](chai-datetime/chai-datetime.d.ts) [chai-datetime](https://github.com/gaslight/chai-datetime.git) by [Cliff Burger](https://github.com/cliffburger) * [:link:](chai-fuzzy/chai-fuzzy.d.ts) [chai-fuzzy](http://chaijs.com/plugins/chai-fuzzy) by [Bart van der Schoor](https://github.com/Bartvds) @@ -121,15 +127,19 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](chroma-js/chroma-js.d.ts) [Chroma.js](https://github.com/gka/chroma.js) by [Sebastian Brückner](https://github.com/invliD) * [:link:](chrome/chrome.d.ts) [Chrome extension development](http://developer.chrome.com/extensions) by [Matthew Kimber](https://github.com/matthewkimber), [otiai10](https://github.com/otiai10) * [:link:](chrome/chrome-app.d.ts) [Chrome packaged application development](http://developer.chrome.com/apps) by [Adam Lay](https://github.com/AdamLay), [MIZUNE Pine](https://github.com/pine613), [MIZUSHIMA Junki](https://github.com/mzsm) +* [:link:](circular-json/circular-json.d.ts) [circular-json](https://github.com/WebReflection/circular-json) by [Jonathan Pevarnek](https://github.com/jpevarnek) * [:link:](ckeditor/ckeditor.d.ts) [CKEditor](http://ckeditor.com) by [Ondrej Sevcik](https://github.com/ondrejsevcik) * [:link:](cli-color/cli-color.d.ts) [cli-color](https://github.com/medikoo/cli-color) by [Joel Spadin](https://github.com/ChaosinaCan) * [:link:](clone/clone.d.ts) [clone](https://github.com/pvorb/node-clone) by [Kieran Simpson](https://github.com/kierans/DefinitelyTyped) * [:link:](codemirror/codemirror.d.ts) [CodeMirror](https://github.com/marijnh/CodeMirror) by [mihailik](https://github.com/mihailik) +* [:link:](colorbrewer/colorbrewer.d.ts) [colorbrewer](https://github.com/jeanlauliac/colorbrewer) by [Matt Traynham](https://github.com/mtraynham) * [:link:](colors/colors.d.ts) [Colors.js 0.6.0-1](https://github.com/Marak/colors.js) by [Bart van der Schoor](https://github.com/Bartvds) * [:link:](cometd/cometd.d.ts) [CometD](http://cometd.org) by [Derek Cicerone](https://github.com/derekcicerone) * [:link:](commander/commander.d.ts) [commanderjs](https://github.com/visionmedia/commander.js) by [Marcelo Dezem](http://github.com/mdezem), [vvakame](http://github.com/vvakame) * [:link:](compression/compression.d.ts) [compression](https://github.com/expressjs/compression) by [Santi Albo](https://github.com/santialbo) * [:link:](configstore/configstore.d.ts) [configstore](https://github.com/yeoman/configstore) by [Bart van der Schoor](https://github.com/Bartvds) +* [:link:](connect-flash/connect-flash.d.ts) [connect-flash](https://github.com/jaredhanson/connect-flash) by [Andreas Gassmann](https://github.com/AndreasGassmann) +* [:link:](connect-slashes/connect-slashes.d.ts) [connect-slashes](https://github.com/avinoamr/connect-slashes) by [Sam Herrmann](https://github.com/samherrmann) * [:link:](consolidate/consolidate.d.ts) [consolidate](https://github.com/visionmedia/consolidate.js) by [Carlos Ballesteros Velasco](https://github.com/soywiz) * [:link:](content-type/content-type.d.ts) [content-type](https://github.com/deoxxa/content-type) by [Pine Mizune](https://github.com/pine613) * [:link:](convert-source-map/convert-source-map.d.ts) [convert-source-map](https://github.com/thlorenz/convert-source-map) by [Andrew Gaspar](https://github.com/AndrewGaspar) @@ -140,6 +150,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](cordovarduino/cordovarduino.d.ts) [Cordovarduino plugin](https://github.com/stereolux/cordovarduino) by [Hendrik Maus](https://github.com/hendrikmaus) * [:link:](couchbase/couchbase.d.ts) [Couchbase Couchnode](https://github.com/couchbase/couchnode) by [Basarat Ali Syed](https://github.com/basarat) * [: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:](cron/cron.d.ts) [cron](https://www.npmjs.com/package/cron) by [Hiroki Horiuchi](https://github.com/horiuchi) * [: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) @@ -147,6 +158,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [: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:](custom-error-generator/custom-error-generator.d.ts) [custom-error-generator](https://github.com/jproulx/node-custom-error) by [Thierry Miceli](https://github.com/thmiceli) * [: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) @@ -157,12 +169,14 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](datejs/datejs.d.ts) [DateJS](http://www.datejs.com) by [David Khristepher Santos](http://github.com/rupertavery) * [:link:](dcjs/dc.d.ts) [DCJS](https://github.com/dc-js/dc.js) by [hans windhoff](https://github.com/hansrwindhoff), [matt traynham](https://github.com/mtraynham) * [:link:](debug/debug.d.ts) [debug](https://github.com/visionmedia/debug) by [Seon-Wook Park](https://github.com/swook) +* [:link:](decimal.js/decimal.js.d.ts) [decimal.js](http://mikemcl.github.io/decimal.js) by [Joseph Rossi](http://github.com/musicist288) * [:link:](deep-diff/deep-diff.d.ts) [deep-diff](https://github.com/flitbit/diff) by [ZauberNerd](https://github.com/ZauberNerd) * [:link:](deep-freeze/deep-freeze.d.ts) [deep-freeze](https://github.com/substack/deep-freeze) by [Bart van der Schoor](https://github.com/Bartvds) * [:link:](del/del.d.ts) [del](https://github.com/sindresorhus/del) by [Asana](https://asana.com) * [:link:](deployJava/deployJava.d.ts) [deployJava.js](https://www.java.com/js/deployJava.txt) by [Cyril Schumacher](https://github.com/cyrilschumacher) * [:link:](detect-indent/detect-indent.d.ts) [detect-indent](https://github.com/sindresorhus/detect-indent) by [Bart van der Schoor](https://github.com/Bartvds) * [:link:](devextreme/dx.devextreme.d.ts) [DevExtreme](http://js.devexpress.com) by [DevExpress Inc.](http://devexpress.com) +* [:link:](dexie/dexie.d.ts) [Dexie](https://github.com/dfahlander/Dexie.js) by [David Fahlander](http://github.com/dfahlander) * [:link:](dhtmlxgantt/dhtmlxgantt.d.ts) [dhtmlxGantt](http://dhtmlx.com/docs/products/dhtmlxGantt) by [Maksim Kozhukh](http://github.com/mkozhukh) * [:link:](dhtmlxscheduler/dhtmlxscheduler.d.ts) [dhtmlxScheduler](http://dhtmlx.com/docs/products/dhtmlxScheduler) by [Maksim Kozhukh](http://github.com/mkozhukh) * [:link:](di-lite/di-lite.d.ts) [di-lite](https://github.com/NickQiZhu/di.js) by [Timothy Morris](https://github.com/dcrusader) @@ -171,19 +185,24 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](dock-spawn/dock-spawn.d.ts) [Dock Spawn](http://dockspawn.com) by [Drew Noakes](https://drewnoakes.com) * [:link:](documentdb/documentdb.d.ts) [DocumentDB](https://github.com/Azure/azure-documentdb-node) by [Noel Abrahams](https://github.com/NoelAbrahams) * [:link:](dojo/dojo.d.ts) [Dojo](http://dojotoolkit.org) by [Michael Van Sickle](https://github.com/vansimke) +* [:link:](dompurify/dompurify.d.ts) [DOM Purify](https://github.com/cure53/DOMPurify) by [Dave Taylor](http://davetayls.me) * [:link:](domo/domo.d.ts) [Domo](http://domo-js.com) by [Steve Fenton](https://github.com/Steve-Fenton) * [:link:](domready/domready.d.ts) [domready](https://github.com/ded/domready) by [Christian Holm Nielsen](https://github.com/dotnetnerd) +* [:link:](donna/donna.d.ts) [donna](https://github.com/atom/donna) by [vvakame](https://github.com/vvakame) * [:link:](dot/dot.d.ts) [doT](https://github.com/olado/doT) by [ZombieHunter](https://github.com/ZombieHunter) * [:link:](dotdotdot/dotdotdot.d.ts) [dotdotdot](http://dotdotdot.frebsite.nl) by [Milan Jaros](https://github.com/milanjaros) * [:link:](doublearray/doublearray.d.ts) [doublearray](https://github.com/takuyaa/doublearray) by [MIZUSHIMA Junki](https://github.com/mzsm) * [:link:](drop/drop.d.ts) [Drop](http://github.hubspot.com/drop) by [Adi Dahiya](https://github.com/adidahiya) * [:link:](dropboxjs/dropboxjs.d.ts) [dropbox-js](https://github.com/dropbox/dropbox-js) by [Steve Fenton](https://github.com/Steve-Fenton), [Pedro Casaubon](https://github.com/xperiments) * [:link:](dropzone/dropzone.d.ts) [Dropzone](http://www.dropzonejs.com) by [Natan Vivo](https://github.com/nvivo) +* [:link:](dsv/dsv.d.ts) [dsv](https://www.npmjs.com/package/dsv) by [Jason Swearingen](https://jasonswearingen.github.io) * [:link:](dts-bundle/dts-bundle.d.ts) [dts-bundle](https://github.com/TypeStrong/dts-bundle) by [Asana](https://asana.com) * [:link:](durandal/durandal.d.ts) [Durandal](http://durandaljs.com) by [Blue Spire](https://github.com/BlueSpire) * [:link:](easeljs/easeljs.d.ts) [EaselJS](http://www.createjs.com/#!/EaselJS) by [Pedro Ferreira](https://bitbucket.org/drk4), [Chris Smith](https://github.com/evilangelist) +* [:link:](easy-session/easy-session.d.ts) [easy-session](https://github.com/DeadAlready/node-easy-session) by [Karl Düüna](https://github.com/DeadAlready) * [:link:](easy-table/easy-table.d.ts) [easy-table](https://github.com/eldargab/easy-table) by [Bart van der Schoor](https://github.com/Bartvds) * [:link:](easystarjs/easystarjs.d.ts) [EasyStar.js](http://easystarjs.com) by [Magnus Gustafsson](https://github.com/borundin) +* [:link:](egg.js/egg.js.d.ts) [Egg.js](https://github.com/mikeflynn/egg.js) by [Markus Peloso](https://github.com/ToastHawaii) * [:link:](ejs-locals/ejs-locals.d.ts) [ejs-locals](https://github.com/randometc/ejs-locals) by [jt000](https://github.com/jt000) * [:link:](jquery.elang/jquery.elang.d.ts) [eLang](https://github.com/sumegizoltan/ELang) by [Zoltan Sumegi](https://github.com/sumegizoltan) * [:link:](element-resize-event/element-resize-event.d.ts) [element-resize-event](https://github.com/KyleAMathews/element-resize-event) by [Rogier Schouten](https://github.com/rogierschouten) @@ -205,6 +224,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](expect.js/expect.js.d.ts) [expect.js](https://github.com/LearnBoost/expect.js) by [Teppei Sato](https://github.com/teppeis) * [:link:](expectations/expectations.d.ts) [expectations.js](https://github.com/spmason/expectations) by [vvakame](https://github.com/vvakame) * [:link:](express/express.d.ts) [Express 4.x](http://expressjs.com) by [Boris Yankov](https://github.com/borisyankov) +* [:link:](express-debug/express-debug.d.ts) [express-debug](https://github.com/devoidfury/express-debug) by [Federico Bond](https://github.com/federicobond) * [:link:](express-jwt/express-jwt.d.ts) [express-jwt](https://www.npmjs.org/package/express-jwt) by [Wonshik Kim](https://github.com/wokim) * [:link:](express-myconnection/express-myconnection.d.ts) [express-myconnection](https://www.npmjs.org/package/express-myconnection) by [Michael Ferris](https://github.com/Cellule) * [:link:](express-partials/express-partials.d.ts) [express-partials](https://github.com/publicclass/express-partials) by [jt000](https://github.com/jt000) @@ -213,6 +233,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [: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:](eyes/eyes.d.ts) [eyes](https://github.com/cloudhead/eyes.js) by [bryn austin bellomy](https://github.com/brynbellomy) * [: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) @@ -255,6 +276,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](gently/gently.d.ts) [gently](https://www.npmjs.org/package/gently) by [bonnici](https://github.com/bonnici) * [:link:](geojson/geojson.d.ts) [GeoJSON Format Specification](http://geojson.org) by [Jacob Bruun](https://github.com/cobster) * [:link:](giraffe/giraffe.d.ts) [Giraffe](https://github.com/barc/backbone.giraffe) by [Matt McCray](https://github.com/darthapo) +* [:link:](gl-matrix/gl-matrix.d.ts) [gl-matrix](https://github.com/toji/gl-matrix) by [Tat](https://github.com/tatchx) * [:link:](gldatepicker/gldatepicker.d.ts) [glDatePicker](http://glad.github.com/glDatePicker) by [Dániel Tar](https://github.com/qcz) * [:link:](glidejs/glidejs.d.ts) [Glide.js](http://glide.jedrzejchalubek.com) by [Milan Jaros](https://github.com/milanjaros) * [:link:](glob/glob.d.ts) [Glob](https://github.com/isaacs/node-glob) by [vvakame](https://github.com/vvakame) @@ -265,11 +287,12 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](google.analytics/ga.d.ts) [Google Analytics (Classic and Universal)](https://developers.google.com/analytics/devguides/collection/gajs) by [Ronnie Haakon Hegelund](http://ronniehegelund.blogspot.dk), [Pat Kujawa](http://patkujawa.com) * [:link:](gapi/gapi.d.ts) [Google API Client](https://code.google.com/p/google-api-javascript-client) by [Frank M](https://github.com/sgtfrankieboy) * [:link:](google.feeds/google.feed.api.d.ts) [Google Feed Apis](https://developers.google.com/feed) by [RodneyJT](https://github.com/RodneyJT) -* [:link:](google.geolocation/google.geolocation.d.ts) [Google Geolocation](https://code.google.com/p/geo-location-javascript) by [Vincent Bortone](https://github.com/vbortone) * [:link:](googlemaps/google.maps.d.ts) [Google Geolocation](https://developers.google.com/maps) by [Folia A/S](http://www.folia.dk) +* [:link:](google.geolocation/google.geolocation.d.ts) [Google Geolocation](https://code.google.com/p/geo-location-javascript) by [Vincent Bortone](https://github.com/vbortone) * [:link:](gapi.pagespeedonline/gapi.pagespeedonline.d.ts) [Google Page Speed Online Api](https://developers.google.com/speed/pagespeed) by [Frank M](https://github.com/sgtfrankieboy) * [:link:](google.picker/google.picker.d.ts) [Google Picker API](https://developers.google.com/picker) by [grapswiz](https://github.com/grapswiz) * [:link:](recaptcha/recaptcha.d.ts) [Google Recaptcha](https://www.google.com/recaptcha) by [Brent Jenkins](https://github.com/brentj73) +* [:link:](grecaptcha/grecaptcha.d.ts) [Google Recaptcha v2](https://www.google.com/recaptcha) by [Kristof Mattei](http://kristofmattei.be) * [:link:](gapi.translate/gapi.translate.d.ts) [Google Translate API](https://developers.google.com/translate) by [Frank M](https://github.com/sgtfrankieboy) * [:link:](gapi.urlshortener/gapi.urlshortener.d.ts) [Google Url Shortener API](https://developers.google.com/url-shortener) by [Frank M](https://github.com/sgtfrankieboy) * [:link:](google.visualization/google.visualization.d.ts) [Google Visualisation Apis](https://developers.google.com/chart) by [Dan Ludwig](https://github.com/danludwig) @@ -279,9 +302,9 @@ 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/TweenLite.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/Core.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) * [:link:](gulp-concat/gulp-concat.d.ts) [gulp-concat](http://github.com/wearefractal/gulp-concat) by [Keita Kagurazaka](https://github.com/k-kagurazaka) @@ -314,6 +337,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](highcharts/highcharts.d.ts) [Highcharts](http://www.highcharts.com) by [Damiano Gambarotto](http://github.com/damianog) * [:link:](highland/highland.d.ts) [Highland](http://highlandjs.org) by [Bart van der Schoor](https://github.com/Bartvds) * [:link:](highlightjs/highlightjs.d.ts) [highlight.js](https://github.com/isagalaev/highlight.js) by [Niklas Mollenhauer](https://github.com/nikeee), [Jeremy Hull](https://github.com/sourrust) +* [:link:](highcharts/highstock.d.ts) [Highstock](http://www.highcharts.com) by [David Deutsch](http://github.com/DavidKDeutsch) * [:link:](history/history.d.ts) [History.js](https://github.com/browserstate/history.js) by [Boris Yankov](https://github.com/borisyankov), [Gidon Junge](https://github.com/gjunge) * [:link:](howlerjs/howler.d.ts) [howler.js](https://github.com/goldfire/howler.js) by [Pedro Casaubon](https://github.com/xperiments) * [:link:](touch-events/touch-events.d.ts) [HTML Touch Events](http://www.w3.org/TR/touch-events) by [Kevin Barabash](https://github.com/kevinb7) @@ -322,7 +346,9 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [: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:](hypertext-application-language/hypertext-application-language.d.ts) [Hypertext Application Language Draft 6](https://tools.ietf.org/html/draft-kelly-json-hal-06) by [Maks3w](https://github.com/maks3w) * [:link:](i18n-node/i18n-node.d.ts) [i18n-node](https://github.com/mashpie/i18n-node) by [Maxime LUCE](https://github.com/SomaticIT) +* [:link:](ng-i18next/ng-i18next.d.ts) [i18next](https://github.com/i18next/ng-i18next) by [Cyril Schumacher](https://github.com/cyrilschumacher) * [:link:](i18next/i18next.d.ts) [i18next](http://i18next.com) by [Maarten Docter](https://github.com/mdocter) * [:link:](iban/iban.d.ts) [iban.js](https://github.com/arhs/iban.js) by [Cyril Schumacher](https://github.com/cyrilschumacher) * [:link:](icheck/icheck.d.ts) [iCheck](http://damirfoy.com/iCheck) by [Dániel Tar](https://github.com/qcz) @@ -335,6 +361,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [: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) +* [:link:](inversify/inversify.d.ts) [inversify](https://github.com/inversify/InversifyJS) by [inversify](https://github.com/inversify) * [:link:](cordova-ionic/cordova-ionic.d.ts) [Ionic Cordova plugins](https://github.com/driftyco) by [Hendrik Maus](https://github.com/hendrikmaus) * [:link:](is_js/is_js.d.ts) [is.js](http://arasatasaygin.github.io/is.js) by [Rodrigo Cabral](https://github.com/cabralRodrigo) * [:link:](iscroll/iscroll.d.ts) [iScroll](http://cubiq.org/iscroll-4) by [Boris Yankov](https://github.com/borisyankov), [Christiaan Rakowski](https://github.com/csrakowski) @@ -351,6 +378,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](jasmine-matchers/jasmine-matchers.d.ts) [jasmine-matchers](https://github.com/uxebu/jasmine-matchers) by [Bart van der Schoor](https://github.com/Bartvds) * [:link:](java-applet/java-applet.d.ts) [Java Applet](https://www.java.com) by [Cyril Schumacher](https://github.com/cyrilschumacher) * [:link:](hooker/hooker.d.ts) [JavaScript Hooker](https://github.com/cowboy/javascript-hooker) by [Michael Zabka](https://github.com/misak113) +* [:link:](oauth.js/oauth.js.d.ts) [JavaScript software for implementing an OAuth consumer](https://code.google.com/p/oauth) by [NOBUOKA Yu](https://github.com/nobuoka) * [:link:](jbinary/jbinary.d.ts) [jBinary](https://github.com/jDataView/jBinary) by [Tim Bureck](https://github.com/tbureck) * [:link:](jdataview/jdataview.d.ts) [jDataView](https://github.com/jDataView/jDataView) by [Ingvar Stepanyan](https://github.com/RReverser) * [:link:](jest/jest.d.ts) [Jest](http://facebook.github.io/jest) by [Asana](https://asana.com) @@ -407,6 +435,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](jquery.gridster/gridster.d.ts) [jQuery.gridster](https://github.com/jbaldwin/gridster) by [Josh Baldwin](https://github.com/jbaldwin) * [:link:](jquery.jnotify/jquery.jnotify.d.ts) [jQuery.jNotify](http://jnotify.codeplex.com) by [James Curran](https://github.com/jamescurran) * [:link:](jquery.jsignature/jquery.jsignature.d.ts) [jQuery.jsignature v2](https://github.com/willowsystems/jSignature) by [Patrick Magee](https://github.com/pjmagee) +* [:link:](jquery-jsonrpcclient/jquery-jsonrpcclient.d.ts) [jquery.jsonrpc](https://github.com/Textalk/jquery.jsonrpcclient.js) by [Maksim Karelov](https://github.com/Ty3uK) * [:link:](jquery.noty/jquery.noty.d.ts) [jQuery.noty](http://needim.github.io/noty) by [Aaron King](https://github.com/kingdango) * [:link:](jquery.payment/jquery.payment.d.ts) [jQuery.payment](https://github.com/stripe/jquery.payment) by [Eric J. Smith](https://github.com/ejsmith) * [:link:](jquery.pjax.falsandtru/jquery.pjax.d.ts) [jquery.pjax.ts by falsandtru](https://github.com/falsandtru/jquery.pjax.js) by [新ゝ月 NewNotMoon](http://new.not-moon.net) @@ -442,8 +471,11 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](hashset/hashset.d.ts) [jshashset](http://www.timdown.co.uk/jshashtable/jshashset.html) by [Sergey Gerasimov](https://github.com/gerich-home) * [:link:](hashtable/hashtable.d.ts) [jshashtable](http://www.timdown.co.uk/jshashtable) by [Sergey Gerasimov](https://github.com/gerich-home) * [:link:](jsnox/jsnox.d.ts) [JSnoX](https://github.com/af/jsnox) by [Steve Baker](https://github.com/stkb) +* [:link:](json-patch/json-patch.d.ts) [json-patch](https://github.com/bruth/jsonpatch-js) by [vvakame](https://github.com/vvakame) * [:link:](json-pointer/json-pointer.d.ts) [json-pointer 1.0 l](https://www.npmjs.org/package/json-pointer) by [Bart van der Schoor](https://github.com/Bartvds) +* [:link:](json5/json5.d.ts) [JSON5](http://json5.org) by [Jason Swearingen](https://jasonswearingen.github.io) * [:link:](jsoneditoronline/jsoneditoronline.d.ts) [JSONEditorOnline](https://github.com/josdejong/jsoneditoronline) by [Vincent Bortone](https://github.com/vbortone) +* [:link:](jsonpath/jsonpath.d.ts) [jsonpath](https://www.npmjs.org/package/jsonpath) by [Hiroki Horiuchi](https://github.com/horiuchi) * [:link:](JSONStream/JSONStream.d.ts) [JSONStream](http://github.com/dominictarr/JSONStream) by [Bart van der Schoor](https://github.com/Bartvds) * [: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) @@ -451,6 +483,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [: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:](jsuri/jsuri.d.ts) [jsUri](https://github.com/derek-watson/jsUri) by [Chris Charabaruk](http://github.com/coldacid) * [: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) @@ -475,6 +508,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](knockout-transformations/knockout-transformations.d.ts) [knockout-transformations](https://github.com/One-com/knockout-transformations) by [John Reilly](https://github.com/johnnyreilly), [Wim Looman](https://github.com/Nemo157) * [:link:](knockout.mapper/knockout.mapper.d.ts) [Knockout.Mapper](https://github.com/LucasLorentz/knockout.mapper) by [Brandon Meyer](https://github.com/BMeyerKC) * [:link:](knockout.mapping/knockout.mapping.d.ts) [Knockout.Mapping](https://github.com/SteveSanderson/knockout.mapping) by [Boris Yankov](https://github.com/borisyankov) +* [:link:](knockout.punches/knockout.punches.d.ts) [knockout.punches](https://github.com/mbest/knockout.punches) by [Stephen Lautier](https://github.com/johnnyreilly) * [:link:](knockout.rx/knockout.rx.d.ts) [knockout.rx](https://github.com/Igorbek/knockout.rx) by [Igor Oleinikov](https://github.com/Igorbek) * [:link:](knockstrap/knockstrap.d.ts) [Knockstrap](http://faulknercs.github.io/Knockstrap) by [Adam Pluciński](https://github.com/adaskothebeast) * [:link:](knockout.kogrid/ko-grid.d.ts) [ko-grid](http://knockout-contrib.github.io/KoGrid) by [huer12](https://github.com/huer12) @@ -488,7 +522,8 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](leaflet-label/leaflet-label.d.ts) [Leaflet.label](https://github.com/Leaflet/Leaflet.label) by [Wim Looman](https://github.com/Nemo157) * [:link:](jquery.leanModal/jquery.leanModal.d.ts) [leanModal.js](http://leanmodal.finelysliced.com.au) by [FinelySliced](https://github.com/FinelySliced) * [:link:](leapmotionTS/LeapMotionTS.d.ts) [Leap Motion TS](https://github.com/logotype/LeapMotionTS) by [Victor Norgren](https://github.com/logotype) -* [:link:](less/less.d.ts) [LESS](http://lesscss.org) by [AndrewGaspar](https://github.com/AndrewGaspar) +* [:link:](less/less.d.ts) [LESS](http://lesscss.org) by [Tom Hasner](https://github.com/thasner) +* [:link:](less-middleware/less-middleware.d.ts) [less-middleware](https://github.com/emberfeather/less.js-middleware) by [Federico Bond](https://github.com/federicobond) * [:link:](levelup/levelup.d.ts) [LevelUp](https://github.com/rvagg/node-levelup) by [Bret Little](https://github.com/blittle) * [:link:](libxmljs/libxmljs.d.ts) [Libxmljs](https://github.com/polotek/libxmljs) by [François de Campredon](https://github.com/fdecampredon) * [:link:](dustjs-linkedin/dustjs-linkedin.d.ts) [linkedin dustjs](https://github.com/linkedin/dustjs) by [Marcelo Dezem](http://github.com/mdezem) @@ -504,11 +539,14 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [: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:](lory.js/lory.js.d.ts) [lory](https://github.com/meandmax/lory) by [kubosho](https://github.com/kubosho) * [: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) * [:link:](lunr/lunr.d.ts) [lunr.js](https://github.com/olivernn/lunr.js) by [Sebastian Lenz](https://github.com/sebastian-lenz) * [:link:](lz-string/lz-string.d.ts) [lz-string](https://github.com/pieroxy/lz-string) by [Roman Nikitin](https://github.com/M0ns1gn0r) +* [:link:](mailcheck/mailcheck.d.ts) [Mailcheck](https://github.com/mailcheck/mailcheck) by [Paulo Cesar](http://github.com/pocesar) * [: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:](mandrill-api/mandrill-api.d.ts) [Mandrill API 1.x](http://mandrill.com) by [Paulo Cesar](https://github.com/pocesar) * [: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) @@ -516,6 +554,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [: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) * [:link:](mathjax/mathjax.d.ts) [MathJax](https://github.com/mathjax/MathJax) by [Roland Zwaga](https://github.com/rolandzwaga) +* [:link:](matter-js/matter-js.d.ts) [Matter.js](https://github.com/liabru/matter-js) by [Ivane Gegia](https://twitter.com/ivanegegia) * [:link:](mCustomScrollbar/mCustomScrollbar.d.ts) [mCustomScrollbar](https://github.com/malihu/malihu-custom-scrollbar-plugin) by [Sarah Williams](https://github.com/flurg) * [:link:](memory-cache/memory-cache.d.ts) [memory-cache](http://github.com/ptarjan/node-cache) by [Jeff Goddard](https://github.com/jedigo) * [:link:](merge-stream/merge-stream.d.ts) [merge-stream](https://github.com/grncdr/merge-stream) by [Keita Kagurazaka](https://github.com/k-kagurazaka) @@ -524,7 +563,11 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](meteor/meteor.d.ts) [Meteor](http://www.meteor.com) by [Dave Allen](https://github.com/fullflavedave) * [:link:](method-override/method-override.d.ts) [method-override](https://github.com/expressjs/method-override) by [Santi Albo](https://github.com/santialbo) * [:link:](microsoft-ajax/microsoft.ajax.d.ts) [Microsoft ASP.NET Ajax client side library](http://msdn.microsoft.com/en-us/library/ee341002(v=vs.100).aspx) by [Patrick Magee](https://github.com/pjmagee) +* [:link:](xrm/xrm.d.ts) [Microsoft Dynamics xRM API](http://www.microsoft.com/en-us/download/details.aspx?id=44567) by [David Berry](https://github.com/6ix4our), [Matt Ngan](https://github.com/mattngan) +* [:link:](xrm/xrm-6.d.ts) [Microsoft Dynamics xRM API v6](http://msdn.microsoft.com/en-us/library/gg328255.aspx) by [David Berry](https://github.com/6ix4our) +* [:link:](xrm/clientglobalcontext.d.ts) [Microsoft Dynamics xRM ClientGlobalContext.js.aspx](http://msdn.microsoft.com/en-us/library/gg328255.aspx) by [David Berry](https://github.com/6ix4our) * [:link:](microsoft-live-connect/microsoft-live-connect.d.ts) [Microsoft Live Connect](http://msdn.microsoft.com/en-us/library/live/hh243643.aspx) by [John Vilk](https://github.com/jvilk) +* [:link:](xrm/parature.d.ts) [Microsoft Parature extentions to Xrm.Page - available for CRM Online Only](http://msdn.microsoft.com/en-us/library/gg328255.aspx) by [David Berry](https://github.com/6ix4our) * [:link:](azure-mobile-services-client/AzureMobileServicesClient.d.ts) [Microsoft Windows AzureMobile Service](http://www.windowsazure.com/en-us/develop/mobile) by [Morosinotto Daniele](https://github.com/dmorosinotto) * [:link:](bingmaps/Microsoft.Maps.d.ts) [Microsoft.Maps](http://msdn.microsoft.com/en-us/library/gg427611.aspx) by [Eric Todd](https://github.com/ericrtodd) * [:link:](bingmaps/Microsoft.Maps.AdvancedShapes.d.ts) [Microsoft.Maps.AdvancedShapes](http://msdn.microsoft.com/en-us/library/hh921952.aspx) by [Eric Todd](https://github.com/ericrtodd) @@ -557,7 +600,6 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](mousetrap/mousetrap.d.ts) [Mousetrap](http://craig.is/killing/mice) by [Dániel Tar](https://github.com/qcz) * [:link:](mousetrap/mousetrap-global-bind.d.ts) [Mousetrap 1.4.6's global-bind extension](http://craig.is/killing/mice#extensions.global) by [Andrew Bradley](https://github.com/cspotcode) * [:link:](moviedb/moviedb.d.ts) [MovieDB](https://github.com/danzajdband/moviedb) by [Basarat Ali Syed](https://github.com/basarat) -* [:link:](mozilla-spidermonkey-parser-api/mozilla-spidermonkey-parser-api.d.ts) [Mozilla SpiderMonkey Parser API](https://developer.mozilla.org/en-US/docs/Mozilla/Projects/SpiderMonkey/Parser_API) by [vvakame](https://github.com/vvakame) * [:link:](firefox/firefox.d.ts) [Mozilla Web API](https://developer.mozilla.org/en-US/docs/Web/API) by [vvakame](https://github.com/vvakame) * [: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) @@ -598,20 +640,24 @@ 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.d.ts) [node_acl](https://github.com/optimalbits/node_acl) by [Qubo](https://github.com/tkQubo) * [:link:](acl/acl-mongodbBackend.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:](acl/acl.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) -* [:link:](nodemailer/nodemailer.d.ts) [Nodemailer](https://github.com/andris9/Nodemailer) by [Vincent Bortone](https://github.com/vbortone) +* [:link:](nodemailer/nodemailer-types.d.ts) [Nodemailer](https://github.com/andris9/Nodemailer) by [Rogier Schouten](https://github.com/rogierschouten) +* [:link:](nodemailer/nodemailer.d.ts) [Nodemailer](https://github.com/andris9/Nodemailer) by [Rogier Schouten](https://github.com/rogierschouten) +* [:link:](nodemailer-direct-transport/nodemailer-direct-transport.d.ts) [nodemailer-direct-transport](https://github.com/andris9/nodemailer-direct-transport) by [Rogier Schouten](https://github.com/rogierschouten) +* [:link:](nodemailer-smtp-pool/nodemailer-smtp-pool.d.ts) [nodemailer-smtp-pool](https://github.com/andris9/nodemailer-smtp-pool) by [Rogier Schouten](https://github.com/rogierschouten) +* [:link:](nodemailer-smtp-transport/nodemailer-smtp-transport.d.ts) [nodemailer-smtp-transport](https://github.com/andris9/nodemailer-smtp-transport) by [Rogier Schouten](https://github.com/rogierschouten) * [: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:](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:](wnumb/wnumb.d.ts) [nouislider](https://github.com/leongersen/wnumb) by [Corey Jepperson](https://github.com/acoreyj) +* [:link:](notifyjs/notifyjs.d.ts) [notify.js](https://github.com/alexgibson/notify.js) by [soundTricker](https://github.com/soundTricker) * [: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) @@ -658,10 +704,10 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [: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-dialog.d.ts) [polymer's paper-dialog](https://github.com/Polymer/paper-dialog) by [Louis Grignon](https://github.com/lgrignon) -* [:link:](polymer/polymer.core-overlay.d.ts) [polymer's paper-toast](https://github.com/Polymer/core-selector) 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:](polymer/polymer.core-overlay.d.ts) [polymer's paper-toast](https://github.com/Polymer/core-selector) by [Louis Grignon](https://github.com/lgrignon) * [:link:](polymer/polymer.core-selector.d.ts) [polymer's paper-toast](https://github.com/Polymer/core-selector) 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:](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) @@ -680,6 +726,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](q-io/Q-io.d.ts) [Q-io](https://github.com/kriskowal/q-io) by [Bart van der Schoor](https://github.com/Bartvds) * [:link:](q-retry/q-retry.d.ts) [q-retry](https://github.com/vilic/q-retry) by [VILIC VANE](https://github.com/vilic) * [:link:](qajax/qajax.d.ts) [Qajax](https://github.com/gre/qajax) by [Boltmade](https://github.com/Boltmade) +* [:link:](qtip2/qtip2.d.ts) [qtip2](http://qtip2.com) by [Nathan Pitman](https://github.com/Seltzer) * [: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](http://ractivejs.org) by [Han Lin Yap](http://yap.nu) @@ -692,6 +739,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [: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:](recursive-readdir/recursive-readdir.d.ts) [recursive-readdir](https://github.com/jergason/recursive-readdir) by [Elisée Maurer](https://github.com/elisee) * [: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) * [:link:](ref-array/ref-array.d.ts) [ref-array](https://github.com/TooTallNate/ref-array) by [Paul Loyd](https://github.com/loyd) @@ -728,6 +776,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [: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) +* [:link:](sanitizer/sanitizer.d.ts) [Sanitizer](https://github.com/theSmaw/Caja-HTML-Sanitizer) by [Dave Taylor](http://davetayls.me) * [:link:](sax/sax.d.ts) [sax js](https://github.com/isaacs/sax-js) by [Asana](https://asana.com) * [:link:](screenfull/screenfull.d.ts) [screenfull.js](https://github.com/sindresorhus/screenfull.js) by [Ilia Choly](http://github.com/icholy) * [:link:](select2/select2.d.ts) [Select2](http://ivaynberg.github.com/select2) by [Boris Yankov](https://github.com/borisyankov) @@ -751,7 +800,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](simple-cw-node/simple-cw-node.d.ts) [simple-cw-node](https://github.com/astronaughts/simple-cw-node) by [vvakame](https://github.com/vvakame) * [:link:](jquery.simplemodal/jquery.simplemodal.d.ts) [SimpleModal](http://www.ericmmartin.com/projects/simplemodal) by [Friedrich von Never](https://github.com/ForNeVeR) * [:link:](sinon/sinon.d.ts) [Sinon](http://sinonjs.org) by [William Sears](https://github.com/mrbigdog2u) -* [:link:](sinon-chai/sinon-chai.d.ts) [sinon-chai](https://github.com/domenic/sinon-chai) by [Kazi Manzur Rashid](https://github.com/kazimanzurrashid) +* [:link:](sinon-chai/sinon-chai.d.ts) [sinon-chai](https://github.com/domenic/sinon-chai) by [Kazi Manzur Rashid](https://github.com/kazimanzurrashid), [Jed Mao](https://github.com/jedmao) * [:link:](sipml/sipml.d.ts) [SIPml5](http://sipml5.org) by [A. Groenenboom](https://github.com/chookies) * [:link:](sjcl/sjcl.d.ts) [sjcl](http://crypto.stanford.edu/sjcl) by [Eugene Chernyshov](https://github.com/Evgenus) * [:link:](slickgrid/SlickGrid.d.ts) [SlickGrid](https://github.com/mleibman/SlickGrid) by [Josh Baldwin](https://github.com/jbaldwin) @@ -771,6 +820,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](spectrum/spectrum.d.ts) [spectrum](https://github.com/bgrins/spectrum) by [Mordechai Zuber](https://github.com/M-Zuber) * [:link:](spin/spin.d.ts) [Spin.js](http://fgnass.github.com/spin.js) by [Boris Yankov](https://github.com/borisyankov), [Theodore Brown](https://github.com/theodorejb) * [:link:](split/split.d.ts) [split](https://github.com/dominictarr/split) by [Marcin Porębski](https://github.com/marcinporebski) +* [:link:](sprintf-js/sprintf-js.d.ts) [sprintf-js](https://www.npmjs.com/package/sprintf-js) by [Jason Swearingen](https://jasonswearingen.github.io) * [: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) @@ -783,6 +833,8 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](stream-series/stream-series.d.ts) [stream-series](https://github.com/rschmukler/stream-series) by [Keita Kagurazaka](https://github.com/k-kagurazaka) * [:link:](stream-to-array/stream-to-array.d.ts) [stream-to-array](https://github.com/stream-utils/stream-to-array) by [Bart van der Schoor](https://github.com/Bartvds) * [:link:](stripe/stripe.d.ts) [stripe](https://stripe.com) by [Eric J. Smith](https://github.com/ejsmith) +* [:link:](stripe/stripe-node.d.ts) [stripe-node](https://github.com/stripe/stripe-node) by [William Johnston](https://github.com/wjohnsto) +* [:link:](strophe/strophe.d.ts) [Strophe.js](http://strophe.im/strophejs) by [David Deutsch](https://github.com/DavidKDeutsch) * [:link:](stylus/stylus.d.ts) [stylus](https://github.com/LearnBoost/stylus) by [Maxime LUCE](https://github.com/SomaticIT) * [:link:](sugar/sugar.d.ts) [Sugar](http://sugarjs.com) by [Josh Baldwin](https://github.com/jbaldwin) * [:link:](superagent/superagent.d.ts) [SuperAgent](https://github.com/visionmedia/superagent) by [Alex Varju](https://github.com/varju) @@ -792,6 +844,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](svg2png/svg2png.d.ts) [svg2png node package](https://github.com/domenic/svg2png) by [hans windhoff](https://github.com/hansrwindhoff) * [:link:](svgjs.draggable/svgjs.draggable.d.ts) [svgjs.draggable](http://www.svgjs.com) by [Luigi Trabacchin](https://github.com/LiFeleSs) * [:link:](swag/swag.d.ts) [swag](https://github.com/elving/swag) by [Shogo Iwano](https://github.com/shiwano) +* [:link:](sweetalert/sweetalert.d.ts) [SweetAlert](https://github.com/t4t5/sweetalert) by [Markus Peloso](https://github.com/ToastHawaii) * [:link:](swfobject/swfobject.d.ts) [swfobject](https://code.google.com/p/swfobject) by [rou](https://github.com/rou) * [:link:](swig/swig.d.ts) [swig](http://github.com/paularmstrong/swig) by [Peter Harris](https://github.com/CodeAnimal), [Carlos Ballesteros Velasco](https://github.com/soywiz) * [:link:](swiper/swiper.d.ts) [Swiper](https://github.com/nolimits4web/Swiper) by [Sebastián Galiano](https://github.com/sgaliano) @@ -838,7 +891,9 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](twig/twig.d.ts) [twig](https://github.com/justjohn/twig.js) by [Carlos Ballesteros Velasco](https://github.com/soywiz) * [:link:](twitter/twitter.d.ts) [Twitter for Websites](https://dev.twitter.com/web) by [Chitoku](https://github.com/chitoku-k) * [:link:](jquery.bootstrap.wizard/jquery.bootstrap.wizard.d.ts) [twitter-bootstrap-wizard](https://github.com/VinceG/twitter-bootstrap-wizard) by [Blake Niemyjski](https://github.com/niemyjski) +* [:link:](twix/twix.d.ts) [twix.js](https://github.com/icambron/twix.js) by [j3ko](https://github.com/j3ko) * [: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:](type-name/type-name.d.ts) [type-name](https://github.com/twada/type-name) by [OKUNOKENTARO](https://github.com/armorik83) * [: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) @@ -847,6 +902,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](underscore/underscore.d.ts) [Underscore](http://underscorejs.org) by [Boris Yankov](https://github.com/borisyankov), [Josh Baldwin](https://github.com/jbaldwin) * [:link:](underscore-ko/underscore-ko.d.ts) [Underscore-ko 1.2.2 with underscore](https://github.com/kamranayub/UnderscoreKO) by [Maurits Elbers](https://github.com/MagicMau) * [:link:](underscore.string/underscore.string.d.ts) [underscore.string](https://github.com/epeli/underscore.string) by [Ry Racherbaumer](http://github.com/rygine) +* [:link:](uniq/uniq.d.ts) [uniq](https://www.npmjs.com/package/uniq) by [Hans Windhoff](https://github.com/hansrwindhoff) * [:link:](universal-analytics/universal-analytics.d.ts) [universal-analytics](https://github.com/peaksandpies/universal-analytics) by [Bart van der Schoor](https://github.com/Bartvds) * [:link:](update-notifier/update-notifier.d.ts) [update-notifier](https://github.com/yeoman/update-notifier) by [vvakame](https://github.com/vvakame) * [:link:](uri-templates/uri-templates.d.ts) [uri-templates](https://github.com/geraintluff/uri-templates) by [Bart van der Schoor](https://github.com/Bartvds) @@ -859,6 +915,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](vega/vega.d.ts) [Vega](http://trifacta.github.io/vega) by [Tom Crockett](http://github.com/pelotom) * [:link:](velocity-animate/velocity-animate.d.ts) [Velocity](http://velocityjs.org) by [Greg Smith](https://github.com/smrq) * [:link:](vex-js/vex-js.d.ts) [Vex](https://github.com/HubSpot/vex) by [Greg Cohan](https://github.com/gdcohan) +* [:link:](victor/victor.d.ts) [Victor.js](http://victorjs.org) by [Ivane Gegia](https://twitter.com/ivanegegia) * [:link:](videojs/videojs.d.ts) [Video.js](https://github.com/zencoder/video-js) by [Vincent Bortone](https://github.com/vbortone) * [:link:](vimeo/froogaloop.d.ts) [Vimeo](http://developer.vimeo.com/player/js-api) by [Daz Wilkin](https://github.com/DazWilkin) * [:link:](vinyl/vinyl.d.ts) [vinyl](https://github.com/wearefractal/vinyl) by [vvakame](https://github.com/vvakame), [jedmao](https://github.com/jedmao) @@ -877,6 +934,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [: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:](websql/websql.d.ts) [websql](http://www.w3.org/TR/webdatabase) by [TeamworkGuy2](https://github.com/TeamworkGuy2) * [:link:](when/when.d.ts) [When](https://github.com/cujojs/when) by [Derek Cicerone](https://github.com/derekcicerone), [Wim Looman](https://github.com/Nemo157) * [:link:](which/which.d.ts) [which](https://github.com/isaacs/node-which) by [vvakame](https://github.com/vvakame) * [:link:](jquery.window/jquery.window.d.ts) [Window plugin for jQuery](http://fstoke.me/jquery/window) by [Ryan Graham](https://github.com/ryan-codingintrigue) @@ -893,6 +951,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](xpath/xpath.d.ts) [xpath](https://github.com/goto100/xpath) by [Andrew Bradley](https://github.com/cspotcode) * [:link:](xregexp/xregexp.d.ts) [XRegExp](http://xregexp.com) by [Bart van der Schoor](https://github.com/Bartvds) * [:link:](xsockets/XSockets.d.ts) [XSockets.NET](http://xsockets.net) by [Jeffery Grajkowski](https://github.com/pushplay) +* [:link:](xss-filters/xss-filters.d.ts) [Yahoo XSS Filters](https://github.com/yahoo/xss-filters) by [Dave Taylor](http://davetayls.me) * [:link:](yamljs/yamljs.d.ts) [yamljs](https://github.com/jeremyfa/yaml.js) by [Tim Jonischkat](http://www.tim-jonischkat.de) * [:link:](yargs/yargs.d.ts) [yargs](https://github.com/chevex/yargs) by [Martin Poelstra](https://github.com/poelstra) * [:link:](yeoman-generator/yeoman-generator.d.ts) [yeoman-generator](https://github.com/yeoman/generator) by [Kentaro Okuno](http://github.com/armorik83) diff --git a/DataStream.js/DataStream.js-tests.ts b/DataStream.js/DataStream.js-tests.ts new file mode 100644 index 000000000..71bb08537 --- /dev/null +++ b/DataStream.js/DataStream.js-tests.ts @@ -0,0 +1,180 @@ +/// + +var buf = new ArrayBuffer(100); +var ds = new DataStream(buf); +ds = new DataStream(buf, 10); +ds = new DataStream(buf, 10, DataStream.BIG_ENDIAN); + +ds.save('somefile.ext'); +ds.dynamicSize = true; + +for (var i=0; i +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare class DataStream { + + /** + Big-endian const to use as default endianness. + */ + static BIG_ENDIAN: boolean; + + /** + Little-endian const to use as default endianness. + */ + static LITTLE_ENDIAN: boolean; + + /** + DataStream reads scalars, arrays and structs of data from an ArrayBuffer. + It's like a file-like DataView on steroids. + + @param {ArrayBuffer} arrayBuffer ArrayBuffer to read from. + */ + constructor(arrayBuffer: ArrayBuffer); + + /** + DataStream reads scalars, arrays and structs of data from an ArrayBuffer. + It's like a file-like DataView on steroids. + + @param arrayBuffer ArrayBuffer to read from. + @param byteOffset Offset from arrayBuffer beginning for the DataStream. + */ + constructor(arrayBuffer: ArrayBuffer, byteOffset: number); + + /** + DataStream reads scalars, arrays and structs of data from an ArrayBuffer. + It's like a file-like DataView on steroids. + + @param arrayBuffer ArrayBuffer to read from. + @param byteOffset Offset from arrayBuffer beginning for the DataStream. + @param endianness DataStream.BIG_ENDIAN or DataStream.LITTLE_ENDIAN (the default). + */ + constructor(arrayBuffer: ArrayBuffer, byteOffset: number, endianness: boolean); + + /** + Saves the DataStream contents to the given filename. + Uses Chrome's anchor download property to initiate download. + * + @param filename Filename to save as. + @return nothing + */ + save(filename: string): void; + + /** + Whether to extend DataStream buffer when trying to write beyond its size. + If set, the buffer is reallocated to twice its current size until the + requested write fits the buffer. + */ + dynamicSize: boolean; + + /** + Returns the byte length of the DataStream object. + */ + byteLength: number; + + /** + Set/get the backing ArrayBuffer of the DataStream object. + The setter updates the DataView to point to the new buffer. + */ + buffer: ArrayBuffer; + + /** + Set/get the byteOffset of the DataStream object. + The setter updates the DataView to point to the new byteOffset. + */ + byteOffset: number; + + /** + Set/get the backing DataView of the DataStream object. + The setter updates the buffer and byteOffset to point to the DataView values. + */ + dataView: Object; + + /** + Sets the DataStream read/write position to given position. + Clamps between 0 and DataStream length. + * + @param pos Position to seek to. + @return nothing + */ + seek(pos: number): void; + + /** + Returns true if the DataStream seek pointer is at the end of buffer and + there's no more data to read. + * + @return true if the seek pointer is at the end of the buffer. + */ + isEof(): boolean; + + /** + Maps an Int32Array into the DataStream buffer, swizzling it to native + endianness in-place. The current offset from the start of the buffer needs to + be a multiple of element size, just like with typed array views. + * + Nice for quickly reading in data. Warning: potentially modifies the buffer + contents. + * + @param length Number of elements to map. + @return Int32Array to the DataStream backing buffer. + */ + mapInt32Array(length: number): Int32Array; + + /** + Maps an Int32Array into the DataStream buffer, swizzling it to native + endianness in-place. The current offset from the start of the buffer needs to + be a multiple of element size, just like with typed array views. + * + Nice for quickly reading in data. Warning: potentially modifies the buffer + contents. + * + @param length Number of elements to map. + @param e Endianness of the data to read. + @return Int32Array to the DataStream backing buffer. + */ + mapInt32Array(length: number, e: boolean): Int32Array; + + /** + Maps an Int16Array into the DataStream buffer, swizzling it to native + endianness in-place. The current offset from the start of the buffer needs to + be a multiple of element size, just like with typed array views. + * + Nice for quickly reading in data. Warning: potentially modifies the buffer + contents. + * + @param length Number of elements to map. + @return Int16Array to the DataStream backing buffer. + */ + mapInt16Array(length: number): Int16Array; + + /** + Maps an Int16Array into the DataStream buffer, swizzling it to native + endianness in-place. The current offset from the start of the buffer needs to + be a multiple of element size, just like with typed array views. + * + Nice for quickly reading in data. Warning: potentially modifies the buffer + contents. + * + @param length Number of elements to map. + @param e Endianness of the data to read. + @return Int16Array to the DataStream backing buffer. + */ + mapInt16Array(length: number, e: boolean): Int16Array; + + /** + Maps an Int8Array into the DataStream buffer. + * + Nice for quickly reading in data. + * + @param length Number of elements to map. + @return Int8Array to the DataStream backing buffer. + */ + mapInt8Array(length: number): Int8Array; + + /** + Maps a Uint32Array into the DataStream buffer, swizzling it to native + endianness in-place. The current offset from the start of the buffer needs to + be a multiple of element size, just like with typed array views. + * + Nice for quickly reading in data. Warning: potentially modifies the buffer + contents. + * + @param length Number of elements to map. + @return Uint32Array to the DataStream backing buffer. + */ + mapUint32Array(length: number): Uint32Array; + + /** + Maps a Uint32Array into the DataStream buffer, swizzling it to native + endianness in-place. The current offset from the start of the buffer needs to + be a multiple of element size, just like with typed array views. + * + Nice for quickly reading in data. Warning: potentially modifies the buffer + contents. + * + @param length Number of elements to map. + @param e Endianness of the data to read. + @return Uint32Array to the DataStream backing buffer. + */ + mapUint32Array(length: number, e: boolean): Uint32Array; + + /** + Maps a Uint16Array into the DataStream buffer, swizzling it to native + endianness in-place. The current offset from the start of the buffer needs to + be a multiple of element size, just like with typed array views. + * + Nice for quickly reading in data. Warning: potentially modifies the buffer + contents. + * + @param length Number of elements to map. + @return Uint16Array to the DataStream backing buffer. + */ + mapUint16Array(length: number): Uint16Array; + + /** + Maps a Uint16Array into the DataStream buffer, swizzling it to native + endianness in-place. The current offset from the start of the buffer needs to + be a multiple of element size, just like with typed array views. + * + Nice for quickly reading in data. Warning: potentially modifies the buffer + contents. + * + @param length Number of elements to map. + @param e Endianness of the data to read. + @return Uint16Array to the DataStream backing buffer. + */ + mapUint16Array(length: number, e: boolean): Uint16Array; + + /** + Maps a Uint8Array into the DataStream buffer. + * + Nice for quickly reading in data. + * + @param length Number of elements to map. + @return Uint8Array to the DataStream backing buffer. + */ + mapUint8Array(length: number): Uint8Array; + + /** + Maps a Float64Array into the DataStream buffer, swizzling it to native + endianness in-place. The current offset from the start of the buffer needs to + be a multiple of element size, just like with typed array views. + * + Nice for quickly reading in data. Warning: potentially modifies the buffer + contents. + * + @param length Number of elements to map. + @return Float64Array to the DataStream backing buffer. + */ + mapFloat64Array(length: number): Float64Array; + + /** + Maps a Float64Array into the DataStream buffer, swizzling it to native + endianness in-place. The current offset from the start of the buffer needs to + be a multiple of element size, just like with typed array views. + * + Nice for quickly reading in data. Warning: potentially modifies the buffer + contents. + * + @param length Number of elements to map. + @param e Endianness of the data to read. + @return Float64Array to the DataStream backing buffer. + */ + mapFloat64Array(length: number, e: boolean): Float64Array; + + /** + Maps a Float32Array into the DataStream buffer, swizzling it to native + endianness in-place. The current offset from the start of the buffer needs to + be a multiple of element size, just like with typed array views. + * + Nice for quickly reading in data. Warning: potentially modifies the buffer + contents. + * + @param length Number of elements to map. + @return Float32Array to the DataStream backing buffer. + */ + mapFloat32Array(length: number): Float32Array; + + /** + Maps a Float32Array into the DataStream buffer, swizzling it to native + endianness in-place. The current offset from the start of the buffer needs to + be a multiple of element size, just like with typed array views. + * + Nice for quickly reading in data. Warning: potentially modifies the buffer + contents. + * + @param length Number of elements to map. + @param e Endianness of the data to read. + @return Float32Array to the DataStream backing buffer. + */ + mapFloat32Array(length: number, e: boolean): Float32Array; + + /** + Reads an Int32Array of desired length and endianness from the DataStream. + * + @param length Number of elements to map. + @return The read Int32Array. + */ + readInt32Array(length: number): Int32Array; + + /** + Reads an Int32Array of desired length and endianness from the DataStream. + * + @param length Number of elements to map. + @param e Endianness of the data to read. + @return The read Int32Array. + */ + readInt32Array(length: number, e: boolean): Int32Array; + + /** + Reads an Int16Array of desired length and endianness from the DataStream. + * + @param length Number of elements to map. + @return The read Int16Array. + */ + readInt16Array(length: number): Int16Array; + + /** + Reads an Int16Array of desired length and endianness from the DataStream. + * + @param length Number of elements to map. + @param e Endianness of the data to read. + @return The read Int16Array. + */ + readInt16Array(length: number, e: boolean): Int16Array; + + /** + Reads an Int8Array of desired length from the DataStream. + * + @param length Number of elements to map. + @return The read Int8Array. + */ + readInt8Array(length: number): Int8Array; + + /** + Reads an Uint32Array of desired length and endianness from the DataStream. + * + @param length Number of elements to map. + @return The read Uint32Array. + */ + readUint32Array(length: number): Uint32Array; + + /** + Reads an Uint32Array of desired length and endianness from the DataStream. + * + @param length Number of elements to map. + @param e Endianness of the data to read. + @return The read Uint32Array. + */ + readUint32Array(length: number, e: boolean): Uint32Array; + + /** + Reads an Uint16Array of desired length and endianness from the DataStream. + * + @param length Number of elements to map. + @return The read Uint16Array. + */ + readUint16Array(length: number): Uint16Array; + + /** + Reads an Uint16Array of desired length and endianness from the DataStream. + * + @param length Number of elements to map. + @param e Endianness of the data to read. + @return The read Uint16Array. + */ + readUint16Array(length: number, e: boolean): Uint16Array; + + /** + Reads an Uint8Array of desired length from the DataStream. + * + @param length Number of elements to map. + @return The read Uint8Array. + */ + readUint8Array(length: number): Uint8Array; + + /** + Reads a Float64Array of desired length and endianness from the DataStream. + * + @param length Number of elements to map. + @param e Endianness of the data to read. + @return The read Float64Array. + */ + readFloat64Array(length: number, e: boolean): Float64Array; + + /** + Reads a Float64Array of desired length and endianness from the DataStream. + * + @param length Number of elements to map. + @return The read Float64Array. + */ + readFloat64Array(length: number): Float64Array; + + /** + Reads a Float32Array of desired length and endianness from the DataStream. + * + @param length Number of elements to map. + @param e Endianness of the data to read. + @return The read Float32Array. + */ + readFloat32Array(length: number, e: boolean): Float32Array; + + /** + Reads a Float32Array of desired length and endianness from the DataStream. + * + @param length Number of elements to map. + @return The read Float32Array. + */ + readFloat32Array(length: number): Float32Array; + + /** + Writes an Int32Array of specified endianness to the DataStream. + * + @param arr The array to write. + @param e Endianness of the data to write. + */ + writeInt32Array(arr: Int32Array, e: boolean): void; + + /** + Writes an Int32Array of specified endianness to the DataStream. + * + @param arr The array to write. + */ + writeInt32Array(arr: Int32Array): void; + + /** + Writes an Int16Array of specified endianness to the DataStream. + * + @param arr The array to write. + @param e Endianness of the data to write. + */ + writeInt16Array(arr: Int16Array, e: boolean): void; + + /** + Writes an Int16Array of specified endianness to the DataStream. + * + @param arr The array to write. + */ + writeInt16Array(arr: Int16Array): void; + + /** + Writes an Int8Array to the DataStream. + * + @param arr The array to write. + */ + writeInt8Array(arr: Int8Array): void; + + /** + Writes an Uint32Array of specified endianness to the DataStream. + * + @param arr The array to write. + @param e Endianness of the data to write. + */ + writeUint32Array(arr: Uint32Array, e: boolean): void; + + /** + Writes an Uint32Array of specified endianness to the DataStream. + * + @param arr The array to write. + */ + writeUint32Array(arr: Uint32Array): void; + + /** + Writes an Uint16Array of specified endianness to the DataStream. + * + @param arr The array to write. + @param e Endianness of the data to write. + */ + writeUint16Array(arr: Uint16Array, e: boolean): void; + + /** + Writes an Uint16Array of specified endianness to the DataStream. + * + @param arr The array to write. + */ + writeUint16Array(arr: Uint16Array): void; + + /** + Writes an Uint8Array to the DataStream. + * + @param arr The array to write. + */ + writeUint8Array(arr: Uint8Array): void; + + /** + Writes a Float64Array of specified endianness to the DataStream. + * + @param arr The array to write. + */ + writeFloat64Array(arr: Float64Array): void; + + /** + Writes a Float64Array of specified endianness to the DataStream. + * + @param arr The array to write. + @param e Endianness of the data to write. + */ + writeFloat64Array(arr: Float64Array, e: boolean): void; + + /** + Writes a Float32Array of specified endianness to the DataStream. + * + @param arr The array to write. + */ + writeFloat32Array(arr: Float32Array): void; + + /** + Writes a Float32Array of specified endianness to the DataStream. + * + @param arr The array to write. + @param e Endianness of the data to write. + */ + writeFloat32Array(arr: Float32Array, e: boolean): void; + + /** + Reads a 32-bit int from the DataStream with the desired endianness. + * + @return The read number. + */ + readInt32(): number; + + /** + Reads a 32-bit int from the DataStream with the desired endianness. + * + @param e Endianness of the number. + @return The read number. + */ + readInt32(e: boolean): number; + + /** + Reads a 16-bit int from the DataStream with the desired endianness. + * + @return The read number. + */ + readInt16(): number; + + /** + Reads a 16-bit int from the DataStream with the desired endianness. + * + @param e Endianness of the number. + @return The read number. + */ + readInt16(e: boolean): number; + + /** + Reads an 8-bit int from the DataStream. + * + @return The read number. + */ + readInt8(): number; + + /** + Reads a 32-bit unsigned int from the DataStream with the desired endianness. + * + @return The read number. + */ + readUint32(): number; + + /** + Reads a 32-bit unsigned int from the DataStream with the desired endianness. + * + @param e Endianness of the number. + @return The read number. + */ + readUint32(e: boolean): number; + + /** + Reads a 16-bit unsigned int from the DataStream with the desired endianness. + * + @return The read number. + */ + readUint16(): number; + + /** + Reads a 16-bit unsigned int from the DataStream with the desired endianness. + * + @param e Endianness of the number. + @return The read number. + */ + readUint16(e: boolean): number; + + /** + Reads an 8-bit unsigned intfrom the DataStream. + * + @return The read number. + */ + readUint8(): number; + + /** + Reads a 32-bit float from the DataStream with the desired endianness. + * + @return The read number. + */ + readFloat32(): number; + + /** + Reads a 32-bit float from the DataStream with the desired endianness. + * + @param e Endianness of the number. + @return The read number. + */ + readFloat32(e: boolean): number; + + /** + Reads a 64-bit float from the DataStream with the desired endianness. + * + @return The read number. + */ + readFloat64(): number; + + /** + Reads a 64-bit float from the DataStream with the desired endianness. + * + @param e Endianness of the number. + @return The read number. + */ + readFloat64(e: boolean): number; + + /** + Writes a 32-bit int to the DataStream with the desired endianness. + * + @param v Number to write. + */ + writeInt32(v: number): void; + + /** + Writes a 32-bit int to the DataStream with the desired endianness. + * + @param v Number to write. + @param e Endianness of the number. + */ + writeInt32(v: number, e: boolean): void; + + /** + Writes a 16-bit int to the DataStream with the desired endianness. + * + @param v Number to write. + */ + writeInt16(v: number): void; + + /** + Writes a 16-bit int to the DataStream with the desired endianness. + * + @param v Number to write. + @param e Endianness of the number. + */ + writeInt16(v: number, e: boolean): void; + + /** + Writes an 8-bit int to the DataStream. + * + @param v Number to write. + */ + writeInt8(v: number): void; + + /** + Writes a 32-bit undigned int to the DataStream with the desired endianness. + * + @param v Number to write. + */ + writeUint32(v: number): void; + + /** + Writes a 32-bit undigned int to the DataStream with the desired endianness. + * + @param v Number to write. + @param e Endianness of the number. + */ + writeUint32(v: number, e: boolean): void; + + /** + Writes a 16-bit undigned int to the DataStream with the desired endianness. + * + @param v Number to write. + */ + writeUint16(v: number): void; + + /** + Writes a 16-bit undigned int to the DataStream with the desired endianness. + * + @param v Number to write. + @param e Endianness of the number. + */ + writeUint16(v: number, e: boolean): void; + + /** + Writes an 8-bit undigned int to the DataStream. + * + @param v Number to write. + */ + writeUint8(v: number): void; + + /** + Writes a 32-bit float to the DataStream with the desired endianness. + * + @param v Number to write. + */ + writeFloat32(v: number): void; + + /** + Writes a 32-bit float to the DataStream with the desired endianness. + * + @param v Number to write. + @param e Endianness of the number. + */ + writeFloat32(v: number, e: boolean): void; + + /** + Writes a 64-bit float to the DataStream with the desired endianness. + * + @param v Number to write. + */ + writeFloat64(v: number): void; + + /** + Writes a 64-bit float to the DataStream with the desired endianness. + * + @param v Number to write. + @param e Endianness of the number. + */ + writeFloat64(v: number, e: boolean): void; + + /** + Reads a struct of data from the DataStream. The struct is defined as + a flat array of [name, type]-pairs. See the example below: + * + ds.readStruct([ + 'headerTag', 'uint32', // Uint32 in DataStream endianness. + 'headerTag2', 'uint32be', // Big-endian Uint32. + 'headerTag3', 'uint32le', // Little-endian Uint32. + 'array', ['[]', 'uint32', 16], // Uint32Array of length 16. + 'array2Length', 'uint32', + 'array2', ['[]', 'uint32', 'array2Length'] // Uint32Array of length array2Length + ]); + * + The possible values for the type are as follows: + * + // Number types + // Unsuffixed number types use DataStream endianness. + // To explicitly specify endianness, suffix the type with + // 'le' for little-endian or 'be' for big-endian, + // e.g. 'int32be' for big-endian int32. + 'uint8' -- 8-bit unsigned int + 'uint16' -- 16-bit unsigned int + 'uint32' -- 32-bit unsigned int + 'int8' -- 8-bit int + 'int16' -- 16-bit int + 'int32' -- 32-bit int + 'float32' -- 32-bit float + 'float64' -- 64-bit float + * + // String types + 'cstring' -- ASCII string terminated by a zero byte. + 'string:N' -- ASCII string of length N, where N is a literal integer. + 'string:variableName' -- ASCII string of length $variableName, + where 'variableName' is a previously parsed number in the current struct. + 'string,CHARSET:N' -- String of byteLength N encoded with given CHARSET. + 'u16string:N' -- UCS-2 string of length N in DataStream endianness. + 'u16stringle:N' -- UCS-2 string of length N in little-endian. + 'u16stringbe:N' -- UCS-2 string of length N in big-endian. + * + // Complex types + [name, type, name_2, type_2, ..., name_N, type_N] -- Struct + function(dataStream, struct) {} -- Callback function to read and return data. + {get: function(dataStream, struct) {}, + set: function(dataStream, struct) {}} + -- Getter/setter functions to read and return data, handy for using the same + struct definition for reading and writing structs. + ['[]', type, length] -- Array of given type and length. The length can be either + a number, a string that references a previously-read + field, or a callback function(struct, dataStream, type){}. + If length is '*', reads in as many elements as it can. + * + @param structDefinition Struct definition object. + @return The read struct. Null if failed to read struct. + */ + readStruct(structDefinition: any[]): Object; + + /** + Writes a struct to the DataStream. Takes a structDefinition that gives the + types and a struct object that gives the values. Refer to readStruct for the + structure of structDefinition. + * + @param structDefinition Type definition of the struct. + @param struct The struct data object. + */ + writeStruct(structDefinition: Object, struct: Object): void; + + /** + Read UCS-2 string of desired length and endianness from the DataStream. + * + @param length The length of the string to read. + @return The read string. + */ + readUCS2String(length: number): string; + + /** + Read UCS-2 string of desired length and endianness from the DataStream. + * + @param length The length of the string to read. + @param endianness The endianness of the string data in the DataStream. + @return The read string. + */ + readUCS2String(length: number, endianness: boolean): string; + + /** + Write a UCS-2 string of desired endianness to the DataStream. The + lengthOverride argument lets you define the number of characters to write. + If the string is shorter than lengthOverride, the extra space is padded with + zeroes. + * + @param str The string to write. + */ + writeUCS2String(str: string): void; + + /** + Write a UCS-2 string of desired endianness to the DataStream. The + lengthOverride argument lets you define the number of characters to write. + If the string is shorter than lengthOverride, the extra space is padded with + zeroes. + * + @param str The string to write. + @param endianness The endianness to use for the written string data. + */ + writeUCS2String(str: string, endianness: boolean): void; + + /** + Write a UCS-2 string of desired endianness to the DataStream. The + lengthOverride argument lets you define the number of characters to write. + If the string is shorter than lengthOverride, the extra space is padded with + zeroes. + * + @param str The string to write. + @param endianness The endianness to use for the written string data. + @param lengthOverride The number of characters to write. + */ + writeUCS2String(str: string, endianness: boolean, lengthOverride: number): void; + + /** + Read a string of desired length and encoding from the DataStream. + * + @param length The length of the string to read in bytes. + @return The read string. + */ + readString(length: number): string; + + /** + Read a string of desired length and encoding from the DataStream. + * + @param length The length of the string to read in bytes. + @param encoding The encoding of the string data in the DataStream. Defaults to ASCII. + @return The read string. + */ + readString(length: number, encoding: string): string; + + /** + Writes a string of desired length and encoding to the DataStream. + * + @param s The string to write. + */ + writeString(s: string): void; + + /** + Writes a string of desired length and encoding to the DataStream. + * + @param s The string to write. + @param encoding The encoding for the written string data. Defaults to ASCII. + */ + writeString(s: string, encoding: string): void; + + /** + Writes a string of desired length and encoding to the DataStream. + * + @param s The string to write. + @param encoding The encoding for the written string data. Defaults to ASCII. + @param length The number of characters to write. + */ + writeString(s: string, encoding: string, length: number): void; + + /** + Read null-terminated string of desired length from the DataStream. Truncates + the returned string so that the null byte is not a part of it. + * + @return The read string. + */ + readCString(): string; + + /** + Read null-terminated string of desired length from the DataStream. Truncates + the returned string so that the null byte is not a part of it. + * + @param length The length of the string to read. + @return The read string. + */ + readCString(length: number): string; + + /** + Writes a null-terminated string to DataStream and zero-pads it to length + bytes. If length is not given, writes the string followed by a zero. + If string is longer than length, the written part of the string does not have + a trailing zero. + * + @param s The string to write. + */ + writeCString(s: string): void; + + /** + Writes a null-terminated string to DataStream and zero-pads it to length + bytes. If length is not given, writes the string followed by a zero. + If string is longer than length, the written part of the string does not have + a trailing zero. + * + @param s The string to write. + @param length The number of characters to write. + */ + writeCString(s: string, length: number): void; + + /** + Reads an object of type t from the DataStream, passing struct as the thus-far + read struct to possible callbacks that refer to it. Used by readStruct for + reading in the values, so the type is one of the readStruct types. + * + @param t Type of the object to read. + @return Returns the object on successful read, null on unsuccessful. + */ + readType(t: Object): Object; + + /** + Reads an object of type t from the DataStream, passing struct as the thus-far + read struct to possible callbacks that refer to it. Used by readStruct for + reading in the values, so the type is one of the readStruct types. + * + @param t Type of the object to read. + @param struct Struct to refer to when resolving length references and for calling callbacks. + @return Returns the object on successful read, null on unsuccessful. + */ + readType(t: Object, struct: Object): Object; + + /** + Writes object v of type t to the DataStream. + * + @param t Type of data to write. + @param v Value of data to write. + @param struct Struct to pass to write callback functions. + */ + writeType(t: Object, v: Object, struct: Object): void; +} diff --git a/ace/ace.d.ts b/ace/ace.d.ts index 29fadf3bc..72fefbc6e 100644 --- a/ace/ace.d.ts +++ b/ace/ace.d.ts @@ -576,7 +576,7 @@ declare module AceAjax { /** * Returns the current tab size. **/ - getTabSize(): string; + getTabSize(): number; /** * Returns `true` if the character at the position is a soft tab. @@ -1034,6 +1034,9 @@ declare module AceAjax { * Event sessions dealing with the mouse and keyboard are bubbled up from `Document` to the `Editor`, which decides what to do with them. **/ export interface Editor { + + addEventListener(ev: 'change', callback: (ev: EditorChangeEvent) => any); + addEventListener(ev: string, callback: Function); inMultiSelectMode: boolean; @@ -1710,6 +1713,13 @@ declare module AceAjax { **/ new(renderer: VirtualRenderer, session?: IEditSession): Editor; } + + interface EditorChangeEvent { + start: Position; + end: Position; + action: string; // insert, remove + lines: any[]; + } //////////////////////////////// /// PlaceHolder diff --git a/angular-file-upload/angular-file-upload-tests.ts b/angular-file-upload/angular-file-upload-tests.ts index d59e65b4e..85dcb7853 100644 --- a/angular-file-upload/angular-file-upload-tests.ts +++ b/angular-file-upload/angular-file-upload-tests.ts @@ -10,35 +10,41 @@ module controllers { static $inject = ["$upload"]; constructor( - private $upload: ng.angularFileUpload.IUploadService + private $upload: angular.angularFileUpload.IUploadService ) { } onFileSelect($files: File[]) { - //$files: an array of files selected, each file has name, size, and type. - var uploads: ng.IPromise[] = []; + // $files: an array of files selected, each file has name, size, and type. for (var i = 0; i < $files.length; i++) { var file = $files[i]; - uploads.push(this.$upload.upload({ - url: "/api/upload", - method: "POST", - data: { - extraData: { - fileName: file.name, test: "anything" - } - }, - file: file + this.$upload.upload({ + url: "/api/upload", + method: "POST", + data: { + extraData: { + fileName: file.name, + test: "anything" + } + }, + file: file + }) + .abort() + .xhr((evt: any) => { + console.log('xhr'); }) - .progress((evt: any) => { - console.log('progress'); - }) - .then(success => { - // file is uploaded successfully - console.log(success.data); - }) - .catch(err => { - console.error(err); - })); + .progress((evt: angular.angularFileUpload.IFileProgressEvent) => { + var percent = parseInt((100.0 * evt.loaded / evt.total).toString(), 10); + console.log("upload progress: " + percent + "% for " + evt.config.file.name); + }) + .error((data: any, status: number, response: any, headers: any) => { + console.error(data, status, response, headers); + }) + .success((data: any, status: number, headers: any, config: angular.angularFileUpload.IFileUploadConfig) => { + // file is uploaded successfully + console.log("Success!", data, status, headers, config); + }); + } } } diff --git a/angular-file-upload/angular-file-upload.d.ts b/angular-file-upload/angular-file-upload.d.ts index 2eb0e72b5..d38c43226 100644 --- a/angular-file-upload/angular-file-upload.d.ts +++ b/angular-file-upload/angular-file-upload.d.ts @@ -1,5 +1,5 @@ -// Type definitions for Angular File Upload 1.6.7 -// Project: https://github.com/danialfarid/angular-file-upload +// Type definitions for Angular File Upload 4.2.1 +// Project: https://github.com/danialfarid/ng-file-upload // Definitions by: John Reilly // Definitions: https://github.com/borisyankov/DefinitelyTyped @@ -9,18 +9,24 @@ declare module angular.angularFileUpload { interface IUploadService { - http(config: ng.IRequestConfig): IUploadPromise; + http(config: IRequestConfig): IUploadPromise; upload(config: IFileUploadConfig): IUploadPromise; } interface IUploadPromise extends IHttpPromise { - + abort(): IUploadPromise; progress(callback: IHttpPromiseCallback): IUploadPromise; + xhr(callback: IHttpPromiseCallback): IUploadPromise; } - interface IFileUploadConfig extends ng.IRequestConfig { + interface IFileUploadConfig extends IRequestConfig { file: File; fileName?: string; } -} + + interface IFileProgressEvent extends ProgressEvent { + + config: IFileUploadConfig; + } +} \ No newline at end of file diff --git a/angular-jwt/angular-jwt-tests.ts b/angular-jwt/angular-jwt-tests.ts new file mode 100644 index 000000000..7f66f2611 --- /dev/null +++ b/angular-jwt/angular-jwt-tests.ts @@ -0,0 +1,17 @@ +/// +/// + +var app = angular.module("angular-jwt-tests", ["angular-jwt"]); + +var $jwtHelper: angular.jwt.IJwtHelper; + +var expToken = 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczovL3NhbXBsZXMuYXV0aDAuY29tLyIsInN1YiI6ImZhY2Vib29rfDEwMTU0Mjg3MDI3NTEwMzAyIiwiYXVkIjoiQlVJSlNXOXg2MHNJSEJ3OEtkOUVtQ2JqOGVESUZ4REMiLCJleHAiOjE0MTIyMzQ3MzAsImlhdCI6MTQxMjE5ODczMH0.7M5sAV50fF1-_h9qVbdSgqAnXVF7mz3I6RjS6JiH0H8'; +var tokenPayload = $jwtHelper.decodeToken(expToken); +var date = $jwtHelper.getTokenExpirationDate(expToken); +var bool = $jwtHelper.isTokenExpired(expToken); + +var $jwtInterceptor: angular.jwt.IJwtInterceptor; + +$jwtInterceptor.tokenGetter = () => { + return expToken; +} diff --git a/angular-jwt/angular-jwt.d.ts b/angular-jwt/angular-jwt.d.ts new file mode 100644 index 000000000..55bb3e4f6 --- /dev/null +++ b/angular-jwt/angular-jwt.d.ts @@ -0,0 +1,30 @@ +// Type definitions for angular-jwt 0.0.8 +// Project: https://github.com/auth0/angular-jwt +// Definitions by: Reto Rezzonico +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module angular.jwt { + + interface JwtToken { + iss: string; + sub: string; + aud: string; + exp: number; + nbf: number; + iat: number; + jti: string; + unique_name: string; + } + + interface IJwtHelper { + decodeToken(token: string): JwtToken; + getTokenExpirationDate(token: any): Date; + isTokenExpired(token: any, offsetSeconds?: number): boolean; + } + + interface IJwtInterceptor { + tokenGetter(): string; + } +} diff --git a/angular-local-storage/angular-local-storage-tests.ts b/angular-local-storage/angular-local-storage-tests.ts index cf61d20c9..230a32dce 100644 --- a/angular-local-storage/angular-local-storage-tests.ts +++ b/angular-local-storage/angular-local-storage-tests.ts @@ -13,7 +13,7 @@ interface TestScope extends ng.IScope { } export class TestController { - constructor($scope: TestScope, localStorageService: ng.local.storage.ILocalStorageService) { + constructor($scope: TestScope, localStorageService: ng.local.storage.ILocalStorageService) { // isSupported if (localStorageService.isSupported) { // do something @@ -29,7 +29,7 @@ export class TestController { // get $scope.getItem = (key) => { - return localStorageService.get(key); + return localStorageService.get(key); }; // remove diff --git a/angular-local-storage/angular-local-storage.d.ts b/angular-local-storage/angular-local-storage.d.ts index d40630a2a..f0500a96f 100644 --- a/angular-local-storage/angular-local-storage.d.ts +++ b/angular-local-storage/angular-local-storage.d.ts @@ -75,7 +75,7 @@ declare module angular.local.storage { } - interface ILocalStorageService { + interface ILocalStorageService { /** * Checks if the browser support the current storage type(e.g: localStorage, sessionStorage). * Returns: Boolean @@ -92,14 +92,14 @@ declare module angular.local.storage { * @param key * @param value */ - set(key: string, value: T): boolean; + set(key: string, value: T): boolean; /** * Directly get a value from local storage. * If local storage is not supported, use cookies instead. * Returns: value from local storage * @param key */ - get(key: string): T; + get(key: string): T; /** * Return array of keys for local storage, ignore keys that not owned. * Returns: value from local storage @@ -129,7 +129,7 @@ declare module angular.local.storage { * @param value optional * @param key The corresponding key used in local storage */ - bind(scope:ng.IScope, property: string, value?: any, key?: string): Function; + bind(scope: angular.IScope, property: string, value?: any, key?: string): Function; /** * Return the derive key * Returns String diff --git a/angular-localForage/angular-localForage-tests.ts b/angular-localForage/angular-localForage-tests.ts new file mode 100644 index 000000000..8b31143c2 --- /dev/null +++ b/angular-localForage/angular-localForage-tests.ts @@ -0,0 +1,126 @@ +/// +/// + +var app = angular.module('angular-localForage-tests', ['LocalForageModule']); +app.config(function (localStorageServiceProvider:angular.localForage.ILocalForageProvider) { + + //TODO +}); + +var $rootScope:angular.IRootScopeService, + $localForage:angular.localForage.ILocalForageService, + instanceVersion = 0; + +// create a fresh instance +$localForage.clear().then(function () { + $localForage = $localForage.createInstance({ + name: ++instanceVersion + }); +}); + +$localForage.getItem('this key is unknown').then(function (value) { + +}); + + +$localForage.setItem('myName', 'Olivier Combe').then(function (data) { + + $localForage.getItem('myName').then(function (data) { + }); +}); + +var values = ['Olivier Combe', 'AngularJs', 'Open Source']; + +$localForage.setItem(['myName', 'myPassion', 'myHobbie'], values).then(function (data) { + + $localForage.getItem(['myHobbie', 'myName']).then(function (data) { + }); + +}); + +$localForage.removeItem('myName').then(function () { + + $localForage.getItem('myName').then(function (data) { + }); + +}); + +$localForage.removeItem(['myName', 'myPassion']).then(function () { + + $localForage.getItem(['myName', 'myPassion', 'myHobbie']).then(function (data) { + }); + +}); + +$localForage.pull('myName').then(function (data) { + + $localForage.getItem('myName').then(function (data) { + }); + +}); +$localForage.pull(['myName', 'myPassion']).then(function (data) { + + $localForage.getItem(['myName', 'myPassion', 'myHobbie']).then(function (data) { + }); + +}); + + +$localForage.setItem('myName', 'Olivier Combe').then(function (d) { + + $localForage.getItem('myName').then(function (data) { + }); + +}); + + +$localForage.setDriver('localStorageWrapper').then(function () { + $localForage.setItem('myName', 'Olivier Combe').then(function (d) { + $localForage.getItem('myName').then(function (data) { + }); + }); +}); + +$localForage.setItem('myArray', [{ + $$hashKey: '00A', + name: 'Olivier Combe' +}]).then(function (d) { + + $localForage.getItem('myArray').then(function (data) { + }); + +}); + +$localForage.setDriver('localStorageWrapper').then(function () { + $localForage.setItem('myArray', [{ + $$hashKey: '00A', + name: 'Olivier Combe' + }]).then(function (d) { + + $localForage.getItem('myArray').then(function (data) { + }); + + }); +}); + +var aFileParts = ["hey!<\/b><\/a>"]; +var oMyBlob = new Blob(aFileParts, {"type": "text\/xml"}); // the blob + +$localForage.setItem('myBlob', oMyBlob).then(function (data) { +}); + +// $localForage.setItem(['myName', 'myPassion', 'myHobbie'], 'value'); + +// $localForage.setItem(); + + +$localForage.iterate(function (value, key) { +}).then(function (data) { +}); + +$localForage.iterate(function (value, key) { + if (key == 'myPassion') { + return value; + } +}).then(function (data) { +}); diff --git a/angular-localForage/angular-localForage.d.ts b/angular-localForage/angular-localForage.d.ts new file mode 100644 index 000000000..ee2aeeb6d --- /dev/null +++ b/angular-localForage/angular-localForage.d.ts @@ -0,0 +1,63 @@ +// Type definitions for angular-localForage 1.2.2 +// Project: https://github.com/ocombe/angular-localForage +// Definitions by: Stefan Steinhart +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// +/// + +declare module angular.localForage { + + interface LocalForageConfig { + driver?:string; + name?:string | number; + version?:number; + storeName?:string; + description?:string; + } + + interface ILocalForageProvider { + config(config:LocalForageConfig):void; + setNotify(onItemSet:boolean, onItemRemove:boolean):void; + } + + interface ILocalForageService { + setDriver(driver:string):angular.IPromise; + driver():lf.ILocalForage; + + setItem(key:string, value:any):angular.IPromise; + setItem(keys:Array, values:Array):angular.IPromise; + + getItem(key:string):angular.IPromise; + getItem(keys:Array):angular.IPromise>; + + removeItem(key:string | Array):angular.IPromise; + + pull(key:string):angular.IPromise; + pull(keys:Array):angular.IPromise>; + + clear():angular.IPromise; + + key(n:number):angular.IPromise; + + keys():angular.IPromise; + + length():angular.IPromise; + + iterate(iteratorCallback:(value:string | number, key:string)=>T):angular.IPromise; + + bind($scope:ng.IScope, key:string):void; + + bind($scope:ng.IScope, config:{ + key:string; + defaultValue:any; + scopeKey:string; + name:string; + }):void; + + unbind($scope:ng.IScope, key:string, scopeKey?:string):void; + + createInstance(config:LocalForageConfig):ILocalForageService; + instance(name:string):ILocalForageService; + } +} diff --git a/angular-material/angular-material-0.8.3.d.ts b/angular-material/angular-material-0.8.3.d.ts new file mode 100644 index 000000000..1e3eda18a --- /dev/null +++ b/angular-material/angular-material-0.8.3.d.ts @@ -0,0 +1,195 @@ +// Type definitions for Angular Material 0.8.3+ (angular.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]: angular.IPromise} + controllerAs?: string; + parent?: Element; + disableParentScroll?: boolean; + } + + interface MDBottomSheetService { + show(options: MDBottomSheetOptions): angular.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]: angular.IPromise} + controllerAs?: string; + parent?: Element; + onComplete?: Function; + } + + interface MDDialogService { + show(dialog: MDDialogOptions|MDPresetDialog): angular.IPromise; + confirm(): MDConfirmDialog; + alert(): MDAlertDialog; + hide(response?: any): void; + cancel(response?: any): void; + } + + interface MDIcon { + (path: string): angular.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]: angular.IPromise} + controllerAs?: string; + parent?: Element; + } + + interface MDToastService { + show(optionsOrPreset: MDToastOptions|MDToastPreset): angular.IPromise; + showSimple(): angular.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-material/angular-material.d.ts b/angular-material/angular-material.d.ts index 1e3eda18a..06c1ecf25 100644 --- a/angular-material/angular-material.d.ts +++ b/angular-material/angular-material.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Angular Material 0.8.3+ (angular.material module) +// Type definitions for Angular Material 0.9.0-rc1+ (angular.material module) // Project: https://github.com/angular/material // Definitions by: Matt Traynham // Definitions: https://github.com/borisyankov/DefinitelyTyped @@ -9,13 +9,15 @@ declare module angular.material { interface MDBottomSheetOptions { templateUrl?: string; template?: string; - controller?: any; + scope?: angular.IScope; // default: new child scope + preserveScope?: boolean; // default: false + controller?: string|Function; locals?: {[index: string]: any}; - targetEvent?: any; + targetEvent?: MouseEvent; resolve?: {[index: string]: angular.IPromise} controllerAs?: string; - parent?: Element; - disableParentScroll?: boolean; + parent?: string|Element|JQuery; // default: root node + disableParentScroll?: boolean; // default: true } interface MDBottomSheetService { @@ -27,7 +29,7 @@ declare module angular.material { interface MDPresetDialog { title(title: string): T; content(content: string): T; - ok(content: string): T; + ok(ok: string): T; theme(theme: string): T; } @@ -35,28 +37,31 @@ declare module angular.material { } interface MDConfirmDialog extends MDPresetDialog { - cancel(reason?: string): MDConfirmDialog; + cancel(cancel: string): MDConfirmDialog; } interface MDDialogOptions { templateUrl?: string; template?: string; - domClickEvent?: any; - disableParentScroll?: boolean; - clickOutsideToClose?: boolean; - hasBackdrop?: boolean; - escapeToClose?: boolean; - controller?: any; + targetEvent?: MouseEvent; + scope?: angular.IScope; // default: new child scope + preserveScope?: boolean; // default: false + disableParentScroll?: boolean; // default: true + hasBackdrop?: boolean // default: true + clickOutsideToClose?: boolean; // default: false + escapeToClose?: boolean; // default: true + focusOnOpen?: boolean; // default: true + controller?: string|Function; locals?: {[index: string]: any}; - bindToController?: boolean; + bindToController?: boolean; // default: false resolve?: {[index: string]: angular.IPromise} controllerAs?: string; - parent?: Element; + parent?: string|Element|JQuery; // default: root node onComplete?: Function; } interface MDDialogService { - show(dialog: MDDialogOptions|MDPresetDialog): angular.IPromise; + show(dialog: MDDialogOptions|MDAlertDialog|MDConfirmDialog): angular.IPromise; confirm(): MDConfirmDialog; alert(): MDAlertDialog; hide(response?: any): void; @@ -64,14 +69,14 @@ declare module angular.material { } interface MDIcon { - (path: string): angular.IPromise; + (id: string): angular.IPromise; // id is a unique ID or URL } 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; + icon(id: string, url: string, iconSize?: string): MDIconProvider; // iconSize default: '24px' + iconSet(id: string, url: string, iconSize?: string): MDIconProvider; // iconSize default: '24px' + defaultIconSet(url: string, iconSize?: string): MDIconProvider; // iconSize default: '24px' + defaultIconSize(iconSize: string): MDIconProvider; // default: '24px' } interface MDMedia { @@ -79,9 +84,9 @@ declare module angular.material { } interface MDSidenavObject { - toggle(): void; - open(): void; - close(): void; + toggle(): angular.IPromise; + open(): angular.IPromise; + close(): angular.IPromise; isOpen(): boolean; isLockedOpen(): boolean; } @@ -97,6 +102,7 @@ declare module angular.material { capsule(capsule: boolean): T; theme(theme: string): T; hideDelay(delay: number): T; + position(position: string): T; } interface MDSimpleToastPreset extends MDToastPreset { @@ -105,14 +111,16 @@ declare module angular.material { interface MDToastOptions { templateUrl?: string; template?: string; - hideDelay?: number; - position?: string; - controller?: any; + scope?: angular.IScope; // default: new child scope + preserveScope?: boolean; // default: false + hideDelay?: number; // default (ms): 3000 + position?: string; // any combination of 'bottom'/'left'/'top'/'right'/'fit'; default: 'bottom left' + controller?: string|Function; locals?: {[index: string]: any}; - bindToController?: boolean; + bindToController?: boolean; // default: false resolve?: {[index: string]: angular.IPromise} controllerAs?: string; - parent?: Element; + parent?: string|Element|JQuery; // default: root node } interface MDToastService { @@ -175,6 +183,7 @@ declare module angular.material { interface MDTheme { name: string; + isDark: boolean; colors: MDThemeColors; foregroundPalette: MDThemeGrayScalePalette; foregroundShadow: string; diff --git a/angular-meteor/angular-meteor-tests.ts b/angular-meteor/angular-meteor-tests.ts new file mode 100644 index 000000000..9ce0a33e9 --- /dev/null +++ b/angular-meteor/angular-meteor-tests.ts @@ -0,0 +1,255 @@ +/// + +interface ITodo { + _id?: string; + name: string; + public?: boolean; + sticky?: boolean; +} + +interface TodoAngularMeteorObject extends ITodo, angular.meteor.AngularMeteorObject {} + +interface CustomScope extends angular.meteor.IScope { + sticky: boolean; + + todos: angular.meteor.AngularMeteorCollection; + stickyTodos: angular.meteor.AngularMeteorCollection; + notAutoTodos: angular.meteor.AngularMeteorCollection; + + todo: ITodo; + todoNotAuto: TodoAngularMeteorObject; + todoSubscribed: TodoAngularMeteorObject; + + save: (todo: ITodo) => void; + saveAll: () =>void; + autoSave: (todo: ITodo) => void; + remove: (todoId: string) => void; + removeAll: () => void; + removeAuto: (todo: ITodo) => void; + toSticky: (todo: ITodo) => void; +} + +var Todos = new Mongo.Collection('todos'); + +var app = angular.module('angularMeteorTestApp'); + +app.controller("mainCtrl", ['$scope', '$meteor', ($scope: CustomScope, $meteor: angular.meteor.IMeteorService) => { + // Bind all the todos to $scope.todos + $scope.todos = $meteor.collection(Todos); + + $scope.sticky = true; + // Bind all sticky todos to $scope.stickyTodos + // Binds the query to $scope.sticky so that if it changes, Meteor will re-run the query and bind it + // to $scope.stickyTodos + $scope.stickyTodos = $meteor.collection(function(){ + return Todos.find({sticky: $scope.getReactively('sticky')}); + }); + + // Bind without auto-save all todos to $scope.notAutoTodos + $scope.notAutoTodos = $meteor.collection(Todos, false).subscribe("publicTodos"); + + $scope.todoNotAuto = $meteor.object(Todos, 'TodoID', false); + $scope.todoSubscribed = $meteor.object(Todos, 'TodoID').subscribe('todos'); + $scope.todo = $scope.todoNotAuto.getRawObject(); + $scope.todoNotAuto.reset(); + $scope.todoNotAuto.save($scope.todo).then((data) => { return data == 1; });; + + // todo might be an object like this {text: "Learn Angular", sticky: false} + // or an array like this: + // [{text: "Learn Angular", sticky: false}, {text: "Hello World", sticky: true}] + + $scope.save = function(todo) { + $scope.notAutoTodos.save(todo); + }; + + $scope.saveAll = function() { + $scope.notAutoTodos.save(); + }; + + $scope.autoSave = function(todo) { + $scope.todos.push(todo); + }; + + // todoId might be an string like this "WhrnEez5yBRgo4yEm" + // or an array like this ["WhrnEez5yBRgo4yEm","gH6Fa4DXA3XxQjXNS"] + $scope.remove = function(todoId) { + $scope.notAutoTodos.remove(todoId); + }; + + $scope.removeAll = function() { + $scope.notAutoTodos.remove(); + }; + + $scope.removeAuto = function(todo) { + $scope.todos.splice( $scope.todos.indexOf(todo), 1 ); + } + + $scope.toSticky = function(todo) { + if (angular.isArray(todo)){ + angular.forEach(todo, function(object) { + object.sticky = true; + }); + } else { + todo.sticky = true; + } + + $scope.stickyTodos.save(todo); + }; + + var todoObject = {name:'first todo'}; + var todosArray = [{name:'second todo'}, {name:'third todo'}]; + var todoSecondObject = {name:'forth todo'}; + + $scope.todos.save(todoObject); // todos equals [{name:'first todo'}] + + $scope.todos.save(todosArray); // todos equals [{name:'first todo'}, {name:'second todo'}, {name:'third todo'}] + + $scope.todos.push(todoSecondObject); // The scope variable equals to [{name:'first todo'}, {name:'second todo'}, {name:'third todo'}, {name:'forth todo'}] + // but the collection still equals to [{name:'first todo'}, {name:'second todo'}, {name:'third todo'}] + + $scope.todos.save(); // Now the collection also equals to [{name:'first todo'}, {name:'second todo'}, {name:'third todo'}, {name:'forth todo'}] + + $scope.todos.remove('firstTodoId'); // scope and collection equals to [{name:'second todo'}, {name:'third todo'}, {name:'forth todo'}] + + var todoIdsArray = ['secondTodoId', 'thirdTodoId']; + $scope.todos.remove(todoIdsArray); // removes everything matches the array of IDs both in scope and in collection + + $scope.todos.pop(); // removes only in scope + + $scope.todos.remove(); // syncs also in Meteor collection + + // Subscribe -> + + $meteor.subscribe('todos').then((subscriptionHandle) => { + // Bind all the todos to $scope.todos + $scope.todos = $meteor.collection(Todos); + + console.log($scope.todos + ' is ready'); + + // You can use the subscription handle to stop the subscription if you want + subscriptionHandle.stop(); + }); + + $scope.subscribe('todos').then((subscriptionHandle) => { + // Bind all the todos to $scope.books + $scope.todos = $meteor.collection(Todos); + + console.log($scope.todos + ' is ready'); + + // No need to stop the subscription, it will automatically close on scope destroy + }); + + $meteor.call('subscribe', $scope.todo._id, $scope.currentUser._id).then((data) => { + // Handle success + console.log('success subscribing', data.name); + }, (err) => { + // Handle error + console.log('failed', err); + }); + + if (!$scope.loggingIn) { + $meteor.waitForUser(); + + $meteor.requireUser(); + + $meteor.requireValidUser(user => { + return user.username == 'admin'; + }); + + $meteor.loginWithPassword('user', 'password').then(() => { + console.log('Login success'); + }, err => { + console.log('Login error - ', err); + }); + + $meteor.createUser({ + username:'moma', + email:'example@gmail.com', + password: 'Bksd@asdf', + profile: {expertize: 'Developer'} + }).then(() => { + console.log('Login success'); + }, err => { + console.log('Login error - ', err); + }); + + $meteor.changePassword('old', 'new232f3').then(() => { + console.log('Change password success'); + }, err => { + console.log('Error changing password - ', err); + }); + + $meteor.forgotPassword({email: 'sample@gmail.com'}).then(() => { + console.log('Success sending forgot password email'); + }, err => { + console.log('Error sending forgot password email - ', err); + }); + + $meteor.resetPassword('tokenID', 'new232f3').then(() => { + console.log('Reset password success'); + }, err => { + console.log('Error resetting password - ', err); + }); + + $meteor.verifyEmail('tokenID').then(() => { + console.log('Success verifying password '); + }, err => { + console.log('Error verifying password - ', err); + }); + + $meteor.logout().then(() => { + console.log('Logout success'); + }, err => { + console.log('logout error - ', err); + }); + + $meteor.logoutOtherClients().then(() => { + console.log('Logout success'); + }, err => { + console.log('logout error - ', err); + }); + + var loginWithOptions = {requestPermissions: ['email']}; + + $meteor.loginWithFacebook({requestPermissions: ['email']}).then(() => { + console.log('Login success'); + }, err => { + console.log('Login error - ', err); + }); + $meteor.loginWithGithub({requestPermissions: ['email']}).then(() => { + console.log('Login success'); + }, err => { + console.log('Login error - ', err); + }); + $meteor.loginWithGoogle({requestPermissions: ['email']}).then(() => { + console.log('Login success'); + }, err => { + console.log('Login error - ', err); + }); + $meteor.loginWithMeetup({requestPermissions: ['email']}).then(() => { + console.log('Login success'); + }, err => { + console.log('Login error - ', err); + }); + $meteor.loginWithTwitter({requestPermissions: ['email']}).then(() => { + console.log('Login success'); + }, err => { + console.log('Login error - ', err); + }); + $meteor.loginWithWeibo({requestPermissions: ['email']}).then(() => { + console.log('Login success'); + }, err => { + console.log('Login error - ', err); + }); + } + + $meteor.autorun($scope, () => { console.log("Aurorun triggered."); }); + $meteor.getCollectionByName('collectionName'); + + // requires meteor add mdg:camera + $meteor.getPicture().then(function(data){ + $scope['picture'] = data; + }); + + $meteor.session('counter').bind($scope, 'counter'); +}]); diff --git a/angular-meteor/angular-meteor.d.ts b/angular-meteor/angular-meteor.d.ts new file mode 100644 index 000000000..b3f520ac5 --- /dev/null +++ b/angular-meteor/angular-meteor.d.ts @@ -0,0 +1,330 @@ +// Type definitions for Angular JS Meteor v0.8.8 (angular.meteor module) +// Project: https://github.com/Urigo/angular-meteor +// Definitions by: Peter Grman +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// +/// + +declare module angular.meteor { + interface IRootScopeService extends angular.IRootScopeService { + /** + * The current logged in user and it's data. it is null if the user is not logged in. A reactive data source. + */ + currentUser: Meteor.User; + + /** + * True if a login method (such as Meteor.loginWithPassword, Meteor.loginWithFacebook, or Accounts.createUser) is currently in progress. + * A reactive data source. Can be use to display animation while user is logging in. + */ + loggingIn: boolean; + } + + interface IScope extends angular.IScope, IRootScopeService { + /** + * A method to get a $scope variable and watch it reactivly + * + * @param scopeVariableName - The name of the scope's variable to bind to + * @param [objectEquality=false] - Watch the object equality using angular.equals instead of comparing for reference equality, deeper watch but also slower + */ + getReactively(scopeVariableName: string, objectEquality?: boolean): ReactiveResult; + + /** + * A service which is a wrapper for Meteor.subscribe. It subscribes to a Meteor.publish method in the client and returns a AngularJS promise when ready. + * Calling $scope.subscribe will automatically stop the subscription when the scope is destroyed. + * + * @param name - Name of the subscription. Matches the name of the server's publish() call. + * @param publisherArguments - Optional arguments passed to publisher function on server. + * + * @return The promise solved successfully when subscription is ready. The success promise holds the subscription handle. + */ + subscribe(name: string, ...publisherArguments: any[]): angular.IPromise; + } + + /** + * $meteor in angularjs + */ + interface IMeteorService { + /** + * A service that wraps the Meteor collections to enable reactivity within AngularJS. + * + * @param collection - A Meteor Collection or a reactive function to bind to. + * - Reactive function can be used with $scope.getReactively to add $scope variable as reactive variable to the cursor. + * @param [autoClientSave=true] - By default, changes in the Angular collection will automatically update the Meteor collection. + * - However if set to false, changes in the client won't be automatically propagated back to the Meteor collection. + */ + collection(collection: Mongo.Collection|ReactiveResult|Function|(()=>T), autoClientSave?: boolean): AngularMeteorCollection; + + /** + * A service that wraps the Meteor collections to enable reactivity within AngularJS. + * + * @param collection - A Meteor Collection or a reactive function to bind to. + * - Reactive function can be used with $scope.getReactively to add $scope variable as reactive variable to the cursor. + * @param [autoClientSave=true] - By default, changes in the Angular collection will automatically update the Meteor collection. + * - However if set to false, changes in the client won't be automatically propagated back to the Meteor collection. + * @param [updateCollection] - A collection object which will be used for updates (insert, update, delete). + */ + collection(collection: Mongo.Collection|ReactiveResult|Function|(()=>T), autoClientSave: boolean, updateCollection: Mongo.Collection): AngularMeteorCollection2; + + /** + * A service that wraps a Meteor object to enable reactivity within AngularJS. + * Finds the first document that matches the selector, as ordered by sort and skip options. Wraps collection.findOne + * + * @param collection - A Meteor Collection to bind to. + * @param selector - A query describing the documents to find or just the ID of the document. + * - $meteor.object will find the first document that matches the selector, + * - as ordered by sort and skip options, exactly like Meteor's collection.findOne + * @param [autoClientSave=true] - By default, changes in the Angular object will automatically update the Meteor object. + * - However if set to false, changes in the client won't be automatically propagated back to the Meteor object. + */ + object(collection: Mongo.Collection, selector: Mongo.Selector|Mongo.ObjectID|string, autoClientSave?: boolean): AngularMeteorObject; + + /** + * A service which is a wrapper for Meteor.subscribe. It subscribes to a Meteor.publish method in the client and returns a AngularJS promise when ready. + * + * @param name - Name of the subscription. Matches the name of the server's publish() call. + * @param publisherArguments - Optional arguments passed to publisher function on server. + * + * @return The promise solved successfully when subscription is ready. The success promise holds the subscription handle. + */ + subscribe(name: string, ...publisherArguments: any[]): angular.IPromise; + + /** + * A service service which wraps up Meteor.methods with AngularJS promises. + * + * @param name - Name of method to invoke + * @param methodArguments - Optional method arguments + * + * @return The promise solves successfully with the return value of the method or return reject with the error from the method. + */ + call(name: string, ...methodArguments: any[]): angular.IPromise; + + // User Authentication BEGIN -> + + /** + * Returns a promise fulfilled with the currentUser when the user subscription is ready. + * This is useful when you want to grab the current user before the route is rendered. + * If there is no logged in user, it will return null. + * See the “Authentication with Routers” section of our tutorial for more information and a full example. + */ + waitForUser(): angular.IPromise; + + /** + * Resolves the promise successfully if a user is authenticated and rejects otherwise. + * This is useful in cases where you want to require a route to have an authenticated user. + * You can catch the rejected promise and redirect the unauthenticated user to a different page, such as the login page. + * See the “Authentication with Routers” section of our tutorial for more information and a full example. + */ + requireUser(): angular.IPromise; + + /** + * Resolves the promise successfully if a user is authenticated and the validatorFn returns true; rejects otherwise. + * This is useful in cases where you want to require a route to have an authenticated user and do extra validation like the user's role or group. + * You can catch the rejected promise and redirect the unauthenticated user to a different page, such as the login page. + * See the “Authentication with Routers” section of our tutorial for more information and a full example. + * + * The mandatory validator function will be called with the authenticated user as the single param and it's expected to return true in order to resolve. + * If it returns a string, the promise will be rejected using said string as the reason. + * Any other return (false, null, undefined) will be rejected with the default "FORBIDDEN" reason. + */ + requireValidUser(validatorFn: (user: Meteor.User) => boolean|string): angular.IPromise; + + /** + * Log the user in with a password. + * + * @param user - Either a string interpreted as a username or an email; or an object with a single key: email, username or id. + * @param password - The user's password. + */ + loginWithPassword(user: string|{email: string}|{username: string}|{id: string}, password: string): angular.IPromise; + + /** + * Create a new user. More information: http://docs.meteor.com/#/full/accounts_createuser + * + * @param options.username - A unique name for this user. Either this, or email is required. + * @param options.email - The user's email address. Either this, or username is required. + * @param options.password - The user's password. This is not sent in plain text over the wire. + * @param options.profile - The user's profile, typically including the name field. + */ + createUser(options: {username?: string; email?: string; password: string; profile?: Object}): angular.IPromise; + + /** + * Change the current user's password. Must be logged in. + * + * @param oldPassword - The user's current password. This is not sent in plain text over the wire. + * @param newPassword - A new password for the user. This is not sent in plain text over the wire. + */ + changePassword(oldPassword: string, newPassword: string): angular.IPromise; + + /** + * Request a forgot password email. + * + * @param options.email - The email address to send a password reset link. + */ + forgotPassword(options: {email: string}): angular.IPromise; + + /** + * Reset the password for a user using a token received in email. Logs the user in afterwards. + * + * @param token - The token retrieved from the reset password URL. + * @param newPassword - A new password for the user. This is not sent in plain text over the wire. + */ + resetPassword(token: string, newPassword: string): angular.IPromise; + + /** + * Marks the user's email address as verified. Logs the user in afterwards. + * + * @param token - The token retrieved from the reset password URL. + */ + verifyEmail(token: string): angular.IPromise; + + loginWithFacebook: ILoginWithExternalService; + loginWithTwitter: ILoginWithExternalService; + loginWithGoogle: ILoginWithExternalService; + loginWithGithub: ILoginWithExternalService; + loginWithMeetup: ILoginWithExternalService; + loginWithWeibo: ILoginWithExternalService; + + /** + * Log the user out. + * + * @return Resolves with no arguments on success, or reject with a Error argument on failure. + */ + logout(): angular.IPromise; + + /** + * Log out other clients logged in as the current user, but does not log out the client that calls this function. + * For example, when called in a user's browser, connections in that browser remain logged in, + * but any other browsers or DDP clients logged in as that user will be logged out. + * + * @return Resolves with no arguments on success, or reject with a Error argument on failure. + */ + logoutOtherClients(): angular.IPromise; + + // <- User Authentication END + // $meteorUtils BEGIN -> + + /** + * @param scope - The AngularJS scope you use the autorun on. + * @param fn - The function that will re-run every time a reactive variable changes inside it. + */ + autorun(scope: angular.IScope, fn: Function): void; + + /** + * @param collectionName - The name of the collection you want to get back + */ + getCollectionByName(collectionName: string): Mongo.Collection; + + // <- $meteorUtils END + // $meteorCamera BEGIN -> + + /** + * A helper service for taking pictures across platforms. + * Must add mdg:camera package to use! (meteor add mdg:camera) + * + * @param [options] - options is an optional argument that is an Object with the following possible keys: + * @param options.width - An integer that specifies the minimum width of the returned photo. + * @param options.height - An integer that specifies the minimum height of the returned photo. + * @param options.quality - A number from 0 to 100 specifying the desired quality of JPEG encoding. + * + * @return The promise solved successfully when the picture is taken with the data as a parameter or rejected with an error as a parameter in case of error. + */ + getPicture(options?: {width?: number; height?: number; quality?: number}): angular.IPromise; + + // <- $meteorCamera END + + /** + * A service that binds a scope variable to a Meteor Session variable. + * + * @param sessionKey - The name of the session variable + * @return An object with a single function bind - to bind to that variable. + */ + session(sessionKey: string): { + /** + * @param scope - The scope the document will be bound to. + * @param model - The name of the scope's model variable that the document will be bound to. + */ + bind: (scope: IScope, model: string) => void; + }; + } + + /** + * An object that connects a Meteor Object to an AngularJS scope variable. + * + * The object contains also all the properties from the generic type T, + * unfortunately TypeScript doesn't at the moment allow to extend a generic type (see https://github.com/Microsoft/TypeScript/issues/2225 for details and updates). + * For a workaround, you'll need to implement an interface which will merge AngularMeteorObject together with T and cast it, like this: + * + * interface TodoAngularMeteorObject extends ITodo, AngularMeteorObject { } + * var todo = $meteor.object(TodoCollection, 'TodoID'); + */ + interface AngularMeteorObject { + /** + * @param [doc] - The doc to save to the Meteor Object. If nothing is passed, the method saves everything in the AngularMeteorObject as is. + * - Unchanged properties will be overridden with their existing values, which may trigger hooks. + * - If doc is passed, the method only updates the Meteor Object with the properties passed, and no other changes will be saved. + * + * @return Returns a promise with an error in case for an error or a number of successful docs changed in case of success. + */ + save(doc?: T): angular.IPromise; + + /** + * Reset the current value of the object to the one in the server. + */ + reset(): void; + + /** + * Returns a copy of the AngularMeteorObject with all the AngularMeteor-specific internal properties removed. + * The returned object is then safe to use as a parameter for method calls, or anywhere else where the data needs to be converted to JSON. + */ + getRawObject(): T; + + /** + * A shorten (Syntactic sugar) function for the $meteor.subscribe function. + * Takes only one parameter and not returns a promise like $meteor.subscribe does. + * + * @param subscriptionName - The subscription name to subscribe to. Exactly like the first parameter in $meteor.subscribe service. + */ + subscribe(subscriptionName:string): AngularMeteorObject; + } + + /** + * An object that connects a Meteor Collection to an AngularJS scope variable + */ + interface AngularMeteorCollection extends AngularMeteorCollection2 { } + + /** + * An object that connects a Meteor Collection to an AngularJS scope variable, + * but can use a differen type for updates. + */ + interface AngularMeteorCollection2 extends Array { + /** + * @param [docs] - The docs to save to the Meteor Collection. + * - If the docs parameter is empty, the method saves everything in the AngularMeteorCollection as is. + * - If an object is passed, the method pushes that object into the AngularMeteorCollection. + * - If an array is passed, the method pushes all objects in the array into the AngularMeteorCollection. + */ + save(docs?: U|U[]): void; + + /** + * @param [keys] - The keys of the object to remove from the Meteor Collection. + * - If nothing is passed, the method removes all the documents from the AngularMeteorCollection. + * - If an object is passed, the method removes the object with that key from the AngularMeteorCollection. + * - If an array is passed, the method removes all objects that matches the keys in the array from the AngularMeteorCollection. + */ + remove(keys?: U|string|number|string[]|number[]): void; + + /** + * A shorten (Syntactic sugar) function for the $meteor.subscribe function. + * Takes only one parameter and not returns a promise like $meteor.subscribe does. + * + * @param subscriptionName - The subscription name to subscribe to. Exactly like the first parameter in $meteor.subscribe service. + */ + subscribe(subscriptionName:string): AngularMeteorCollection2; + } + + interface ILoginWithExternalService { + (options: Meteor.LoginWithExternalServiceOptions): angular.IPromise; + } + + interface ReactiveResult { } +} diff --git a/angular-translate/angular-translate-tests.ts b/angular-translate/angular-translate-tests.ts index 559555418..cc02a85d6 100644 --- a/angular-translate/angular-translate-tests.ts +++ b/angular-translate/angular-translate-tests.ts @@ -2,7 +2,7 @@ var app = angular.module('at', ['pascalprecht.translate']); -app.config(($translateProvider: ng.translate.ITranslateProvider) => { +app.config(($translateProvider: angular.translate.ITranslateProvider) => { $translateProvider.translations('en', { TITLE: 'Hello', FOO: 'This is a paragraph.', @@ -22,7 +22,7 @@ interface Scope extends ng.IScope { changeLanguage(key: any): void; } -app.controller('Ctrl', ($scope: Scope, $translate: ng.translate.ITranslateService) => { +app.controller('Ctrl', ($scope: Scope, $translate: angular.translate.ITranslateService) => { $scope['changeLanguage'] = function (key: any) { $translate.use(key); }; diff --git a/angular-translate/angular-translate.d.ts b/angular-translate/angular-translate.d.ts index c972c927d..87a75439b 100644 --- a/angular-translate/angular-translate.d.ts +++ b/angular-translate/angular-translate.d.ts @@ -6,13 +6,7 @@ /// declare module angular.translate { - - interface ITranslatePartialLoaderService { - addPart(name: string): ITranslatePartialLoaderService; - deletePart(name: string, removeData?: boolean): ITranslatePartialLoaderService; - isPartAvailable(name: string): boolean; - } - + interface ITranslationTable { [key: string]: string; } @@ -26,15 +20,30 @@ declare module angular.translate { set(name: string, value: string): void; } - interface ISTaticFilesLoaderOptions { + interface IStaticFilesLoaderOptions { prefix: string; suffix: string; key?: string; } + interface IPartialLoader { + addPart(name : string, priority? : number) : T; + deletePart(name : string) : T; + isPartAvailable(name : string) : boolean; + } + + interface ITranslatePartialLoaderService extends IPartialLoader { + getRegisteredParts() : Array; + isPartLoaded(name : string, lang : string) : boolean; + } + + interface ITranslatePartialLoaderProvider extends angular.IServiceProvider, IPartialLoader { + setPart(lang : string, part : string, table : ITranslationTable) : ITranslatePartialLoaderProvider; + } + interface ITranslateService { - (translationId: string, interpolateParams?: any, interpolationId?: string): ng.IPromise; - (translationId: string[], interpolateParams?: any, interpolationId?: string): ng.IPromise<{ [key: string]: string }>; + (translationId: string, interpolateParams?: any, interpolationId?: string): angular.IPromise; + (translationId: string[], interpolateParams?: any, interpolationId?: string): angular.IPromise<{ [key: string]: string }>; cloakClassName(): string; cloakClassName(name: string): ITranslateProvider; fallbackLanguage(langKey?: string): string; @@ -44,17 +53,17 @@ declare module angular.translate { isPostCompilingEnabled(): boolean; preferredLanguage(langKey?: string): string; proposedLanguage(): string; - refresh(langKey?: string): ng.IPromise; + refresh(langKey?: string): angular.IPromise; storage(): IStorage; storageKey(): string; use(): string; - use(key: string): ng.IPromise; + use(key: string): angular.IPromise; useFallbackLanguage(langKey?: string): void; versionInfo(): string; loaderCache(): any; } - interface ITranslateProvider extends ng.IServiceProvider { + interface ITranslateProvider extends angular.IServiceProvider { translations(): ITranslationTable; translations(key: string, translationTable: ITranslationTable): ITranslateProvider; cloakClassName(): string; @@ -78,7 +87,7 @@ declare module angular.translate { storageKey(): string; storageKey(key: string): void; // JeroMiya - the library should probably return ITranslateProvider but it doesn't here useUrlLoader(url: string): ITranslateProvider; - useStaticFilesLoader(options: ISTaticFilesLoaderOptions): ITranslateProvider; + useStaticFilesLoader(options: IStaticFilesLoaderOptions): ITranslateProvider; useLoader(loaderFactory: string, options: any): ITranslateProvider; useLocalStorage(): ITranslateProvider; useCookieStorage(): ITranslateProvider; diff --git a/angular-ui-bootstrap/angular-ui-bootstrap-tests.ts b/angular-ui-bootstrap/angular-ui-bootstrap-tests.ts index 608591b58..c9883f86e 100644 --- a/angular-ui-bootstrap/angular-ui-bootstrap-tests.ts +++ b/angular-ui-bootstrap/angular-ui-bootstrap-tests.ts @@ -131,6 +131,7 @@ testApp.controller('TestCtrl', ( var modalInstance = $modal.open({ backdrop: 'static', controller: 'ModalTestCtrl', + controllerAs: 'vm', keyboard: true, resolve: { items: ()=> { diff --git a/angular-ui-bootstrap/angular-ui-bootstrap.d.ts b/angular-ui-bootstrap/angular-ui-bootstrap.d.ts index d7e65c77c..c3675e7a9 100644 --- a/angular-ui-bootstrap/angular-ui-bootstrap.d.ts +++ b/angular-ui-bootstrap/angular-ui-bootstrap.d.ts @@ -229,7 +229,7 @@ declare module angular.ui.bootstrap { * a scope instance to be used for the modal's content (actually the $modal service is going to create a child scope of a provided scope). * Defaults to `$rootScope`. */ - scope?: IModalScope; + scope?: angular.IScope|IModalScope; /** * a controller for a modal instance - it can initialize scope used by modal. @@ -237,6 +237,12 @@ declare module angular.ui.bootstrap { */ controller?: any; + /** + * an alternative to the controller-as syntax, matching the API of directive definitions. + * Requires the controller option to be provided as well + */ + controllerAs?: string; + /** * members that will be resolved and passed to the controller as locals; it is equivalent of the `resolve` property for AngularJS routes */ diff --git a/angular-ui-router/angular-ui-router.d.ts b/angular-ui-router/angular-ui-router.d.ts index f5dfbeca5..bfec95156 100644 --- a/angular-ui-router/angular-ui-router.d.ts +++ b/angular-ui-router/angular-ui-router.d.ts @@ -45,13 +45,15 @@ declare module angular.ui { 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. + * Callback function for when a state is entered. Good way to trigger an action or dispatch an event, such as opening a dialog. + * If minifying your scripts, make sure to explictly annotate this function, because it won't be automatically annotated by your build tools. */ - onEnter?: Function; + onEnter?: Function|(string|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. + * If minifying your scripts, make sure to explictly annotate this function, because it won't be automatically annotated by your build tools. */ - onExit?: Function; + onExit?: Function|(string|Function)[]; /** * Arbitrary data object, useful for custom configuration. */ @@ -62,7 +64,7 @@ declare module angular.ui { reloadOnSearch?: boolean; } - interface IStateProvider extends ng.IServiceProvider { + interface IStateProvider extends angular.IServiceProvider { state(name:string, config:IState): IStateProvider; state(config:IState): IStateProvider; decorator(name?: string, decorator?: (state: IState, parent: Function) => any): any; @@ -81,7 +83,7 @@ declare module angular.ui { type(name: string, definition: any, definitionFn?: any): any; } - interface IUrlRouterProvider extends ng.IServiceProvider { + interface IUrlRouterProvider extends angular.IServiceProvider { when(whenPath: RegExp, handler: Function): IUrlRouterProvider; when(whenPath: RegExp, handler: any[]): IUrlRouterProvider; when(whenPath: RegExp, toPath: string): IUrlRouterProvider; @@ -143,7 +145,7 @@ declare module angular.ui { * * @param options Options object. */ - go(to: string, params?: {}, options?: IStateOptions): ng.IPromise; + go(to: string, params?: {}, options?: IStateOptions): angular.IPromise; transitionTo(state: string, params?: {}, updateLocation?: boolean): void; transitionTo(state: string, params?: {}, options?: IStateOptions): void; includes(state: string, params?: {}): boolean; diff --git a/angular-wizard/angular-wizard-tests.ts b/angular-wizard/angular-wizard-tests.ts new file mode 100644 index 000000000..61ad7a484 --- /dev/null +++ b/angular-wizard/angular-wizard-tests.ts @@ -0,0 +1,218 @@ +/// +/// + +/// + +// test file taken from https://github.com/mgonto/angular-wizard + + +interface WizardScope extends ng.IScope { + referenceCurrentStep:string; + stepValidation:()=>void; + finishedWizard:()=>void; + enterValidation:()=>void; +} + +describe('AngularWizard', function () { + var $compile:ng.ICompileService, + $rootScope:ng.IRootScopeService, WizardHandler:angular.mgoAngularWizard.WizardHandler, scope:WizardScope; + + /** + * Create the view with wizard to test + * @param {Scope} scope A scope to bind to + * @return {[DOM element]} A DOM element compiled + */ + function createView(scope:WizardScope) { + scope.referenceCurrentStep = null; + var element = angular.element('' + + ' ' + + '

This is the first step

' + + '

Here you can use whatever you want. You can use other directives, binding, etc.

' + + ' ' + + '
' + + ' ' + + '

Continuing

' + + '

You have continued here!

' + + ' ' + + '
' + + ' ' + + '

Even more steps!!

' + + ' ' + + '
' + + '
'); + var elementCompiled = $compile(element)(scope); + $rootScope.$digest(); + return elementCompiled; + } + + it("should correctly create the wizard", function () { + var view = createView(scope); + expect(WizardHandler).toBeTruthy(); + expect(view.find('section').length).toEqual(3); + // expect the correct step to be desirable one + expect(scope.referenceCurrentStep).toEqual('Starting'); + }); + + it("should go to the next step", function () { + var view = createView(scope); + expect(scope.referenceCurrentStep).toEqual('Starting'); + WizardHandler.wizard().next(); + $rootScope.$digest(); + expect(scope.referenceCurrentStep).toEqual('Continuing'); + }); + it("should return to a previous step", function () { + + var view = createView(scope); + expect(scope.referenceCurrentStep).toEqual('Starting'); + WizardHandler.wizard().next(); + $rootScope.$digest(); + expect(scope.referenceCurrentStep).toEqual('Continuing'); + WizardHandler.wizard().previous(); + $rootScope.$digest(); + expect(scope.referenceCurrentStep).toEqual('Starting'); + }); + it("should go to a step specified by name", function () { + + var view = createView(scope); + expect(scope.referenceCurrentStep).toEqual('Starting'); + WizardHandler.wizard().goTo('More steps'); + $rootScope.$digest(); + expect(scope.referenceCurrentStep).toEqual('More steps'); + }); + it("should go to a step specified by index", function () { + + var view = createView(scope); + expect(scope.referenceCurrentStep).toEqual('Starting'); + WizardHandler.wizard().goTo(2); + $rootScope.$digest(); + expect(scope.referenceCurrentStep).toEqual('More steps'); + }); + it("should go to next step becasue callback is truthy", function () { + + var view = createView(scope); + expect(scope.referenceCurrentStep).toEqual('Starting'); + WizardHandler.wizard().next(function () { + return true + }); + $rootScope.$digest(); + expect(scope.referenceCurrentStep).toEqual('Continuing'); + }); + it("should NOT go to next step because callback is falsey", function () { + + var view = createView(scope); + expect(scope.referenceCurrentStep).toEqual('Starting'); + WizardHandler.wizard().next(function () { + return false + }); + $rootScope.$digest(); + expect(scope.referenceCurrentStep).toEqual('Starting'); + }); + it("should go to next step because CANEXIT is UNDEFINED", function () { + + var view = createView(scope); + expect(scope.referenceCurrentStep).toEqual('Starting'); + WizardHandler.wizard().next(); + $rootScope.$digest(); + expect(scope.referenceCurrentStep).toEqual('Continuing'); + }); + it("should go to next step because CANEXIT is TRUE", function () { + + var view = createView(scope); + scope.stepValidation = function () { + return true; + }; + expect(scope.referenceCurrentStep).toEqual('Starting'); + WizardHandler.wizard().next(); + $rootScope.$digest(); + expect(scope.referenceCurrentStep).toEqual('Continuing'); + WizardHandler.wizard().next(); + $rootScope.$digest(); + expect(scope.referenceCurrentStep).toEqual('More steps'); + }); + it("should NOT go to next step because CANEXIT is FALSE", function () { + + var view = createView(scope); + scope.stepValidation = function () { + return false; + }; + expect(scope.referenceCurrentStep).toEqual('Starting'); + WizardHandler.wizard().next(); + $rootScope.$digest(); + expect(scope.referenceCurrentStep).toEqual('Continuing'); + WizardHandler.wizard().next(); + $rootScope.$digest(); + expect(scope.referenceCurrentStep).toEqual('Continuing'); + }); + it("should go to next step because CANENTER is TRUE", function () { + + var view = createView(scope); + scope.enterValidation = function () { + return true; + }; + expect(scope.referenceCurrentStep).toEqual('Starting'); + WizardHandler.wizard().next(); + $rootScope.$digest(); + expect(scope.referenceCurrentStep).toEqual('Continuing'); + WizardHandler.wizard().next(); + $rootScope.$digest(); + expect(scope.referenceCurrentStep).toEqual('More steps'); + }); + it("should NOT go to next step because CANENTER is FALSE", function () { + + var view = createView(scope); + scope.enterValidation = function () { + return false; + }; + expect(scope.referenceCurrentStep).toEqual('Starting'); + WizardHandler.wizard().next(); + $rootScope.$digest(); + expect(scope.referenceCurrentStep).toEqual('Continuing'); + WizardHandler.wizard().next(); + $rootScope.$digest(); + expect(scope.referenceCurrentStep).toEqual('Continuing'); + }); + it("should NOT return to a previous step. Although CANEXIT is false and we are heading to a previous state, the can enter validation is false", function () { + + var view = createView(scope); + scope.stepValidation = function () { + return false; + }; + scope.enterValidation = function () { + return false; + }; + expect(scope.referenceCurrentStep).toEqual('Starting'); + WizardHandler.wizard().next(); + $rootScope.$digest(); + expect(scope.referenceCurrentStep).toEqual('Continuing'); + WizardHandler.wizard().previous(); + $rootScope.$digest(); + expect(scope.referenceCurrentStep).toEqual('Continuing'); + }); + it("should return to a previous step even though CANEXIT is false", function () { + + var view = createView(scope); + scope.stepValidation = function () { + return false; + }; + expect(scope.referenceCurrentStep).toEqual('Starting'); + WizardHandler.wizard().next(); + $rootScope.$digest(); + expect(scope.referenceCurrentStep).toEqual('Continuing'); + WizardHandler.wizard().previous(); + $rootScope.$digest(); + expect(scope.referenceCurrentStep).toEqual('Starting'); + }); + it("should finish", function () { + + var flag = false; + scope.finishedWizard = function () { + flag = true; + }; + var view = createView(scope); + expect(scope.referenceCurrentStep).toEqual('Starting'); + WizardHandler.wizard().finish(); + expect(flag).toBeTruthy(); + $rootScope.$digest(); + }); +}); + diff --git a/angular-wizard/angular-wizard.d.ts b/angular-wizard/angular-wizard.d.ts new file mode 100644 index 000000000..f079a46c2 --- /dev/null +++ b/angular-wizard/angular-wizard.d.ts @@ -0,0 +1,21 @@ +// Type definitions for Angular Wizard 0.4.2 +// Project: https://github.com/mgonto/angular-wizard +// Definitions by: Marko Jurisic +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module angular.mgoAngularWizard { + interface WizardHandler { + wizard(name?:string): Wizard; + addWizard(name:string, wizard:Wizard):void; + removeWizard(name:string):void; + } + + interface Wizard { + next(nextHandler?:Function):void; + previous():void; + goTo(step:number):void; + goTo(step:string):void; + finish():void; + currentStepNumber():number; + } +} diff --git a/angular2/angular2-tests.ts b/angular2/angular2-tests.ts new file mode 100644 index 000000000..bdd2628e5 --- /dev/null +++ b/angular2/angular2-tests.ts @@ -0,0 +1,28 @@ +/// + +// Use Typescript 1.4 style imports +import ng = require("angular2/angular2"); +import di = require("angular2/di"); + +class Service { + +} +class Service2 { + +} + +class Cmp { + static annotations: any[]; +} +Cmp.annotations = [ + ng.Component({ + selector: 'cmp', + injectables: [Service, di.bind(Service2).toValue(null)] + }), + ng.View({ + template: '{{greeting}} world!', + directives: [ng.For, ng.If] + }) +]; + +ng.bootstrap(Cmp); diff --git a/angular2/angular2.d.ts b/angular2/angular2.d.ts new file mode 100644 index 000000000..fa3cc7788 --- /dev/null +++ b/angular2/angular2.d.ts @@ -0,0 +1,622 @@ +// Type definitions for Angular v2.0.0-alpha.22 +// Project: http://angular.io/ +// Definitions by: angular team +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/****************** + * This is a minimal type definition for the Angular2 quickstart. + * We plan to publish a complete definition soon. + ******************/ + +interface List extends Array {} +interface Type {} + +interface _ComponentArg { + /** + * The CSS selector that triggers the instantiation of a directive. + * + * Angular only allows directives to trigger on CSS selectors that do not cross element boundaries. + * + * `selector` may be declared as one of the following: + * + * - `element-name`: select by element name. + * - `.class`: select by class name. + * - `[attribute]`: select by attribute name. + * - `[attribute=value]`: select by attribute name and value. + * - `:not(sub_selector)`: select only if the element does not match the `sub_selector`. + * - `selector1, selector2`: select if either `selector1` or `selector2` matches. + * + * + * ## Example + * + * Suppose we have a directive with an `input[type=text]` selector. + * + * And the following HTML: + * + * ```html + *
+ * + * + * + * ``` + * + * The directive would only be instantiated on the `` element. + * + */ + selector: string; + + /** + * Enumerates the set of properties that accept data binding for a directive. + * + * The `properties` property defines a set of `directiveProperty` to `bindingProperty` + * key-value pairs: + * + * - `directiveProperty` specifies the component property where the value is written. + * - `bindingProperty` specifies the DOM property where the value is read from. + * + * You can include a {@link Pipe} when specifying a `bindingProperty` to allow for data transformation and structural + * change detection of the value. These pipes will be evaluated in the context of this component. + * + * + * ## Syntax + * + * ``` + * @Directive({ + * properties: { + * 'directiveProperty1': 'bindingProperty1', + * 'directiveProperty2': 'bindingProperty2 | pipe1 | ...', + * ... + * } + * } + * ``` + * + * + * ## Basic Property Binding + * + * We can easily build a simple `Tooltip` directive that exposes a `tooltip` property, which can be used in templates + * with standard Angular syntax. For example: + * + * ``` + * @Directive({ + * selector: '[tooltip]', + * properties: { + * 'text': 'tooltip' + * } + * }) + * class Tooltip { + * set text(text) { + * // This will get called every time the 'tooltip' binding changes with the new value. + * } + * } + * ``` + * + * We can then bind to the `tooltip' property as either an expression (`someExpression`) or as a string literal, as + * shown in the HTML template below: + * + * ```html + *
...
+ *
...
+ * ``` + * + * Whenever the `someExpression` expression changes, the `properties` declaration instructs + * Angular to update the `Tooltip`'s `text` property. + * + * + * + * ## Bindings With Pipes + * + * You can also use pipes when writing binding definitions for a directive. + * + * For example, we could write a binding that updates the directive on structural changes, rather than on reference + * changes, as normally occurs in change detection. + * + * See {@link Pipe} and {@link keyValDiff} documentation for more details. + * + * ``` + * @Directive({ + * selector: '[class-set]', + * properties: { + * 'classChanges': 'classSet | keyValDiff' + * } + * }) + * class ClassSet { + * set classChanges(changes:KeyValueChanges) { + * // This will get called every time the `class-set` expressions changes its structure. + * } + * } + * ``` + * + * The template that this directive is used in may also contain its own pipes. For example: + * + * ```html + *
+ * ``` + * + * In this case, the two pipes compose as if they were inlined: `someExpression | somePipe | keyValDiff`. + * + */ + properties?: Object; + + /** + * Specifies which DOM hostListeners a directive listens to. + * + * The `hostListeners` property defines a set of `event` to `method` key-value pairs: + * + * - `event1`: the DOM event that the directive listens to. + * - `statement`: the statement to execute when the event occurs. + * If the evalutation of the statement returns `false`, then `preventDefault`is applied on the DOM event. + * + * To listen to global events, a target must be added to the event name. + * The target can be `window`, `document` or `body`. + * + * When writing a directive event binding, you can also refer to the following local variables: + * - `$event`: Current event object which triggered the event. + * - `$target`: The source of the event. This will be either a DOM element or an Angular directive. + * (will be implemented in later release) + * + * + * ## Syntax + * + * ``` + * @Directive({ + * hostListeners: { + * 'event1': 'onMethod1(arguments)', + * 'target:event2': 'onMethod2(arguments)', + * ... + * } + * } + * ``` + * + * ## Basic Event Binding: + * + * Suppose you want to write a directive that triggers on `change` events in the DOM and on `resize` events in window. + * You would define the event binding as follows: + * + * ``` + * @Directive({ + * selector: 'input', + * hostListeners: { + * 'change': 'onChange($event)', + * 'window:resize': 'onResize($event)' + * } + * }) + * class InputDirective { + * onChange(event:Event) { + * } + * onResize(event:Event) { + * } + * } + * ``` + * + * Here the `onChange` method of `InputDirective` is invoked whenever the DOM element fires the 'change' event. + * + */ + hostListeners?: Object; + + /** + * Defines the set of injectable objects that are visible to a Component and its children. + * + * The `injectables` defined in the Component annotation allow you to configure a set of bindings for the component's + * injector. + * + * When a component is instantiated, Angular creates a new child Injector, which is configured with the bindings in + * the Component `injectables` annotation. The injectable objects then become available for injection to the component + * itself and any of the directives in the component's template, i.e. they are not available to the directives which + * are children in the component's light DOM. + * + * + * The syntax for configuring the `injectables` injectable is identical to {@link Injector} injectable configuration. + * See {@link Injector} for additional detail. + * + * + * ## Simple Example + * + * Here is an example of a class that can be injected: + * + * ``` + * class Greeter { + * greet(name:string) { + * return 'Hello ' + name + '!'; + * } + * } + * + * @Component({ + * selector: 'greet', + * injectables: [ + * Greeter + * ] + * }) + * @View({ + * template: `{{greeter.greet('world')}}!`, + * directives: Child + * }) + * class HelloWorld { + * greeter:Greeter; + * + * constructor(greeter:Greeter) { + * this.greeter = greeter; + * } + * } + * ``` + */ + injectables?: List; + + /** + * Specifies a set of lifecycle hostListeners in which the directive participates. + * + * See {@link onChange}, {@link onDestroy}, {@link onAllChangesDone} for details. + */ + lifecycle?: List; + + /** + * Defines the used change detection strategy. + * + * When a component is instantiated, Angular creates a change detector, which is responsible for propagating + * the component's bindings. + * + * The `changeDetection` property defines, whether the change detection will be checked every time or only when the component + * tells it to do so. + */ + changeDetection?: string; +} + +interface _ViewArg { + /** + * Specifies a template URL for an angular component. + * + * NOTE: either `templateUrl` or `template` should be used, but not both. + */ + templateUrl?: string; + + /** + * Specifies an inline template for an angular component. + * + * NOTE: either `templateUrl` or `template` should be used, but not both. + */ + template?: string; + + /** + * Specifies a list of directives that can be used within a template. + * + * Directives must be listed explicitly to provide proper component encapsulation. + */ + directives?: List; +} + +declare module "angular2/angular2" { + /** + * Bootstrapping for Angular applications. + * + * You instantiate an Angular application by explicitly specifying a component to use as the root component for your + * application via the `bootstrap()` method. + * + * ## Simple Example + * + * Assuming this `index.html`: + * + * ```html + * + * + * + * loading... + * + * + * ``` + * + * An application is bootstrapped inside an existing browser DOM, typically `index.html`. Unlike Angular 1, Angular 2 + * does not compile/process bindings in `index.html`. This is mainly for security reasons, as well as architectural + * changes in Angular 2. This means that `index.html` can safely be processed using server-side technologies such as + * bindings. Bindings can thus use double-curly `{{ syntax }}` without collision from Angular 2 component double-curly + * `{{ syntax }}`. + * + * We can use this script code: + * + * ``` + * @Component({ + * selector: 'my-app' + * }) + * @View({ + * template: 'Hello {{ name }}!' + * }) + * class MyApp { + * name:string; + * + * constructor() { + * this.name = 'World'; + * } + * } + * + * main() { + * return bootstrap(MyApp); + * } + * ``` + * + * When the app developer invokes `bootstrap()` with the root component `MyApp` as its argument, Angular performs the + * following tasks: + * + * 1. It uses the component's `selector` property to locate the DOM element which needs to be upgraded into + * the angular component. + * 2. It creates a new child injector (from the platform injector) and configures the injector with the component's + * `injectables`. Optionally, you can also override the injector configuration for an app by invoking + * `bootstrap` with the `componentInjectableBindings` argument. + * 3. It creates a new `Zone` and connects it to the angular application's change detection domain instance. + * 4. It creates a shadow DOM on the selected component's host element and loads the template into it. + * 5. It instantiates the specified component. + * 6. Finally, Angular performs change detection to apply the initial data bindings for the application. + * + * + * ## Instantiating Multiple Applications on a Single Page + * + * There are two ways to do this. + * + * + * ### Isolated Applications + * + * Angular creates a new application each time that the `bootstrap()` method is invoked. When multiple applications + * are created for a page, Angular treats each application as independent within an isolated change detection and + * `Zone` domain. If you need to share data between applications, use the strategy described in the next + * section, "Applications That Share Change Detection." + * + * + * ### Applications That Share Change Detection + * + * If you need to bootstrap multiple applications that share common data, the applications must share a common + * change detection and zone. To do that, create a meta-component that lists the application components in its template. + * By only invoking the `bootstrap()` method once, with the meta-component as its argument, you ensure that only a + * single change detection zone is created and therefore data can be shared across the applications. + * + * + * ## Platform Injector + * + * When working within a browser window, there are many singleton resources: cookies, title, location, and others. + * Angular services that represent these resources must likewise be shared across all Angular applications that + * occupy the same browser window. For this reason, Angular creates exactly one global platform injector which stores + * all shared services, and each angular application injector has the platform injector as its parent. + * + * Each application has its own private injector as well. When there are multiple applications on a page, Angular treats + * each application injector's services as private to that application. + * + * + * # API + * - `appComponentType`: The root component which should act as the application. This is a reference to a `Type` + * which is annotated with `@Component(...)`. + * - `componentInjectableBindings`: An additional set of bindings that can be added to `injectables` for the + * {@link Component} to override default injection behavior. + * - `errorReporter`: `function(exception:any, stackTrace:string)` a default error reporter for unhandled exceptions. + * + * Returns a `Promise` with the application`s private {@link Injector}. + * + */ + function bootstrap(appComponentType: any): void; + + /** + * Declare reusable UI building blocks for an application. + * + * Each Angular component requires a single `@Component` and at least one `@View` annotation. The `@Component` + * annotation specifies when a component is instantiated, and which properties and hostListeners it binds to. + * + * When a component is instantiated, Angular + * - creates a shadow DOM for the component. + * - loads the selected template into the shadow DOM. + * - creates a child {@link Injector} which is configured with the `injectables` for the {@link Component}. + * + * All template expressions and statements are then evaluated against the component instance. + * + * For details on the `@View` annotation, see {@link View}. + * + * ## Example + * + * ``` + * @Component({ + * selector: 'greet' + * }) + * @View({ + * template: 'Hello {{name}}!' + * }) + * class Greet { + * name: string; + * + * constructor() { + * this.name = 'World'; + * } + * } + * ``` + * + * + * Dynamically loading a component at runtime: + * + * Regular Angular components are statically resolved. Dynamic components allows to resolve a component at runtime + * instead by providing a placeholder into which a regular Angular component can be dynamically loaded. Once loaded, + * the dynamically-loaded component becomes permanent and cannot be changed. + * Dynamic components are declared just like components, but without a `@View` annotation. + * + * + * ## Example + * + * Here we have `DynamicComp` which acts as the placeholder for `HelloCmp`. At runtime, the dynamic component + * `DynamicComp` requests loading of the `HelloCmp` component. + * + * There is nothing special about `HelloCmp`, which is a regular Angular component. It can also be used in other static + * locations. + * + * ``` + * @Component({ + * selector: 'dynamic-comp' + * }) + * class DynamicComp { + * helloCmp:HelloCmp; + * constructor(loader:DynamicComponentLoader, location:ElementRef) { + * loader.load(HelloCmp, location).then((helloCmp) => { + * this.helloCmp = helloCmp; + * }); + * } + * } + * + * @Component({ + * selector: 'hello-cmp' + * }) + * @View({ + * template: "{{greeting}}" + * }) + * class HelloCmp { + * greeting:string; + * constructor() { + * this.greeting = "hello"; + * } + * } + * ``` + * + */ + function Component(arg: _ComponentArg): (target: any) => any; + + /** + * Declares the available HTML templates for an application. + * + * Each angular component requires a single `@Component` and at least one `@View` annotation. The @View + * annotation specifies the HTML template to use, and lists the directives that are active within the template. + * + * When a component is instantiated, the template is loaded into the component's shadow root, and the + * expressions and statements in the template are evaluated against the component. + * + * For details on the `@Component` annotation, see {@link Component}. + * + * ## Example + * + * ``` + * @Component({ + * selector: 'greet' + * }) + * @View({ + * template: 'Hello {{name}}!', + * directives: [GreetUser, Bold] + * }) + * class Greet { + * name: string; + * + * constructor() { + * this.name = 'World'; + * } + * } + * ``` + * + */ + function View(arg: _ViewArg): (target: any) => any; + + /** + * The `For` directive instantiates a template once per item from an iterable. The context for each + * instantiated template inherits from the outer context with the given loop variable set to the + * current item from the iterable. + * + * It is possible to alias the `index` to a local variable that will be set to the current loop + * iteration in the template context. + * + * When the contents of the iterator changes, `For` makes the corresponding changes to the DOM: + * + * * When an item is added, a new instance of the template is added to the DOM. + * * When an item is removed, its template instance is removed from the DOM. + * * When items are reordered, their respective templates are reordered in the DOM. + * + * # Example + * + * ``` + *
    + *
  • + * Error {{i}} of {{errors.length}}: {{error.message}} + *
  • + *
+ * ``` + * + * # Syntax + * + * - `
  • ...
  • ` + * - `
  • ...
  • ` + * - `` + * + */ + function For(): void; + + /** + * Removes or recreates a portion of the DOM tree based on an {expression}. + * + * If the expression assigned to `if` evaluates to a false value then the element is removed from the + * DOM, otherwise a clone of the element is reinserted into the DOM. + * + * # Example: + * + * ``` + *
    + * + * {{errorCount}} errors detected + *
    + * ``` + * + * # Syntax + * + * - `
    ...
    ` + * - `
    ...
    ` + * - `` + * + */ + function If(): void; + + /** + * The `NonBindable` directive tells Angular not to compile or bind the contents of the current + * DOM element. This is useful if the element contains what appears to be Angular directives and + * bindings but which should be ignored by Angular. This could be the case if you have a site that + * displays snippets of code, for instance. + * + * Example: + * + * ``` + *
    Normal: {{1 + 2}}
    // output "Normal: 3" + *
    Ignored: {{1 + 2}}
    // output "Ignored: {{1 + 2}}" + * ``` + * + */ + function NonBindable(): void; + + /** + * The `Switch` directive is used to conditionally swap DOM structure on your template based on a + * scope expression. + * Elements within `Switch` but without `SwitchWhen` or `SwitchDefault` directives will be + * preserved at the location as specified in the template. + * + * `Switch` simply chooses nested elements and makes them visible based on which element matches + * the value obtained from the evaluated expression. In other words, you define a container element + * (where you place the directive), place an expression on the **`[switch]="..."` attribute**), + * define any inner elements inside of the directive and place a `[switch-when]` attribute per + * element. + * The when attribute is used to inform Switch which element to display when the expression is + * evaluated. If a matching expression is not found via a when attribute then an element with the + * default attribute is displayed. + * + * # Example: + * + * ``` + * + * + * + * + * + * ``` + * + */ + function Switch(): void; +} + +declare module "angular2/di" { + /** + * Provides an API for imperatively constructing {@link Binding}s. + * + * This is only relevant for JavaScript. See {@link BindingBuilder}. + * + * ## Example + * + * ```javascript + * bind(MyInterface).toClass(MyClass) + * + * ``` + * + */ + function bind(token: any): any; +} diff --git a/angularfire/angularfire-tests.ts b/angularfire/angularfire-tests.ts index 7d39e4181..c649301e3 100644 --- a/angularfire/angularfire-tests.ts +++ b/angularfire/angularfire-tests.ts @@ -46,7 +46,7 @@ myapp.controller("MyController", ["$scope", "$firebase", '$FirebaseObject', '$Fi // AngularFireObject { - var obj = sync.$asObject(); + var obj = $FirebaseObject(ref); // $id if (obj.$id !== ref.name()) throw "error"; @@ -62,8 +62,8 @@ myapp.controller("MyController", ["$scope", "$firebase", '$FirebaseObject', '$Fi obj.$save(); }); - // $inst() - if (obj.$inst() !== sync) throw "error"; + // $ref() + if (obj.$ref() !== ref) throw "error"; // $bindTo() obj.$bindTo($scope, "data").then(function () { @@ -81,8 +81,8 @@ myapp.controller("MyController", ["$scope", "$firebase", '$FirebaseObject', '$Fi // $destroy() obj.$destroy(); - // $extendFactory() - var NewFactory = $FirebaseObject.$extendFactory({ + // $extend() + var NewFactory = $FirebaseObject.$extend({ getMyFavoriteColor: function () { return this.favoriteColor + ", no green!"; // obscure Monty Python reference } @@ -92,10 +92,10 @@ myapp.controller("MyController", ["$scope", "$firebase", '$FirebaseObject', '$Fi // AngularFireArray { - var list = sync.$asArray(); + var list = $FirebaseArray(ref); - // $inst() - if (list.$inst() !== sync) throw "error"; + // $ref() + if (list.$ref() !== ref) throw "error"; // $add() list.$add({ foo: "foo value" }); @@ -145,8 +145,8 @@ myapp.controller("MyController", ["$scope", "$firebase", '$FirebaseObject', '$Fi // $destroy() list.$destroy(); - // $extendFactory() - var ArrayWithSum = $FirebaseArray.$extendFactory({ + // $extend() + var ArrayWithSum = $FirebaseArray.$extend({ sum: function () { var total = 0; angular.forEach(this.$list, function (rec) { @@ -167,30 +167,43 @@ interface AngularFireAuthScope extends ng.IScope { loginObj: AngularFireAuth; } -myapp.controller("MyAuthController", ["$scope", "$firebaseSimpleLogin", - function($scope: AngularFireAuthScope, $firebaseSimpleLogin: AngularFireAuthService) { +myapp.controller("MyAuthController", ["$scope", "$firebaseAuth", + function($scope: AngularFireAuthScope, $firebaseAuth: AngularFireAuthService) { var dataRef = new Firebase(url); - $scope.loginObj = $firebaseSimpleLogin(dataRef); - $scope.loginObj.$getCurrentUser().then(_ => { - }); - var email = 'my@email.com'; - var password = 'mypassword'; - $scope.loginObj.$login('password', { - email: email, - password: password - }).then(function(user) { - console.log('Logged in as: ', user.uid); - }, function(error) { - console.error('Login failed: ', error); - }); - $scope.loginObj.$logout(); - $scope.loginObj.$createUser(email, password).then(_ => { - }); - $scope.loginObj.$changePassword(email, password, password).then(_ => { - }); - $scope.loginObj.$removeUser(email, password).then(_ => { - }); - $scope.loginObj.$sendPasswordResetEmail(email).then(_ => { - }); + $scope.loginObj = $firebaseAuth(dataRef); + $scope.loginObj.$getAuth(); + var credentials = { + email: 'my@email.com', + password: 'mypassword' + }; + var resetPasswordCredentials = { + email: 'my@email.com' + }; + var changePasswordCredentials = { + email: 'my@email.com', + oldPassword: 'mypassword', + newPassword: 'mypassword' + }; + var changeUserCredentials = { + oldEmail: 'my@email.com', + newEmail: 'my@email.com', + password: 'mypassword' + }; + $scope.loginObj.$authWithCustomToken("token").then(_ => {}); + $scope.loginObj.$authAnonymously().then(_ => {}); + $scope.loginObj.$authWithPassword(credentials).then(_ => {}); + $scope.loginObj.$authWithOAuthPopup("github").then(_ => {}); + $scope.loginObj.$authWithOAuthRedirect("google").then(_ => {}); + $scope.loginObj.$authWithOAuthToken("twitter", "token").then(_ => {}); + $scope.loginObj.$getAuth(); + $scope.loginObj.$onAuth(() => {}); + $scope.loginObj.$unauth(); + $scope.loginObj.$waitForAuth(); + $scope.loginObj.$requireAuth(); + $scope.loginObj.$createUser(credentials).then(_ => {}); + $scope.loginObj.$removeUser(credentials).then(_ => {}); + $scope.loginObj.$changeEmail(changeUserCredentials).then(_ => {}); + $scope.loginObj.$changePassword(changePasswordCredentials).then(_ => {}); + $scope.loginObj.$resetPassword(resetPasswordCredentials).then(_ => {}); } -]); \ No newline at end of file +]); diff --git a/angularfire/angularfire.d.ts b/angularfire/angularfire.d.ts index e4129e4ba..b1e7f4c2e 100644 --- a/angularfire/angularfire.d.ts +++ b/angularfire/angularfire.d.ts @@ -10,6 +10,9 @@ interface AngularFireService { (firebase: Firebase, config?: any): AngularFire; } +/** + * @deprecated. Not possible with AngularFire 1.0+ + */ interface AngularFire { $asArray(): AngularFireArray; $asObject(): AngularFireObject; @@ -24,39 +27,284 @@ interface AngularFire { $transaction(key:string, updateFn: (currentData: any) => any, applyLocally?: boolean): ng.IPromise; } +/** + * Creates and maintains a synchronized object, with 2-way bindings between Angular and Firebase. + */ interface AngularFireObject extends AngularFireSimpleObject { $id: string; $priority: number; $value: any; + + /** + * Removes all keys from the FirebaseObject and also removes + * the remote data from the server. + * + * @returns a promise which will resolve after the op completes + */ + + $remove(): ng.IPromise; + /** + * Saves all data on the FirebaseObject back to Firebase. + * @returns a promise which will resolve after the save is completed. + */ $save(): ng.IPromise; + + /** + * The loaded method is invoked after the initial batch of data arrives from the server. + * When this resolves, all data which existed prior to calling $asObject() is now cached + * locally in the object. + * + * As a shortcut is also possible to pass resolve/reject methods directly into this + * method just as they would be passed to .then() + * + * @param {Function} resolve + * @param {Function} reject + * @returns a promise which resolves after initial data is downloaded from Firebase + */ $loaded(resolve?: (x: AngularFireObject) => ng.IHttpPromise<{}>, reject?: (err: any) => any): ng.IPromise; + + /** + * The loaded method is invoked after the initial batch of data arrives from the server. + * When this resolves, all data which existed prior to calling $asObject() is now cached + * locally in the object. + * + * As a shortcut is also possible to pass resolve/reject methods directly into this + * method just as they would be passed to .then() + * + * @param {Function} resolve + * @param {Function} reject + * @returns a promise which resolves after initial data is downloaded from Firebase + */ $loaded(resolve?: (x: AngularFireObject) => ng.IPromise<{}>, reject?: (err: any) => any): ng.IPromise; + + /** + * The loaded method is invoked after the initial batch of data arrives from the server. + * When this resolves, all data which existed prior to calling $asObject() is now cached + * locally in the object. + * + * As a shortcut is also possible to pass resolve/reject methods directly into this + * method just as they would be passed to .then() + * + * @param {Function} resolve + * @param {Function} reject + * @returns a promise which resolves after initial data is downloaded from Firebase + */ $loaded(resolve?: (x: AngularFireObject) => void, reject?: (err: any) => any): ng.IPromise; - $inst(): AngularFire; + + /** + * @returns {Firebase} the original Firebase instance used to create this object. + */ + $ref(): Firebase; + + /** + * Creates a 3-way data sync between this object, the Firebase server, and a + * scope variable. This means that any changes made to the scope variable are + * pushed to Firebase, and vice versa. + * + * If scope emits a $destroy event, the binding is automatically severed. Otherwise, + * it is possible to unbind the scope variable by using the `unbind` function + * passed into the resolve method. + * + * Can only be bound to one scope variable at a time. If a second is attempted, + * the promise will be rejected with an error. + * + * @param {object} scope + * @param {string} varName + * @returns a promise which resolves to an unbind method after data is set in scope + */ $bindTo(scope: ng.IScope, varName: string): ng.IPromise; + + /** + * Listeners passed into this method are notified whenever a new change is received + * from the server. Each invocation is sent an object containing + * { type: 'value', key: 'my_firebase_id' } + * + * This method returns an unbind function that can be used to detach the listener. + * + * @param {Function} cb + * @param {Object} [context] + * @returns {Function} invoke to stop observing events + */ $watch(callback: Function, context?: any): Function; + + /** + * Informs $firebase to stop sending events and clears memory being used + * by this object (delete's its local content). + */ $destroy(): void; } interface AngularFireObjectService { - $extendFactory(ChildClass: Object, methods?: Object): Object; + /** + * Creates a synchronized object with 2-way bindings between Angular and Firebase. + * + * @param {Firebase} ref + * @returns {FirebaseObject} + */ + (firebase: Firebase): AngularFireObject; + $extend(ChildClass: Object, methods?: Object): Object; } +/** + * Creates and maintains a synchronized list of data. This is a pseudo-read-only array. One should + * not call splice(), push(), pop(), et al directly on this array, but should instead use the + * $remove and $add methods. + * + * It is acceptable to .sort() this array, but it is important to use this in conjunction with + * $watch(), so that it will be re-sorted any time the server data changes. Examples of this are + * included in the $watch documentation. + */ interface AngularFireArray extends Array { + /** + * Create a new record with a unique ID and add it to the end of the array. + * This should be used instead of Array.prototype.push, since those changes will not be + * synchronized with the server. + * + * Any value, including a primitive, can be added in this way. Note that when the record + * is created, the primitive value would be stored in $value (records are always objects + * by default). + * + * Returns a future which is resolved when the data has successfully saved to the server. + * The resolve callback will be passed a Firebase ref representing the new data element. + * + * @param data + * @returns a promise resolved after data is added + */ $add(newData: any): ng.IPromise; + + /** + * Pass either an item in the array or the index of an item and it will be saved back + * to Firebase. While the array is read-only and its structure should not be changed, + * it is okay to modify properties on the objects it contains and then save those back + * individually. + * + * Returns a future which is resolved when the data has successfully saved to the server. + * The resolve callback will be passed a Firebase ref representing the saved element. + * If passed an invalid index or an object which is not a record in this array, + * the promise will be rejected. + * + * @param {int|object} indexOrItem + * @returns a promise resolved after data is saved + */ $save(recordOrIndex: any): ng.IPromise; + + /** + * Pass either an existing item in this array or the index of that item and it will + * be removed both locally and in Firebase. This should be used in place of + * Array.prototype.splice for removing items out of the array, as calling splice + * will not update the value on the server. + * + * Returns a future which is resolved when the data has successfully removed from the + * server. The resolve callback will be passed a Firebase ref representing the deleted + * element. If passed an invalid index or an object which is not a record in this array, + * the promise will be rejected. + * + * @param {int|object} indexOrItem + * @returns a promise which resolves after data is removed + */ $remove(recordOrIndex: any): ng.IPromise; + + /** + * Returns the record for a given Firebase key (record.$id). If the record is not found + * then returns null. + * + * @param {string} key + * @returns {Object|null} a record in this array + */ $getRecord(key: string): AngularFireSimpleObject; + + /** + * Given an item in this array or the index of an item in the array, this returns the + * Firebase key (record.$id) for that record. If passed an invalid key or an item which + * does not exist in this array, it will return null. + * + * @param {int|object} indexOrItem + * @returns {null|string} + */ $keyAt(recordOrIndex: any): string; + + /** + * The inverse of $keyAt, this method takes a Firebase key (record.$id) and returns the + * index in the array where that record is stored. If the record is not in the array, + * this method returns -1. + * + * @param {String} key + * @returns {int} -1 if not found + */ $indexFor(key: string): number; + + /** + * The loaded method is invoked after the initial batch of data arrives from the server. + * When this resolves, all data which existed prior to calling $asArray() is now cached + * locally in the array. + * + * As a shortcut is also possible to pass resolve/reject methods directly into this + * method just as they would be passed to .then() + * + * @param {Function} [resolve] + * @param {Function} [reject] + * @returns a promise + */ $loaded(resolve?: (x: AngularFireArray) => ng.IHttpPromise<{}>, reject?: (err: any) => any): ng.IPromise; + + /** + * The loaded method is invoked after the initial batch of data arrives from the server. + * When this resolves, all data which existed prior to calling $asArray() is now cached + * locally in the array. + * + * As a shortcut is also possible to pass resolve/reject methods directly into this + * method just as they would be passed to .then() + * + * @param {Function} [resolve] + * @param {Function} [reject] + * @returns a promise + */ $loaded(resolve?: (x: AngularFireArray) => ng.IPromise<{}>, reject?: (err: any) => any): ng.IPromise; + + /** + * The loaded method is invoked after the initial batch of data arrives from the server. + * When this resolves, all data which existed prior to calling $asArray() is now cached + * locally in the array. + * + * As a shortcut is also possible to pass resolve/reject methods directly into this + * method just as they would be passed to .then() + * + * @param {Function} [resolve] + * @param {Function} [reject] + * @returns a promise + */ $loaded(resolve?: (x: AngularFireArray) => void, reject?: (err: any) => any): ng.IPromise; - $inst(): AngularFire; + + /** + * @returns {Firebase} the original Firebase ref used to create this object. + */ + $ref(): Firebase; + + /** + * Listeners passed into this method are notified whenever a new change (add, updated, + * move, remove) is received from the server. Each invocation is sent an object + * containing { type: 'child_added|child_updated|child_moved|child_removed', + * key: 'key_of_item_affected'} + * + * Additionally, added and moved events receive a prevChild parameter, containing the + * key of the item before this one in the array. + * + * This method returns a function which can be invoked to stop observing events. + * + * @param {Function} cb + * @param {Object} [context] + * @returns {Function} used to stop observing + */ $watch(cb: (event: string, key: string, prevChild: string) => void, context?: any): Function; + + /** + * Informs $firebase to stop sending events and clears memory being used + * by this array (delete's its local content). + */ $destroy(): void; } interface AngularFireArrayService { - $extendFactory(ChildClass: Object, methods?: Object): Object; + (firebase: Firebase): AngularFireArray; + $extend(ChildClass: Object, methods?: Object): Object; } interface AngularFireSimpleObject { @@ -72,11 +320,160 @@ interface AngularFireAuthService { } interface AngularFireAuth { - $getCurrentUser(): ng.IPromise; - $login(provider: string, options?: Object): ng.IPromise; - $logout(): void; - $createUser(email: string, password: string): ng.IPromise; - $changePassword(email: string, oldPassword: string, newPassword: string): ng.IPromise; - $removeUser(email: string, password: string): ng.IPromise; - $sendPasswordResetEmail(email: string): ng.IPromise; + /** + * Authenticates the Firebase reference with a custom authentication token. + * + * @param {string} authToken An authentication token or a Firebase Secret. A Firebase Secret + * should only be used for authenticating a server process and provides full read / write + * access to the entire Firebase. + * @param {Object} [options] An object containing optional client arguments, such as configuring + * session persistence. + * @return {Promise} A promise fulfilled with an object containing authentication data. + */ + $authWithCustomToken(authToken: string, options?: Object): ng.IPromise; + + /** + * Authenticates the Firebase reference anonymously. + * + * @param {Object} [options] An object containing optional client arguments, such as configuring + * session persistence. + * @return {Promise} A promise fulfilled with an object containing authentication data. + */ + $authAnonymously(options?: Object): ng.IPromise; + + /** + * Authenticates the Firebase reference with an email/password user. + * + * @param {Object} credentials An object containing email and password attributes corresponding + * to the user account. + * @param {Object} [options] An object containing optional client arguments, such as configuring + * session persistence. + * @return {Promise} A promise fulfilled with an object containing authentication data. + */ + $authWithPassword(credentials: FirebaseCredentials, options?: Object): ng.IPromise; + + /** + * Authenticates the Firebase reference with the OAuth popup flow. + * + * @param {string} provider The unique string identifying the OAuth provider to authenticate + * with, e.g. google. + * @param {Object} [options] An object containing optional client arguments, such as configuring + * session persistence. + * @return {Promise} A promise fulfilled with an object containing authentication data. + */ + $authWithOAuthPopup(provider: string, options?: Object): ng.IPromise; + + /** + * Authenticates the Firebase reference with the OAuth redirect flow. + * + * @param {string} provider The unique string identifying the OAuth provider to authenticate + * with, e.g. google. + * @param {Object} [options] An object containing optional client arguments, such as configuring + * session persistence. + * @return {Promise} A promise fulfilled with an object containing authentication data. + */ + $authWithOAuthRedirect(provider: string, options?: Object): ng.IPromise; + + /** + * Authenticates the Firebase reference with an OAuth token. + * + * @param {string} provider The unique string identifying the OAuth provider to authenticate + * with, e.g. google. + * @param {string|Object} credentials Either a string, such as an OAuth 2.0 access token, or an + * Object of key / value pairs, such as a set of OAuth 1.0a credentials. + * @param {Object} [options] An object containing optional client arguments, such as configuring + * session persistence. + * @return {Promise} A promise fulfilled with an object containing authentication data. + */ + $authWithOAuthToken(provider: string, credentials: Object|string, options?: Object): ng.IPromise; + + /** + * Synchronously retrieves the current authentication data. + * + * @return {Object} The client's authentication data. + */ + $getAuth(): FirebaseAuthData; + + /** + * Asynchronously fires the provided callback with the current authentication data every time + * the authentication data changes. It also fires as soon as the authentication data is + * retrieved from the server. + * + * @param {function} callback A callback that fires when the client's authenticate state + * changes. If authenticated, the callback will be passed an object containing authentication + * data according to the provider used to authenticate. Otherwise, it will be passed null. + * @param {string} [context] If provided, this object will be used as this when calling your + * callback. + * @return {function} A function which can be used to deregister the provided callback. + */ + $onAuth(callback: Function, context?: any): Function; + + /** + * Unauthenticates the Firebase reference. + */ + $unauth(): void; + + /** + * Utility method which can be used in a route's resolve() method to grab the current + * authentication data. + * + * @returns {Promise} A promise fulfilled with the client's current authentication + * state, which will be null if the client is not authenticated. + */ + $waitForAuth(): ng.IPromise; + + /** + * Utility method which can be used in a route's resolve() method to require that a route has + * a logged in client. + * + * @returns {Promise} A promise fulfilled with the client's current authentication + * state or rejected if the client is not authenticated. + */ + $requireAuth(): ng.IPromise; + + /** + * Creates a new email/password user. Note that this function only creates the user, if you + * wish to log in as the newly created user, call $authWithPassword() after the promise for + * this method has been resolved. + * + * @param {Object} credentials An object containing the email and password of the user to create. + * @return {Promise} A promise fulfilled with the user object, which contains the + * uid of the created user. + */ + $createUser(credentials: FirebaseCredentials): ng.IPromise; + + /** + * Removes an email/password user. + * + * @param {Object} credentials An object containing the email and password of the user to remove. + * @return {Promise<>} An empty promise fulfilled once the user is removed. + */ + $removeUser(credentials: FirebaseCredentials): ng.IPromise; + + /** + * Changes the email for an email/password user. + * + * @param {Object} credentials An object containing the old email, new email, and password of + * the user whose email is to change. + * @return {Promise<>} An empty promise fulfilled once the email change is complete. + */ + $changeEmail(credentials: FirebaseChangeEmailCredentials): ng.IPromise; + + /** + * Changes the password for an email/password user. + * + * @param {Object} credentials An object containing the email, old password, and new password of + * the user whose password is to change. + * @return {Promise<>} An empty promise fulfilled once the password change is complete. + */ + $changePassword(credentials: FirebaseChangePasswordCredentials): ng.IPromise; + + /** + * Sends a password reset email to an email/password user. + * + * @param {Object} credentials An object containing the email of the user to send a reset + * password email to. + * @return {Promise<>} An empty promise fulfilled once the reset password email is sent. + */ + $resetPassword(credentials: FirebaseResetPasswordCredentials): ng.IPromise; } diff --git a/angularjs-toaster/angularjs-toaster-tests.ts b/angularjs-toaster/angularjs-toaster-tests.ts new file mode 100644 index 000000000..ffff32159 --- /dev/null +++ b/angularjs-toaster/angularjs-toaster-tests.ts @@ -0,0 +1,42 @@ +/// +class NgToasterTestController { + constructor(public $scope: ng.IScope, public $window: ng.IWindowService, public toaster: ngtoaster.IToasterService) { + this.bar = 'Hi'; + } + bar: string; + + pop(): void { + this.toaster.success({ title: "title", body: "text1" }); + this.toaster.error("title", "text2"); + this.toaster.pop({ type: 'wait', title: "title", body: "text" }); + this.toaster.pop('success', "title", '
    • Render html
    ', 5000, 'trustedHtml'); + this.toaster.pop('error', "title", '
    • Render html
    ', null, 'trustedHtml'); + this.toaster.pop('wait', "title", null, null, 'template'); + this.toaster.pop('warning', "title", "myTemplate.html", null, 'template'); + this.toaster.pop('note', "title", "text"); + this.toaster.pop('success', "title", 'Its address is https://google.com.', 5000, 'trustedHtml', (toaster: ngtoaster.IToast): boolean => { + var match = toaster.body.match(/http[s]?:\/\/[^\s]+/); + if (match) { + this.$window.open(match[0]); + } + return true; + }); + this.toaster.pop('warning', "Hi ", "{template: 'myTemplateWithData.html', data: 'MyData'}", 15000, 'templateWithData'); + } + + goToLink(toaster: ngtoaster.IToast): boolean { + var match = toaster.body.match(/http[s]?:\/\/[^\s]+/); + if (match) { + this.$window.open(match[0]); + } + return true; + } + + clear(): void { + this.toaster.clear(); + } +} + +angular + .module('main', ['ngAnimate', 'toaster']) + .controller('myController', NgToasterTestController); \ No newline at end of file diff --git a/angularjs-toaster/angularjs-toaster.d.ts b/angularjs-toaster/angularjs-toaster.d.ts new file mode 100644 index 000000000..398704514 --- /dev/null +++ b/angularjs-toaster/angularjs-toaster.d.ts @@ -0,0 +1,109 @@ +// Type definitions for angularjs-toaster v0.4.13 +// Project: https://github.com/jirikavi/AngularJS-Toaster +// Definitions by: Ben Tesser +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module ngtoaster { + interface IToasterService { + pop(params:IPopParams): void + /** + * @param {string} type Type of toaster -- 'error', 'info', 'wait', 'success', and 'warning' + */ + pop(type?:string, title?:string, body?:string, timeout?:number, bodyOutputType?:string, clickHandler?:EventListener, + toasterId?:number, showCloseButton?:boolean): void + error(params: IPopParams): void + error(title?:string, body?:string, timeout?:number, bodyOutputType?:string, clickHandler?:EventListener, + toasterId?:number): void + into(params: IPopParams): void + info(title?:string, body?:string, timeout?:number, bodyOutputType?:string, clickHandler?:EventListener, + toasterId?:number): void + wait(params: IPopParams): void + wait(title?:string, body?:string, timeout?:number, bodyOutputType?:string, clickHandler?:EventListener, + toasterId?:number): void + success(params: IPopParams): void + success(title?:string, body?:string, timeout?:number, bodyOutputType?:string, clickHandler?:EventListener, + toasterId?:number): void + warning(params: IPopParams): void + warning(title?:string, body?:string, timeout?:number, bodyOutputType?:string, clickHandler?:EventListener, + toasterId?:number): void + clear(): void + toast:IToast; + } + + interface IToasterEventRegistry { + setup(): void + subscribeToNewToastEvent(onNewToast:IToastEventListener): void + subscribeToClearToastsEvent(onClearToasts:IToastEventListener): void + unsubscribeToNewToastEvent(onNewToast:IToastEventListener): void + unsubscribeToClearToastsEvent(onClearToasts:IToastEventListener): void + } + + interface IPopParams extends IToast{ + toasterId?: number; + } + + interface IToastEventListener { + (event:Event, toasterId: number): void; + } + + interface IToast { + /** + * Acceptable types are: + * 'error', 'info', 'wait', 'success', and 'warning' + */ + type?: string; + title?: string; + body?: string; + timeout?: number; + bodyOutputType?: string; + clickHandler?: EventListener; + showCloseButton?: boolean; + } + + interface IToasterConfig { + /** + * limits max number of toasts + */ + limit?: number; + 'tap-to-dismiss'?: boolean; + 'close-button'?: boolean; + 'newest-on-top'?: boolean; + 'time-out'?: number; + 'icon-classes'?: IIconClasses; + /** + * Options include: + * '', 'trustedHtml', 'template', 'templateWithData' + */ + 'body-output-type'?: string; + 'body-template'?: string; + 'icon-class'?: string; + /** + * Options include: + * 'toast-top-full-width', 'toast-bottom-full-width', 'toast-center', + * 'toast-top-left', 'toast-top-center', 'toast-top-rigt', + * 'toast-bottom-left', 'toast-bottom-center', 'toast-bottom-rigt', + */ + 'position-class'?: string; + 'title-class'?: string; + 'message-class'?: string; + 'prevent-duplicates'?: boolean; + /** + * stop timeout on mouseover and restart timer on mouseout + */ + 'mouseover-timer-stop'?: boolean; + } + + interface IIconClasses { + error: string; + info: string; + wait: string; + success: string; + warning: string; + } +} + +declare module "ngtoaster" { + export = ngtoaster +} diff --git a/angularjs/angular-animate.d.ts b/angularjs/angular-animate.d.ts index e78b85c3e..3ecc95b5b 100644 --- a/angularjs/angular-animate.d.ts +++ b/angularjs/angular-animate.d.ts @@ -19,7 +19,7 @@ declare module angular.animate { // AnimateService // see http://docs.angularjs.org/api/ngAnimate/service/$animate /////////////////////////////////////////////////////////////////////////// - interface IAnimateService extends ng.IAnimateService { + interface IAnimateService extends angular.IAnimateService { /** * Globally enables / disables animations. * @@ -39,7 +39,7 @@ declare module angular.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; + animate(element: JQuery, from: any, to: any, className?: string, options?: IAnimationOptions): IPromise; /** * Appends the element to the parentElement element that resides in the document and then runs the enter animation. @@ -50,7 +50,7 @@ declare module angular.animate { * @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, options?: IAnimationOptions): ng.IPromise; + enter(element: JQuery, parentElement: JQuery, afterElement?: JQuery, options?: IAnimationOptions): IPromise; /** * Runs the leave animation operation and, upon completion, removes the element from the DOM. @@ -59,7 +59,7 @@ declare module angular.animate { * @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, options?: IAnimationOptions): ng.IPromise; + leave(element: JQuery, options?: IAnimationOptions): IPromise; /** * Fires the move DOM operation. Just before the animation starts, the animate service will either append @@ -71,7 +71,7 @@ declare module angular.animate { * @param afterElement the sibling element (which is the previous element) of the element that will be the focus of the move animation * @returns the animation callback promise */ - move(element: JQuery, parentElement: JQuery, afterElement?: JQuery): ng.IPromise; + move(element: JQuery, parentElement: JQuery, afterElement?: JQuery): IPromise; /** * Triggers a custom animation event based off the className variable and then attaches the className @@ -82,7 +82,7 @@ declare module angular.animate { * @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, options?: IAnimationOptions): ng.IPromise; + addClass(element: JQuery, className: string, options?: IAnimationOptions): IPromise; /** * Triggers a custom animation event based off the className variable and then removes the CSS class @@ -93,7 +93,7 @@ declare module angular.animate { * @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, options?: IAnimationOptions): ng.IPromise; + removeClass(element: JQuery, className: string, options?: IAnimationOptions): IPromise; /** * Adds and/or removes the given CSS classes to and from the element. Once complete, the done() callback @@ -105,12 +105,12 @@ declare module angular.animate { * @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, options?: IAnimationOptions): ng.IPromise; + setClass(element: JQuery, add: string, remove: string, options?: IAnimationOptions): IPromise; /** * Cancels the provided animation. */ - cancel(animationPromise: ng.IPromise): void; + cancel(animationPromise: IPromise): void; } /////////////////////////////////////////////////////////////////////////// @@ -124,7 +124,7 @@ declare module angular.animate { * @param name The name of the animation. * @param factory The factory function that will be executed to return the animation object. */ - register(name: string, factory: () => ng.IAnimateCallbackObject): void; + register(name: string, factory: () => IAnimateCallbackObject): void; /** * Gets and/or sets the CSS class expression that is checked when performing an animation. diff --git a/angularjs/angular-cookies.d.ts b/angularjs/angular-cookies.d.ts index 89a747f82..cdea69d36 100644 --- a/angularjs/angular-cookies.d.ts +++ b/angularjs/angular-cookies.d.ts @@ -1,6 +1,6 @@ -// Type definitions for Angular JS 1.3 (ngCookies module) +// Type definitions for Angular JS 1.4 (ngCookies module) // Project: http://angularjs.org -// Definitions by: Diego Vilar +// Definitions by: Diego Vilar , Anthony Ciccarello // Definitions: https://github.com/borisyankov/DefinitelyTyped @@ -28,10 +28,13 @@ declare module angular.cookies { // CookieStoreService // see http://docs.angularjs.org/api/ngCookies.$cookieStore /////////////////////////////////////////////////////////////////////////// - interface ICookieStoreService { - get(key: string): any; - put(key: string, value: any): void; - remove(key: string): void; + interface ICookiesService { + get(key: string): string; + getObject(key: string): any; + getAll(): any; + put(key: string, value: string, options?: any): void; + putObject(key: string, value: any, options?: any): void; + remove(key: string, options?: any): void; } } diff --git a/angularjs/angular-mocks.d.ts b/angularjs/angular-mocks.d.ts index db551ee3d..1c1966c1b 100644 --- a/angularjs/angular-mocks.d.ts +++ b/angularjs/angular-mocks.d.ts @@ -39,8 +39,11 @@ declare module angular { dump(obj: any): string; // see http://docs.angularjs.org/api/angular.mock.inject - inject(...fns: Function[]): any; - inject(...inlineAnnotatedConstructor: any[]): any; // this overload is undocumented, but works + inject: { + (...fns: Function[]): any; + (...inlineAnnotatedConstructor: any[]): any; // this overload is undocumented, but works + strictDi(val?: boolean): void; + } // see http://docs.angularjs.org/api/angular.mock.module module(...modules: any[]): any; diff --git a/angularjs/angular-resource-tests.ts b/angularjs/angular-resource-tests.ts index c80cc662d..148d40901 100644 --- a/angularjs/angular-resource-tests.ts +++ b/angularjs/angular-resource-tests.ts @@ -1,12 +1,12 @@ /// -interface IMyResource extends ng.resource.IResource { }; -interface IMyResourceClass extends ng.resource.IResourceClass { }; +interface IMyResource extends angular.resource.IResource { }; +interface IMyResourceClass extends angular.resource.IResourceClass { }; /////////////////////////////////////// // IActionDescriptor /////////////////////////////////////// -var actionDescriptor: ng.resource.IActionDescriptor; +var actionDescriptor: angular.resource.IActionDescriptor; actionDescriptor.headers = { header: 'value' }; actionDescriptor.isArray = true; @@ -19,7 +19,7 @@ actionDescriptor.params = { key: 'value' }; /////////////////////////////////////// var resourceClass: IMyResourceClass; var resource: IMyResource; -var resourceArray: ng.resource.IResourceArray; +var resourceArray: angular.resource.IResourceArray; resource = resourceClass.delete(); resource = resourceClass.delete({ key: 'value' }); @@ -49,7 +49,7 @@ resourceArray = resourceClass.query({ key: 'value' }, { key: 'value' }); resourceArray = resourceClass.query({ key: 'value' }, { key: 'value' }, function () { }); resourceArray = resourceClass.query({ key: 'value' }, { key: 'value' }, function () { }, function () { }); resourceArray.push(resource); -resourceArray.$promise.then(function(data: ng.resource.IResourceArray) {}); +resourceArray.$promise.then(function(data: angular.resource.IResourceArray) {}); resource = resourceClass.remove(); resource = resourceClass.remove({ key: 'value' }); @@ -73,8 +73,8 @@ resource = resourceClass.save({ key: 'value' }, { key: 'value' }, function () { // IResource /////////////////////////////////////// -var promise : ng.IPromise; -var arrayPromise : ng.IPromise; +var promise : angular.IPromise; +var arrayPromise : angular.IPromise; promise = resource.$delete(); promise = resource.$delete({ key: 'value' }); @@ -97,7 +97,7 @@ arrayPromise = resourceArray[0].$query({ key: 'value' }, function () { }); arrayPromise = resourceArray[0].$query(function () { }); arrayPromise = resourceArray[0].$query(function () { }, function () { }); arrayPromise = resourceArray[0].$query({ key: 'value' }, function () { }, function () { }); -arrayPromise.then(function(data: ng.resource.IResourceArray) {}); +arrayPromise.then(function(data: angular.resource.IResourceArray) {}); promise = resource.$remove(); promise = resource.$remove({ key: 'value' }); @@ -116,7 +116,7 @@ promise = resource.$save({ key: 'value' }, function () { }, function () { }); /////////////////////////////////////// // IResourceService /////////////////////////////////////// -var resourceService: ng.resource.IResourceService; +var resourceService: angular.resource.IResourceService; resourceClass = resourceService('test'); resourceClass = resourceService('test'); resourceClass = resourceService('test'); @@ -125,12 +125,12 @@ resourceClass = resourceService('test'); // IModule /////////////////////////////////////// var mod: ng.IModule; -var resourceServiceFactoryFunction: ng.resource.IResourceServiceFactoryFunction; -var resourceService: ng.resource.IResourceService; +var resourceServiceFactoryFunction: angular.resource.IResourceServiceFactoryFunction; +var resourceService: angular.resource.IResourceService; resourceClass = resourceServiceFactoryFunction(resourceService); -resourceServiceFactoryFunction = function (resourceService: ng.resource.IResourceService) { return resourceClass; }; +resourceServiceFactoryFunction = function (resourceService: angular.resource.IResourceService) { return resourceClass; }; mod = mod.factory('factory name', resourceServiceFactoryFunction); /////////////////////////////////////// diff --git a/angularjs/angular-resource.d.ts b/angularjs/angular-resource.d.ts index 4f03a341c..057cc1b56 100644 --- a/angularjs/angular-resource.d.ts +++ b/angularjs/angular-resource.d.ts @@ -104,28 +104,28 @@ declare module angular.resource { // Instance calls always return the the promise of the request which retrieved the object // https://github.com/angular/angular.js/blob/v1.2.0/src/ngResource/resource.js#L538-L546 interface IResource { - $get(): ng.IPromise; - $get(params?: Object, success?: Function, error?: Function): ng.IPromise; - $get(success: Function, error?: Function): ng.IPromise; + $get(): angular.IPromise; + $get(params?: Object, success?: Function, error?: Function): angular.IPromise; + $get(success: Function, error?: Function): angular.IPromise; - $query(): ng.IPromise>; - $query(params?: Object, success?: Function, error?: Function): ng.IPromise>; - $query(success: Function, error?: Function): ng.IPromise>; + $query(): angular.IPromise>; + $query(params?: Object, success?: Function, error?: Function): angular.IPromise>; + $query(success: Function, error?: Function): angular.IPromise>; - $save(): ng.IPromise; - $save(params?: Object, success?: Function, error?: Function): ng.IPromise; - $save(success: Function, error?: Function): ng.IPromise; + $save(): angular.IPromise; + $save(params?: Object, success?: Function, error?: Function): angular.IPromise; + $save(success: Function, error?: Function): angular.IPromise; - $remove(): ng.IPromise; - $remove(params?: Object, success?: Function, error?: Function): ng.IPromise; - $remove(success: Function, error?: Function): ng.IPromise; + $remove(): angular.IPromise; + $remove(params?: Object, success?: Function, error?: Function): angular.IPromise; + $remove(success: Function, error?: Function): angular.IPromise; - $delete(): ng.IPromise; - $delete(params?: Object, success?: Function, error?: Function): ng.IPromise; - $delete(success: Function, error?: Function): ng.IPromise; + $delete(): angular.IPromise; + $delete(params?: Object, success?: Function, error?: Function): angular.IPromise; + $delete(success: Function, error?: Function): angular.IPromise; /** the promise of the original server interaction that created this instance. **/ - $promise : ng.IPromise; + $promise : angular.IPromise; $resolved : boolean; } @@ -134,14 +134,14 @@ declare module angular.resource { */ interface IResourceArray extends Array { /** the promise of the original server interaction that created this collection. **/ - $promise : ng.IPromise>; + $promise : angular.IPromise>; $resolved : boolean; } /** when creating a resource factory via IModule.factory */ interface IResourceServiceFactoryFunction { - ($resource: ng.resource.IResourceService): IResourceClass; - >($resource: ng.resource.IResourceService): U; + ($resource: angular.resource.IResourceService): IResourceClass; + >($resource: angular.resource.IResourceService): U; } } @@ -150,13 +150,13 @@ declare module angular { interface IModule { /** creating a resource service factory */ - factory(name: string, resourceServiceFactoryFunction: ng.resource.IResourceServiceFactoryFunction): IModule; + factory(name: string, resourceServiceFactoryFunction: angular.resource.IResourceServiceFactoryFunction): IModule; } } interface Array { /** the promise of the original server interaction that created this collection. **/ - $promise : ng.IPromise>; + $promise : angular.IPromise>; $resolved : boolean; } diff --git a/angularjs/angular-route.d.ts b/angularjs/angular-route.d.ts index b791942a4..4ddf87cab 100644 --- a/angularjs/angular-route.d.ts +++ b/angularjs/angular-route.d.ts @@ -63,7 +63,7 @@ declare module angular.route { * * {Array.} - route parameters extracted from the current $location.path() by applying the current route */ - template?: string|{($routeParams?: ng.route.IRouteParamsService) : string;} + template?: string|{($routeParams?: angular.route.IRouteParamsService) : string;} /** * {string=|function()=} * Path or function that returns a path to an html template that should be used by ngView. @@ -72,7 +72,7 @@ declare module angular.route { * * {Array.} - route parameters extracted from the current $location.path() by applying the current route */ - templateUrl?: string|{ ($routeParams?: ng.route.IRouteParamsService): string; } + templateUrl?: string|{ ($routeParams?: angular.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: * @@ -91,7 +91,7 @@ declare module angular.route { * - {Object} - current $location.search() * - The custom redirectTo function is expected to return a string which will be used to update $location.path() and $location.search(). */ - redirectTo?: string|{($routeParams?: ng.route.IRouteParamsService, $locationPath?: string, $locationSearch?: any) : string}; + redirectTo?: string|{($routeParams?: angular.route.IRouteParamsService, $locationPath?: string, $locationSearch?: any) : string}; /** * Reload route when only $location.search() or $location.hash() changes. * diff --git a/angularjs/angular.d.ts b/angularjs/angular.d.ts index 191aa7692..457a1df35 100755 --- a/angularjs/angular.d.ts +++ b/angularjs/angular.d.ts @@ -474,6 +474,7 @@ declare module angular { // types do work and it's common to use them. $setViewValue(value: any, trigger?: string): void; $setPristine(): void; + $setDirty(): void; $validate(): void; $setTouched(): void; $setUntouched(): void; @@ -539,9 +540,29 @@ declare module angular { $applyAsync(exp: string): any; $applyAsync(exp: (scope: IScope) => any): any; + /** + * Dispatches an event name downwards to all child scopes (and their children) notifying the registered $rootScope.Scope listeners. + * + * The event life cycle starts at the scope on which $broadcast was called. All listeners listening for name event on this scope get notified. Afterwards, the event propagates to all direct and indirect scopes of the current scope and calls all registered listeners along the way. The event cannot be canceled. + * + * Any exception emitted from the listeners will be passed onto the $exceptionHandler service. + * + * @param name Event name to broadcast. + * @param args Optional one or more arguments which will be passed onto the event listeners. + */ $broadcast(name: string, ...args: any[]): IAngularEvent; $destroy(): void; $digest(): void; + /** + * Dispatches an event name upwards through the scope hierarchy notifying the registered $rootScope.Scope listeners. + * + * The event life cycle starts at the scope on which $emit was called. All listeners listening for name event on this scope get notified. Afterwards, the event traverses upwards toward the root scope and calls all registered listeners along the way. The event will stop propagating if one of the listeners cancels it. + * + * Any exception emitted from the listeners will be passed onto the $exceptionHandler service. + * + * @param name Event name to emit. + * @param args Optional one or more arguments which will be passed onto the event listeners. + */ $emit(name: string, ...args: any[]): IAngularEvent; $eval(): any; @@ -665,6 +686,7 @@ declare module angular { // TODO undocumented, so we need to get it from the source code /////////////////////////////////////////////////////////////////////////// interface IBrowserService { + defer: angular.ITimeoutService; [key: string]: any; } @@ -715,17 +737,37 @@ declare module angular { eventFn(element: Node, doneFn: () => void): Function; } - /////////////////////////////////////////////////////////////////////////// - // FilterService - // see http://docs.angularjs.org/api/ng.$filter - // see http://docs.angularjs.org/api/ng.$filterProvider - /////////////////////////////////////////////////////////////////////////// + /** + * $filter - $filterProvider - service in module ng + * + * Filters are used for formatting data displayed to the user. + * + * see https://docs.angularjs.org/api/ng/service/$filter + */ interface IFilterService { + /** + * Usage: + * $filter(name); + * + * @param name Name of the filter function to retrieve + */ (name: string): Function; } + /** + * $filterProvider - $filter - provider in module ng + * + * Filters are just functions which transform input to an output. However filters need to be Dependency Injected. To achieve this a filter definition consists of a factory function which is annotated with dependencies and is responsible for creating a filter function. + * + * see https://docs.angularjs.org/api/ng/provider/$filterProvider + */ interface IFilterProvider extends IServiceProvider { - register(name: string, filterFactory: Function): IServiceProvider; + /** + * register(name); + * + * @param name Name of the filter function, or an object map of filters where the keys are the filter names and the values are the filter factories. Note: Filter names must be valid angular Expressions identifiers, such as uppercase or orderBy. Names with special characters, such as hyphens and dots, are not allowed. If you wish to namespace your filters, then you can use capitalization (myappSubsectionFilterx) or underscores (myapp_subsection_filterx). + */ + register(name: string | {}): IServiceProvider; } /////////////////////////////////////////////////////////////////////////// @@ -1011,37 +1053,98 @@ declare module angular { disableAutoScrolling(): void; } - /////////////////////////////////////////////////////////////////////////// - // CacheFactoryService - // see http://docs.angularjs.org/api/ng.$cacheFactory - /////////////////////////////////////////////////////////////////////////// + /** + * $cacheFactory - service in module ng + * + * Factory that constructs Cache objects and gives access to them. + * + * see https://docs.angularjs.org/api/ng/service/$cacheFactory + */ interface ICacheFactoryService { - // Lets not foce the optionsMap to have the capacity member. Even though - // it's the ONLY option considered by the implementation today, a consumer - // might find it useful to associate some other options to the cache object. - //(cacheId: string, optionsMap?: { capacity: number; }): CacheObject; - (cacheId: string, optionsMap?: { capacity: number; }): ICacheObject; + /** + * Factory that constructs Cache objects and gives access to them. + * + * @param cacheId Name or id of the newly created cache. + * @param optionsMap Options object that specifies the cache behavior. Properties: + * + * capacity — turns the cache into LRU cache. + */ + (cacheId: string, optionsMap?: { capacity?: number; }): ICacheObject; - // Methods bellow are not documented + /** + * Get information about all the caches that have been created. + * @returns key-value map of cacheId to the result of calling cache#info + */ info(): any; + + /** + * Get access to a cache object by the cacheId used when it was created. + * + * @param cacheId Name or id of a cache to access. + */ get(cacheId: string): ICacheObject; } + /** + * $cacheFactory.Cache - type in module ng + * + * A cache object used to store and retrieve data, primarily used by $http and the script directive to cache templates and other data. + * + * see https://docs.angularjs.org/api/ng/type/$cacheFactory.Cache + */ interface ICacheObject { + /** + * Retrieve information regarding a particular Cache. + */ info(): { + /** + * the id of the cache instance + */ id: string; + + /** + * the number of entries kept in the cache instance + */ size: number; - // Not garanteed to have, since it's a non-mandatory option - //capacity: number; + //...: any additional properties from the options object when creating the cache. }; + + /** + * Inserts a named entry into the Cache object to be retrieved later, and incrementing the size of the cache if the key was not already present in the cache. If behaving like an LRU cache, it will also remove stale entries from the set. + * + * It will not insert undefined values into the cache. + * + * @param key the key under which the cached data is stored. + * @param value the value to store alongside the key. If it is undefined, the key will not be stored. + */ put(key: string, value?: T): T; + + /** + * Retrieves named data stored in the Cache object. + * + * @param key the key of the data to be retrieved + */ get(key: string): any; + + /** + * Removes an entry from the Cache object. + * + * @param key the key of the entry to be removed + */ remove(key: string): void; + + /** + * Clears the cache object of any entries. + */ removeAll(): void; + + /** + * Destroys the Cache object entirely, removing it from the $cacheFactory set. + */ destroy(): void; } - + /////////////////////////////////////////////////////////////////////////// // CompileService // see http://docs.angularjs.org/api/ng.$compile @@ -1277,7 +1380,7 @@ declare module angular { interface IHttpPromiseCallbackArg { data?: T; status?: number; - headers?: (headerName: string) => string; + headers?: IHttpHeadersGetter; config?: IRequestConfig; statusText?: string; } diff --git a/ansi-styles/ansi-styles-tests.ts b/ansi-styles/ansi-styles-tests.ts new file mode 100644 index 000000000..dc3187ef5 --- /dev/null +++ b/ansi-styles/ansi-styles-tests.ts @@ -0,0 +1,54 @@ +/// + +import ansi = require('ansi-styles'); + + +var styles = [ + ansi.reset, + + ansi.bold, + ansi.dim, + ansi.italic, + ansi.underline, + ansi.inverse, + ansi.hidden, + ansi.strikethrough, + + ansi.black, + ansi.red, + ansi.green, + ansi.yellow, + ansi.blue, + ansi.magenta, + ansi.cyan, + ansi.white, + ansi.gray, + + ansi.bgBlack, + ansi.bgRed, + ansi.bgGreen, + ansi.bgYellow, + ansi.bgBlue, + ansi.bgMagenta, + ansi.bgCyan, + ansi.bgWhite +] + +for (var key in styles) { + check(key, styles[key]) +} + +function check(key:string, escapeCodes:ansi.EscapeCodePair): void { + if (uninitialized(escapeCodes.open)) { + throw new Error('key not found ~> ' + key + '.open') + } + if (uninitialized(escapeCodes.close)) { + throw new Error('key not found ~> ' + key + '.close') + } +} + +function uninitialized(val:any): boolean { + return val === null || val === undefined +} + + diff --git a/ansi-styles/ansi-styles.d.ts b/ansi-styles/ansi-styles.d.ts new file mode 100644 index 000000000..4c79b118f --- /dev/null +++ b/ansi-styles/ansi-styles.d.ts @@ -0,0 +1,42 @@ +// Type definitions for ansi-styles 2.0.1 +// Project: https://github.com/sindresorhus/ansi-styles +// Definitions by: bryn austin bellomy +// Definitions: https://github.com/borisyankov/DefinitelyTyped + + +declare module "ansi-styles" +{ + export interface EscapeCodePair { + open: string; + close: string; + } + + export var reset: EscapeCodePair; + + export var bold: EscapeCodePair; + export var dim: EscapeCodePair; + export var italic: EscapeCodePair; + export var underline: EscapeCodePair; + export var inverse: EscapeCodePair; + export var hidden: EscapeCodePair; + export var strikethrough: EscapeCodePair; + + export var black: EscapeCodePair; + export var red: EscapeCodePair; + export var green: EscapeCodePair; + export var yellow: EscapeCodePair; + export var blue: EscapeCodePair; + export var magenta: EscapeCodePair; + export var cyan: EscapeCodePair; + export var white: EscapeCodePair; + export var gray: EscapeCodePair; + + export var bgBlack: EscapeCodePair; + export var bgRed: EscapeCodePair; + export var bgGreen: EscapeCodePair; + export var bgYellow: EscapeCodePair; + export var bgBlue: EscapeCodePair; + export var bgMagenta: EscapeCodePair; + export var bgCyan: EscapeCodePair; + export var bgWhite: EscapeCodePair; +} \ No newline at end of file diff --git a/applicationinsights/applicationinsights-tests.ts b/applicationinsights/applicationinsights-tests.ts new file mode 100644 index 000000000..871a029e8 --- /dev/null +++ b/applicationinsights/applicationinsights-tests.ts @@ -0,0 +1,25 @@ +/// +import appInsights = require("applicationinsights"); + +// basic use +appInsights.setup("").start(); + +// basic use with auto-collection configuration +appInsights.setup("") + .setAutoCollectRequests(false) + .setAutoCollectPerformance(false) + .setAutoCollectExceptions(false) + // no telemetry will be sent until .start() is called + // this prevents any of the auto-collectors from initializing + .enableVerboseLogging() + .start(); + +appInsights.client.trackEvent("custom event", {customProperty: "custom property value"}); +appInsights.client.trackException(new Error("handled exceptions can be logged with this method")); +appInsights.client.trackMetric("custom metric", 3); +appInsights.client.trackTrace("trace message"); + +// assign common properties to all telemetry +appInsights.client.commonProperties = { + environment: "dev" +}; diff --git a/applicationinsights/applicationinsights.d.ts b/applicationinsights/applicationinsights.d.ts new file mode 100644 index 000000000..6b80adc2a --- /dev/null +++ b/applicationinsights/applicationinsights.d.ts @@ -0,0 +1,429 @@ +// Type definitions for Application Insights v0.15.1 +// Project: https://github.com/Microsoft/ApplicationInsights-node.js +// Definitions by: Scott Southwood +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +interface AutoCollectConsole { + enable(isEnabled: boolean): void; + isInitialized(): boolean; +} + +interface AutoCollectExceptions { + isInitialized(): boolean; + enable(isEnabled:boolean): void; +} + +interface AutoCollectPerformance { + enable(isEnabled: boolean): void; + isInitialized(): boolean; +} + +interface AutoCollectRequests { + enable(isEnabled: boolean): void; + isInitialized(): boolean; +} + + +declare module ContractsModule { + enum DataPointType { + Measurement = 0, + Aggregation = 1, + } + enum DependencyKind { + SQL = 0, + Http = 1, + Other = 2, + } + enum DependencySourceType { + Undefined = 0, + Aic = 1, + Apmc = 2, + } + enum SessionState { + Start = 0, + End = 1, + } + enum SeverityLevel { + Verbose = 0, + Information = 1, + Warning = 2, + Error = 3, + Critical = 4, + } + interface ContextTagKeys { + applicationVersion: string; + applicationBuild: string; + deviceId: string; + deviceIp: string; + deviceLanguage: string; + deviceLocale: string; + deviceModel: string; + deviceNetwork: string; + deviceOEMName: string; + deviceOS: string; + deviceOSVersion: string; + deviceRoleInstance: string; + deviceRoleName: string; + deviceScreenResolution: string; + deviceType: string; + deviceMachineName: string; + locationIp: string; + operationId: string; + operationName: string; + operationParentId: string; + operationRootId: string; + operationSyntheticSource: string; + operationIsSynthetic: string; + sessionId: string; + sessionIsFirst: string; + sessionIsNew: string; + userAccountAcquisitionDate: string; + userAccountId: string; + userAgent: string; + userId: string; + userStoreRegion: string; + sampleRate: string; + internalSdkVersion: string; + internalAgentVersion: string; + } + interface Domain { + ver: number; + properties: any; + } + interface Data { + baseType: string; + baseData: TDomain; + } + interface Envelope { + ver: number; + name: string; + time: string; + sampleRate: number; + seq: string; + iKey: string; + flags: number; + deviceId: string; + os: string; + osVer: string; + appId: string; + appVer: string; + userId: string; + tags: { + [key: string]: string; + }; + data: Data; + } + interface EventData extends ContractsModule.Domain { + ver: number; + name: string; + properties: any; + measurements: any; + } + interface MessageData extends ContractsModule.Domain { + ver: number; + message: string; + severityLevel: ContractsModule.SeverityLevel; + properties: any; + } + interface ExceptionData extends ContractsModule.Domain { + ver: number; + handledAt: string; + exceptions: ExceptionDetails[]; + severityLevel: ContractsModule.SeverityLevel; + problemId: string; + crashThreadId: number; + properties: any; + measurements: any; + } + interface StackFrame { + level: number; + method: string; + assembly: string; + fileName: string; + line: number; + } + interface ExceptionDetails { + id: number; + outerId: number; + typeName: string; + message: string; + hasFullStack: boolean; + stack: string; + parsedStack: StackFrame[]; + } + interface DataPoint { + name: string; + kind: ContractsModule.DataPointType; + value: number; + count: number; + min: number; + max: number; + stdDev: number; + } + interface MetricData extends ContractsModule.Domain { + ver: number; + metrics: DataPoint[]; + properties: any; + } + interface PageViewData extends ContractsModule.EventData { + ver: number; + url: string; + name: string; + duration: string; + properties: any; + measurements: any; + } + interface PageViewPerfData extends ContractsModule.PageViewData { + ver: number; + url: string; + perfTotal: string; + name: string; + duration: string; + networkConnect: string; + sentRequest: string; + receivedResponse: string; + domProcessing: string; + properties: any; + measurements: any; + } + interface RemoteDependencyData extends ContractsModule.Domain { + ver: number; + name: string; + kind: ContractsModule.DataPointType; + value: number; + count: number; + min: number; + max: number; + stdDev: number; + dependencyKind: ContractsModule.DependencyKind; + success: boolean; + async: boolean; + dependencySource: ContractsModule.DependencySourceType; + commandName: string; + dependencyTypeName: string; + properties: any; + } + interface AjaxCallData extends ContractsModule.PageViewData { + ver: number; + url: string; + ajaxUrl: string; + name: string; + duration: string; + requestSize: number; + responseSize: number; + timeToFirstByte: string; + timeToLastByte: string; + callbackDuration: string; + responseCode: string; + success: boolean; + properties: any; + measurements: any; + } + interface RequestData extends ContractsModule.Domain { + ver: number; + id: string; + name: string; + startTime: string; + duration: string; + responseCode: string; + success: boolean; + httpMethod: string; + url: string; + properties: any; + measurements: any; + } + interface SessionStateData extends ContractsModule.Domain { + ver: number; + state: ContractsModule.SessionState; + } + interface PerformanceCounterData extends ContractsModule.Domain { + ver: number; + categoryName: string; + counterName: string; + instanceName: string; + kind: DataPointType; + count: number; + min: number; + max: number; + stdDev: number; + value: number; + properties: any; + } +} + + +interface Channel { + constructor(isDisabled: () => boolean, getBatchSize: () => number, getBatchIntervalMs: () => number, sender: Sender): Channel; + /** + * Add a telemetry item to the send buffer + */ + send(envelope: ContractsModule.Envelope): void; + handleCrash(envelope: ContractsModule.Envelope): void; + /** + * Immediately send buffered data + */ + triggerSend(isNodeCrashing?: boolean): void; +} + +interface Client { + config: Config; + context: Context; + commonProperties: { + [key: string]: string; + }; + channel: Channel; + /** + * Constructs a new client of the client + * @param iKey the instrumentation key to use (read from environment variable if not specified) + */ + constructor(iKey?: string): Client; + /** + * Log a user action or other occurrence. + * @param name A string to identify this event in the portal. + * @param properties map[string, string] - additional data used to filter events and metrics in the portal. Defaults to empty. + * @param measurements map[string, number] - metrics associated with this event, displayed in Metrics Explorer on the portal. Defaults to empty. + */ + trackEvent(name: string, properties?: { + [key: string]: string; + }, measurements?: { + [key: string]: number; + }): void; + /** + * Log a trace message + * @param message A string to identify this event in the portal. + * @param properties map[string, string] - additional data used to filter events and metrics in the portal. Defaults to empty. + */ + trackTrace(message: string, severityLevel?: ContractsModule.SeverityLevel, properties?: { + [key: string]: string; + }): void; + /** + * Log an exception you have caught. + * @param exception An Error from a catch clause, or the string error message. + * @param properties map[string, string] - additional data used to filter events and metrics in the portal. Defaults to empty. + * @param measurements map[string, number] - metrics associated with this event, displayed in Metrics Explorer on the portal. Defaults to empty. + */ + trackException(exception: Error, properties?: { + [key: string]: string; + }): void; + /** + * Log a numeric value that is not associated with a specific event. Typically used to send regular reports of performance indicators. + * To send a single measurement, use just the first two parameters. If you take measurements very frequently, you can reduce the + * telemetry bandwidth by aggregating multiple measurements and sending the resulting average at intervals. + * @param name A string that identifies the metric. + * @param value The value of the metric + */ + trackMetric(name: string, value: number): void; + trackRequest(request: any /* http.ServerRequest */, response: any /* http.ServerResponse */, properties?: { + [key: string]: string; + }): void; + /** + * Immediately send all queued telemetry. + */ + sendPendingData(): void; + getEnvelope(data: ContractsModule.Data, tagOverrides?: { + [key: string]: string; + }): ContractsModule.Envelope; + /** + * Generic track method for all telemetry types + * @param data the telemetry to send + * @param tagOverrides the context tags to use for this telemetry which overwrite default context values + */ + track(data: ContractsModule.Data, tagOverrides?: { + [key: string]: string; + }): void; +} + +interface Config { + instrumentationKey: string; + sessionRenewalMs: number; + sessionExpirationMs: number; + endpointUrl: string; + maxBatchSize: number; + maxBatchIntervalMs: number; + disableAppInsights: boolean; + constructor(instrumentationKey?: string): Config; +} + +interface Context { + keys: ContractsModule.ContextTagKeys; + tags: { + [key: string]: string; + }; + constructor(packageJsonPath?: string): Context; +} + +interface Sender { + constructor(getUrl: () => string, onSuccess?: (response: string) => void, onError?: (error: Error) => void): Sender; + send(payload: any/* Buffer */): void; + saveOnCrash(payload: string): void; + /** + * enable caching events locally on error + */ + enableCacheOnError(): void; + /** + * disable caching events locally on error + */ + disableCacheOnError(): void; +} + +/** + * The singleton meta interface for the default client of the client. This interface is used to setup/start and configure + * the auto-collection behavior of the application insights module. + */ +declare class ApplicationInsights { + static client: Client; + private static _isConsole; + private static _isExceptions; + private static _isPerformance; + private static _isRequests; + private static _console; + private static _exceptions; + private static _performance; + private static _requests; + private static _isStarted; + /** + * Initializes the default client of the client and sets the default configuration + * @param instrumentationKey the instrumentation key to use. Optional, if this is not specified, the value will be + * read from the environment variable APPINSIGHTS_INSTRUMENTATION_KEY + * @returns {ApplicationInsights} this interface + */ + static setup(instrumentationKey?: string): typeof ApplicationInsights; + /** + * Starts automatic collection of telemetry. Prior to calling start no telemetry will be collected + * @returns {ApplicationInsights} this interface + */ + static start(): typeof ApplicationInsights; + /** + * Sets the state of console tracking (enabled by default) + * @param value if true console activity will be sent to Application Insights + * @returns {ApplicationInsights} this interface + */ + static setAutoCollectConsole(value: boolean): typeof ApplicationInsights; + /** + * Sets the state of exception tracking (enabled by default) + * @param value if true uncaught exceptions will be sent to Application Insights + * @returns {ApplicationInsights} this interface + */ + static setAutoCollectExceptions(value: boolean): typeof ApplicationInsights; + /** + * Sets the state of performance tracking (enabled by default) + * @param value if true performance counters will be collected every second and sent to Application Insights + * @returns {ApplicationInsights} this interface + */ + static setAutoCollectPerformance(value: boolean): typeof ApplicationInsights; + /** + * Sets the state of request tracking (enabled by default) + * @param value if true requests will be sent to Application Insights + * @returns {ApplicationInsights} this interface + */ + static setAutoCollectRequests(value: boolean): typeof ApplicationInsights; + /** + * Enables verbose debug logging + * @returns {ApplicationInsights} this interface + */ + static enableVerboseLogging(): typeof ApplicationInsights; +} + +declare module "applicationinsights" { + export = ApplicationInsights; +} \ No newline at end of file diff --git a/async/async-tests.ts b/async/async-tests.ts index a6b041b4d..4fddea875 100644 --- a/async/async-tests.ts +++ b/async/async-tests.ts @@ -106,6 +106,17 @@ async.series({ }, function (err, results) { }); +async.times(5, function(n, next) { + next(null, n) +}, function(err, results) { + console.log(results) +}) + +async.timesSeries(5, function(n, next) { + next(null, n) +}, function(err, results) { + console.log(results) +}) async.parallel([ function (callback) { diff --git a/async/async.d.ts b/async/async.d.ts index bb8890ef7..475191aaf 100644 --- a/async/async.d.ts +++ b/async/async.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Async 0.1.23 +// Type definitions for Async 0.9.2 // Project: https://github.com/caolan/async // Definitions by: Boris Yankov // Definitions: https://github.com/borisyankov/DefinitelyTyped @@ -9,7 +9,6 @@ interface ErrorCallback { (err?: Error): void; } interface AsyncResultCallback { (err: Error, result: T): void; } interface AsyncResultArrayCallback { (err: Error, results: T[]): void; } interface AsyncResultObjectCallback { (err: Error, results: Dictionary): void; } -interface AsyncTimesCallback { (n: number, callback: AsyncResultArrayCallback): void; } interface AsyncIterator { (item: T, callback: ErrorCallback): void; } interface AsyncResultIterator { (item: T, callback: AsyncResultCallback): void; } @@ -105,8 +104,8 @@ interface Async { apply(fn: Function, ...arguments: any[]): AsyncFunction; nextTick(callback: Function): void; - times (n: number, callback: AsyncTimesCallback): void; - timesSeries (n: number, callback: AsyncTimesCallback): void; + times (n: number, iterator: AsyncResultIterator, callback: AsyncResultArrayCallback): void; + timesSeries (n: number, iterator: AsyncResultIterator, callback: AsyncResultArrayCallback): void; // Utils memoize(fn: Function, hasher?: Function): Function; diff --git a/atom/api-docs.d.ts b/atom/api-docs.d.ts new file mode 100644 index 000000000..a4fc19eea --- /dev/null +++ b/atom/api-docs.d.ts @@ -0,0 +1,107 @@ +// Type definitions for Atom API docs +// Project: https://github.com/atom/atom/blob/master/build/tasks/docs-task.coffee +// Definitions by: vvakame +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/* + How to generate. + $ git clone git@github.com:atom/atom.git + $ cd atom + $ npm install + $ cd build + $ npm install + $ grunt build-docs + $ cd ../ + $ ls -la la docs/output/api.json + api.json example https://gist.github.com/vvakame/10f8d2f3884affc32476 + */ + +declare module AtomDocTypes { + interface Metadata { + classes: { [className: string]: ClassInfo; }; + } + + interface ClassInfo { + name: string; + superClass: string; + visibility: string; + + filename: string; + srcUrl: string; + summary: string; + description: string; + examples: Example[]; + sections: Section[]; + + classMethods: ClassMethod[]; + classProperties: ClassProperty[]; + instanceMethods: InstanceMethod[]; + instanceProperties: InstanceProperty[]; + } + + interface Example { + description: string; + lang: string; + code: string; + raw: string; + } + + interface Section { + name: string; + description: string; + } + + interface ClassMethod { + name: string; + sectionName: string; + srcUrl: string; + visibility: string; + summary: string; + description: string; + arguments: Argument[]; + returnValues: ReturnValue[]; + } + + interface ClassProperty { + } + + interface InstanceMethod { + name: string; + sectionName: string; + srcUrl: string; + visibility: string; + summary: string; + description: string; + arguments: Argument[]; + returnValues: ReturnValue[]; + titledArguments: TitledArgument[]; + } + + interface InstanceProperty { + name: string; + sectionName: string; + srcUrl: string; + visibility: string; + summary: string; + description: string; + } + + interface Argument { + name: string; + description: string; + type: string; + isOptional: boolean; + children: Argument[]; + } + + interface TitledArgument { + title: string; + description: string; + arguments: Argument[]; + } + + interface ReturnValue { + type: string; + description: string; + } +} diff --git a/atom/atom.d.ts b/atom/atom.d.ts index 96b7c849d..0abeda316 100644 --- a/atom/atom.d.ts +++ b/atom/atom.d.ts @@ -1145,6 +1145,18 @@ declare module AtomCore { new(state:IAtomState):IAtom; } + class Disposable { + constructor(disposalAction:any) + dispose():void + } + + class CommandRegistry { + add(target:string, commandName:string, callback:Function):Disposable + findCommands(params:Object):Object[] + dispatch(target:any,commandName:string):void + } + + // https://atom.io/docs/api/v0.106.0/api/classes/Atom.html /* Global Atom class : instance members */ interface IAtom { @@ -1175,6 +1187,8 @@ declare module AtomCore { workspace: IWorkspace; // really exists? end + commands: CommandRegistry; + initialize:Function; // registerRepresentationClass:Function; // registerRepresentationClasses:Function; @@ -1754,6 +1768,8 @@ declare module "atom" { cancel():any; } + + var WorkspaceView:AtomCore.IWorkspaceViewStatic; var Task:AtomCore.ITaskStatic; diff --git a/autoprefixer-core/autoprefixer-core-tests.ts b/autoprefixer-core/autoprefixer-core-tests.ts new file mode 100644 index 000000000..9ff4e7695 --- /dev/null +++ b/autoprefixer-core/autoprefixer-core-tests.ts @@ -0,0 +1,9 @@ +/// +import autoprefixer = require("autoprefixer-core"); + +var css: string; + +var prefixed = autoprefixer.process(css).css; + +var processor = autoprefixer({ browsers: ['> 1%', 'IE 7'], cascade: false }); +console.log(processor.info()); diff --git a/autoprefixer-core/autoprefixer-core.d.ts b/autoprefixer-core/autoprefixer-core.d.ts new file mode 100644 index 000000000..905447acf --- /dev/null +++ b/autoprefixer-core/autoprefixer-core.d.ts @@ -0,0 +1,44 @@ +// Type definitions for Autoprefixer Core 5.1.11 +// Project: https://github.com/postcss/autoprefixer-core +// Definitions by: Asana +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module "autoprefixer-core" { + interface Config { + browsers?: string[]; + cascade?: boolean; + remove?: boolean; + } + + interface Options { + from?: string; + to?: string; + safe?: boolean; + map?: { + inline?: boolean; + prev?: string | Object; + } + } + + interface Result { + css: string; + map: string; + opts: Options; + } + + interface Processor { + postcss: any; + info(): string; + process(css: string, opts?: Options): Result; + } + + interface Exports { + (config: Config): Processor; + postcss: any; + info(): string; + process(css: string, opts?: Options): Result; + } + + var exports: Exports; + export = exports; +} diff --git a/backbone/backbone.d.ts b/backbone/backbone.d.ts index 7de8eb807..9d54361d5 100644 --- a/backbone/backbone.d.ts +++ b/backbone/backbone.d.ts @@ -169,9 +169,7 @@ declare module Backbone { **/ private static extend(properties: any, classProperties?: any): any; - // TODO: this really has to be typeof TModel - //model: typeof TModel; - model: { new(): TModel; }; // workaround + model: new (...args:any[]) => TModel; models: TModel[]; length: number; diff --git a/backgrid/backgrid.d.ts b/backgrid/backgrid.d.ts index fcae05d80..3a75e6142 100644 --- a/backgrid/backgrid.d.ts +++ b/backgrid/backgrid.d.ts @@ -8,12 +8,12 @@ declare module Backgrid { interface GridOptions { - columns: Column[]; - collection: Backbone.Collection; - header: Header; - body: Body; - row: Row; - footer: Footer; + columns: Column[]; + collection: Backbone.Collection; + header: Header; + body: Body; + row: Row; + footer: Footer; } class Header extends Backbone.View { @@ -21,65 +21,106 @@ declare module Backgrid { class Footer extends Backbone.View { } - + class Row extends Backbone.View { } class Command { - cancel(); - moveDown(); - moveLeft(); - moveRight(); - moveUp(); - passThru(); - save(); + moveUp(): boolean; + moveDown(): boolean; + moveLeft(): boolean; + moveRight(): boolean; + save(): boolean; + cancel(): boolean; + passThru(): boolean; + } + + class CellFormatter { + fromRaw(rawData: any, model: Backbone.Model); + toRaw(formattedData: any, model: Backbone.Model); + } + + class NumberFormatter extends CellFormatter {} + + class PercentFormatter extends NumberFormatter {} + + class DateTimeFormatter extends CellFormatter {} + + class StringFormatter extends CellFormatter {} + + class EmailFormatter extends CellFormatter {} + + class SelectFormatter extends CellFormatter {} + + class CellEditor extends Backbone.View{ + initialize(options?: any); + postRender(model: Backbone.Model, column: Backbone.Model); + } + + class InputCellEditor extends CellEditor { + render(); + saveOrCancel(event: any); + } + + class Cell extends Backbone.View{ + tagName: string; + formatter: CellFormatter; + editor: InputCellEditor; + enterEditMode(); + renderError(); + exitEditMode(); + remove(); + } + + class StringCell extends Cell { } interface ColumnAttr { - name: string; - cell: string; - headerCell: string; - label: string; - sortable: boolean; - editable: boolean; - renderable: boolean; - formater: string; + name: string; + cell: string; + headerCell: string; + label: string; + sortable: boolean; + editable: boolean; + renderable: boolean; + formater: string; } class Column extends Backbone.Model { - initialize(options?: any); + initialize(options?: any); } class Body extends Backbone.View { - tagName: string; + tagName: string; - initialize(options?: any); - insertRow(model: Backbone.Model, collection: Backbone.Collection, options: any); - moveToNextCell(model: Backbone.Model, cell: Column, command: Command); - refresh(): Body; - remove(): Body; - removeRow(model: Backbone.Model, collection: Backbone.Collection, options: any); - render(): Body; + initialize(options?: any); + insertRow(model: Backbone.Model, collection: Backbone.Collection, options: any); + moveToNextCell(model: Backbone.Model, cell: Column, command: Command); + refresh(): Body; + remove(): Body; + removeRow(model: Backbone.Model, collection: Backbone.Collection, options: any); + render(): Body; } class Grid extends Backbone.View { - body: Backgrid.Body; - className: string; - footer: any; - header: any; - tagName: string; + body: Backgrid.Body; + className: string; + footer: any; + header: any; + tagName: string; - initialize(options: any); - getSelectedModels(): Backbone.Model[]; - insertColumn(...options: any[]): Grid; - insertRow(model: Backbone.Model, collection: Backbone.Collection, options: any); - remove():Grid; - removeColumn(...options: any[]): Grid; - removeRow(model: Backbone.Model, collection: Backbone.Collection, options: any); - render():Grid; + initialize(options: any); + getSelectedModels(): Backbone.Model[]; + insertColumn(...options: any[]): Grid; + insertRow(model: Backbone.Model, collection: Backbone.Collection, options: any); + remove(): Grid; + removeColumn(...options: any[]): Grid; + removeRow(model: Backbone.Model, collection: Backbone.Collection, options: any); + render(): Grid; } - - } +declare module "backgrid" { + export = Backgrid; +} diff --git a/blocks/blocks-tests.ts b/blocks/blocks-tests.ts new file mode 100644 index 000000000..7b83b52a6 --- /dev/null +++ b/blocks/blocks-tests.ts @@ -0,0 +1,322 @@ +/// + +function test_blocks_methods() { + var extended: Object; + blocks.extend(extended, new Object()); + + blocks.each([3, 1, 4], function(value, index, collection) { + // value is the current item (3, 1 and 4) + // index is the current index (0, 1 and 2) + // collection points to the array passed to the function - [3, 1, 4] + }); + + blocks.eachRight([3, 1, 4], function(value, index, collection) { + // value is the current item (4, 1 and 3) + // index is the current index (2, 1 and 0) + // collection points to the array passed to the function - [3, 1, 4] + }); + + blocks.isArray([1, 2, 3]); + // -> true + + function calculate() { + blocks.isArray(arguments); + // -> false + } + + function max(collection: any, callback: any) { + callback = callback || blocks.noop; + } + + blocks.type('a string'); + // -> string + + blocks.type(314); + // -> number + + blocks.type([]); + // -> array + + blocks.type({}); + // -> object + + blocks.type(blocks.noop); + // -> function + + blocks.type(new RegExp('')); + // -> regexp + + blocks.type(undefined); + // -> undefined + + blocks.type(null); + // -> null + + blocks.is([], 'array'); + // -> true + + blocks.is(function() { }, 'object'); + // -> false + + blocks.has({ + price: undefined + }, 'price'); + // -> true + + blocks.has({ + price: 314 + }, 'ratio'); + // -> false + + blocks.unwrap(blocks.observable(314)); + // -> 314 + + blocks.unwrap(blocks([3, 1, 4])); + // -> [3, 1, 4] + + blocks.unwrap('a string or any other value will not be changed'); + // -> 'a string or any other value will not be changed' + + blocks.toArray(3); + // -> [3] + + blocks.toArray([3, 1, 4]); + // -> [3, 1, 4] + + blocks.toUnit(230); + // -> 230px + + blocks.toUnit(230, '%'); + // -> 230% + + blocks.toUnit('60px', '%'); + // -> 60% + + var array = [3, 1, 4]; + var cloned = blocks.clone(array); + // -> [3, 1, 4] + var areEqual = array == cloned; + // -> false + + blocks.isElement(document.body); + // -> true + + blocks.isElement({}); + // -> false + + blocks.isBoolean(true); + // -> true + + blocks.isBoolean(new Boolean(false)); + // -> true + + blocks.isBoolean(1); + // -> false + + blocks.isPlainObject({ property: true }); + // -> true + + blocks.isPlainObject(new Object()); + // -> true + + var car = new Object(); + + blocks.isPlainObject(car); + // -> false + + var alert = blocks.bind(() => { + alert(this); + }, 'Hello bind method!'); + + alert(); + // -> alerts 'Hello bind method' + + var alertAll = blocks.bind((firstName: string, lastName: string) => { + alert('My name is ' + firstName + ' ' + lastName); + }, null, 'John', 'Doe'); + + alertAll(); + // -> alerts 'My name is John Doe' + + blocks.equals([3, 4], [3, 4]); + // -> true + + blocks.equals({ value: 7 }, { value: 7, result: 1 }); + // -> false + + blocks.query({ + message: 'Hello World!' + }); + + blocks.query({ + items: ['John', 'Alf', 'Mega'], + alertIndex: (e: any) => { + alert('Clicked an item with index:' + blocks.context(e.target).$index); + } + }); + + blocks.query({ + items: [1, 2, 3], + alertValue: (e: any) => { + alert('Clicked the value: ' + blocks.dataItem(e.target)); + } + }); + + blocks.isObservable(blocks.observable(3)); + // -> true + + blocks.isObservable(3); + // -> false + + blocks.unwrapObservable(blocks.observable(304)); + // -> 304 + + blocks.unwrapObservable(305); + // -> 305 +} + +function test_observable_array() { + // creates an observable array with [1, 2, 3] as values + var items = blocks.observable([1, 2, 3]); + + // removes the previous values and fills the observable array with [5, 6, 7] values + items.reset([5, 6, 7]) + + // results in observable array with [1, 2, 3, 4] values + items.add(4); + + // results in observable array with [1, 2, 3, 4, 5, 6] values + items.addMany([4, 5, 6]); + + var items = blocks.observable([4, 2, 3, 1]); + + // results in observable array with [1, 2, 3, 4] values + items.swap(0, 3); + + var items = blocks.observable([1, 4, 2, 3, 5]); + + // results in observable array with [1, 2, 3, 4, 5] values + items.move(1, 4); +} + +function test_Property() { + var App = blocks.Application(); + + var User = App.Model({ + username: App.Property({ + defaultValue: 'John Doe' + }) + }); +} + +function test_Model() { + var App = blocks.Application(); + + var User = App.Model({ + firstName: App.Property({ + required: true, + validateOnChange: true + }), + + lastName: App.Property({ + required: true, + validateOnChange: true + }), + + fullName: App.Property({ + value: function() { + return this.firstName() + ' ' + this.lastName(); + } + }) + }); + + App.View('Profile', { + user: User({ + firstName: 'John', + lastName: 'Doe' + }) + }); +} + +function test_Collection() { + var App = blocks.Application(); + + var User = App.Model({ + firstName: App.Property({ + required: true, + validateOnChange: true + }), + + lastName: App.Property({ + required: true, + validateOnChange: true + }), + + fullName: App.Property({ + value: function() { + return this.firstName() + ' ' + this.lastName(); + } + }) + }); + + var Users = App.Collection(User, { + count: App.Property({ + value: () => { + return this().length; + } + }) + }); + + App.View('Profiles', { + users: Users([{ + firstName: 'John', + lastName: 'Doe' + }, { + firstName: 'Johna', + lastName: 'Doa' + }]) + }); +} + +function test_View() { + var App = blocks.Application(); + + App.View('Clicker', { + handleClick: () => { + alert('Clicky! Click!'); + } + }); + + + App.View('Statistics', { + init: () => { + this.loadRemoteData(); + }, + + loadRemoteData: () => { + // ...stuff... + } + }); + + App.View('ContactUs', { + options: { + route: 'contactus' + }, + + routed: () => { + alert('Navigated to ContactUs page!') + } + }); + + App.View('ContactUs', { + options: { + route: 'contactus' + } + }); + + App.View('Navigation', { + navigateToContactUs: () => { + this.route('contactus') + } + }); +} \ No newline at end of file diff --git a/blocks/blocks.d.ts b/blocks/blocks.d.ts new file mode 100644 index 000000000..ad492333e --- /dev/null +++ b/blocks/blocks.d.ts @@ -0,0 +1,731 @@ +// Type definitions for jsblocks v0.3.0 +// Project: http://jsblocks.com/ +// Definitions by: Krzysztof Śmigiel +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +///////////////////////////////////////// +// blocks methods +///////////////////////////////////////// + +interface BlocksStatic { + (obj: any): any; + + /** + * Performs a query operation on the DOM. Executes all data-query attributes + * and renders the html result to the specified HTMLElement if not specified + * uses document.body by default. + * + * @param model The model that will be used to query the DOM. + */ + query(model: any): void; + /** + * @param model The model that will be used to query the DOM. + * @param element Optional element on which to execute the query. + */ + query(model: any, element: HTMLElement): void; + + /** + * Copies properties from all provided objects into the first object parameter + */ + extend(obj: Object, ...objects: any[]): void; + + /** + * Iterates over the collection + * + * @param collection The array or object to iterate over + * @param callback The callback that will be executed for each element in the collection + * @param thisArg Optional this context for the callback + */ + each(collection: any, callback: (value: any, index: any, collection: any) => void, thisArg?: any): void; + + /** + * Iterates over the collection from end to start + * + * @param collection The array or object to iterate over + * @param callback The callback that will be executed for each element in the collection + * @param thisArg Optional this context for the callback + */ + eachRight(collection: any, callback: (value: any, index: any, collection: any) => void, thisArg?: any): void; + + /** + * Determines if a value is an array. + * Returns false for array like objects (for example arguments object). + * + * @param value The value to check if it is an array + */ + isArray(value: any): boolean; + + /** + * Represents a dummy empty function + */ + noop(): Function; + + /** + * Determines the true type of an object. + * Returns the type of the value as a string. + * + * @param value The value for which to determine its type + */ + type(value: any): string; + + /** + * Determines if a specific value is the specified type + * + * @param value The value + * @param type The type + */ + is(value: any, type: string): boolean; + + /** + * Checks if a variable has the specified property. Uses hasOwnProperty internally + * + * @param obj The object to call hasOwnPrototype for + * @param key The key to check if exists in the object + */ + has(obj: any, key: string): boolean; + + /** + * Unwraps a jsblocks value to its raw representation. + * Unwraps blocks.observable() and blocks() values + * + * @param value The value that will be unwrapped + */ + unwrap(value: any): any; + + /** + * Converts a value to an array. Arguments object is converted to array and primitive values + * are wrapped in an array. + * Does nothing when value is already an array + * + * @param value The value to be converted to an array + */ + toArray(value: any): any[]; + + /** + * Converts an integer or string to a unit. If the value could not be parsed to a number it is not converted + * + * @param value The value to be converted to the specified unit + */ + toUnit(value: any): any; + /** + * @param value The value to be converted to the specified unit + * @param unit Optionally provide a unit to convert to. Default value is 'px' + */ + toUnit(value: any, unit: string): any; + + /** + * Clones value. If deepClone is set to true the value will be cloned recursively + * + * @param value Value/object to be cloned + */ + clone(value: any): any; + /** + * @param value Value/object to be cloned + * @param deepClone By default false + */ + clone(value: any, deepClone: boolean): any; + + /** + * Determines if the specified value is a HTML elements collection. + * Returns whether the value is elements collection. + * + * @param value The value to check if it is elements collection + */ + isElements(value: any): boolean; + + /** + * Determines if the specified value is a HTML element. + * Returns whether the value is a HTML element. + * + * @param value The value to check if it is a HTML element + */ + isElement(value: any): boolean; + + /** + * Determines if a the specified value is a boolean. + * Whether the value is a boolean or not. + * + * @param value The value to be checked if it is a boolean + */ + isBoolean(value: any): boolean; + + /** + * Determines if the specified value is an object. + * Returns whether the value is an object. + * + * @param obj The value to check for if it is an object + */ + isObject(obj: any): boolean; + + /** + * Determines if a value is a object created using {} or new Object. + * Whether the value is a plain object or not. + * + * @param obj The value that will be checked + */ + isPlainObject(obj: any): boolean; + + /** + * Changes the this binding to a function and optionally passes additional parameters to the function. + * Returns the newly created function having the new this binding and optional arguments. + * + * @param func The function for which to change the this binding and optionally add arguments + * @param thisArg The new this binding context value + * @param args Optional arguments that will be passed to the function + */ + bind(func: Function, thisArg: any, ...args: any[]): Function; + + /** + * Determines if two values are deeply equal. Set deepEqual to false to stop recusively equality checking + * + * @param a The first object to be campared + * @param b The second object to be compared + */ + equals(a: any, b: any): boolean; + /** + * @param a The first object to be campared + * @param b The second object to be compared + * @param deepEqual Determines if the equality check will recursively check all child properties + */ + equals(a: any, b: any, deepEqual: boolean): boolean; + + /** + * Gets the context for a particular element. Searches all parents until it finds the context. + * + * @param element The element from which to search for a context + * + */ + context(element: any): any; + + /** + * Gets the associated dataItem for a particlar element. Searches all parents until it finds the context + * + * @param element The element from which to search for a dataItem + */ + dataItem(element: any): any; + + /** + * Determines if particular value is an blocks.observable + * + * @param value The value to check if the value is observable + */ + isObservable(value: any): boolean; + + /** + * Gets the raw value of an observable or returns the value if the specified object is not an observable + * + * @param value The value that could be any object observable or not + */ + unwrapObservable(value: any): any; + + route(route: string): BlocksStatic; + + optional(param: string): BlocksStatic; + optional(param: string, defaultValue: any): BlocksStatic; + + range(start: number, end: number): BlocksStatic; + + /** + * Creates the server which will automatically handle server-side rendering. + */ + server(): { express(): any }; + /** + * @param options Overrides default jsblocks options + */ + server(options: Server): { express(): any }; + + /** + * Make observable property. You can specify initial value in parentheses. + */ + observable(): BlocksObservable; + observable(value: any[]): BlocksArray; + observable(value: any): BlocksObservable; + + /** + * Use blocks.Application and its MVC(Model-View-Collection) structure to create better architecture and maintainability for your application. + */ + Application(): App; + Application(options: { history: string }): App; +} + +///////////////////////////////////////// +// blocks observable +///////////////////////////////////////// + +interface BlocksObservable extends Extendable { + (arg: any): BlocksObservable; + + /** + * Updates all elements, expressions and dependencies where the observable is used + */ + update(): BlocksObservable; + + /** + * If event in prototype is not defined use this function instead. + * + * @param event Name of the event to raise + * @param trigger Function to be called when event is fired + */ + on(event: string, trigger: Function): BlocksObservable; +} + +///////////////////////////////////////// +// blocks array +///////////////////////////////////////// + +interface BlocksArray extends BlocksObservable { + + /** + * Updates all elements, expressions and dependencies where the observable is used + */ + update(): BlocksArray; + + /** + * Extends the current observable with particular functionality depending on the parameters specified. + * If the method is called without arguments and jsvalue framework is included the observable will be + * extended with the methods available in jsvalue for the current type. + * + * @param options Optional options + */ + extend(...options: any[]): BlocksArray; + /** + * @param name Name of the extender + * @param options Optional options + */ + extend(name: string, ...options: any[]): BlocksArray; + + /** + * Removes all items from the collection and replaces them with the new value provided. + * The value could be Array, observable array or jsvalue.Array + * + * @param value The new value that will be populated + */ + reset(value: any[]): BlocksArray; + + /** + * Adds values to the end of the observable array + * + * @param value The values that will be added to the end of the array + */ + add(value: any): BlocksArray; + /** + * @param value The values that will be added to the end of the array + * @param index Optional index specifying where to insert the value + */ + add(value: any, index: number): BlocksArray; + + /** + * Adds the values from the provided array(s) to the end of the collection + * + * @param value The array that will be added to the end of the array + */ + addMany(value: any[]): BlocksArray; + /** + * @param value The array that will be added to the end of the array + * @param index Optional position where the array of values to be inserted + */ + addMany(value: any[], index: number): BlocksArray; + + /** + * Swaps two values in the observable array. Note: Faster than removing the items and adding them at the locations + * + * @param indexA The first index that points to the index in the array that will be swapped + * @param indexB The second index that points to the index in the array that will be swapped + */ + swap(indexA: number, indexB: number): BlocksArray; + + /** + * Moves an item from one location to another in the array. Note: Faster than removing the item and adding it at the location + * + * @param sourceIndex The index pointing to the item that will be moved + * @param targetIndex The index where the item will be moved to + */ + move(sourceIndex: number, targetIndex: number): BlocksArray; + + /** + * Removes an item from the observable array + * + * @param value The value that will be removed or a callback function which returns true or false to determine if the value should be removed + */ + remove(value: any): BlocksArray; + /** + * @param value The value that will be removed or a callback function which returns true or false to determine if the value should be removed + * @param thisArg Optional this context for the callback + */ + remove(value: any, thisArg: Function): BlocksArray; + + /** + * Removes an item at the specified index + * + * @param index The index location of the item that will be removed + */ + removeAt(index: number): BlocksArray; + /** + * @param index The index location of the item that will be removed + * @param count Optional parameter that if specified will remove the next items starting from the specified index + */ + removeAt(index: number, count: number): BlocksArray; + + /** + * Removes all items from the observable array and optionally filter which items to be removed by providing a callback + */ + removeAll(): BlocksArray; + /** + * @param callback Optional callback function which filters which items to be removed. Returning a truthy value will remove the item and vice versa + */ + removeAll(callback: Function): BlocksArray; + /** + * @param callback Optional callback function which filters which items to be removed. Returning a truthy value will remove the item and vice versa + * @param thisArg Optional this context for the callback function + */ + removeAll(callback: Function, thisArg: any): BlocksArray; + + /** + * The concat() method is used to join two or more arrays + * + * @param arrays The arrays to be joined + */ + concat(...arrays: any[]): any[] + + /** + * The slice() method returns the selected elements in an array, as a new array object + * + * @param start An integer that specifies where to start the selection (The first element has an index of 0) + */ + slice(start: number): any[]; + /** + * @param start An integer that specifies where to start the selection (The first element has an index of 0) + * @param end An integer that specifies where to end the selection. If omitted, all elements from the start position and to the end of the array will be selected. + * Use negative numbers to select from the end of an array + */ + slice(start: number, end: number): any[]; + + /** + * The join() method joins the elements of an array into a string, and returns the string + */ + join(): string; + /** + * @param separator The separator to be used. If omitted, the elements are separated with a comma + */ + join(seperator: string): string; + + /** + * The pop() method removes the last element of a observable array, and returns that element + */ + pop(): any; + + /** + * The push() method adds new items to the end of the observable array, and returns the new length + * + * @param values The item(s) to add to the observable array + */ + push(...values: any[]): number; + + /** + * Reverses the order of the elements in the observable array + */ + reverse(): any[]; + + /** + * Removes the first element of a observable array, and returns that element + */ + shift(): any + + /** + * Sorts the elements of an array + */ + sort(): any[]; + /** + * @param sortfunction A function that defines the sort order + */ + sort(sortfunction: Function): any[]; + + /** + * Adds and/or removes elements from the observable array + * Returns A new array containing the removed items, if any. + * + * @param index An integer that specifies at what position to add/remove items. Use negative values to specify the position from the end of the array. + * @param howMany The number of items to be removed. If set to 0, no items will be removed. + * @param items The new item(s) to be added to the array. + */ + splice(index: number, howMany: number, ...items: any[]): any[]; + + /** + * The unshift() method adds new items to the beginning of an array, and returns the new length. + * + * @param items + */ + unshift(...items: any[]): number; +} + +///////////////////////////////////////// +// blocks MVC App +///////////////////////////////////////// + +interface App extends Extendable { + + /** + * Creates an application property for a Model. + */ + Property(): any; + /** + * @param options Configuration options for property + */ + Property(options: PropertyPrototype): any; + + /** + * Defines a view that will be part of the Application. + * + * @param name The name of the View you are creating + * @param prototype The object that will represent the View + */ + View(name: string, prototype: ViewPrototype): any; + /** + * Defines a view that will be part of the Application. + * + * @param parentViewName Provide this parameter only if you are creating nested views. This is the name of the parent View + * @param name The name of the View you are creating + * @param prototype The object that will represent the View + */ + View(parentViewName: string, name: string, prototype: ViewPrototype): any; + + /** + * Creates a new Model + * + * @param prototype The Model object properties that will be created + */ + Model(prototype: ModelPrototype): Model; + + /** + * Creates a new Collection + * + * @param prototype The Collection object properties that will be created. + */ + Collection(prototype: CollectionPrototype): Collection; + Collection(model: Model, prototype: CollectionPrototype): Collection; +} + +///////////////////////////////////////// +// App.Property +///////////////////////////////////////// + +interface PropertyPrototype { + defaultValue?: any; + isObservable?: boolean; + field?: string; + value?: any; + validateOnChange?: boolean; + maxErrors?: number; + validateInitially?: boolean + + // Validators + required?: Validator; + minlength?: Validator; + maxlength?: Validator; + min?: Validator; + max?: Validator; + email?: Validator; + url?: Validator; + date?: Validator; + creditcard?: Validator; + regexp?: Validator; + number?: Validator; + digits?: Validator; + letters?: Validator; + equals?: Validator; +} + +interface Validator { } + +///////////////////////////////////////// +// App.View +///////////////////////////////////////// + +interface ViewPrototype { + parentView?: any; + + /** + * Routes to a specific URL and actives the appropriate views associated with the URL + * + * @param name Name of the route + */ + route?(name: string): ViewPrototype; + + + /** + * Determines if the view is visible + */ + isActive?(): boolean; + + /** + * Override the init method to perform actions when the View is first created and shown on the page + */ + init?: Function; + + /** + * Override the routed method to perform actions when the View have routing and routing mechanism actives it. + */ + routed?: Function; + + navigateTo?: Function; + + /** + * Override the ready method to perform actions when the DOM is ready and + * all data-query have been executed. + */ + ready?: Function; + + options?: { + route?: any; + url?: string + }; +} + +///////////////////////////////////////// +// App.Model +///////////////////////////////////////// + +interface Model { + (): Model; + (props: Object): Model; + + /** + * Fires a request to the server to populate the Model based on the read URL specified + */ + read(): Model; + /** + * @param params The parameters Object that will be used to populate the Model from the specified options.read URL. If the URL does not contain parameters + */ + read(params: Object): Model; + + /** + * Synchronizes the changes with the server by sending requests to the provided URL's + */ + sync(): Model; +} + +interface ModelPrototype { + + /** + * Override the init method to perform actions on creation for each Model instance + */ + init?: Function; + + /** + * Validates all observable properties that have validation and returns true if all values are valid otherwise returns false + */ + validate?(): boolean; + + /** + * Extracts the raw(non observable) dataItem object values from the Model + */ + dataItem?(): Object; + + /** + * Applies new properties to the Model by providing an Object + * + * @param dataItem The object from which the new values will be applied + */ + reset?(dataItem: ModelPrototype): ModelPrototype; + + /** + * Determines whether the instance is new. If true when syncing the item will send for insertion instead of updating it. + * The check is determined by the idAttr value specified in the options. If idAttr is not specified the item will always be considered new. + * + */ + isNew?(): boolean; + + options?: { + idAttr?: string; + baseUrl?: string; + read?: { url?: string }; + create?: { url?: string }; + destroy?: { url?: string }; + update?: { url?: string }; + }; +} + +///////////////////////////////////////// +// App.Collection +///////////////////////////////////////// + +interface Collection extends Extendable { + (): Collection; + (props: Object[]): Collection; + + /** + * Fires a request to the server to populate the Model based on the read URL specified + */ + read(): Collection; + /** + * @param params The parameters Object that will be used to populate the Collection from the specified options.read URL. If the URL does not contain parameters + */ + read(params: Object): Collection; + + /** + * Clear all changes made to the collection + */ + clearChanges(): Collection; + + /** + * Performs an ajax request for all create, update and delete operations in order to sync them with a database. + */ + sync(): Collection; + + update(id: number, newValues: Object): Collection; +} + +interface CollectionPrototype { + options?: { + read?: { url?: string }; + create?: { url?: string }; + destroy?: { url?: string }; + update?: { url?: string }; + }; +} + +interface Extendable { + + /** + * Extends the current observable with particular functionality depending on the parameters specified. + * If the method is called without arguments and jsvalue framework is included the observable will be + * extended with the methods available in jsvalue for the current type. + * + * @param name Name of the extender + * @param options Optional options + */ + extend(name?: string, ...options: any[]): T; + extend(arg: any): T; +} + +interface Server { + + /** + * The port at which your application will be run + */ + port?: number; + + /** + * The folder where your application files like .html; .js and .css are going to be. + * The value is passed to express.static() middleware. + */ + static?: string; + + /** + * Caches pages result instead of executing them each time. + * Disabling cache could impact performance. + */ + cache?: boolean; + + /** + * Provide an express middleware function or an array of middleware functions. + * Use: [compression(); bodyParser()] + */ + use?: any; +} + +declare var blocks: BlocksStatic; + +declare module "blocks" { + export = blocks; +} \ No newline at end of file diff --git a/bootstrap-slider/bootstrap-slider-tests.ts b/bootstrap-slider/bootstrap-slider-tests.ts new file mode 100644 index 000000000..548d909a6 --- /dev/null +++ b/bootstrap-slider/bootstrap-slider-tests.ts @@ -0,0 +1,120 @@ +/// +/// + +$(function() { + // examples from http://seiyria.github.io/bootstrap-slider/ + + $('#ex1').slider({ + formatter: function(value) { + return 'Current value: ' + value; + } + }); + + + + $("#ex2").slider({}); + + var RGBChange = function() { + $('#RGB').css('background', 'rgb('+r.getValue()+','+g.getValue()+','+b.getValue()+')') + }; + + var r = $('#R').slider() + .on('slide', RGBChange) + .data('slider'); + var g = $('#G').slider() + .on('slide', RGBChange) + .data('slider'); + var b = $('#B').slider() + .on('slide', RGBChange) + .data('slider'); + + + + $("#ex4").slider({ + reversed : true + }); + + + + $("#ex5").slider(); + + $("#destroyEx5Slider").click(function() { + $("#ex5").slider('destroy'); + }); + + + + $("#ex6").slider(); + $("#ex6").on("slide", function(slideEvt) { + $("#ex6SliderVal").text(slideEvt.value); + }); + + + + $("#ex7").slider(); + + $("#ex7-enabled").click(function() { + if(this.checked) { + // With JQuery + $("#ex7").slider("enable"); + } + else { + // With JQuery + $("#ex7").slider("disable"); + } + }); + + + + $("#ex8").slider({ + tooltip: 'always' + }); + + + + $("#ex9").slider({ + precision: 2, + value: 8.115 // Slider will instantiate showing 8.12 due to specified precision + }); + + + + $("#ex11").slider({step: 20000, min: 0, max: 200000}); + + + + $("#ex12a").slider({ id: "slider12a", min: 0, max: 10, value: 5 }); + $("#ex12b").slider({ id: "slider12b", min: 0, max: 10, range: true, value: [3, 7] }); + $("#ex12c").slider({ id: "slider12c", min: 0, max: 10, range: true, value: [3, 7] }); + + + + $("#ex13").slider({ + ticks: [0, 100, 200, 300, 400], + ticks_labels: ['$0', '$100', '$200', '$300', '$400'], + ticks_snap_bounds: 30 + }); + + + + $("#ex14").slider({ + ticks: [0, 100, 200, 300, 400], + ticks_positions: [0, 30, 60, 70, 90, 100], + ticks_labels: ['$0', '$100', '$200', '$300', '$400'], + ticks_snap_bounds: 30 + }); + + + + $("#ex15").slider({ + min: 1000, + max: 10000000, + scale: 'logarithmic', + step: 10 + }); + + + + $("#ex16a").slider({ min: 0, max: 10, value: 0, focus: true }); + $("#ex16b").slider({ min: 0, max: 10, value: [0, 10], focus: true }); +}); diff --git a/bootstrap-slider/bootstrap-slider.d.ts b/bootstrap-slider/bootstrap-slider.d.ts new file mode 100644 index 000000000..78aeb645c --- /dev/null +++ b/bootstrap-slider/bootstrap-slider.d.ts @@ -0,0 +1,200 @@ +// Type definitions for bootstrap-slider.js 4.8.3 +// Project: https://github.com/seiyria/bootstrap-slider +// Definitions by: Daniel Beckwith +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +interface SliderOptions { + /** + * Default: '' + * set the id of the slider element when it's created + */ + id?: string; + /** + * Default: 0 + * minimum possible value + */ + min?: number; + /** + * Default: 10 + * maximum possible value + */ + max?: number; + /** + * Default: 1 + * increment step + */ + step?: number; + /** + * Default: number of digits after the decimal of step value + * The number of digits shown after the decimal. Defaults to the number of digits after the decimal of step value. + */ + precision?: number; + /** + * Default: 'horizontal' + * set the orientation. Accepts 'vertical' or 'horizontal' + */ + orientation?: number; + /** + * Default: 5 + * initial value. Use array to have a range slider. + */ + value?: number|number[]; + /** + * Default: false + * make range slider. Optional if initial value is an array. If initial value is scalar, max will be used for second value. + */ + range?: boolean; + /** + * Default: 'before' + * selection placement. Accepts: 'before', 'after' or 'none'. In case of a range slider, the selection will be placed between the handles + */ + selection?: string; + /** + * Default: 'show' + * whether to show the tooltip on drag, hide the tooltip, or always show the tooltip. Accepts: 'show', 'hide', or 'always' + */ + tooltip?: string; + /** + * Default: false + * if false show one tootip if true show two tooltips one for each handler + */ + tooltip_split?: boolean; + /** + * Default: 'round' + * handle shape. Accepts: 'round', 'square', 'triangle' or 'custom' + */ + handle?: string; + /** + * Default: false + * whether or not the slider should be reversed + */ + reversed?: boolean; + /** + * Default: true + * whether or not the slider is initially enabled + */ + enabled?: boolean; + /** + * Default: returns the plain value + * formatter callback. Return the value wanted to be displayed in the tooltip + * @param val the current value to display + */ + formatter?(val:number): string; + /** + * Default: false + * The natural order is used for the arrow keys. Arrow up select the upper slider value for vertical sliders, arrow right the righter slider value for a horizontal slider - no matter if the slider was reversed or not. By default the arrow keys are oriented by arrow up/right to the higher slider value, arrow down/left to the lower slider value. + */ + natural_arrow_keys?: boolean; + /** + * Default: [ ] + * Used to define the values of ticks. Tick marks are indicators to denote special values in the range. This option overwrites min and max options. + */ + ticks?: number[]; + /** + * Default: [ ] + * Defines the positions of the tick values in percentages. The first value should alwasy be 0, the last value should always be 100 percent. + */ + ticks_positions?: number[]; + /** + * Default: [ ] + * Defines the labels below the tick marks. Accepts HTML input. + */ + ticks_labels?: string[]; + /** + * Default: 0 + * Used to define the snap bounds of a tick. Snaps to the tick if value is within these bounds. + */ + ticks_snap_bounds?: number; + /** + * Default: 'linear' + * Set to 'logarithmic' to use a logarithmic scale. + */ + scale?: string; + /** + * Default: false + * Focus the appropriate slider handle after a value change. + */ + focus?: boolean; +} + +interface JQuery { + /** + * Creates a slider from the current element. + * @param options + */ + slider(options?:SliderOptions): JQuery; + slider(methodName:string, ...args:any[]): JQuery; +} + +interface ChangeValue { + oldValue: number; + newValue: number; +} + +interface JQueryEventObject { + value: number|ChangeValue; +} + +/** + * This class is actually not used when using the jQuery version of bootstrap-slider + * The method documentation is still here thouh. + * When using jQuery, slider methods like setValue(3, true) have to be called like $slider.slider('setValue', 3, true) + */ +interface Slider extends JQuery { + /** + * Get the current value from the slider + */ + getValue(): number; + /** + * Set a new value for the slider. If optional triggerSlideEvent parameter is true, 'slide' events will be triggered. If optional triggerChangeEvent parameter is true, 'change' events will be triggered. + * @param newValue + * @param triggerSlideEvent + * @param triggerChangeEvent + */ + setValue(newValue:number, triggerSlideEvent?:boolean, triggerChangeEvent?:boolean): void; + /** + * Properly clean up and remove the slider instance + */ + destroy(): void; + /** + * Disables the slider and prevents the user from changing the value + */ + disable(): void; + /** + * Enables the slider + */ + enable(): void; + /** + * Returns true if enabled, false if disabled + */ + isEnabled(): boolean; + /** + * Updates the slider's attributes + * @param attribute + * @param value + */ + setAttribute(attribute:string, value:any): void; + /** + * Get the slider's attributes + * @param attribute + */ + getAttribute(attribute:string): any; + /** + * Refreshes the current slider + */ + refresh(): void; + /** + * Renders the tooltip again, after initialization. Useful in situations when the slider and tooltip are initially hidden. + */ + relayout(): void; + on: { + (eventType:string, callback:(eventObject:JQueryEventObject, ...args:any[]) => any): Slider; + (eventType:string, data:any, callback:(eventObject:JQueryEventObject, ...args:any[]) => any): Slider; + (eventType:string, selector:string, callback:(eventObject:JQueryEventObject, ...eventData:any[]) => any): Slider; + (eventType:string, selector:string, data:any, callback:(eventObject:JQueryEventObject, ...eventData:any[]) => any): Slider; + (eventType:{ [key: string]: any; }, selector?:string, data?:any): Slider; + (eventType:{ [key: string]: any; }, data?:any): Slider; + } +} diff --git a/bootstrap-touchspin/bootstrap-touchspin-tests.ts b/bootstrap-touchspin/bootstrap-touchspin-tests.ts new file mode 100644 index 000000000..552c26f52 --- /dev/null +++ b/bootstrap-touchspin/bootstrap-touchspin-tests.ts @@ -0,0 +1,68 @@ +/// +/// + +$(function () { + // Example 1 from http://www.virtuosoft.eu/code/bootstrap-touchspin/ + $("input[name='demo1']").TouchSpin({ + min: 0, + max: 100, + step: 0.1, + decimals: 2, + boostat: 5, + maxboostedstep: 10, + postfix: '%' + }); + + // Example 2 from http://www.virtuosoft.eu/code/bootstrap-touchspin/ + $("input[name='demo2']").TouchSpin({ + min: -1000000000, + max: 1000000000, + stepinterval: 50, + maxboostedstep: 10000000, + prefix: '$' + }); + + // Example 3 from http://www.virtuosoft.eu/code/bootstrap-touchspin/ + $("input[name='demo_vertical']").TouchSpin({ + verticalbuttons: true + }); + + // Example 4 from http://www.virtuosoft.eu/code/bootstrap-touchspin/ + $("input[name='demo_vertical2']").TouchSpin({ + verticalbuttons: true, + verticalupclass: 'glyphicon glyphicon-plus', + verticaldownclass: 'glyphicon glyphicon-minus' + }); + + // Example 5 from http://www.virtuosoft.eu/code/bootstrap-touchspin/ + $("input[name='demo3']").TouchSpin(); + + // Example 6 from http://www.virtuosoft.eu/code/bootstrap-touchspin/ + $("input[name='demo3_21']").TouchSpin({ + initval: 40 + }); + + // Example 7 from http://www.virtuosoft.eu/code/bootstrap-touchspin/ + $("input[name='demo4']").TouchSpin({ + postfix: "a button", + postfix_extraclass: "btn btn-default" + }); + + // Example 8 from http://www.virtuosoft.eu/code/bootstrap-touchspin/ + $("input[name='demo4_2']").TouchSpin({ + postfix: "a button", + postfix_extraclass: "btn btn-default" + }); + + // Example 9 from http://www.virtuosoft.eu/code/bootstrap-touchspin/ + $("input[name='demo5']").TouchSpin({ + prefix: "pre", + postfix: "post" + }); + + // Example 10 from http://www.virtuosoft.eu/code/bootstrap-touchspin/ + $("input[name='demo6']").TouchSpin({ + buttondown_class: "btn btn-link", + buttonup_class: "btn btn-link" + }); +}); \ No newline at end of file diff --git a/bootstrap-touchspin/bootstrap-touchspin.d.ts b/bootstrap-touchspin/bootstrap-touchspin.d.ts new file mode 100644 index 000000000..2dcf62884 --- /dev/null +++ b/bootstrap-touchspin/bootstrap-touchspin.d.ts @@ -0,0 +1,130 @@ +// Type definitions for Bootstrap TouchSpin +// Project: http://www.virtuosoft.eu/code/bootstrap-touchspin/ +// Definitions by: Albin Sunnanbo +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +/** + * TouchSpinOptions. All options are optional + */ +interface TouchSpinOptions { + /** + * Applied when no explicit value is set on the input with the value attribute. + * Empty string means that the value remains empty on initialization. + */ + initval?: number | string; + + /** + * Minimum value. + */ + min?: number; + + /** + * Maximum value. + */ + max?: number; + + /** + * Incremental/decremental step on up/down change. + */ + step?: number; + + /** + * How to force the value to be divisible by step value: 'none' | 'round' | 'floor' | 'ceil' + */ + forcestepdivisibility?: string; + + /** + * Number of decimal points. + */ + decimals?: number; + + /** + * Refresh rate of the spinner in milliseconds. + */ + stepinterval?: number; + + /** + * Time in milliseconds before the spinner starts to spin. + */ + stepintervaldelay?: number; + + /** + * Enables the traditional up/down buttons. + */ + verticalbuttons?: boolean; + + /** + * Class of the up button with vertical buttons mode enabled. + */ + verticalupclass?: string; + + /** + * Class of the down button with vertical buttons mode enabled. + */ + verticaldownclass?: string; + + /** + * Text before the input. + */ + prefix?: string; + + /** + * Text after the input. + */ + postfix?: string; + + /** + * Extra class(es) for prefix. + */ + prefix_extraclass?: string; + + /** + * Extra class(es) for postfix. + */ + postfix_extraclass?: string; + + /** + * If enabled, the the spinner is continually becoming faster as holding the button. + */ + booster?: boolean; + + /** + * Boost at every nth step. + */ + boostat?: number; + + /** + * Maximum step when boosted. + */ + maxboostedstep?: number | boolean; + + /** + * Enables the mouse wheel to change the value of the input. + */ + mousewheel?: boolean; + + /** + * Class(es) of down button. + */ + buttondown_class?: string; + + /** + * Class(es) of up button. + */ + buttonup_class?: string; +} + +interface JQuery { + /** + * Initialize TouchSpin + */ + TouchSpin(): JQuery; + + /** + * Inialize TouchSpin with options + * @param options a TouchSpinOptions object with one or more options + */ + TouchSpin(options: TouchSpinOptions): JQuery; +} diff --git a/browser-sync/browser-sync-tests.ts b/browser-sync/browser-sync-tests.ts index 0d369e393..0af5dfc00 100644 --- a/browser-sync/browser-sync-tests.ts +++ b/browser-sync/browser-sync-tests.ts @@ -7,6 +7,13 @@ browserSync({ } }); +// multiple base directory +browserSync({ + server: { + baseDir: ["app", "dist"] + } +}); + browserSync({ proxy: "yourlocal.dev" }); @@ -62,4 +69,14 @@ evt.on("init", function () { console.log("BrowserSync is running!"); }); -browserSync(config); \ No newline at end of file +browserSync(config); + +var bs = browserSync.create(); + +bs.init({ + server: "./app" +}); + +bs.reload(); + + diff --git a/browser-sync/browser-sync.d.ts b/browser-sync/browser-sync.d.ts index 5dde0e854..db9f3ad3b 100644 --- a/browser-sync/browser-sync.d.ts +++ b/browser-sync/browser-sync.d.ts @@ -3,96 +3,113 @@ // Definitions by: Asana // Definitions: https://github.com/borisyankov/DefinitelyTyped +/// /// declare module "browser-sync" { + import chokidar = require("chokidar"); + import fs = require("fs"); import http = require("http"); - - function BrowserSync(config?: BrowserSync.Options, callback?: (err: Error, bs: Object) => any): void; - - module BrowserSync { - export function reload(): void; - export function reload(file: string): void; - export function reload(files: string[]): void; - export function reload(options: {stream: boolean}): NodeJS.ReadWriteStream; - export function notify(message: string, timeout?: number): void; - - export function exit(): void; - - export var active: boolean; - - export var emitter: NodeJS.EventEmitter; - - interface Options { - files?: string | string[]; - watchOptions?: GazeOptions; - server?: ServerOptions; - proxy?: string | boolean; - port?: number; - https?: boolean; - ghostMode?: GhostOptions | boolean; - logLevel?: string; - logPrefix?: string; - logConnections?: boolean; - logFileChanges?: boolean; - logSnippet?: boolean; - snippetOptions?: SnippetOptions; - tunnel?: string | boolean; - online?: boolean; - open?: string | boolean; - browser?: string | string[]; - xip?: boolean; - notify?: boolean; - scrollProportionally?: boolean; - scrollThrottle?: number; - reloadDelay?: number; - injectChanges?: boolean; - startPath?: string; - minify?: boolean; - host?: string; - codeSync?: boolean; - timestamps?: boolean; - scriptPath?: (path: string) => string; - socket?: SocketOptions; - } - - interface GazeOptions { - interval?: number; - debounceDelay?: number; - mode?: string; - cwd?: string; - } - - interface ServerOptions { - baseDir?: string; - directory?: boolean; - index?: string; - routes?: {[path: string]: string}; - middleware?: MiddlewareHandler[]; - } - - interface MiddlewareHandler { - (req: http.ServerRequest, res: http.ServerResponse, next: Function): any; - } - - interface GhostOptions { - clicks?: boolean; - scroll?: boolean; - forms?: boolean; - } - - interface SnippetOptions { - ignorePaths?: string; - rule?: {match?: RegExp; fn?: (snippet: string, match: string) => any}; - } - - interface SocketOptions { - path?: string; - clientPath?: string; - namespace?: string; - } + interface Options { + files?: string | string[]; + watchOptions?: GazeOptions; + server?: ServerOptions; + proxy?: string | boolean; + port?: number; + https?: boolean; + ghostMode?: GhostOptions | boolean; + logLevel?: string; + logPrefix?: string; + logConnections?: boolean; + logFileChanges?: boolean; + logSnippet?: boolean; + snippetOptions?: SnippetOptions; + rewriteRules?: boolean | RewriteRules[]; + tunnel?: string | boolean; + online?: boolean; + open?: string | boolean; + browser?: string | string[]; + xip?: boolean; + notify?: boolean; + scrollProportionally?: boolean; + scrollThrottle?: number; + reloadDelay?: number; + reloadDebounce?: number; + plugins?: any[]; + injectChanges?: boolean; + startPath?: string; + minify?: boolean; + host?: string; + codeSync?: boolean; + timestamps?: boolean; + scriptPath?: (path: string) => string; + socket?: SocketOptions; } - export = BrowserSync; -} \ No newline at end of file + interface GazeOptions { + interval?: number; + debounceDelay?: number; + mode?: string; + cwd?: string; + } + + interface ServerOptions { + baseDir?: string | string[]; + directory?: boolean; + index?: string; + routes?: {[path: string]: string}; + middleware?: MiddlewareHandler[]; + } + + interface MiddlewareHandler { + (req: http.ServerRequest, res: http.ServerResponse, next: Function): any; + } + + interface GhostOptions { + clicks?: boolean; + scroll?: boolean; + forms?: boolean; + } + + interface SnippetOptions { + ignorePaths?: string; + rule?: {match?: RegExp; fn?: (snippet: string, match: string) => any}; + } + + interface SocketOptions { + path?: string; + clientPath?: string; + namespace?: string; + } + + interface RewriteRules { + match: RegExp; + fn: (match: string) => string; + } + + interface BrowserSync { + init(config?: Options, callback?: (err: Error, bs: Object) => any): void; + reload(): void; + reload(file: string): void; + reload(files: string[]): void; + reload(options: {stream: boolean}): NodeJS.ReadWriteStream; + notify(message: string, timeout?: number): void; + exit(): void; + watch(patterns: string, opts?: chokidar.WatchOptions, fn?: (event: string, file: fs.Stats) => any): NodeJS.EventEmitter; + pause(): void; + resume(): void; + emitter: NodeJS.EventEmitter; + active: boolean; + paused: boolean; + } + + interface Exports extends BrowserSync { + create(): BrowserSync; + (config?: Options, callback?: (err: Error, bs: Object) => any): void; + } + + var browserSync: Exports; + + export = browserSync; +} diff --git a/buffers/buffers-tests.ts b/buffers/buffers-tests.ts new file mode 100644 index 000000000..0a51f97ae --- /dev/null +++ b/buffers/buffers-tests.ts @@ -0,0 +1,49 @@ +/// +import Buffers = require('buffers'); + +var any: any; +var num: number; +var str: string; +var buf = new Buffer([1, 2, 3]); +var bufs: Buffers = new Buffers(); // with new, as type + +bufs = Buffers(); // no new + +// with self +bufs = Buffers(bufs); +bufs = new Buffers(bufs); + +// with array of buffers. +bufs = Buffers([buf, buf]); +bufs = new Buffers([buf, buf]); + +num = bufs.push(buf); +num = bufs.push(buf, buf); + +num = bufs.unshift(buf); +num = bufs.unshift(buf, buf); + +buf = bufs.slice(); +buf = bufs.slice(num); +buf = bufs.slice(num, num); + +bufs = bufs.splice(num); +bufs = bufs.splice(num, num); +bufs = bufs.splice(num, num, buf); +bufs = bufs.splice(num, num, buf, buf); + +num = bufs.copy(buf); +num = bufs.copy(buf, num, num, num); + +any = bufs.get(num); +bufs.set(num, any); + +num = bufs.indexOf(str); +num = bufs.indexOf(str, num); +num = bufs.indexOf(buf); +num = bufs.indexOf(buf, num); + +buf = bufs.toBuffer(); + +str = buf.toString(); +str = buf.toString(any, num, num); diff --git a/buffers/buffers.d.ts b/buffers/buffers.d.ts new file mode 100644 index 000000000..fad36d3c4 --- /dev/null +++ b/buffers/buffers.d.ts @@ -0,0 +1,36 @@ +// Type definitions for buffers 0.1.1 +// Project: https://github.com/substack/node-buffers +// Definitions by: Robert Hencke +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module "buffers" { + + interface BuffersStatics { + new (bufs?: Buffer[]|Buffers): Buffers; + (bufs?: Buffer[]| Buffers): Buffers; + prototype: Buffers; + } + + interface Buffers { + buffers: Buffer[]; + length: number; + + push(...items: Buffer[]): number; + unshift(...items: Buffer[]): number; + slice(i?: number, j?: number): Buffer; + splice(i: number, howMany?: number, ...items: Buffer[]): Buffers; + copy(dst: Buffer, dstStart?: number, start?: number, end?: number): number; + get(i: number): any; + set(i: number, b: any): void; + indexOf(needle: string|Buffer, offset?: number): number; + toBuffer(): Buffer; + toString(encoding?: any, start?: number, end?: number): string; + } + + var Buffers: BuffersStatics; + + export = Buffers; + +} diff --git a/calq/calq-tests.ts b/calq/calq-tests.ts new file mode 100644 index 000000000..6f8019261 --- /dev/null +++ b/calq/calq-tests.ts @@ -0,0 +1,28 @@ +/// +function calq_base() +{ + calq.init("bfff14a4e0225789be3d9d22c4bb42a1"); + + calq.init("bfff14a4e0225789be3d9d22c4bb42a1", { your: "config" }); + + calq.action.track("Product Review", {"Rating": 9.0}); + + calq.action.trackSale("Product Sale", { "Product Id": 149, "Product Name": "Dinosaur T-Shirt XL" }, "USD",10); + + calq.action.trackHTMLLink('Link', { 'Target': 'Calq'}); + + calq.action.trackPageView(); + + calq.action.trackPageView("Custom Action"); + + calq.action.setGlobalProperty("Referral Source", "Google Campaign"); +} + +function calq_people() +{ + calq.user.identify("1001"); + + calq.user.clear(); + + calq.user.profile( { "Company": "MegaCorp", "$email": "super_customer1@notarealemail.com" }); +} diff --git a/calq/calq.d.ts b/calq/calq.d.ts new file mode 100644 index 000000000..c574df58f --- /dev/null +++ b/calq/calq.d.ts @@ -0,0 +1,34 @@ +// Type definitions for calq +// Project: https://calq.io/docs/client/javascript/reference +// Definitions by: Eirik Hoem +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +interface Calq +{ + action:Calq.Action; + user:Calq.User; + + init(writeKey:string, options?:{[index:string]:any}):void; +} + +declare module Calq +{ + interface Action + { + track(action:string, params?:{[index:string]:any}):void; + trackSale(action:string, params:{[index:string]:any}, currency:string, amount:number):void; + trackHTMLLink(action:string, params?:{[index:string]:any}):void; + trackPageView(action?:string):void; + setGlobalProperty(name:string,value:any):void; + } + + interface User + { + identify(userId:string):void; + clear():void; + profile(params:{[index:string]:any}):void; + + } +} + +declare var calq:Calq; \ No newline at end of file diff --git a/chai-as-promised/chai-as-promised-tests.ts b/chai-as-promised/chai-as-promised-tests.ts index 20a773cdd..95a433517 100644 --- a/chai-as-promised/chai-as-promised-tests.ts +++ b/chai-as-promised/chai-as-promised-tests.ts @@ -1,4 +1,3 @@ -/// /// import chai = require('chai'); @@ -6,9 +5,11 @@ import chaiAsPromised = require('chai-as-promised'); chai.use(chaiAsPromised); +// ReSharper disable WrongExpressionStatement var promise: any; chai.expect(promise).to.eventually.equal(3); chai.expect(promise).to.become(3); +chai.expect(promise).to.be.fulfilled; chai.expect(promise).to.be.rejected; chai.expect(promise).to.be.rejectedWith(Error); chai.expect(promise).to.notify(() => console.log('done')); diff --git a/chai-as-promised/chai-as-promised.d.ts b/chai-as-promised/chai-as-promised.d.ts index 20b697bb5..106bbf41e 100644 --- a/chai-as-promised/chai-as-promised.d.ts +++ b/chai-as-promised/chai-as-promised.d.ts @@ -6,21 +6,22 @@ /// declare module 'chai-as-promised' { - import chai = require('chai'); - function chaiAsPromised(chai: any, utils: any): void; - export = chaiAsPromised; } -declare module chai { +declare module Chai { + + interface Assertion { + become(expected: any): Assertion; + fulfilled: Assertion; + rejected: Assertion; + rejectedWith(expected: any): Assertion; + notify(fn: Function): Assertion; + } interface LanguageChains { - become(expected: any): Expect; - eventually: Expect; - rejected: Expect; - rejectedWith(expected: any): Expect; - notify(fn: Function): Expect; + eventually: Assertion; } interface Assert { @@ -32,4 +33,4 @@ declare module chai { isRejected(promise: any, expected: any, message?: string): void; isRejected(promise: any, match: RegExp, message?: string): void; } -} \ No newline at end of file +} diff --git a/chai-datetime/chai-datetime-tests.ts b/chai-datetime/chai-datetime-tests.ts index 8f8238b4e..5c15326f4 100644 --- a/chai-datetime/chai-datetime-tests.ts +++ b/chai-datetime/chai-datetime-tests.ts @@ -1,13 +1,16 @@ -/// /// +import chai = require('chai'); +import chaiDateTime = require('chai-datetime'); + +chai.use(chaiDateTime); var expect = chai.expect; var assert = chai.assert; function test_equalTime(){ var date: Date = new Date(2014, 1, 1); - expect(date).to.be.equalTime(date); - date.should.be.equalTime(date); + expect(date).to.equalTime(date); + date.should.equalTime(date); assert.equalTime(date, date); } @@ -34,14 +37,14 @@ function test_equalDate(){ function test_beforeDate(){ var date: Date = new Date(2014, 1, 1); - expect(date).to.beforeDate(date); - date.should.beforeDate(date); + expect(date).to.be.beforeDate(date); + date.should.be.beforeDate(date); assert.beforeDate(date, date); } function test_afterDate(){ var date: Date = new Date(2014, 1, 1); - expect(date).to.afterDate(date); - date.should.afterDate(date); + expect(date).to.be.afterDate(date); + date.should.be.afterDate(date); assert.afterDate(date, date); } diff --git a/chai-datetime/chai-datetime.d.ts b/chai-datetime/chai-datetime.d.ts index bce063443..b6140689c 100644 --- a/chai-datetime/chai-datetime.d.ts +++ b/chai-datetime/chai-datetime.d.ts @@ -5,35 +5,38 @@ /// -declare module chai { +declare module Chai { - interface Expect { - afterDate(date: Date): boolean; - beforeDate(date: Date): boolean; - equalDate(date: Date): boolean; + interface Assertion { + afterDate(date: Date): Assertion; + beforeDate(date: Date): Assertion; + equalDate(date: Date): Assertion; + afterTime(date: Date): Assertion; + beforeTime(date: Date): Assertion; + equalTime(date: Date): Assertion; + } - afterTime(date: Date): boolean; - beforeTime(date: Date): boolean; - equalTime(date: Date): boolean; - } - - interface Assert { - equalTime(val: Date, exp: Date, msg?: string): boolean; - notEqualTime(val: Date, exp: Date, msg?: string): boolean; - beforeTime(val: Date, exp: Date, msg?: string): boolean; - notBeforeTime(val: Date, exp: Date, msg?: string): boolean; - afterTime(val: Date, exp: Date, msg?: string): boolean; - notAfterTime(val: Date, exp: Date, msg?: string): boolean; - - equalDate(val: Date, exp: Date, msg?: string): boolean; - notEqualDate(val: Date, exp: Date, msg?: string): boolean; - beforeDate(val: Date, exp: Date, msg?: string): boolean; - notBeforeDate(val: Date, exp: Date, msg?: string): boolean; - afterDate(val: Date, exp: Date, msg?: string): boolean; - notAfterDate(val: Date, exp: Date, msg?: string): boolean; - } + interface Assert { + equalTime(val: Date, exp: Date, msg?: string): void; + notEqualTime(val: Date, exp: Date, msg?: string): void; + beforeTime(val: Date, exp: Date, msg?: string): void; + notBeforeTime(val: Date, exp: Date, msg?: string): void; + afterTime(val: Date, exp: Date, msg?: string): void; + notAfterTime(val: Date, exp: Date, msg?: string): void; + equalDate(val: Date, exp: Date, msg?: string): void; + notEqualDate(val: Date, exp: Date, msg?: string): void; + beforeDate(val: Date, exp: Date, msg?: string): void; + notBeforeDate(val: Date, exp: Date, msg?: string): void; + afterDate(val: Date, exp: Date, msg?: string): void; + notAfterDate(val: Date, exp: Date, msg?: string): void; + } } interface Date { - should: chai.Expect; + should: Chai.Assertion; +} + +declare module "chai-datetime" { + function chaiDateTime(chai: any, utils: any): void; + export = chaiDateTime; } diff --git a/chai-fuzzy/chai-fuzzy-tests.ts b/chai-fuzzy/chai-fuzzy-tests.ts new file mode 100644 index 000000000..292b25002 --- /dev/null +++ b/chai-fuzzy/chai-fuzzy-tests.ts @@ -0,0 +1,35 @@ +/// + +// tests taken from http://chaijs.com/plugins/chai-fuzzy + +import chai = require('chai'); +import chaiFuzzy = require('chai-fuzzy'); + +chai.use(chaiFuzzy); +var expect = chai.expect; +var assert = chai.assert; + +/** + * compare object attributes and values rather than checking to see if they're the same reference + */ +function like() { + var subject = { a: 'a' }; + + expect(subject).to.be.like({ a: 'a' }); + expect(subject).not.to.be.like({ x: 'x' }); + expect(subject).not.to.be.like({ a: 'a', b: 'b' }); + + assert.like(subject, { a: 'a' }); + assert.notLike(subject, { x: 'x' }); + assert.notLike(subject, { a: 'a', b: 'b' }); + + var subject2 = ['a']; + + expect(subject2).to.be.like(['a']); + expect(subject2).not.to.be.like(['x']); + expect(subject2).not.to.be.like(['a', 'b']); + + assert.like(subject2, ['a']); + assert.notLike(subject2, ['x']); + assert.notLike(subject2, ['a', 'b']); +} diff --git a/chai-fuzzy/chai-fuzzy.d.ts b/chai-fuzzy/chai-fuzzy.d.ts index acfb515f4..90955e1e1 100644 --- a/chai-fuzzy/chai-fuzzy.d.ts +++ b/chai-fuzzy/chai-fuzzy.d.ts @@ -5,13 +5,72 @@ /// -declare module chai { - interface Assert { - like(act:any, exp:any, msg?:string); - notLike(act:any, exp:any, msg?:string); - containOneLike(act:any, exp:any, msg?:string); - notContainOneLike(act:any, exp:any, msg?:string); - jsonOf(act:any, exp:any, msg?:string); - notJsonOf(act:any, exp:any, msg?:string); +declare module Chai { + + interface Assertion { + /** + * Compare object attributes and values rather than checking to see if + * they're the same reference. + */ + like(expected: any, message?: string): Assertion; + /** + * Compare object attributes and values rather than checking to see if + * they're the same reference. + */ + notLike(expected: any, message?: string): Assertion; + /** + * Check the first level of the container for a value like the one provided. + */ + containOneLike(expected: any, message?: string): Assertion; + /** + * Check the first level of the container for a value like the one provided. + */ + notContainOneLike(expected: any, message?: string): Assertion; + /** + * Check that the given javascript object is like the JSON-ified expected + * value. Useful for checking stringification and parsing of an object. + */ + jsonOf(expected: any, message?: string): Assertion; + /** + * Check that the given javascript object is like the JSON-ified expected + * value. Useful for checking stringification and parsing of an object. + */ + notJsonOf(expected: any, message?: string): Assertion; + } + + export interface Assert { + /** + * Compare object attributes and values rather than checking to see if + * they're the same reference. + */ + like(actual: any, expected: any, message?: string): void; + /** + * Compare object attributes and values rather than checking to see if + * they're the same reference. + */ + notLike(actual: any, expected: any, message?: string): void; + /** + * Check the first level of the container for a value like the one provided. + */ + containOneLike(actual: any, expected: any, message?: string): void; + /** + * Check the first level of the container for a value like the one provided. + */ + notContainOneLike(actual: any, expected: any, message?: string): void; + /** + * Check that the given javascript object is like the JSON-ified expected + * value. Useful for checking stringification and parsing of an object. + */ + jsonOf(actual: any, expected: any, message?: string): void; + /** + * Check that the given javascript object is like the JSON-ified expected + * value. Useful for checking stringification and parsing of an object. + */ + notJsonOf(actual: any, expected: any, message?: string): void; } } + +declare module "chai-fuzzy" { + function chaiFuzzy(chai: any, utils: any): void; + export = chaiFuzzy; +} diff --git a/chai-fuzzy/chai-fuzzy.d.ts.tscparams b/chai-fuzzy/chai-fuzzy.d.ts.tscparams deleted file mode 100644 index d3f5a12fa..000000000 --- a/chai-fuzzy/chai-fuzzy.d.ts.tscparams +++ /dev/null @@ -1 +0,0 @@ - diff --git a/chai-http/chai-http-tests.ts b/chai-http/chai-http-tests.ts index e6e471321..078a7799c 100644 --- a/chai-http/chai-http-tests.ts +++ b/chai-http/chai-http-tests.ts @@ -1,20 +1,21 @@ /// -/// +/// import fs = require('fs'); import http = require('http'); import chai = require('chai'); -import chaiHttp = require('chai-http'); +import ChaiHttp = require('chai-http'); import when = require('when'); -chai.use(chaiHttp); +chai.use(ChaiHttp); + +// ReSharper disable WrongExpressionStatement // Add promise support if this does not exist natively. if (!global.Promise) { chai.request.addPromises(when.promise); } - var app: http.Server; chai.request(app).get('/'); @@ -41,13 +42,12 @@ chai.request(app) chai.request(app) .get('/search') - .query('name', 'foo') - .query('limit', '10'); + .query({name: 'foo', limit: 10}); chai.request(app) .put('/user/me') .send({ passsword: '123', confirmPassword: '123' }) - .end((err: any, res: chaiHttp.Response) => { + .end((err: any, res: ChaiHttp.Response) => { chai.expect(err).to.be.null; chai.expect(res).to.have.status(200); }); @@ -55,7 +55,7 @@ chai.request(app) chai.request(app) .put('/user/me') .send({ passsword: '123', confirmPassword: '123' }) - .then((res: chaiHttp.Response) => chai.expect(res).to.have.status(200)) + .then((res: ChaiHttp.Response) => chai.expect(res).to.have.status(200)) .catch((err: any) => { throw err; }); var agent = chai.request.agent(app); @@ -63,17 +63,17 @@ var agent = chai.request.agent(app); agent .post('/session') .send({ username: 'me', password: '123' }) - .then((res: chaiHttp.Response) => { + .then((res: ChaiHttp.Response) => { chai.expect(res).to.have.cookie('sessionid'); // The `agent` now has the sessionid cookie saved, and will send it // back to the server in the next request: return agent.get('/user/me') - .then((res: chaiHttp.Response) => chai.expect(res).to.have.status(200)); + .then((res: ChaiHttp.Response) => chai.expect(res).to.have.status(200)); }); function test1() { var req = chai.request(app).get('/'); - req.then((res: chaiHttp.Response) => { + req.then((res: ChaiHttp.Response) => { chai.expect(res).to.have.status(200); chai.expect(res).to.have.header('content-type', 'text/plain'); chai.expect(res).to.have.header('content-type', /^text/); @@ -99,5 +99,4 @@ function test1() { }); } - when(chai.request(app).get('/')).done(() => console.log('success'), () => console.log('failure')); diff --git a/chai-http/chai-http.d.ts b/chai-http/chai-http.d.ts index fed2a8416..8f009c6ab 100644 --- a/chai-http/chai-http.d.ts +++ b/chai-http/chai-http.d.ts @@ -6,27 +6,38 @@ /// /// -declare module chai { - export function request(server: any): chaiHttp.Agent; +declare module Chai { - export module request { - export function agent(server: any): chaiHttp.Agent; - export function addPromises(promiseConstructor: chaiHttp.PromiseConstructor): void; + interface ChaiStatic { + request: ChaiHttpRequest; } - interface Assertions extends chaiHttp.Assertions { + interface ChaiHttpRequest { + (server: any): ChaiHttp.Agent; + agent(server: any): ChaiHttp.Agent; + addPromises(promiseConstructor: any): void; } - interface TypeComparison extends chaiHttp.TypeComparison { + interface Assertion { + status(code: number): Assertion; + header(key: string, value?: string): Assertion; + header(key: string, value?: RegExp): Assertion; + headers: Assertion; + json: Assertion; + text: Assertion; + html: Assertion; + redirect: Assertion; + redirectTo(location: string): Assertion; + param(key: string, value?: string): Assertion; + cookie(key: string, value?: string): Assertion; + } + + interface TypeComparison { + ip: Assertion; } } -declare function chaiHttp(chai: any, utils: any): void; -declare module chaiHttp { - interface PromiseConstructor { - (resolver: (resolve: (value: T) => void, reject: (reason: any) => void) => void): Promise; - } - +declare module ChaiHttp { interface Promise { then(onFulfilled: (value: T) => U, onRejected?: (reason: any) => U): Promise; } @@ -38,10 +49,9 @@ declare module chaiHttp { } interface Request extends FinishedRequest { - attach(field: string, file: string, filename: string): Request; - attach(field: string, file: Buffer, filename: string): Request; + attach(field: string, file: string|Buffer, filename: string): Request; set(field: string, val: string): Request; - query(key: string, value: string): Request; + query(params: Object): Request; send(data: Object): Request; auth(user: string, name: string): Request; field(name: string, val: string): Request; @@ -63,25 +73,12 @@ declare module chaiHttp { patch(url: string, callback?: (err: any, res: Response) => void): Request; } - interface Assertions { - status(code: number): any; - header(key: string, value?: string): any; - header(key: string, value?: RegExp): any; - headers: any; - json: any; - // text: any; - // html: any; - redirect: any; - redirectTo(location: string): any; - param(key: string, value?: string): any; - cookie(key: string, value?: string): any; - } - interface TypeComparison { ip: any; } } declare module "chai-http" { + function chaiHttp(chai: any, utils: any): void; export = chaiHttp; } diff --git a/chai-jquery/chai-jquery-tests.ts b/chai-jquery/chai-jquery-tests.ts index 45c9981f5..64f6b040b 100644 --- a/chai-jquery/chai-jquery-tests.ts +++ b/chai-jquery/chai-jquery-tests.ts @@ -1,9 +1,9 @@ -/// /// // tests taken from https://github.com/chaijs/chai-jquery -declare var $; +declare var $: ChaiJQueryStatic; +import chai = require('chai'); var expect = chai.expect; function test_attr() { @@ -19,7 +19,7 @@ function test_css() { function test_data() { expect($('#foo')).to.have.data('toggle'); expect($('#foo')).to.have.css('toggle', 'true'); - expect($('body')).to.have.css('font-family').match(/sans-serif/); + expect($('body')).to.have.css('font-family').and.match(/sans-serif/); } function test_class() { @@ -88,4 +88,4 @@ function test_be_selector() { function test_have_selector() { $('body').should.have('h1'); expect($('#foo')).to.have('div'); -} \ No newline at end of file +} diff --git a/chai-jquery/chai-jquery-tests.ts.tscparams b/chai-jquery/chai-jquery-tests.ts.tscparams deleted file mode 100644 index d3f5a12fa..000000000 --- a/chai-jquery/chai-jquery-tests.ts.tscparams +++ /dev/null @@ -1 +0,0 @@ - diff --git a/chai-jquery/chai-jquery.d.ts b/chai-jquery/chai-jquery.d.ts index 826e66579..d4eb7465f 100644 --- a/chai-jquery/chai-jquery.d.ts +++ b/chai-jquery/chai-jquery.d.ts @@ -4,34 +4,2577 @@ // Definitions: https://github.com/borisyankov/DefinitelyTyped /// +/// -declare module chai { - interface NameValueRegexMatcher { - match(value: RegExp): boolean; - } +declare module Chai { - interface NameValueMatcher { - (name: string, value?: string): boolean; - } - - interface Have { - attr: NameValueMatcher; - css: NameValueMatcher; - data: NameValueMatcher; - class(className: string): boolean; - id(id: string): boolean; - html(html: string): boolean; - text(text: string): boolean; - value(text: string): boolean; - (selector: string): boolean; - } - - interface Be { - visible: boolean; - hidden: boolean; - selected: boolean; - checked: boolean; - disabled: boolean; - (selector: string): boolean; + interface Assertion { + attr: (name: string, value?: string) => Assertion; + css: (name: string, value?: string) => Assertion; + data: (name: string, value?: string) => Assertion; + class(className: string): Assertion; + id(id: string): Assertion; + html(html: string): Assertion; + text(text: string): Assertion; + value(text: string): Assertion; + (selector: string): Assertion; + visible: Assertion; + hidden: Assertion; + selected: Assertion; + checked: Assertion; + disabled: Assertion; + (selector: string): Assertion; } } + +/** + * Static members of chai-jquery (those on $ and jQuery themselves) + */ +interface ChaiJQueryStatic { + + /** + * Perform an asynchronous HTTP (Ajax) request. + * + * @param settings A set of key/value pairs that configure the Ajax request. All settings are optional. A default can be set for any option with $.ajaxSetup(). + */ + ajax(settings: JQueryAjaxSettings): JQueryXHR; + /** + * Perform an asynchronous HTTP (Ajax) request. + * + * @param url A string containing the URL to which the request is sent. + * @param settings A set of key/value pairs that configure the Ajax request. All settings are optional. A default can be set for any option with $.ajaxSetup(). + */ + ajax(url: string, settings?: JQueryAjaxSettings): JQueryXHR; + + /** + * Handle custom Ajax options or modify existing options before each request is sent and before they are processed by $.ajax(). + * + * @param dataTypes An optional string containing one or more space-separated dataTypes + * @param handler A handler to set default values for future Ajax requests. + */ + ajaxPrefilter(dataTypes: string, handler: (opts: any, originalOpts: JQueryAjaxSettings, jqXHR: JQueryXHR) => any): void; + /** + * Handle custom Ajax options or modify existing options before each request is sent and before they are processed by $.ajax(). + * + * @param handler A handler to set default values for future Ajax requests. + */ + ajaxPrefilter(handler: (opts: any, originalOpts: JQueryAjaxSettings, jqXHR: JQueryXHR) => any): void; + + ajaxSettings: JQueryAjaxSettings; + + /** + * Set default values for future Ajax requests. Its use is not recommended. + * + * @param options A set of key/value pairs that configure the default Ajax request. All options are optional. + */ + ajaxSetup(options: JQueryAjaxSettings): void; + + /** + * Load data from the server using a HTTP GET request. + * + * @param url A string containing the URL to which the request is sent. + * @param success A callback function that is executed if the request succeeds. + * @param dataType The type of data expected from the server. Default: Intelligent Guess (xml, json, script, or html). + */ + get(url: string, success?: (data: any, textStatus: string, jqXHR: JQueryXHR) => any, dataType?: string): JQueryXHR; + /** + * Load data from the server using a HTTP GET request. + * + * @param url A string containing the URL to which the request is sent. + * @param data A plain object or string that is sent to the server with the request. + * @param success A callback function that is executed if the request succeeds. + * @param dataType The type of data expected from the server. Default: Intelligent Guess (xml, json, script, or html). + */ + get(url: string, data?: Object|string, success?: (data: any, textStatus: string, jqXHR: JQueryXHR) => any, dataType?: string): JQueryXHR; + /** + * Load JSON-encoded data from the server using a GET HTTP request. + * + * @param url A string containing the URL to which the request is sent. + * @param success A callback function that is executed if the request succeeds. + */ + getJSON(url: string, success?: (data: any, textStatus: string, jqXHR: JQueryXHR) => any): JQueryXHR; + /** + * Load JSON-encoded data from the server using a GET HTTP request. + * + * @param url A string containing the URL to which the request is sent. + * @param data A plain object or string that is sent to the server with the request. + * @param success A callback function that is executed if the request succeeds. + */ + getJSON(url: string, data?: Object|string, success?: (data: any, textStatus: string, jqXHR: JQueryXHR) => any): JQueryXHR; + /** + * Load a JavaScript file from the server using a GET HTTP request, then execute it. + * + * @param url A string containing the URL to which the request is sent. + * @param success A callback function that is executed if the request succeeds. + */ + getScript(url: string, success?: (script: string, textStatus: string, jqXHR: JQueryXHR) => any): JQueryXHR; + + /** + * Create a serialized representation of an array or object, suitable for use in a URL query string or Ajax request. + */ + param: JQueryParam; + + /** + * Load data from the server using a HTTP POST request. + * + * @param url A string containing the URL to which the request is sent. + * @param success A callback function that is executed if the request succeeds. Required if dataType is provided, but can be null in that case. + * @param dataType The type of data expected from the server. Default: Intelligent Guess (xml, json, script, text, html). + */ + post(url: string, success?: (data: any, textStatus: string, jqXHR: JQueryXHR) => any, dataType?: string): JQueryXHR; + /** + * Load data from the server using a HTTP POST request. + * + * @param url A string containing the URL to which the request is sent. + * @param data A plain object or string that is sent to the server with the request. + * @param success A callback function that is executed if the request succeeds. Required if dataType is provided, but can be null in that case. + * @param dataType The type of data expected from the server. Default: Intelligent Guess (xml, json, script, text, html). + */ + post(url: string, data?: Object|string, success?: (data: any, textStatus: string, jqXHR: JQueryXHR) => any, dataType?: string): JQueryXHR; + + /** + * A multi-purpose callbacks list object that provides a powerful way to manage callback lists. + * + * @param flags An optional list of space-separated flags that change how the callback list behaves. + */ + Callbacks(flags?: string): JQueryCallback; + + /** + * Holds or releases the execution of jQuery's ready event. + * + * @param hold Indicates whether the ready hold is being requested or released + */ + holdReady(hold: boolean): void; + + /** + * Accepts a string containing a CSS selector which is then used to match a set of elements. + * + * @param selector A string containing a selector expression + * @param context A DOM Element, Document, or jQuery to use as context + */ + (selector: string, context?: Element|JQuery): ChaiJQuery; + /** + * Accepts a string containing a CSS selector which is then used to match a set of elements. + * + * @param element A DOM element to wrap in a jQuery object. + */ + (element: Element): ChaiJQuery; + /** + * Accepts a string containing a CSS selector which is then used to match a set of elements. + * + * @param elementArray An array containing a set of DOM elements to wrap in a jQuery object. + */ + (elementArray: Element[]): ChaiJQuery; + /** + * Accepts a string containing a CSS selector which is then used to match a set of elements. + * + * @param object A plain object to wrap in a jQuery object. + */ + (object: {}): ChaiJQuery; + /** + * Accepts a string containing a CSS selector which is then used to match a set of elements. + * + * @param object An existing jQuery object to clone. + */ + (object: JQuery): ChaiJQuery; + /** + * Specify a function to execute when the DOM is fully loaded. + */ + (): ChaiJQuery; + + /** + * Creates DOM elements on the fly from the provided string of raw HTML. + * + * @param html A string of HTML to create on the fly. Note that this parses HTML, not XML. + * @param ownerDocument A document in which the new elements will be created. + */ + (html: string, ownerDocument?: Document): ChaiJQuery; + /** + * Creates DOM elements on the fly from the provided string of raw HTML. + * + * @param html A string defining a single, standalone, HTML element (e.g.
    or
    ). + * @param attributes An object of attributes, events, and methods to call on the newly-created element. + */ + (html: string, attributes: Object): ChaiJQuery; + + /** + * Binds a function to be executed when the DOM has finished loading. + * + * @param callback A function to execute after the DOM is ready. + */ + (callback: Function): ChaiJQuery; + + /** + * Relinquish jQuery's control of the $ variable. + * + * @param removeAll A Boolean indicating whether to remove all jQuery variables from the global scope (including jQuery itself). + */ + noConflict(removeAll?: boolean): Object; + + /** + * 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: 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. + */ + cssHooks: { [key: string]: any; }; + cssNumber: any; + + /** + * Store arbitrary data associated with the specified element. Returns the value that was set. + * + * @param element The DOM element to associate with the data. + * @param key A string naming the piece of data to set. + * @param value The new data value. + */ + data(element: Element, key: string, value: T): T; + /** + * Returns value at named data store for the element, as set by jQuery.data(element, name, value), or the full data store for the element. + * + * @param element The DOM element to associate with the data. + * @param key A string naming the piece of data to set. + */ + data(element: Element, key: string): any; + /** + * Returns value at named data store for the element, as set by jQuery.data(element, name, value), or the full data store for the element. + * + * @param element The DOM element to associate with the data. + */ + data(element: Element): any; + + /** + * Execute the next function on the queue for the matched element. + * + * @param element A DOM element from which to remove and execute a queued function. + * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue. + */ + dequeue(element: Element, queueName?: string): void; + + /** + * Determine whether an element has any jQuery data associated with it. + * + * @param element A DOM element to be checked for data. + */ + hasData(element: Element): boolean; + + /** + * Show the queue of functions to be executed on the matched element. + * + * @param element A DOM element to inspect for an attached queue. + * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue. + */ + queue(element: Element, queueName?: string): any[]; + /** + * Manipulate the queue of functions to be executed on the matched element. + * + * @param element A DOM element where the array of queued functions is attached. + * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue. + * @param newQueue An array of functions to replace the current queue contents. + */ + queue(element: Element, queueName: string, newQueue: Function[]): ChaiJQuery; + /** + * Manipulate the queue of functions to be executed on the matched element. + * + * @param element A DOM element on which to add a queued function. + * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue. + * @param callback The new function to add to the queue. + */ + queue(element: Element, queueName: string, callback: Function): ChaiJQuery; + + /** + * Remove a previously-stored piece of data. + * + * @param element A DOM element from which to remove data. + * @param name A string naming the piece of data to remove. + */ + removeData(element: Element, name?: string): ChaiJQuery; + + /** + * A constructor function that returns a chainable utility object with methods to register multiple callbacks into callback queues, invoke callback queues, and relay the success or failure state of any synchronous or asynchronous function. + * + * @param beforeStart A function that is called just before the constructor returns. + */ + Deferred(beforeStart?: (deferred: JQueryDeferred) => any): JQueryDeferred; + + /** + * Effects + */ + fx: { + tick: () => void; + /** + * The rate (in milliseconds) at which animations fire. + */ + interval: number; + stop: () => void; + speeds: { slow: number; fast: number; }; + /** + * Globally disable all animations. + */ + off: boolean; + step: any; + }; + + /** + * Takes a function and returns a new one that will always have a particular context. + * + * @param fnction The function whose context will be changed. + * @param context The object to which the context (this) of the function should be set. + * @param additionalArguments Any number of arguments to be passed to the function referenced in the function argument. + */ + proxy(fnction: (...args: any[]) => any, context: Object, ...additionalArguments: any[]): any; + /** + * Takes a function and returns a new one that will always have a particular context. + * + * @param context The object to which the context (this) of the function should be set. + * @param name The name of the function whose context will be changed (should be a property of the context object). + * @param additionalArguments Any number of arguments to be passed to the function named in the name argument. + */ + proxy(context: Object, name: string, ...additionalArguments: any[]): any; + + Event: JQueryEventConstructor; + + /** + * Takes a string and throws an exception containing it. + * + * @param message The message to send out. + */ + error(message: any): ChaiJQuery; + + expr: any; + fn: any; //TODO: Decide how we want to type this + + isReady: boolean; + + // Properties + support: JQuerySupport; + + /** + * Check to see if a DOM element is a descendant of another DOM element. + * + * @param container The DOM element that may contain the other element. + * @param contained The DOM element that may be contained by (a descendant of) the other element. + */ + contains(container: Element, contained: Element): boolean; + + /** + * A generic iterator function, which can be used to seamlessly iterate over both objects and arrays. Arrays and array-like objects with a length property (such as a function's arguments object) are iterated by numeric index, from 0 to length-1. Other objects are iterated via their named properties. + * + * @param collection The object or array to iterate over. + * @param callback The function that will be executed on every object. + */ + each( + collection: T[], + callback: (indexInArray: number, valueOfElement: T) => any + ): any; + + /** + * A generic iterator function, which can be used to seamlessly iterate over both objects and arrays. Arrays and array-like objects with a length property (such as a function's arguments object) are iterated by numeric index, from 0 to length-1. Other objects are iterated via their named properties. + * + * @param collection The object or array to iterate over. + * @param callback The function that will be executed on every object. + */ + each( + collection: any, + callback: (indexInArray: any, valueOfElement: any) => any + ): any; + + /** + * Merge the contents of two or more objects together into the first object. + * + * @param target An object that will receive the new properties if additional objects are passed in or that will extend the jQuery namespace if it is the sole argument. + * @param object1 An object containing additional properties to merge in. + * @param objectN Additional objects containing properties to merge in. + */ + extend(target: any, object1?: any, ...objectN: any[]): any; + /** + * Merge the contents of two or more objects together into the first object. + * + * @param deep If true, the merge becomes recursive (aka. deep copy). + * @param target The object to extend. It will receive the new properties. + * @param object1 An object containing additional properties to merge in. + * @param objectN Additional objects containing properties to merge in. + */ + extend(deep: boolean, target: any, object1?: any, ...objectN: any[]): any; + + /** + * Execute some JavaScript code globally. + * + * @param code The JavaScript code to execute. + */ + globalEval(code: string): any; + + /** + * Finds the elements of an array which satisfy a filter function. The original array is not affected. + * + * @param array The array to search through. + * @param func The function to process each item against. The first argument to the function is the item, and the second argument is the index. The function should return a Boolean value. this will be the global window object. + * @param invert If "invert" is false, or not provided, then the function returns an array consisting of all elements for which "callback" returns true. If "invert" is true, then the function returns an array consisting of all elements for which "callback" returns false. + */ + grep(array: T[], func: (elementOfArray: T, indexInArray: number) => boolean, invert?: boolean): T[]; + + /** + * Search for a specified value within an array and return its index (or -1 if not found). + * + * @param value The value to search for. + * @param array An array through which to search. + * @param fromIndex he index of the array at which to begin the search. The default is 0, which will search the whole array. + */ + inArray(value: T, array: T[], fromIndex?: number): number; + + /** + * Determine whether the argument is an array. + * + * @param obj Object to test whether or not it is an array. + */ + isArray(obj: any): boolean; + /** + * Check to see if an object is empty (contains no enumerable properties). + * + * @param obj The object that will be checked to see if it's empty. + */ + isEmptyObject(obj: any): boolean; + /** + * Determine if the argument passed is a Javascript function object. + * + * @param obj Object to test whether or not it is a function. + */ + isFunction(obj: any): boolean; + /** + * Determines whether its argument is a number. + * + * @param obj The value to be tested. + */ + isNumeric(value: any): boolean; + /** + * Check to see if an object is a plain object (created using "{}" or "new Object"). + * + * @param obj The object that will be checked to see if it's a plain object. + */ + isPlainObject(obj: any): boolean; + /** + * Determine whether the argument is a window. + * + * @param obj Object to test whether or not it is a window. + */ + isWindow(obj: any): boolean; + /** + * Check to see if a DOM node is within an XML document (or is an XML document). + * + * @param node he DOM node that will be checked to see if it's in an XML document. + */ + isXMLDoc(node: Node): boolean; + + /** + * Convert an array-like object into a true JavaScript array. + * + * @param obj Any object to turn into a native Array. + */ + makeArray(obj: any): any[]; + + /** + * Translate all items in an array or object to new array of items. + * + * @param array The Array to translate. + * @param callback The function to process each item against. The first argument to the function is the array item, the second argument is the index in array The function can return any value. Within the function, this refers to the global (window) object. + */ + map(array: T[], callback: (elementOfArray: T, indexInArray: number) => U): U[]; + /** + * Translate all items in an array or object to new array of items. + * + * @param arrayOrObject The Array or Object to translate. + * @param callback The function to process each item against. The first argument to the function is the value; the second argument is the index or key of the array or object property. The function can return any value to add to the array. A returned array will be flattened into the resulting array. Within the function, this refers to the global (window) object. + */ + map(arrayOrObject: any, callback: (value: any, indexOrKey: any) => any): any; + + /** + * Merge the contents of two arrays together into the first array. + * + * @param first The first array to merge, the elements of second added. + * @param second The second array to merge into the first, unaltered. + */ + merge(first: T[], second: T[]): T[]; + + /** + * An empty function. + */ + noop(): any; + + /** + * Return a number representing the current time. + */ + now(): number; + + /** + * Takes a well-formed JSON string and returns the resulting JavaScript object. + * + * @param json The JSON string to parse. + */ + parseJSON(json: string): any; + + /** + * Parses a string into an XML document. + * + * @param data a well-formed XML string to be parsed + */ + parseXML(data: string): XMLDocument; + + /** + * Remove the whitespace from the beginning and end of a string. + * + * @param str Remove the whitespace from the beginning and end of a string. + */ + trim(str: string): string; + + /** + * Determine the internal JavaScript [[Class]] of an object. + * + * @param obj Object to get the internal JavaScript [[Class]] of. + */ + type(obj: any): string; + + /** + * Sorts an array of DOM elements, in place, with the duplicates removed. Note that this only works on arrays of DOM elements, not strings or numbers. + * + * @param array The Array of DOM elements. + */ + unique(array: Element[]): Element[]; + + /** + * Parses a string into an array of DOM nodes. + * + * @param data HTML string to be parsed + * @param context DOM element to serve as the context in which the HTML fragment will be created + * @param keepScripts A Boolean indicating whether to include scripts passed in the HTML string + */ + parseHTML(data: string, context?: HTMLElement, keepScripts?: boolean): any[]; + + /** + * Parses a string into an array of DOM nodes. + * + * @param data HTML string to be parsed + * @param context DOM element to serve as the context in which the HTML fragment will be created + * @param keepScripts A Boolean indicating whether to include scripts passed in the HTML string + */ + parseHTML(data: string, context?: Document, keepScripts?: boolean): any[]; +} + +/** + * The chai-jquery instance members + */ +interface ChaiJQuery { + /** + * Register a handler to be called when Ajax requests complete. This is an AjaxEvent. + * + * @param handler The function to be invoked. + */ + ajaxComplete(handler: (event: JQueryEventObject, XMLHttpRequest: XMLHttpRequest, ajaxOptions: any) => any): ChaiJQuery; + /** + * Register a handler to be called when Ajax requests complete with an error. This is an Ajax Event. + * + * @param handler The function to be invoked. + */ + ajaxError(handler: (event: JQueryEventObject, jqXHR: JQueryXHR, ajaxSettings: JQueryAjaxSettings, thrownError: any) => any): ChaiJQuery; + /** + * Attach a function to be executed before an Ajax request is sent. This is an Ajax Event. + * + * @param handler The function to be invoked. + */ + ajaxSend(handler: (event: JQueryEventObject, jqXHR: JQueryXHR, ajaxOptions: JQueryAjaxSettings) => any): ChaiJQuery; + /** + * Register a handler to be called when the first Ajax request begins. This is an Ajax Event. + * + * @param handler The function to be invoked. + */ + ajaxStart(handler: () => any): ChaiJQuery; + /** + * Register a handler to be called when all Ajax requests have completed. This is an Ajax Event. + * + * @param handler The function to be invoked. + */ + ajaxStop(handler: () => any): ChaiJQuery; + /** + * Attach a function to be executed whenever an Ajax request completes successfully. This is an Ajax Event. + * + * @param handler The function to be invoked. + */ + ajaxSuccess(handler: (event: JQueryEventObject, XMLHttpRequest: XMLHttpRequest, ajaxOptions: JQueryAjaxSettings) => any): ChaiJQuery; + + /** + * Load data from the server and place the returned HTML into the matched element. + * + * @param url A string containing the URL to which the request is sent. + * @param data A plain object or string that is sent to the server with the request. + * @param complete A callback function that is executed when the request completes. + */ + load(url: string, data?: string|Object, complete?: (responseText: string, textStatus: string, XMLHttpRequest: XMLHttpRequest) => any): ChaiJQuery; + + /** + * Encode a set of form elements as a string for submission. + */ + serialize(): string; + /** + * Encode a set of form elements as an array of names and values. + */ + serializeArray(): JQuerySerializeArrayElement[]; + + /** + * Adds the specified class(es) to each of the set of matched elements. + * + * @param className One or more space-separated classes to be added to the class attribute of each matched element. + */ + addClass(className: string): ChaiJQuery; + /** + * Adds the specified class(es) to each of the set of matched elements. + * + * @param function A function returning one or more space-separated class names to be added to the existing class name(s). Receives the index position of the element in the set and the existing class name(s) as arguments. Within the function, this refers to the current element in the set. + */ + addClass(func: (index: number, className: string) => string): ChaiJQuery; + + /** + * Add the previous set of elements on the stack to the current set, optionally filtered by a selector. + */ + addBack(selector?: string): ChaiJQuery; + + /** + * Get the value of an attribute for the first element in the set of matched elements. + * + * @param attributeName The name of the attribute to get. + */ + attr(attributeName: string): string; + /** + * Set one or more attributes for the set of matched elements. + * + * @param attributeName The name of the attribute to set. + * @param value A value to set for the attribute. + */ + attr(attributeName: string, value: string|number): ChaiJQuery; + /** + * Set one or more attributes for the set of matched elements. + * + * @param attributeName The name of the attribute to set. + * @param func A function returning the value to set. this is the current element. Receives the index position of the element in the set and the old attribute value as arguments. + */ + attr(attributeName: string, func: (index: number, attr: string) => string|number): ChaiJQuery; + /** + * Set one or more attributes for the set of matched elements. + * + * @param attributes An object of attribute-value pairs to set. + */ + attr(attributes: Object): ChaiJQuery; + + /** + * Determine whether any of the matched elements are assigned the given class. + * + * @param className The class name to search for. + */ + hasClass(className: string): boolean; + + /** + * Get the HTML contents of the first element in the set of matched elements. + */ + html(): string; + /** + * Set the HTML contents of each element in the set of matched elements. + * + * @param htmlString A string of HTML to set as the content of each matched element. + */ + html(htmlString: string): ChaiJQuery; + /** + * Set the HTML contents of each element in the set of matched elements. + * + * @param func A function returning the HTML content to set. Receives the index position of the element in the set and the old HTML value as arguments. jQuery empties the element before calling the function; use the oldhtml argument to reference the previous content. Within the function, this refers to the current element in the set. + */ + html(func: (index: number, oldhtml: string) => string): ChaiJQuery; + /** + * Set the HTML contents of each element in the set of matched elements. + * + * @param func A function returning the HTML content to set. Receives the index position of the element in the set and the old HTML value as arguments. jQuery empties the element before calling the function; use the oldhtml argument to reference the previous content. Within the function, this refers to the current element in the set. + */ + + /** + * Get the value of a property for the first element in the set of matched elements. + * + * @param propertyName The name of the property to get. + */ + prop(propertyName: string): any; + /** + * Set one or more properties for the set of matched elements. + * + * @param propertyName The name of the property to set. + * @param value A value to set for the property. + */ + prop(propertyName: string, value: string|number|boolean): ChaiJQuery; + /** + * Set one or more properties for the set of matched elements. + * + * @param properties An object of property-value pairs to set. + */ + prop(properties: Object): ChaiJQuery; + /** + * Set one or more properties for the set of matched elements. + * + * @param propertyName The name of the property to set. + * @param func A function returning the value to set. Receives the index position of the element in the set and the old property value as arguments. Within the function, the keyword this refers to the current element. + */ + prop(propertyName: string, func: (index: number, oldPropertyValue: any) => any): ChaiJQuery; + + /** + * Remove an attribute from each element in the set of matched elements. + * + * @param attributeName An attribute to remove; as of version 1.7, it can be a space-separated list of attributes. + */ + removeAttr(attributeName: string): ChaiJQuery; + + /** + * Remove a single class, multiple classes, or all classes from each element in the set of matched elements. + * + * @param className One or more space-separated classes to be removed from the class attribute of each matched element. + */ + removeClass(className?: string): ChaiJQuery; + /** + * Remove a single class, multiple classes, or all classes from each element in the set of matched elements. + * + * @param function A function returning one or more space-separated class names to be removed. Receives the index position of the element in the set and the old class value as arguments. + */ + removeClass(func: (index: number, className: string) => string): ChaiJQuery; + + /** + * Remove a property for the set of matched elements. + * + * @param propertyName The name of the property to remove. + */ + removeProp(propertyName: string): ChaiJQuery; + + /** + * Add or remove one or more classes from each element in the set of matched elements, depending on either the class's presence or the value of the switch argument. + * + * @param className One or more class names (separated by spaces) to be toggled for each element in the matched set. + * @param swtch A Boolean (not just truthy/falsy) value to determine whether the class should be added or removed. + */ + toggleClass(className: string, swtch?: boolean): ChaiJQuery; + /** + * Add or remove one or more classes from each element in the set of matched elements, depending on either the class's presence or the value of the switch argument. + * + * @param swtch A boolean value to determine whether the class should be added or removed. + */ + toggleClass(swtch?: boolean): ChaiJQuery; + /** + * Add or remove one or more classes from each element in the set of matched elements, depending on either the class's presence or the value of the switch argument. + * + * @param func A function that returns class names to be toggled in the class attribute of each element in the matched set. Receives the index position of the element in the set, the old class value, and the switch as arguments. + * @param swtch A boolean value to determine whether the class should be added or removed. + */ + toggleClass(func: (index: number, className: string, swtch: boolean) => string, swtch?: boolean): ChaiJQuery; + + /** + * Get the current value of the first element in the set of matched elements. + */ + val(): any; + /** + * Set the value of each element in the set of matched elements. + * + * @param value A string of text or an array of strings corresponding to the value of each matched element to set as selected/checked. + */ + val(value: string|string[]): ChaiJQuery; + /** + * Set the value of each element in the set of matched elements. + * + * @param func A function returning the value to set. this is the current element. Receives the index position of the element in the set and the old value as arguments. + */ + val(func: (index: number, value: string) => string): ChaiJQuery; + + + /** + * Get the value of style properties for the first element in the set of matched elements. + * + * @param propertyName A CSS property. + */ + css(propertyName: string): string; + /** + * Set one or more CSS properties for the set of matched elements. + * + * @param propertyName A CSS property name. + * @param value A value to set for the property. + */ + css(propertyName: string, value: string|number): ChaiJQuery; + /** + * Set one or more CSS properties for the set of matched elements. + * + * @param propertyName A CSS property name. + * @param value A function returning the value to set. this is the current element. Receives the index position of the element in the set and the old value as arguments. + */ + css(propertyName: string, value: (index: number, value: string) => string|number): ChaiJQuery; + /** + * Set one or more CSS properties for the set of matched elements. + * + * @param properties An object of property-value pairs to set. + */ + css(properties: Object): ChaiJQuery; + + /** + * Get the current computed height for the first element in the set of matched elements. + */ + height(): number; + /** + * Set the CSS height of every matched element. + * + * @param value An integer representing the number of pixels, or an integer with an optional unit of measure appended (as a string). + */ + height(value: number|string): ChaiJQuery; + /** + * Set the CSS height of every matched element. + * + * @param func A function returning the height to set. Receives the index position of the element in the set and the old height as arguments. Within the function, this refers to the current element in the set. + */ + height(func: (index: number, height: number) => number|string): ChaiJQuery; + + /** + * Get the current computed height for the first element in the set of matched elements, including padding but not border. + */ + innerHeight(): number; + + /** + * Sets the inner height on elements in the set of matched elements, including padding but not border. + * + * @param value An integer representing the number of pixels, or an integer along with an optional unit of measure appended (as a string). + */ + innerHeight(height: number|string): ChaiJQuery; + + /** + * Get the current computed width for the first element in the set of matched elements, including padding but not border. + */ + innerWidth(): number; + + /** + * Sets the inner width on elements in the set of matched elements, including padding but not border. + * + * @param value An integer representing the number of pixels, or an integer along with an optional unit of measure appended (as a string). + */ + innerWidth(width: number|string): ChaiJQuery; + + /** + * Get the current coordinates of the first element in the set of matched elements, relative to the document. + */ + offset(): JQueryCoordinates; + /** + * An object containing the properties top and left, which are integers indicating the new top and left coordinates for the elements. + * + * @param coordinates An object containing the properties top and left, which are integers indicating the new top and left coordinates for the elements. + */ + offset(coordinates: JQueryCoordinates): ChaiJQuery; + /** + * An object containing the properties top and left, which are integers indicating the new top and left coordinates for the elements. + * + * @param func A function to return the coordinates to set. Receives the index of the element in the collection as the first argument and the current coordinates as the second argument. The function should return an object with the new top and left properties. + */ + offset(func: (index: number, coords: JQueryCoordinates) => JQueryCoordinates): ChaiJQuery; + + /** + * Get the current computed height for the first element in the set of matched elements, including padding, border, and optionally margin. Returns an integer (without "px") representation of the value or null if called on an empty set of elements. + * + * @param includeMargin A Boolean indicating whether to include the element's margin in the calculation. + */ + outerHeight(includeMargin?: boolean): number; + + /** + * Sets the outer height on elements in the set of matched elements, including padding and border. + * + * @param value An integer representing the number of pixels, or an integer along with an optional unit of measure appended (as a string). + */ + outerHeight(height: number|string): ChaiJQuery; + + /** + * Get the current computed width for the first element in the set of matched elements, including padding and border. + * + * @param includeMargin A Boolean indicating whether to include the element's margin in the calculation. + */ + outerWidth(includeMargin?: boolean): number; + + /** + * Sets the outer width on elements in the set of matched elements, including padding and border. + * + * @param value An integer representing the number of pixels, or an integer along with an optional unit of measure appended (as a string). + */ + outerWidth(width: number|string): ChaiJQuery; + + /** + * Get the current coordinates of the first element in the set of matched elements, relative to the offset parent. + */ + position(): JQueryCoordinates; + + /** + * Get the current horizontal position of the scroll bar for the first element in the set of matched elements or set the horizontal position of the scroll bar for every matched element. + */ + scrollLeft(): number; + /** + * Set the current horizontal position of the scroll bar for each of the set of matched elements. + * + * @param value An integer indicating the new position to set the scroll bar to. + */ + scrollLeft(value: number): ChaiJQuery; + + /** + * Get the current vertical position of the scroll bar for the first element in the set of matched elements or set the vertical position of the scroll bar for every matched element. + */ + scrollTop(): number; + /** + * Set the current vertical position of the scroll bar for each of the set of matched elements. + * + * @param value An integer indicating the new position to set the scroll bar to. + */ + scrollTop(value: number): ChaiJQuery; + + /** + * Get the current computed width for the first element in the set of matched elements. + */ + width(): number; + /** + * Set the CSS width of each element in the set of matched elements. + * + * @param value An integer representing the number of pixels, or an integer along with an optional unit of measure appended (as a string). + */ + width(value: number|string): ChaiJQuery; + /** + * Set the CSS width of each element in the set of matched elements. + * + * @param func A function returning the width to set. Receives the index position of the element in the set and the old width as arguments. Within the function, this refers to the current element in the set. + */ + width(func: (index: number, width: number) => number|string): ChaiJQuery; + + /** + * Remove from the queue all items that have not yet been run. + * + * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue. + */ + clearQueue(queueName?: string): ChaiJQuery; + + /** + * Store arbitrary data associated with the matched elements. + * + * @param key A string naming the piece of data to set. + * @param value The new data value; it can be any Javascript type including Array or Object. + */ + data(key: string, value: any): ChaiJQuery; + /** + * Store arbitrary data associated with the matched elements. + * + * @param obj An object of key-value pairs of data to update. + */ + data(obj: { [key: string]: any; }): ChaiJQuery; + /** + * Return the value at the named data store for the first element in the jQuery collection, as set by data(name, value) or by an HTML5 data-* attribute. + * + * @param key Name of the data stored. + */ + data(key: string): any; + /** + * Return the value at the named data store for the first element in the jQuery collection, as set by data(name, value) or by an HTML5 data-* attribute. + */ + data(): any; + + /** + * Execute the next function on the queue for the matched elements. + * + * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue. + */ + dequeue(queueName?: string): ChaiJQuery; + + /** + * Remove a previously-stored piece of data. + * + * @param name A string naming the piece of data to delete or space-separated string naming the pieces of data to delete. + */ + removeData(name: string): ChaiJQuery; + /** + * Remove a previously-stored piece of data. + * + * @param list An array of strings naming the pieces of data to delete. + */ + removeData(list: string[]): ChaiJQuery; + + /** + * Return a Promise object to observe when all actions of a certain type bound to the collection, queued or not, have finished. + * + * @param type The type of queue that needs to be observed. (default: fx) + * @param target Object onto which the promise methods have to be attached + */ + promise(type?: string, target?: Object): JQueryPromise; + + /** + * Perform a custom animation of a set of CSS properties. + * + * @param properties An object of CSS properties and values that the animation will move toward. + * @param duration A string or number determining how long the animation will run. + * @param complete A function to call once the animation is complete. + */ + animate(properties: Object, duration?: string|number, complete?: Function): ChaiJQuery; + /** + * Perform a custom animation of a set of CSS properties. + * + * @param properties An object of CSS properties and values that the animation will move toward. + * @param duration A string or number determining how long the animation will run. + * @param easing A string indicating which easing function to use for the transition. (default: swing) + * @param complete A function to call once the animation is complete. + */ + animate(properties: Object, duration?: string|number, easing?: string, complete?: Function): ChaiJQuery; + /** + * Perform a custom animation of a set of CSS properties. + * + * @param properties An object of CSS properties and values that the animation will move toward. + * @param options A map of additional options to pass to the method. + */ + animate(properties: Object, options: JQueryAnimationOptions): ChaiJQuery; + + /** + * Set a timer to delay execution of subsequent items in the queue. + * + * @param duration An integer indicating the number of milliseconds to delay execution of the next item in the queue. + * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue. + */ + delay(duration: number, queueName?: string): ChaiJQuery; + + /** + * Display the matched elements by fading them to opaque. + * + * @param duration A string or number determining how long the animation will run. + * @param complete A function to call once the animation is complete. + */ + fadeIn(duration?: number|string, complete?: Function): ChaiJQuery; + /** + * Display the matched elements by fading them to opaque. + * + * @param duration A string or number determining how long the animation will run. + * @param easing A string indicating which easing function to use for the transition. + * @param complete A function to call once the animation is complete. + */ + fadeIn(duration?: number|string, easing?: string, complete?: Function): ChaiJQuery; + /** + * Display the matched elements by fading them to opaque. + * + * @param options A map of additional options to pass to the method. + */ + fadeIn(options: JQueryAnimationOptions): ChaiJQuery; + + /** + * Hide the matched elements by fading them to transparent. + * + * @param duration A string or number determining how long the animation will run. + * @param complete A function to call once the animation is complete. + */ + fadeOut(duration?: number|string, complete?: Function): ChaiJQuery; + /** + * Hide the matched elements by fading them to transparent. + * + * @param duration A string or number determining how long the animation will run. + * @param easing A string indicating which easing function to use for the transition. + * @param complete A function to call once the animation is complete. + */ + fadeOut(duration?: number|string, easing?: string, complete?: Function): ChaiJQuery; + /** + * Hide the matched elements by fading them to transparent. + * + * @param options A map of additional options to pass to the method. + */ + fadeOut(options: JQueryAnimationOptions): ChaiJQuery; + + /** + * Adjust the opacity of the matched elements. + * + * @param duration A string or number determining how long the animation will run. + * @param opacity A number between 0 and 1 denoting the target opacity. + * @param complete A function to call once the animation is complete. + */ + fadeTo(duration: string|number, opacity: number, complete?: Function): ChaiJQuery; + /** + * Adjust the opacity of the matched elements. + * + * @param duration A string or number determining how long the animation will run. + * @param opacity A number between 0 and 1 denoting the target opacity. + * @param easing A string indicating which easing function to use for the transition. + * @param complete A function to call once the animation is complete. + */ + fadeTo(duration: string|number, opacity: number, easing?: string, complete?: Function): ChaiJQuery; + + /** + * Display or hide the matched elements by animating their opacity. + * + * @param duration A string or number determining how long the animation will run. + * @param complete A function to call once the animation is complete. + */ + fadeToggle(duration?: number|string, complete?: Function): ChaiJQuery; + /** + * Display or hide the matched elements by animating their opacity. + * + * @param duration A string or number determining how long the animation will run. + * @param easing A string indicating which easing function to use for the transition. + * @param complete A function to call once the animation is complete. + */ + fadeToggle(duration?: number|string, easing?: string, complete?: Function): ChaiJQuery; + /** + * Display or hide the matched elements by animating their opacity. + * + * @param options A map of additional options to pass to the method. + */ + fadeToggle(options: JQueryAnimationOptions): ChaiJQuery; + + /** + * Stop the currently-running animation, remove all queued animations, and complete all animations for the matched elements. + * + * @param queue The name of the queue in which to stop animations. + */ + finish(queue?: string): ChaiJQuery; + + /** + * Hide the matched elements. + * + * @param duration A string or number determining how long the animation will run. + * @param complete A function to call once the animation is complete. + */ + hide(duration?: number|string, complete?: Function): ChaiJQuery; + /** + * Hide the matched elements. + * + * @param duration A string or number determining how long the animation will run. + * @param easing A string indicating which easing function to use for the transition. + * @param complete A function to call once the animation is complete. + */ + hide(duration?: number|string, easing?: string, complete?: Function): ChaiJQuery; + /** + * Hide the matched elements. + * + * @param options A map of additional options to pass to the method. + */ + hide(options: JQueryAnimationOptions): ChaiJQuery; + + /** + * Display the matched elements. + * + * @param duration A string or number determining how long the animation will run. + * @param complete A function to call once the animation is complete. + */ + show(duration?: number|string, complete?: Function): ChaiJQuery; + /** + * Display the matched elements. + * + * @param duration A string or number determining how long the animation will run. + * @param easing A string indicating which easing function to use for the transition. + * @param complete A function to call once the animation is complete. + */ + show(duration?: number|string, easing?: string, complete?: Function): ChaiJQuery; + /** + * Display the matched elements. + * + * @param options A map of additional options to pass to the method. + */ + show(options: JQueryAnimationOptions): ChaiJQuery; + + /** + * Display the matched elements with a sliding motion. + * + * @param duration A string or number determining how long the animation will run. + * @param complete A function to call once the animation is complete. + */ + slideDown(duration?: number|string, complete?: Function): ChaiJQuery; + /** + * Display the matched elements with a sliding motion. + * + * @param duration A string or number determining how long the animation will run. + * @param easing A string indicating which easing function to use for the transition. + * @param complete A function to call once the animation is complete. + */ + slideDown(duration?: number|string, easing?: string, complete?: Function): ChaiJQuery; + /** + * Display the matched elements with a sliding motion. + * + * @param options A map of additional options to pass to the method. + */ + slideDown(options: JQueryAnimationOptions): ChaiJQuery; + + /** + * Display or hide the matched elements with a sliding motion. + * + * @param duration A string or number determining how long the animation will run. + * @param complete A function to call once the animation is complete. + */ + slideToggle(duration?: number|string, complete?: Function): ChaiJQuery; + /** + * Display or hide the matched elements with a sliding motion. + * + * @param duration A string or number determining how long the animation will run. + * @param easing A string indicating which easing function to use for the transition. + * @param complete A function to call once the animation is complete. + */ + slideToggle(duration?: number|string, easing?: string, complete?: Function): ChaiJQuery; + /** + * Display or hide the matched elements with a sliding motion. + * + * @param options A map of additional options to pass to the method. + */ + slideToggle(options: JQueryAnimationOptions): ChaiJQuery; + + /** + * Hide the matched elements with a sliding motion. + * + * @param duration A string or number determining how long the animation will run. + * @param complete A function to call once the animation is complete. + */ + slideUp(duration?: number|string, complete?: Function): ChaiJQuery; + /** + * Hide the matched elements with a sliding motion. + * + * @param duration A string or number determining how long the animation will run. + * @param easing A string indicating which easing function to use for the transition. + * @param complete A function to call once the animation is complete. + */ + slideUp(duration?: number|string, easing?: string, complete?: Function): ChaiJQuery; + /** + * Hide the matched elements with a sliding motion. + * + * @param options A map of additional options to pass to the method. + */ + slideUp(options: JQueryAnimationOptions): ChaiJQuery; + + /** + * Stop the currently-running animation on the matched elements. + * + * @param clearQueue A Boolean indicating whether to remove queued animation as well. Defaults to false. + * @param jumpToEnd A Boolean indicating whether to complete the current animation immediately. Defaults to false. + */ + stop(clearQueue?: boolean, jumpToEnd?: boolean): ChaiJQuery; + /** + * Stop the currently-running animation on the matched elements. + * + * @param queue The name of the queue in which to stop animations. + * @param clearQueue A Boolean indicating whether to remove queued animation as well. Defaults to false. + * @param jumpToEnd A Boolean indicating whether to complete the current animation immediately. Defaults to false. + */ + stop(queue?: string, clearQueue?: boolean, jumpToEnd?: boolean): ChaiJQuery; + + /** + * Display or hide the matched elements. + * + * @param duration A string or number determining how long the animation will run. + * @param complete A function to call once the animation is complete. + */ + toggle(duration?: number|string, complete?: Function): ChaiJQuery; + /** + * Display or hide the matched elements. + * + * @param duration A string or number determining how long the animation will run. + * @param easing A string indicating which easing function to use for the transition. + * @param complete A function to call once the animation is complete. + */ + toggle(duration?: number|string, easing?: string, complete?: Function): ChaiJQuery; + /** + * Display or hide the matched elements. + * + * @param options A map of additional options to pass to the method. + */ + toggle(options: JQueryAnimationOptions): ChaiJQuery; + /** + * Display or hide the matched elements. + * + * @param showOrHide A Boolean indicating whether to show or hide the elements. + */ + toggle(showOrHide: boolean): ChaiJQuery; + + /** + * Attach a handler to an event for the elements. + * + * @param eventType A string containing one or more DOM event types, such as "click" or "submit," or custom event names. + * @param eventData An object containing data that will be passed to the event handler. + * @param handler A function to execute each time the event is triggered. + */ + bind(eventType: string, eventData: any, handler: (eventObject: JQueryEventObject) => any): ChaiJQuery; + /** + * Attach a handler to an event for the elements. + * + * @param eventType A string containing one or more DOM event types, such as "click" or "submit," or custom event names. + * @param handler A function to execute each time the event is triggered. + */ + bind(eventType: string, handler: (eventObject: JQueryEventObject) => any): ChaiJQuery; + /** + * Attach a handler to an event for the elements. + * + * @param eventType A string containing one or more DOM event types, such as "click" or "submit," or custom event names. + * @param eventData An object containing data that will be passed to the event handler. + * @param preventBubble Setting the third argument to false will attach a function that prevents the default action from occurring and stops the event from bubbling. The default is true. + */ + bind(eventType: string, eventData: any, preventBubble: boolean): ChaiJQuery; + /** + * Attach a handler to an event for the elements. + * + * @param eventType A string containing one or more DOM event types, such as "click" or "submit," or custom event names. + * @param preventBubble Setting the third argument to false will attach a function that prevents the default action from occurring and stops the event from bubbling. The default is true. + */ + bind(eventType: string, preventBubble: boolean): ChaiJQuery; + /** + * Attach a handler to an event for the elements. + * + * @param events An object containing one or more DOM event types and functions to execute for them. + */ + bind(events: any): ChaiJQuery; + + /** + * Trigger the "blur" event on an element + */ + blur(): ChaiJQuery; + /** + * Bind an event handler to the "blur" JavaScript event + * + * @param handler A function to execute each time the event is triggered. + */ + blur(handler: (eventObject: JQueryEventObject) => any): ChaiJQuery; + /** + * Bind an event handler to the "blur" JavaScript event + * + * @param eventData An object containing data that will be passed to the event handler. + * @param handler A function to execute each time the event is triggered. + */ + blur(eventData?: any, handler?: (eventObject: JQueryEventObject) => any): ChaiJQuery; + + /** + * Trigger the "change" event on an element. + */ + change(): ChaiJQuery; + /** + * Bind an event handler to the "change" JavaScript event + * + * @param handler A function to execute each time the event is triggered. + */ + change(handler: (eventObject: JQueryEventObject) => any): ChaiJQuery; + /** + * Bind an event handler to the "change" JavaScript event + * + * @param eventData An object containing data that will be passed to the event handler. + * @param handler A function to execute each time the event is triggered. + */ + change(eventData?: any, handler?: (eventObject: JQueryEventObject) => any): ChaiJQuery; + + /** + * Trigger the "click" event on an element. + */ + click(): ChaiJQuery; + /** + * Bind an event handler to the "click" JavaScript event + * + * @param eventData An object containing data that will be passed to the event handler. + */ + click(handler: (eventObject: JQueryEventObject) => any): ChaiJQuery; + /** + * Bind an event handler to the "click" JavaScript event + * + * @param eventData An object containing data that will be passed to the event handler. + * @param handler A function to execute each time the event is triggered. + */ + click(eventData?: any, handler?: (eventObject: JQueryEventObject) => any): ChaiJQuery; + + /** + * Trigger the "dblclick" event on an element. + */ + dblclick(): ChaiJQuery; + /** + * Bind an event handler to the "dblclick" JavaScript event + * + * @param handler A function to execute each time the event is triggered. + */ + dblclick(handler: (eventObject: JQueryEventObject) => any): ChaiJQuery; + /** + * Bind an event handler to the "dblclick" JavaScript event + * + * @param eventData An object containing data that will be passed to the event handler. + * @param handler A function to execute each time the event is triggered. + */ + dblclick(eventData?: any, handler?: (eventObject: JQueryEventObject) => any): ChaiJQuery; + + delegate(selector: any, eventType: string, handler: (eventObject: JQueryEventObject) => any): ChaiJQuery; + delegate(selector: any, eventType: string, eventData: any, handler: (eventObject: JQueryEventObject) => any): ChaiJQuery; + + /** + * Trigger the "focus" event on an element. + */ + focus(): ChaiJQuery; + /** + * Bind an event handler to the "focus" JavaScript event + * + * @param handler A function to execute each time the event is triggered. + */ + focus(handler: (eventObject: JQueryEventObject) => any): ChaiJQuery; + /** + * Bind an event handler to the "focus" JavaScript event + * + * @param eventData An object containing data that will be passed to the event handler. + * @param handler A function to execute each time the event is triggered. + */ + focus(eventData?: any, handler?: (eventObject: JQueryEventObject) => any): ChaiJQuery; + + /** + * Bind an event handler to the "focusin" JavaScript event + * + * @param handler A function to execute each time the event is triggered. + */ + focusin(handler: (eventObject: JQueryEventObject) => any): ChaiJQuery; + /** + * Bind an event handler to the "focusin" JavaScript event + * + * @param eventData An object containing data that will be passed to the event handler. + * @param handler A function to execute each time the event is triggered. + */ + focusin(eventData: Object, handler: (eventObject: JQueryEventObject) => any): ChaiJQuery; + + /** + * Bind an event handler to the "focusout" JavaScript event + * + * @param handler A function to execute each time the event is triggered. + */ + focusout(handler: (eventObject: JQueryEventObject) => any): ChaiJQuery; + /** + * Bind an event handler to the "focusout" JavaScript event + * + * @param eventData An object containing data that will be passed to the event handler. + * @param handler A function to execute each time the event is triggered. + */ + focusout(eventData: Object, handler: (eventObject: JQueryEventObject) => any): ChaiJQuery; + + /** + * Bind two handlers to the matched elements, to be executed when the mouse pointer enters and leaves the elements. + * + * @param handlerIn A function to execute when the mouse pointer enters the element. + * @param handlerOut A function to execute when the mouse pointer leaves the element. + */ + hover(handlerIn: (eventObject: JQueryEventObject) => any, handlerOut: (eventObject: JQueryEventObject) => any): ChaiJQuery; + /** + * Bind a single handler to the matched elements, to be executed when the mouse pointer enters or leaves the elements. + * + * @param handlerInOut A function to execute when the mouse pointer enters or leaves the element. + */ + hover(handlerInOut: (eventObject: JQueryEventObject) => any): ChaiJQuery; + + /** + * Trigger the "keydown" event on an element. + */ + keydown(): ChaiJQuery; + /** + * Bind an event handler to the "keydown" JavaScript event + * + * @param handler A function to execute each time the event is triggered. + */ + keydown(handler: (eventObject: JQueryKeyEventObject) => any): ChaiJQuery; + /** + * Bind an event handler to the "keydown" JavaScript event + * + * @param eventData An object containing data that will be passed to the event handler. + * @param handler A function to execute each time the event is triggered. + */ + keydown(eventData?: any, handler?: (eventObject: JQueryKeyEventObject) => any): ChaiJQuery; + + /** + * Trigger the "keypress" event on an element. + */ + keypress(): ChaiJQuery; + /** + * Bind an event handler to the "keypress" JavaScript event + * + * @param handler A function to execute each time the event is triggered. + */ + keypress(handler: (eventObject: JQueryKeyEventObject) => any): ChaiJQuery; + /** + * Bind an event handler to the "keypress" JavaScript event + * + * @param eventData An object containing data that will be passed to the event handler. + * @param handler A function to execute each time the event is triggered. + */ + keypress(eventData?: any, handler?: (eventObject: JQueryKeyEventObject) => any): ChaiJQuery; + + /** + * Trigger the "keyup" event on an element. + */ + keyup(): ChaiJQuery; + /** + * Bind an event handler to the "keyup" JavaScript event + * + * @param handler A function to execute each time the event is triggered. + */ + keyup(handler: (eventObject: JQueryKeyEventObject) => any): ChaiJQuery; + /** + * Bind an event handler to the "keyup" JavaScript event + * + * @param eventData An object containing data that will be passed to the event handler. + * @param handler A function to execute each time the event is triggered. + */ + keyup(eventData?: any, handler?: (eventObject: JQueryKeyEventObject) => any): ChaiJQuery; + + /** + * Bind an event handler to the "load" JavaScript event. + * + * @param handler A function to execute when the event is triggered. + */ + load(handler: (eventObject: JQueryEventObject) => any): ChaiJQuery; + /** + * Bind an event handler to the "load" JavaScript event. + * + * @param eventData An object containing data that will be passed to the event handler. + * @param handler A function to execute when the event is triggered. + */ + load(eventData?: any, handler?: (eventObject: JQueryEventObject) => any): ChaiJQuery; + + /** + * Trigger the "mousedown" event on an element. + */ + mousedown(): ChaiJQuery; + /** + * Bind an event handler to the "mousedown" JavaScript event. + * + * @param handler A function to execute when the event is triggered. + */ + mousedown(handler: (eventObject: JQueryMouseEventObject) => any): ChaiJQuery; + /** + * Bind an event handler to the "mousedown" JavaScript event. + * + * @param eventData An object containing data that will be passed to the event handler. + * @param handler A function to execute when the event is triggered. + */ + mousedown(eventData: Object, handler: (eventObject: JQueryMouseEventObject) => any): ChaiJQuery; + + /** + * Trigger the "mouseenter" event on an element. + */ + mouseenter(): ChaiJQuery; + /** + * Bind an event handler to be fired when the mouse enters an element. + * + * @param handler A function to execute when the event is triggered. + */ + mouseenter(handler: (eventObject: JQueryMouseEventObject) => any): ChaiJQuery; + /** + * Bind an event handler to be fired when the mouse enters an element. + * + * @param eventData An object containing data that will be passed to the event handler. + * @param handler A function to execute when the event is triggered. + */ + mouseenter(eventData: Object, handler: (eventObject: JQueryMouseEventObject) => any): ChaiJQuery; + + /** + * Trigger the "mouseleave" event on an element. + */ + mouseleave(): ChaiJQuery; + /** + * Bind an event handler to be fired when the mouse leaves an element. + * + * @param handler A function to execute when the event is triggered. + */ + mouseleave(handler: (eventObject: JQueryMouseEventObject) => any): ChaiJQuery; + /** + * Bind an event handler to be fired when the mouse leaves an element. + * + * @param eventData An object containing data that will be passed to the event handler. + * @param handler A function to execute when the event is triggered. + */ + mouseleave(eventData: Object, handler: (eventObject: JQueryMouseEventObject) => any): ChaiJQuery; + + /** + * Trigger the "mousemove" event on an element. + */ + mousemove(): ChaiJQuery; + /** + * Bind an event handler to the "mousemove" JavaScript event. + * + * @param handler A function to execute when the event is triggered. + */ + mousemove(handler: (eventObject: JQueryMouseEventObject) => any): ChaiJQuery; + /** + * Bind an event handler to the "mousemove" JavaScript event. + * + * @param eventData An object containing data that will be passed to the event handler. + * @param handler A function to execute when the event is triggered. + */ + mousemove(eventData: Object, handler: (eventObject: JQueryMouseEventObject) => any): ChaiJQuery; + + /** + * Trigger the "mouseout" event on an element. + */ + mouseout(): ChaiJQuery; + /** + * Bind an event handler to the "mouseout" JavaScript event. + * + * @param handler A function to execute when the event is triggered. + */ + mouseout(handler: (eventObject: JQueryMouseEventObject) => any): ChaiJQuery; + /** + * Bind an event handler to the "mouseout" JavaScript event. + * + * @param eventData An object containing data that will be passed to the event handler. + * @param handler A function to execute when the event is triggered. + */ + mouseout(eventData: Object, handler: (eventObject: JQueryMouseEventObject) => any): ChaiJQuery; + + /** + * Trigger the "mouseover" event on an element. + */ + mouseover(): ChaiJQuery; + /** + * Bind an event handler to the "mouseover" JavaScript event. + * + * @param handler A function to execute when the event is triggered. + */ + mouseover(handler: (eventObject: JQueryMouseEventObject) => any): ChaiJQuery; + /** + * Bind an event handler to the "mouseover" JavaScript event. + * + * @param eventData An object containing data that will be passed to the event handler. + * @param handler A function to execute when the event is triggered. + */ + mouseover(eventData: Object, handler: (eventObject: JQueryMouseEventObject) => any): ChaiJQuery; + + /** + * Trigger the "mouseup" event on an element. + */ + mouseup(): ChaiJQuery; + /** + * Bind an event handler to the "mouseup" JavaScript event. + * + * @param handler A function to execute when the event is triggered. + */ + mouseup(handler: (eventObject: JQueryMouseEventObject) => any): ChaiJQuery; + /** + * Bind an event handler to the "mouseup" JavaScript event. + * + * @param eventData An object containing data that will be passed to the event handler. + * @param handler A function to execute when the event is triggered. + */ + mouseup(eventData: Object, handler: (eventObject: JQueryMouseEventObject) => any): ChaiJQuery; + + /** + * Remove an event handler. + */ + off(): ChaiJQuery; + /** + * Remove an event handler. + * + * @param events One or more space-separated event types and optional namespaces, or just namespaces, such as "click", "keydown.myPlugin", or ".myPlugin". + * @param selector A selector which should match the one originally passed to .on() when attaching event handlers. + * @param handler A handler function previously attached for the event(s), or the special value false. + */ + off(events: string, selector?: string, handler?: (eventObject: JQueryEventObject) => any): ChaiJQuery; + /** + * Remove an event handler. + * + * @param events One or more space-separated event types and optional namespaces, or just namespaces, such as "click", "keydown.myPlugin", or ".myPlugin". + * @param handler A handler function previously attached for the event(s), or the special value false. + */ + off(events: string, handler: (eventObject: JQueryEventObject) => any): ChaiJQuery; + /** + * Remove an event handler. + * + * @param events An object where the string keys represent one or more space-separated event types and optional namespaces, and the values represent handler functions previously attached for the event(s). + * @param selector A selector which should match the one originally passed to .on() when attaching event handlers. + */ + off(events: { [key: string]: any; }, selector?: string): ChaiJQuery; + + /** + * Attach an event handler function for one or more events to the selected elements. + * + * @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin". + * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. Rest parameter args is for optional parameters passed to jQuery.trigger(). Note that the actual parameters on the event handler function must be marked as optional (? syntax). + */ + on(events: string, handler: (eventObject: JQueryEventObject, ...args: any[]) => any): ChaiJQuery; + /** + * Attach an event handler function for one or more events to the selected elements. + * + * @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin". + * @param data Data to be passed to the handler in event.data when an event is triggered. + * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. + */ + on(events: string, data: any, handler: (eventObject: JQueryEventObject, ...args: any[]) => any): ChaiJQuery; + /** + * Attach an event handler function for one or more events to the selected elements. + * + * @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin". + * @param selector A selector string to filter the descendants of the selected elements that trigger the event. If the selector is null or omitted, the event is always triggered when it reaches the selected element. + * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. + */ + on(events: string, selector: string, handler: (eventObject: JQueryEventObject, ...eventData: any[]) => any): ChaiJQuery; + /** + * Attach an event handler function for one or more events to the selected elements. + * + * @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin". + * @param selector A selector string to filter the descendants of the selected elements that trigger the event. If the selector is null or omitted, the event is always triggered when it reaches the selected element. + * @param data Data to be passed to the handler in event.data when an event is triggered. + * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. + */ + on(events: string, selector: string, data: any, handler: (eventObject: JQueryEventObject, ...eventData: any[]) => any): ChaiJQuery; + /** + * Attach an event handler function for one or more events to the selected elements. + * + * @param events An object in which the string keys represent one or more space-separated event types and optional namespaces, and the values represent a handler function to be called for the event(s). + * @param selector A selector string to filter the descendants of the selected elements that will call the handler. If the selector is null or omitted, the handler is always called when it reaches the selected element. + * @param data Data to be passed to the handler in event.data when an event occurs. + */ + on(events: { [key: string]: any; }, selector?: string, data?: any): ChaiJQuery; + /** + * Attach an event handler function for one or more events to the selected elements. + * + * @param events An object in which the string keys represent one or more space-separated event types and optional namespaces, and the values represent a handler function to be called for the event(s). + * @param data Data to be passed to the handler in event.data when an event occurs. + */ + on(events: { [key: string]: any; }, data?: any): ChaiJQuery; + + /** + * Attach a handler to an event for the elements. The handler is executed at most once per element per event type. + * + * @param events A string containing one or more JavaScript event types, such as "click" or "submit," or custom event names. + * @param handler A function to execute at the time the event is triggered. + */ + one(events: string, handler: (eventObject: JQueryEventObject) => any): ChaiJQuery; + /** + * Attach a handler to an event for the elements. The handler is executed at most once per element per event type. + * + * @param events A string containing one or more JavaScript event types, such as "click" or "submit," or custom event names. + * @param data An object containing data that will be passed to the event handler. + * @param handler A function to execute at the time the event is triggered. + */ + one(events: string, data: Object, handler: (eventObject: JQueryEventObject) => any): ChaiJQuery; + + /** + * Attach a handler to an event for the elements. The handler is executed at most once per element per event type. + * + * @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin". + * @param selector A selector string to filter the descendants of the selected elements that trigger the event. If the selector is null or omitted, the event is always triggered when it reaches the selected element. + * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. + */ + one(events: string, selector: string, handler: (eventObject: JQueryEventObject) => any): ChaiJQuery; + /** + * Attach a handler to an event for the elements. The handler is executed at most once per element per event type. + * + * @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin". + * @param selector A selector string to filter the descendants of the selected elements that trigger the event. If the selector is null or omitted, the event is always triggered when it reaches the selected element. + * @param data Data to be passed to the handler in event.data when an event is triggered. + * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. + */ + one(events: string, selector: string, data: any, handler: (eventObject: JQueryEventObject) => any): ChaiJQuery; + + /** + * Attach a handler to an event for the elements. The handler is executed at most once per element per event type. + * + * @param events An object in which the string keys represent one or more space-separated event types and optional namespaces, and the values represent a handler function to be called for the event(s). + * @param selector A selector string to filter the descendants of the selected elements that will call the handler. If the selector is null or omitted, the handler is always called when it reaches the selected element. + * @param data Data to be passed to the handler in event.data when an event occurs. + */ + one(events: { [key: string]: any; }, selector?: string, data?: any): ChaiJQuery; + + /** + * Attach a handler to an event for the elements. The handler is executed at most once per element per event type. + * + * @param events An object in which the string keys represent one or more space-separated event types and optional namespaces, and the values represent a handler function to be called for the event(s). + * @param data Data to be passed to the handler in event.data when an event occurs. + */ + one(events: { [key: string]: any; }, data?: any): ChaiJQuery; + + + /** + * Specify a function to execute when the DOM is fully loaded. + * + * @param handler A function to execute after the DOM is ready. + */ + ready(handler: Function): ChaiJQuery; + + /** + * Trigger the "resize" event on an element. + */ + resize(): ChaiJQuery; + /** + * Bind an event handler to the "resize" JavaScript event. + * + * @param handler A function to execute each time the event is triggered. + */ + resize(handler: (eventObject: JQueryEventObject) => any): ChaiJQuery; + /** + * Bind an event handler to the "resize" JavaScript event. + * + * @param eventData An object containing data that will be passed to the event handler. + * @param handler A function to execute each time the event is triggered. + */ + resize(eventData: Object, handler: (eventObject: JQueryEventObject) => any): ChaiJQuery; + + /** + * Trigger the "scroll" event on an element. + */ + scroll(): ChaiJQuery; + /** + * Bind an event handler to the "scroll" JavaScript event. + * + * @param handler A function to execute each time the event is triggered. + */ + scroll(handler: (eventObject: JQueryEventObject) => any): ChaiJQuery; + /** + * Bind an event handler to the "scroll" JavaScript event. + * + * @param eventData An object containing data that will be passed to the event handler. + * @param handler A function to execute each time the event is triggered. + */ + scroll(eventData: Object, handler: (eventObject: JQueryEventObject) => any): ChaiJQuery; + + /** + * Trigger the "select" event on an element. + */ + select(): ChaiJQuery; + /** + * Bind an event handler to the "select" JavaScript event. + * + * @param handler A function to execute each time the event is triggered. + */ + select(handler: (eventObject: JQueryEventObject) => any): ChaiJQuery; + /** + * Bind an event handler to the "select" JavaScript event. + * + * @param eventData An object containing data that will be passed to the event handler. + * @param handler A function to execute each time the event is triggered. + */ + select(eventData: Object, handler: (eventObject: JQueryEventObject) => any): ChaiJQuery; + + /** + * Trigger the "submit" event on an element. + */ + submit(): ChaiJQuery; + /** + * Bind an event handler to the "submit" JavaScript event + * + * @param handler A function to execute each time the event is triggered. + */ + submit(handler: (eventObject: JQueryEventObject) => any): ChaiJQuery; + /** + * Bind an event handler to the "submit" JavaScript event + * + * @param eventData An object containing data that will be passed to the event handler. + * @param handler A function to execute each time the event is triggered. + */ + submit(eventData?: any, handler?: (eventObject: JQueryEventObject) => any): ChaiJQuery; + + /** + * Execute all handlers and behaviors attached to the matched elements for the given event type. + * + * @param eventType A string containing a JavaScript event type, such as click or submit. + * @param extraParameters Additional parameters to pass along to the event handler. + */ + trigger(eventType: string, extraParameters?: any[]|Object): ChaiJQuery; + /** + * Execute all handlers and behaviors attached to the matched elements for the given event type. + * + * @param event A jQuery.Event object. + * @param extraParameters Additional parameters to pass along to the event handler. + */ + trigger(event: JQueryEventObject, extraParameters?: any[]|Object): ChaiJQuery; + + /** + * Execute all handlers attached to an element for an event. + * + * @param eventType A string containing a JavaScript event type, such as click or submit. + * @param extraParameters An array of additional parameters to pass along to the event handler. + */ + triggerHandler(eventType: string, ...extraParameters: any[]): Object; + + /** + * Remove a previously-attached event handler from the elements. + * + * @param eventType A string containing a JavaScript event type, such as click or submit. + * @param handler The function that is to be no longer executed. + */ + unbind(eventType?: string, handler?: (eventObject: JQueryEventObject) => any): ChaiJQuery; + /** + * Remove a previously-attached event handler from the elements. + * + * @param eventType A string containing a JavaScript event type, such as click or submit. + * @param fls Unbinds the corresponding 'return false' function that was bound using .bind( eventType, false ). + */ + unbind(eventType: string, fls: boolean): ChaiJQuery; + /** + * Remove a previously-attached event handler from the elements. + * + * @param evt A JavaScript event object as passed to an event handler. + */ + unbind(evt: any): ChaiJQuery; + + /** + * Remove a handler from the event for all elements which match the current selector, based upon a specific set of root elements. + */ + undelegate(): ChaiJQuery; + /** + * Remove a handler from the event for all elements which match the current selector, based upon a specific set of root elements. + * + * @param selector A selector which will be used to filter the event results. + * @param eventType A string containing a JavaScript event type, such as "click" or "keydown" + * @param handler A function to execute at the time the event is triggered. + */ + undelegate(selector: string, eventType: string, handler?: (eventObject: JQueryEventObject) => any): ChaiJQuery; + /** + * Remove a handler from the event for all elements which match the current selector, based upon a specific set of root elements. + * + * @param selector A selector which will be used to filter the event results. + * @param events An object of one or more event types and previously bound functions to unbind from them. + */ + undelegate(selector: string, events: Object): ChaiJQuery; + /** + * Remove a handler from the event for all elements which match the current selector, based upon a specific set of root elements. + * + * @param namespace A string containing a namespace to unbind all events from. + */ + undelegate(namespace: string): ChaiJQuery; + + /** + * Bind an event handler to the "unload" JavaScript event. (DEPRECATED from v1.8) + * + * @param handler A function to execute when the event is triggered. + */ + unload(handler: (eventObject: JQueryEventObject) => any): ChaiJQuery; + /** + * Bind an event handler to the "unload" JavaScript event. (DEPRECATED from v1.8) + * + * @param eventData A plain object of data that will be passed to the event handler. + * @param handler A function to execute when the event is triggered. + */ + unload(eventData?: any, handler?: (eventObject: JQueryEventObject) => any): ChaiJQuery; + + /** + * The DOM node context originally passed to jQuery(); if none was passed then context will likely be the document. (DEPRECATED from v1.10) + */ + context: Element; + + jquery: string; + + /** + * Bind an event handler to the "error" JavaScript event. (DEPRECATED from v1.8) + * + * @param handler A function to execute when the event is triggered. + */ + error(handler: (eventObject: JQueryEventObject) => any): ChaiJQuery; + /** + * Bind an event handler to the "error" JavaScript event. (DEPRECATED from v1.8) + * + * @param eventData A plain object of data that will be passed to the event handler. + * @param handler A function to execute when the event is triggered. + */ + error(eventData: any, handler: (eventObject: JQueryEventObject) => any): ChaiJQuery; + + /** + * Add a collection of DOM elements onto the jQuery stack. + * + * @param elements An array of elements to push onto the stack and make into a new jQuery object. + */ + pushStack(elements: any[]): ChaiJQuery; + /** + * Add a collection of DOM elements onto the jQuery stack. + * + * @param elements An array of elements to push onto the stack and make into a new jQuery object. + * @param name The name of a jQuery method that generated the array of elements. + * @param arguments The arguments that were passed in to the jQuery method (for serialization). + */ + pushStack(elements: any[], name: string, arguments: any[]): ChaiJQuery; + + /** + * Insert content, specified by the parameter, after each element in the set of matched elements. + * + * param content1 HTML string, DOM element, array of elements, or jQuery object to insert after each element in the set of matched elements. + * param content2 One or more additional DOM elements, arrays of elements, HTML strings, or jQuery objects to insert after each element in the set of matched elements. + */ + after(content1: JQuery|any[]|Element|Text|string, ...content2: any[]): ChaiJQuery; + /** + * Insert content, specified by the parameter, after each element in the set of matched elements. + * + * param func A function that returns an HTML string, DOM element(s), or jQuery object to insert after each element in the set of matched elements. Receives the index position of the element in the set as an argument. Within the function, this refers to the current element in the set. + */ + after(func: (index: number, html: string) => string|Element|JQuery): ChaiJQuery; + + /** + * Insert content, specified by the parameter, to the end of each element in the set of matched elements. + * + * param content1 DOM element, array of elements, HTML string, or jQuery object to insert at the end of each element in the set of matched elements. + * param content2 One or more additional DOM elements, arrays of elements, HTML strings, or jQuery objects to insert at the end of each element in the set of matched elements. + */ + append(content1: JQuery|any[]|Element|Text|string, ...content2: any[]): ChaiJQuery; + /** + * Insert content, specified by the parameter, to the end of each element in the set of matched elements. + * + * param func A function that returns an HTML string, DOM element(s), or jQuery object to insert at the end of each element in the set of matched elements. Receives the index position of the element in the set and the old HTML value of the element as arguments. Within the function, this refers to the current element in the set. + */ + append(func: (index: number, html: string) => string|Element|JQuery): ChaiJQuery; + + /** + * Insert every element in the set of matched elements to the end of the target. + * + * @param target A selector, element, HTML string, array of elements, or jQuery object; the matched set of elements will be inserted at the end of the element(s) specified by this parameter. + */ + appendTo(target: JQuery|any[]|Element|string): ChaiJQuery; + + /** + * Insert content, specified by the parameter, before each element in the set of matched elements. + * + * param content1 HTML string, DOM element, array of elements, or jQuery object to insert before each element in the set of matched elements. + * param content2 One or more additional DOM elements, arrays of elements, HTML strings, or jQuery objects to insert before each element in the set of matched elements. + */ + before(content1: JQuery|any[]|Element|Text|string, ...content2: any[]): ChaiJQuery; + /** + * Insert content, specified by the parameter, before each element in the set of matched elements. + * + * param func A function that returns an HTML string, DOM element(s), or jQuery object to insert before each element in the set of matched elements. Receives the index position of the element in the set as an argument. Within the function, this refers to the current element in the set. + */ + before(func: (index: number, html: string) => string|Element|JQuery): ChaiJQuery; + + /** + * Create a deep copy of the set of matched elements. + * + * param withDataAndEvents A Boolean indicating whether event handlers and data should be copied along with the elements. The default value is false. + * param deepWithDataAndEvents A Boolean indicating whether event handlers and data for all children of the cloned element should be copied. By default its value matches the first argument's value (which defaults to false). + */ + clone(withDataAndEvents?: boolean, deepWithDataAndEvents?: boolean): ChaiJQuery; + + /** + * Remove the set of matched elements from the DOM. + * + * param selector A selector expression that filters the set of matched elements to be removed. + */ + detach(selector?: string): ChaiJQuery; + + /** + * Remove all child nodes of the set of matched elements from the DOM. + */ + empty(): ChaiJQuery; + + /** + * Insert every element in the set of matched elements after the target. + * + * param target A selector, element, array of elements, HTML string, or jQuery object; the matched set of elements will be inserted after the element(s) specified by this parameter. + */ + insertAfter(target: JQuery|any[]|Element|Text|string): ChaiJQuery; + + /** + * Insert every element in the set of matched elements before the target. + * + * param target A selector, element, array of elements, HTML string, or jQuery object; the matched set of elements will be inserted before the element(s) specified by this parameter. + */ + insertBefore(target: JQuery|any[]|Element|Text|string): ChaiJQuery; + + /** + * Insert content, specified by the parameter, to the beginning of each element in the set of matched elements. + * + * param content1 DOM element, array of elements, HTML string, or jQuery object to insert at the beginning of each element in the set of matched elements. + * param content2 One or more additional DOM elements, arrays of elements, HTML strings, or jQuery objects to insert at the beginning of each element in the set of matched elements. + */ + prepend(content1: JQuery|any[]|Element|Text|string, ...content2: any[]): ChaiJQuery; + /** + * Insert content, specified by the parameter, to the beginning of each element in the set of matched elements. + * + * param func A function that returns an HTML string, DOM element(s), or jQuery object to insert at the beginning of each element in the set of matched elements. Receives the index position of the element in the set and the old HTML value of the element as arguments. Within the function, this refers to the current element in the set. + */ + prepend(func: (index: number, html: string) => string|Element|JQuery): ChaiJQuery; + + /** + * Insert every element in the set of matched elements to the beginning of the target. + * + * @param target A selector, element, HTML string, array of elements, or jQuery object; the matched set of elements will be inserted at the beginning of the element(s) specified by this parameter. + */ + prependTo(target: JQuery|any[]|Element|string): ChaiJQuery; + + /** + * Remove the set of matched elements from the DOM. + * + * @param selector A selector expression that filters the set of matched elements to be removed. + */ + remove(selector?: string): ChaiJQuery; + + /** + * Replace each target element with the set of matched elements. + * + * @param target A selector string, jQuery object, DOM element, or array of elements indicating which element(s) to replace. + */ + replaceAll(target: JQuery|any[]|Element|string): ChaiJQuery; + + /** + * Replace each element in the set of matched elements with the provided new content and return the set of elements that was removed. + * + * param newContent The content to insert. May be an HTML string, DOM element, array of DOM elements, or jQuery object. + */ + replaceWith(newContent: JQuery|any[]|Element|Text|string): ChaiJQuery; + /** + * Replace each element in the set of matched elements with the provided new content and return the set of elements that was removed. + * + * param func A function that returns content with which to replace the set of matched elements. + */ + replaceWith(func: () => Element|JQuery): ChaiJQuery; + + /** + * Get the combined text contents of each element in the set of matched elements, including their descendants. + */ + text(): string; + /** + * Set the content of each element in the set of matched elements to the specified text. + * + * @param text The text to set as the content of each matched element. When Number or Boolean is supplied, it will be converted to a String representation. + */ + text(text: string|number|boolean): ChaiJQuery; + /** + * Set the content of each element in the set of matched elements to the specified text. + * + * @param func A function returning the text content to set. Receives the index position of the element in the set and the old text value as arguments. + */ + text(func: (index: number, text: string) => string): ChaiJQuery; + + /** + * Retrieve all the elements contained in the jQuery set, as an array. + */ + toArray(): any[]; + + /** + * Remove the parents of the set of matched elements from the DOM, leaving the matched elements in their place. + */ + unwrap(): ChaiJQuery; + + /** + * Wrap an HTML structure around each element in the set of matched elements. + * + * @param wrappingElement A selector, element, HTML string, or jQuery object specifying the structure to wrap around the matched elements. + */ + wrap(wrappingElement: JQuery|Element|string): ChaiJQuery; + /** + * Wrap an HTML structure around each element in the set of matched elements. + * + * @param func A callback function returning the HTML content or jQuery object to wrap around the matched elements. Receives the index position of the element in the set as an argument. Within the function, this refers to the current element in the set. + */ + wrap(func: (index: number) => string|JQuery): ChaiJQuery; + + /** + * Wrap an HTML structure around all elements in the set of matched elements. + * + * @param wrappingElement A selector, element, HTML string, or jQuery object specifying the structure to wrap around the matched elements. + */ + wrapAll(wrappingElement: JQuery|Element|string): ChaiJQuery; + wrapAll(func: (index: number) => string): ChaiJQuery; + + /** + * Wrap an HTML structure around the content of each element in the set of matched elements. + * + * @param wrappingElement An HTML snippet, selector expression, jQuery object, or DOM element specifying the structure to wrap around the content of the matched elements. + */ + wrapInner(wrappingElement: JQuery|Element|string): ChaiJQuery; + /** + * Wrap an HTML structure around the content of each element in the set of matched elements. + * + * @param func A callback function which generates a structure to wrap around the content of the matched elements. Receives the index position of the element in the set as an argument. Within the function, this refers to the current element in the set. + */ + wrapInner(func: (index: number) => string): ChaiJQuery; + + /** + * Iterate over a jQuery object, executing a function for each matched element. + * + * @param func A function to execute for each matched element. + */ + each(func: (index: number, elem: Element) => any): ChaiJQuery; + + /** + * Retrieve one of the elements matched by the jQuery object. + * + * @param index A zero-based integer indicating which element to retrieve. + */ + get(index: number): HTMLElement; + /** + * Retrieve the elements matched by the jQuery object. + */ + get(): any[]; + + /** + * Search for a given element from among the matched elements. + */ + index(): number; + /** + * Search for a given element from among the matched elements. + * + * @param selector A selector representing a jQuery collection in which to look for an element. + */ + index(selector: string|JQuery|Element): number; + + /** + * The number of elements in the jQuery object. + */ + length: number; + /** + * A selector representing selector passed to jQuery(), if any, when creating the original set. + * version deprecated: 1.7, removed: 1.9 + */ + selector: string; + [index: string]: any; + [index: number]: HTMLElement; + + /** + * Add elements to the set of matched elements. + * + * @param selector A string representing a selector expression to find additional elements to add to the set of matched elements. + * @param context The point in the document at which the selector should begin matching; similar to the context argument of the $(selector, context) method. + */ + add(selector: string, context?: Element): ChaiJQuery; + /** + * Add elements to the set of matched elements. + * + * @param elements One or more elements to add to the set of matched elements. + */ + add(...elements: Element[]): ChaiJQuery; + /** + * Add elements to the set of matched elements. + * + * @param html An HTML fragment to add to the set of matched elements. + */ + add(html: string): ChaiJQuery; + /** + * Add elements to the set of matched elements. + * + * @param obj An existing jQuery object to add to the set of matched elements. + */ + add(obj: JQuery): ChaiJQuery; + + /** + * Get the children of each element in the set of matched elements, optionally filtered by a selector. + * + * @param selector A string containing a selector expression to match elements against. + */ + children(selector?: string): ChaiJQuery; + + /** + * For each element in the set, get the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree. + * + * @param selector A string containing a selector expression to match elements against. + */ + closest(selector: string): ChaiJQuery; + /** + * For each element in the set, get the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree. + * + * @param selector A string containing a selector expression to match elements against. + * @param context A DOM element within which a matching element may be found. If no context is passed in then the context of the jQuery set will be used instead. + */ + closest(selector: string, context?: Element): ChaiJQuery; + /** + * For each element in the set, get the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree. + * + * @param obj A jQuery object to match elements against. + */ + closest(obj: JQuery): ChaiJQuery; + /** + * For each element in the set, get the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree. + * + * @param element An element to match elements against. + */ + closest(element: Element): ChaiJQuery; + + /** + * Get an array of all the elements and selectors matched against the current element up through the DOM tree. + * + * @param selectors An array or string containing a selector expression to match elements against (can also be a jQuery object). + * @param context A DOM element within which a matching element may be found. If no context is passed in then the context of the jQuery set will be used instead. + */ + closest(selectors: any, context?: Element): any[]; + + /** + * Get the children of each element in the set of matched elements, including text and comment nodes. + */ + contents(): ChaiJQuery; + + /** + * End the most recent filtering operation in the current chain and return the set of matched elements to its previous state. + */ + end(): ChaiJQuery; + + /** + * Reduce the set of matched elements to the one at the specified index. + * + * @param index An integer indicating the 0-based position of the element. OR An integer indicating the position of the element, counting backwards from the last element in the set. + * + */ + eq(index: number): ChaiJQuery; + + /** + * Reduce the set of matched elements to those that match the selector or pass the function's test. + * + * @param selector A string containing a selector expression to match the current set of elements against. + */ + filter(selector: string): ChaiJQuery; + /** + * Reduce the set of matched elements to those that match the selector or pass the function's test. + * + * @param func A function used as a test for each element in the set. this is the current DOM element. + */ + filter(func: (index: number, element: Element) => any): ChaiJQuery; + /** + * Reduce the set of matched elements to those that match the selector or pass the function's test. + * + * @param element An element to match the current set of elements against. + */ + filter(element: Element): ChaiJQuery; + /** + * Reduce the set of matched elements to those that match the selector or pass the function's test. + * + * @param obj An existing jQuery object to match the current set of elements against. + */ + filter(obj: JQuery): ChaiJQuery; + + /** + * Get the descendants of each element in the current set of matched elements, filtered by a selector, jQuery object, or element. + * + * @param selector A string containing a selector expression to match elements against. + */ + find(selector: string): ChaiJQuery; + /** + * Get the descendants of each element in the current set of matched elements, filtered by a selector, jQuery object, or element. + * + * @param element An element to match elements against. + */ + find(element: Element): ChaiJQuery; + /** + * Get the descendants of each element in the current set of matched elements, filtered by a selector, jQuery object, or element. + * + * @param obj A jQuery object to match elements against. + */ + find(obj: JQuery): ChaiJQuery; + + /** + * Reduce the set of matched elements to the first in the set. + */ + first(): ChaiJQuery; + + /** + * Reduce the set of matched elements to those that have a descendant that matches the selector or DOM element. + * + * @param selector A string containing a selector expression to match elements against. + */ + has(selector: string): ChaiJQuery; + /** + * Reduce the set of matched elements to those that have a descendant that matches the selector or DOM element. + * + * @param contained A DOM element to match elements against. + */ + has(contained: Element): ChaiJQuery; + + /** + * Check the current matched set of elements against a selector, element, or jQuery object and return true if at least one of these elements matches the given arguments. + * + * @param selector A string containing a selector expression to match elements against. + */ + is(selector: string): boolean; + /** + * Check the current matched set of elements against a selector, element, or jQuery object and return true if at least one of these elements matches the given arguments. + * + * @param func A function used as a test for the set of elements. It accepts one argument, index, which is the element's index in the jQuery collection.Within the function, this refers to the current DOM element. + */ + is(func: (index: number, element: Element) => boolean): boolean; + /** + * Check the current matched set of elements against a selector, element, or jQuery object and return true if at least one of these elements matches the given arguments. + * + * @param obj An existing jQuery object to match the current set of elements against. + */ + is(obj: JQuery): boolean; + /** + * Check the current matched set of elements against a selector, element, or jQuery object and return true if at least one of these elements matches the given arguments. + * + * @param elements One or more elements to match the current set of elements against. + */ + is(elements: any): boolean; + + /** + * Reduce the set of matched elements to the final one in the set. + */ + last(): ChaiJQuery; + + /** + * Pass each element in the current matched set through a function, producing a new jQuery object containing the return values. + * + * @param callback A function object that will be invoked for each element in the current set. + */ + map(callback: (index: number, domElement: Element) => any): ChaiJQuery; + + /** + * Get the immediately following sibling of each element in the set of matched elements. If a selector is provided, it retrieves the next sibling only if it matches that selector. + * + * @param selector A string containing a selector expression to match elements against. + */ + next(selector?: string): ChaiJQuery; + + /** + * Get all following siblings of each element in the set of matched elements, optionally filtered by a selector. + * + * @param selector A string containing a selector expression to match elements against. + */ + nextAll(selector?: string): ChaiJQuery; + + /** + * Get all following siblings of each element up to but not including the element matched by the selector, DOM node, or jQuery object passed. + * + * @param selector A string containing a selector expression to indicate where to stop matching following sibling elements. + * @param filter A string containing a selector expression to match elements against. + */ + nextUntil(selector?: string, filter?: string): ChaiJQuery; + /** + * Get all following siblings of each element up to but not including the element matched by the selector, DOM node, or jQuery object passed. + * + * @param element A DOM node or jQuery object indicating where to stop matching following sibling elements. + * @param filter A string containing a selector expression to match elements against. + */ + nextUntil(element?: Element, filter?: string): ChaiJQuery; + /** + * Get all following siblings of each element up to but not including the element matched by the selector, DOM node, or jQuery object passed. + * + * @param obj A DOM node or jQuery object indicating where to stop matching following sibling elements. + * @param filter A string containing a selector expression to match elements against. + */ + nextUntil(obj?: JQuery, filter?: string): ChaiJQuery; + + /** + * Remove elements from the set of matched elements. + * + * @param selector A string containing a selector expression to match elements against. + */ + not(selector: string): ChaiJQuery; + /** + * Remove elements from the set of matched elements. + * + * @param func A function used as a test for each element in the set. this is the current DOM element. + */ + not(func: (index: number, element: Element) => boolean): ChaiJQuery; + /** + * Remove elements from the set of matched elements. + * + * @param elements One or more DOM elements to remove from the matched set. + */ + not(...elements: Element[]): ChaiJQuery; + /** + * Remove elements from the set of matched elements. + * + * @param obj An existing jQuery object to match the current set of elements against. + */ + not(obj: JQuery): ChaiJQuery; + + /** + * Get the closest ancestor element that is positioned. + */ + offsetParent(): ChaiJQuery; + + /** + * Get the parent of each element in the current set of matched elements, optionally filtered by a selector. + * + * @param selector A string containing a selector expression to match elements against. + */ + parent(selector?: string): ChaiJQuery; + + /** + * Get the ancestors of each element in the current set of matched elements, optionally filtered by a selector. + * + * @param selector A string containing a selector expression to match elements against. + */ + parents(selector?: string): ChaiJQuery; + + /** + * Get the ancestors of each element in the current set of matched elements, up to but not including the element matched by the selector, DOM node, or jQuery object. + * + * @param selector A string containing a selector expression to indicate where to stop matching ancestor elements. + * @param filter A string containing a selector expression to match elements against. + */ + parentsUntil(selector?: string, filter?: string): ChaiJQuery; + /** + * Get the ancestors of each element in the current set of matched elements, up to but not including the element matched by the selector, DOM node, or jQuery object. + * + * @param element A DOM node or jQuery object indicating where to stop matching ancestor elements. + * @param filter A string containing a selector expression to match elements against. + */ + parentsUntil(element?: Element, filter?: string): ChaiJQuery; + /** + * Get the ancestors of each element in the current set of matched elements, up to but not including the element matched by the selector, DOM node, or jQuery object. + * + * @param obj A DOM node or jQuery object indicating where to stop matching ancestor elements. + * @param filter A string containing a selector expression to match elements against. + */ + parentsUntil(obj?: JQuery, filter?: string): ChaiJQuery; + + /** + * Get the immediately preceding sibling of each element in the set of matched elements, optionally filtered by a selector. + * + * @param selector A string containing a selector expression to match elements against. + */ + prev(selector?: string): ChaiJQuery; + + /** + * Get all preceding siblings of each element in the set of matched elements, optionally filtered by a selector. + * + * @param selector A string containing a selector expression to match elements against. + */ + prevAll(selector?: string): ChaiJQuery; + + /** + * Get all preceding siblings of each element up to but not including the element matched by the selector, DOM node, or jQuery object. + * + * @param selector A string containing a selector expression to indicate where to stop matching preceding sibling elements. + * @param filter A string containing a selector expression to match elements against. + */ + prevUntil(selector?: string, filter?: string): ChaiJQuery; + /** + * Get all preceding siblings of each element up to but not including the element matched by the selector, DOM node, or jQuery object. + * + * @param element A DOM node or jQuery object indicating where to stop matching preceding sibling elements. + * @param filter A string containing a selector expression to match elements against. + */ + prevUntil(element?: Element, filter?: string): ChaiJQuery; + /** + * Get all preceding siblings of each element up to but not including the element matched by the selector, DOM node, or jQuery object. + * + * @param obj A DOM node or jQuery object indicating where to stop matching preceding sibling elements. + * @param filter A string containing a selector expression to match elements against. + */ + prevUntil(obj?: JQuery, filter?: string): ChaiJQuery; + + /** + * Get the siblings of each element in the set of matched elements, optionally filtered by a selector. + * + * @param selector A string containing a selector expression to match elements against. + */ + siblings(selector?: string): ChaiJQuery; + + /** + * Reduce the set of matched elements to a subset specified by a range of indices. + * + * @param start An integer indicating the 0-based position at which the elements begin to be selected. If negative, it indicates an offset from the end of the set. + * @param end An integer indicating the 0-based position at which the elements stop being selected. If negative, it indicates an offset from the end of the set. If omitted, the range continues until the end of the set. + */ + slice(start: number, end?: number): ChaiJQuery; + + /** + * Show the queue of functions to be executed on the matched elements. + * + * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue. + */ + queue(queueName?: string): any[]; + /** + * Manipulate the queue of functions to be executed, once for each matched element. + * + * @param newQueue An array of functions to replace the current queue contents. + */ + queue(newQueue: Function[]): ChaiJQuery; + /** + * Manipulate the queue of functions to be executed, once for each matched element. + * + * @param callback The new function to add to the queue, with a function to call that will dequeue the next item. + */ + queue(callback: Function): ChaiJQuery; + /** + * Manipulate the queue of functions to be executed, once for each matched element. + * + * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue. + * @param newQueue An array of functions to replace the current queue contents. + */ + queue(queueName: string, newQueue: Function[]): ChaiJQuery; + /** + * Manipulate the queue of functions to be executed, once for each matched element. + * + * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue. + * @param callback The new function to add to the queue, with a function to call that will dequeue the next item. + */ + queue(queueName: string, callback: Function): ChaiJQuery; + should: Chai.Assertion; +} diff --git a/chai-subset/chai-subset-tests.ts b/chai-subset/chai-subset-tests.ts new file mode 100644 index 000000000..8b88e5c6a --- /dev/null +++ b/chai-subset/chai-subset-tests.ts @@ -0,0 +1,62 @@ +/// + +import chai = require('chai'); +import chaiSubset = require('chai-subset'); + +chai.use(chaiSubset); +var expect = chai.expect; +var assert = chai.assert; + +function test_containSubset() { + var obj: Object = { + a: 'b', + c: 'd', + e: { + foo: 'bar', + baz: { + qux: 'quux' + } + } + }; + + expect(obj).to.containSubset({ + a: 'b', + e: { + baz: { + qux: 'quux' + } + } + }); + + obj.should.containSubset({ a: 'b' }); +} + +function test_notContainSubset() { + var obj: Object = { + a: 'b', + c: 'd', + e: { + foo: 'bar', + baz: { + qux: 'quux' + } + } + }; + + expect(obj).to.not.containSubset({ g: 'whatever' }); + obj.should.not.containSubset({ g: 'whatever' }); +} + +function test_arrayContainSubset() { + var list: Array = [{a: 'a', b: 'b'}, {v: 'f', d: {z: 'g'}} ]; + + expect(list).to.containSubset([{a:'a', b: 'b'}]); + list.should.containSubset([{a:'a', b: 'b'}]); +} + +function test_arrayNotContainSubset() { + var list: Array = [{a: 'a', b: 'b'}, {v: 'f', d: {z: 'g'}} ]; + + expect(list).not.to.containSubset([{a:'a', b: 'bd'}]); + list.should.not.containSubset([{a:'a', b: 'bd'}]); +} diff --git a/chai-subset/chai-subset.d.ts b/chai-subset/chai-subset.d.ts new file mode 100644 index 000000000..b9605241b --- /dev/null +++ b/chai-subset/chai-subset.d.ts @@ -0,0 +1,17 @@ +// Type definitions for chai-subset 1.0.0 +// Project: https://github.com/e-conomic/chai-subset +// Definitions by: Sam Noedel , Andrew Brown +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module Chai { + interface Assertion { + containSubset(obj: Object): Assertion; + } +} + +declare module "chai-subset" { + function chaiSubset(chai: any, utils: any): void; + export = chaiSubset; +} diff --git a/chai/chai-tests.ts b/chai/chai-tests.ts index 98d75e8ae..fdd23da16 100644 --- a/chai/chai-tests.ts +++ b/chai/chai-tests.ts @@ -1,763 +1,1121 @@ /// +import chai = require('chai'); + +// ReSharper disable WrongExpressionStatement var expect = chai.expect; var assert = chai.assert; +var should = chai.should(); declare var err: Function; function chaiVersion() { expect(chai).to.have.property('version'); + (<{}>chai).should.have.property('version'); } function assertion() { expect('test').to.be.a('string'); + 'test'.should.be.a('string'); expect('foo').to.equal('foo'); + 'foo'.should.equal('foo'); + should.equal('foo', 'foo'); } +function fail() { + err(() => { + should.fail('foo', 'bar'); + }, 'expected fail to throw an AssertionError'); + err(() => { + should.fail('foo', 'bar', 'should fail'); + }, 'expected fail to throw an AssertionError'); + err(() => { + should.fail('foo', 'bar', 'should fail', 'equal'); + }, 'expected fail to throw an AssertionError'); +} + +// ReSharper disable once InconsistentNaming function _true() { expect(true).to.be.true; + true.should.be.true; expect(false).to.not.be.true; + false.should.not.be.true; expect(1).to.not.be.true; + (1).should.not.be.true; err(() => { expect('test').to.be.true; - }, "expected 'test' to be true") + 'test'.should.be.true; + }, 'expected \'test\' to be true'); } function ok() { expect(true).to.be.ok; + true.should.be.ok; expect(false).to.not.be.ok; + false.should.not.be.ok; expect(1).to.be.ok; + (1).should.be.ok; expect(0).to.not.be.ok; + (0).should.not.be.ok; err(() => { expect('').to.be.ok; - }, "expected '' to be truthy"); + ''.should.be.ok; + }, 'expected \'\' to be truthy'); err(() => { expect('test').to.not.be.ok; - }, "expected 'test' to be falsy"); + 'test'.should.not.be.ok; + }, 'expected \'test\' to be falsy'); } function _false() { expect(false).to.be.false; + false.should.be.false; expect(true).to.not.be.false; + true.should.not.be.false; expect(0).to.not.be.false; + (0).should.not.be.false; err(() => { expect('').to.be.false; - }, "expected '' to be false") + ''.should.be.false; + }, 'expected \'\' to be false'); } function _null() { expect(null).to.be.null; + should.equal(null, null); expect(false).to.not.be.null; + false.should.not.be.null; err(() => { expect('').to.be.null; - }, "expected '' to be null") + ''.should.be.null; + }, 'expected \'\' to be null'); } function _undefined() { expect(undefined).to.be.undefined; + should.equal(undefined, undefined); expect(null).to.not.be.undefined; + should.not.equal(null, undefined); err(() => { expect('').to.be.undefined; - }, "expected '' to be undefined") + ''.should.be.undefined; + }, 'expected \'\' to be undefined'); } function exist() { - var foo = 'bar' - , bar; + var foo = 'bar'; expect(foo).to.exist; - expect(bar).to.not.exist; + should.exist(foo); + expect(void(0)).to.not.exist; + should.not.exist(void (0)); } function arguments() { var args = arguments; expect(args).to.be.arguments; + args.should.be.arguments; expect([]).to.not.be.arguments; + [].should.not.be.arguments; expect(args).to.be.an('arguments').and.be.arguments; + args.should.be.an('arguments').and.be.arguments; expect([]).to.be.an('array').and.not.be.Arguments; + [].should.be.an('array').and.not.be.Arguments; } function equal() { - var foo; - expect(undefined).to.equal(foo); + expect(undefined).to.equal(void(0)); + should.equal(undefined, void(0)); } function _typeof() { expect('test').to.be.a('string'); + 'test'.should.be.a('string'); err(() => { expect('test').to.not.be.a('string'); - }, "expected 'test' not to be a string"); + 'test'.should.not.be.a('string'); + }, 'expected \'test\' not to be a string'); expect(arguments).to.be.an('arguments'); + arguments.should.be.an('arguments'); expect(5).to.be.a('number'); + (5).should.be.a('number'); + expect(new Number(1)).to.be.a('number'); + (new Number(1)).should.be.a('number'); expect(Number(1)).to.be.a('number'); + Number(1).should.be.a('number'); expect(true).to.be.a('boolean'); + true.should.be.a('boolean'); expect(new Array()).to.be.a('array'); + (new Array()).should.be.a('array'); expect(new Object()).to.be.a('object'); + (new Object()).should.be.a('object'); expect({}).to.be.a('object'); + ({}).should.be.a('object'); expect([]).to.be.a('array'); - expect(function () { }).to.be.a('function'); + [].should.be.a('array'); + expect(() => { }).to.be.a('function'); + (() => { }).should.be.a('function'); expect(null).to.be.a('null'); + // N.B. previous line has no should equivalent err(() => { expect(5).to.not.be.a('number', 'blah'); - }, "blah: expected 5 not to be a number"); + (5).should.not.be.a('number', 'blah'); + }, 'blah: expected 5 not to be a number'); } +class Foo { } function _instanceof() { - function Foo() { } expect(new Foo()).to.be.an.instanceof(Foo); + (new Foo()).should.be.an.instanceof(Foo); err(() => { expect(3).to.an.instanceof(Foo, 'blah'); - }, "blah: expected 3 to be an instance of Foo"); + (3).should.an.instanceof(Foo, 'blah'); + }, 'blah: expected 3 to be an instance of Foo'); } -function within(start, finish) { +function within() { expect(5).to.be.within(5, 10); + (5).should.be.within(5, 10); expect(5).to.be.within(3, 6); + (5).should.be.within(3, 6); expect(5).to.be.within(3, 5); + (5).should.be.within(3, 5); expect(5).to.not.be.within(1, 3); + (5).should.not.be.within(1, 3); expect('foo').to.have.length.within(2, 4); + 'foo'.should.have.length.within(2, 4); expect([1, 2, 3]).to.have.length.within(2, 4); + [1, 2, 3].should.have.length.within(2, 4); err(() => { expect(5).to.not.be.within(4, 6, 'blah'); - }, "blah: expected 5 to not be within 4..6", 'blah'); + (5).should.not.be.within(4, 6, 'blah'); + }, 'blah: expected 5 to not be within 4..6', 'blah'); err(() => { expect(10).to.be.within(50, 100, 'blah'); - }, "blah: expected 10 to be within 50..100"); + (10).should.be.within(50, 100, 'blah'); + }, 'blah: expected 10 to be within 50..100'); err(() => { expect('foo').to.have.length.within(5, 7, 'blah'); - }, "blah: expected \'foo\' to have a length within 5..7"); + 'foo'.should.have.length.within(5, 7, 'blah'); + }, 'blah: expected \'foo\' to have a length within 5..7'); err(() => { expect([1, 2, 3]).to.have.length.within(5, 7, 'blah'); - }, "blah: expected [ 1, 2, 3 ] to have a length within 5..7"); + [1, 2, 3].should.have.length.within(5, 7, 'blah'); + }, 'blah: expected [ 1, 2, 3 ] to have a length within 5..7'); } -function above(n) { +function above() { expect(5).to.be.above(2); + (5).should.be.above(2); expect(5).to.be.greaterThan(2); + (5).should.be.greaterThan(2); expect(5).to.not.be.above(5); + (5).should.not.be.above(5); expect(5).to.not.be.above(6); + (5).should.not.be.above(6); expect('foo').to.have.length.above(2); + 'foo'.should.have.length.above(2); expect([1, 2, 3]).to.have.length.above(2); + [1, 2, 3].should.have.length.above(2); err(() => { expect(5).to.be.above(6, 'blah'); - }, "blah: expected 5 to be above 6", 'blah'); + (5).should.be.above(6, 'blah'); + }, 'blah: expected 5 to be above 6', 'blah'); err(() => { expect(10).to.not.be.above(6, 'blah'); - }, "blah: expected 10 to be at most 6"); + (10).should.not.be.above(6, 'blah'); + }, 'blah: expected 10 to be at most 6'); err(() => { expect('foo').to.have.length.above(4, 'blah'); - }, "blah: expected \'foo\' to have a length above 4 but got 3"); + 'foo'.should.have.length.above(4, 'blah'); + }, 'blah: expected \'foo\' to have a length above 4 but got 3'); err(() => { expect([1, 2, 3]).to.have.length.above(4, 'blah'); - }, "blah: expected [ 1, 2, 3 ] to have a length above 4 but got 3"); + [1, 2, 3].should.have.length.above(4, 'blah'); + }, 'blah: expected [ 1, 2, 3 ] to have a length above 4 but got 3'); } -function least(n) { +function least() { expect(5).to.be.at.least(2); + (5).should.be.at.least(2); expect(5).to.be.at.least(5); + (5).should.be.at.least(5); expect(5).to.not.be.at.least(6); + (5).should.not.be.at.least(6); expect('foo').to.have.length.of.at.least(2); + 'foo'.should.have.length.of.at.least(2); expect([1, 2, 3]).to.have.length.of.at.least(2); + [1, 2, 3].should.have.length.of.at.least(2); err(() => { expect(5).to.be.at.least(6, 'blah'); - }, "blah: expected 5 to be at least 6", 'blah'); + (5).should.be.at.least(6, 'blah'); + }, 'blah: expected 5 to be at least 6', 'blah'); err(() => { expect(10).to.not.be.at.least(6, 'blah'); - }, "blah: expected 10 to be below 6"); + (10).should.not.be.at.least(6, 'blah'); + }, 'blah: expected 10 to be below 6'); err(() => { expect('foo').to.have.length.of.at.least(4, 'blah'); - }, "blah: expected \'foo\' to have a length at least 4 but got 3"); + 'foo'.should.have.length.of.at.least(4, 'blah'); + }, 'blah: expected \'foo\' to have a length at least 4 but got 3'); err(() => { expect([1, 2, 3]).to.have.length.of.at.least(4, 'blah'); - }, "blah: expected [ 1, 2, 3 ] to have a length at least 4 but got 3"); + [1, 2, 3].should.have.length.of.at.least(4, 'blah'); + }, 'blah: expected [ 1, 2, 3 ] to have a length at least 4 but got 3'); err(() => { expect([1, 2, 3, 4]).to.not.have.length.of.at.least(4, 'blah'); - }, "blah: expected [ 1, 2, 3, 4 ] to have a length below 4"); + [1, 2, 3, 4].should.not.have.length.of.at.least(4, 'blah'); + }, 'blah: expected [ 1, 2, 3, 4 ] to have a length below 4'); } -function below(n) { +function below() { expect(2).to.be.below(5); + (2).should.be.below(5); expect(2).to.be.lessThan(5); + (2).should.be.lessThan(5); expect(2).to.not.be.below(2); + (2).should.not.be.below(2); expect(2).to.not.be.below(1); + (2).should.not.be.below(1); expect('foo').to.have.length.below(4); + 'foo'.should.have.length.below(4); expect([1, 2, 3]).to.have.length.below(4); + [1, 2, 3].should.have.length.below(4); err(() => { expect(6).to.be.below(5, 'blah'); - }, "blah: expected 6 to be below 5"); + (6).should.be.below(5, 'blah'); + }, 'blah: expected 6 to be below 5'); err(() => { expect(6).to.not.be.below(10, 'blah'); - }, "blah: expected 6 to be at least 10"); + (6).should.not.be.below(10, 'blah'); + }, 'blah: expected 6 to be at least 10'); err(() => { expect('foo').to.have.length.below(2, 'blah'); - }, "blah: expected \'foo\' to have a length below 2 but got 3"); + 'foo'.should.have.length.below(2, 'blah'); + }, 'blah: expected \'foo\' to have a length below 2 but got 3'); err(() => { expect([1, 2, 3]).to.have.length.below(2, 'blah'); - }, "blah: expected [ 1, 2, 3 ] to have a length below 2 but got 3"); + [1, 2, 3].should.have.length.below(2, 'blah'); + }, 'blah: expected [ 1, 2, 3 ] to have a length below 2 but got 3'); } -function most(n) { +function most() { expect(2).to.be.at.most(5); + (2).should.be.at.most(5); expect(2).to.be.at.most(2); + (2).should.be.at.most(2); expect(2).to.not.be.at.most(1); + (2).should.not.be.at.most(1); expect(2).to.not.be.at.most(1); + (2).should.not.be.at.most(1); expect('foo').to.have.length.of.at.most(4); + 'foo'.should.have.length.of.at.most(4); expect([1, 2, 3]).to.have.length.of.at.most(4); + [1, 2, 3].should.have.length.of.at.most(4); err(() => { expect(6).to.be.at.most(5, 'blah'); - }, "blah: expected 6 to be at most 5"); + (6).should.be.at.most(5, 'blah'); + }, 'blah: expected 6 to be at most 5'); err(() => { expect(6).to.not.be.at.most(10, 'blah'); - }, "blah: expected 6 to be above 10"); + (6).should.not.be.at.most(10, 'blah'); + }, 'blah: expected 6 to be above 10'); err(() => { expect('foo').to.have.length.of.at.most(2, 'blah'); - }, "blah: expected \'foo\' to have a length at most 2 but got 3"); + 'foo'.should.have.length.of.at.most(2, 'blah'); + }, 'blah: expected \'foo\' to have a length at most 2 but got 3'); err(() => { expect([1, 2, 3]).to.have.length.of.at.most(2, 'blah'); - }, "blah: expected [ 1, 2, 3 ] to have a length at most 2 but got 3"); + [1, 2, 3].should.have.length.of.at.most(2, 'blah'); + }, 'blah: expected [ 1, 2, 3 ] to have a length at most 2 but got 3'); err(() => { expect([1, 2]).to.not.have.length.of.at.most(2, 'blah'); - }, "blah: expected [ 1, 2 ] to have a length above 2"); + [1, 2].should.not.have.length.of.at.most(2, 'blah'); + }, 'blah: expected [ 1, 2 ] to have a length above 2'); } -function match(regexp) { +function match() { expect('foobar').to.match(/^foo/); + 'foobar'.should.match(/^foo/); expect('foobar').to.not.match(/^bar/); + 'foobar'.should.not.match(/^bar/); err(() => { - expect('foobar').to.match(/^bar/i, 'blah') -}, "blah: expected 'foobar' to match /^bar/i"); + expect('foobar').to.match(/^bar/i, 'blah'); + 'foobar'.should.match(/^bar/i, 'blah'); + }, 'blah: expected \'foobar\' to match /^bar/i'); err(() => { - expect('foobar').to.not.match(/^foo/i, 'blah') -}, "blah: expected 'foobar' not to match /^foo/i"); + expect('foobar').to.not.match(/^foo/i, 'blah'); + 'foobar'.should.not.match(/^foo/i, 'blah'); + }, 'blah: expected \'foobar\' not to match /^foo/i'); } -function length2(n) { +function length2() { expect('test').to.have.length(4); + 'test'.should.have.length(4); expect('test').to.not.have.length(3); + 'test'.should.not.have.length(3); expect([1, 2, 3]).to.have.length(3); + [1, 2, 3].should.have.length(3); err(() => { expect(4).to.have.length(3, 'blah'); + (4).should.have.length(3, 'blah'); }, 'blah: expected 4 to have a property \'length\''); err(() => { expect('asd').to.not.have.length(3, 'blah'); - }, "blah: expected 'asd' to not have a length of 3"); + 'asd'.should.not.have.length(3, 'blah'); + }, 'blah: expected \'asd\' to not have a length of 3'); } -function eql(val) { +function eql() { expect('test').to.eql('test'); + 'test'.should.eql('test'); expect({ foo: 'bar' }).to.eql({ foo: 'bar' }); + ({ foo: 'bar' }).should.eql({ foo: 'bar' }); expect(1).to.eql(1); + (1).should.eql(1); expect('4').to.not.eql(4); + '4'.should.not.eql(4); err(() => { expect(4).to.eql(3, 'blah'); + (4).should.eql(3, 'blah'); }, 'blah: expected 4 to deeply equal 3'); } +class Buffer { + constructor(arr: number[]) { + } +} function buffer() { - var Buffer; expect(new Buffer([1])).to.eql(new Buffer([1])); + (new Buffer([1])).should.eql(new Buffer([1])); err(() => { expect(new Buffer([0])).to.eql(new Buffer([1])); + (new Buffer([0])).should.eql(new Buffer([1])); }, 'expected to deeply equal '); } -function equal2(val) { +function equal2() { expect('test').to.equal('test'); + 'test'.should.equal('test'); + should.equal('test', 'test'); expect(1).to.equal(1); + (1).should.equal(1); + should.equal(1, 1); err(() => { expect(4).to.equal(3, 'blah'); + (4).should.equal(3, 'blah'); + should.equal(4, 3, 'blah'); }, 'blah: expected 4 to equal 3'); err(() => { expect('4').to.equal(4, 'blah'); - }, "blah: expected '4' to equal 4"); + '4'.should.equal(4, 'blah'); + should.equal(4, 4, 'blah'); + }, 'blah: expected \'4\' to equal 4'); } -function deepEqual(val) { +function deepEqual() { expect({ foo: 'bar' }).to.deep.equal({ foo: 'bar' }); + ({ foo: 'bar' }).should.deep.equal({ foo: 'bar' }); expect({ foo: 'bar' }).not.to.deep.equal({ foo: 'baz' }); } function deepEqual2() { expect(/a/).to.deep.equal(/a/); + /a/.should.deep.equal(/a/); expect(/a/).not.to.deep.equal(/b/); expect(/a/).not.to.deep.equal({}); expect(/a/g).to.deep.equal(/a/g); + /a/g.should.deep.equal(/a/g); expect(/a/g).not.to.deep.equal(/b/g); expect(/a/i).to.deep.equal(/a/i); + /a/i.should.deep.equal(/a/i); expect(/a/i).not.to.deep.equal(/b/i); expect(/a/m).to.deep.equal(/a/m); + /a/m.should.deep.equal(/a/m); expect(/a/m).not.to.deep.equal(/b/m); } -function deepEqual3(Date) { - var a = new Date(1, 2, 3) - , b = new Date(4, 5, 6); +// ReSharper disable once InconsistentNaming +function deepEqual3() { + var a = new Date(1, 2, 3); + var b = new Date(4, 5, 6); expect(a).to.deep.equal(a); + a.should.deep.equal(a); expect(a).not.to.deep.equal(b); + a.should.not.deep.equal(b); expect(a).not.to.deep.equal({}); + a.should.not.deep.equal({}); +} + +function deepInclude() { + expect(['foo', 'bar']).to.deep.include(['bar', 'foo']); + ['foo', 'bar'].should.deep.include(['bar', 'foo']); + expect(['foo', 'bar']).not.to.deep.equal(['foo', 'baz' ]); + ['foo', 'bar'].should.not.deep.equal(['foo', 'baz' ]); +} + +class FakeArgs { + length: number; } function empty() { - function FakeArgs() { }; FakeArgs.prototype.length = 0; expect('').to.be.empty; + + ''.should.be.empty; expect('foo').not.to.be.empty; + 'foo'.should.not.be.empty; expect([]).to.be.empty; + [].should.be.empty; expect(['foo']).not.to.be.empty; + ['foo'].should.not.be.empty; expect(new FakeArgs).to.be.empty; + (new FakeArgs).should.be.empty; expect({ arguments: 0 }).not.to.be.empty; + ({ arguments: 0 }).should.not.be.empty; expect({}).to.be.empty; + ({}).should.be.empty; expect({ foo: 'bar' }).not.to.be.empty; + ({ foo: 'bar' }).should.not.be.empty; err(() => { expect('').not.to.be.empty; - }, "expected \'\' not to be empty"); + ''.should.not.be.empty; + }, 'expected \'\' not to be empty'); err(() => { expect('foo').to.be.empty; - }, "expected \'foo\' to be empty"); + 'foo'.should.be.empty; + 'foo'.should.be.empty; + }, 'expected \'foo\' to be empty'); err(() => { expect([]).not.to.be.empty; - }, "expected [] not to be empty"); + [].should.not.be.empty; + }, 'expected [] not to be empty'); err(() => { expect(['foo']).to.be.empty; - }, "expected [ \'foo\' ] to be empty"); + ['foo'].should.be.empty; + }, 'expected [ \'foo\' ] to be empty'); err(() => { expect(new FakeArgs).not.to.be.empty; - }, "expected { length: 0 } not to be empty"); + (new FakeArgs).should.not.be.empty; + }, 'expected { length: 0 } not to be empty'); err(() => { expect({ arguments: 0 }).to.be.empty; - }, "expected { arguments: 0 } to be empty"); + ({ arguments: 0 }).should.be.empty; + }, 'expected { arguments: 0 } to be empty'); err(() => { expect({}).not.to.be.empty; - }, "expected {} not to be empty"); + ({}).should.not.be.empty; + }, 'expected {} not to be empty'); err(() => { expect({ foo: 'bar' }).to.be.empty; - }, "expected { foo: \'bar\' } to be empty"); + ({ foo: 'bar' }).should.be.empty; + }, 'expected { foo: \'bar\' } to be empty'); } -function property(name) { +function property() { expect('test').to.have.property('length'); + 'test'.should.have.property('length'); expect(4).to.not.have.property('length'); + (4).should.not.have.property('length'); expect({ 'foo.bar': 'baz' }) .to.have.property('foo.bar'); + ({ 'foo.bar': 'baz' }).should.have.property('foo.bar'); expect({ foo: { bar: 'baz' } }) .to.not.have.property('foo.bar'); + ({ foo: { bar: 'baz' } }).should.not.have.property('foo.bar'); err(() => { expect('asd').to.have.property('foo'); - }, "expected 'asd' to have a property 'foo'"); + 'asd'.should.have.property('foo'); + }, 'expected \'asd\' to have a property \'foo\''); err(() => { expect({ foo: { bar: 'baz' } }) .to.have.property('foo.bar'); - }, "expected { foo: { bar: 'baz' } } to have a property 'foo.bar'"); + ({ foo: { bar: 'baz' } }).should.have.property('foo.bar'); + }, 'expected { foo: { bar: \'baz\' } } to have a property \'foo.bar\''); } -function deepProperty(name) { +function deepProperty() { expect({ 'foo.bar': 'baz' }) .to.not.have.deep.property('foo.bar'); + ({ 'foo.bar': 'baz' }).should + .not.have.deep.property('foo.bar'); expect({ foo: { bar: 'baz' } }) .to.have.deep.property('foo.bar'); + ({ foo: { bar: 'baz' } }).should + .have.deep.property('foo.bar'); err(() => { expect({ 'foo.bar': 'baz' }) .to.have.deep.property('foo.bar'); - }, "expected { 'foo.bar': 'baz' } to have a deep property 'foo.bar'"); + ({ 'foo.bar': 'baz' }).should + .have.deep.property('foo.bar'); + }, 'expected { \'foo.bar\': \'baz\' } to have a deep property \'foo.bar\''); } -function property2(name, val) { +function property2() { expect('test').to.have.property('length', 4); + 'test'.should.have.property('length', 4); expect('asd').to.have.property('constructor', String); + 'asd'.should.have.property('constructor', String); err(() => { expect('asd').to.have.property('length', 4, 'blah'); - }, "blah: expected 'asd' to have a property 'length' of 4, but got 3"); + 'asd'.should.have.property('length', 4, 'blah'); + }, 'blah: expected \'asd\' to have a property \'length\' of 4, but got 3'); err(() => { expect('asd').to.not.have.property('length', 3, 'blah'); - }, "blah: expected 'asd' to not have a property 'length' of 3"); + 'asd'.should.not.have.property('length', 3, 'blah'); + }, 'blah: expected \'asd\' to not have a property \'length\' of 3'); err(() => { expect('asd').to.not.have.property('foo', 3, 'blah'); - }, "blah: 'asd' has no property 'foo'"); + 'asd'.should.not.have.property('foo', 3, 'blah'); + }, 'blah: \'asd\' has no property \'foo\''); err(() => { expect('asd').to.have.property('constructor', Number, 'blah'); - }, "blah: expected 'asd' to have a property 'constructor' of [Function: Number], but got [Function: String]"); + 'asd'.should.have.property('constructor', Number, 'blah'); + }, 'blah: expected \'asd\' to have a property \'constructor\' of [Function: Number], but got [Function: String]'); } -function deepProperty2(name, val) { +function deepProperty2() { expect({ foo: { bar: 'baz' } }) .to.have.deep.property('foo.bar', 'baz'); + ({ foo: { bar: 'baz' } }).should + .have.deep.property('foo.bar', 'baz'); err(() => { expect({ foo: { bar: 'baz' } }) .to.have.deep.property('foo.bar', 'quux', 'blah'); - }, "blah: expected { foo: { bar: 'baz' } } to have a deep property 'foo.bar' of 'quux', but got 'baz'"); + ({ foo: { bar: 'baz' } }).should + .have.deep.property('foo.bar', 'quux', 'blah'); + }, 'blah: expected { foo: { bar: \'baz\' } } to have a deep property \'foo.bar\' of \'quux\', but got \'baz\''); err(() => { expect({ foo: { bar: 'baz' } }) .to.not.have.deep.property('foo.bar', 'baz', 'blah'); - }, "blah: expected { foo: { bar: 'baz' } } to not have a deep property 'foo.bar' of 'baz'"); + ({ foo: { bar: 'baz' } }).should + .not.have.deep.property('foo.bar', 'baz', 'blah'); + }, 'blah: expected { foo: { bar: \'baz\' } } to not have a deep property \'foo.bar\' of \'baz\''); err(() => { expect({ foo: 5 }) .to.not.have.deep.property('foo.bar', 'baz', 'blah'); - }, "blah: { foo: 5 } has no deep property 'foo.bar'"); + ({ foo: 5 }).should + .not.have.deep.property('foo.bar', 'baz', 'blah'); + }, 'blah: { foo: 5 } has no deep property \'foo.bar\''); } -function ownProperty(name) { +function ownProperty() { expect('test').to.have.ownProperty('length'); + 'test'.should.have.ownProperty('length'); expect('test').to.haveOwnProperty('length'); + 'test'.should.haveOwnProperty('length'); expect({ length: 12 }).to.have.ownProperty('length'); + ({ length: 12 }).should.have.ownProperty('length'); err(() => { expect({ length: 12 }).to.not.have.ownProperty('length', 'blah'); - }, "blah: expected { length: 12 } to not have own property 'length'"); + ({ length: 12 }).should.not.have.ownProperty('length', 'blah'); + }, 'blah: expected { length: 12 } to not have own property \'length\''); } function string() { expect('foobar').to.have.string('bar'); + 'foobar'.should.have.string('bar'); expect('foobar').to.have.string('foo'); + 'foobar'.should.have.string('foo'); expect('foobar').to.not.have.string('baz'); + 'foobar'.should.not.have.string('baz'); err(() => { expect(3).to.have.string('baz'); - }, "expected 3 to be a string"); + (3).should.have.string('baz'); + }, 'expected 3 to be a string'); err(() => { expect('foobar').to.have.string('baz', 'blah'); - }, "blah: expected 'foobar' to contain 'baz'"); + 'foobar'.should.have.string('baz', 'blah'); + }, 'blah: expected \'foobar\' to contain \'baz\''); err(() => { expect('foobar').to.not.have.string('bar', 'blah'); - }, "blah: expected 'foobar' to not contain 'bar'"); + 'foobar'.should.not.have.string('bar', 'blah'); + }, 'blah: expected \'foobar\' to not contain \'bar\''); } function include() { expect(['foo', 'bar']).to.include('foo'); + ['foo', 'bar'].should.include('foo'); expect(['foo', 'bar']).to.include('foo'); + ['foo', 'bar'].should.include('foo'); expect(['foo', 'bar']).to.include('bar'); + ['foo', 'bar'].should.include('bar'); expect([1, 2]).to.include(1); + [1, 2].should.include(1); expect(['foo', 'bar']).to.not.include('baz'); + ['foo', 'bar'].should.not.include('baz'); expect(['foo', 'bar']).to.not.include(1); + ['foo', 'bar'].should.not.include(1); err(() => { expect(['foo']).to.include('bar', 'blah'); - }, "blah: expected [ 'foo' ] to include 'bar'"); + ['foo'].should.include('bar', 'blah'); + }, 'blah: expected [ \'foo\' ] to include \'bar\''); err(() => { expect(['bar', 'foo']).to.not.include('foo', 'blah'); - }, "blah: expected [ 'bar', 'foo' ] to not include 'foo'"); + ['bar', 'foo'].should.not.include('foo', 'blah'); + }, 'blah: expected [ \'bar\', \'foo\' ] to not include \'foo\''); } -function keys(array) { +function keys() { expect({ foo: 1 }).to.have.keys(['foo']); + ({ foo: 1 }).should.have.keys(['foo']); expect({ foo: 1, bar: 2 }).to.have.keys(['foo', 'bar']); + ({ foo: 1, bar: 2 }).should.have.keys(['foo', 'bar']); expect({ foo: 1, bar: 2 }).to.have.keys('foo', 'bar'); + ({ foo: 1, bar: 2 }).should.have.keys('foo', 'bar'); expect({ foo: 1, bar: 2, baz: 3 }).to.contain.keys('foo', 'bar'); + ({ foo: 1, bar: 2, baz: 3 }).should.contain.keys('foo', 'bar'); expect({ foo: 1, bar: 2, baz: 3 }).to.contain.keys('bar', 'foo'); + ({ foo: 1, bar: 2, baz: 3 }).should.contain.keys('bar', 'foo'); expect({ foo: 1, bar: 2, baz: 3 }).to.contain.keys('baz'); + ({ foo: 1, bar: 2, baz: 3 }).should.contain.keys('baz'); expect({ foo: 1, bar: 2 }).to.contain.keys('foo'); + ({ foo: 1, bar: 2 }).should.contain.keys('foo'); expect({ foo: 1, bar: 2 }).to.contain.keys('bar', 'foo'); + ({ foo: 1, bar: 2 }).should.contain.keys('bar', 'foo'); expect({ foo: 1, bar: 2 }).to.contain.keys(['foo']); + ({ foo: 1, bar: 2 }).should.contain.keys(['foo']); expect({ foo: 1, bar: 2 }).to.contain.keys(['bar']); + ({ foo: 1, bar: 2 }).should.contain.keys(['bar']); expect({ foo: 1, bar: 2 }).to.contain.keys(['bar', 'foo']); + ({ foo: 1, bar: 2 }).should.contain.keys(['bar', 'foo']); expect({ foo: 1, bar: 2 }).to.not.have.keys('baz'); + ({ foo: 1, bar: 2 }).should.not.have.keys('baz'); expect({ foo: 1, bar: 2 }).to.not.have.keys('foo', 'baz'); + ({ foo: 1, bar: 2 }).should.not.have.keys('foo', 'baz'); expect({ foo: 1, bar: 2 }).to.not.contain.keys('baz'); + ({ foo: 1, bar: 2 }).should.not.contain.keys('baz'); expect({ foo: 1, bar: 2 }).to.not.contain.keys('foo', 'baz'); + ({ foo: 1, bar: 2 }).should.not.contain.keys('foo', 'baz'); expect({ foo: 1, bar: 2 }).to.not.contain.keys('baz', 'foo'); + ({ foo: 1, bar: 2 }).should.not.contain.keys('baz', 'foo'); err(() => { expect({ foo: 1 }).to.have.keys(); - }, "keys required"); + ({ foo: 1 }).should.have.keys(); + }, 'keys required'); err(() => { expect({ foo: 1 }).to.have.keys([]); - }, "keys required"); + ({ foo: 1 }).should.have.keys([]); + }, 'keys required'); err(() => { expect({ foo: 1 }).to.not.have.keys([]); - }, "keys required"); + ({ foo: 1 }).should.not.have.keys([]); + }, 'keys required'); err(() => { expect({ foo: 1 }).to.contain.keys([]); - }, "keys required"); + ({ foo: 1 }).should.contain.keys([]); + }, 'keys required'); err(() => { expect({ foo: 1 }).to.have.keys(['bar']); - }, "expected { foo: 1 } to have key 'bar'"); + ({ foo: 1 }).should.have.keys(['bar']); + }, 'expected { foo: 1 } to have key \'bar\''); err(() => { expect({ foo: 1 }).to.have.keys(['bar', 'baz']); - }, "expected { foo: 1 } to have keys 'bar', and 'baz'"); + ({ foo: 1 }).should.have.keys(['bar', 'baz']); + }, 'expected { foo: 1 } to have keys \'bar\', and \'baz\''); err(() => { expect({ foo: 1 }).to.have.keys(['foo', 'bar', 'baz']); - }, "expected { foo: 1 } to have keys 'foo', 'bar', and 'baz'"); + ({ foo: 1 }).should.have.keys(['foo', 'bar', 'baz']); + }, 'expected { foo: 1 } to have keys \'foo\', \'bar\', and \'baz\''); err(() => { expect({ foo: 1 }).to.not.have.keys(['foo']); - }, "expected { foo: 1 } to not have key 'foo'"); + ({ foo: 1 }).should.not.have.keys(['foo']); + }, 'expected { foo: 1 } to not have key \'foo\''); err(() => { expect({ foo: 1 }).to.not.have.keys(['foo']); - }, "expected { foo: 1 } to not have key 'foo'"); + ({ foo: 1 }).should.not.have.keys(['foo']); + }, 'expected { foo: 1 } to not have key \'foo\''); err(() => { expect({ foo: 1, bar: 2 }).to.not.have.keys(['foo', 'bar']); - }, "expected { foo: 1, bar: 2 } to not have keys 'foo', and 'bar'"); + ({ foo: 1, bar: 2 }).should.not.have.keys(['foo', 'bar']); + }, 'expected { foo: 1, bar: 2 } to not have keys \'foo\', and \'bar\''); err(() => { expect({ foo: 1 }).to.not.contain.keys(['foo']); - }, "expected { foo: 1 } to not contain key 'foo'"); + ({ foo: 1 }).should.not.contain.keys(['foo']); + }, 'expected { foo: 1 } to not contain key \'foo\''); err(() => { expect({ foo: 1 }).to.contain.keys('foo', 'bar'); - }, "expected { foo: 1 } to contain keys 'foo', and 'bar'"); + ({ foo: 1 }).should.contain.keys('foo', 'bar'); + }, 'expected { foo: 1 } to contain keys \'foo\', and \'bar\''); } function chaining() { var tea = { name: 'chai', extras: ['milk', 'sugar', 'smile'] }; expect(tea).to.have.property('extras').with.lengthOf(3); + tea.should.have.property('extras').with.lengthOf(3); err(() => { expect(tea).to.have.property('extras').with.lengthOf(4); - }, "expected [ 'milk', 'sugar', 'smile' ] to have a length of 4 but got 3"); + tea.should.have.property('extras').with.lengthOf(4); + }, 'expected [ \'milk\', \'sugar\', \'smile\' ] to have a length of 4 but got 3'); expect(tea).to.be.a('object').and.have.property('name', 'chai'); + tea.should.be.a('object').and.have.property('name', 'chai'); } +class PoorlyConstructedError {} function _throw() { // See GH-45: some poorly-constructed custom errors don't have useful names // on either their constructor or their constructor prototype, but instead // only set the name inside the constructor itself. - var PoorlyConstructedError = () => { - this.name = 'PoorlyConstructedError'; - }; PoorlyConstructedError.prototype = Object.create(Error.prototype); var specificError = new RangeError('boo'); - var goodFn = () => { 1 == 1; } + var goodFn = () => { } , badFn = () => { throw new Error('testing'); } , refErrFn = () => { throw new ReferenceError('hello'); } , ickyErrFn = () => { throw new PoorlyConstructedError(); } , specificErrFn = () => { throw specificError; }; expect(goodFn).to.not.throw(); + goodFn.should.not.throw(); + should.not.throw(goodFn); expect(goodFn).to.not.throw(Error); + goodFn.should.not.throw(Error); + should.not.throw(goodFn, Error); expect(goodFn).to.not.throw(specificError); + goodFn.should.not.throw(specificError); + should.not.throw(goodFn, specificError); + expect(badFn).to.throw(); + badFn.should.throw(); + should.throw(badFn); expect(badFn).to.throw(Error); + badFn.should.throw(Error); + should.throw(badFn, Error); expect(badFn).to.not.throw(ReferenceError); + badFn.should.not.throw(ReferenceError); + should.not.throw(badFn, ReferenceError); expect(badFn).to.not.throw(specificError); + badFn.should.not.throw(specificError); + should.not.throw(badFn, specificError); + expect(refErrFn).to.throw(); + refErrFn.should.throw(); + should.throw(refErrFn); expect(refErrFn).to.throw(ReferenceError); + refErrFn.should.throw(ReferenceError); + should.throw(refErrFn, ReferenceError); expect(refErrFn).to.throw(Error); + refErrFn.should.throw(Error); + should.throw(refErrFn, Error); expect(refErrFn).to.not.throw(TypeError); + refErrFn.should.not.throw(TypeError); + should.not.throw(refErrFn, TypeError); expect(refErrFn).to.not.throw(specificError); + refErrFn.should.not.throw(specificError); + should.not.throw(refErrFn, specificError); + expect(ickyErrFn).to.throw(); + ickyErrFn.should.throw(); + should.throw(ickyErrFn); expect(ickyErrFn).to.throw(PoorlyConstructedError); + ickyErrFn.should.throw(PoorlyConstructedError); + should.throw(ickyErrFn, PoorlyConstructedError); expect(ickyErrFn).to.throw(Error); + ickyErrFn.should.throw(Error); + should.throw(ickyErrFn, Error); expect(ickyErrFn).to.not.throw(specificError); + ickyErrFn.should.not.throw(specificError); + should.not.throw(ickyErrFn, specificError); expect(specificErrFn).to.throw(specificError); + specificErrFn.should.throw(specificError); + should.throw(ickyErrFn, specificError); expect(badFn).to.throw(/testing/); + badFn.should.throw(/testing/); + should.throw(badFn, /testing/); expect(badFn).to.not.throw(/hello/); + badFn.should.not.throw(/hello/); + should.not.throw(badFn, /hello/); expect(badFn).to.throw('testing'); + badFn.should.throw('testing'); + should.throw(badFn, 'testing'); expect(badFn).to.not.throw('hello'); + badFn.should.not.throw('hello'); + should.not.throw(badFn, 'hello'); expect(badFn).to.throw(Error, /testing/); + badFn.should.throw(Error, /testing/); + should.throw(badFn, Error, /testing/); expect(badFn).to.throw(Error, 'testing'); + badFn.should.throw(Error, 'testing'); + should.throw(badFn, Error, 'testing'); err(() => { expect(goodFn).to.throw(); - }, "expected [Function] to throw an error"); + goodFn.should.throw(); + should.throw(goodFn); + }, 'expected [Function] to throw an error'); err(() => { expect(goodFn).to.throw(ReferenceError); - }, "expected [Function] to throw ReferenceError"); + goodFn.should.throw(ReferenceError); + should.throw(goodFn, ReferenceError); + }, 'expected [Function] to throw ReferenceError'); err(() => { expect(goodFn).to.throw(specificError); - }, "expected [Function] to throw [RangeError: boo]"); + goodFn.should.throw(specificError); + should.throw(goodFn, specificError); + }, 'expected [Function] to throw [RangeError: boo]'); err(() => { expect(badFn).to.not.throw(); - }, "expected [Function] to not throw an error but [Error: testing] was thrown"); + badFn.should.not.throw(); + should.not.throw(badFn); + }, 'expected [Function] to not throw an error but [Error: testing] was thrown'); err(() => { expect(badFn).to.throw(ReferenceError); - }, "expected [Function] to throw 'ReferenceError' but [Error: testing] was thrown"); + badFn.should.throw(ReferenceError); + should.throw(badFn, ReferenceError); + }, 'expected [Function] to throw \'ReferenceError\' but [Error: testing] was thrown'); err(() => { expect(badFn).to.throw(specificError); - }, "expected [Function] to throw [RangeError: boo] but [Error: testing] was thrown"); + badFn.should.throw(specificError); + should.throw(badFn, specificError); + }, 'expected [Function] to throw [RangeError: boo] but [Error: testing] was thrown'); err(() => { expect(badFn).to.not.throw(Error); - }, "expected [Function] to not throw 'Error' but [Error: testing] was thrown"); + badFn.should.not.throw(Error); + should.not.throw(badFn, Error); + }, 'expected [Function] to not throw \'Error\' but [Error: testing] was thrown'); err(() => { expect(refErrFn).to.not.throw(ReferenceError); - }, "expected [Function] to not throw 'ReferenceError' but [ReferenceError: hello] was thrown"); + refErrFn.should.not.throw(ReferenceError); + should.not.throw(refErrFn, ReferenceError); + }, 'expected [Function] to not throw \'ReferenceError\' but [ReferenceError: hello] was thrown'); err(() => { expect(badFn).to.throw(PoorlyConstructedError); - }, "expected [Function] to throw 'PoorlyConstructedError' but [Error: testing] was thrown"); + badFn.should.throw(PoorlyConstructedError); + should.throw(badFn, PoorlyConstructedError); + }, 'expected [Function] to throw \'PoorlyConstructedError\' but [Error: testing] was thrown'); err(() => { expect(ickyErrFn).to.not.throw(PoorlyConstructedError); + ickyErrFn.should.not.throw(PoorlyConstructedError); + should.not.throw(ickyErrFn, PoorlyConstructedError); }, /^(expected \[Function\] to not throw 'PoorlyConstructedError' but)(.*)(PoorlyConstructedError|\{ Object \()(.*)(was thrown)$/); err(() => { expect(ickyErrFn).to.throw(ReferenceError); + ickyErrFn.should.throw(ReferenceError); + should.throw(ickyErrFn, ReferenceError); }, /^(expected \[Function\] to throw 'ReferenceError' but)(.*)(PoorlyConstructedError|\{ Object \()(.*)(was thrown)$/); err(() => { expect(specificErrFn).to.throw(new ReferenceError('eek')); - }, "expected [Function] to throw [ReferenceError: eek] but [RangeError: boo] was thrown"); + specificErrFn.should.throw(new ReferenceError('eek')); + should.throw(specificErrFn, new ReferenceError('eek')); + }, 'expected [Function] to throw [ReferenceError: eek] but [RangeError: boo] was thrown'); err(() => { expect(specificErrFn).to.not.throw(specificError); - }, "expected [Function] to not throw [RangeError: boo]"); + specificErrFn.should.not.throw(specificError); + should.not.throw(specificErrFn, specificError); + }, 'expected [Function] to not throw [RangeError: boo]'); err(() => { expect(badFn).to.not.throw(/testing/); - }, "expected [Function] to throw error not matching /testing/"); + badFn.should.not.throw(/testing/); + should.not.throw(badFn, /testing/); + }, 'expected [Function] to throw error not matching /testing/'); err(() => { expect(badFn).to.throw(/hello/); - }, "expected [Function] to throw error matching /hello/ but got 'testing'"); + badFn.should.throw(/hello/); + should.throw(badFn, /hello/); + }, 'expected [Function] to throw error matching /hello/ but got \'testing\''); err(() => { expect(badFn).to.throw(Error, /hello/, 'blah'); - }, "blah: expected [Function] to throw error matching /hello/ but got 'testing'"); + badFn.should.throw(Error, /hello/, 'blah'); + should.throw(badFn, Error, /hello/, 'blah'); + }, 'blah: expected [Function] to throw error matching /hello/ but got \'testing\''); err(() => { expect(badFn).to.throw(Error, 'hello', 'blah'); - }, "blah: expected [Function] to throw error including 'hello' but got 'testing'"); + badFn.should.throw(Error, 'hello', 'blah'); + should.throw(badFn, Error, 'hello', 'blah'); + }, 'blah: expected [Function] to throw error including \'hello\' but got \'testing\''); } function use(){ - chai.use(function (_chai, utils) { + // ReSharper disable once InconsistentNaming + chai.use((_chai) => { _chai.can.use.any(); }); } function respondTo() { - function Foo() {}; var bar = {}; expect(Foo).to.respondTo('bar'); + Foo.should.respondTo('bar'); expect(Foo).to.not.respondTo('foo'); + Foo.should.not.respondTo('foo'); expect(Foo).itself.to.respondTo('func'); expect(Foo).itself.not.to.respondTo('bar'); expect(bar).to.respondTo('foo'); + bar.should.respondTo('foo'); err(() => { expect(Foo).to.respondTo('baz', 'constructor'); + Foo.should.respondTo('baz', 'constructor'); }, /^(constructor: expected)(.*)(\[Function: Foo\])(.*)(to respond to \'baz\')$/); err(() => { expect(bar).to.respondTo('baz', 'object'); + bar.should.respondTo('baz', 'object'); }, /^(object: expected)(.*)(\{ foo: \[Function\] \}|\{ Object \()(.*)(to respond to \'baz\')$/); } function satisfy() { - function matcher(num) { + function matcher(num: number) { return num === 1; - }; + } expect(1).to.satisfy(matcher); + (1).should.satisfy(matcher); err(() => { expect(2).to.satisfy(matcher, 'blah'); - }, "blah: expected 2 to satisfy [Function: matcher]"); + (2).should.satisfy(matcher, 'blah'); + }, 'blah: expected 2 to satisfy [Function: matcher]'); } function closeTo() { expect(1.5).to.be.closeTo(1.0, 0.5); + (1.5).should.be.closeTo(1.0, 0.5); expect(10).to.be.closeTo(20, 20); + (10).should.be.closeTo(20, 20); expect(-10).to.be.closeTo(20, 30); + (-10).should.be.closeTo(20, 30); err(() => { expect(2).to.be.closeTo(1.0, 0.5, 'blah'); - }, "blah: expected 2 to be close to 1 +/- 0.5"); + (2).should.be.closeTo(1.0, 0.5, 'blah'); + }, 'blah: expected 2 to be close to 1 +/- 0.5'); err(() => { expect(-10).to.be.closeTo(20, 29, 'blah'); - }, "blah: expected -10 to be close to 20 +/- 29"); + (-10).should.be.closeTo(20, 29, 'blah'); + }, 'blah: expected -10 to be close to 20 +/- 29'); } function includeMembers() { expect([1, 2, 3]).to.include.members([]); + [1, 2, 3].should.include.members([]); expect([1, 2, 3]).to.include.members([3, 2]); + [1, 2, 3].should.include.members([3, 2]); + expect([1, 2, 3]).to.not.include.members([8, 4]); + [1, 2, 3].should.not.include.members([8, 4]); + expect([1, 2, 3]).to.not.include.members([1, 2, 3, 4]); + + [1, 2, 3].should.not.include.members([1, 2, 3, 4]); } function sameMembers() { expect([5, 4]).to.have.same.members([4, 5]); + [5, 4].should.have.same.members([4, 5]); expect([5, 4]).to.have.same.members([5, 4]); + [5, 4].should.have.same.members([5, 4]); expect([5, 4]).to.not.have.same.members([]); + [5, 4].should.not.have.same.members([]); expect([5, 4]).to.not.have.same.members([6, 3]); + [5, 4].should.not.have.same.members([6, 3]); expect([5, 4]).to.not.have.same.members([5, 4, 2]); + [5, 4].should.not.have.same.members([5, 4, 2]); } function members() { @@ -774,617 +1132,611 @@ declare function suite(description: string, action: Function):void; declare function test(description: string, action: Function):void; interface FieldObj { - field: any; -} -class Foo { - constructor() { - - } + field: any; } class CrashyObject { - inspect (): void { - throw new Error("Arg's inspect() called even though the test passed"); - } + inspect (): void { + throw new Error('Arg\'s inspect() called even though the test passed'); + } } -suite('assert', function () { +suite('assert', () => { - test('assert', function () { - var foo = 'bar'; - assert(foo == 'bar', "expected foo to equal `bar`"); + test('assert', () => { + var foo = 'bar'; + assert(foo === 'bar', 'expected foo to equal `bar`'); - err(function () { - assert(foo == 'baz', "expected foo to equal `bar`"); - }, "expected foo to equal `bar`"); - }); + err(() => { + assert(foo === 'baz', 'expected foo to equal `bar`'); + }, 'expected foo to equal `bar`'); + }); - test('isTrue', function () { - assert.isTrue(true); - - err(function () { - assert.isTrue(false); - }, "expected false to be true"); + test('isTrue', () => { + assert.isTrue(true); - err(function () { - assert.isTrue(1); - }, "expected 1 to be true"); - - err(function () { - assert.isTrue('test'); - }, "expected 'test' to be true"); - }); + err(() => { + assert.isTrue(false); + }, 'expected false to be true'); - test('ok', function () { - assert.ok(true); - assert.ok(1); - assert.ok('test'); - - err(function () { - assert.ok(false); - }, "expected false to be truthy"); - - err(function () { - assert.ok(0); - }, "expected 0 to be truthy"); - - err(function () { - assert.ok(''); - }, "expected '' to be truthy"); - }); - - test('isFalse', function () { - assert.isFalse(false); - - err(function () { - assert.isFalse(true); - }, "expected true to be false"); - - err(function () { - assert.isFalse(0); - }, "expected 0 to be false"); - }); + err(() => { + assert.isTrue(1); + }, 'expected 1 to be true'); - test('equal', function () { - var foo: any; - assert.equal(foo, undefined); - }); + err(() => { + assert.isTrue('test'); + }, 'expected \'test\' to be true'); + }); - test('typeof / notTypeOf', function () { - assert.typeOf('test', 'string'); - assert.typeOf(true, 'boolean'); - assert.typeOf(5, 'number'); + test('ok', () => { + assert.ok(true); + assert.ok(1); + assert.ok('test'); + + err(() => { + assert.ok(false); + }, 'expected false to be truthy'); + + err(() => { + assert.ok(0); + }, 'expected 0 to be truthy'); + + err(() => { + assert.ok(''); + }, 'expected \'\' to be truthy'); + }); + + test('isFalse', () => { + assert.isFalse(false); + + err(() => { + assert.isFalse(true); + }, 'expected true to be false'); + + err(() => { + assert.isFalse(0); + }, 'expected 0 to be false'); + }); - err(function () { - assert.typeOf(5, 'string'); - }, "expected 5 to be a string"); + test('equal', () => { + assert.equal(void(0), undefined); + }); - }); + test('typeof / notTypeOf', () => { + assert.typeOf('test', 'string'); + assert.typeOf(true, 'boolean'); + assert.typeOf(5, 'number'); - test('notTypeOf', function () { - assert.notTypeOf('test', 'number'); - - err(function () { - assert.notTypeOf(5, 'number'); - }, "expected 5 not to be a number"); - }); + err(() => { + assert.typeOf(5, 'string'); + }, 'expected 5 to be a string'); - test('instanceOf', function () { - assert.instanceOf(new Foo(), Foo); - - err(function () { - assert.instanceOf(5, Foo); - }, "expected 5 to be an instance of Foo"); - assert.instanceOf(new CrashyObject(), CrashyObject); - }); - - test('notInstanceOf', function () { - assert.notInstanceOf(new Foo(), String); - - err(function () { - assert.notInstanceOf(new Foo(), Foo); - }, "expected {} to not be an instance of Foo"); - }); - - test('isObject', function () { - assert.isObject({}); - assert.isObject(new Foo()); - - err(function () { - assert.isObject(true); - }, "expected true to be an object"); - - err(function () { - assert.isObject(Foo); - }, "expected [Function: Foo] to be an object"); - - err(function () { - assert.isObject('foo'); - }, "expected 'foo' to be an object"); - }); - - test('isNotObject', function () { - assert.isNotObject(5); - - err(function () { - assert.isNotObject({}); - }, "expected {} not to be an object"); - }); - - test('notEqual', function () { - assert.notEqual(3, 4); - - err(function () { - assert.notEqual(5, 5); - }, "expected 5 to not equal 5"); - }); - - test('strictEqual', function () { - assert.strictEqual('foo', 'foo'); - - err(function () { - assert.strictEqual('5', 5); - }, "expected \'5\' to equal 5"); - }); - - test('notStrictEqual', function () { - assert.notStrictEqual(5, '5'); - - err(function () { - assert.notStrictEqual(5, 5); - }, "expected 5 to not equal 5"); - }); - - test('deepEqual', function () { - assert.deepEqual({tea: 'chai'}, {tea: 'chai'}); - - err(function () { - assert.deepEqual({tea: 'chai'}, {tea: 'black'}); - }, "expected { tea: \'chai\' } to deeply equal { tea: \'black\' }"); - - var obja = Object.create({ tea: 'chai' }) - , objb = Object.create({ tea: 'chai' }); - - assert.deepEqual(obja, objb); - - var obj1 = Object.create({tea: 'chai'}) - , obj2 = Object.create({tea: 'black'}); - - err(function () { - assert.deepEqual(obj1, obj2); - }, "expected { tea: \'chai\' } to deeply equal { tea: \'black\' }"); - }); - - test('deepEqual (ordering)', function () { - var a = { a: 'b', c: 'd' } - , b = { c: 'd', a: 'b' }; - assert.deepEqual(a, b); - }); - - test('deepEqual (circular)', function () { - var circularObject:any = {} - , secondCircularObject:any = {}; - circularObject.field = circularObject; - secondCircularObject.field = secondCircularObject; - - assert.deepEqual(circularObject, secondCircularObject); - - err(function () { - secondCircularObject.field2 = secondCircularObject; - assert.deepEqual(circularObject, secondCircularObject); - }, "expected { field: [Circular] } to deeply equal { Object (field, field2) }"); - }); - - test('notDeepEqual', function () { - assert.notDeepEqual({tea: 'jasmine'}, {tea: 'chai'}); - err(function () { - assert.notDeepEqual({tea: 'chai'}, {tea: 'chai'}); - }, "expected { tea: \'chai\' } to not deeply equal { tea: \'chai\' }"); - }); - - test('notDeepEqual (circular)', function () { - var circularObject:any = {} - , secondCircularObject:any = { tea: 'jasmine' }; - circularObject.field = circularObject; - secondCircularObject.field = secondCircularObject; - - assert.notDeepEqual(circularObject, secondCircularObject); - - err(function () { - delete secondCircularObject.tea; - assert.notDeepEqual(circularObject, secondCircularObject); - }, "expected { field: [Circular] } to not deeply equal { field: [Circular] }"); - }); - - test('isNull', function () { - assert.isNull(null); - - err(function () { - assert.isNull(undefined); - }, "expected undefined to equal null"); - }); - - test('isNotNull', function () { - assert.isNotNull(undefined); - - err(function () { - assert.isNotNull(null); - }, "expected null to not equal null"); - }); - - test('isUndefined', function () { - assert.isUndefined(undefined); - - err(function () { - assert.isUndefined(null); - }, "expected null to equal undefined"); - }); - - test('isDefined', function () { - assert.isDefined(null); - - err(function () { - assert.isDefined(undefined); - }, "expected undefined to not equal undefined"); - }); - - test('isFunction', function () { - var func = function () { - }; - assert.isFunction(func); - - err(function () { - assert.isFunction({}); - }, "expected {} to be a function"); - }); - - test('isNotFunction', function () { - assert.isNotFunction(5); - - err(function () { - assert.isNotFunction(function () { - }); - }, "expected [Function] not to be a function"); - }); - - test('isArray', function () { - assert.isArray([]); - assert.isArray(new Array()); - - err(function () { - assert.isArray({}); - }, "expected {} to be an array"); - }); - - test('isNotArray', function () { - assert.isNotArray(3); - - err(function () { - assert.isNotArray([]); - }, "expected [] not to be an array"); - - err(function () { - assert.isNotArray(new Array()); - }, "expected [] not to be an array"); - }); - - test('isString', function () { - assert.isString('Foo'); - assert.isString(new String('foo')); - - err(function () { - assert.isString(1); - }, "expected 1 to be a string"); - }); - - test('isNotString', function () { - assert.isNotString(3); - assert.isNotString([ 'hello' ]); - - err(function () { - assert.isNotString('hello'); - }, "expected 'hello' not to be a string"); - }); - - test('isNumber', function () { - assert.isNumber(1); - assert.isNumber(Number('3')); - - err(function () { - assert.isNumber('1'); - }, "expected \'1\' to be a number"); - }); - - test('isNotNumber', function () { - assert.isNotNumber('hello'); - assert.isNotNumber([ 5 ]); - - err(function () { - assert.isNotNumber(4); - }, "expected 4 not to be a number"); - }); - - test('isBoolean', function () { - assert.isBoolean(true); - assert.isBoolean(false); - - err(function () { - assert.isBoolean('1'); - }, "expected \'1\' to be a boolean"); - }); - - test('isNotBoolean', function () { - assert.isNotBoolean('true'); - - err(function () { - assert.isNotBoolean(true); - }, "expected true not to be a boolean"); - - err(function () { - assert.isNotBoolean(false); - }, "expected false not to be a boolean"); - }); - - test('include', function () { - assert.include('foobar', 'bar'); - assert.include([ 1, 2, 3], 3); - - err(function () { - assert.include('foobar', 'baz'); - }, "expected \'foobar\' to contain \'baz\'"); - - err(function () { - assert.include(undefined, 'bar'); - }, "expected an array or string"); - }); - - test('notInclude', function () { - assert.notInclude('foobar', 'baz'); - assert.notInclude([ 1, 2, 3 ], 4); - - err(function () { - assert.notInclude('foobar', 'bar'); - }, "expected \'foobar\' to not contain \'bar\'"); - - err(function () { - assert.notInclude(undefined, 'bar'); - }, "expected an array or string"); - }); - - test('lengthOf', function () { - assert.lengthOf([1, 2, 3], 3); - assert.lengthOf('foobar', 6); - - err(function () { - assert.lengthOf('foobar', 5); - }, "expected 'foobar' to have a length of 5 but got 6"); - - err(function () { - assert.lengthOf(1, 5); - }, "expected 1 to have a property \'length\'"); - }); - - test('match', function () { - assert.match('foobar', /^foo/); - assert.notMatch('foobar', /^bar/); - - err(function () { - assert.match('foobar', /^bar/i); - }, "expected 'foobar' to match /^bar/i"); - - err(function () { - assert.notMatch('foobar', /^foo/i); - }, "expected 'foobar' not to match /^foo/i"); - }); - - test('property', function () { - var obj = { foo: { bar: 'baz' } }; - var simpleObj = { foo: 'bar' }; - assert.property(obj, 'foo'); - assert.deepProperty(obj, 'foo.bar'); - assert.notProperty(obj, 'baz'); - assert.notProperty(obj, 'foo.bar'); - assert.notDeepProperty(obj, 'foo.baz'); - assert.deepPropertyVal(obj, 'foo.bar', 'baz'); - assert.deepPropertyNotVal(obj, 'foo.bar', 'flow'); - - err(function () { - assert.property(obj, 'baz'); - }, "expected { foo: { bar: 'baz' } } to have a property 'baz'"); - - err(function () { - assert.deepProperty(obj, 'foo.baz'); - }, "expected { foo: { bar: 'baz' } } to have a deep property 'foo.baz'"); - - err(function () { - assert.notProperty(obj, 'foo'); - }, "expected { foo: { bar: 'baz' } } to not have property 'foo'"); - - err(function () { - assert.notDeepProperty(obj, 'foo.bar'); - }, "expected { foo: { bar: 'baz' } } to not have deep property 'foo.bar'"); - - err(function () { - assert.propertyVal(simpleObj, 'foo', 'ball'); - }, "expected { foo: 'bar' } to have a property 'foo' of 'ball', but got 'bar'"); - - err(function () { - assert.deepPropertyVal(obj, 'foo.bar', 'ball'); - }, "expected { foo: { bar: 'baz' } } to have a deep property 'foo.bar' of 'ball', but got 'baz'"); - - err(function () { - assert.propertyNotVal(simpleObj, 'foo', 'bar'); - }, "expected { foo: 'bar' } to not have a property 'foo' of 'bar'"); - - err(function () { - assert.deepPropertyNotVal(obj, 'foo.bar', 'baz'); - }, "expected { foo: { bar: 'baz' } } to not have a deep property 'foo.bar' of 'baz'"); - }); - - test('throws', function () { - assert.throws(function () { - throw new Error('foo'); - }); - assert.throws(function () { - throw new Error('bar'); - }, 'bar'); - assert.throws(function () { - throw new Error('bar'); - }, /bar/); - assert.throws(function () { - throw new Error('bar'); - }, Error); - assert.throws(function () { - throw new Error('bar'); - }, Error, 'bar'); - - err(function () { - assert.throws(function () { - throw new Error('foo') - }, TypeError); - }, "expected [Function] to throw 'TypeError' but [Error: foo] was thrown") - - err(function () { - assert.throws(function () { - throw new Error('foo') - }, 'bar'); - }, "expected [Function] to throw error including 'bar' but got 'foo'") - - err(function () { - assert.throws(function () { - throw new Error('foo') - }, Error, 'bar'); - }, "expected [Function] to throw error including 'bar' but got 'foo'") - - err(function () { - assert.throws(function () { - throw new Error('foo') - }, TypeError, 'bar'); - }, "expected [Function] to throw 'TypeError' but [Error: foo] was thrown") - - err(function () { - assert.throws(function () { - }); - }, "expected [Function] to throw an error"); - - err(function () { - assert.throws(function () { - throw new Error('') - }, 'bar'); - }, "expected [Function] to throw error including 'bar' but got ''"); - - err(function () { - assert.throws(function () { - throw new Error('') - }, /bar/); - }, "expected [Function] to throw error matching /bar/ but got ''"); - }); - - test('doesNotThrow', function () { - assert.doesNotThrow(function () { - }); - assert.doesNotThrow(function () { - }, 'foo'); - - err(function () { - assert.doesNotThrow(function () { - throw new Error('foo'); - }); - }, 'expected [Function] to not throw an error but [Error: foo] was thrown'); - }); - - test('ifError', function () { - assert.ifError(false); - assert.ifError(null); - assert.ifError(undefined); - - err(function () { - assert.ifError('foo'); - }, "expected \'foo\' to be falsy"); - }); - - test('operator', function () { - assert.operator(1, '<', 2); - assert.operator(2, '>', 1); - assert.operator(1, '==', 1); - assert.operator(1, '<=', 1); - assert.operator(1, '>=', 1); - assert.operator(1, '!=', 2); - assert.operator(1, '!==', 2); - - err(function () { - assert.operator(1, '=', 2); - }, 'Invalid operator "="'); - - err(function () { - assert.operator(2, '<', 1); - }, "expected 2 to be < 1"); - - err(function () { - assert.operator(1, '>', 2); - }, "expected 1 to be > 2"); - - err(function () { - assert.operator(1, '==', 2); - }, "expected 1 to be == 2"); - - err(function () { - assert.operator(2, '<=', 1); - }, "expected 2 to be <= 1"); - - err(function () { - assert.operator(1, '>=', 2); - }, "expected 1 to be >= 2"); - - err(function () { - assert.operator(1, '!=', 1); - }, "expected 1 to be != 1"); - - err(function () { - assert.operator(1, '!==', '1'); - }, "expected 1 to be !== \'1\'"); - }); - - test('closeTo', function () { - assert.closeTo(1.5, 1.0, 0.5); - assert.closeTo(10, 20, 20); - assert.closeTo(-10, 20, 30); - - err(function () { - assert.closeTo(2, 1.0, 0.5); - }, "expected 2 to be close to 1 +/- 0.5"); - - err(function () { - assert.closeTo(-10, 20, 29); - }, "expected -10 to be close to 20 +/- 29"); - }); - - test('members', function () { - assert.includeMembers([1, 2, 3], [2, 3]); - assert.includeMembers([1, 2, 3], []); - assert.includeMembers([1, 2, 3], [3]); - - err(function () { - assert.includeMembers([5, 6], [7, 8]); - }, 'expected [ 5, 6 ] to be a superset of [ 7, 8 ]'); - - err(function () { - assert.includeMembers([5, 6], [5, 6, 0]); - }, 'expected [ 5, 6 ] to be a superset of [ 5, 6, 0 ]'); - }); - - test('memberEquals', function () { - assert.sameMembers([], []); - assert.sameMembers([1, 2, 3], [3, 2, 1]); - assert.sameMembers([4, 2], [4, 2]); - - err(function () { - assert.sameMembers([], [1, 2]); - }, 'expected [] to have the same members as [ 1, 2 ]'); - - err(function () { - assert.sameMembers([1, 54], [6, 1, 54]); - }, 'expected [ 1, 54 ] to have the same members as [ 6, 1, 54 ]'); - }); + }); + + test('notTypeOf', () => { + assert.notTypeOf('test', 'number'); + + err(() => { + assert.notTypeOf(5, 'number'); + }, 'expected 5 not to be a number'); + }); + + test('instanceOf', () => { + assert.instanceOf(new Foo(), Foo); + + err(() => { + assert.instanceOf(5, Foo); + }, 'expected 5 to be an instance of Foo'); + assert.instanceOf(new CrashyObject(), CrashyObject); + }); + + test('notInstanceOf', () => { + assert.notInstanceOf(new Foo(), String); + + err(() => { + assert.notInstanceOf(new Foo(), Foo); + }, 'expected {} to not be an instance of Foo'); + }); + + test('isObject', () => { + assert.isObject({}); + assert.isObject(new Foo()); + + err(() => { + assert.isObject(true); + }, 'expected true to be an object'); + + err(() => { + assert.isObject(Foo); + }, 'expected [Function: Foo] to be an object'); + + err(() => { + assert.isObject('foo'); + }, 'expected \'foo\' to be an object'); + }); + + test('isNotObject', () => { + assert.isNotObject(5); + + err(() => { + assert.isNotObject({}); + }, 'expected {} not to be an object'); + }); + + test('notEqual', () => { + assert.notEqual(3, 4); + + err(() => { + assert.notEqual(5, 5); + }, 'expected 5 to not equal 5'); + }); + + test('strictEqual', () => { + assert.strictEqual('foo', 'foo'); + + err(() => { + assert.strictEqual('5', 5); + }, 'expected \'5\' to equal 5'); + }); + + test('notStrictEqual', () => { + assert.notStrictEqual(5, '5'); + + err(() => { + assert.notStrictEqual(5, 5); + }, 'expected 5 to not equal 5'); + }); + + test('deepEqual', () => { + assert.deepEqual({tea: 'chai'}, {tea: 'chai'}); + + err(() => { + assert.deepEqual({tea: 'chai'}, {tea: 'black'}); + }, 'expected { tea: \'chai\' } to deeply equal { tea: \'black\' }'); + + var obja = Object.create({ tea: 'chai' }) + , objb = Object.create({ tea: 'chai' }); + + assert.deepEqual(obja, objb); + + var obj1 = Object.create({tea: 'chai'}) + , obj2 = Object.create({tea: 'black'}); + + err(() => { + assert.deepEqual(obj1, obj2); + }, 'expected { tea: \'chai\' } to deeply equal { tea: \'black\' }'); + }); + + test('deepEqual (ordering)', () => { + var a = { a: 'b', c: 'd' } + , b = { c: 'd', a: 'b' }; + assert.deepEqual(a, b); + }); + + test('deepEqual (circular)', () => { + var circularObject:any = {} + , secondCircularObject:any = {}; + circularObject.field = circularObject; + secondCircularObject.field = secondCircularObject; + + assert.deepEqual(circularObject, secondCircularObject); + + err(() => { + secondCircularObject.field2 = secondCircularObject; + assert.deepEqual(circularObject, secondCircularObject); + }, 'expected { field: [Circular] } to deeply equal { Object (field, field2) }'); + }); + + test('notDeepEqual', () => { + assert.notDeepEqual({tea: 'jasmine'}, {tea: 'chai'}); + err(() => { + assert.notDeepEqual({tea: 'chai'}, {tea: 'chai'}); + }, 'expected { tea: \'chai\' } to not deeply equal { tea: \'chai\' }'); + }); + + test('notDeepEqual (circular)', () => { + var circularObject:any = {} + , secondCircularObject:any = { tea: 'jasmine' }; + circularObject.field = circularObject; + secondCircularObject.field = secondCircularObject; + + assert.notDeepEqual(circularObject, secondCircularObject); + + err(() => { + delete secondCircularObject.tea; + assert.notDeepEqual(circularObject, secondCircularObject); + }, 'expected { field: [Circular] } to not deeply equal { field: [Circular] }'); + }); + + test('isNull', () => { + assert.isNull(null); + + err(() => { + assert.isNull(undefined); + }, 'expected undefined to equal null'); + }); + + test('isNotNull', () => { + assert.isNotNull(undefined); + + err(() => { + assert.isNotNull(null); + }, 'expected null to not equal null'); + }); + + test('isUndefined', () => { + assert.isUndefined(undefined); + + err(() => { + assert.isUndefined(null); + }, 'expected null to equal undefined'); + }); + + test('isDefined', () => { + assert.isDefined(null); + + err(() => { + assert.isDefined(undefined); + }, 'expected undefined to not equal undefined'); + }); + + test('isFunction', () => { + var func = () => { + }; + assert.isFunction(func); + + err(() => { + assert.isFunction({}); + }, 'expected {} to be a function'); + }); + + test('isNotFunction', () => { + assert.isNotFunction(5); + + err(() => { + assert.isNotFunction(() => { + }); + }, 'expected [Function] not to be a function'); + }); + + test('isArray', () => { + assert.isArray([]); + assert.isArray(new Array()); + + err(() => { + assert.isArray({}); + }, 'expected {} to be an array'); + }); + + test('isNotArray', () => { + assert.isNotArray(3); + + err(() => { + assert.isNotArray([]); + }, 'expected [] not to be an array'); + + err(() => { + assert.isNotArray(new Array()); + }, 'expected [] not to be an array'); + }); + + test('isString', () => { + assert.isString('Foo'); + assert.isString(new String('foo')); + + err(() => { + assert.isString(1); + }, 'expected 1 to be a string'); + }); + + test('isNotString', () => { + assert.isNotString(3); + assert.isNotString([ 'hello' ]); + + err(() => { + assert.isNotString('hello'); + }, 'expected \'hello\' not to be a string'); + }); + + test('isNumber', () => { + assert.isNumber(1); + assert.isNumber(Number('3')); + + err(() => { + assert.isNumber('1'); + }, 'expected \'1\' to be a number'); + }); + + test('isNotNumber', () => { + assert.isNotNumber('hello'); + assert.isNotNumber([ 5 ]); + + err(() => { + assert.isNotNumber(4); + }, 'expected 4 not to be a number'); + }); + + test('isBoolean', () => { + assert.isBoolean(true); + assert.isBoolean(false); + + err(() => { + assert.isBoolean('1'); + }, 'expected \'1\' to be a boolean'); + }); + + test('isNotBoolean', () => { + assert.isNotBoolean('true'); + + err(() => { + assert.isNotBoolean(true); + }, 'expected true not to be a boolean'); + + err(() => { + assert.isNotBoolean(false); + }, 'expected false not to be a boolean'); + }); + + test('include', () => { + assert.include('foobar', 'bar'); + assert.include([ 1, 2, 3], 3); + + err(() => { + assert.include('foobar', 'baz'); + }, 'expected \'foobar\' to contain \'baz\''); + + err(() => { + assert.include(undefined, 'bar'); + }, 'expected an array or string'); + }); + + test('notInclude', () => { + assert.notInclude('foobar', 'baz'); + assert.notInclude([ 1, 2, 3 ], 4); + + err(() => { + assert.notInclude('foobar', 'bar'); + }, 'expected \'foobar\' to not contain \'bar\''); + + err(() => { + assert.notInclude(undefined, 'bar'); + }, 'expected an array or string'); + }); + + test('lengthOf', () => { + assert.lengthOf([1, 2, 3], 3); + assert.lengthOf('foobar', 6); + + err(() => { + assert.lengthOf('foobar', 5); + }, 'expected \'foobar\' to have a length of 5 but got 6'); + + err(() => { + assert.lengthOf(1, 5); + }, 'expected 1 to have a property \'length\''); + }); + + test('match', () => { + assert.match('foobar', /^foo/); + assert.notMatch('foobar', /^bar/); + + err(() => { + assert.match('foobar', /^bar/i); + }, 'expected \'foobar\' to match /^bar/i'); + + err(() => { + assert.notMatch('foobar', /^foo/i); + }, 'expected \'foobar\' not to match /^foo/i'); + }); + + test('property', () => { + var obj = { foo: { bar: 'baz' } }; + var simpleObj = { foo: 'bar' }; + assert.property(obj, 'foo'); + assert.deepProperty(obj, 'foo.bar'); + assert.notProperty(obj, 'baz'); + assert.notProperty(obj, 'foo.bar'); + assert.notDeepProperty(obj, 'foo.baz'); + assert.deepPropertyVal(obj, 'foo.bar', 'baz'); + assert.deepPropertyNotVal(obj, 'foo.bar', 'flow'); + + err(() => { + assert.property(obj, 'baz'); + }, 'expected { foo: { bar: \'baz\' } } to have a property \'baz\''); + + err(() => { + assert.deepProperty(obj, 'foo.baz'); + }, 'expected { foo: { bar: \'baz\' } } to have a deep property \'foo.baz\''); + + err(() => { + assert.notProperty(obj, 'foo'); + }, 'expected { foo: { bar: \'baz\' } } to not have property \'foo\''); + + err(() => { + assert.notDeepProperty(obj, 'foo.bar'); + }, 'expected { foo: { bar: \'baz\' } } to not have deep property \'foo.bar\''); + + err(() => { + assert.propertyVal(simpleObj, 'foo', 'ball'); + }, 'expected { foo: \'bar\' } to have a property \'foo\' of \'ball\', but got \'bar\''); + + err(() => { + assert.deepPropertyVal(obj, 'foo.bar', 'ball'); + }, 'expected { foo: { bar: \'baz\' } } to have a deep property \'foo.bar\' of \'ball\', but got \'baz\''); + + err(() => { + assert.propertyNotVal(simpleObj, 'foo', 'bar'); + }, 'expected { foo: \'bar\' } to not have a property \'foo\' of \'bar\''); + + err(() => { + assert.deepPropertyNotVal(obj, 'foo.bar', 'baz'); + }, 'expected { foo: { bar: \'baz\' } } to not have a deep property \'foo.bar\' of \'baz\''); + }); + + test('throws', () => { + assert.throws(() => { + throw new Error('foo'); + }); + assert.throws(() => { + throw new Error('bar'); + }, 'bar'); + assert.throws(() => { + throw new Error('bar'); + }, /bar/); + assert.throws(() => { + throw new Error('bar'); + }, Error); + assert.throws(() => { + throw new Error('bar'); + }, Error, 'bar'); + + err(() => { + assert.throws(() => { + throw new Error('foo'); + }, TypeError); + }, 'expected [Function] to throw \'TypeError\' but [Error: foo] was thrown'); + + err(() => { + assert.throws(() => { + throw new Error('foo'); + }, 'bar'); + }, 'expected [Function] to throw error including \'bar\' but got \'foo\''); + + err(() => { + assert.throws(() => { + throw new Error('foo'); + }, Error, 'bar'); + }, 'expected [Function] to throw error including \'bar\' but got \'foo\''); + + err(() => { + assert.throws(() => { + throw new Error('foo'); + }, TypeError, 'bar'); + }, 'expected [Function] to throw \'TypeError\' but [Error: foo] was thrown'); + + err(() => { + assert.throws(() => { + }); + }, 'expected [Function] to throw an error'); + + err(() => { + assert.throws(() => { + throw new Error(''); + }, 'bar'); + }, 'expected [Function] to throw error including \'bar\' but got \'\''); + + err(() => { + assert.throws(() => { + throw new Error(''); + }, /bar/); + }, 'expected [Function] to throw error matching /bar/ but got \'\''); + }); + + test('doesNotThrow', () => { + assert.doesNotThrow(() => { + }); + assert.doesNotThrow(() => { + }, 'foo'); + + err(() => { + assert.doesNotThrow(() => { + throw new Error('foo'); + }); + }, 'expected [Function] to not throw an error but [Error: foo] was thrown'); + }); + + test('ifError', () => { + assert.ifError(false); + assert.ifError(null); + assert.ifError(undefined); + + err(() => { + assert.ifError('foo'); + }, 'expected \'foo\' to be falsy'); + }); + + test('operator', () => { + assert.operator(1, '<', 2); + assert.operator(2, '>', 1); + assert.operator(1, '==', 1); + assert.operator(1, '<=', 1); + assert.operator(1, '>=', 1); + assert.operator(1, '!=', 2); + assert.operator(1, '!==', 2); + + err(() => { + assert.operator(1, '=', 2); + }, 'Invalid operator "="'); + + err(() => { + assert.operator(2, '<', 1); + }, 'expected 2 to be < 1'); + + err(() => { + assert.operator(1, '>', 2); + }, 'expected 1 to be > 2'); + + err(() => { + assert.operator(1, '==', 2); + }, 'expected 1 to be == 2'); + + err(() => { + assert.operator(2, '<=', 1); + }, 'expected 2 to be <= 1'); + + err(() => { + assert.operator(1, '>=', 2); + }, 'expected 1 to be >= 2'); + + err(() => { + assert.operator(1, '!=', 1); + }, 'expected 1 to be != 1'); + + err(() => { + assert.operator(1, '!==', '1'); + }, 'expected 1 to be !== \'1\''); + }); + + test('closeTo', () => { + assert.closeTo(1.5, 1.0, 0.5); + assert.closeTo(10, 20, 20); + assert.closeTo(-10, 20, 30); + + err(() => { + assert.closeTo(2, 1.0, 0.5); + }, 'expected 2 to be close to 1 +/- 0.5'); + + err(() => { + assert.closeTo(-10, 20, 29); + }, 'expected -10 to be close to 20 +/- 29'); + }); + + test('members', () => { + assert.includeMembers([1, 2, 3], [2, 3]); + assert.includeMembers([1, 2, 3], []); + assert.includeMembers([1, 2, 3], [3]); + + err(() => { + assert.includeMembers([5, 6], [7, 8]); + }, 'expected [ 5, 6 ] to be a superset of [ 7, 8 ]'); + + err(() => { + assert.includeMembers([5, 6], [5, 6, 0]); + }, 'expected [ 5, 6 ] to be a superset of [ 5, 6, 0 ]'); + }); + + test('memberEquals', () => { + assert.sameMembers([], []); + assert.sameMembers([1, 2, 3], [3, 2, 1]); + assert.sameMembers([4, 2], [4, 2]); + + err(() => { + assert.sameMembers([], [1, 2]); + }, 'expected [] to have the same members as [ 1, 2 ]'); + + err(() => { + assert.sameMembers([1, 54], [6, 1, 54]); + }, 'expected [ 1, 54 ] to have the same members as [ 6, 1, 54 ]'); + }); }); diff --git a/chai/chai-tests.ts.tscparams b/chai/chai-tests.ts.tscparams deleted file mode 100644 index d3f5a12fa..000000000 --- a/chai/chai-tests.ts.tscparams +++ /dev/null @@ -1 +0,0 @@ - diff --git a/chai/chai.d.ts b/chai/chai.d.ts index 4b9d313dd..f693582c5 100644 --- a/chai/chai.d.ts +++ b/chai/chai.d.ts @@ -1,67 +1,67 @@ // Type definitions for chai 2.0.0 // Project: http://chaijs.com/ -// Definitions by: Jed Hunsaker , Bart van der Schoor +// Definitions by: Jed Mao , +// Bart van der Schoor , +// Andrew Brown // Definitions: https://github.com/borisyankov/DefinitelyTyped -declare module chai { - export class AssertionError { - constructor(message: string, _props?: any, ssf?: Function); - name: string; - message: string; - showDiff: boolean; - stack: string; +declare module Chai { + + interface ChaiStatic { + expect: ExpectStatic; + should(): Should; + /** + * Provides a way to extend the internals of Chai + */ + use(fn: (chai: any, utils: any) => void): any; + assert: AssertStatic; + config: Config; } - export function expect(target: any, message?: string): Expect; - - export var assert: Assert; - export var config: Config; - - export interface Config { - includeStack: boolean; + export interface ExpectStatic extends AssertionStatic { } - // Provides a way to extend the internals of Chai - function use(fn: (chai: any, utils: any) => void): any; - - interface ExpectStatic { - (target: any): Expect; + export interface AssertStatic extends Assert { } - interface Assertions { - attr(name: string, value?: string): any; - css(name: string, value?: string): any; - data(name: string, value?: string): any; - class(className: string): any; - id(id: string): any; - html(html: string): any; - text(text: string): any; - value(value: string): any; - visible: any; - hidden: any; - selected: any; - checked: any; - disabled: any; - empty: any; - exist: any; + export interface AssertionStatic { + (target: any, message?: string): Assertion; } - interface Expect extends LanguageChains, NumericComparison, TypeComparison, Assertions { - not: Expect; + interface ShouldAssertion { + equal(value1: any, value2: any, message?: string): void; + Throw: ShouldThrow; + throw: ShouldThrow; + exist(value: any, message?: string): void; + } + + interface Should extends ShouldAssertion { + not: ShouldAssertion; + fail(actual: any, expected: any, message?: string, operator?: string): void; + } + + interface ShouldThrow { + (actual: Function): void; + (actual: Function, expected: string|RegExp, message?: string): void; + (actual: Function, constructor: Error|Function, expected?: string|RegExp, message?: string): void; + } + + interface Assertion extends LanguageChains, NumericComparison, TypeComparison { + not: Assertion; deep: Deep; a: TypeComparison; an: TypeComparison; include: Include; contain: Include; - ok: Expect; - true: Expect; - false: Expect; - null: Expect; - undefined: Expect; - exist: Expect; - empty: Expect; - arguments: Expect; - Arguments: Expect; + ok: Assertion; + true: Assertion; + false: Assertion; + null: Assertion; + undefined: Assertion; + exist: Assertion; + empty: Assertion; + arguments: Assertion; + Arguments: Assertion; equal: Equal; equals: Equal; eq: Equal; @@ -72,34 +72,34 @@ declare module chai { haveOwnProperty: OwnProperty; length: Length; lengthOf: Length; - match(RegularExpression: RegExp, message?: string): Expect; - string(string: string, message?: string): Expect; + match(regexp: RegExp|string, message?: string): Assertion; + string(string: string, message?: string): Assertion; keys: Keys; - key(string: string): Expect; + key(string: string): Assertion; throw: Throw; throws: Throw; Throw: Throw; - respondTo(method: string, message?: string): Expect; - itself: Expect; - satisfy(matcher: Function, message?: string): Expect; - closeTo(expected: number, delta: number, message?: string): Expect; + respondTo(method: string, message?: string): Assertion; + itself: Assertion; + satisfy(matcher: Function, message?: string): Assertion; + closeTo(expected: number, delta: number, message?: string): Assertion; members: Members; } interface LanguageChains { - to: Expect; - be: Expect; - been: Expect; - is: Expect; - that: Expect; - which: Expect; - and: Expect; - have: Expect; - has: Expect; - with: Expect; - at: Expect; - of: Expect; - same: Expect; + to: Assertion; + be: Assertion; + been: Assertion; + is: Assertion; + that: Assertion; + which: Assertion; + and: Assertion; + has: Assertion; + have: Assertion; + with: Assertion; + at: Assertion; + of: Assertion; + same: Assertion; } interface NumericComparison { @@ -113,173 +113,196 @@ declare module chai { lessThan: NumberComparer; most: NumberComparer; lte: NumberComparer; - within(start: number, finish: number, message?: string): Expect; + within(start: number, finish: number, message?: string): Assertion; } interface NumberComparer { - (value: number, message?: string): Expect; + (value: number, message?: string): Assertion; } interface TypeComparison { - (type: string, message?: string): Expect; + (type: string, message?: string): Assertion; instanceof: InstanceOf; instanceOf: InstanceOf; } interface InstanceOf { - (constructor: Object, message?: string): Expect; + (constructor: Object, message?: string): Assertion; } interface Deep { equal: Equal; + include: Include; property: Property; } interface Equal { - (value: any, message?: string): Expect; + (value: any, message?: string): Assertion; } interface Property { - (name: string, value?: any, message?: string): Expect; + (name: string, value?: any, message?: string): Assertion; } interface OwnProperty { - (name: string, message?: string): Expect; + (name: string, message?: string): Assertion; } interface Length extends LanguageChains, NumericComparison { - (length: number, message?: string): Expect; + (length: number, message?: string): Assertion; } interface Include { - (value: Object, message?: string): Expect; - (value: string, message?: string): Expect; - (value: number, message?: string): Expect; + (value: Object, message?: string): Assertion; + (value: string, message?: string): Assertion; + (value: number, message?: string): Assertion; keys: Keys; members: Members; } interface Keys { - (...keys: string[]): Expect; - (keys: any[]): Expect; - } - - interface Members { - (set: any[], message?: string): Expect; + (...keys: string[]): Assertion; + (keys: any[]): Assertion; } interface Throw { - (): Expect; - (expected: string, message?: string): Expect; - (expected: RegExp, message?: string): Expect; - (constructor: Error, expected?: string, message?: string): Expect; - (constructor: Error, expected?: RegExp, message?: string): Expect; - (constructor: Function, expected?: string, message?: string): Expect; - (constructor: Function, expected?: RegExp, message?: string): Expect; + (): Assertion; + (expected: string, message?: string): Assertion; + (expected: RegExp, message?: string): Assertion; + (constructor: Error, expected?: string, message?: string): Assertion; + (constructor: Error, expected?: RegExp, message?: string): Assertion; + (constructor: Function, expected?: string, message?: string): Assertion; + (constructor: Function, expected?: RegExp, message?: string): Assertion; + } + + interface Members { + (set: any[], message?: string): Assertion; } export interface Assert { - (express: any, msg?: string):void; + /** + * @param expression Expression to test for truthiness. + * @param message Message to display on error. + */ + (expression: any, message?: string): void; - fail(actual?: any, expected?: any, msg?: string, operator?: string):void; + fail(actual?: any, expected?: any, msg?: string, operator?: string): void; - ok(val: any, msg?: string):void; - notOk(val: any, msg?: string):void; + ok(val: any, msg?: string): void; + notOk(val: any, msg?: string): void; - equal(act: any, exp: any, msg?: string):void; - notEqual(act: any, exp: any, msg?: string):void; + equal(act: any, exp: any, msg?: string): void; + notEqual(act: any, exp: any, msg?: string): void; - strictEqual(act: any, exp: any, msg?: string):void; - notStrictEqual(act: any, exp: any, msg?: string):void; + strictEqual(act: any, exp: any, msg?: string): void; + notStrictEqual(act: any, exp: any, msg?: string): void; - deepEqual(act: any, exp: any, msg?: string):void; - notDeepEqual(act: any, exp: any, msg?: string):void; + deepEqual(act: any, exp: any, msg?: string): void; + notDeepEqual(act: any, exp: any, msg?: string): void; - isTrue(val: any, msg?: string):void; - isFalse(val: any, msg?: string):void; + isTrue(val: any, msg?: string): void; + isFalse(val: any, msg?: string): void; - isNull(val: any, msg?: string):void; - isNotNull(val: any, msg?: string):void; + isNull(val: any, msg?: string): void; + isNotNull(val: any, msg?: string): void; - isUndefined(val: any, msg?: string):void; - isDefined(val: any, msg?: string):void; + isUndefined(val: any, msg?: string): void; + isDefined(val: any, msg?: string): void; - isFunction(val: any, msg?: string):void; - isNotFunction(val: any, msg?: string):void; + isFunction(val: any, msg?: string): void; + isNotFunction(val: any, msg?: string): void; - isObject(val: any, msg?: string):void; - isNotObject(val: any, msg?: string):void; + isObject(val: any, msg?: string): void; + isNotObject(val: any, msg?: string): void; - isArray(val: any, msg?: string):void; - isNotArray(val: any, msg?: string):void; + isArray(val: any, msg?: string): void; + isNotArray(val: any, msg?: string): void; - isString(val: any, msg?: string):void; - isNotString(val: any, msg?: string):void; + isString(val: any, msg?: string): void; + isNotString(val: any, msg?: string): void; - isNumber(val: any, msg?: string):void; - isNotNumber(val: any, msg?: string):void; + isNumber(val: any, msg?: string): void; + isNotNumber(val: any, msg?: string): void; - isBoolean(val: any, msg?: string):void; - isNotBoolean(val: any, msg?: string):void; + isBoolean(val: any, msg?: string): void; + isNotBoolean(val: any, msg?: string): void; - typeOf(val: any, type: string, msg?: string):void; - notTypeOf(val: any, type: string, msg?: string):void; + typeOf(val: any, type: string, msg?: string): void; + notTypeOf(val: any, type: string, msg?: string): void; - instanceOf(val: any, type: Function, msg?: string):void; - notInstanceOf(val: any, type: Function, msg?: string):void; + instanceOf(val: any, type: Function, msg?: string): void; + notInstanceOf(val: any, type: Function, msg?: string): void; - include(exp: string, inc: any, msg?: string):void; - include(exp: any[], inc: any, msg?: string):void; + include(exp: string, inc: any, msg?: string): void; + include(exp: any[], inc: any, msg?: string): void; - notInclude(exp: string, inc: any, msg?: string):void; - notInclude(exp: any[], inc: any, msg?: string):void; + notInclude(exp: string, inc: any, msg?: string): void; + notInclude(exp: any[], inc: any, msg?: string): void; - match(exp: any, re: RegExp, msg?: string):void; - notMatch(exp: any, re: RegExp, msg?: string):void; + match(exp: any, re: RegExp, msg?: string): void; + notMatch(exp: any, re: RegExp, msg?: string): void; - property(obj: Object, prop: string, msg?: string):void; - notProperty(obj: Object, prop: string, msg?: string):void; - deepProperty(obj: Object, prop: string, msg?: string):void; - notDeepProperty(obj: Object, prop: string, msg?: string):void; + property(obj: Object, prop: string, msg?: string): void; + notProperty(obj: Object, prop: string, msg?: string): void; + deepProperty(obj: Object, prop: string, msg?: string): void; + notDeepProperty(obj: Object, prop: string, msg?: string): void; - propertyVal(obj: Object, prop: string, val: any, msg?: string):void; - propertyNotVal(obj: Object, prop: string, val: any, msg?: string):void; + propertyVal(obj: Object, prop: string, val: any, msg?: string): void; + propertyNotVal(obj: Object, prop: string, val: any, msg?: string): void; - deepPropertyVal(obj: Object, prop: string, val: any, msg?: string):void; - deepPropertyNotVal(obj: Object, prop: string, val: any, msg?: string):void; + deepPropertyVal(obj: Object, prop: string, val: any, msg?: string): void; + deepPropertyNotVal(obj: Object, prop: string, val: any, msg?: string): void; - lengthOf(exp: any, len: number, msg?: string):void; + lengthOf(exp: any, len: number, msg?: string): void; //alias frenzy - throw(fn: Function, msg?: string):void; - throw(fn: Function, regExp: RegExp):void; - throw(fn: Function, errType: Function, msg?: string):void; - throw(fn: Function, errType: Function, regExp: RegExp):void; + throw(fn: Function, msg?: string): void; + throw(fn: Function, regExp: RegExp): void; + throw(fn: Function, errType: Function, msg?: string): void; + throw(fn: Function, errType: Function, regExp: RegExp): void; - throws(fn: Function, msg?: string):void; - throws(fn: Function, regExp: RegExp):void; - throws(fn: Function, errType: Function, msg?: string):void; - throws(fn: Function, errType: Function, regExp: RegExp):void; + throws(fn: Function, msg?: string): void; + throws(fn: Function, regExp: RegExp): void; + throws(fn: Function, errType: Function, msg?: string): void; + throws(fn: Function, errType: Function, regExp: RegExp): void; - Throw(fn: Function, msg?: string):void; - Throw(fn: Function, regExp: RegExp):void; - Throw(fn: Function, errType: Function, msg?: string):void; - Throw(fn: Function, errType: Function, regExp: RegExp):void; + Throw(fn: Function, msg?: string): void; + Throw(fn: Function, regExp: RegExp): void; + Throw(fn: Function, errType: Function, msg?: string): void; + Throw(fn: Function, errType: Function, regExp: RegExp): void; - doesNotThrow(fn: Function, msg?: string):void; - doesNotThrow(fn: Function, regExp: RegExp):void; - doesNotThrow(fn: Function, errType: Function, msg?: string):void; - doesNotThrow(fn: Function, errType: Function, regExp: RegExp):void; + doesNotThrow(fn: Function, msg?: string): void; + doesNotThrow(fn: Function, regExp: RegExp): void; + doesNotThrow(fn: Function, errType: Function, msg?: string): void; + doesNotThrow(fn: Function, errType: Function, regExp: RegExp): void; - operator(val: any, operator: string, val2: any, msg?: string):void; - closeTo(act: number, exp: number, delta: number, msg?: string):void; + operator(val: any, operator: string, val2: any, msg?: string): void; + closeTo(act: number, exp: number, delta: number, msg?: string): void; - sameMembers(set1: any[], set2: any[], msg?: string):void; - includeMembers(set1: any[], set2: any[], msg?: string):void; + sameMembers(set1: any[], set2: any[], msg?: string): void; + includeMembers(set1: any[], set2: any[], msg?: string): void; - ifError(val: any, msg?: string):void; + ifError(val: any, msg?: string): void; + } + + export interface Config { + includeStack: boolean; + } + + export class AssertionError { + constructor(message: string, _props?: any, ssf?: Function); + name: string; + message: string; + showDiff: boolean; + stack: string; } } +declare var chai: Chai.ChaiStatic; + declare module "chai" { export = chai; } + +interface Object { + should: Chai.Assertion; +} diff --git a/chartjs/chart-tests.ts b/chartjs/chart-tests.ts index 2374b6228..4bd8820c6 100644 --- a/chartjs/chart-tests.ts +++ b/chartjs/chart-tests.ts @@ -252,12 +252,12 @@ var myPolarAreaChart = new Chart(ctx).PolarArea(polarAreaData, { var myPolarAreaChartLegend: string = myPolarAreaChart.generateLegend(); var myPolarAreaChartImage: string = myPolarAreaChart.toBase64Image(); -myPolarAreaChart.addData([{ +myPolarAreaChart.addData({ value: 120, color: "#4D5360", highlight: "#616774", label: "Dark Grey" -}], 0); +}, 0); myPolarAreaChart.clear(); myPolarAreaChart.removeData(0); myPolarAreaChart.resize(); @@ -301,12 +301,12 @@ var myPieChart = new Chart(ctx).Pie(pieData, { var myPieChartLegend: string = myPieChart.generateLegend(); var myPieChartImage: string = myPieChart.toBase64Image(); -myPieChart.addData([{ +myPieChart.addData({ value: 120, color: "#4D5360", highlight: "#616774", label: "Dark Grey" -}], 0); +}, 0); myPieChart.clear(); myPieChart.removeData(0); myPieChart.resize(); @@ -329,12 +329,12 @@ var myDoughnutChart = new Chart(ctx).Doughnut(pieData, { var myDoughnutChartLegend: string = myDoughnutChart.generateLegend(); var myDoughnutChartImage: string = myDoughnutChart.toBase64Image(); -myPieChart.addData([{ +myPieChart.addData({ value: 120, color: "#4D5360", highlight: "#616774", label: "Dark Grey" -}], 0); +}, 0); myDoughnutChart.clear(); myDoughnutChart.removeData(0); myDoughnutChart.resize(); diff --git a/chartjs/chart.d.ts b/chartjs/chart.d.ts index d85f9b476..9da7245f6 100644 --- a/chartjs/chart.d.ts +++ b/chartjs/chart.d.ts @@ -113,7 +113,7 @@ interface LinearInstance extends ChartInstance { interface CircularInstance extends ChartInstance { getSegmentsAtEvent: (event: Event) => {}[]; update: () => void; - addData: (valuesArray: CircularChartData[], index: number) => void; + addData: (valuesArray: CircularChartData, index?: number) => void; removeData: (index: number) => void; segments: Array; } diff --git a/chrome/chrome-app-tests.ts b/chrome/chrome-app-tests.ts index 01657dc85..970e03517 100644 --- a/chrome/chrome-app-tests.ts +++ b/chrome/chrome-app-tests.ts @@ -23,8 +23,21 @@ chrome.app.runtime.onLaunched.addListener(function (launchData: runtime.LaunchDa chrome.app.runtime.onRestarted.addListener(function () { return; }); -// Get Current Window +// retrieving windows var currentWindow: cwindow.AppWindow = chrome.app.window.current(); +var otherWindow: cwindow.AppWindow = chrome.app.window.get('some-string'); +var allWindows: cwindow.AppWindow[] = chrome.app.window.getAll(); + +// listening to window events +currentWindow.onBoundsChanged.addListener(function () { return; }); +currentWindow.onClosed.addListener(function () { return; }); +currentWindow.onFullscreened.addListener(function () { return; }); +currentWindow.onMaximized.addListener(function () { return; }); +currentWindow.onMinimized.addListener(function () { return; }); +currentWindow.onRestored.addListener(function () { return; }); + +// check platform capabilities +var visibleEverywhere: boolean = chrome.app.window.canSetVisibleOnAllWorkspaces(); // FileSystem // https://developer.chrome.com/apps/fileSystem diff --git a/chrome/chrome-app.d.ts b/chrome/chrome-app.d.ts index a2b0d5997..5cfa0fbce 100644 --- a/chrome/chrome-app.d.ts +++ b/chrome/chrome-app.d.ts @@ -122,10 +122,19 @@ declare module chrome.app.window { id: string; innerBounds: Bounds; outerBounds: Bounds; + onBoundsChanged: WindowEvent; + onClosed: WindowEvent; + onFullscreened: WindowEvent; + onMaximized: WindowEvent; + onMinimized: WindowEvent; + onRestored: WindowEvent; } export function create(url: string, options?: CreateWindowOptions, callback?: (created_window: AppWindow) => void): void; export function current(): AppWindow; + export function get(id: string): AppWindow; + export function getAll(): AppWindow[]; + export function canSetVisibleOnAllWorkspaces(): boolean; interface WindowEvent { addListener(callback: () => void): void; diff --git a/chrome/chrome-tests.ts b/chrome/chrome-tests.ts index 8d27a9d55..57aa25f4f 100644 --- a/chrome/chrome-tests.ts +++ b/chrome/chrome-tests.ts @@ -174,3 +174,26 @@ function catBlock () { // extraInfoSpec ["blocking"]); } + +// contrived settings example +function proxySettings() { + chrome.proxy.settings.get({ incognito: false }, (details) => { + var val = details.value; + var level: string = details.levelOfControl; + var incognito: boolean = details.incognitoSpecific; + }); + + // bare minimum set call + chrome.proxy.settings.set({ value: 'something' }); + + // add a scope and callback + chrome.proxy.settings.set({ + value: 'something', + scope: 'regular' + }, () => {}); + + chrome.proxy.settings.clear({}); + + // clear with a scope set + chrome.proxy.settings.clear({ scope: 'regular' }); +} diff --git a/chrome/chrome.d.ts b/chrome/chrome.d.ts index f67cb3949..23eb24bef 100755 --- a/chrome/chrome.d.ts +++ b/chrome/chrome.d.ts @@ -2061,8 +2061,11 @@ declare module chrome.ttsEngine { // Types //////////////////// declare module chrome.types { - interface ChromeSettingSetDetails { + interface ChromeSettingClearDetails { scope?: string; + } + + interface ChromeSettingSetDetails extends ChromeSettingClearDetails { value: any; } @@ -2070,6 +2073,8 @@ declare module chrome.types { incognito?: boolean; } + type DetailsCallback = (details: ChromeSettingGetResultDetails) => void; + interface ChromeSettingGetResultDetails { levelOfControl: string; value: any; @@ -2077,7 +2082,7 @@ declare module chrome.types { } interface ChromeSettingChangedEvent extends chrome.events.Event { - addListener(callback: (details: ChromeSettingGetResultDetails) => void): void; + addListener(callback: DetailsCallback): void; } interface ChromeSetting { @@ -2086,7 +2091,8 @@ declare module chrome.types { callback?: Function; }; set(details: ChromeSettingSetDetails, callback?: Function): void; - get(details: ChromeSettingGetDetails, callback?: ChromeSettingGetResultDetails): void; + get(details: ChromeSettingGetDetails, callback?: DetailsCallback): void; + clear(details: ChromeSettingClearDetails, callback?: Function): void; onChange: ChromeSettingChangedEvent; } } diff --git a/colorbrewer/colorbrewer-tests.ts b/colorbrewer/colorbrewer-tests.ts new file mode 100644 index 000000000..7e17551b5 --- /dev/null +++ b/colorbrewer/colorbrewer-tests.ts @@ -0,0 +1,8 @@ +/// + +var accent3: string[] = colorbrewer.Accent[3]; +var accent4: string[] = colorbrewer.Accent[4]; +var accent5: string[] = colorbrewer.Accent[5]; +var accent6: string[] = colorbrewer.Accent[6]; +var accent7: string[] = colorbrewer.Accent[7]; +var accent8: string[] = colorbrewer.Accent[8]; diff --git a/colorbrewer/colorbrewer.d.ts b/colorbrewer/colorbrewer.d.ts new file mode 100644 index 000000000..ecd4bffc7 --- /dev/null +++ b/colorbrewer/colorbrewer.d.ts @@ -0,0 +1,76 @@ +// Type definitions for colorbrewer v1.0.0 +// Project: https://github.com/jeanlauliac/colorbrewer +// Definitions by: Matt Traynham +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare var colorbrewer: ColorBrewer.Base; + +declare module ColorBrewer { + interface ColorScheme { + [n: number]: string[]; + } + + interface EightColorScheme extends ColorScheme { + 3: [string, string, string]; + 4: [string, string, string, string]; + 5: [string, string, string, string, string]; + 6: [string, string, string, string, string, string]; + 7: [string, string, string, string, string, string, string]; + 8: [string, string, string, string, string, string, string, string]; + } + + interface NineColorScheme extends EightColorScheme { + 9: [string, string, string, string, string, string, string, string, string]; + } + + interface ElevenColorScheme extends NineColorScheme { + 10: [string, string, string, string, string, string, string, string, string, string]; + 11: [string, string, string, string, string, string, string, string, string, string, string]; + } + + interface TwelveColorScheme extends ElevenColorScheme { + 12: [string, string, string, string, string, string, string, string, string, string, string, string]; + } + + interface Base { + YlGn: NineColorScheme; + YlGnBu: NineColorScheme; + GnBu: NineColorScheme; + BuGn: NineColorScheme; + PuBuGn: NineColorScheme; + PuBu: NineColorScheme; + BuPu: NineColorScheme; + RdPu: NineColorScheme; + PuRd: NineColorScheme; + OrRd: NineColorScheme; + YlOrRd: NineColorScheme; + YlOrBr: NineColorScheme; + Purples: NineColorScheme; + Blues: NineColorScheme; + Greens: NineColorScheme; + Oranges: NineColorScheme; + Reds: NineColorScheme; + Greys: NineColorScheme; + PuOr: ElevenColorScheme; + BrBG: ElevenColorScheme; + PRGn: ElevenColorScheme; + PiYG: ElevenColorScheme; + RdBu: ElevenColorScheme; + RdGy: ElevenColorScheme; + RdYlBu: ElevenColorScheme; + Spectral: ElevenColorScheme; + RdYlGn: ElevenColorScheme; + Accent: EightColorScheme; + Dark2: EightColorScheme; + Paired: TwelveColorScheme; + Pastel1: NineColorScheme; + Pastel2: EightColorScheme; + Set1: NineColorScheme; + Set2: EightColorScheme; + Set3: TwelveColorScheme; + } +} + +declare module 'colorbrewer' { + export = colorbrewer; +} diff --git a/connect-flash/connect-flash-tests.ts b/connect-flash/connect-flash-tests.ts new file mode 100644 index 000000000..303c12647 --- /dev/null +++ b/connect-flash/connect-flash-tests.ts @@ -0,0 +1,16 @@ +/// + +import express = require('express'); +import flash = require('connect-flash'); + +var app = express(); + +app.use(flash()); +app.use(flash({ + unsafe: false +})); + +app.use(function(req: Express.Request, res: Express.Response, next: Function) { + req.flash('Message'); + req.flash('info', 'Message'); +}); diff --git a/connect-flash/connect-flash.d.ts b/connect-flash/connect-flash.d.ts new file mode 100644 index 000000000..0b8047a72 --- /dev/null +++ b/connect-flash/connect-flash.d.ts @@ -0,0 +1,22 @@ +// Type definitions for connect-flash +// Project: https://github.com/jaredhanson/connect-flash +// Definitions by: Andreas Gassmann +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module Express { + export interface Request { + flash(message: string): any; + flash(event: string, message: string): any; + } +} + +declare module "connect-flash" { + import express = require('express'); + interface IConnectFlashOptions { + unsafe?: boolean; + } + function e(options?: IConnectFlashOptions): express.RequestHandler; + export = e; +} diff --git a/connect-slashes/connect-slashes-tests.ts b/connect-slashes/connect-slashes-tests.ts new file mode 100644 index 000000000..6fc66bbc0 --- /dev/null +++ b/connect-slashes/connect-slashes-tests.ts @@ -0,0 +1,53 @@ +/// + +import express = require('express'); +import slashes = require('connect-slashes'); + +var app = express(); + +// Using default settings... +app.use(slashes()); + + +// Remove slashes instead of adding them... +app.use(slashes(false)); + + +// With additional options defined inline... +app.use(slashes(true, { + base: '/blog', + code: 302, + headers: { + 'Cache-Control': 'public', + 'Accpet': 'application/json' + } +})); + + +// Defining an options object and referencing +// it in the constructor... +var options: slashes.Options = { + base: '/blog', + code: 302, + headers: { + 'Cache-Control': 'public', + 'Accpet': 'application/json' + } +}; +app.use(slashes(true, options)); + + +// Defining an options object with only +// some properties... +var options: slashes.Options = { + base: '/blog' +} +var options: slashes.Options = { + code: 302 +} +var options: slashes.Options = { + headers: { + 'Cache-Control': 'public', + 'Accpet': 'application/json' + } +} diff --git a/connect-slashes/connect-slashes.d.ts b/connect-slashes/connect-slashes.d.ts new file mode 100644 index 000000000..58f0e7e69 --- /dev/null +++ b/connect-slashes/connect-slashes.d.ts @@ -0,0 +1,40 @@ +// Type definitions for connect-slashes +// Project: https://github.com/avinoamr/connect-slashes +// Definitions by: Sam Herrmann +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/* =================== USAGE =================== + + import express = require('express'); + import slashes = require('connect-slashes'); + + var app = express(); + app.use(slashes()); + =============================================== */ + +/// + + +declare module "connect-slashes" { + import express = require('express'); + + /** + * @see https://github.com/avinoamr/connect-slashes#usage + */ + function slashes (addTrailingSlashes?: boolean, options?: slashes.Options): express.RequestHandler; + + module slashes { + + /** + * Additional settings + * @see https://github.com/avinoamr/connect-slashes#additional-settings + */ + interface Options { + base?: string; + code?: number; + headers?: {[field: string]: string}; + } + } + + export = slashes; +} diff --git a/convert-source-map/convert-source-map.d.ts b/convert-source-map/convert-source-map.d.ts index 6034d13f7..34a0b2c8e 100644 --- a/convert-source-map/convert-source-map.d.ts +++ b/convert-source-map/convert-source-map.d.ts @@ -6,22 +6,22 @@ declare module "convert-source-map" { export interface SourceMapConverter { toObject(): any; - toJSON(space?): string; + toJSON(space?: any): string; toBase64(): string; toComment(): string; - addProperty(key, value): SourceMapConverter; - setProperty(key, value): SourceMapConverter; + addProperty(key: string, value: any): SourceMapConverter; + setProperty(key: string, value: any): SourceMapConverter; - getProperty(key): any; + getProperty(key: string): any; } - export function removeComments(src): string; + export function removeComments(src: string): string; export var commentRegex: RegExp; - export function fromObject(obj): SourceMapConverter; + export function fromObject(obj: any): SourceMapConverter; export function fromJSON(json: string): SourceMapConverter; export function fromBase64(base64: string): SourceMapConverter; export function fromComment(comment: string): SourceMapConverter; export function fromSource(source: string): SourceMapConverter; -} \ No newline at end of file +} diff --git a/cron/cron-tests.ts b/cron/cron-tests.ts new file mode 100644 index 000000000..cea98cdab --- /dev/null +++ b/cron/cron-tests.ts @@ -0,0 +1,66 @@ +/// + +import cron = require('cron'); +var CronJob = cron.CronJob; +var CronTime = cron.CronTime; + +var timeZone = 'America/Los_Angeles'; + +// Usage (basic cron usage): +new CronJob('* * * * * *', () => { + console.log('You will see this message every second'); +}, null, true, 'America/Los_Angeles'); + +// Another cron example +var job = new CronJob('00 30 11 * * 1-5', () => { + /* + * Runs every weekday (Monday through Friday) + * at 11:30:00 AM. It does not run on Saturday + * or Sunday. + */ + }, () => { + /* This function is executed when the job stops */ + }, + true, /* Start the job right now */ + timeZone /* Time zone of this job. */ +); + +// Another example with Date +var job = new CronJob(new Date(), () => { + /* runs once at the specified date. */ + }, () => { + /* This function is executed when the job stops */ + }, + true, /* Start the job right now */ + timeZone /* Time zone of this job. */ +); + +// For good measure +var job = new CronJob({ + cronTime: '00 30 11 * * 1-5', + onTick: () => { + /* + * Runs every weekday (Monday through Friday) + * at 11:30:00 AM. It does not run on Saturday + * or Sunday. + */ + }, + start: false, + timeZone: 'America/Los_Angeles' +}); +job.start(); + +// How to check if a cron pattern is valid: +try { + new CronJob('invalid cron pattern', () => { + console.log('this should not be printed'); + }) +} catch(ex) { + console.log("cron pattern not valid"); +} + + +// Check cronTime fomat +new CronTime('* * * * * *'); +new CronTime(new Date()); + diff --git a/cron/cron.d.ts b/cron/cron.d.ts new file mode 100644 index 000000000..c956a26fb --- /dev/null +++ b/cron/cron.d.ts @@ -0,0 +1,27 @@ +// Type definitions for cron 1.0.9 +// Project: https://www.npmjs.com/package/cron +// Definitions by: Hiroki Horiuchi +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module "cron" { + + interface CronJobStatic { + new(cronTime: string|Date, onTick: () => void, onComplete?: () => void, start?: boolean, timezone?: string, context?: any): CronJob; + new(options: { + cronTime: string|Date; onTick: () => void; onComplete?: () => void; start?: boolean; timezone?: string; context?: any + }): CronJob; + } + interface CronJob { + start(): void; + stop(): void; + } + export var CronJob: CronJobStatic; + + interface CronTimeStatic { + new(time: string|Date): CronTime; + } + interface CronTime {} + export var CronTime: CronTimeStatic; + +} + diff --git a/custom-error-generator/custom-error-generator-tests.ts b/custom-error-generator/custom-error-generator-tests.ts new file mode 100644 index 000000000..09ae86373 --- /dev/null +++ b/custom-error-generator/custom-error-generator-tests.ts @@ -0,0 +1,6 @@ +/// + +import createCustomError = require('custom-error-generator'); +var HTTPError = createCustomError('HTTPError', { 'code' : 500, 'status' : 'Server Error' }); +var error = new HTTPError('Uh oh'); +console.log(error.code, error.status); diff --git a/custom-error-generator/custom-error-generator.d.ts b/custom-error-generator/custom-error-generator.d.ts new file mode 100644 index 000000000..8ce65f673 --- /dev/null +++ b/custom-error-generator/custom-error-generator.d.ts @@ -0,0 +1,11 @@ +// Type definitions for custom-error-generator 7.0.0 +// Project: https://github.com/jproulx/node-custom-error +// Definitions by: Thierry Miceli +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module "custom-error-generator" { + function createError(name: string, parameters?: Object, Constructor?: any): any; + module createError { + } + export = createError; +} diff --git a/d3/d3.d.ts b/d3/d3.d.ts index 18a27790b..495999bb8 100644 --- a/d3/d3.d.ts +++ b/d3/d3.d.ts @@ -1,3287 +1,3287 @@ -// Type definitions for d3JS -// Project: http://d3js.org/ -// Definitions by: Alex Ford , Boris Yankov -// Definitions: https://github.com/borisyankov/DefinitelyTyped - -declare module d3 { - /** - * The current version of D3.js. - */ - export var version: string; - - /** - * Find the first element that matches the given selector string. - */ - export function select(selector: string): Selection; - - /** - * Create a selection from the given node reference. - */ - export function select(node: EventTarget): Selection; - - /** - * Find all elements that match the given selector string. - */ - export function selectAll(selector: string): Selection; - - /** - * Create a selection from the given list of nodes. - */ - export function selectAll(nodes: EventTarget[]): Selection; - - /** - * Returns the root selection (as if by d3.select(document.documentElement)). This function may be used for 'instanceof' tests, and extending its prototype will add properties to all selections. - */ - export function selection(): Selection; - - module selection { - export var prototype: Selection; - - /** - * Selections are grouped into arrays of nodes, with the parent tracked in the 'parentNode' property. - */ - interface Group extends Array { - parentNode: EventTarget; - } - - interface Update { - /** - * Retrieve a grouped selection. - */ - [index: number]: Group; - - /** - * The number of groups in this selection. - */ - length: number; - - /** - * Retrieve the value of the given attribute for the first node in the selection. - * - * @param name The attribute name to query. May be prefixed (see d3.ns.prefix). - */ - attr(name: string): string; - - /** - * For all nodes, set the attribute to the specified constant value. Use null to remove. - * - * @param name The attribute name, optionally prefixed. - * @param value The attribute value to use. Note that this is coerced to a string automatically. - */ - attr(name: string, value: Primitive): Update; - - /** - * Derive an attribute value for each node in the selection based on bound data. - * - * @param name The attribute name, optionally prefixed. - * @param value The function of the datum (the bound data item) and index (the position in the subgrouping) which computes the attribute value. If the function returns null, the attribute is removed. - */ - attr(name: string, value: (datum: Datum, index: number) => Primitive): Update; - - /** - * Set multiple properties at once using an Object. D3 iterates over all enumerable properties and either sets or computes the attribute's value based on the corresponding entry in the Object. - * - * @param obj A key-value mapping corresponding to attributes and values. If the value is a simple string or number, it is taken as a constant. Otherwise, it is a function that derives the attribute value. - */ - attr(obj: { [key: string]: Primitive | ((datum: Datum, index: number) => Primitive) }): Update; - - /** - * Returns true if the first node in this selection has the given class list. If multiple classes are specified (i.e., "foo bar"), then returns true only if all classes match. - * - * @param name The class list to query. - */ - classed(name: string): boolean; - - /** - * Adds (or removes) the given class list. - * - * @param name The class list to toggle. Spaces separate class names: "foo bar" is a list of two classes. - * @param value If true, add the classes. If false, remove them. - */ - classed(name: string, value: boolean): Update; - - /** - * Determine if the given class list should be toggled for each node in the selection. - * - * @param name The class list. Spaces separate multiple class names. - * @param value The function to run for each node. Should return true to add the class to the node, or false to remove it. - */ - classed(name: string, value: (datum: Datum, index: number) => boolean): Update; - - /** - * Set or derive classes for multiple class lists at once. - * - * @param obj An Object mapping class lists to values that are either plain booleans or functions that return booleans. - */ - classed(obj: { [key: string]: boolean | ((datum: Datum, index: number) => boolean) }): Update; - - /** - * Retrieve the computed style value for the first node in the selection. - * @param name The CSS property name to query - */ - style(name: string): string; - - /** - * Set a style property for all nodes in the selection. - * @param name the CSS property name - * @param value the property value - * @param priority if specified, either null or the string "important" (no exclamation mark) - */ - style(name: string, value: Primitive, priority?: string): Update; - - /** - * Derive a property value for each node in the selection. - * @param name the CSS property name - * @param value the function to derive the value - * @param priority if specified, either null or the string "important" (no exclamation mark) - */ - style(name: string, value: (datum: Datum, index: number) => Primitive, priority?: string): Update; - - /** - * Set a large number of CSS properties from an object. - * - * @param obj an Object whose keys correspond to CSS property names and values are either constants or functions that derive property values - * @param priority if specified, either null or the string "important" (no exclamation mark) - */ - style(obj: { [key: string]: Primitive | ((datum: Datum, index: number) => Primitive) }, priority?: string): Update; - - /** - * Retrieve an arbitrary node property such as the 'checked' property of checkboxes, or the 'value' of text boxes. - * - * @param name the node's property to retrieve - */ - property(name: string): any; - - /** - * For each node, set the property value. Internally, this sets the node property directly (e.g., node[name] = value), so take care not to mutate special properties like __proto__. - * - * @param name the property name - * @param value the property value - */ - property(name: string, value: any): Update; - - /** - * For each node, derive the property value. Internally, this sets the node property directly (e.g., node[name] = value), so take care not to mutate special properties like __proto__. - * - * @param name the property name - * @param value the function used to derive the property's value - */ - property(name: string, value: (datum: Datum, index: number) => any): Update; - - /** - * Set multiple node properties. Caveats apply: take care not to mutate special properties like __proto__. - * - * @param obj an Object whose keys correspond to node properties and values are either constants or functions that will compute a value. - */ - property(obj: { [key: string]: any | ((datum: Datum, index: number) => any) }): Update; - - /** - * Retrieve the textContent of the first node in the selection. - */ - text(): string; - - /** - * Set the textContent of each node in the selection. - * @param value the text to use for all nodes - */ - text(value: Primitive): Update; - - /** - * Compute the textContent of each node in the selection. - * @param value the function which will compute the text - */ - text(value: (datum: Datum, index: number) => Primitive): Update; - - /** - * Retrieve the HTML content of the first node in the selection. Uses 'innerHTML' internally and will not work with SVG or other elements without a polyfill. - */ - html(): string; - - /** - * Set the HTML content of every node in the selection. Uses 'innerHTML' internally and thus will not work with SVG or other elements without a polyfill. - * @param value the HTML content to use. - */ - html(value: string): Selection; - - /** - * Compute the HTML content for each node in the selection. Uses 'innerHTML' internally and thus will not work with SVG or other elements without a polyfill. - * @param value the function to compute HTML content - */ - html(value: (datum: Datum, index: number) => string): Selection; - - /** - * Appends a new child to each node in the selection. This child will inherit the parent's data (if available). Returns a fresh selection consisting of the newly-appended children. - * - * @param name the element name to append. May be prefixed (see d3.ns.prefix). - */ - append(name: string): Selection; - - /** - * Appends a new child to each node in the selection by computing a new node. This child will inherit the parent's data (if available). Returns a fresh selection consisting of the newly-appended children. - * - * @param name the function to compute a new element - */ - append(name: (datum: Datum, index: number) => EventTarget): Update; - - /** - * Inserts a new child to each node in the selection. This child will inherit its parent's data (if available). Returns a fresh selection consisting of the newly-inserted children. - * @param name the element name to append. May be prefixed (see d3.ns.prefix). - * @param before the selector to determine position (e.g., ":first-child") - */ - insert(name: string, before: string): Update; - - /** - * Inserts a new child to each node in the selection. This child will inherit its parent's data (if available). Returns a fresh selection consisting of the newly-inserted children. - * @param name the element name to append. May be prefixed (see d3.ns.prefix). - * @param before a function to determine the node to use as the next sibling - */ - insert(name: string, before: (datum: Datum, index: number) => EventTarget): Update; - - /** - * Inserts a new child to the end of each node in the selection by computing a new node. This child will inherit its parent's data (if available). Returns a fresh selection consisting of the newly-inserted children. - * @param name the function to compute a new child - * @param before the selector to determine position (e.g., ":first-child") - */ - insert(name: (datum: Datum, index: number) => EventTarget, before: string): Update; - - /** - * Inserts a new child to the end of each node in the selection by computing a new node. This child will inherit its parent's data (if available). Returns a fresh selection consisting of the newly-inserted children. - * @param name the function to compute a new child - * @param before a function to determine the node to use as the next sibling - */ - insert(name: (datum: Datum, index: number) => EventTarget, before: (datum: Datum, index: number) => EventTarget): Update; - - /** - * Removes the elements from the DOM. They are in a detached state and may be re-added (though there is currently no dedicated API for doing so). - */ - remove(): Update; - - /** - * Retrieves the data bound to the first group in this selection. - */ - data(): Datum[]; - - /** - * Binds data to this selection. - * @param data the array of data to bind to this selection - * @param key the optional function to determine the unique key for each piece of data. When unspecified, uses the index of the element. - */ - data(data: NewDatum[], key?: (datum: NewDatum, index: number) => string): Update; - - /** - * Derives data to bind to this selection. - * @param data the function to derive data. Must return an array. - * @param key the optional function to determine the unique key for each data item. When unspecified, uses the index of the element. - */ - data(data: (datum: Datum, index: number) => NewDatum[], key?: (datum: NewDatum, index: number) => string): Update; - - /** - * Filters the selection, returning only those nodes that match the given CSS selector. - * @param selector the CSS selector - */ - filter(selector: string): Update; - - /** - * Filters the selection, returning only those nodes for which the given function returned true. - * @param selector the filter function - */ - filter(selector: (datum: Datum, index: number) => boolean): Update; - - /** - * Return the data item bound to the first element in the selection. - */ - datum(): Datum; - - /** - * Set the data item for each node in the selection. - * @param value the constant element to use for each node - */ - datum(value: NewDatum): Update; - - /** - * Derive the data item for each node in the selection. Useful for situations such as the HTML5 'dataset' attribute. - * @param value the function to compute data for each node - */ - datum(value: (datum: Datum, index: number) => NewDatum): Update; - - /** - * Reorders nodes in the selection based on the given comparator. Nodes are re-inserted into the document once sorted. - * @param comparator the comparison function, which defaults to d3.ascending - */ - sort(comparator?: (a: Datum, b: Datum) => number): Update; - - /** - * Reorders nodes in the document to match the selection order. More efficient than calling sort() if the selection is already ordered. - */ - order(): Update; - - /** - * Returns the listener (if any) for the given event. - * @param type the type of event to load the listener for. May have a namespace (e.g., ".foo") at the end. - */ - on(type: string): (datum: Datum, index: number) => any; - - /** - * Adds a listener for the specified event. If one was already registered, it is removed before the new listener is added. The return value of the listener function is ignored. - * @param type the of event to listen to. May have a namespace (e.g., ".foo") at the end. - * @param listener an event listener function, or null to unregister - * @param capture sets the DOM useCapture flag - */ - on(type: string, listener: (datum: Datum, index: number) => any, capture?: boolean): Update; - - /** - * Begins a new transition. Interrupts any active transitions of the same name. - * @param name the transition name (defaults to "") - */ - transition(name?: string): Transition; - - /** - * Interrupts the active transition of the provided name. Does not cancel scheduled transitions. - * @param name the transition name (defaults to "") - */ - interrupt(name?: string): Update; - - /** - * Creates a subselection by finding the first descendent matching the selector string. Bound data is inherited. - * @param selector the CSS selector to match against - */ - select(selector: string): Update; - - /** - * Creates a subselection by using a function to find descendent elements. Bound data is inherited. - * @param selector the function to find matching descendants - */ - select(selector: (datum: Datum, index: number) => EventTarget): Update; - - /** - * Creates a subselection by finding all descendents that match the given selector. Bound data is not inherited. - * @param selector the CSS selector to match against - */ - selectAll(selector: string): Update; - - /** - * Creates a subselection by using a function to find descendent elements. Bound data is not inherited. - * @param selector the function to find matching descendents - */ - selectAll(selector: (datum: Datum, index: number) => Array | NodeList): Update; - - /** - * Invoke the given function for each element in the selection. The return value of the function is ignored. - * @param func the function to invoke - */ - each(func: (datum: Datum, index: number) => any): Update; - - /** - * Call a function on the selection. sel.call(foo) is equivalent to foo(sel). - * @param func the function to call on the selection - * @param args any optional args - */ - call(func: (sel: Update, ...args: any[]) => any, ...args: any[]): Update; - - /** - * Returns true if the current selection is empty. - */ - empty(): boolean; - - /** - * Returns the first non-null element in the selection, or null otherwise. - */ - node(): EventTarget; - - /** - * Returns the total number of elements in the selection. - */ - size(): number; - - /** - * Returns the placeholder nodes for each data element for which no corresponding DOM element was found. - */ - enter(): Enter; - - /** - * Returns a selection for those DOM nodes for which no new data element was found. - */ - exit(): Selection; - } - - interface Enter { - append(name: string): Selection; - append(name: (datum: Datum, index: number) => EventTarget): Selection; - - insert(name: string, before?: string): Selection; - insert(name: string, before: (datum: Datum, index: number) => EventTarget): Selection; - insert(name: (datum: Datum, index: number) => EventTarget, before?: string): Selection; - insert(name: (datum: Datum, index: number) => EventTarget, before: (datum: Datum, index: number) => EventTarget): Selection; - - select(name: (datum: Datum, index: number) => EventTarget): Selection; - call(func: (selection: Enter, ...args: any[]) => any, ...args: any[]): Enter; - } - } - - /** - * Administrivia: JavaScript primitive types, or "things that toString() predictably". - */ - export type Primitive = number | string | boolean; - - /** - * Administrivia: anything with a valueOf(): number method is comparable, so we allow it in numeric operations - */ - interface Numeric { - valueOf(): number; - } - - /** - * A grouped array of nodes. - * @param Datum the data bound to this selection. - */ - interface Selection { - /** - * Retrieve a grouped selection. - */ - [index: number]: selection.Group; - - /** - * The number of groups in this selection. - */ - length: number; - - /** - * Retrieve the value of the given attribute for the first node in the selection. - * - * @param name The attribute name to query. May be prefixed (see d3.ns.prefix). - */ - attr(name: string): string; - - /** - * For all nodes, set the attribute to the specified constant value. Use null to remove. - * - * @param name The attribute name, optionally prefixed. - * @param value The attribute value to use. Note that this is coerced to a string automatically. - */ - attr(name: string, value: Primitive): Selection; - - /** - * Derive an attribute value for each node in the selection based on bound data. - * - * @param name The attribute name, optionally prefixed. - * @param value The function of the datum (the bound data item) and index (the position in the subgrouping) which computes the attribute value. If the function returns null, the attribute is removed. - */ - attr(name: string, value: (datum: Datum, index: number) => Primitive): Selection; - - /** - * Set multiple properties at once using an Object. D3 iterates over all enumerable properties and either sets or computes the attribute's value based on the corresponding entry in the Object. - * - * @param obj A key-value mapping corresponding to attributes and values. If the value is a simple string or number, it is taken as a constant. Otherwise, it is a function that derives the attribute value. - */ - attr(obj: { [key: string]: Primitive | ((datum: Datum, index: number) => Primitive) }): Selection; - - /** - * Returns true if the first node in this selection has the given class list. If multiple classes are specified (i.e., "foo bar"), then returns true only if all classes match. - * - * @param name The class list to query. - */ - classed(name: string): boolean; - - /** - * Adds (or removes) the given class list. - * - * @param name The class list to toggle. Spaces separate class names: "foo bar" is a list of two classes. - * @param value If true, add the classes. If false, remove them. - */ - classed(name: string, value: boolean): Selection; - - /** - * Determine if the given class list should be toggled for each node in the selection. - * - * @param name The class list. Spaces separate multiple class names. - * @param value The function to run for each node. Should return true to add the class to the node, or false to remove it. - */ - classed(name: string, value: (datum: Datum, index: number) => boolean): Selection; - - /** - * Set or derive classes for multiple class lists at once. - * - * @param obj An Object mapping class lists to values that are either plain booleans or functions that return booleans. - */ - classed(obj: { [key: string]: boolean | ((datum: Datum, index: number) => boolean) }): Selection; - - /** - * Retrieve the computed style value for the first node in the selection. - * @param name The CSS property name to query - */ - style(name: string): string; - - /** - * Set a style property for all nodes in the selection. - * @param name the CSS property name - * @param value the property value - * @param priority if specified, either null or the string "important" (no exclamation mark) - */ - style(name: string, value: Primitive, priority?: string): Selection; - - /** - * Derive a property value for each node in the selection. - * @param name the CSS property name - * @param value the function to derive the value - * @param priority if specified, either null or the string "important" (no exclamation mark) - */ - style(name: string, value: (datum: Datum, index: number) => Primitive, priority?: string): Selection; - - /** - * Set a large number of CSS properties from an object. - * - * @param obj an Object whose keys correspond to CSS property names and values are either constants or functions that derive property values - * @param priority if specified, either null or the string "important" (no exclamation mark) - */ - style(obj: { [key: string]: Primitive | ((datum: Datum, index: number) => Primitive) }, priority?: string): Selection; - - /** - * Retrieve an arbitrary node property such as the 'checked' property of checkboxes, or the 'value' of text boxes. - * - * @param name the node's property to retrieve - */ - property(name: string): any; - - /** - * For each node, set the property value. Internally, this sets the node property directly (e.g., node[name] = value), so take care not to mutate special properties like __proto__. - * - * @param name the property name - * @param value the property value - */ - property(name: string, value: any): Selection; - - /** - * For each node, derive the property value. Internally, this sets the node property directly (e.g., node[name] = value), so take care not to mutate special properties like __proto__. - * - * @param name the property name - * @param value the function used to derive the property's value - */ - property(name: string, value: (datum: Datum, index: number) => any): Selection; - - /** - * Set multiple node properties. Caveats apply: take care not to mutate special properties like __proto__. - * - * @param obj an Object whose keys correspond to node properties and values are either constants or functions that will compute a value. - */ - property(obj: { [key: string]: any | ((datum: Datum, index: number) => any) }): Selection; - - /** - * Retrieve the textContent of the first node in the selection. - */ - text(): string; - - /** - * Set the textContent of each node in the selection. - * @param value the text to use for all nodes - */ - text(value: Primitive): Selection; - - /** - * Compute the textContent of each node in the selection. - * @param value the function which will compute the text - */ - text(value: (datum: Datum, index: number) => Primitive): Selection; - - /** - * Retrieve the HTML content of the first node in the selection. Uses 'innerHTML' internally and will not work with SVG or other elements without a polyfill. - */ - html(): string; - - /** - * Set the HTML content of every node in the selection. Uses 'innerHTML' internally and thus will not work with SVG or other elements without a polyfill. - * @param value the HTML content to use. - */ - html(value: string): Selection; - - /** - * Compute the HTML content for each node in the selection. Uses 'innerHTML' internally and thus will not work with SVG or other elements without a polyfill. - * @param value the function to compute HTML content - */ - html(value: (datum: Datum, index: number) => string): Selection; - - /** - * Appends a new child to each node in the selection. This child will inherit the parent's data (if available). Returns a fresh selection consisting of the newly-appended children. - * - * @param name the element name to append. May be prefixed (see d3.ns.prefix). - */ - append(name: string): Selection; - - /** - * Appends a new child to each node in the selection by computing a new node. This child will inherit the parent's data (if available). Returns a fresh selection consisting of the newly-appended children. - * - * @param name the function to compute a new element - */ - append(name: (datum: Datum, index: number) => EventTarget): Selection; - - /** - * Inserts a new child to each node in the selection. This child will inherit its parent's data (if available). Returns a fresh selection consisting of the newly-inserted children. - * @param name the element name to append. May be prefixed (see d3.ns.prefix). - * @param before the selector to determine position (e.g., ":first-child") - */ - insert(name: string, before: string): Selection; - - /** - * Inserts a new child to each node in the selection. This child will inherit its parent's data (if available). Returns a fresh selection consisting of the newly-inserted children. - * @param name the element name to append. May be prefixed (see d3.ns.prefix). - * @param before a function to determine the node to use as the next sibling - */ - insert(name: string, before: (datum: Datum, index: number) => EventTarget): Selection; - - /** - * Inserts a new child to the end of each node in the selection by computing a new node. This child will inherit its parent's data (if available). Returns a fresh selection consisting of the newly-inserted children. - * @param name the function to compute a new child - * @param before the selector to determine position (e.g., ":first-child") - */ - insert(name: (datum: Datum, index: number) => EventTarget, before: string): Selection; - - /** - * Inserts a new child to the end of each node in the selection by computing a new node. This child will inherit its parent's data (if available). Returns a fresh selection consisting of the newly-inserted children. - * @param name the function to compute a new child - * @param before a function to determine the node to use as the next sibling - */ - insert(name: (datum: Datum, index: number) => EventTarget, before: (datum: Datum, index: number) => EventTarget): Selection; - - /** - * Removes the elements from the DOM. They are in a detached state and may be re-added (though there is currently no dedicated API for doing so). - */ - remove(): Selection; - - /** - * Retrieves the data bound to the first group in this selection. - */ - data(): Datum[]; - - /** - * Binds data to this selection. - * @param data the array of data to bind to this selection - * @param key the optional function to determine the unique key for each piece of data. When unspecified, uses the index of the element. - */ - data(data: NewDatum[], key?: (datum: NewDatum, index: number) => string): selection.Update; - - /** - * Derives data to bind to this selection. - * @param data the function to derive data. Must return an array. - * @param key the optional function to determine the unique key for each data item. When unspecified, uses the index of the element. - */ - data(data: (datum: Datum, index: number) => NewDatum[], key?: (datum: NewDatum, index: number) => string): selection.Update; - - /** - * Filters the selection, returning only those nodes that match the given CSS selector. - * @param selector the CSS selector - */ - filter(selector: string): Selection; - - /** - * Filters the selection, returning only those nodes for which the given function returned true. - * @param selector the filter function - */ - filter(selector: (datum: Datum, index: number) => boolean): Selection; - - /** - * Return the data item bound to the first element in the selection. - */ - datum(): Datum; - - /** - * Derive the data item for each node in the selection. Useful for situations such as the HTML5 'dataset' attribute. - * @param value the function to compute data for each node - */ - datum(value: (datum: Datum, index: number) => NewDatum): Selection; - - /** - * Set the data item for each node in the selection. - * @param value the constant element to use for each node - */ - datum(value: NewDatum): Selection; - - /** - * Reorders nodes in the selection based on the given comparator. Nodes are re-inserted into the document once sorted. - * @param comparator the comparison function, which defaults to d3.ascending - */ - sort(comparator?: (a: Datum, b: Datum) => number): Selection; - - /** - * Reorders nodes in the document to match the selection order. More efficient than calling sort() if the selection is already ordered. - */ - order(): Selection; - - /** - * Returns the listener (if any) for the given event. - * @param type the type of event to load the listener for. May have a namespace (e.g., ".foo") at the end. - */ - on(type: string): (datum: Datum, index: number) => any; - - /** - * Adds a listener for the specified event. If one was already registered, it is removed before the new listener is added. The return value of the listener function is ignored. - * @param type the of event to listen to. May have a namespace (e.g., ".foo") at the end. - * @param listener an event listener function, or null to unregister - * @param capture sets the DOM useCapture flag - */ - on(type: string, listener: (datum: Datum, index: number) => any, capture?: boolean): Selection; - - /** - * Begins a new transition. Interrupts any active transitions of the same name. - * @param name the transition name (defaults to "") - */ - transition(name?: string): Transition; - - /** - * Interrupts the active transition of the provided name. Does not cancel scheduled transitions. - * @param name the transition name (defaults to "") - */ - interrupt(name?: string): Selection; - - /** - * Creates a subselection by finding the first descendent matching the selector string. Bound data is inherited. - * @param selector the CSS selector to match against - */ - select(selector: string): Selection; - - /** - * Creates a subselection by using a function to find descendent elements. Bound data is inherited. - * @param selector the function to find matching descendants - */ - select(selector: (datum: Datum, index: number) => EventTarget): Selection; - - /** - * Creates a subselection by finding all descendents that match the given selector. Bound data is not inherited. - * @param selector the CSS selector to match against - */ - selectAll(selector: string): Selection; - - /** - * Creates a subselection by finding all descendants that match the given selector. Bound data is not inherited. - * - * Use this overload when data-binding a subselection (that is, sel.selectAll('.foo').data(d => ...)). The type will carry over. - */ - selectAll(selector: string): Selection; - - /** - * Creates a subselection by using a function to find descendent elements. Bound data is not inherited. - * @param selector the function to find matching descendents - */ - selectAll(selector: (datum: Datum, index: number) => Array | NodeList): Selection; - - /** - * Creates a subselection by using a function to find descendent elements. Bound data is not inherited. - * - * Use this overload when data-binding a subselection (that is, sel.selectAll('.foo').data(d => ...)). The type will carry over. - * @param selector the function to find matching descendents - */ - selectAll(selector: (datum: Datum, index: number) => Array | NodeList): Selection; - - /** - * Invoke the given function for each element in the selection. The return value of the function is ignored. - * @param func the function to invoke - */ - each(func: (datum: Datum, index: number) => any): Selection; - - /** - * Call a function on the selection. sel.call(foo) is equivalent to foo(sel). - * @param func the function to call on the selection - * @param args any optional args - */ - call(func: (sel: Selection, ...args: any[]) => any, ...args: any[]): Selection; - - /** - * Returns true if the current selection is empty. - */ - empty(): boolean; - - /** - * Returns the first non-null element in the selection, or null otherwise. - */ - node(): EventTarget; - - /** - * Returns the total number of elements in the selection. - */ - size(): number; - } - - export function transition(): Transition; - module transition { - export var prototype: Transition; - } - - interface Transition { - delay(): number; - delay(delay: number): Transition; - delay(delay: (datum: Datum, index: number) => number): Transition; - - duration(): number; - duration(duration: number): Transition; - duration(duration: (datum: Datum, index: number) => number): Transition; - - ease(): (t: number) => number; - ease(value: string, ...args: any[]): Transition; - ease(value: (t: number) => number): Transition; - - attr(name: string, value: Primitive): Transition; - attr(name: string, value: (datum: Datum, index: number) => Primitive): Transition; - attr(obj: { [key: string]: Primitive | ((datum: Datum, index: number) => Primitive) }): Transition; - - attrTween(name: string, tween: (datum: Datum, index: number, attr: string) => Primitive): Transition; - - style(name: string, value: Primitive, priority?: string): Transition; - style(name: string, value: (datum: Datum, index: number) => Primitive, priority?: string): Transition; - style(obj: { [key: string]: Primitive | ((datum: Datum, index: number) => Primitive) }, priority?: string): Transition; - - styleTween(name: string, tween: (datum: Datum, index: number, attr: string) => Primitive, priority?: string): Transition; - - text(value: Primitive): Transition; - text(value: (datum: Datum, index: number) => Primitive): Transition; - - tween(name: string, factory: () => (t: number) => any): Transition; - - remove(): Transition; - - select(selector: string): Transition; - select(selector: (d: Datum, i: number) => EventTarget): Transition; - - selectAll(selector: string): Transition; - selectAll(selector: (d: Datum, i: number) => EventTarget[]): Transition; - - filter(selector: string): Transition; - filter(selector: (d: Datum, i: number) => boolean): Transition; - - each(type: string, listener: (d: Datum, i: number) => any): Transition; - each(listener: (d: Datum, i: number) => any): Transition; - - call(func: (transition: Transition, ...args: any[]) => any, ...args: any[]): Transition; - - empty(): boolean; - node(): EventTarget; - size(): number; - } - - export function ease(type: 'linear'): (t: number) => number; - export function ease(type: 'linear-in'): (t: number) => number; - export function ease(type: 'linear-out'): (t: number) => number; - export function ease(type: 'linear-in-out'): (t: number) => number; - export function ease(type: 'linear-out-in'): (t: number) => number; - - export function ease(type: 'poly', k: number): (t: number) => number; - export function ease(type: 'poly-in', k: number): (t: number) => number; - export function ease(type: 'poly-out', k: number): (t: number) => number; - export function ease(type: 'poly-in-out', k: number): (t: number) => number; - export function ease(type: 'poly-out-in', k: number): (t: number) => number; - - export function ease(type: 'quad'): (t: number) => number; - export function ease(type: 'quad-in'): (t: number) => number; - export function ease(type: 'quad-out'): (t: number) => number; - export function ease(type: 'quad-in-out'): (t: number) => number; - export function ease(type: 'quad-out-in'): (t: number) => number; - - export function ease(type: 'cubic'): (t: number) => number; - export function ease(type: 'cubic-in'): (t: number) => number; - export function ease(type: 'cubic-out'): (t: number) => number; - export function ease(type: 'cubic-in-out'): (t: number) => number; - export function ease(type: 'cubic-out-in'): (t: number) => number; - - export function ease(type: 'sin'): (t: number) => number; - export function ease(type: 'sin-in'): (t: number) => number; - export function ease(type: 'sin-out'): (t: number) => number; - export function ease(type: 'sin-in-out'): (t: number) => number; - export function ease(type: 'sin-out-in'): (t: number) => number; - - export function ease(type: 'circle'): (t: number) => number; - export function ease(type: 'circle-in'): (t: number) => number; - export function ease(type: 'circle-out'): (t: number) => number; - export function ease(type: 'circle-in-out'): (t: number) => number; - export function ease(type: 'circle-out-in'): (t: number) => number; - - export function ease(type: 'elastic', a?: number, b?: number): (t: number) => number; - export function ease(type: 'elastic-in', a?: number, b?: number): (t: number) => number; - export function ease(type: 'elastic-out', a?: number, b?: number): (t: number) => number; - export function ease(type: 'elastic-in-out', a?: number, b?: number): (t: number) => number; - export function ease(type: 'elastic-out-in', a?: number, b?: number): (t: number) => number; - - export function ease(type: 'back', s: number): (t: number) => number; - export function ease(type: 'back-in', s: number): (t: number) => number; - export function ease(type: 'back-out', s: number): (t: number) => number; - export function ease(type: 'back-in-out', s: number): (t: number) => number; - export function ease(type: 'back-out-in', s: number): (t: number) => number; - - export function ease(type: 'bounce'): (t: number) => number; - export function ease(type: 'bounce-in'): (t: number) => number; - export function ease(type: 'bounce-out'): (t: number) => number; - export function ease(type: 'bounce-in-out'): (t: number) => number; - export function ease(type: 'bounce-out-in'): (t: number) => number; - - export function ease(type: string, ...args: any[]): (t: number) => number; - - export function timer(func: () => any, delay?: number, time?: number): void; - - module timer { - export function flush(): void; - } - - /** - * The current event's value. Use this variable in a handler registered with selection.on. - */ - export var event: Event; - - /** - * Returns the x and y coordinates of the mouse relative to the provided container element, using d3.event for the mouse's position on the page. - * @param container the container element (e.g. an SVG element) - */ - export function mouse(container: EventTarget): [number, number]; - - /** - * Given a container element and a touch identifier, determine the x and y coordinates of the touch. - * @param container the container element (e.g., an SVG element) - * @param identifier the given touch identifier - */ - export function touch(container: EventTarget, identifer: number): [number, number]; - - /** - * Given a container element, a list of touches, and a touch identifier, determine the x and y coordinates of the touch. - * @param container the container element (e.g., an SVG element) - * @param identifier the given touch identifier - */ - export function touch(container: EventTarget, touches: TouchList, identifer: number): [number, number]; - - /** - * Given a container element and an optional list of touches, return the position of every touch relative to the container. - * @param container the container element - * @param touches an optional list of touches (defaults to d3.event.touches) - */ - export function touches(container: EventTarget, touches?: TouchList): Array<[number, number]>; - - // NB. this is limited to primitive values due to D3's use of the <, >, and >= operators. Results get weird for object instances. - /** - * Compares two primitive values for sorting (in ascending order). - */ - export function ascending(a: Primitive, b: Primitive): number; - - /** - * Compares two primitive values for sorting (in ascending order). - */ - export function descending(a: Primitive, b: Primitive): number; - - /** - * Return the minimum value in the array using natural order. - */ - export function min(array: number[]): number; - - /** - * Return the minimum value in the array using natural order. - */ - export function min(array: string[]): string; - - /** - * Return the minimum value in the array using natural order. - */ - export function min(array: T[]): T; - - /** - * Return the minimum value in the array using natural order. - */ - export function min(array: T[], accessor: (datum: T, index: number) => number): number; - - /** - * Return the minimum value in the array using natural order. - */ - export function min(array: T[], accessor: (datum: T, index: number) => string): string; - - /** - * Return the minimum value in the array using natural order. - */ - export function min(array: T[], accessor: (datum: T, index: number) => U): U; - - /** - * Return the maximum value in the array of numbers using natural order. - */ - export function max(array: number[]): number; - - /** - * Return the maximum value in the array of strings using natural order. - */ - export function max(array: string[]): string; - - /** - * Return the maximum value in the array of numbers using natural order. - */ - export function max(array: T[]): T; - - /** - * Return the maximum value in the array using natural order and a projection function to map values to numbers. - */ - export function max(array: T[], accessor: (datum: T, index: number) => number): number; - - /** - * Return the maximum value in the array using natural order and a projection function to map values to strings. - */ - export function max(array: T[], accessor: (datum: T, index: number) => string): string; - - /** - * Return the maximum value in the array using natural order and a projection function to map values to easily-sorted values. - */ - export function max(array: T[], accessor: (datum: T, index: number) => U): U; - - /** - * Return the min and max simultaneously. - */ - export function extent(array: number[]): [number, number]; - - /** - * Return the min and max simultaneously. - */ - export function extent(array: string[]): [string, string]; - - /** - * Return the min and max simultaneously. - */ - export function extent(array: T[]): [T, T]; - - /** - * Return the min and max simultaneously. - */ - export function extent(array: Array): [T | Primitive, T | Primitive]; - - /** - * Return the min and max simultaneously. - */ - export function extent(array: T[], accessor: (datum: T, index: number) => number): [number, number]; - - /** - * Return the min and max simultaneously. - */ - export function extent(array: T[], accessor: (datum: T, index: number) => string): [string, string]; - - /** - * Return the min and max simultaneously. - */ - export function extent(array: U[], accessor: (datum: T, index: number) => U): [U | Primitive, U | Primitive]; - - /** - * Compute the sum of an array of numbers. - */ - export function sum(array: number[]): number; - - /** - * Compute the sum of an array, using the given accessor to convert values to numbers. - */ - export function sum(array: T[], accessor: (datum: T, index: number) => number): number; - - export function mean(array: number[]): number; - export function mean(array: T[], accessor: (datum: T, index: number) => number): number; - - export function quantile(array: number[], p: number): number; - - export function variance(array: number[]): number; - export function variance(array: T[], accessor: (datum: T, index: number) => number): number; - - export function deviation(array: number[]): number; - export function deviation(array: T[], accessor: (datum: T, index: number) => number): number; - - export function bisectLeft(array: number[], x: number, lo?: number, hi?: number): number; - export function bisectLeft(array: string[], x: string, lo?: number, hi?: number): number; - - export var bisect: typeof bisectRight; - - export function bisectRight(array: T[], x: T, lo?: number, hi?: number): number; - - export function bisector(accessor: (x: T) => U): { - left: (array: T[], x: T, lo?: number, hi?: number) => number; - right: (array: T[], x: T, lo?: number, hi?: number) => number; - } - - export function bisector(comparator: (a: T, b: U) => number): { - left: (array: T[], x: U, lo?: number, hi?: number) => number; - right: (array: T[], x: U, lo?: number, hi?: number) => number; - } - - export function shuffle(array: T[], lo?: number, hi?: number): T[]; - - /** - * Returns the enumerable property names of the specified object. - * @param object a JavaScript object - */ - export function keys(object: Object): string[]; - - /** - * Returns an array containing the property values of the specified object. - */ - export function values(object: { [key: string]: T }): T[]; - /** - * Returns an array containing the property values of the specified object. - */ - export function values(object: { [key: number]: T }): T[]; - /** - * Returns an array containing the property values of the specified object. - */ - export function values(object: Object): any[]; - - /** - * Returns an array of key-value pairs containing the property values of the specified object. - */ - export function entries(object: { [key: string]: T }): { key: string; value: T }[]; - - /** - * Returns an array of key-value pairs containing the property values of the specified object. - */ - export function entries(object: { [key: number]: T }): { key: string; value: T }[]; - - /** - * Returns an array of key-value pairs containing the property values of the specified object. - */ - export function entries(object: Object): { key: string; value: any }[]; - - /** - * A shim for ES6 maps. The implementation uses a JavaScript object internally, and thus keys are limited to strings. - */ - interface Map { - /** - * Does the map contain the given key? - */ - has(key: string): boolean; - - /** - * Retrieve the value for the given key. Returns undefined if there is no value stored. - */ - get(key: string): T; - - /** - * Set the value for the given key. Returns the new value. - */ - set(key: string, value: T): T; - - /** - * Remove the value for the given key. Returns true if there was a value and false otherwise. - */ - remove(key: string): boolean; - - /** - * Returns an array of all keys in arbitrary order. - */ - keys(): string[]; - - /** - * Returns an array of all values in arbitrary order. - */ - values(): T[]; - - /** - * Returns an array of key-value objects in arbitrary order. - */ - entries(): { key: string; value: T }[]; - - /** - * Calls the function for each key and value pair in the map. The 'this' context is the map itself. - */ - forEach(func: (key: string, value: T) => any): void; - - /** - * Is this map empty? - */ - empty(): boolean; - - /** - * Returns the number of elements stored in the map. - */ - size(): number; - } - - /** - * Constructs an initially empty map. - */ - export function map(): Map; - - /** - * Construct a new map by copying keys and values from the given one. - */ - export function map(object: Map): Map; - - /** - * Construct a new map by copying enumerable properties and values from the given object. - */ - export function map(object: { [key: string]: T }): Map; - - /** - * Construct a new map by copying enumerable properties and values from the given object. - */ - export function map(object: { [key: number]: T }): Map; - - /** - * Construct a new map by copying elements from the array. The key function is used to identify each object. - */ - export function map(array: T[], key: (datum: T, index: number) => string): Map; - - /** - * Construct a new map by copying enumerable properties and values from the given object. - */ - export function map(object: Object): Map; - - /** - * A shim for ES6 sets. Is only able to store strings. - */ - interface Set { - /** - * Is the given string stored in this set? - */ - has(value: string): boolean; - - /** - * Add the string to this set. Returns the value. - */ - add(value: string): string; - - /** - * Remove the given value from the set. Returns true if it was stored, and false otherwise. - */ - remove(value: string): boolean; - - /** - * Returns an array of the strings stored in this set. - */ - values(): string[]; - - /** - * Calls a given function for each value in the set. The return value of the function is ignored. The this context of the function is the set itself. - */ - forEach(func: (value: string) => any): void; - - /** - * Is this set empty? - */ - empty(): boolean; - - /** - * Returns the number of values stored in this set. - */ - size(): number; - } - - /** - * Creates an initially-empty set. - */ - export function set(): Set; - - /** - * Initializes a set from the given array of strings. - */ - export function set(array: string[]): Set; - - /** - * Merges the specified arrays into a single array. - */ - export function merge(arrays: T[][]): T[]; - - /** - * Generates a 0-based numeric sequence. The output range does not include 'stop'. - */ - export function range(stop: number): number[]; - - /** - * Generates a numeric sequence starting from the given start and stop values. 'step' defaults to 1. The output range does not include 'stop'. - */ - export function range(start: number, stop: number, step?: number): number[]; - - /** - * Given the specified array, return an array corresponding to the list of indices in 'keys'. - */ - export function permute(array: { [key: number]: T }, keys: number[]): T[]; - - /** - * Given the specified object, return an array corresponding to the list of property names in 'keys'. - */ - export function permute(object: { [key: string]: T }, keys: string[]): T[]; - - // TODO construct n-tuples from n input arrays - export function zip(...arrays: T[][]): T[][]; - - export function transpose(matrix: T[][]): T[][]; - - /** - * For each adjacent pair of elements in the specified array, returns a new array of tuples of elements i and i - 1. - * Returns the empty array if the input array has fewer than two elements. - */ - export function pairs(array: T[]): Array<[T, T]>; - - interface Nest { - key(func: (datum: T) => string): Nest; - sortKeys(comparator: (a: string, b: string) => number): Nest; - sortValues(comparator: (a: T, b: T) => number): Nest; - rollup(func: (values: T[]) => U): Nest; - map(array: T[]): { [key: string]: any }; - map(array: T[], mapType: typeof d3.map): Map; - entries(array: T[]): { key: string; values: any }[]; - } - - export function nest(): Nest; - - export module random { - export function normal(mean?: number, deviation?: number): () => number; - export function logNormal(mean?: number, deviation?: number): () => number; - export function bates(count: number): () => number; - export function irwinHall(count: number): () => number; - } - - interface Transform { - rotate: number; - translate: [number, number]; - skew: number; - scale: [number, number]; - toString(): string; - } - - export function transform(transform: string): Transform; - - export function format(specifier: string): (n: number) => string; - - interface FormatPrefix { - symbol: string; - scale(n: number): number; - } - - export function formatPrefix(value: number, precision?: number): FormatPrefix; - - export function round(x: number, n?: number): number; - - export function requote(string: string): string; - - export var rgb: { - new (r: number, g: number, b: number): Rgb; - new (color: string): Rgb; - - (r: number, g: number, b: number): Rgb; - (color: string): Rgb; - }; - - interface Rgb extends Color { - r: number; - g: number; - b: number; - - brighter(k?: number): Rgb; - darker(k?: number): Rgb; - - hsl(): Hsl; - - toString(): string; - } - - export var hsl: { - new (h: number, s: number, l: number): Hsl; - new (color: string): Hsl; - - (h: number, s: number, l: number): Hsl; - (color: string): Hsl; - }; - - interface Hsl extends Color { - h: number; - s: number; - l: number; - - brighter(k?: number): Hsl; - darker(k?: number): Hsl; - - rgb(): Rgb; - - toString(): string; - } - - export var hcl: { - new (h: number, c: number, l: number): Hcl; - new (color: string): Hcl; - - (h: number, c: number, l: number): Hcl; - (color: string): Hcl; - }; - - interface Hcl extends Color { - h: number; - c: number; - l: number; - - brighter(k?: number): Hcl; - darker(k?: number): Hcl; - } - - export var lab: { - new (l: number, a: number, b: number): Lab; - new (color: string): Lab; - - (l: number, a: number, b: number): Lab; - (color: string): Lab; - } - - interface Lab extends Color { - l: number; - a: number; - b: number; - - brighter(k?: number): Lab; - darker(k?: number): Lab; - - rgb(): Rgb; - toString(): string; - } - - export var color: { - (): Color; - new (): Color; - }; - - interface Color { - rgb(): Rgb; - } - - export module ns { - interface Qualified { - space: string; - local: string; - } - - export var prefix: { [key: string]: string }; - export function qualify(name: string): Qualified | string; - } - - export function functor(value: T): T; - export function functor(value: T): () => T; - - export function rebind(target: {}, source: {}, ...names: string[]): any; - - export function dispatch(...names: string[]): Dispatch; - - interface Dispatch { - on(type: string): (...args: any[]) => void; - on(type: string, listener: (...args: any[]) => any): Dispatch; - [event: string]: (...args: any[]) => void; - } - - export module scale { - export function identity(): Identity; - - interface Identity { - (n: number): number; - invert(n: number): number; - - domain(): number[]; - domain(numbers: number[]): Identity; - - range(): number[]; - range(numbers: number[]): Identity; - - ticks(count?: number): number[]; - - tickFormat(count?: number, format?: string): (n: number) => string; - - copy(): Identity; - } - - export function linear(): Linear; - export function linear(): Linear; - export function linear(): Linear; - - interface Linear { - (x: number): Output; - invert(y: number): number; - - domain(): number[]; - domain(numbers: number[]): Linear; - - range(): Range[]; - range(values: Range[]): Linear; - - rangeRound(values: number[]): Linear; - - interpolate(): (a: Range, b: Range) => (t: number) => Output; - interpolate(factory: (a: Range, b: Range) => (t: number) => Output): Linear; - - clamp(): boolean; - clamp(clamp: boolean): Linear; - - ticks(count?: number): number[]; - - tickFormat(count?: number, format?: string): (n: number) => string; - - copy(): Linear; - } - - export function sqrt(): Pow; - export function sqrt(): Pow; - export function sqrt(): Pow; - - export function pow(): Pow; - export function pow(): Pow; - export function pow(): Pow; - - interface Pow { - (x: number): Output; - - invert(y: number): number; - - domain(): number[]; - domain(numbers: number[]): Pow; - - range(): Range[]; - range(values: Range[]): Pow; - - rangeRound(values: number[]): Pow; - - exponent(): number; - exponent(k: number): Pow; - - interpolate(): (a: Range, b: Range) => (t: number) => Output; - interpolate(factory: (a: Range, b: Range) => (t: number) => Output): Pow; - - clamp(): boolean; - clamp(clamp: boolean): Pow; - - nice(m?: number): Pow; - - ticks(count?: number): number[]; - - tickFormat(count?: number, format?: string): (n: number) => string; - - copy(): Pow; - } - - export function log(): Log; - export function log(): Log; - export function log(): Log; - - interface Log { - (x: number): Output; - - invert(y: number): number; - - domain(): number[]; - domain(numbers: number[]): Log; - - range(): Range[]; - range(values: Range[]): Log; - - rangeRound(values: number[]): Log; - - base(): number; - base(base: number): Log; - - interpolate(): (a: Range, b: Range) => (t: number) => Output; - interpolate(factory: (a: Range, b: Range) => (t: number) => Output): Log; - - clamp(): boolean; - clamp(clamp: boolean): Log; - - nice(): Log; - - ticks(): number[]; - - tickFormat(count?: number, format?: string): (t: number) => string; - - copy(): Log; - } - - export function quantize(): Quantize; - - interface Quantize { - (x: number): T; - - invertExtent(y: T): [number, number]; - - domain(): number[]; - domain(numbers: number[]): Quantize; - - range(): T[]; - range(values: T[]): Quantize; - - copy(): Quantize; - } - - export function quantile(): Quantile; - - interface Quantile { - (x: number): T; - - invertExtent(y: T): [number, number]; - - domain(): number[]; - domain(numbers: number[]): Quantile; - - range(): T[]; - range(values: T[]): Quantile; - - quantiles(): number[]; - - copy(): Quantile; - } - - export function threshold(): Threshold; - export function threshold(): Threshold; - - interface Threshold { - (x: number): Range; - - invertExtent(y: Range): [Domain, Domain]; - - domain(): Domain[]; - domain(domain: Domain[]): Threshold; - - range(): Range[]; - range(values: Range[]): Threshold; - - copy(): Threshold; - } - - export function ordinal(): Ordinal; - export function ordinal(): Ordinal; - export function category10(): Ordinal; - export function category10(): Ordinal; - export function category20(): Ordinal; - export function category20(): Ordinal; - export function category20b(): Ordinal; - export function category20b(): Ordinal; - export function category20c(): Ordinal; - export function category20c(): Ordinal; - - interface Ordinal { - (x: Domain): Range; - - domain(): Domain[]; - domain(values: Domain[]): Ordinal; - - range(): Range[]; - range(values: Range[]): Ordinal; - - rangePoints(interval: [number, number], padding?: number): Ordinal; - rangeRoundPoints(interval: [number, number], padding?: number): Ordinal; - - rangeBands(interval: [number, number], padding?: number, outerPadding?: number): Ordinal; - rangeRoundBands(interval: [number, number], padding?: number, outerPadding?: number): Ordinal; - - rangeBand(): number; - rangeExtent(): [number, number]; - - copy(): Ordinal; - } - } - - export function interpolate(a: number, b: number): (t: number) => number; - export function interpolate(a: string, b: string): (t: number) => string; - export function interpolate(a: string | Color, b: Color): (t: number) => string; - export function interpolate(a: Array, b: Color[]): (t: number) => string; - export function interpolate(a: Range[], b: Output[]): (t: number) => Output[]; - export function interpolate(a: Range[], b: Range[]): (t: number) => Output[]; - export function interpolate(a: { [key: string]: string | Color }, b: { [key: string]: Color }): (t: number) => { [key: string]: string }; - export function interpolate(a: { [key: string]: Range }, b: { [key: string]: Output }): (t: number) => { [key: string]: Output }; - export function interpolate(a: { [key: string]: Range }, b: { [key: string]: Range }): (t: number) => { [key: string]: Output }; - - export function interpolateNumber(a: number, b: number): (t: number) => number; - - export function interpolateRound(a: number, b: number): (t: number) => number; - - export function interpolateString(a: string, b: string): (t: number) => string; - - export function interpolateRgb(a: string | Color, b: string | Color): (t: number) => string; - - export function interpolateHsl(a: string | Color, b: string | Color): (t: number) => string; - - export function interpolateLab(a: string | Color, b: string | Color): (t: number) => string; - - export function interpolateHcl(a: string | Color, b: string | Color): (t: number) => string; - - export function interpolateArray(a: Array, b: Color[]): (t: number) => string[]; - export function interpolateArray(a: Range[], b: Range[]): (t: number) => Output[]; - export function interpolateArray(a: Range[], b: Output[]): (t: number) => Output[]; - - export function interpolateObject(a: { [key: string]: string | Color }, b: { [key: string]: Color }): (t: number) => { [key: string]: string }; - export function interpolateObject(a: { [key: string]: Range }, b: { [key: string]: Output }): (t: number) => { [key: string]: Output }; - export function interpolateObject(a: { [key: string]: Range }, b: { [key: string]: Range }): (t: number) => { [key: string]: Output }; - - export function interpolateTransform(a: string | Transform, b: string | Transform): (t: number) => string; - - export function interpolateZoom(a: [number, number, number], b: [number, number, number]): { - (t: number): [number, number, number]; - duration: number; - }; - - export var interpolators: Array<(a: any, b: any) => (t: number) => any>; - - export module time { - export var second: Interval; - export var minute: Interval; - export var hour: Interval; - export var day: Interval; - export var week: Interval; - export var sunday: Interval; - export var monday: Interval; - export var tuesday: Interval; - export var wednesday: Interval; - export var thursday: Interval; - export var friday: Interval; - export var saturday: Interval; - export var month: Interval; - export var year: Interval; - - interface Interval { - (d: Date): Date; - - floor(d: Date): Date; - - round(d: Date): Date; - - ceil(d: Date): Date; - - range(start: Date, stop: Date, step?: number): Date[]; - - offset(date: Date, step: Date): Date; - - utc: { - (d: Date): Date; - - floor(d: Date): Date; - - round(d: Date): Date; - - ceil(d: Date): Date; - - range(start: Date, stop: Date, step?: number): Date[]; - - offset(date: Date, step: Date): Date; - } - } - - export function seconds(start: Date, stop: Date, step?: number): Date[]; - export function minutes(start: Date, stop: Date, step?: number): Date[]; - export function hours(start: Date, stop: Date, step?: number): Date[]; - export function days(start: Date, stop: Date, step?: number): Date[]; - export function weeks(start: Date, stop: Date, step?: number): Date[]; - export function sundays(start: Date, stop: Date, step?: number): Date[]; - export function mondays(start: Date, stop: Date, step?: number): Date[]; - export function tuesdays(start: Date, stop: Date, step?: number): Date[]; - export function wednesdays(start: Date, stop: Date, step?: number): Date[]; - export function thursdays(start: Date, stop: Date, step?: number): Date[]; - export function fridays(start: Date, stop: Date, step?: number): Date[]; - export function saturdays(start: Date, stop: Date, step?: number): Date[]; - export function months(start: Date, stop: Date, step?: number): Date[]; - export function years(start: Date, stop: Date, step?: number): Date[]; - - export function dayOfYear(d: Date): number; - export function weekOfYear(d: Date): number; - export function sundayOfYear(d: Date): number; - export function mondayOfYear(d: Date): number; - export function tuesdayOfYear(d: Date): number; - export function wednesdayOfYear(d: Date): number; - export function fridayOfYear(d: Date): number; - export function saturdayOfYear(d: Date): number; - - export function format(specifier: string): Format; - - export module format { - export function multi(formats: Array<[string, (d: Date) => boolean]>): Format; - export function utc(specifier: string): Format; - export var iso: Format; - } - - interface Format { - (d: Date): string; - parse(input: string): Date; - } - - export function scale(): Scale; - export function scale(): Scale; - export function scale(): Scale; - - export module scale { - export function utc(): Scale; - export function utc(): Scale; - export function utc(): Scale; - } - - - interface Scale { - (x: Date): Output; - - invert(y: number): Date; - - domain(): Date[]; - domain(dates: number[]): Scale; - domain(dates: Date[]): Scale; - - nice(): Scale; - nice(interval: Interval, step?: number): Scale; - - range(): Range[]; - range(values: Range[]): Scale; - - rangeRound(values: number[]): Scale; - - interpolate(): (a: Range, b: Range) => (t: number) => Output; - interpolate(factory: (a: Range, b: Range) => (t: number) => Output): Scale; - - clamp(): boolean; - clamp(clamp: boolean): Scale; - - ticks(): Date[]; - ticks(interval: Interval, step?: number): Date[]; - ticks(count: number): Date[]; - - tickFormat(count: number): (d: Date) => string; - - copy(): Scale; - } - } - - export module behavior { - export function drag(): Drag; - - interface Drag { - (selection: Selection): void; - - on(type: string): (d: Datum, i: number) => any; - on(type: string, listener: (d: Datum, i: number) => any): Drag; - - origin(): (d: Datum, i: number) => { x: number; y: number }; - origin(accessor: (d: Datum, i: number) => { x: number; y: number }): Drag; - } - - export function zoom(): Zoom; - - module zoom { - interface Scale { - domain(): number[]; - domain(values: number[]): Scale; - - invert(y: number): number; - - range(values: number[]): Scale; - range(): number[]; - } - } - - interface Zoom { - (selection: Selection): void; - - translate(): [number, number]; - translate(translate: [number, number]): Zoom; - - scale(): number; - scale(scale: number): Zoom; - - scaleExtent(): [number, number]; - scaleExtent(extent: [number, number]): Zoom; - - center(): [number, number]; - center(center: [number, number]): Zoom; - - size(): [number, number]; - size(size: [number, number]): Zoom; - - x(): zoom.Scale; - x(x: zoom.Scale): Zoom; - - y(): zoom.Scale; - y(y: zoom.Scale): Zoom; - - on(type: string): (d: Datum, i: number) => any; - on(type: string, listener: (d: Datum, i: number) => any): Zoom; - - event(selection: Selection): void; - event(transition: Transition): void; - } - } - - export module geo { - export function path(): Path; - - interface Path { - (feature: any, index?: number): string; - - area(feature: any): number; - - centroid(feature: any): [number, number]; - - bounds(feature: any): [[number, number], [number, number]]; - - projection(): Transform | ((coordinates: [number, number]) => [number, number]); - projection(stream: Transform): Path; - projection(projection: (coordinates: [number, number]) => [number, number]): Path; - - pointRadius(): number | ((datum: any, index: number) => number); - pointRadius(radius: number): Path; - pointRadius(radius: (datum: any, index: number) => number): Path; - - context(): CanvasRenderingContext2D; - context(context: CanvasRenderingContext2D): Path; - } - - export function graticule(): Graticule; - - interface Graticule { - (): any; - - lines(): any[]; - - outline(): any; - - extent(): [[number, number], [number, number]]; - extent(extent: [[number, number], [number, number]]): Graticule; - - majorExtent(): [[number, number], [number, number]]; - majorExtent(extent: [[number, number], [number, number]]): Graticule; - - minorExtent(): [[number, number], [number, number]]; - minorExtent(extent: [[number, number], [number, number]]): Graticule; - - step(): [number, number]; - step(step: [number, number]): Graticule; - - majorStep(): [number, number]; - majorStep(step: [number, number]): Graticule; - - minorStep(): [number, number]; - minorStep(step: [number, number]): Graticule; - - precision(): number; - precision(precision: number): Graticule; - } - - export function circle(): Circle; - - interface Circle { - (...args: any[]): any; - - origin(): [number, number] | ((...args: any[]) => [number, number]); - origin(origin: [number, number]): Circle; - origin(origin: (...args: any[]) => [number, number]): Circle; - - angle(): number; - angle(angle: number): Circle; - - precision(): number; - precision(precision: number): Circle; - } - - export function area(feature: any): number; - export function centroid(feature: any): [number, number]; - export function bounds(feature: any): [[number, number], [number, number]]; - export function distance(a: [number, number], b: [number, number]): number; - export function length(feature: any): number; - export function interpolate(a: [number, number], b: [number, number]): (t: number) => [number, number]; - - export function rotation(rotate: [number, number] | [number, number, number]): Rotation; - - interface Rotation { - (location: [number, number]): [number, number]; - invert(location: [number, number]): [number, number]; - } - - export function stream(object: any, listener: Listener): void; - - interface Listener { - point(x: number, y: number, z: number): void; - lineStart(): void; - lineEnd(): void; - polygonStart(): void; - polygonEnd(): void; - sphere(): void; - } - - export function transform(methods: TransformMethods): Transform; - - interface TransformMethods { - point?(x: number, y: number, z: number): void; - lineStart?(): void; - lineEnd?(): void; - polygonStart?(): void; - polygonEnd?(): void; - sphere?(): void; - } - - interface Transform { - stream(stream: Listener): Listener; - } - - export function clipExtent(): ClipExtent; - - interface ClipExtent extends Transform { - extent(): [[number, number], [number, number]]; - extent(extent: [[number, number], [number, number]]): ClipExtent; - } - - export function projection(raw: RawInvertibleProjection): InvertibleProjection; - export function projection(raw: RawProjection): Projection; - - export function projectionMutator(factory: (...args: any[]) => RawInvertibleProjection): (...args: any[]) => InvertibleProjection; - export function projectionMutator(factory: (...args: any[]) => RawProjection): (...args: any[]) => Projection; - - export function albers(): ConicProjection; - export function albersUsa(): ConicProjection; - export function azimuthalEqualArea(): InvertibleProjection; - module azimuthalEqualArea { - export function raw(lambda: number, phi: number): [number, number]; - module raw { - export function invert(x: number, y: number): [number, number]; - } - } - - export function azimuthalEquidistant(): InvertibleProjection; - module azimuthalEquidistant { - export function raw(lambda: number, phi: number): [number, number]; - module raw { - export function invert(x: number, y: number): [number, number]; - } - } - - export function conicConformal(): ConicProjection; - module conicConformal { - export function raw(phi0: number, phi1: number): RawInvertibleProjection; - } - - export function conicEqualArea(): ConicProjection; - module conicEqualArea { - export function raw(phi0: number, phi1: number): RawInvertibleProjection; - } - - export function conicEquidistant(): ConicProjection; - module conicEquidistant { - export function raw(phi0: number, phi1: number): RawInvertibleProjection; - } - - export function equirectangular(): InvertibleProjection; - module equirectangular { - export function raw(lambda: number, phi: number): [number, number]; - module raw { - export function invert(x: number, y: number): [number, number]; - } - } - - export function gnomonic(): InvertibleProjection; - module gnomonic { - export function raw(lambda: number, phi: number): [number, number]; - module raw { - export function invert(x: number, y: number): [number, number]; - } - } - - export function mercator(): InvertibleProjection; - module mercator { - export function raw(lambda: number, phi: number): [number, number]; - module raw { - export function invert(x: number, y: number): [number, number]; - } - } - - export function orthographic(): InvertibleProjection; - module orthographic { - export function raw(lambda: number, phi: number): [number, number]; - module raw { - export function invert(x: number, y: number): [number, number]; - } - } - - export function stereographic(): InvertibleProjection; - module stereographic { - export function raw(lambda: number, phi: number): [number, number]; - module raw { - export function invert(x: number, y: number): [number, number]; - } - } - - export function transverseMercator(): InvertibleProjection; - module transverseMercator { - export function raw(lambda: number, phi: number): [number, number]; - module raw { - export function invert(x: number, y: number): [number, number]; - } - } - - interface Projection { - (location: [number, number]): [number, number]; - - rotate(): [number, number, number]; - rotate(rotation: [number, number, number]): Projection; - - center(): [number, number]; - center(location: [number, number]): Projection; - - translate(): [number, number]; - translate(point: [number, number]): Projection; - - scale(): number; - scale(scale: number): Projection; - - clipAngle(): number; - clipAngle(angle: number): Projection; - - clipExtent(): [[number, number], [number, number]]; - clipExtent(extent: [[number, number], [number, number]]): Projection; - - precision(): number; - precision(precision: number): Projection; - - stream(listener: Listener): Listener; - } - - interface InvertibleProjection extends Projection { - invert(point: [number, number]): [number, number]; - } - - interface ConicProjection extends InvertibleProjection { - parallels(): [number, number]; - parallels(parallels: [number, number]): ConicProjection; - - rotate(): [number, number, number]; - rotate(rotation: [number, number, number]): ConicProjection; - - center(): [number, number]; - center(location: [number, number]): ConicProjection; - - translate(): [number, number]; - translate(point: [number, number]): ConicProjection; - - scale(): number; - scale(scale: number): ConicProjection; - - clipAngle(): number; - clipAngle(angle: number): ConicProjection; - - clipExtent(): [[number, number], [number, number]]; - clipExtent(extent: [[number, number], [number, number]]): ConicProjection; - - precision(): number; - precision(precision: number): ConicProjection; - } - - interface RawProjection { - (lambda: number, phi: number): [number, number]; - } - - interface RawInvertibleProjection extends RawProjection { - invert(x: number, y: number): [number, number]; - } - } - - module svg { - export function line(): Line<[number, number]>; - export function line(): Line; - - interface Line { - (data: T[]): string; - - x(): number | ((d: T, i: number) => number); - x(x: number): Line; - x(x: (d: T, i: number) => number): Line; - - y(): number | ((d: T, i: number) => number); - y(x: number): Line; - y(y: (d: T, i: number) => number): Line; - - interpolate(): string | ((points: Array<[number, number]>) => string); - interpolate(interpolate: "linear"): Line; - interpolate(interpolate: "linear-closed"): Line; - interpolate(interpolate: "step"): Line; - interpolate(interpolate: "step-before"): Line; - interpolate(interpolate: "step-after"): Line; - interpolate(interpolate: "basis"): Line; - interpolate(interpolate: "basis-open"): Line; - interpolate(interpolate: "basis-closed"): Line; - interpolate(interpolate: "bundle"): Line; - interpolate(interpolate: "cardinal"): Line; - interpolate(interpolate: "cardinal-open"): Line; - interpolate(interpolate: "cardinal-closed"): Line; - interpolate(interpolate: "monotone"): Line; - interpolate(interpolate: string): Line; - interpolate(interpolate: (points: Array<[number, number]>) => string): Line; - - tension(): number; - tension(tension: number): Line; - - defined(): (d: T, i: number) => boolean; - defined(defined: (d: T, i: number) => boolean): Line; - } - - module line { - export function radial(): Radial<[number, number]>; - export function radial(): Radial; - - interface Radial { - (data: T[]): string; - - radius(): number | ((d: T, i: number) => number); - radius(radius: number): Radial; - radius(radius: (d: T, i: number) => number): Radial; - - angle(): number | ((d: T, i: number) => number); - angle(angle: number): Radial; - angle(angle: (d: T, i: number) => number): Radial; - - interpolate(): string | ((points: Array<[number, number]>) => string); - interpolate(interpolate: "linear"): Radial; - interpolate(interpolate: "linear-closed"): Radial; - interpolate(interpolate: "step"): Radial; - interpolate(interpolate: "step-before"): Radial; - interpolate(interpolate: "step-after"): Radial; - interpolate(interpolate: "basis"): Radial; - interpolate(interpolate: "basis-open"): Radial; - interpolate(interpolate: "basis-closed"): Radial; - interpolate(interpolate: "bundle"): Radial; - interpolate(interpolate: "cardinal"): Radial; - interpolate(interpolate: "cardinal-open"): Radial; - interpolate(interpolate: "cardinal-closed"): Radial; - interpolate(interpolate: "monotone"): Radial; - interpolate(interpolate: string): Radial; - interpolate(interpolate: (points: Array<[number, number]>) => string): Radial; - - tension(): number; - tension(tension: number): Radial; - - defined(): (d: T, i: number) => boolean; - defined(defined: (d: T, i: number) => boolean): Radial; - } - } - - export function area(): Area<[number, number]>; - export function area(): Area; - - interface Area { - (data: T[]): string; - - x(): number | ((d: T, i: number) => number); - x(x: number): Area; - x(x: (d: T, i: number) => number): Area; - - x0(): number | ((d: T, i: number) => number); - x0(x0: number): Area; - x0(x0: (d: T, i: number) => number): Area; - - x1(): number | ((d: T, i: number) => number); - x1(x1: number): Area; - x1(x1: (d: T, i: number) => number): Area; - - y(): number | ((d: T, i: number) => number); - y(y: number): Area; - y(y: (d: T, i: number) => number): Area; - - y0(): number | ((d: T, i: number) => number); - y0(y0: number): Area; - y0(y0: (d: T, i: number) => number): Area; - - y1(): number | ((d: T, i: number) => number); - y1(y1: number): Area; - y1(y1: (d: T, i: number) => number): Area; - - interpolate(): string | ((points: Array<[number, number]>) => string); - interpolate(interpolate: "linear"): Area; - interpolate(interpolate: "step"): Area; - interpolate(interpolate: "step-before"): Area; - interpolate(interpolate: "step-after"): Area; - interpolate(interpolate: "basis"): Area; - interpolate(interpolate: "basis-open"): Area; - interpolate(interpolate: "cardinal"): Area; - interpolate(interpolate: "cardinal-open"): Area; - interpolate(interpolate: "monotone"): Area; - interpolate(interpolate: string): Area; - - tension(): number; - tension(tension: number): Area; - - defined(): (d: T, i: number) => boolean; - defined(): (d: T, i: number) => boolean; - } - - module area { - export function radial(): Radial<[number, number]>; - export function radial(): Radial; - - interface Radial { - (data: T[]): string; - - radius(): number | ((d: T, i: number) => number); - radius(radius: number): Radial; - radius(radius: (d: T, i: number) => number): Radial; - - innerRadius(): number | ((d: T, i: number) => number); - innerRadius(innerRadius: number): Radial; - innerRadius(innerRadius: (d: T, i: number) => number): Radial; - - outerRadius(): number | ((d: T, i: number) => number); - outerRadius(outerRadius: number): Radial; - outerRadius(outerRadius: (d: T, i: number) => number): Radial; - - angle(): number | ((d: T, i: number) => number); - angle(angle: number): Radial; - angle(angle: (d: T, i: number) => number): Radial; - - startAngle(): number | ((d: T, i: number) => number); - startAngle(startAngle: number): Radial; - startAngle(startAngle: (d: T, i: number) => number): Radial; - - endAngle(): number | ((d: T, i: number) => number); - endAngle(endAngle: number): Radial; - endAngle(endAngle: (d: T, i: number) => number): Radial; - - interpolate(): string | ((points: Array<[number, number]>) => string); - interpolate(interpolate: "linear"): Radial; - interpolate(interpolate: "step"): Radial; - interpolate(interpolate: "step-before"): Radial; - interpolate(interpolate: "step-after"): Radial; - interpolate(interpolate: "basis"): Radial; - interpolate(interpolate: "basis-open"): Radial; - interpolate(interpolate: "cardinal"): Radial; - interpolate(interpolate: "cardinal-open"): Radial; - interpolate(interpolate: "monotone"): Radial; - interpolate(interpolate: string): Radial; - interpolate(interpolate: (points: Array<[number, number]>) => string): Radial; - - tension(): number; - tension(tension: number): Radial; - - defined(): (d: T, i: number) => boolean; - defined(): (d: T, i: number) => boolean; - } - } - - export function arc(): Arc; - export function arc(): Arc; - - module arc { - interface Arc { - innerRadius: number; - outerRadius: number; - startAngle: number; - endAngle: number; - padAngle: number - } - } - - interface Arc { - (d: T, i: number): string; - - innerRadius(): (d: T, i: number) => number; - innerRadius(radius: number): Arc; - innerRadius(radius: (d: T, i: number) => number): Arc; - - outerRadius(): (d: T, i: number) => number; - outerRadius(radius: number): Arc; - outerRadius(radius: (d: T, i: number) => number): Arc; - - cornerRadius(): (d: T, i: number) => number; - cornerRadius(radius: number): Arc; - cornerRadius(radius: (d: T, i: number) => number): Arc; - - padRadius(): string | ((d: T, i: number) => number); - padRadius(radius: "auto"): Arc; - padRadius(radius: string): Arc; - padRadius(radius: (d: T, i: number) => number): Arc; - - startAngle(): (d: T, i: number) => number; - startAngle(angle: number): Arc; - startAngle(angle: (d: T, i: number) => number): Arc; - - endAngle(): (d: T, i: number) => number; - endAngle(angle: number): Arc; - endAngle(angle: (d: T, i: number) => number): Arc; - - padAngle(): (d: T, i: number) => number; - padAngle(angle: number): Arc; - padAngle(angle: (d: T, i: number) => number): Arc; - - centroid(d: T, i?: number): [number, number]; - } - - export function symbol(): Symbol<{}>; - export function symbol(): Symbol; - - interface Symbol { - (d: T, i: number): string; - - type(): (d: T, i: number) => string; - type(type: string): Symbol; - type(type: (d: T, i: number) => string): Symbol; - - size(): (d: T, i: string) => number; - size(size: number): Symbol; - size(size: (d: T, i: number) => number): Symbol; - } - - export var symbolTypes: string[]; - - export function chord(): Chord, chord.Node>; - export function chord(): Chord, Node>; - export function chord(): Chord; - - module chord { - interface Link { - source: Node; - target: Node; - } - - interface Node { - radius: number; - startAngle: number; - endAngle: number - } - } - - interface Chord { - (d: Link, i: number): string; - - source(): (d: Link, i: number) => Node; - source(source: Node): Chord; - source(source: (d: Link, i: number) => Node): Chord; - - target(): (d: Link, i: number) => Node; - target(target: Node): Chord; - target(target: (d: Link, i: number) => Node): Chord; - - radius(): (d: Node, i: number) => number; - radius(radius: number): Chord; - radius(radius: (d: Node, i: number) => number): Chord; - - startAngle(): (d: Node, i: number) => number; - startAngle(angle: number): Chord; - startAngle(angle: (d: Node, i: number) => number): Chord; - - endAngle(): (d: Node, i: number) => number; - endAngle(angle: number): Chord; - endAngle(angle: (d: Node, i: number) => number): Chord; - } - - export function diagonal(): Diagonal, diagonal.Node>; - export function diagonal(): Diagonal, Node>; - export function diagonal(): Diagonal; - - module diagonal { - interface Link { - source: Node; - target: Node; - } - - interface Node { - x: number; - y: number; - } - } - - interface Diagonal { - (d: Link, i: number): string; - - source(): (d: Link, i: number) => Node; - source(source: Node): Diagonal; - source(source: (d: Link, i: number) => Node): Diagonal; - - target(): (d: Link, i: number) => Node; - target(target: Node): Diagonal; - target(target: (d: Link, i: number) => Node): Diagonal; - - projection(): (d: Node, i: number) => [number, number]; - projection(projection: (d: Node, i: number) => [number, number]): Diagonal; - } - - module diagonal { - export function radial(): Radial, Node>; - export function radial(): Radial, Node>; - export function radial(): Radial; - - interface Radial { - (d: Link, i: number): string; - - source(): (d: Link, i: number) => Node; - source(source: Node): Radial; - source(source: (d: Link, i: number) => Node): Radial; - - target(): (d: Link, i: number) => Node; - target(target: Node): Radial; - target(target: (d: Link, i: number) => Node): Radial; - - projection(): (d: Node, i: number) => [number, number]; - projection(projection: (d: Node, i: number) => [number, number]): Radial; - } - } - - export function axis(): Axis; - - interface Axis { - (selection: Selection): void; - (selection: Transition): void; - - scale(): any; - scale(scale: any): Axis; - - orient(): string; - orient(orientation: string): Axis; - - ticks(): any[]; - ticks(...args: any[]): Axis; - - tickValues(): any[]; - tickValues(values: any[]): Axis; - - tickSize(): number; - tickSize(size: number): Axis; - tickSize(inner: number, outer: number): Axis; - - innerTickSize(): number; - innerTickSize(size: number): Axis; - - outerTickSize(): number; - outerTickSize(size: number): Axis; - - tickPadding(): number; - tickPadding(padding: number): Axis; - - tickFormat(): (t: any) => string; - tickFormat(format: (t: any) => string): Axis; - } - - export function brush(): Brush; - export function brush(): Brush; - - module brush { - interface Scale { - domain(): number[]; - domain(domain: number[]): Scale; - - range(): number[]; - range(range: number[]): Scale; - - invert?(y: number): number; - } - } - - interface Brush { - (selection: Selection): void; - (selection: Transition): void; - - event(selection: Selection): void; - event(selection: Transition): void; - - x(): brush.Scale; - x(x: brush.Scale): Brush; - - y(): brush.Scale; - y(y: brush.Scale): Brush; - - extent(): [number, number] | [[number, number], [number, number]]; - extent(extent: [number, number] | [[number, number], [number, number]]): Brush; - - clamp(): boolean | [boolean, boolean]; - clamp(clamp: boolean | [boolean, boolean]): Brush; - - clear(): void; - - empty(): boolean; - - on(type: 'brushstart'): (datum: T, index: number) => void; - on(type: 'brush'): (datum: T, index: number) => void; - on(type: 'brushend'): (datum: T, index: number) => void; - on(type: string): (datum: T, index: number) => void; - - on(type: 'brushstart', listener: (datum: T, index: number) => void): Brush; - on(type: 'brush', listener: (datum: T, index: number) => void): Brush; - on(type: 'brushend', listener: (datum: T, index: number) => void): Brush; - on(type: string, listener: (datum: T, index: number) => void): Brush; - } - } - - export function xhr(url: string, mimeType?: string, callback?: (err: any, data: any) => void): Xhr; - export function xhr(url: string, callback: (err: any, data: any) => void): Xhr; - - interface Xhr { - header(name: string): string; - header(name: string, value: string): Xhr; - - mimeType(): string; - mimeType(type: string): Xhr; - - responseType(): string; - responseType(type: string): Xhr; - - response(): (request: XMLHttpRequest) => any; - response(value: (request: XMLHttpRequest) => any): Xhr; - - get(callback?: (err: any, data: any) => void): Xhr; - - post(data?: any, callback?: (err: any, data: any) => void): Xhr; - post(callback: (err: any, data: any) => void): Xhr; - - send(method: string, data?: any, callback?: (err: any, data: any) => void): Xhr; - send(method: string, callback: (err: any, data: any) => void): Xhr; - - abort(): Xhr; - - on(type: "beforesend"): (request: XMLHttpRequest) => void; - on(type: "progress"): (request: XMLHttpRequest) => void; - on(type: "load"): (response: any) => void; - on(type: "error"): (err: any) => void; - on(type: string): (...args: any[]) => void; - - on(type: "beforesend", listener: (request: XMLHttpRequest) => void): Xhr; - on(type: "progress", listener: (request: XMLHttpRequest) => void): Xhr; - on(type: "load", listener: (response: any) => void): Xhr; - on(type: "error", listener: (err: any) => void): Xhr; - on(type: string, listener: (...args: any[]) => void): Xhr; - } - - export function text(url: string, mimeType?: string, callback?: (err: any, data: string) => void): Xhr; - export function text(url: string, callback: (err: any, data: string) => void): Xhr; - - export function json(url: string, callback?: (err: any, data: any) => void): Xhr; - - export function xml(url: string, mimeType?: string, callback?: (err: any, data: any) => void): Xhr; - export function xml(url: string, callback: (err: any, data: any) => void): Xhr; - - export function html(url: string, callback?: (err: any, data: DocumentFragment) => void): Xhr; - - export var csv: Dsv; - export var tsv: Dsv; - export function dsv(delimiter: string, mimeType: string): Dsv; - - interface Dsv { - (url: string, callback: (rows: { [key: string]: string }[]) => void): DsvXhr<{ [key: string]: string }>; - (url: string, callback: (error: any, rows: { [key: string]: string }[]) => void): DsvXhr<{ [key: string]: string }>; - (url: string): DsvXhr<{ [key: string]: string }>; - (url: string, accessor: (row: { [key: string]: string }) => T, callback: (rows: T[]) => void): DsvXhr; - (url: string, accessor: (row: { [key: string]: string }) => T, callback: (error: any, rows: T[]) => void): DsvXhr; - (url: string, accessor: (row: { [key: string]: string }) => T): DsvXhr; - - parse(string: string): { [key: string]: string }[]; - parse(string: string, accessor: (row: { [key: string]: string }, index: number) => T): T[]; - - parseRows(string: string): string[][]; - parseRows(string: string, accessor: (row: string[], index: number) => T): T[]; - - format(rows: Object[]): string; - - formatRows(rows: string[][]): string; - } - - interface DsvXhr extends Xhr { - row(): (row: { [key: string]: string }) => T; - row(accessor: (row: { [key: string]: string }) => U): DsvXhr; - - header(name: string): string; - header(name: string, value: string): DsvXhr; - - mimeType(): string; - mimeType(type: string): DsvXhr; - - responseType(): string; - responseType(type: string): DsvXhr; - - response(): (request: XMLHttpRequest) => any; - response(value: (request: XMLHttpRequest) => any): DsvXhr; - - get(callback?: (err: any, data: T) => void): DsvXhr; - post(data?: any, callback?: (err: any, data: T) => void): DsvXhr; - post(callback: (err: any, data: T) => void): DsvXhr; - - send(method: string, data?: any, callback?: (err: any, data: T) => void): DsvXhr; - send(method: string, callback: (err: any, data: T) => void): DsvXhr; - - abort(): DsvXhr; - - on(type: "beforesend"): (request: XMLHttpRequest) => void; - on(type: "progress"): (request: XMLHttpRequest) => void; - on(type: "load"): (response: T) => void; - on(type: "error"): (err: any) => void; - on(type: string): (...args: any[]) => void; - - on(type: "beforesend", listener: (request: XMLHttpRequest) => void): DsvXhr; - on(type: "progress", listener: (request: XMLHttpRequest) => void): DsvXhr; - on(type: "load", listener: (response: T) => void): DsvXhr; - on(type: "error", listener: (err: any) => void): DsvXhr; - on(type: string, listener: (...args: any[]) => void): DsvXhr; - } - - export function locale(definition: LocaleDefinition): Locale; - - interface LocaleDefinition { - decimal: string; - thousands: string; - grouping: number[]; - currency: [string, string]; - dateTime: string; - date: string; - time: string; - periods: [string, string]; - days: [string, string, string, string, string, string, string]; - shortDays: [string, string, string, string, string, string, string]; - months: [string, string, string, string, string, string, string, string, string, string, string, string]; - shortMonths: [string, string, string, string, string, string, string, string, string, string, string, string]; - } - - interface Locale { - numberFormat(specifier: string): (n: number) => string; - timeFormat: { - (specifier: string): time.Format; - utc(specifier: string): time.Format; - } - } - - module layout { - export function bundle(): Bundle; - export function bundle(): Bundle - - module bundle { - interface Node { - parent: Node; - } - - interface Link { - source: T; - target: T; - } - } - - interface Bundle { - (links: bundle.Link[]): T[][]; - } - - export function chord(): Chord; - - module chord { - interface Link { - source: Node; - target: Node; - } - - interface Node { - index: number; - subindex: number; - startAngle: number; - endAngle: number; - value: number; - } - - interface Group { - index: number; - startAngle: number; - endAngle: number; - value: number; - } - } - - interface Chord { - matrix(): number[][]; - matrix(matrix: number[][]): Chord; - - padding(): number; - padding(padding: number): Chord; - - sortGroups(): (a: number, b: number) => number; - sortGroups(comparator: (a: number, b: number) => number): Chord; - - sortSubgroups(): (a: number, b: number) => number; - sortSubgroups(comparator: (a: number, b: number) => number): Chord; - - sortChords(): (a: number, b: number) => number; - sortChords(comparator: (a: number, b: number) => number): Chord; - - chords(): chord.Link[]; - groups(): chord.Group[]; - } - - export function cluster(): Cluster; - export function cluster(): Cluster; - - module cluster { - interface Result { - parent?: Result; - children?: Result[]; - depth?: number; - x?: number; - y?: number; - } - - interface Link { - source: T; - target: T; - } - } - - interface Cluster { - (root: T): T[]; - - nodes(root: T): T[]; - - links(nodes: T[]): cluster.Link; - - children(): (node: T) => T[]; - children(accessor: (node: T) => T[]): Cluster; - - sort(): (a: T, b: T) => number; - sort(comparator: (a: T, b: T) => number): Cluster; - - separation(): (a: T, b: T) => number; - separation(separation: (a: T, b: T) => number): Cluster; - - size(): [number, number]; - size(size: [number, number]): Cluster; - - nodeSize(): [number, number]; - nodeSize(nodeSize: [number, number]): Cluster; - - value(): (a: T) => number; - value(value: (a: T) => number): Cluster; - } - - export function force(): Force, force.Node>; - export function force(): Force, Node>; - export function force, Node extends force.Node>(): Force; - - module force { - interface Link { - source: T; - target: T; - } - - interface Node { - index?: number; - x?: number; - y?: number; - px?: number; - py?: number; - fixed?: boolean; - weight?: number; - } - - interface Event { - type: string; - alpha: number; - } - } - - interface Force, Node extends force.Node> { - size(): [number, number]; - size(size: [number, number]): Force; - - linkDistance(): number | ((link: Link, index: number) => number); - linkDistance(distance: number): Force; - linkDistance(distance: (link: Link, index: number) => number): Force; - - linkStrength(): number | ((link: Link, index: number) => number); - linkStrength(strength: number): Force; - linkStrength(strength: (link: Link, index: number) => number): Force; - - friction(): number; - friction(friction: number): Force; - - charge(): number | ((node: Node, index: number) => number); - charge(charge: number): Force; - charge(charge: (node: Node, index: number) => number): Force; - - chargeDistance(): number; - chargeDistance(distance: number): Force; - - theta(): number; - theta(theta: number): Force; - - gravity(): number; - gravity(gravity: number): Force; - - nodes(): Node[]; - nodes(nodes: Node[]): Force; - - links(): Link[]; - links(links: { source: number; target: number }[]): Force; - links(links: Link[]): Force; - - start(): Force; - - alpha(): number; - alpha(value: number): Force; - - resume(): Force; - - stop(): Force; - - on(type: string): (event: force.Event) => void; - on(type: string, listener: (event: force.Event) => void): Force; - - drag(): behavior.Drag; - drag(selection: Selection): void; - } - - export function hierarchy(): Hierarchy; - export function hierarchy(): Hierarchy; - - module hierarchy { - interface Result { - parent?: Result; - children?: Result[]; - value?: number; - depth?: number; - } - } - - interface Hierarchy { - (root: T): T[]; - - children(): (node: T) => T[]; - children(accessor: (node: T) => T[]): Hierarchy; - - sort(): (a: T, b: T) => number; - sort(comparator: (a: T, b: T) => number): Hierarchy; - - value(): (node: T) => number; - value(accessor: (node: T) => number): Hierarchy; - - revalue(root: T): T[]; - } - - export function histogram(): Histogram; - export function histogram(): Histogram; - - module histogram { - interface Bin extends Array { - x: number; - dx: number; - y: number; - } - } - - interface Histogram { - (values: T[], index?: number): histogram.Bin[]; - - value(): (datum: T, index: number) => number; - value(value: (datum: T, index: number) => number): Histogram; - - range(): (values: T[], index: number) => [number, number]; - range(range: (values: T[], index: number) => [number, number]): Histogram; - - bins(): (range: [number, number], values: T[], index: number) => number[]; - bins(count: number): Histogram; - bins(thresholds: number[]): Histogram; - bins(func: (range: [number, number], values: T[], index: number) => number[]): Histogram; - - frequency(): boolean; - frequency(frequency: boolean): Histogram; - } - - export function pack(): Pack; - export function pack(): Pack; - - module pack { - interface Node { - parent?: Node; - children?: Node[]; - value?: number; - depth?: number; - x?: number; - y?: number; - r?: number; - } - - interface Link { - source: Node; - target: Node; - } - } - - interface Pack { - (root: T): T[]; - - nodes(root: T): T[]; - - links(nodes: T[]): pack.Link[]; - - children(): (node: T, depth: number) => T[]; - children(children: (node: T, depth: number) => T[]): Pack; - - sort(): (a: T, b: T) => number; - sort(comparator: (a: T, b: T) => number): Pack; - - value(): (node: T) => number; - value(value: (node: T) => number): Pack; - - size(): [number, number]; - size(size: [number, number]): Pack; - - radius(): number | ((node: T) => number); - radius(radius: number): Pack; - radius(radius: (node: T) => number): Pack; - - padding(): number; - padding(padding: number): Pack; - } - - export function pie(): Pie; - export function pie(): Pie; - - module pie { - interface Arc { - value: number; - startAngle: number; - endAngle: number; - padAngle: number; - data: T; - } - } - - interface Pie { - (data: T[], index?: number): pie.Arc[]; - - value(): (datum: T, index: number) => number; - value(accessor: (datum: T, index: number) => number): Pie; - - sort(): (a: T, b: T) => number; - sort(comparator: (a: T, b: T) => number): Pie; - - startAngle(): number | ((data: T[], index: number) => number); - startAngle(angle: number): Pie; - startAngle(angle: (data: T[], index: number) => number): Pie; - - endAngle(): number | ((data: T[], index: number) => number); - endAngle(angle: number): Pie; - endAngle(angle: (data: T[], index: number) => number): Pie; - - padAngle(): number | ((data: T[], index: number) => number); - padAngle(angle: number): Pie; - padAngle(angle: (data: T[], index: number) => number): Pie; - } - - export function stack(): Stack; - export function stack(): Stack; - export function stack(): Stack; - module stack { - interface Value { - x: number; - y: number; - y0?: number; - } - } - - interface Stack { - (layers: Series[], index?: number): Series[]; - - values(): (layer: Series, index: number) => Value[]; - values(accessor: (layer: Series, index: number) => Value[]): Stack; - - offset(): (data: Array<[number, number]>) => number[]; - offset(offset: "silhouette"): Stack; - offset(offset: "wiggle"): Stack; - offset(offset: "expand"): Stack; - offset(offset: "zero"): Stack; - offset(offset: string): Stack; - offset(offset: (data: Array<[number, number]>) => number[]): Stack; - - order(): (data: Array<[number, number]>) => number[]; - order(order: "inside-out"): Stack; - order(order: "reverse"): Stack; - order(order: "default"): Stack; - order(order: string): Stack; - order(order: (data: Array<[number, number]>) => number[]): Stack; - - x(): (value: Value, index: number) => number; - x(accessor: (value: Value, index: number) => number): Stack; - - y(): (value: Value, index: number) => number; - y(accesor: (value: Value, index: number) => number): Stack; - - out(): (value: Value, y0: number, y: number) => void; - out(setter: (value: Value, y0: number, y: number) => void): Stack; - } - - export function tree(): Tree; - export function tree(): Tree; - - module tree { - interface Link { - source: T; - target: T; - } - - interface Node { - parent?: Node; - children?: Node[]; - depth?: number; - x?: number; - y?: number; - } - } - - interface Tree { - (root: T, index?: number): T[]; - - nodes(root: T, index?: number): T[]; - - links(nodes: T[]): tree.Link[]; - - children(): (datum: T, index: number) => T[]; - children(children: (datum: T, index: number) => T[]): Tree; - - separation(): (a: T, b: T) => number; - separation(separation: (a: T, b: T) => number): Tree; - - size(): [number, number]; - size(size: [number, number]): Tree; - - nodeSize(): [number, number]; - nodeSize(size: [number, number]): Tree; - - sort(): (a: T, b: T) => number; - sort(comparator: (a: T, b: T) => number): Tree; - - value(): (datum: T, index: number) => number; - value(value: (datum: T, index: number) => number): Tree; - } - - export function treemap(): Treemap; - export function treemap(): Treemap; - - module treemap { - interface Node { - parent?: Node; - children?: Node[]; - value?: number; - depth?: number; - x?: number; - y?: number; - dx?: number; - dy?: number; - } - - interface Link { - source: T; - target: T; - } - - type Padding = number | [number, number, number, number]; - } - - interface Treemap { - (root: T, index?: number): T[]; - - nodes(root: T, index?: number): T[]; - - links(nodes: T[]): treemap.Link[]; - - children(): (node: T, depth: number) => T[]; - children(children: (node: T, depth: number) => T[]): Treemap; - - sort(): (a: T, b: T) => number; - sort(comparator: (a: T, b: T) => number): Treemap; - - value(): (node: T, index: number) => number; - value(value: (node: T, index: number) => number): Treemap; - - size(): [number, number]; - size(size: [number, number]): Treemap; - - padding(): (node: T, depth: number) => treemap.Padding; - padding(padding: treemap.Padding): Treemap; - padding(padding: (node: T, depth: number) => treemap.Padding): Treemap; - - round(): boolean; - round(round: boolean): Treemap; - - sticky(): boolean; - sticky(sticky: boolean): boolean; - - mode(): string; - mode(mode: "squarify"): Treemap; - mode(mode: "slice"): Treemap; - mode(mode: "dice"): Treemap; - mode(mode: "slice-dice"): Treemap; - mode(mode: string): Treemap; - - ratio(): number; - ratio(ratio: number): Treemap; - } - } - - module geom { - export function voronoi(): Voronoi<[number, number]>; - export function voronoi(): Voronoi; - - module voronoi { - interface Link { - source: T; - target: T; - } - } - - interface Voronoi { - (data: T[]): Array<[number, number]>; - - x(): (vertex: T) => number; - x(x: (vertex: T) => number): Voronoi; - - y(): (vertex: T) => number; - y(y: (vertex: T) => number): Voronoi; - - clipExtent(): [[number, number], [number, number]]; - clipExtent(extent: [[number, number], [number, number]]): Voronoi; - - links(data: T[]): voronoi.Link[]; - - triangles(data: T[]): Array<[T, T, T]>; - } - - /** - * @deprecated use d3.geom.voronoi().triangles() instead - */ - export function delaunay(vertices: Array<[number, number]>): Array<[[number, number], [number, number], [number, number]]>; - - export function quadtree(): Quadtree<[number, number]>; - export function quadtree(): Quadtree; - - module quadtree { - interface Node { - nodes: [Node, Node, Node, Node]; - leaf: boolean; - point: T; - x: number; - y: number; - } - - interface Quadtree extends Node { - add(point: T): void; - visit(callback: (node: Node, x1: number, y1: number, x2: number, y2: number) => boolean | void): void; - find(point: [number, number]): T; - } - } - - interface Quadtree { - (points: T[]): quadtree.Quadtree; - - x(): (datum: T, index: number) => number; - x(x: number): Quadtree; - x(x: (datum: T, index: number) => number): Quadtree; - - y(): (datum: T, index: number) => number; - y(y: number): Quadtree; - y(y: (datum: T, index: number) => number): Quadtree; - - extent(): [[number, number], [number, number]]; - extent(extent: [[number, number], [number, number]]): Quadtree; - } - - export function hull(vertices: Array<[number, number]>): Array<[number, number]>; - export function hull(): Hull<[number, number]>; - export function hull(): Hull; - - interface Hull { - (vertices: T[]): Array<[number, number]>; - - x(): (datum: T) => number; - x(x: (datum: T) => number): Hull; - - y(): (datum: T) => number; - y(y: (datum: T) => number): Hull; - } - - export function polygon(vertices: Array<[number, number]>): Polygon; - - interface Polygon { - area(): number; - - centroid(): [number, number]; - - clip(subject: Array<[number, number]>): Array<[number, number]>; - } - } -} - -// we need this to exist -interface TouchList { } - -declare module 'd3' { - export = d3; -} +// Type definitions for d3JS +// Project: http://d3js.org/ +// Definitions by: Alex Ford , Boris Yankov +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module d3 { + /** + * The current version of D3.js. + */ + export var version: string; + + /** + * Find the first element that matches the given selector string. + */ + export function select(selector: string): Selection; + + /** + * Create a selection from the given node reference. + */ + export function select(node: EventTarget): Selection; + + /** + * Find all elements that match the given selector string. + */ + export function selectAll(selector: string): Selection; + + /** + * Create a selection from the given list of nodes. + */ + export function selectAll(nodes: EventTarget[]): Selection; + + /** + * Returns the root selection (as if by d3.select(document.documentElement)). This function may be used for 'instanceof' tests, and extending its prototype will add properties to all selections. + */ + export function selection(): Selection; + + module selection { + export var prototype: Selection; + + /** + * Selections are grouped into arrays of nodes, with the parent tracked in the 'parentNode' property. + */ + interface Group extends Array { + parentNode: EventTarget; + } + + interface Update { + /** + * Retrieve a grouped selection. + */ + [index: number]: Group; + + /** + * The number of groups in this selection. + */ + length: number; + + /** + * Retrieve the value of the given attribute for the first node in the selection. + * + * @param name The attribute name to query. May be prefixed (see d3.ns.prefix). + */ + attr(name: string): string; + + /** + * For all nodes, set the attribute to the specified constant value. Use null to remove. + * + * @param name The attribute name, optionally prefixed. + * @param value The attribute value to use. Note that this is coerced to a string automatically. + */ + attr(name: string, value: Primitive): Update; + + /** + * Derive an attribute value for each node in the selection based on bound data. + * + * @param name The attribute name, optionally prefixed. + * @param value The function of the datum (the bound data item) and index (the position in the subgrouping) which computes the attribute value. If the function returns null, the attribute is removed. + */ + attr(name: string, value: (datum: Datum, index: number) => Primitive): Update; + + /** + * Set multiple properties at once using an Object. D3 iterates over all enumerable properties and either sets or computes the attribute's value based on the corresponding entry in the Object. + * + * @param obj A key-value mapping corresponding to attributes and values. If the value is a simple string or number, it is taken as a constant. Otherwise, it is a function that derives the attribute value. + */ + attr(obj: { [key: string]: Primitive | ((datum: Datum, index: number) => Primitive) }): Update; + + /** + * Returns true if the first node in this selection has the given class list. If multiple classes are specified (i.e., "foo bar"), then returns true only if all classes match. + * + * @param name The class list to query. + */ + classed(name: string): boolean; + + /** + * Adds (or removes) the given class list. + * + * @param name The class list to toggle. Spaces separate class names: "foo bar" is a list of two classes. + * @param value If true, add the classes. If false, remove them. + */ + classed(name: string, value: boolean): Update; + + /** + * Determine if the given class list should be toggled for each node in the selection. + * + * @param name The class list. Spaces separate multiple class names. + * @param value The function to run for each node. Should return true to add the class to the node, or false to remove it. + */ + classed(name: string, value: (datum: Datum, index: number) => boolean): Update; + + /** + * Set or derive classes for multiple class lists at once. + * + * @param obj An Object mapping class lists to values that are either plain booleans or functions that return booleans. + */ + classed(obj: { [key: string]: boolean | ((datum: Datum, index: number) => boolean) }): Update; + + /** + * Retrieve the computed style value for the first node in the selection. + * @param name The CSS property name to query + */ + style(name: string): string; + + /** + * Set a style property for all nodes in the selection. + * @param name the CSS property name + * @param value the property value + * @param priority if specified, either null or the string "important" (no exclamation mark) + */ + style(name: string, value: Primitive, priority?: string): Update; + + /** + * Derive a property value for each node in the selection. + * @param name the CSS property name + * @param value the function to derive the value + * @param priority if specified, either null or the string "important" (no exclamation mark) + */ + style(name: string, value: (datum: Datum, index: number) => Primitive, priority?: string): Update; + + /** + * Set a large number of CSS properties from an object. + * + * @param obj an Object whose keys correspond to CSS property names and values are either constants or functions that derive property values + * @param priority if specified, either null or the string "important" (no exclamation mark) + */ + style(obj: { [key: string]: Primitive | ((datum: Datum, index: number) => Primitive) }, priority?: string): Update; + + /** + * Retrieve an arbitrary node property such as the 'checked' property of checkboxes, or the 'value' of text boxes. + * + * @param name the node's property to retrieve + */ + property(name: string): any; + + /** + * For each node, set the property value. Internally, this sets the node property directly (e.g., node[name] = value), so take care not to mutate special properties like __proto__. + * + * @param name the property name + * @param value the property value + */ + property(name: string, value: any): Update; + + /** + * For each node, derive the property value. Internally, this sets the node property directly (e.g., node[name] = value), so take care not to mutate special properties like __proto__. + * + * @param name the property name + * @param value the function used to derive the property's value + */ + property(name: string, value: (datum: Datum, index: number) => any): Update; + + /** + * Set multiple node properties. Caveats apply: take care not to mutate special properties like __proto__. + * + * @param obj an Object whose keys correspond to node properties and values are either constants or functions that will compute a value. + */ + property(obj: { [key: string]: any | ((datum: Datum, index: number) => any) }): Update; + + /** + * Retrieve the textContent of the first node in the selection. + */ + text(): string; + + /** + * Set the textContent of each node in the selection. + * @param value the text to use for all nodes + */ + text(value: Primitive): Update; + + /** + * Compute the textContent of each node in the selection. + * @param value the function which will compute the text + */ + text(value: (datum: Datum, index: number) => Primitive): Update; + + /** + * Retrieve the HTML content of the first node in the selection. Uses 'innerHTML' internally and will not work with SVG or other elements without a polyfill. + */ + html(): string; + + /** + * Set the HTML content of every node in the selection. Uses 'innerHTML' internally and thus will not work with SVG or other elements without a polyfill. + * @param value the HTML content to use. + */ + html(value: string): Selection; + + /** + * Compute the HTML content for each node in the selection. Uses 'innerHTML' internally and thus will not work with SVG or other elements without a polyfill. + * @param value the function to compute HTML content + */ + html(value: (datum: Datum, index: number) => string): Selection; + + /** + * Appends a new child to each node in the selection. This child will inherit the parent's data (if available). Returns a fresh selection consisting of the newly-appended children. + * + * @param name the element name to append. May be prefixed (see d3.ns.prefix). + */ + append(name: string): Selection; + + /** + * Appends a new child to each node in the selection by computing a new node. This child will inherit the parent's data (if available). Returns a fresh selection consisting of the newly-appended children. + * + * @param name the function to compute a new element + */ + append(name: (datum: Datum, index: number) => EventTarget): Update; + + /** + * Inserts a new child to each node in the selection. This child will inherit its parent's data (if available). Returns a fresh selection consisting of the newly-inserted children. + * @param name the element name to append. May be prefixed (see d3.ns.prefix). + * @param before the selector to determine position (e.g., ":first-child") + */ + insert(name: string, before: string): Update; + + /** + * Inserts a new child to each node in the selection. This child will inherit its parent's data (if available). Returns a fresh selection consisting of the newly-inserted children. + * @param name the element name to append. May be prefixed (see d3.ns.prefix). + * @param before a function to determine the node to use as the next sibling + */ + insert(name: string, before: (datum: Datum, index: number) => EventTarget): Update; + + /** + * Inserts a new child to the end of each node in the selection by computing a new node. This child will inherit its parent's data (if available). Returns a fresh selection consisting of the newly-inserted children. + * @param name the function to compute a new child + * @param before the selector to determine position (e.g., ":first-child") + */ + insert(name: (datum: Datum, index: number) => EventTarget, before: string): Update; + + /** + * Inserts a new child to the end of each node in the selection by computing a new node. This child will inherit its parent's data (if available). Returns a fresh selection consisting of the newly-inserted children. + * @param name the function to compute a new child + * @param before a function to determine the node to use as the next sibling + */ + insert(name: (datum: Datum, index: number) => EventTarget, before: (datum: Datum, index: number) => EventTarget): Update; + + /** + * Removes the elements from the DOM. They are in a detached state and may be re-added (though there is currently no dedicated API for doing so). + */ + remove(): Update; + + /** + * Retrieves the data bound to the first group in this selection. + */ + data(): Datum[]; + + /** + * Binds data to this selection. + * @param data the array of data to bind to this selection + * @param key the optional function to determine the unique key for each piece of data. When unspecified, uses the index of the element. + */ + data(data: NewDatum[], key?: (datum: NewDatum, index: number) => string): Update; + + /** + * Derives data to bind to this selection. + * @param data the function to derive data. Must return an array. + * @param key the optional function to determine the unique key for each data item. When unspecified, uses the index of the element. + */ + data(data: (datum: Datum, index: number) => NewDatum[], key?: (datum: NewDatum, index: number) => string): Update; + + /** + * Filters the selection, returning only those nodes that match the given CSS selector. + * @param selector the CSS selector + */ + filter(selector: string): Update; + + /** + * Filters the selection, returning only those nodes for which the given function returned true. + * @param selector the filter function + */ + filter(selector: (datum: Datum, index: number) => boolean): Update; + + /** + * Return the data item bound to the first element in the selection. + */ + datum(): Datum; + + /** + * Set the data item for each node in the selection. + * @param value the constant element to use for each node + */ + datum(value: NewDatum): Update; + + /** + * Derive the data item for each node in the selection. Useful for situations such as the HTML5 'dataset' attribute. + * @param value the function to compute data for each node + */ + datum(value: (datum: Datum, index: number) => NewDatum): Update; + + /** + * Reorders nodes in the selection based on the given comparator. Nodes are re-inserted into the document once sorted. + * @param comparator the comparison function, which defaults to d3.ascending + */ + sort(comparator?: (a: Datum, b: Datum) => number): Update; + + /** + * Reorders nodes in the document to match the selection order. More efficient than calling sort() if the selection is already ordered. + */ + order(): Update; + + /** + * Returns the listener (if any) for the given event. + * @param type the type of event to load the listener for. May have a namespace (e.g., ".foo") at the end. + */ + on(type: string): (datum: Datum, index: number) => any; + + /** + * Adds a listener for the specified event. If one was already registered, it is removed before the new listener is added. The return value of the listener function is ignored. + * @param type the of event to listen to. May have a namespace (e.g., ".foo") at the end. + * @param listener an event listener function, or null to unregister + * @param capture sets the DOM useCapture flag + */ + on(type: string, listener: (datum: Datum, index: number) => any, capture?: boolean): Update; + + /** + * Begins a new transition. Interrupts any active transitions of the same name. + * @param name the transition name (defaults to "") + */ + transition(name?: string): Transition; + + /** + * Interrupts the active transition of the provided name. Does not cancel scheduled transitions. + * @param name the transition name (defaults to "") + */ + interrupt(name?: string): Update; + + /** + * Creates a subselection by finding the first descendent matching the selector string. Bound data is inherited. + * @param selector the CSS selector to match against + */ + select(selector: string): Update; + + /** + * Creates a subselection by using a function to find descendent elements. Bound data is inherited. + * @param selector the function to find matching descendants + */ + select(selector: (datum: Datum, index: number) => EventTarget): Update; + + /** + * Creates a subselection by finding all descendents that match the given selector. Bound data is not inherited. + * @param selector the CSS selector to match against + */ + selectAll(selector: string): Update; + + /** + * Creates a subselection by using a function to find descendent elements. Bound data is not inherited. + * @param selector the function to find matching descendents + */ + selectAll(selector: (datum: Datum, index: number) => Array | NodeList): Update; + + /** + * Invoke the given function for each element in the selection. The return value of the function is ignored. + * @param func the function to invoke + */ + each(func: (datum: Datum, index: number) => any): Update; + + /** + * Call a function on the selection. sel.call(foo) is equivalent to foo(sel). + * @param func the function to call on the selection + * @param args any optional args + */ + call(func: (sel: Update, ...args: any[]) => any, ...args: any[]): Update; + + /** + * Returns true if the current selection is empty. + */ + empty(): boolean; + + /** + * Returns the first non-null element in the selection, or null otherwise. + */ + node(): EventTarget; + + /** + * Returns the total number of elements in the selection. + */ + size(): number; + + /** + * Returns the placeholder nodes for each data element for which no corresponding DOM element was found. + */ + enter(): Enter; + + /** + * Returns a selection for those DOM nodes for which no new data element was found. + */ + exit(): Selection; + } + + interface Enter { + append(name: string): Selection; + append(name: (datum: Datum, index: number) => EventTarget): Selection; + + insert(name: string, before?: string): Selection; + insert(name: string, before: (datum: Datum, index: number) => EventTarget): Selection; + insert(name: (datum: Datum, index: number) => EventTarget, before?: string): Selection; + insert(name: (datum: Datum, index: number) => EventTarget, before: (datum: Datum, index: number) => EventTarget): Selection; + + select(name: (datum: Datum, index: number) => EventTarget): Selection; + call(func: (selection: Enter, ...args: any[]) => any, ...args: any[]): Enter; + } + } + + /** + * Administrivia: JavaScript primitive types, or "things that toString() predictably". + */ + export type Primitive = number | string | boolean; + + /** + * Administrivia: anything with a valueOf(): number method is comparable, so we allow it in numeric operations + */ + interface Numeric { + valueOf(): number; + } + + /** + * A grouped array of nodes. + * @param Datum the data bound to this selection. + */ + interface Selection { + /** + * Retrieve a grouped selection. + */ + [index: number]: selection.Group; + + /** + * The number of groups in this selection. + */ + length: number; + + /** + * Retrieve the value of the given attribute for the first node in the selection. + * + * @param name The attribute name to query. May be prefixed (see d3.ns.prefix). + */ + attr(name: string): string; + + /** + * For all nodes, set the attribute to the specified constant value. Use null to remove. + * + * @param name The attribute name, optionally prefixed. + * @param value The attribute value to use. Note that this is coerced to a string automatically. + */ + attr(name: string, value: Primitive): Selection; + + /** + * Derive an attribute value for each node in the selection based on bound data. + * + * @param name The attribute name, optionally prefixed. + * @param value The function of the datum (the bound data item) and index (the position in the subgrouping) which computes the attribute value. If the function returns null, the attribute is removed. + */ + attr(name: string, value: (datum: Datum, index: number) => Primitive): Selection; + + /** + * Set multiple properties at once using an Object. D3 iterates over all enumerable properties and either sets or computes the attribute's value based on the corresponding entry in the Object. + * + * @param obj A key-value mapping corresponding to attributes and values. If the value is a simple string or number, it is taken as a constant. Otherwise, it is a function that derives the attribute value. + */ + attr(obj: { [key: string]: Primitive | ((datum: Datum, index: number) => Primitive) }): Selection; + + /** + * Returns true if the first node in this selection has the given class list. If multiple classes are specified (i.e., "foo bar"), then returns true only if all classes match. + * + * @param name The class list to query. + */ + classed(name: string): boolean; + + /** + * Adds (or removes) the given class list. + * + * @param name The class list to toggle. Spaces separate class names: "foo bar" is a list of two classes. + * @param value If true, add the classes. If false, remove them. + */ + classed(name: string, value: boolean): Selection; + + /** + * Determine if the given class list should be toggled for each node in the selection. + * + * @param name The class list. Spaces separate multiple class names. + * @param value The function to run for each node. Should return true to add the class to the node, or false to remove it. + */ + classed(name: string, value: (datum: Datum, index: number) => boolean): Selection; + + /** + * Set or derive classes for multiple class lists at once. + * + * @param obj An Object mapping class lists to values that are either plain booleans or functions that return booleans. + */ + classed(obj: { [key: string]: boolean | ((datum: Datum, index: number) => boolean) }): Selection; + + /** + * Retrieve the computed style value for the first node in the selection. + * @param name The CSS property name to query + */ + style(name: string): string; + + /** + * Set a style property for all nodes in the selection. + * @param name the CSS property name + * @param value the property value + * @param priority if specified, either null or the string "important" (no exclamation mark) + */ + style(name: string, value: Primitive, priority?: string): Selection; + + /** + * Derive a property value for each node in the selection. + * @param name the CSS property name + * @param value the function to derive the value + * @param priority if specified, either null or the string "important" (no exclamation mark) + */ + style(name: string, value: (datum: Datum, index: number) => Primitive, priority?: string): Selection; + + /** + * Set a large number of CSS properties from an object. + * + * @param obj an Object whose keys correspond to CSS property names and values are either constants or functions that derive property values + * @param priority if specified, either null or the string "important" (no exclamation mark) + */ + style(obj: { [key: string]: Primitive | ((datum: Datum, index: number) => Primitive) }, priority?: string): Selection; + + /** + * Retrieve an arbitrary node property such as the 'checked' property of checkboxes, or the 'value' of text boxes. + * + * @param name the node's property to retrieve + */ + property(name: string): any; + + /** + * For each node, set the property value. Internally, this sets the node property directly (e.g., node[name] = value), so take care not to mutate special properties like __proto__. + * + * @param name the property name + * @param value the property value + */ + property(name: string, value: any): Selection; + + /** + * For each node, derive the property value. Internally, this sets the node property directly (e.g., node[name] = value), so take care not to mutate special properties like __proto__. + * + * @param name the property name + * @param value the function used to derive the property's value + */ + property(name: string, value: (datum: Datum, index: number) => any): Selection; + + /** + * Set multiple node properties. Caveats apply: take care not to mutate special properties like __proto__. + * + * @param obj an Object whose keys correspond to node properties and values are either constants or functions that will compute a value. + */ + property(obj: { [key: string]: any | ((datum: Datum, index: number) => any) }): Selection; + + /** + * Retrieve the textContent of the first node in the selection. + */ + text(): string; + + /** + * Set the textContent of each node in the selection. + * @param value the text to use for all nodes + */ + text(value: Primitive): Selection; + + /** + * Compute the textContent of each node in the selection. + * @param value the function which will compute the text + */ + text(value: (datum: Datum, index: number) => Primitive): Selection; + + /** + * Retrieve the HTML content of the first node in the selection. Uses 'innerHTML' internally and will not work with SVG or other elements without a polyfill. + */ + html(): string; + + /** + * Set the HTML content of every node in the selection. Uses 'innerHTML' internally and thus will not work with SVG or other elements without a polyfill. + * @param value the HTML content to use. + */ + html(value: string): Selection; + + /** + * Compute the HTML content for each node in the selection. Uses 'innerHTML' internally and thus will not work with SVG or other elements without a polyfill. + * @param value the function to compute HTML content + */ + html(value: (datum: Datum, index: number) => string): Selection; + + /** + * Appends a new child to each node in the selection. This child will inherit the parent's data (if available). Returns a fresh selection consisting of the newly-appended children. + * + * @param name the element name to append. May be prefixed (see d3.ns.prefix). + */ + append(name: string): Selection; + + /** + * Appends a new child to each node in the selection by computing a new node. This child will inherit the parent's data (if available). Returns a fresh selection consisting of the newly-appended children. + * + * @param name the function to compute a new element + */ + append(name: (datum: Datum, index: number) => EventTarget): Selection; + + /** + * Inserts a new child to each node in the selection. This child will inherit its parent's data (if available). Returns a fresh selection consisting of the newly-inserted children. + * @param name the element name to append. May be prefixed (see d3.ns.prefix). + * @param before the selector to determine position (e.g., ":first-child") + */ + insert(name: string, before: string): Selection; + + /** + * Inserts a new child to each node in the selection. This child will inherit its parent's data (if available). Returns a fresh selection consisting of the newly-inserted children. + * @param name the element name to append. May be prefixed (see d3.ns.prefix). + * @param before a function to determine the node to use as the next sibling + */ + insert(name: string, before: (datum: Datum, index: number) => EventTarget): Selection; + + /** + * Inserts a new child to the end of each node in the selection by computing a new node. This child will inherit its parent's data (if available). Returns a fresh selection consisting of the newly-inserted children. + * @param name the function to compute a new child + * @param before the selector to determine position (e.g., ":first-child") + */ + insert(name: (datum: Datum, index: number) => EventTarget, before: string): Selection; + + /** + * Inserts a new child to the end of each node in the selection by computing a new node. This child will inherit its parent's data (if available). Returns a fresh selection consisting of the newly-inserted children. + * @param name the function to compute a new child + * @param before a function to determine the node to use as the next sibling + */ + insert(name: (datum: Datum, index: number) => EventTarget, before: (datum: Datum, index: number) => EventTarget): Selection; + + /** + * Removes the elements from the DOM. They are in a detached state and may be re-added (though there is currently no dedicated API for doing so). + */ + remove(): Selection; + + /** + * Retrieves the data bound to the first group in this selection. + */ + data(): Datum[]; + + /** + * Binds data to this selection. + * @param data the array of data to bind to this selection + * @param key the optional function to determine the unique key for each piece of data. When unspecified, uses the index of the element. + */ + data(data: NewDatum[], key?: (datum: NewDatum, index: number) => string): selection.Update; + + /** + * Derives data to bind to this selection. + * @param data the function to derive data. Must return an array. + * @param key the optional function to determine the unique key for each data item. When unspecified, uses the index of the element. + */ + data(data: (datum: Datum, index: number) => NewDatum[], key?: (datum: NewDatum, index: number) => string): selection.Update; + + /** + * Filters the selection, returning only those nodes that match the given CSS selector. + * @param selector the CSS selector + */ + filter(selector: string): Selection; + + /** + * Filters the selection, returning only those nodes for which the given function returned true. + * @param selector the filter function + */ + filter(selector: (datum: Datum, index: number) => boolean): Selection; + + /** + * Return the data item bound to the first element in the selection. + */ + datum(): Datum; + + /** + * Derive the data item for each node in the selection. Useful for situations such as the HTML5 'dataset' attribute. + * @param value the function to compute data for each node + */ + datum(value: (datum: Datum, index: number) => NewDatum): Selection; + + /** + * Set the data item for each node in the selection. + * @param value the constant element to use for each node + */ + datum(value: NewDatum): Selection; + + /** + * Reorders nodes in the selection based on the given comparator. Nodes are re-inserted into the document once sorted. + * @param comparator the comparison function, which defaults to d3.ascending + */ + sort(comparator?: (a: Datum, b: Datum) => number): Selection; + + /** + * Reorders nodes in the document to match the selection order. More efficient than calling sort() if the selection is already ordered. + */ + order(): Selection; + + /** + * Returns the listener (if any) for the given event. + * @param type the type of event to load the listener for. May have a namespace (e.g., ".foo") at the end. + */ + on(type: string): (datum: Datum, index: number) => any; + + /** + * Adds a listener for the specified event. If one was already registered, it is removed before the new listener is added. The return value of the listener function is ignored. + * @param type the of event to listen to. May have a namespace (e.g., ".foo") at the end. + * @param listener an event listener function, or null to unregister + * @param capture sets the DOM useCapture flag + */ + on(type: string, listener: (datum: Datum, index: number) => any, capture?: boolean): Selection; + + /** + * Begins a new transition. Interrupts any active transitions of the same name. + * @param name the transition name (defaults to "") + */ + transition(name?: string): Transition; + + /** + * Interrupts the active transition of the provided name. Does not cancel scheduled transitions. + * @param name the transition name (defaults to "") + */ + interrupt(name?: string): Selection; + + /** + * Creates a subselection by finding the first descendent matching the selector string. Bound data is inherited. + * @param selector the CSS selector to match against + */ + select(selector: string): Selection; + + /** + * Creates a subselection by using a function to find descendent elements. Bound data is inherited. + * @param selector the function to find matching descendants + */ + select(selector: (datum: Datum, index: number) => EventTarget): Selection; + + /** + * Creates a subselection by finding all descendents that match the given selector. Bound data is not inherited. + * @param selector the CSS selector to match against + */ + selectAll(selector: string): Selection; + + /** + * Creates a subselection by finding all descendants that match the given selector. Bound data is not inherited. + * + * Use this overload when data-binding a subselection (that is, sel.selectAll('.foo').data(d => ...)). The type will carry over. + */ + selectAll(selector: string): Selection; + + /** + * Creates a subselection by using a function to find descendent elements. Bound data is not inherited. + * @param selector the function to find matching descendents + */ + selectAll(selector: (datum: Datum, index: number) => Array | NodeList): Selection; + + /** + * Creates a subselection by using a function to find descendent elements. Bound data is not inherited. + * + * Use this overload when data-binding a subselection (that is, sel.selectAll('.foo').data(d => ...)). The type will carry over. + * @param selector the function to find matching descendents + */ + selectAll(selector: (datum: Datum, index: number) => Array | NodeList): Selection; + + /** + * Invoke the given function for each element in the selection. The return value of the function is ignored. + * @param func the function to invoke + */ + each(func: (datum: Datum, index: number) => any): Selection; + + /** + * Call a function on the selection. sel.call(foo) is equivalent to foo(sel). + * @param func the function to call on the selection + * @param args any optional args + */ + call(func: (sel: Selection, ...args: any[]) => any, ...args: any[]): Selection; + + /** + * Returns true if the current selection is empty. + */ + empty(): boolean; + + /** + * Returns the first non-null element in the selection, or null otherwise. + */ + node(): EventTarget; + + /** + * Returns the total number of elements in the selection. + */ + size(): number; + } + + export function transition(): Transition; + module transition { + export var prototype: Transition; + } + + interface Transition { + delay(): number; + delay(delay: number): Transition; + delay(delay: (datum: Datum, index: number) => number): Transition; + + duration(): number; + duration(duration: number): Transition; + duration(duration: (datum: Datum, index: number) => number): Transition; + + ease(): (t: number) => number; + ease(value: string, ...args: any[]): Transition; + ease(value: (t: number) => number): Transition; + + attr(name: string, value: Primitive): Transition; + attr(name: string, value: (datum: Datum, index: number) => Primitive): Transition; + attr(obj: { [key: string]: Primitive | ((datum: Datum, index: number) => Primitive) }): Transition; + + attrTween(name: string, tween: (datum: Datum, index: number, attr: string) => Primitive): Transition; + + style(name: string, value: Primitive, priority?: string): Transition; + style(name: string, value: (datum: Datum, index: number) => Primitive, priority?: string): Transition; + style(obj: { [key: string]: Primitive | ((datum: Datum, index: number) => Primitive) }, priority?: string): Transition; + + styleTween(name: string, tween: (datum: Datum, index: number, attr: string) => Primitive, priority?: string): Transition; + + text(value: Primitive): Transition; + text(value: (datum: Datum, index: number) => Primitive): Transition; + + tween(name: string, factory: () => (t: number) => any): Transition; + + remove(): Transition; + + select(selector: string): Transition; + select(selector: (d: Datum, i: number) => EventTarget): Transition; + + selectAll(selector: string): Transition; + selectAll(selector: (d: Datum, i: number) => EventTarget[]): Transition; + + filter(selector: string): Transition; + filter(selector: (d: Datum, i: number) => boolean): Transition; + + each(type: string, listener: (d: Datum, i: number) => any): Transition; + each(listener: (d: Datum, i: number) => any): Transition; + + call(func: (transition: Transition, ...args: any[]) => any, ...args: any[]): Transition; + + empty(): boolean; + node(): EventTarget; + size(): number; + } + + export function ease(type: 'linear'): (t: number) => number; + export function ease(type: 'linear-in'): (t: number) => number; + export function ease(type: 'linear-out'): (t: number) => number; + export function ease(type: 'linear-in-out'): (t: number) => number; + export function ease(type: 'linear-out-in'): (t: number) => number; + + export function ease(type: 'poly', k: number): (t: number) => number; + export function ease(type: 'poly-in', k: number): (t: number) => number; + export function ease(type: 'poly-out', k: number): (t: number) => number; + export function ease(type: 'poly-in-out', k: number): (t: number) => number; + export function ease(type: 'poly-out-in', k: number): (t: number) => number; + + export function ease(type: 'quad'): (t: number) => number; + export function ease(type: 'quad-in'): (t: number) => number; + export function ease(type: 'quad-out'): (t: number) => number; + export function ease(type: 'quad-in-out'): (t: number) => number; + export function ease(type: 'quad-out-in'): (t: number) => number; + + export function ease(type: 'cubic'): (t: number) => number; + export function ease(type: 'cubic-in'): (t: number) => number; + export function ease(type: 'cubic-out'): (t: number) => number; + export function ease(type: 'cubic-in-out'): (t: number) => number; + export function ease(type: 'cubic-out-in'): (t: number) => number; + + export function ease(type: 'sin'): (t: number) => number; + export function ease(type: 'sin-in'): (t: number) => number; + export function ease(type: 'sin-out'): (t: number) => number; + export function ease(type: 'sin-in-out'): (t: number) => number; + export function ease(type: 'sin-out-in'): (t: number) => number; + + export function ease(type: 'circle'): (t: number) => number; + export function ease(type: 'circle-in'): (t: number) => number; + export function ease(type: 'circle-out'): (t: number) => number; + export function ease(type: 'circle-in-out'): (t: number) => number; + export function ease(type: 'circle-out-in'): (t: number) => number; + + export function ease(type: 'elastic', a?: number, b?: number): (t: number) => number; + export function ease(type: 'elastic-in', a?: number, b?: number): (t: number) => number; + export function ease(type: 'elastic-out', a?: number, b?: number): (t: number) => number; + export function ease(type: 'elastic-in-out', a?: number, b?: number): (t: number) => number; + export function ease(type: 'elastic-out-in', a?: number, b?: number): (t: number) => number; + + export function ease(type: 'back', s: number): (t: number) => number; + export function ease(type: 'back-in', s: number): (t: number) => number; + export function ease(type: 'back-out', s: number): (t: number) => number; + export function ease(type: 'back-in-out', s: number): (t: number) => number; + export function ease(type: 'back-out-in', s: number): (t: number) => number; + + export function ease(type: 'bounce'): (t: number) => number; + export function ease(type: 'bounce-in'): (t: number) => number; + export function ease(type: 'bounce-out'): (t: number) => number; + export function ease(type: 'bounce-in-out'): (t: number) => number; + export function ease(type: 'bounce-out-in'): (t: number) => number; + + export function ease(type: string, ...args: any[]): (t: number) => number; + + export function timer(func: () => any, delay?: number, time?: number): void; + + module timer { + export function flush(): void; + } + + /** + * The current event's value. Use this variable in a handler registered with selection.on. + */ + export var event: Event; + + /** + * Returns the x and y coordinates of the mouse relative to the provided container element, using d3.event for the mouse's position on the page. + * @param container the container element (e.g. an SVG element) + */ + export function mouse(container: EventTarget): [number, number]; + + /** + * Given a container element and a touch identifier, determine the x and y coordinates of the touch. + * @param container the container element (e.g., an SVG element) + * @param identifier the given touch identifier + */ + export function touch(container: EventTarget, identifer: number): [number, number]; + + /** + * Given a container element, a list of touches, and a touch identifier, determine the x and y coordinates of the touch. + * @param container the container element (e.g., an SVG element) + * @param identifier the given touch identifier + */ + export function touch(container: EventTarget, touches: TouchList, identifer: number): [number, number]; + + /** + * Given a container element and an optional list of touches, return the position of every touch relative to the container. + * @param container the container element + * @param touches an optional list of touches (defaults to d3.event.touches) + */ + export function touches(container: EventTarget, touches?: TouchList): Array<[number, number]>; + + // NB. this is limited to primitive values due to D3's use of the <, >, and >= operators. Results get weird for object instances. + /** + * Compares two primitive values for sorting (in ascending order). + */ + export function ascending(a: Primitive, b: Primitive): number; + + /** + * Compares two primitive values for sorting (in ascending order). + */ + export function descending(a: Primitive, b: Primitive): number; + + /** + * Return the minimum value in the array using natural order. + */ + export function min(array: number[]): number; + + /** + * Return the minimum value in the array using natural order. + */ + export function min(array: string[]): string; + + /** + * Return the minimum value in the array using natural order. + */ + export function min(array: T[]): T; + + /** + * Return the minimum value in the array using natural order. + */ + export function min(array: T[], accessor: (datum: T, index: number) => number): number; + + /** + * Return the minimum value in the array using natural order. + */ + export function min(array: T[], accessor: (datum: T, index: number) => string): string; + + /** + * Return the minimum value in the array using natural order. + */ + export function min(array: T[], accessor: (datum: T, index: number) => U): U; + + /** + * Return the maximum value in the array of numbers using natural order. + */ + export function max(array: number[]): number; + + /** + * Return the maximum value in the array of strings using natural order. + */ + export function max(array: string[]): string; + + /** + * Return the maximum value in the array of numbers using natural order. + */ + export function max(array: T[]): T; + + /** + * Return the maximum value in the array using natural order and a projection function to map values to numbers. + */ + export function max(array: T[], accessor: (datum: T, index: number) => number): number; + + /** + * Return the maximum value in the array using natural order and a projection function to map values to strings. + */ + export function max(array: T[], accessor: (datum: T, index: number) => string): string; + + /** + * Return the maximum value in the array using natural order and a projection function to map values to easily-sorted values. + */ + export function max(array: T[], accessor: (datum: T, index: number) => U): U; + + /** + * Return the min and max simultaneously. + */ + export function extent(array: number[]): [number, number]; + + /** + * Return the min and max simultaneously. + */ + export function extent(array: string[]): [string, string]; + + /** + * Return the min and max simultaneously. + */ + export function extent(array: T[]): [T, T]; + + /** + * Return the min and max simultaneously. + */ + export function extent(array: Array): [T | Primitive, T | Primitive]; + + /** + * Return the min and max simultaneously. + */ + export function extent(array: T[], accessor: (datum: T, index: number) => number): [number, number]; + + /** + * Return the min and max simultaneously. + */ + export function extent(array: T[], accessor: (datum: T, index: number) => string): [string, string]; + + /** + * Return the min and max simultaneously. + */ + export function extent(array: U[], accessor: (datum: T, index: number) => U): [U | Primitive, U | Primitive]; + + /** + * Compute the sum of an array of numbers. + */ + export function sum(array: number[]): number; + + /** + * Compute the sum of an array, using the given accessor to convert values to numbers. + */ + export function sum(array: T[], accessor: (datum: T, index: number) => number): number; + + export function mean(array: number[]): number; + export function mean(array: T[], accessor: (datum: T, index: number) => number): number; + + export function quantile(array: number[], p: number): number; + + export function variance(array: number[]): number; + export function variance(array: T[], accessor: (datum: T, index: number) => number): number; + + export function deviation(array: number[]): number; + export function deviation(array: T[], accessor: (datum: T, index: number) => number): number; + + export function bisectLeft(array: number[], x: number, lo?: number, hi?: number): number; + export function bisectLeft(array: string[], x: string, lo?: number, hi?: number): number; + + export var bisect: typeof bisectRight; + + export function bisectRight(array: T[], x: T, lo?: number, hi?: number): number; + + export function bisector(accessor: (x: T) => U): { + left: (array: T[], x: T, lo?: number, hi?: number) => number; + right: (array: T[], x: T, lo?: number, hi?: number) => number; + } + + export function bisector(comparator: (a: T, b: U) => number): { + left: (array: T[], x: U, lo?: number, hi?: number) => number; + right: (array: T[], x: U, lo?: number, hi?: number) => number; + } + + export function shuffle(array: T[], lo?: number, hi?: number): T[]; + + /** + * Returns the enumerable property names of the specified object. + * @param object a JavaScript object + */ + export function keys(object: Object): string[]; + + /** + * Returns an array containing the property values of the specified object. + */ + export function values(object: { [key: string]: T }): T[]; + /** + * Returns an array containing the property values of the specified object. + */ + export function values(object: { [key: number]: T }): T[]; + /** + * Returns an array containing the property values of the specified object. + */ + export function values(object: Object): any[]; + + /** + * Returns an array of key-value pairs containing the property values of the specified object. + */ + export function entries(object: { [key: string]: T }): { key: string; value: T }[]; + + /** + * Returns an array of key-value pairs containing the property values of the specified object. + */ + export function entries(object: { [key: number]: T }): { key: string; value: T }[]; + + /** + * Returns an array of key-value pairs containing the property values of the specified object. + */ + export function entries(object: Object): { key: string; value: any }[]; + + /** + * A shim for ES6 maps. The implementation uses a JavaScript object internally, and thus keys are limited to strings. + */ + interface Map { + /** + * Does the map contain the given key? + */ + has(key: string): boolean; + + /** + * Retrieve the value for the given key. Returns undefined if there is no value stored. + */ + get(key: string): T; + + /** + * Set the value for the given key. Returns the new value. + */ + set(key: string, value: T): T; + + /** + * Remove the value for the given key. Returns true if there was a value and false otherwise. + */ + remove(key: string): boolean; + + /** + * Returns an array of all keys in arbitrary order. + */ + keys(): string[]; + + /** + * Returns an array of all values in arbitrary order. + */ + values(): T[]; + + /** + * Returns an array of key-value objects in arbitrary order. + */ + entries(): { key: string; value: T }[]; + + /** + * Calls the function for each key and value pair in the map. The 'this' context is the map itself. + */ + forEach(func: (key: string, value: T) => any): void; + + /** + * Is this map empty? + */ + empty(): boolean; + + /** + * Returns the number of elements stored in the map. + */ + size(): number; + } + + /** + * Constructs an initially empty map. + */ + export function map(): Map; + + /** + * Construct a new map by copying keys and values from the given one. + */ + export function map(object: Map): Map; + + /** + * Construct a new map by copying enumerable properties and values from the given object. + */ + export function map(object: { [key: string]: T }): Map; + + /** + * Construct a new map by copying enumerable properties and values from the given object. + */ + export function map(object: { [key: number]: T }): Map; + + /** + * Construct a new map by copying elements from the array. The key function is used to identify each object. + */ + export function map(array: T[], key: (datum: T, index: number) => string): Map; + + /** + * Construct a new map by copying enumerable properties and values from the given object. + */ + export function map(object: Object): Map; + + /** + * A shim for ES6 sets. Is only able to store strings. + */ + interface Set { + /** + * Is the given string stored in this set? + */ + has(value: string): boolean; + + /** + * Add the string to this set. Returns the value. + */ + add(value: string): string; + + /** + * Remove the given value from the set. Returns true if it was stored, and false otherwise. + */ + remove(value: string): boolean; + + /** + * Returns an array of the strings stored in this set. + */ + values(): string[]; + + /** + * Calls a given function for each value in the set. The return value of the function is ignored. The this context of the function is the set itself. + */ + forEach(func: (value: string) => any): void; + + /** + * Is this set empty? + */ + empty(): boolean; + + /** + * Returns the number of values stored in this set. + */ + size(): number; + } + + /** + * Creates an initially-empty set. + */ + export function set(): Set; + + /** + * Initializes a set from the given array of strings. + */ + export function set(array: string[]): Set; + + /** + * Merges the specified arrays into a single array. + */ + export function merge(arrays: T[][]): T[]; + + /** + * Generates a 0-based numeric sequence. The output range does not include 'stop'. + */ + export function range(stop: number): number[]; + + /** + * Generates a numeric sequence starting from the given start and stop values. 'step' defaults to 1. The output range does not include 'stop'. + */ + export function range(start: number, stop: number, step?: number): number[]; + + /** + * Given the specified array, return an array corresponding to the list of indices in 'keys'. + */ + export function permute(array: { [key: number]: T }, keys: number[]): T[]; + + /** + * Given the specified object, return an array corresponding to the list of property names in 'keys'. + */ + export function permute(object: { [key: string]: T }, keys: string[]): T[]; + + // TODO construct n-tuples from n input arrays + export function zip(...arrays: T[][]): T[][]; + + export function transpose(matrix: T[][]): T[][]; + + /** + * For each adjacent pair of elements in the specified array, returns a new array of tuples of elements i and i - 1. + * Returns the empty array if the input array has fewer than two elements. + */ + export function pairs(array: T[]): Array<[T, T]>; + + interface Nest { + key(func: (datum: T) => string): Nest; + sortKeys(comparator: (a: string, b: string) => number): Nest; + sortValues(comparator: (a: T, b: T) => number): Nest; + rollup(func: (values: T[]) => U): Nest; + map(array: T[]): { [key: string]: any }; + map(array: T[], mapType: typeof d3.map): Map; + entries(array: T[]): { key: string; values: any }[]; + } + + export function nest(): Nest; + + export module random { + export function normal(mean?: number, deviation?: number): () => number; + export function logNormal(mean?: number, deviation?: number): () => number; + export function bates(count: number): () => number; + export function irwinHall(count: number): () => number; + } + + interface Transform { + rotate: number; + translate: [number, number]; + skew: number; + scale: [number, number]; + toString(): string; + } + + export function transform(transform: string): Transform; + + export function format(specifier: string): (n: number) => string; + + interface FormatPrefix { + symbol: string; + scale(n: number): number; + } + + export function formatPrefix(value: number, precision?: number): FormatPrefix; + + export function round(x: number, n?: number): number; + + export function requote(string: string): string; + + export var rgb: { + new (r: number, g: number, b: number): Rgb; + new (color: string): Rgb; + + (r: number, g: number, b: number): Rgb; + (color: string): Rgb; + }; + + interface Rgb extends Color { + r: number; + g: number; + b: number; + + brighter(k?: number): Rgb; + darker(k?: number): Rgb; + + hsl(): Hsl; + + toString(): string; + } + + export var hsl: { + new (h: number, s: number, l: number): Hsl; + new (color: string): Hsl; + + (h: number, s: number, l: number): Hsl; + (color: string): Hsl; + }; + + interface Hsl extends Color { + h: number; + s: number; + l: number; + + brighter(k?: number): Hsl; + darker(k?: number): Hsl; + + rgb(): Rgb; + + toString(): string; + } + + export var hcl: { + new (h: number, c: number, l: number): Hcl; + new (color: string): Hcl; + + (h: number, c: number, l: number): Hcl; + (color: string): Hcl; + }; + + interface Hcl extends Color { + h: number; + c: number; + l: number; + + brighter(k?: number): Hcl; + darker(k?: number): Hcl; + } + + export var lab: { + new (l: number, a: number, b: number): Lab; + new (color: string): Lab; + + (l: number, a: number, b: number): Lab; + (color: string): Lab; + } + + interface Lab extends Color { + l: number; + a: number; + b: number; + + brighter(k?: number): Lab; + darker(k?: number): Lab; + + rgb(): Rgb; + toString(): string; + } + + export var color: { + (): Color; + new (): Color; + }; + + interface Color { + rgb(): Rgb; + } + + export module ns { + interface Qualified { + space: string; + local: string; + } + + export var prefix: { [key: string]: string }; + export function qualify(name: string): Qualified | string; + } + + export function functor(value: T): T; + export function functor(value: T): () => T; + + export function rebind(target: {}, source: {}, ...names: string[]): any; + + export function dispatch(...names: string[]): Dispatch; + + interface Dispatch { + on(type: string): (...args: any[]) => void; + on(type: string, listener: (...args: any[]) => any): Dispatch; + [event: string]: (...args: any[]) => void; + } + + export module scale { + export function identity(): Identity; + + interface Identity { + (n: number): number; + invert(n: number): number; + + domain(): number[]; + domain(numbers: number[]): Identity; + + range(): number[]; + range(numbers: number[]): Identity; + + ticks(count?: number): number[]; + + tickFormat(count?: number, format?: string): (n: number) => string; + + copy(): Identity; + } + + export function linear(): Linear; + export function linear(): Linear; + export function linear(): Linear; + + interface Linear { + (x: number): Output; + invert(y: number): number; + + domain(): number[]; + domain(numbers: number[]): Linear; + + range(): Range[]; + range(values: Range[]): Linear; + + rangeRound(values: number[]): Linear; + + interpolate(): (a: Range, b: Range) => (t: number) => Output; + interpolate(factory: (a: Range, b: Range) => (t: number) => Output): Linear; + + clamp(): boolean; + clamp(clamp: boolean): Linear; + + ticks(count?: number): number[]; + + tickFormat(count?: number, format?: string): (n: number) => string; + + copy(): Linear; + } + + export function sqrt(): Pow; + export function sqrt(): Pow; + export function sqrt(): Pow; + + export function pow(): Pow; + export function pow(): Pow; + export function pow(): Pow; + + interface Pow { + (x: number): Output; + + invert(y: number): number; + + domain(): number[]; + domain(numbers: number[]): Pow; + + range(): Range[]; + range(values: Range[]): Pow; + + rangeRound(values: number[]): Pow; + + exponent(): number; + exponent(k: number): Pow; + + interpolate(): (a: Range, b: Range) => (t: number) => Output; + interpolate(factory: (a: Range, b: Range) => (t: number) => Output): Pow; + + clamp(): boolean; + clamp(clamp: boolean): Pow; + + nice(m?: number): Pow; + + ticks(count?: number): number[]; + + tickFormat(count?: number, format?: string): (n: number) => string; + + copy(): Pow; + } + + export function log(): Log; + export function log(): Log; + export function log(): Log; + + interface Log { + (x: number): Output; + + invert(y: number): number; + + domain(): number[]; + domain(numbers: number[]): Log; + + range(): Range[]; + range(values: Range[]): Log; + + rangeRound(values: number[]): Log; + + base(): number; + base(base: number): Log; + + interpolate(): (a: Range, b: Range) => (t: number) => Output; + interpolate(factory: (a: Range, b: Range) => (t: number) => Output): Log; + + clamp(): boolean; + clamp(clamp: boolean): Log; + + nice(): Log; + + ticks(): number[]; + + tickFormat(count?: number, format?: string): (t: number) => string; + + copy(): Log; + } + + export function quantize(): Quantize; + + interface Quantize { + (x: number): T; + + invertExtent(y: T): [number, number]; + + domain(): number[]; + domain(numbers: number[]): Quantize; + + range(): T[]; + range(values: T[]): Quantize; + + copy(): Quantize; + } + + export function quantile(): Quantile; + + interface Quantile { + (x: number): T; + + invertExtent(y: T): [number, number]; + + domain(): number[]; + domain(numbers: number[]): Quantile; + + range(): T[]; + range(values: T[]): Quantile; + + quantiles(): number[]; + + copy(): Quantile; + } + + export function threshold(): Threshold; + export function threshold(): Threshold; + + interface Threshold { + (x: number): Range; + + invertExtent(y: Range): [Domain, Domain]; + + domain(): Domain[]; + domain(domain: Domain[]): Threshold; + + range(): Range[]; + range(values: Range[]): Threshold; + + copy(): Threshold; + } + + export function ordinal(): Ordinal; + export function ordinal(): Ordinal; + export function category10(): Ordinal; + export function category10(): Ordinal; + export function category20(): Ordinal; + export function category20(): Ordinal; + export function category20b(): Ordinal; + export function category20b(): Ordinal; + export function category20c(): Ordinal; + export function category20c(): Ordinal; + + interface Ordinal { + (x: Domain): Range; + + domain(): Domain[]; + domain(values: Domain[]): Ordinal; + + range(): Range[]; + range(values: Range[]): Ordinal; + + rangePoints(interval: [number, number], padding?: number): Ordinal; + rangeRoundPoints(interval: [number, number], padding?: number): Ordinal; + + rangeBands(interval: [number, number], padding?: number, outerPadding?: number): Ordinal; + rangeRoundBands(interval: [number, number], padding?: number, outerPadding?: number): Ordinal; + + rangeBand(): number; + rangeExtent(): [number, number]; + + copy(): Ordinal; + } + } + + export function interpolate(a: number, b: number): (t: number) => number; + export function interpolate(a: string, b: string): (t: number) => string; + export function interpolate(a: string | Color, b: Color): (t: number) => string; + export function interpolate(a: Array, b: Color[]): (t: number) => string; + export function interpolate(a: Range[], b: Output[]): (t: number) => Output[]; + export function interpolate(a: Range[], b: Range[]): (t: number) => Output[]; + export function interpolate(a: { [key: string]: string | Color }, b: { [key: string]: Color }): (t: number) => { [key: string]: string }; + export function interpolate(a: { [key: string]: Range }, b: { [key: string]: Output }): (t: number) => { [key: string]: Output }; + export function interpolate(a: { [key: string]: Range }, b: { [key: string]: Range }): (t: number) => { [key: string]: Output }; + + export function interpolateNumber(a: number, b: number): (t: number) => number; + + export function interpolateRound(a: number, b: number): (t: number) => number; + + export function interpolateString(a: string, b: string): (t: number) => string; + + export function interpolateRgb(a: string | Color, b: string | Color): (t: number) => string; + + export function interpolateHsl(a: string | Color, b: string | Color): (t: number) => string; + + export function interpolateLab(a: string | Color, b: string | Color): (t: number) => string; + + export function interpolateHcl(a: string | Color, b: string | Color): (t: number) => string; + + export function interpolateArray(a: Array, b: Color[]): (t: number) => string[]; + export function interpolateArray(a: Range[], b: Range[]): (t: number) => Output[]; + export function interpolateArray(a: Range[], b: Output[]): (t: number) => Output[]; + + export function interpolateObject(a: { [key: string]: string | Color }, b: { [key: string]: Color }): (t: number) => { [key: string]: string }; + export function interpolateObject(a: { [key: string]: Range }, b: { [key: string]: Output }): (t: number) => { [key: string]: Output }; + export function interpolateObject(a: { [key: string]: Range }, b: { [key: string]: Range }): (t: number) => { [key: string]: Output }; + + export function interpolateTransform(a: string | Transform, b: string | Transform): (t: number) => string; + + export function interpolateZoom(a: [number, number, number], b: [number, number, number]): { + (t: number): [number, number, number]; + duration: number; + }; + + export var interpolators: Array<(a: any, b: any) => (t: number) => any>; + + export module time { + export var second: Interval; + export var minute: Interval; + export var hour: Interval; + export var day: Interval; + export var week: Interval; + export var sunday: Interval; + export var monday: Interval; + export var tuesday: Interval; + export var wednesday: Interval; + export var thursday: Interval; + export var friday: Interval; + export var saturday: Interval; + export var month: Interval; + export var year: Interval; + + interface Interval { + (d: Date): Date; + + floor(d: Date): Date; + + round(d: Date): Date; + + ceil(d: Date): Date; + + range(start: Date, stop: Date, step?: number): Date[]; + + offset(date: Date, step: Date): Date; + + utc: { + (d: Date): Date; + + floor(d: Date): Date; + + round(d: Date): Date; + + ceil(d: Date): Date; + + range(start: Date, stop: Date, step?: number): Date[]; + + offset(date: Date, step: Date): Date; + } + } + + export function seconds(start: Date, stop: Date, step?: number): Date[]; + export function minutes(start: Date, stop: Date, step?: number): Date[]; + export function hours(start: Date, stop: Date, step?: number): Date[]; + export function days(start: Date, stop: Date, step?: number): Date[]; + export function weeks(start: Date, stop: Date, step?: number): Date[]; + export function sundays(start: Date, stop: Date, step?: number): Date[]; + export function mondays(start: Date, stop: Date, step?: number): Date[]; + export function tuesdays(start: Date, stop: Date, step?: number): Date[]; + export function wednesdays(start: Date, stop: Date, step?: number): Date[]; + export function thursdays(start: Date, stop: Date, step?: number): Date[]; + export function fridays(start: Date, stop: Date, step?: number): Date[]; + export function saturdays(start: Date, stop: Date, step?: number): Date[]; + export function months(start: Date, stop: Date, step?: number): Date[]; + export function years(start: Date, stop: Date, step?: number): Date[]; + + export function dayOfYear(d: Date): number; + export function weekOfYear(d: Date): number; + export function sundayOfYear(d: Date): number; + export function mondayOfYear(d: Date): number; + export function tuesdayOfYear(d: Date): number; + export function wednesdayOfYear(d: Date): number; + export function fridayOfYear(d: Date): number; + export function saturdayOfYear(d: Date): number; + + export function format(specifier: string): Format; + + export module format { + export function multi(formats: Array<[string, (d: Date) => boolean]>): Format; + export function utc(specifier: string): Format; + export var iso: Format; + } + + interface Format { + (d: Date): string; + parse(input: string): Date; + } + + export function scale(): Scale; + export function scale(): Scale; + export function scale(): Scale; + + export module scale { + export function utc(): Scale; + export function utc(): Scale; + export function utc(): Scale; + } + + + interface Scale { + (x: Date): Output; + + invert(y: number): Date; + + domain(): Date[]; + domain(dates: number[]): Scale; + domain(dates: Date[]): Scale; + + nice(): Scale; + nice(interval: Interval, step?: number): Scale; + + range(): Range[]; + range(values: Range[]): Scale; + + rangeRound(values: number[]): Scale; + + interpolate(): (a: Range, b: Range) => (t: number) => Output; + interpolate(factory: (a: Range, b: Range) => (t: number) => Output): Scale; + + clamp(): boolean; + clamp(clamp: boolean): Scale; + + ticks(): Date[]; + ticks(interval: Interval, step?: number): Date[]; + ticks(count: number): Date[]; + + tickFormat(count: number): (d: Date) => string; + + copy(): Scale; + } + } + + export module behavior { + export function drag(): Drag; + + interface Drag { + (selection: Selection): void; + + on(type: string): (d: Datum, i: number) => any; + on(type: string, listener: (d: Datum, i: number) => any): Drag; + + origin(): (d: Datum, i: number) => { x: number; y: number }; + origin(accessor: (d: Datum, i: number) => { x: number; y: number }): Drag; + } + + export function zoom(): Zoom; + + module zoom { + interface Scale { + domain(): number[]; + domain(values: number[]): Scale; + + invert(y: number): number; + + range(values: number[]): Scale; + range(): number[]; + } + } + + interface Zoom { + (selection: Selection): void; + + translate(): [number, number]; + translate(translate: [number, number]): Zoom; + + scale(): number; + scale(scale: number): Zoom; + + scaleExtent(): [number, number]; + scaleExtent(extent: [number, number]): Zoom; + + center(): [number, number]; + center(center: [number, number]): Zoom; + + size(): [number, number]; + size(size: [number, number]): Zoom; + + x(): zoom.Scale; + x(x: zoom.Scale): Zoom; + + y(): zoom.Scale; + y(y: zoom.Scale): Zoom; + + on(type: string): (d: Datum, i: number) => any; + on(type: string, listener: (d: Datum, i: number) => any): Zoom; + + event(selection: Selection): void; + event(transition: Transition): void; + } + } + + export module geo { + export function path(): Path; + + interface Path { + (feature: any, index?: number): string; + + area(feature: any): number; + + centroid(feature: any): [number, number]; + + bounds(feature: any): [[number, number], [number, number]]; + + projection(): Transform | ((coordinates: [number, number]) => [number, number]); + projection(stream: Transform): Path; + projection(projection: (coordinates: [number, number]) => [number, number]): Path; + + pointRadius(): number | ((datum: any, index: number) => number); + pointRadius(radius: number): Path; + pointRadius(radius: (datum: any, index: number) => number): Path; + + context(): CanvasRenderingContext2D; + context(context: CanvasRenderingContext2D): Path; + } + + export function graticule(): Graticule; + + interface Graticule { + (): any; + + lines(): any[]; + + outline(): any; + + extent(): [[number, number], [number, number]]; + extent(extent: [[number, number], [number, number]]): Graticule; + + majorExtent(): [[number, number], [number, number]]; + majorExtent(extent: [[number, number], [number, number]]): Graticule; + + minorExtent(): [[number, number], [number, number]]; + minorExtent(extent: [[number, number], [number, number]]): Graticule; + + step(): [number, number]; + step(step: [number, number]): Graticule; + + majorStep(): [number, number]; + majorStep(step: [number, number]): Graticule; + + minorStep(): [number, number]; + minorStep(step: [number, number]): Graticule; + + precision(): number; + precision(precision: number): Graticule; + } + + export function circle(): Circle; + + interface Circle { + (...args: any[]): any; + + origin(): [number, number] | ((...args: any[]) => [number, number]); + origin(origin: [number, number]): Circle; + origin(origin: (...args: any[]) => [number, number]): Circle; + + angle(): number; + angle(angle: number): Circle; + + precision(): number; + precision(precision: number): Circle; + } + + export function area(feature: any): number; + export function centroid(feature: any): [number, number]; + export function bounds(feature: any): [[number, number], [number, number]]; + export function distance(a: [number, number], b: [number, number]): number; + export function length(feature: any): number; + export function interpolate(a: [number, number], b: [number, number]): (t: number) => [number, number]; + + export function rotation(rotate: [number, number] | [number, number, number]): Rotation; + + interface Rotation { + (location: [number, number]): [number, number]; + invert(location: [number, number]): [number, number]; + } + + export function stream(object: any, listener: Listener): void; + + interface Listener { + point(x: number, y: number, z: number): void; + lineStart(): void; + lineEnd(): void; + polygonStart(): void; + polygonEnd(): void; + sphere(): void; + } + + export function transform(methods: TransformMethods): Transform; + + interface TransformMethods { + point?(x: number, y: number, z: number): void; + lineStart?(): void; + lineEnd?(): void; + polygonStart?(): void; + polygonEnd?(): void; + sphere?(): void; + } + + interface Transform { + stream(stream: Listener): Listener; + } + + export function clipExtent(): ClipExtent; + + interface ClipExtent extends Transform { + extent(): [[number, number], [number, number]]; + extent(extent: [[number, number], [number, number]]): ClipExtent; + } + + export function projection(raw: RawInvertibleProjection): InvertibleProjection; + export function projection(raw: RawProjection): Projection; + + export function projectionMutator(factory: (...args: any[]) => RawInvertibleProjection): (...args: any[]) => InvertibleProjection; + export function projectionMutator(factory: (...args: any[]) => RawProjection): (...args: any[]) => Projection; + + export function albers(): ConicProjection; + export function albersUsa(): ConicProjection; + export function azimuthalEqualArea(): InvertibleProjection; + module azimuthalEqualArea { + export function raw(lambda: number, phi: number): [number, number]; + module raw { + export function invert(x: number, y: number): [number, number]; + } + } + + export function azimuthalEquidistant(): InvertibleProjection; + module azimuthalEquidistant { + export function raw(lambda: number, phi: number): [number, number]; + module raw { + export function invert(x: number, y: number): [number, number]; + } + } + + export function conicConformal(): ConicProjection; + module conicConformal { + export function raw(phi0: number, phi1: number): RawInvertibleProjection; + } + + export function conicEqualArea(): ConicProjection; + module conicEqualArea { + export function raw(phi0: number, phi1: number): RawInvertibleProjection; + } + + export function conicEquidistant(): ConicProjection; + module conicEquidistant { + export function raw(phi0: number, phi1: number): RawInvertibleProjection; + } + + export function equirectangular(): InvertibleProjection; + module equirectangular { + export function raw(lambda: number, phi: number): [number, number]; + module raw { + export function invert(x: number, y: number): [number, number]; + } + } + + export function gnomonic(): InvertibleProjection; + module gnomonic { + export function raw(lambda: number, phi: number): [number, number]; + module raw { + export function invert(x: number, y: number): [number, number]; + } + } + + export function mercator(): InvertibleProjection; + module mercator { + export function raw(lambda: number, phi: number): [number, number]; + module raw { + export function invert(x: number, y: number): [number, number]; + } + } + + export function orthographic(): InvertibleProjection; + module orthographic { + export function raw(lambda: number, phi: number): [number, number]; + module raw { + export function invert(x: number, y: number): [number, number]; + } + } + + export function stereographic(): InvertibleProjection; + module stereographic { + export function raw(lambda: number, phi: number): [number, number]; + module raw { + export function invert(x: number, y: number): [number, number]; + } + } + + export function transverseMercator(): InvertibleProjection; + module transverseMercator { + export function raw(lambda: number, phi: number): [number, number]; + module raw { + export function invert(x: number, y: number): [number, number]; + } + } + + interface Projection { + (location: [number, number]): [number, number]; + + rotate(): [number, number, number]; + rotate(rotation: [number, number, number]): Projection; + + center(): [number, number]; + center(location: [number, number]): Projection; + + translate(): [number, number]; + translate(point: [number, number]): Projection; + + scale(): number; + scale(scale: number): Projection; + + clipAngle(): number; + clipAngle(angle: number): Projection; + + clipExtent(): [[number, number], [number, number]]; + clipExtent(extent: [[number, number], [number, number]]): Projection; + + precision(): number; + precision(precision: number): Projection; + + stream(listener: Listener): Listener; + } + + interface InvertibleProjection extends Projection { + invert(point: [number, number]): [number, number]; + } + + interface ConicProjection extends InvertibleProjection { + parallels(): [number, number]; + parallels(parallels: [number, number]): ConicProjection; + + rotate(): [number, number, number]; + rotate(rotation: [number, number, number]): ConicProjection; + + center(): [number, number]; + center(location: [number, number]): ConicProjection; + + translate(): [number, number]; + translate(point: [number, number]): ConicProjection; + + scale(): number; + scale(scale: number): ConicProjection; + + clipAngle(): number; + clipAngle(angle: number): ConicProjection; + + clipExtent(): [[number, number], [number, number]]; + clipExtent(extent: [[number, number], [number, number]]): ConicProjection; + + precision(): number; + precision(precision: number): ConicProjection; + } + + interface RawProjection { + (lambda: number, phi: number): [number, number]; + } + + interface RawInvertibleProjection extends RawProjection { + invert(x: number, y: number): [number, number]; + } + } + + module svg { + export function line(): Line<[number, number]>; + export function line(): Line; + + interface Line { + (data: T[]): string; + + x(): number | ((d: T, i: number) => number); + x(x: number): Line; + x(x: (d: T, i: number) => number): Line; + + y(): number | ((d: T, i: number) => number); + y(x: number): Line; + y(y: (d: T, i: number) => number): Line; + + interpolate(): string | ((points: Array<[number, number]>) => string); + interpolate(interpolate: "linear"): Line; + interpolate(interpolate: "linear-closed"): Line; + interpolate(interpolate: "step"): Line; + interpolate(interpolate: "step-before"): Line; + interpolate(interpolate: "step-after"): Line; + interpolate(interpolate: "basis"): Line; + interpolate(interpolate: "basis-open"): Line; + interpolate(interpolate: "basis-closed"): Line; + interpolate(interpolate: "bundle"): Line; + interpolate(interpolate: "cardinal"): Line; + interpolate(interpolate: "cardinal-open"): Line; + interpolate(interpolate: "cardinal-closed"): Line; + interpolate(interpolate: "monotone"): Line; + interpolate(interpolate: string): Line; + interpolate(interpolate: (points: Array<[number, number]>) => string): Line; + + tension(): number; + tension(tension: number): Line; + + defined(): (d: T, i: number) => boolean; + defined(defined: (d: T, i: number) => boolean): Line; + } + + module line { + export function radial(): Radial<[number, number]>; + export function radial(): Radial; + + interface Radial { + (data: T[]): string; + + radius(): number | ((d: T, i: number) => number); + radius(radius: number): Radial; + radius(radius: (d: T, i: number) => number): Radial; + + angle(): number | ((d: T, i: number) => number); + angle(angle: number): Radial; + angle(angle: (d: T, i: number) => number): Radial; + + interpolate(): string | ((points: Array<[number, number]>) => string); + interpolate(interpolate: "linear"): Radial; + interpolate(interpolate: "linear-closed"): Radial; + interpolate(interpolate: "step"): Radial; + interpolate(interpolate: "step-before"): Radial; + interpolate(interpolate: "step-after"): Radial; + interpolate(interpolate: "basis"): Radial; + interpolate(interpolate: "basis-open"): Radial; + interpolate(interpolate: "basis-closed"): Radial; + interpolate(interpolate: "bundle"): Radial; + interpolate(interpolate: "cardinal"): Radial; + interpolate(interpolate: "cardinal-open"): Radial; + interpolate(interpolate: "cardinal-closed"): Radial; + interpolate(interpolate: "monotone"): Radial; + interpolate(interpolate: string): Radial; + interpolate(interpolate: (points: Array<[number, number]>) => string): Radial; + + tension(): number; + tension(tension: number): Radial; + + defined(): (d: T, i: number) => boolean; + defined(defined: (d: T, i: number) => boolean): Radial; + } + } + + export function area(): Area<[number, number]>; + export function area(): Area; + + interface Area { + (data: T[]): string; + + x(): number | ((d: T, i: number) => number); + x(x: number): Area; + x(x: (d: T, i: number) => number): Area; + + x0(): number | ((d: T, i: number) => number); + x0(x0: number): Area; + x0(x0: (d: T, i: number) => number): Area; + + x1(): number | ((d: T, i: number) => number); + x1(x1: number): Area; + x1(x1: (d: T, i: number) => number): Area; + + y(): number | ((d: T, i: number) => number); + y(y: number): Area; + y(y: (d: T, i: number) => number): Area; + + y0(): number | ((d: T, i: number) => number); + y0(y0: number): Area; + y0(y0: (d: T, i: number) => number): Area; + + y1(): number | ((d: T, i: number) => number); + y1(y1: number): Area; + y1(y1: (d: T, i: number) => number): Area; + + interpolate(): string | ((points: Array<[number, number]>) => string); + interpolate(interpolate: "linear"): Area; + interpolate(interpolate: "step"): Area; + interpolate(interpolate: "step-before"): Area; + interpolate(interpolate: "step-after"): Area; + interpolate(interpolate: "basis"): Area; + interpolate(interpolate: "basis-open"): Area; + interpolate(interpolate: "cardinal"): Area; + interpolate(interpolate: "cardinal-open"): Area; + interpolate(interpolate: "monotone"): Area; + interpolate(interpolate: string): Area; + + tension(): number; + tension(tension: number): Area; + + defined(): (d: T, i: number) => boolean; + defined(): (d: T, i: number) => boolean; + } + + module area { + export function radial(): Radial<[number, number]>; + export function radial(): Radial; + + interface Radial { + (data: T[]): string; + + radius(): number | ((d: T, i: number) => number); + radius(radius: number): Radial; + radius(radius: (d: T, i: number) => number): Radial; + + innerRadius(): number | ((d: T, i: number) => number); + innerRadius(innerRadius: number): Radial; + innerRadius(innerRadius: (d: T, i: number) => number): Radial; + + outerRadius(): number | ((d: T, i: number) => number); + outerRadius(outerRadius: number): Radial; + outerRadius(outerRadius: (d: T, i: number) => number): Radial; + + angle(): number | ((d: T, i: number) => number); + angle(angle: number): Radial; + angle(angle: (d: T, i: number) => number): Radial; + + startAngle(): number | ((d: T, i: number) => number); + startAngle(startAngle: number): Radial; + startAngle(startAngle: (d: T, i: number) => number): Radial; + + endAngle(): number | ((d: T, i: number) => number); + endAngle(endAngle: number): Radial; + endAngle(endAngle: (d: T, i: number) => number): Radial; + + interpolate(): string | ((points: Array<[number, number]>) => string); + interpolate(interpolate: "linear"): Radial; + interpolate(interpolate: "step"): Radial; + interpolate(interpolate: "step-before"): Radial; + interpolate(interpolate: "step-after"): Radial; + interpolate(interpolate: "basis"): Radial; + interpolate(interpolate: "basis-open"): Radial; + interpolate(interpolate: "cardinal"): Radial; + interpolate(interpolate: "cardinal-open"): Radial; + interpolate(interpolate: "monotone"): Radial; + interpolate(interpolate: string): Radial; + interpolate(interpolate: (points: Array<[number, number]>) => string): Radial; + + tension(): number; + tension(tension: number): Radial; + + defined(): (d: T, i: number) => boolean; + defined(): (d: T, i: number) => boolean; + } + } + + export function arc(): Arc; + export function arc(): Arc; + + module arc { + interface Arc { + innerRadius: number; + outerRadius: number; + startAngle: number; + endAngle: number; + padAngle: number + } + } + + interface Arc { + (d: T, i: number): string; + + innerRadius(): (d: T, i: number) => number; + innerRadius(radius: number): Arc; + innerRadius(radius: (d: T, i: number) => number): Arc; + + outerRadius(): (d: T, i: number) => number; + outerRadius(radius: number): Arc; + outerRadius(radius: (d: T, i: number) => number): Arc; + + cornerRadius(): (d: T, i: number) => number; + cornerRadius(radius: number): Arc; + cornerRadius(radius: (d: T, i: number) => number): Arc; + + padRadius(): string | ((d: T, i: number) => number); + padRadius(radius: "auto"): Arc; + padRadius(radius: string): Arc; + padRadius(radius: (d: T, i: number) => number): Arc; + + startAngle(): (d: T, i: number) => number; + startAngle(angle: number): Arc; + startAngle(angle: (d: T, i: number) => number): Arc; + + endAngle(): (d: T, i: number) => number; + endAngle(angle: number): Arc; + endAngle(angle: (d: T, i: number) => number): Arc; + + padAngle(): (d: T, i: number) => number; + padAngle(angle: number): Arc; + padAngle(angle: (d: T, i: number) => number): Arc; + + centroid(d: T, i?: number): [number, number]; + } + + export function symbol(): Symbol<{}>; + export function symbol(): Symbol; + + interface Symbol { + (d: T, i: number): string; + + type(): (d: T, i: number) => string; + type(type: string): Symbol; + type(type: (d: T, i: number) => string): Symbol; + + size(): (d: T, i: string) => number; + size(size: number): Symbol; + size(size: (d: T, i: number) => number): Symbol; + } + + export var symbolTypes: string[]; + + export function chord(): Chord, chord.Node>; + export function chord(): Chord, Node>; + export function chord(): Chord; + + module chord { + interface Link { + source: Node; + target: Node; + } + + interface Node { + radius: number; + startAngle: number; + endAngle: number + } + } + + interface Chord { + (d: Link, i: number): string; + + source(): (d: Link, i: number) => Node; + source(source: Node): Chord; + source(source: (d: Link, i: number) => Node): Chord; + + target(): (d: Link, i: number) => Node; + target(target: Node): Chord; + target(target: (d: Link, i: number) => Node): Chord; + + radius(): (d: Node, i: number) => number; + radius(radius: number): Chord; + radius(radius: (d: Node, i: number) => number): Chord; + + startAngle(): (d: Node, i: number) => number; + startAngle(angle: number): Chord; + startAngle(angle: (d: Node, i: number) => number): Chord; + + endAngle(): (d: Node, i: number) => number; + endAngle(angle: number): Chord; + endAngle(angle: (d: Node, i: number) => number): Chord; + } + + export function diagonal(): Diagonal, diagonal.Node>; + export function diagonal(): Diagonal, Node>; + export function diagonal(): Diagonal; + + module diagonal { + interface Link { + source: Node; + target: Node; + } + + interface Node { + x: number; + y: number; + } + } + + interface Diagonal { + (d: Link, i: number): string; + + source(): (d: Link, i: number) => Node; + source(source: Node): Diagonal; + source(source: (d: Link, i: number) => Node): Diagonal; + + target(): (d: Link, i: number) => Node; + target(target: Node): Diagonal; + target(target: (d: Link, i: number) => Node): Diagonal; + + projection(): (d: Node, i: number) => [number, number]; + projection(projection: (d: Node, i: number) => [number, number]): Diagonal; + } + + module diagonal { + export function radial(): Radial, Node>; + export function radial(): Radial, Node>; + export function radial(): Radial; + + interface Radial { + (d: Link, i: number): string; + + source(): (d: Link, i: number) => Node; + source(source: Node): Radial; + source(source: (d: Link, i: number) => Node): Radial; + + target(): (d: Link, i: number) => Node; + target(target: Node): Radial; + target(target: (d: Link, i: number) => Node): Radial; + + projection(): (d: Node, i: number) => [number, number]; + projection(projection: (d: Node, i: number) => [number, number]): Radial; + } + } + + export function axis(): Axis; + + interface Axis { + (selection: Selection): void; + (selection: Transition): void; + + scale(): any; + scale(scale: any): Axis; + + orient(): string; + orient(orientation: string): Axis; + + ticks(): any[]; + ticks(...args: any[]): Axis; + + tickValues(): any[]; + tickValues(values: any[]): Axis; + + tickSize(): number; + tickSize(size: number): Axis; + tickSize(inner: number, outer: number): Axis; + + innerTickSize(): number; + innerTickSize(size: number): Axis; + + outerTickSize(): number; + outerTickSize(size: number): Axis; + + tickPadding(): number; + tickPadding(padding: number): Axis; + + tickFormat(): (t: any) => string; + tickFormat(format: (t: any) => string): Axis; + } + + export function brush(): Brush; + export function brush(): Brush; + + module brush { + interface Scale { + domain(): number[]; + domain(domain: number[]): Scale; + + range(): number[]; + range(range: number[]): Scale; + + invert?(y: number): number; + } + } + + interface Brush { + (selection: Selection): void; + (selection: Transition): void; + + event(selection: Selection): void; + event(selection: Transition): void; + + x(): brush.Scale; + x(x: brush.Scale): Brush; + + y(): brush.Scale; + y(y: brush.Scale): Brush; + + extent(): [number, number] | [[number, number], [number, number]]; + extent(extent: [number, number] | [[number, number], [number, number]]): Brush; + + clamp(): boolean | [boolean, boolean]; + clamp(clamp: boolean | [boolean, boolean]): Brush; + + clear(): void; + + empty(): boolean; + + on(type: 'brushstart'): (datum: T, index: number) => void; + on(type: 'brush'): (datum: T, index: number) => void; + on(type: 'brushend'): (datum: T, index: number) => void; + on(type: string): (datum: T, index: number) => void; + + on(type: 'brushstart', listener: (datum: T, index: number) => void): Brush; + on(type: 'brush', listener: (datum: T, index: number) => void): Brush; + on(type: 'brushend', listener: (datum: T, index: number) => void): Brush; + on(type: string, listener: (datum: T, index: number) => void): Brush; + } + } + + export function xhr(url: string, mimeType?: string, callback?: (err: any, data: any) => void): Xhr; + export function xhr(url: string, callback: (err: any, data: any) => void): Xhr; + + interface Xhr { + header(name: string): string; + header(name: string, value: string): Xhr; + + mimeType(): string; + mimeType(type: string): Xhr; + + responseType(): string; + responseType(type: string): Xhr; + + response(): (request: XMLHttpRequest) => any; + response(value: (request: XMLHttpRequest) => any): Xhr; + + get(callback?: (err: any, data: any) => void): Xhr; + + post(data?: any, callback?: (err: any, data: any) => void): Xhr; + post(callback: (err: any, data: any) => void): Xhr; + + send(method: string, data?: any, callback?: (err: any, data: any) => void): Xhr; + send(method: string, callback: (err: any, data: any) => void): Xhr; + + abort(): Xhr; + + on(type: "beforesend"): (request: XMLHttpRequest) => void; + on(type: "progress"): (request: XMLHttpRequest) => void; + on(type: "load"): (response: any) => void; + on(type: "error"): (err: any) => void; + on(type: string): (...args: any[]) => void; + + on(type: "beforesend", listener: (request: XMLHttpRequest) => void): Xhr; + on(type: "progress", listener: (request: XMLHttpRequest) => void): Xhr; + on(type: "load", listener: (response: any) => void): Xhr; + on(type: "error", listener: (err: any) => void): Xhr; + on(type: string, listener: (...args: any[]) => void): Xhr; + } + + export function text(url: string, mimeType?: string, callback?: (err: any, data: string) => void): Xhr; + export function text(url: string, callback: (err: any, data: string) => void): Xhr; + + export function json(url: string, callback?: (err: any, data: any) => void): Xhr; + + export function xml(url: string, mimeType?: string, callback?: (err: any, data: any) => void): Xhr; + export function xml(url: string, callback: (err: any, data: any) => void): Xhr; + + export function html(url: string, callback?: (err: any, data: DocumentFragment) => void): Xhr; + + export var csv: Dsv; + export var tsv: Dsv; + export function dsv(delimiter: string, mimeType: string): Dsv; + + interface Dsv { + (url: string, callback: (rows: { [key: string]: string }[]) => void): DsvXhr<{ [key: string]: string }>; + (url: string, callback: (error: any, rows: { [key: string]: string }[]) => void): DsvXhr<{ [key: string]: string }>; + (url: string): DsvXhr<{ [key: string]: string }>; + (url: string, accessor: (row: { [key: string]: string }) => T, callback: (rows: T[]) => void): DsvXhr; + (url: string, accessor: (row: { [key: string]: string }) => T, callback: (error: any, rows: T[]) => void): DsvXhr; + (url: string, accessor: (row: { [key: string]: string }) => T): DsvXhr; + + parse(string: string): { [key: string]: string }[]; + parse(string: string, accessor: (row: { [key: string]: string }, index: number) => T): T[]; + + parseRows(string: string): string[][]; + parseRows(string: string, accessor: (row: string[], index: number) => T): T[]; + + format(rows: Object[]): string; + + formatRows(rows: string[][]): string; + } + + interface DsvXhr extends Xhr { + row(): (row: { [key: string]: string }) => T; + row(accessor: (row: { [key: string]: string }) => U): DsvXhr; + + header(name: string): string; + header(name: string, value: string): DsvXhr; + + mimeType(): string; + mimeType(type: string): DsvXhr; + + responseType(): string; + responseType(type: string): DsvXhr; + + response(): (request: XMLHttpRequest) => any; + response(value: (request: XMLHttpRequest) => any): DsvXhr; + + get(callback?: (err: any, data: T) => void): DsvXhr; + post(data?: any, callback?: (err: any, data: T) => void): DsvXhr; + post(callback: (err: any, data: T) => void): DsvXhr; + + send(method: string, data?: any, callback?: (err: any, data: T) => void): DsvXhr; + send(method: string, callback: (err: any, data: T) => void): DsvXhr; + + abort(): DsvXhr; + + on(type: "beforesend"): (request: XMLHttpRequest) => void; + on(type: "progress"): (request: XMLHttpRequest) => void; + on(type: "load"): (response: T) => void; + on(type: "error"): (err: any) => void; + on(type: string): (...args: any[]) => void; + + on(type: "beforesend", listener: (request: XMLHttpRequest) => void): DsvXhr; + on(type: "progress", listener: (request: XMLHttpRequest) => void): DsvXhr; + on(type: "load", listener: (response: T) => void): DsvXhr; + on(type: "error", listener: (err: any) => void): DsvXhr; + on(type: string, listener: (...args: any[]) => void): DsvXhr; + } + + export function locale(definition: LocaleDefinition): Locale; + + interface LocaleDefinition { + decimal: string; + thousands: string; + grouping: number[]; + currency: [string, string]; + dateTime: string; + date: string; + time: string; + periods: [string, string]; + days: [string, string, string, string, string, string, string]; + shortDays: [string, string, string, string, string, string, string]; + months: [string, string, string, string, string, string, string, string, string, string, string, string]; + shortMonths: [string, string, string, string, string, string, string, string, string, string, string, string]; + } + + interface Locale { + numberFormat(specifier: string): (n: number) => string; + timeFormat: { + (specifier: string): time.Format; + utc(specifier: string): time.Format; + } + } + + module layout { + export function bundle(): Bundle; + export function bundle(): Bundle + + module bundle { + interface Node { + parent: Node; + } + + interface Link { + source: T; + target: T; + } + } + + interface Bundle { + (links: bundle.Link[]): T[][]; + } + + export function chord(): Chord; + + module chord { + interface Link { + source: Node; + target: Node; + } + + interface Node { + index: number; + subindex: number; + startAngle: number; + endAngle: number; + value: number; + } + + interface Group { + index: number; + startAngle: number; + endAngle: number; + value: number; + } + } + + interface Chord { + matrix(): number[][]; + matrix(matrix: number[][]): Chord; + + padding(): number; + padding(padding: number): Chord; + + sortGroups(): (a: number, b: number) => number; + sortGroups(comparator: (a: number, b: number) => number): Chord; + + sortSubgroups(): (a: number, b: number) => number; + sortSubgroups(comparator: (a: number, b: number) => number): Chord; + + sortChords(): (a: number, b: number) => number; + sortChords(comparator: (a: number, b: number) => number): Chord; + + chords(): chord.Link[]; + groups(): chord.Group[]; + } + + export function cluster(): Cluster; + export function cluster(): Cluster; + + module cluster { + interface Result { + parent?: Result; + children?: Result[]; + depth?: number; + x?: number; + y?: number; + } + + interface Link { + source: T; + target: T; + } + } + + interface Cluster { + (root: T): T[]; + + nodes(root: T): T[]; + + links(nodes: T[]): cluster.Link; + + children(): (node: T) => T[]; + children(accessor: (node: T) => T[]): Cluster; + + sort(): (a: T, b: T) => number; + sort(comparator: (a: T, b: T) => number): Cluster; + + separation(): (a: T, b: T) => number; + separation(separation: (a: T, b: T) => number): Cluster; + + size(): [number, number]; + size(size: [number, number]): Cluster; + + nodeSize(): [number, number]; + nodeSize(nodeSize: [number, number]): Cluster; + + value(): (a: T) => number; + value(value: (a: T) => number): Cluster; + } + + export function force(): Force, force.Node>; + export function force(): Force, Node>; + export function force, Node extends force.Node>(): Force; + + module force { + interface Link { + source: T; + target: T; + } + + interface Node { + index?: number; + x?: number; + y?: number; + px?: number; + py?: number; + fixed?: boolean; + weight?: number; + } + + interface Event { + type: string; + alpha: number; + } + } + + interface Force, Node extends force.Node> { + size(): [number, number]; + size(size: [number, number]): Force; + + linkDistance(): number | ((link: Link, index: number) => number); + linkDistance(distance: number): Force; + linkDistance(distance: (link: Link, index: number) => number): Force; + + linkStrength(): number | ((link: Link, index: number) => number); + linkStrength(strength: number): Force; + linkStrength(strength: (link: Link, index: number) => number): Force; + + friction(): number; + friction(friction: number): Force; + + charge(): number | ((node: Node, index: number) => number); + charge(charge: number): Force; + charge(charge: (node: Node, index: number) => number): Force; + + chargeDistance(): number; + chargeDistance(distance: number): Force; + + theta(): number; + theta(theta: number): Force; + + gravity(): number; + gravity(gravity: number): Force; + + nodes(): Node[]; + nodes(nodes: Node[]): Force; + + links(): Link[]; + links(links: { source: number; target: number }[]): Force; + links(links: Link[]): Force; + + start(): Force; + + alpha(): number; + alpha(value: number): Force; + + resume(): Force; + + stop(): Force; + + on(type: string): (event: force.Event) => void; + on(type: string, listener: (event: force.Event) => void): Force; + + drag(): behavior.Drag; + drag(selection: Selection): void; + } + + export function hierarchy(): Hierarchy; + export function hierarchy(): Hierarchy; + + module hierarchy { + interface Result { + parent?: Result; + children?: Result[]; + value?: number; + depth?: number; + } + } + + interface Hierarchy { + (root: T): T[]; + + children(): (node: T) => T[]; + children(accessor: (node: T) => T[]): Hierarchy; + + sort(): (a: T, b: T) => number; + sort(comparator: (a: T, b: T) => number): Hierarchy; + + value(): (node: T) => number; + value(accessor: (node: T) => number): Hierarchy; + + revalue(root: T): T[]; + } + + export function histogram(): Histogram; + export function histogram(): Histogram; + + module histogram { + interface Bin extends Array { + x: number; + dx: number; + y: number; + } + } + + interface Histogram { + (values: T[], index?: number): histogram.Bin[]; + + value(): (datum: T, index: number) => number; + value(value: (datum: T, index: number) => number): Histogram; + + range(): (values: T[], index: number) => [number, number]; + range(range: (values: T[], index: number) => [number, number]): Histogram; + + bins(): (range: [number, number], values: T[], index: number) => number[]; + bins(count: number): Histogram; + bins(thresholds: number[]): Histogram; + bins(func: (range: [number, number], values: T[], index: number) => number[]): Histogram; + + frequency(): boolean; + frequency(frequency: boolean): Histogram; + } + + export function pack(): Pack; + export function pack(): Pack; + + module pack { + interface Node { + parent?: Node; + children?: Node[]; + value?: number; + depth?: number; + x?: number; + y?: number; + r?: number; + } + + interface Link { + source: Node; + target: Node; + } + } + + interface Pack { + (root: T): T[]; + + nodes(root: T): T[]; + + links(nodes: T[]): pack.Link[]; + + children(): (node: T, depth: number) => T[]; + children(children: (node: T, depth: number) => T[]): Pack; + + sort(): (a: T, b: T) => number; + sort(comparator: (a: T, b: T) => number): Pack; + + value(): (node: T) => number; + value(value: (node: T) => number): Pack; + + size(): [number, number]; + size(size: [number, number]): Pack; + + radius(): number | ((node: T) => number); + radius(radius: number): Pack; + radius(radius: (node: T) => number): Pack; + + padding(): number; + padding(padding: number): Pack; + } + + export function pie(): Pie; + export function pie(): Pie; + + module pie { + interface Arc { + value: number; + startAngle: number; + endAngle: number; + padAngle: number; + data: T; + } + } + + interface Pie { + (data: T[], index?: number): pie.Arc[]; + + value(): (datum: T, index: number) => number; + value(accessor: (datum: T, index: number) => number): Pie; + + sort(): (a: T, b: T) => number; + sort(comparator: (a: T, b: T) => number): Pie; + + startAngle(): number | ((data: T[], index: number) => number); + startAngle(angle: number): Pie; + startAngle(angle: (data: T[], index: number) => number): Pie; + + endAngle(): number | ((data: T[], index: number) => number); + endAngle(angle: number): Pie; + endAngle(angle: (data: T[], index: number) => number): Pie; + + padAngle(): number | ((data: T[], index: number) => number); + padAngle(angle: number): Pie; + padAngle(angle: (data: T[], index: number) => number): Pie; + } + + export function stack(): Stack; + export function stack(): Stack; + export function stack(): Stack; + module stack { + interface Value { + x: number; + y: number; + y0?: number; + } + } + + interface Stack { + (layers: Series[], index?: number): Series[]; + + values(): (layer: Series, index: number) => Value[]; + values(accessor: (layer: Series, index: number) => Value[]): Stack; + + offset(): (data: Array<[number, number]>) => number[]; + offset(offset: "silhouette"): Stack; + offset(offset: "wiggle"): Stack; + offset(offset: "expand"): Stack; + offset(offset: "zero"): Stack; + offset(offset: string): Stack; + offset(offset: (data: Array<[number, number]>) => number[]): Stack; + + order(): (data: Array<[number, number]>) => number[]; + order(order: "inside-out"): Stack; + order(order: "reverse"): Stack; + order(order: "default"): Stack; + order(order: string): Stack; + order(order: (data: Array<[number, number]>) => number[]): Stack; + + x(): (value: Value, index: number) => number; + x(accessor: (value: Value, index: number) => number): Stack; + + y(): (value: Value, index: number) => number; + y(accesor: (value: Value, index: number) => number): Stack; + + out(): (value: Value, y0: number, y: number) => void; + out(setter: (value: Value, y0: number, y: number) => void): Stack; + } + + export function tree(): Tree; + export function tree(): Tree; + + module tree { + interface Link { + source: T; + target: T; + } + + interface Node { + parent?: Node; + children?: Node[]; + depth?: number; + x?: number; + y?: number; + } + } + + interface Tree { + (root: T, index?: number): T[]; + + nodes(root: T, index?: number): T[]; + + links(nodes: T[]): tree.Link[]; + + children(): (datum: T, index: number) => T[]; + children(children: (datum: T, index: number) => T[]): Tree; + + separation(): (a: T, b: T) => number; + separation(separation: (a: T, b: T) => number): Tree; + + size(): [number, number]; + size(size: [number, number]): Tree; + + nodeSize(): [number, number]; + nodeSize(size: [number, number]): Tree; + + sort(): (a: T, b: T) => number; + sort(comparator: (a: T, b: T) => number): Tree; + + value(): (datum: T, index: number) => number; + value(value: (datum: T, index: number) => number): Tree; + } + + export function treemap(): Treemap; + export function treemap(): Treemap; + + module treemap { + interface Node { + parent?: Node; + children?: Node[]; + value?: number; + depth?: number; + x?: number; + y?: number; + dx?: number; + dy?: number; + } + + interface Link { + source: T; + target: T; + } + + type Padding = number | [number, number, number, number]; + } + + interface Treemap { + (root: T, index?: number): T[]; + + nodes(root: T, index?: number): T[]; + + links(nodes: T[]): treemap.Link[]; + + children(): (node: T, depth: number) => T[]; + children(children: (node: T, depth: number) => T[]): Treemap; + + sort(): (a: T, b: T) => number; + sort(comparator: (a: T, b: T) => number): Treemap; + + value(): (node: T, index: number) => number; + value(value: (node: T, index: number) => number): Treemap; + + size(): [number, number]; + size(size: [number, number]): Treemap; + + padding(): (node: T, depth: number) => treemap.Padding; + padding(padding: treemap.Padding): Treemap; + padding(padding: (node: T, depth: number) => treemap.Padding): Treemap; + + round(): boolean; + round(round: boolean): Treemap; + + sticky(): boolean; + sticky(sticky: boolean): boolean; + + mode(): string; + mode(mode: "squarify"): Treemap; + mode(mode: "slice"): Treemap; + mode(mode: "dice"): Treemap; + mode(mode: "slice-dice"): Treemap; + mode(mode: string): Treemap; + + ratio(): number; + ratio(ratio: number): Treemap; + } + } + + module geom { + export function voronoi(): Voronoi<[number, number]>; + export function voronoi(): Voronoi; + + module voronoi { + interface Link { + source: T; + target: T; + } + } + + interface Voronoi { + (data: T[]): Array<[number, number]>; + + x(): (vertex: T) => number; + x(x: (vertex: T) => number): Voronoi; + + y(): (vertex: T) => number; + y(y: (vertex: T) => number): Voronoi; + + clipExtent(): [[number, number], [number, number]]; + clipExtent(extent: [[number, number], [number, number]]): Voronoi; + + links(data: T[]): voronoi.Link[]; + + triangles(data: T[]): Array<[T, T, T]>; + } + + /** + * @deprecated use d3.geom.voronoi().triangles() instead + */ + export function delaunay(vertices: Array<[number, number]>): Array<[[number, number], [number, number], [number, number]]>; + + export function quadtree(): Quadtree<[number, number]>; + export function quadtree(): Quadtree; + + module quadtree { + interface Node { + nodes: [Node, Node, Node, Node]; + leaf: boolean; + point: T; + x: number; + y: number; + } + + interface Quadtree extends Node { + add(point: T): void; + visit(callback: (node: Node, x1: number, y1: number, x2: number, y2: number) => boolean | void): void; + find(point: [number, number]): T; + } + } + + interface Quadtree { + (points: T[]): quadtree.Quadtree; + + x(): (datum: T, index: number) => number; + x(x: number): Quadtree; + x(x: (datum: T, index: number) => number): Quadtree; + + y(): (datum: T, index: number) => number; + y(y: number): Quadtree; + y(y: (datum: T, index: number) => number): Quadtree; + + extent(): [[number, number], [number, number]]; + extent(extent: [[number, number], [number, number]]): Quadtree; + } + + export function hull(vertices: Array<[number, number]>): Array<[number, number]>; + export function hull(): Hull<[number, number]>; + export function hull(): Hull; + + interface Hull { + (vertices: T[]): Array<[number, number]>; + + x(): (datum: T) => number; + x(x: (datum: T) => number): Hull; + + y(): (datum: T) => number; + y(y: (datum: T) => number): Hull; + } + + export function polygon(vertices: Array<[number, number]>): Polygon; + + interface Polygon { + area(): number; + + centroid(): [number, number]; + + clip(subject: Array<[number, number]>): Array<[number, number]>; + } + } +} + +// we need this to exist +interface TouchList { } + +declare module 'd3' { + export = d3; +} \ No newline at end of file diff --git a/datejs/datejs-tests.ts b/datejs/datejs-tests.ts index 9cb5eabbc..0ed60d2d3 100644 --- a/datejs/datejs-tests.ts +++ b/datejs/datejs-tests.ts @@ -2,19 +2,16 @@ /// function tests() { - // TypeScript alias - var DateJS: IDateJSStatic = Date; - - // What date is next thursday? - DateJS.today().next().thursday(); + // What date is next thursday? + Date.today().next().thursday(); // Add 3 days to Today - DateJS.today().add(3).days(); + Date.today().add(3).days(); // Is today Friday? - DateJS.today().is().friday(); + Date.today().is().friday(); - var is = DateJS.today().is(); + var is = Date.today().is(); // Number fun (3).days().ago(); @@ -24,22 +21,22 @@ function tests() { n.months().fromNow(); // Set to 8:30 AM on the 15th day of the month - DateJS.today().set({ day: 15, hour: 8, minute: 30 }); + Date.today().set({ day: 15, hour: 8, minute: 30 }); - DateJS.today().is().january(); - DateJS.today().is().november(); - DateJS.today().add(1).day().is().saturday(); + Date.today().is().january(); + Date.today().is().november(); + Date.today().add(1).day().is().saturday(); // Convert text into Date - DateJS.parse('today'); - DateJS.parse('t + 5 d'); // today + 5 days - DateJS.parse('next thursday'); - DateJS.parse('February 20th 1973'); - DateJS.parse('Thu, 1 July 2004 22:30:00'); + Date.parse('today'); + Date.parse('t + 5 d'); // today + 5 days + Date.parse('next thursday'); + Date.parse('February 20th 1973'); + Date.parse('Thu, 1 July 2004 22:30:00'); - var future: IDateJS = DateJS.today().add(2).months(); - var someDate: IDateJS = DateJS.today().next().april().add(2).days(); + var future: IDateJS = Date.today().add(2).months(); + var someDate: IDateJS = Date.today().next().april().add(2).days(); someDate.same().week(future); // true|false; someDate.same().day(); // true|false; - DateJS.today().toObject().day; + Date.today().toObject().day; } \ No newline at end of file diff --git a/datejs/datejs.d.ts b/datejs/datejs.d.ts index 5c4034bc5..c0b7ad510 100644 --- a/datejs/datejs.d.ts +++ b/datejs/datejs.d.ts @@ -1,8 +1,11 @@ -// Type definitions for DateJS +// Type definitions for DateJS // Project: http://www.datejs.com/ // Definitions by: David Khristepher Santos // Definitions: https://github.com/borisyankov/DefinitelyTyped +//NOTE: This definition file is for the library located at http://datejs.googlecode.com/svn/ and documented at https://code.google.com/p/datejs/wiki/APIDocumentation +//That version of the library is more recent than the one provided at https://code.google.com/p/datejs/downloads/list, which has a slightly different API + /** Defines a structure to be used in the add and set instance methods */ interface IDateJSLiteral { milliseconds: number; @@ -15,13 +18,13 @@ interface IDateJSLiteral { } /** DateJS Public Static Methods */ -interface IDateJSStatic extends IDateJS { +interface DateConstructor { /** Gets a date that is set to the current date. The time is set to the start of the day (00:00 or 12:00 AM) */ - today(): IDateJS; + today(): Date; /** Compares the first date to the second date and returns an number indication of their relative values. -1 = this is lessthan date. 0 = values are equal. 1 = this is greaterthan date. */ - compare(date1: IDateJS, date2: IDateJS): number; + compare(date1: Date, date2: Date): number; /** Compares the first Date object to the second Date object and returns true if they are equal. */ - equals(date1: IDateJS, date2?: IDateJS): boolean; + equals(date1: Date, date2?: Date): boolean; /** Gets the day number (0-6) if given a culture-specific string which is a valid full or abbreviated day name. */ getDayNumberFromName(dayName: string): number; /** Gets the month number (0-11) if given a culture-specific string which is a valid full or abbreviated month name. */ @@ -35,11 +38,11 @@ interface IDateJSStatic extends IDateJS { /** Gets the timezone offset if given a culture-specific string which is a valid full or abbreviated timezone name and a boolean indicating whether daylight savings time is in effect. */ getTimezoneOffset(timezoneAbbreviation?: string, isDayLightSavingsTime?: boolean): number; /** Converts the specified string value into its JavaScript Date equivalent using culture-specific format information. */ - parse(dateString: string): IDateJS; + parse(dateString: string): Date; /** Converts the specified string value into its JavaScript Date equivalent using the specified format. The format of the string value must match one of the supplied formats exactly. */ - parseExact(dateString: string, formatString: string): IDateJS; + parseExact(dateString: string, formatString: string): Date; /** Converts the specified string value into its JavaScript Date equivalent using the specified formats (array). The format of the string value must match one of the supplied formats exactly. */ - parseExact(dateString: string, formatArray: string[]): IDateJS; + parseExact(dateString: string, formatArray: string[]): Date; /** Validates the number is within an acceptable range for the days in a month [0-MaxDaysInMonth]. */ validateDay(day: number, fullYear: number, monthNumber: number): boolean; /** Validates the number is within an acceptable range for hours[0 - 23].Returns true if within range, otherwise false. */ @@ -57,45 +60,45 @@ interface IDateJSStatic extends IDateJS { } /** DateJS Public Instance Methods */ -interface IDateJS extends Date { +interface Date { /** Adds(or subtracts) to the value of the year, month, day, hour, minute, second, millisecond of the date instance using given configuration object. Positive and Negative values allowed. */ - add(config?: IDateJSLiteral): IDateJS; + add(config?: IDateJSLiteral): Date; /** Adds the specified number of milliseconds to this instance. */ - addMilliseconds(milliseconds: number): IDateJS; + addMilliseconds(milliseconds: number): Date; /** Adds the specified number of seconds to this instance given the number of seconds to add.The number can be positive or negative. */ - addSeconds(seconds: number): IDateJS; + addSeconds(seconds: number): Date; /** Adds the specified number of minutes to this instance given the number of minutes to add.The number can be positive or negative. */ - addMinutes(minutes: number): IDateJS; + addMinutes(minutes: number): Date; /** Adds the specified number of hours to this instance given the number of hours to add.The number can be positive or negative. */ - addHours(hours: number): IDateJS; + addHours(hours: number): Date; /** Adds the specified number of days to this instance.The number can be positive or negative. */ - addDays(days: number): IDateJS; + addDays(days: number): Date; /** Adds the specified number of weeks to this instance given the number of weeks to add.The number can be positive or negative. */ - addWeeks(weeks: number): IDateJS; + addWeeks(weeks: number): Date; /** Adds the specified number of months to this instance given the number of months to add.The number can be positive or negative. */ - addMonths(months: number): IDateJS; + addMonths(months: number): Date; /** Adds the specified number of years to this instance given the number of years to add.The number can be positive or negative. */ - addYears(years: number): IDateJS; + addYears(years: number): Date; /** Resets the time of this Date object to 12:00 AM(00:00), which is the start of the day. */ - clearTime(): IDateJS; + clearTime(): Date; /** Resets the time of this Date object to the current time('now'). */ - setTimeToNow(): IDateJS; + setTimeToNow(): Date; /** Returns a new Date object that is an exact date and time copy of the original instance. */ - clone(): IDateJS; + clone(): Date; /** Determines if this instance is between a range of two dates or equal to either the start or end dates. */ - between(startDate: IDateJS, endDate: IDateJS): boolean; + between(startDate: Date, endDate: Date): boolean; /** Compares this instance to a Date object and returns an number indication of their relative values. -1 = this is lessthan date. 0 = values are equal. 1 = this is greaterthan date. */ - compareTo(date: IDateJS): number; + compareTo(date: Date): number; /** Compares this instance to another Date object and returns true if they are equal, otherwise false. */ - equals(date: IDateJS): boolean; + equals(date: Date): boolean; /** Determines if this date occurs after the date to compare to. */ - isAfter(date: IDateJS): boolean; + isAfter(date: Date): boolean; /** Determines if this date occurs before the date to compare to. */ - isBefore(date: IDateJS): boolean; + isBefore(date: Date): boolean; /** Determines if the current Date instance occurs on the same Date as the supplied 'date'. */ - isToday(date: IDateJS): boolean; + isToday(date: Date): boolean; /** Returns the number of milliseconds between this date and date. */ - getElapsed(date: IDateJS): number; + getElapsed(date: Date): number; /** Get the Ordinal day (numeric day number) of the year, adjusted for leap year. Returns 1 through 365 (366 in leap years) */ getOrdinalNumber(): number; /** Get the timezone abbreviation of the current date. */ @@ -107,30 +110,35 @@ interface IDateJS extends Date { /** Get the ISO 8601 week number. Week one ("01") is the week which contains the first Thursday of the year. Monday is considered the first day of the week. */ getISOWeek(): string; /** Moves the date to Monday of the week set. Week one (1) is the week which contains the first Thursday of the year. */ - setWeek(week: number): IDateJS; + setWeek(week: number): Date; /** Indicates whether Daylight Saving Time is observed in the current time zone. */ hasDaylightSavingTime(): boolean; /** Indicates whether this Date instance is within the Daylight Saving Time range for the current time zone. */ isDaylightSavingTime(): boolean; - /** Move to the next or previous dayOfWeek. Whether to move into the future (+1) or past(-1) is controlled by the optional direction parameter. */ - moveToDayOfWeek(dayOfWeek: number, direction: number): IDateJS; + /** Move to the next or previous dayOfWeek. Whether to move into the future (+1) or past(-1) is controlled by the optional direction parameter. */ + moveToDayOfWeek(dayOfWeek: number, direction: number): Date; /** Moves the date to the first day of the month. */ - moveToFirstDayOfMonth(): IDateJS; + moveToFirstDayOfMonth(): Date; /** Moves the date to the last day of the month. */ - moveToLastDayOfMonth(): IDateJS; + moveToLastDayOfMonth(): Date; /** Move to the next or previous month.Whether to move into the future(+1) or past(-1) is controlled by the optional direction parameter. */ - moveToMonth(month: number, direction: number): IDateJS; + moveToMonth(month: number, direction: number): Date; /** Moves the date to the next nth occurrence of the dayOfWeek starting from the beginning of the month. The number (-1) is a magic number and will return the last occurrence of the dayOfWeek in the month. */ - moveToNthOccurrence(dayOfWeek: number, occurrence: number): IDateJS; + moveToNthOccurrence(dayOfWeek: number, occurrence: number): Date; /** Set the value of year, month, day, hour, minute, second, millisecond of date instance using given configuration object. */ - set(config: IDateJSLiteral): IDateJS; + set(config: IDateJSLiteral): Date; /** Set the timezone for the current date using a culture - specific timezone abbreviation("PST").Note that in most JavaScript implementations, this will appear to change the time since the timezone is always based on the locale. */ - setTimezone(timezoneAbbreviation: string): IDateJS; + setTimezone(timezoneAbbreviation: string): Date; /** Set the timezone for the current date using an offset(-0700).Note that in most JavaScript implementations, this will appear to change the time since the timezone is always based on the locale. */ - setTimezoneOffset(timezoneOffset: number): IDateJS; + setTimezoneOffset(timezoneOffset: number): Date; /** Converts the current date instance into a string with an ISO 8601 format.The date is converted to it's UTC value. As per the ISO 8601 specification, the string will be wrapped with double quotation marks ("). */ toISOString(): string; /** Converts the value of the current Date object to its equivalent string representation.Use format argument to specify format(optional).See FormatSpecifiers for more info. */ toString(format?: string): string; } + +//NOTE: IDateJSStatic and IDateJS are provided here solely for backwards compatability with previous versions of this particular definition file (datejs.d.ts.) +//DO NOT use them in new code (and it is strongly suggested you remove their use in any existing code); simply use the Javascript Date class instead. +interface IDateJS extends Date { } +interface IDateJSStatic extends DateConstructor { } \ No newline at end of file diff --git a/datejs/sugarpak.d.ts b/datejs/sugarpak.d.ts index b52e6cf31..3a30d7f6c 100644 --- a/datejs/sugarpak.d.ts +++ b/datejs/sugarpak.d.ts @@ -1,4 +1,4 @@ -// Type definitions for DateJS - SugarPak Extensions +// Type definitions for DateJS - SugarPak Extensions // Project: http://www.datejs.com/ // Definitions by: David Khristepher Santos // Definitions: https://github.com/borisyankov/DefinitelyTyped @@ -7,67 +7,67 @@ declare module sugarpak { export interface IAddOrientation { - millisecond(): IDateJS; - second(): IDateJS; - minute(): IDateJS; - hour(): IDateJS; - day(): IDateJS; - week(): IDateJS; - month(): IDateJS; - year(): IDateJS; + millisecond(): Date; + second(): Date; + minute(): Date; + hour(): Date; + day(): Date; + week(): Date; + month(): Date; + year(): Date; - milliseconds(): IDateJS; - seconds(): IDateJS; - minutes(): IDateJS; - hours(): IDateJS; - days(): IDateJS; - weeks(): IDateJS; - months(): IDateJS; - years(): IDateJS; + milliseconds(): Date; + seconds(): Date; + minutes(): Date; + hours(): Date; + days(): Date; + weeks(): Date; + months(): Date; + years(): Date; } export interface IOrientation extends IAddOrientation { - monday(): IDateJS; - tuesday(): IDateJS; - wednesday(): IDateJS; - thursday(): IDateJS; - friday(): IDateJS; - saturday(): IDateJS; - sunday(): IDateJS; + monday(): Date; + tuesday(): Date; + wednesday(): Date; + thursday(): Date; + friday(): Date; + saturday(): Date; + sunday(): Date; - mon(): IDateJS; - tue(): IDateJS; - wed(): IDateJS; - thu(): IDateJS; - fri(): IDateJS; - sat(): IDateJS; - sun(): IDateJS; + mon(): Date; + tue(): Date; + wed(): Date; + thu(): Date; + fri(): Date; + sat(): Date; + sun(): Date; - january(): IDateJS; - february(): IDateJS; - march(): IDateJS; - april(): IDateJS; - may(): IDateJS; - june(): IDateJS; - july(): IDateJS; - august(): IDateJS; - september(): IDateJS; - october(): IDateJS; - november(): IDateJS; - december(): IDateJS; + january(): Date; + february(): Date; + march(): Date; + april(): Date; + may(): Date; + june(): Date; + july(): Date; + august(): Date; + september(): Date; + october(): Date; + november(): Date; + december(): Date; - jan(): IDateJS; - feb(): IDateJS; - mar(): IDateJS; - apr(): IDateJS; + jan(): Date; + feb(): Date; + mar(): Date; + apr(): Date; // may - jun(): IDateJS; - jul(): IDateJS; - aug(): IDateJS; - sep(): IDateJS; - oct(): IDateJS; - nov(): IDateJS; - dec(): IDateJS; + jun(): Date; + jul(): Date; + aug(): Date; + sep(): Date; + oct(): Date; + nov(): Date; + dec(): Date; } export interface IPredicate { @@ -116,30 +116,30 @@ declare module sugarpak { weekday(): boolean; - day(date?: IDateJS): boolean; - week(date?: IDateJS): boolean; - month(date?: IDateJS): boolean; - year(date?: IDateJS): boolean; + day(date?: Date): boolean; + week(date?: Date): boolean; + month(date?: Date): boolean; + year(date?: Date): boolean; } export interface IDatePartComparer { - millisecond(date?: IDateJS): boolean; - second(date?: IDateJS): boolean; - minute(date?: IDateJS): boolean; - hour(date?: IDateJS): boolean; - day(date?: IDateJS): boolean; - week(date?: IDateJS): boolean; - month(date?: IDateJS): boolean; - year(date?: IDateJS): boolean; + millisecond(date?: Date): boolean; + second(date?: Date): boolean; + minute(date?: Date): boolean; + hour(date?: Date): boolean; + day(date?: Date): boolean; + week(date?: Date): boolean; + month(date?: Date): boolean; + year(date?: Date): boolean; } export interface IDateElementEvaluator { - ago(): IDateJS; - before(): IDateJS; - fromNow(): IDateJS; - after(): IDateJS; + ago(): Date; + before(): Date; + fromNow(): Date; + after(): Date; } export interface IDateElement { @@ -178,10 +178,10 @@ declare module sugarpak { } -interface IDateJS { +interface Date { add(n: number): sugarpak.IAddOrientation; - at(time: string): IDateJS; - at(time: sugarpak.ITimeLiteral): IDateJS; + at(time: string): Date; + at(time: sugarpak.ITimeLiteral): Date; is(): sugarpak.IPredicate; next(): sugarpak.IOrientation; last(): sugarpak.IOrientation; @@ -199,7 +199,7 @@ interface IDateJS { toObject(): sugarpak.IDateLiteral; } -interface IDateJSStatic { +interface DateConstructor { /** Contains the day-of-week value for Monday */ MONDAY: number; /** Contains the day-of-week value for Tuesday */ @@ -215,57 +215,57 @@ interface IDateJSStatic { /** Contains the day-of-week value for Sunday */ SUNDAY: number; /** Instantiates a DateJS object from a literal */ - fromObject(date: sugarpak.IDateLiteral): IDateJS; + fromObject(date: sugarpak.IDateLiteral): Date; next(): sugarpak.IOrientation; last(): sugarpak.IOrientation; prev(): sugarpak.IOrientation; previous(): sugarpak.IOrientation; - january(): IDateJS; - february(): IDateJS; - march(): IDateJS; - april(): IDateJS; - may(): IDateJS; - june(): IDateJS; - july(): IDateJS; - august(): IDateJS; - september(): IDateJS; - october(): IDateJS; - november(): IDateJS; - december(): IDateJS; + january(): Date; + february(): Date; + march(): Date; + april(): Date; + may(): Date; + june(): Date; + july(): Date; + august(): Date; + september(): Date; + october(): Date; + november(): Date; + december(): Date; - monday(): IDateJS; - tuesday(): IDateJS; - wednesday(): IDateJS; - thursday(): IDateJS; - friday(): IDateJS; - saturday(): IDateJS; - sunday(): IDateJS; + monday(): Date; + tuesday(): Date; + wednesday(): Date; + thursday(): Date; + friday(): Date; + saturday(): Date; + sunday(): Date; - mon(): IDateJS; - tue(): IDateJS; - wed(): IDateJS; - thu(): IDateJS; - fri(): IDateJS; - sat(): IDateJS; - sun(): IDateJS; + mon(): Date; + tue(): Date; + wed(): Date; + thu(): Date; + fri(): Date; + sat(): Date; + sun(): Date; - jan(): IDateJS; - feb(): IDateJS; - mar(): IDateJS; - apr(): IDateJS; + jan(): Date; + feb(): Date; + mar(): Date; + apr(): Date; // may - jun(): IDateJS; - jul(): IDateJS; - aug(): IDateJS; - sep(): IDateJS; - oct(): IDateJS; - nov(): IDateJS; - dec(): IDateJS; + jun(): Date; + jul(): Date; + aug(): Date; + sep(): Date; + oct(): Date; + nov(): Date; + dec(): Date; } interface Number extends sugarpak.IDateElement { - // extend the Number type with all the IDateJS goodness + // extend the Number type with all the Date goodness } \ No newline at end of file diff --git a/decimal.js/decimal.js-tests.ts b/decimal.js/decimal.js-tests.ts new file mode 100644 index 000000000..b151380d5 --- /dev/null +++ b/decimal.js/decimal.js-tests.ts @@ -0,0 +1,401 @@ +/// +var x = new Decimal(9) +var y = new Decimal(x) + +Decimal(435.345) + +new Decimal('5032485723458348569331745.33434346346912144534543') +new Decimal('4.321e+4') +new Decimal('-735.0918e-430') +new Decimal('5.6700000') +new Decimal(Infinity) +new Decimal(NaN) +new Decimal('.5') +new Decimal('+2') +new Decimal(-10110100.1, 2) +new Decimal('123412421.234324', 5) +new Decimal('ff.8', 16) + +Decimal.config({ precision: 5 }) +new Decimal(1.23456789) +new Decimal(1.23456789, 10) + + +Decimal.config({ + precision: 20, + rounding: 4, + toExpNeg: -7, + toExpPos: 21, + minE: -9e15, + maxE: 9e15, + errors: true, + crypto: false, + modulo: 1, + format: { + decimalSeparator: '.', + groupSeparator: ',', + groupSize: 3, + secondaryGroupSize: 0, + fractionGroupSeparator: '\xA0', + fractionGroupSize: 0 + } +}); + +Decimal.config({ + format: { + + decimalSeparator: '.', + + groupSeparator: ',', + + groupSize: 3, + + secondaryGroupSize: 0, + + fractionGroupSeparator: ' ', + + fractionGroupSize: 0 + } +}); +Decimal.config({ rounding: Decimal.ROUND_CEIL }) +Decimal.config({ rounding: 2 }) +Decimal.rounding + +x = new Decimal(1.3) +x.ceil() +y = new Decimal(-1.8) +y.ceil() + +x.comparedTo(y) +x.comparedTo(x.minus(1)) +y.cmp(NaN) +y.cmp('110', 2) + +x.decimalPlaces() +y.dp() + +x.dividedBy(y) +x.div(5) +x.div(47, 16) + +x.dividedToIntegerBy(y) +x.divToInt(0.7) +x.divToInt('0.f', 16) + +x.equals('1e-324') +new Decimal(-0).eq(x) +new Decimal(255).eq('ff', 16) + +y = new Decimal(NaN) +y.equals(NaN) + +x = new Decimal(1) +x.exponential() +y = new Decimal(2) +y.exp() + +x = new Decimal(1.8) +x.floor() +y = new Decimal(-1.3) +y.floor() + +x.greaterThan(Decimal(0.3).minus(0.2)) +new Decimal(0).gt(x) +new Decimal(11, 3).gt(11.1, 2) + + +x = new Decimal(0.3).minus(0.2) +x.greaterThanOrEqualTo(0.1) +new Decimal(1).gte(x) +new Decimal(10, 18).gte('i', 36) + +x = new Decimal(1) +x.isFinite() +y = new Decimal(Infinity) +y.isFinite() + +x = new Decimal(1) +x.isInteger() +y = new Decimal(123.456) +y.isInt() + +x = new Decimal(NaN) +x.isNaN() +y = new Decimal('Infinity') +y.isNaN() + +x = new Decimal(-0) +x.isNegative() +y = new Decimal(2) +y.isNeg + +x = new Decimal(-0) +x.isZero() && x.isNeg() +y = new Decimal(Infinity) +y.isZero() + +x.lessThan(0.1) +new Decimal(0).lt(x) +new Decimal(11.1, 2).lt(11, 3) + +x.lessThan(0.1) +new Decimal(0).lt(x) +new Decimal(11.1, 2).lt(11, 3) + +x = new Decimal(0.1) +x.lessThanOrEqualTo(Decimal(0.3).minus(0.2)) +new Decimal(-1).lte(x) +new Decimal(10, 18).lte('i', 36) + +x = new Decimal(1000) +x.logarithm() +y = new Decimal(256) +y.log(2) + +x = new Decimal(0.3) +x.minus(0.1) +x.minus(0.6, 20) + +x = new Decimal(1) +x.modulo(0.9) + +y = new Decimal(33) +y.mod('a', 33) + +x = new Decimal(8) +y = new Decimal(-3) +Decimal.modulo = 1 +x.mod(y) +Decimal.modulo = 3 +x.mod(y) + +x = new Decimal(10) +x.naturalLogarithm() +y = new Decimal('1.23e+30') +y.ln() + +x = new Decimal(1.8) +x.negated() +y = new Decimal(-1.3) +y.neg() + +x = new Decimal(0.1) +y = x.plus(0.2) +new Decimal(0.7).plus(x).plus(y) +x.plus('0.1', 8) + +x = new Decimal(1.234) +x.precision() +y = new Decimal(987000) +y.sd() +y.sd(true) + +Decimal.config({ rounding: 4 }) +x.round() + +Decimal.rounding = Decimal.ROUND_DOWN +x.round() +x + +x = new Decimal(16) +x.squareRoot() +y = new Decimal(3) +y.sqrt() +y.sqrt().eq(y.pow(0.5)) + +x = new Decimal(0.6) +y = x.times(3) +new Decimal('7e+500').times(y) +x.times('-a', 16) + +x = new Decimal(12.24567) +x.toDecimalPlaces(0) +x.toDecimalPlaces(1, 0) + +y = new Decimal(9876.54321) +y.toDP(3) +y.toDP(1, 0) +y.toDP(1, Decimal.ROUND_DOWN) + +y = new Decimal(x) +x.toExponential() +y.toExponential() +x.toExponential(0) +y.toExponential(0) +x.toExponential(1) +y.toExponential(1) +y.toExponential(1, 1) +x.toExponential(3) +y.toExponential(3) + +y = new Decimal(x) +x.toFixed() +y.toFixed() +y.toFixed(0) +x.toFixed(2) +y.toFixed(2) +y.toFixed(2, 1) +x.toFixed(5) +y.toFixed(5) + +Decimal.config({ + format: { + decimalSeparator: '.', + groupSeparator: ',', + groupSize: 3, + secondaryGroupSize: 0, + fractionGroupSeparator: ' ', + fractionGroupSize: 0 + } +}); + +x = new Decimal('123456789.123456789') +x.toFormat() +x.toFormat(1) + + +Decimal.format.groupSeparator = ' '; +Decimal.format.fractionGroupSize = 5; +x.toFormat() + + +Decimal.format = { + decimalSeparator: ',', + groupSeparator: '.', + groupSize: 3, + secondaryGroupSize: 2 +} + +x.toFormat() + +x.toFraction() + +var pi = new Decimal('3.14159265358') +pi.toFraction() +pi.toFraction(100000) +pi.toFraction(10000) +pi.toFraction(100) +pi.toFraction(10) +pi.toFraction(1) + + + +x = new Decimal('177.7e+457') +y = new Decimal(235.4325) +var z = new Decimal('0.0098074') + +// Serialize an array of three Decimals +var str = JSON.stringify([x, y, z]) +// "["1.777e+459","235.4325","0.0098074"]" + +// Return an array of three Decimals +JSON.parse(str, function(key, val) { + return key === '' ? val : new Decimal(val) +}) + +x = new Decimal(1.39) +x.toNearest(0.25) + +y = new Decimal(0.75) +y.toNearest(0.5, 0) +y.toNearest(0.5, 1) + +x = new Decimal(456.789) +x.toNumber() + +y = new Decimal('45987349857634085409857349856430985') +y.toNumber() + +z = new Decimal(-0) +1 / +z +1 / z.toNumber() + +Math.pow(0.7, 2) +x = new Decimal(0.7) +x.toPower(2) +new Decimal(3).pow(-2) + +new Decimal(1217652.23).pow('98765.489305603941') +y = new Decimal(x) +x.toPrecision() +y.toPrecision() +x.toPrecision(1) +y.toPrecision(1) +y.toPrecision(2, 0) +y.toPrecision(2, 1) +x.toPrecision(5) +y.toPrecision(5) + +Decimal.config({ precision: 5, rounding: 4 }) +x = new Decimal(9876.54321) + +x.toSignificantDigits() +x.toSignificantDigits(6) +x.toSignificantDigits(6, Decimal.ROUND_UP) +x.toSD(2) +x.toSD(2, 1) + +x = new Decimal(750000) +x.toString() +Decimal.config({ toExpPos: 5 }) +x.toString() + +y = new Decimal(362.875) +y.toString(2) +y.toString(9) +y.toString(32) + +Decimal.config({ precision: 4 }); +z = new Decimal('1.23456789') +z.toString() +z.toString(10) + +x = new Decimal(123.456) +x.truncated() +y = new Decimal(-12.3) +y.trunc() + +x = new Decimal('1.777e+457') +x.valueOf() + +x = Decimal.exp(3) +y = new Decimal(3).exp() +x.equals(y) + +x = Decimal.ln(4.321) +y = new Decimal(4.321).ln() +x.equals(y) + +x = Decimal.log(100, 2.5) +y = new Decimal(100).log(2.5) +x.equals(y) + +x = new Decimal('3257869345.0378653') +Decimal.max(4e9, x, '123456789.9') + +var arr = [12, '13', new Decimal(14)] +Decimal.max(arr) + +x = new Decimal('3257869345.0378653') +Decimal.min(4e9, x, '123456789.9') + +arr = [2, new Decimal(-14), '-15.9999', -12] +Decimal.min(arr) + +x = new Decimal(2) +var D = Decimal.noConflict() +Decimal +y = new D(3) + +x = Decimal.pow(3257.4, 17.01) +y = new Decimal(3257.4).pow(17.01) +x.equals(y) + +Decimal.config({ precision: 10 }) +Decimal.random() + +Decimal.random(20) + +x = Decimal.sqrt('987654321.123456789') +y = new Decimal('987654321.123456789').sqrt() +x.equals(y) diff --git a/decimal.js/decimal.js.d.ts b/decimal.js/decimal.js.d.ts new file mode 100644 index 000000000..da2489a5f --- /dev/null +++ b/decimal.js/decimal.js.d.ts @@ -0,0 +1,765 @@ +// Type definitions for decimal.js +// Project: http://mikemcl.github.io/decimal.js +// Definitions by: Joseph Rossi +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare var Decimal: decimal.IDecimalStatic; + +// Support AMD require +declare module 'decimal' { + export = Decimal; +} + +declare module decimal { + + enum RoundingMode { + /** + * Rounds away from zero + */ + ROUND_UP = 0, + + /** + * Rounds towards zero + */ + ROUND_DOWN = 1, + + /** + * Rounds towards Infinity + */ + ROUND_CEIL = 2, + + /** + * Rounds towards -Infinity + */ + ROUND_FLOOR = 3, + + /** + * Rounds towards nearest neighbour. + * If equidistant, rounds away from zero + */ + ROUND_HALF_UP = 4, + + /** + * Rounds towards nearest neighbour. + * If equidistant, rounds towards zero + */ + ROUND_HALF_DOWN = 5, + + /** + * Rounds towards nearest neighbour. + * If equidistant, rounds towards even neighbour + */ + ROUND_HALF_EVEN = 6, + + /** + * Rounds towards nearest neighbour. + * If equidistant, rounds towards Infinity + */ + ROUND_HALF_CEIL = 7, + + /** + * Rounds towards nearest neighbour. + * If equidistant, rounds towards -Infinity + */ + ROUND_HALF_FLOOR = 8, + + /** + * Not a rounding mode, see modulo + */ + EUCLID = 9, + } + + interface IFormatConfig { + decimalSeparator?: string; + groupSeparator?: string; + groupSize?: number; + secondaryGroupSize?: number; + fractionGroupSeparator?: string; + fractionGroupSize?: number; + } + + interface IDecimalConfig { + /** + * number: integer, 1 to 1e+9 inclusive + * Default value: 20 + * + * The maximum number of significant digits of the result of a calculation or base conversion. + * + * All methods which return a Decimal will round the return value to precision significant digits except absoluteValue, ceil, floor, negated, round, toDecimalPlaces, toNearest and truncated. + * + * A Decimal constructor will also not round to precision unless a base is specified. + */ + precision?: number; + + /** + * number: integer, 0 to 8 inclusive + * Default value: 4 (ROUND_HALF_UP) + * + * The default rounding mode used when rounding the result of a calculation or base conversion to precision significant digits, and when rounding the return value of the round, toDecimalPlaces, toExponential, toFixed, toFormat, toNearest, toPrecision and toSignificantDigits methods. + * + * The rounding modes are available as enumerated properties of the constructor. + */ + rounding?: RoundingMode; + + /** + * number: integer, -9e15 to 0 inclusive + * Default value: -7 + * + * The negative exponent value at and below which toString returns exponential notation. + * @type {[type]} + */ + toExpNeg?: number; + + /** + * number: integer, 0 to 9e15 inclusive + * Default value: 20 + * + * The positive exponent value at and above which toString returns exponential notation. + */ + toExpPos?: number; + + /** + * number: integer, -9e15 to 0 inclusive + * Default value: -9e15 + * + * The negative exponent limit, i.e. the exponent value below which underflow to zero occurs. + * + * If the Decimal to be returned by a calculation would have an exponent lower than minE then its value becomes zero. + * + * JavaScript numbers underflow to zero for exponents below -324. + */ + minE?: number; + + /** + * number: integer, 0 to 9e15 inclusive + * Default value: 9e15 + * + * The positive exponent limit, i.e. the exponent value above which overflow to Infinity occurs. + * + * If the Decimal to be returned by a calculation would have an exponent higher than maxE then its value becomes Infinity. + * + * JavaScript numbers overflow to Infinity for exponents above 308. + */ + maxE?: number; + + /** + * boolean/number: true, false, 1 or 0 + * Default value: true + * + * The value that determines whether Decimal Errors are thrown. If errors is false, this library will not throw errors. + */ + errors?: boolean | number; + + /** + * boolean/number: true, false, 1 or 0 + * Default value: false + * + * The value that determines whether cryptographically-secure pseudo-random number generation is used. + * + * If crypto is truthy then the random method will generate random digits using crypto.getRandomValues in browsers that support it, or crypto.randomBytes if using a version of Node.js that supports it. + * + * If neither function is supported by the host environment or if crypto is falsey then the source of randomness will be Math.random. If the crypto property is set directly (i.e. without using config) to true, then at the time the random method is called, if errors is true, an error will be thrown if the crypto methods are unavailable. + */ + crypto?: boolean | number; + + /** + * number: integer, 0 to 9 inclusive + * Default value: 1 (ROUND_DOWN) + * + * The modulo mode used when calculating the modulus: a mod n. + * + * The quotient, q = a / n, is calculated according to the rounding mode that corresponds to the chosen modulo mode. + * + * The remainder, r, is calculated as: r = a - n * q. + * + * The modes that are most commonly used for the modulus/remainder operation are ROUND_UP, ROUND_DOWN, ROUND_FLOOR, ROUND_HALF_EVEN, and EUCLID. Although the other rounding modes can be used, they may not give useful results. + */ + modulo?: RoundingMode; + + /** + * The format object configures the format of the string returned by the toFormat method. + * + * The example below shows the properties of the format object that are recognised, and their default values. + * + * Unlike setting other properties using config, the values of the properties of the format object will not be checked for validity. The existing format object will simply be replaced by the object that is passed in. Only the toFormat method ever references a Decimal constructor's format object property. + * + * See toFormat for examples of usage, and of setting format properties individually and directly without using config. + */ + format?: IFormatConfig; + } + + interface IDecimalStatic extends IDecimalConfig { + (value: number | string | Decimal, base?: number): Decimal; + + new(value: number | string | Decimal, base?: number): Decimal; + + /** + * Configures the 'global' settings for this particular Decimal constructor. + * + * Returns this Decimal constructor. + */ + config(object: IDecimalConfig): IDecimalStatic; + + /** + * Returns a new independent Decimal constructor with configuration settings as described by object + */ + constructor(object: IDecimalConfig): IDecimalStatic; + + /** + * Returns a new Decimal whose value is the base e (Euler's number, the base of the natural logarithm) exponential of the value of this Decimal, rounded to precision significant digits using rounding mode rounding. + */ + exp(n: number | string | Decimal): Decimal; + + /** + * Returns a new Decimal whose value is the natural logarithm of the value of this Decimal, rounded to precision significant digits using rounding mode rounding. + * + * The natual logarithm is the inverse of the exponential function. + */ + ln(n: number | string | Decimal): Decimal; + + /** + * Returns a new Decimal whose value is the base n logarithm of the value of this Decimal, rounded to precision significant digits using rounding mode rounding. + * + * If n is null or undefined, then the base 10 logarithm of the value of this Decimal will be returned. + */ + log(n: number | string | Decimal, base?: number): Decimal; + + /** + * Returns a new Decimal whose value is the maximum of arg1, arg2,... . + */ + max(...args: any[]): Decimal; + + /** + * Returns a new Decimal whose value is the minimum of arg1, arg2,... . + */ + min(...args: any[]): Decimal; + + /** + * Reverts the Decimal variable to the value it had before this library was loaded and returns a reference to the original Decimal constructor so it can be assigned to a variable with a different name. + */ + noConflict(): IDecimalStatic; + + /** + * Returns a new Decimal whose value is the value of this Decimal raised to the power n, rounded to precision significant digits using rounding mode rounding. + * + * The performance of this method degrades exponentially with increasing digits. For non-integer exponents in particular, the performance of this method may not be adequate. + */ + pow(base: number | string | Decimal, exponent: number | string | Decimal): Decimal; + + /** + * Returns a new Decimal with a pseudo-random value equal to or greater than 0 and less than 1. The return value will have dp decimal places (or less if trailing zeros are produced). If dp is omitted then the number of decimal places will default to the current precision setting. + * + * Depending on the value of a Decimal constructor's crypto property and the support for the crypto object in the host environment, the random digits of the return value are generated by either Math.random (fastest), crypto.getRandomValues (Web Cryptography API in recent browsers) or crypto.randomBytes (Node.js). + * + * If crypto is true, i.e. one of the crypto methods is to be used, the value of a returned Decimal should be cryptographically-secure and statistically indistinguishable from a random value. + */ + random(dp?: number): Decimal; + + /** + * The return value will be correctly rounded, i.e. rounded as if the result was first calculated to an infinite number of correct digits before rounding. + * + * This method is much faster than using the toPower method with an exponent of 0.5. + */ + sqrt(arg: number | string | Decimal): Decimal; + + /** + * A Decimal instance with value one. + */ + ONE: number; + + /** + * Rounds away from zero + */ + ROUND_UP: number; + + /** + * Rounds towards zero + */ + ROUND_DOWN: number; + + /** + * Rounds towards Infinity + */ + ROUND_CEIL: number; + + /** + * Rounds towards -Infinity + */ + ROUND_FLOOR: number; + + /** + * Rounds towards nearest neighbour. + * If equidistant, rounds away from zero + */ + ROUND_HALF_UP: number; + + /** + * Rounds towards nearest neighbour. + * If equidistant, rounds towards zero + */ + ROUND_HALF_DOWN: number; + + /** + * Rounds towards nearest neighbour. + * If equidistant, rounds towards even neighbour + */ + ROUND_HALF_EVEN: number; + + /** + * Rounds towards nearest neighbour. + * If equidistant, rounds towards Infinity + */ + ROUND_HALF_CEIL: number; + + /** + * Rounds towards nearest neighbour. + * If equidistant, rounds towards -Infinity + */ + ROUND_HALF_FLOOR: number; + + /** + * Not a rounding mode, see modulo + */ + EUCLID: number; + } + + interface Decimal { + + /** + * Returns a new Decimal whose value is the absolute value, i.e. the magnitude, of the value of this Decimal. + * + * The return value is not rounded. + */ + absoluteValue(): Decimal; + + /** + * Returns a new Decimal whose value is the absolute value, i.e. the magnitude, of the value of this Decimal. + * + * The return value is not rounded. + */ + abs(): Decimal; + + /** + * Returns a new Decimal whose value is the value of this Decimal rounded to a whole number in the direction of positive Infinity. + * + * The return value is not rounded to precision. + */ + ceil(): Decimal; + + /** + * @return 1, -1, 0, or null + * 1 If the value of this Decimal is greater than the + * value of n + * -1 If the value of this Decimal is less than the value + * of n + * 0 If this Decimal and n have the same value + * null If the value of either this Decimal or n is NaN + */ + comparedTo(n: number | string | Decimal, base?: number): number; + + /** + * Returns 1, -1, 0, or null + * 1 If the value of this Decimal is greater than the value + * of n + * -1 If the value of this Decimal is less than the value + * of n + * 0 If this Decimal and n have the same value + * null If the value of either this Decimal or n is NaN + */ + cmp(n: number | string | Decimal, base?: number): number; + + /** + * Returns the number of decimal places, i.e. the number of digits after the decimal point, of the value of this Decimal. + */ + decimalPlaces(): number; + + /** + * Returns the number of decimal places, i.e. the number of digits after the decimal point, of the value of this Decimal. + */ + dp(): number; + + /** + * Returns a new Decimal whose value is the value of this Decimal divided by n, rounded to precision significant digits using rounding mode rounding. + */ + dividedBy(n: number | string | Decimal, base?: number): Decimal; + + /** + * Returns a new Decimal whose value is the value of this Decimal divided by n, rounded to precision significant digits using rounding mode rounding. + */ + div(n: number | string | Decimal, base?: number): Decimal; + + /** + * Return a new Decimal whose value is the integer part of dividing this Decimal by n, rounded to precision significant digits using rounding mode rounding. + */ + dividedToIntegerBy(n: number | string| Decimal, base?: number): Decimal; + + /** + * Return a new Decimal whose value is the integer part of dividing this Decimal by n, rounded to precision significant digits using rounding mode rounding. + */ + divToInt(n: number | string| Decimal, base?: number): Decimal; + + /** + * Returns true if the value of this Decimal equals the value of n, otherwise returns false. + * + * As with JavaScript, NaN does not equal NaN. + * + * Note: This method uses the cmp method internally. + */ + equals(n: number | string | Decimal, base?: number): boolean; + + /** + * Returns true if the value of this Decimal equals the value of n, otherwise returns false. + * + * As with JavaScript, NaN does not equal NaN. + * + * Note: This method uses the cmp method internally. + */ + eq(n: number | string | Decimal, base?: number): boolean; + + /** + * Returns a new Decimal whose value is the base e (Euler's number, the base of the natural logarithm) exponential of the value of this Decimal, rounded to precision significant digits using rounding mode rounding. + */ + exponential(): Decimal; + + /** + * Returns a new Decimal whose value is the base e (Euler's number, the base of the natural logarithm) exponential of the value of this Decimal, rounded to precision significant digits using rounding mode rounding. + */ + exp(): Decimal; + + /** + * The return value is not rounded to precision. + */ + floor(): Decimal; + + + /** + * Note: This method uses cmp method internally. + */ + greaterThan(n: number | string | Decimal, base?: number): boolean; + + /** + * Note: This method uses cmp method internally. + */ + gt(n: number | string | Decimal, base?: number): boolean; + + /** + * Note: This method uses cmp method internally. + */ + greaterThanOrEqualTo(n: number | string | Decimal, base?: number): boolean; + + /** + * Note: This method uses cmp method internally. + */ + gte(n: number | string | Decimal, base?: number): boolean; + + /** + * The only possible non-finite values of a Decimal are NaN, Infinity and -Infinity. + */ + isFinite(): boolean; + + isInteger(): boolean; + + isInt(): boolean; + + isNaN(): boolean; + + isNegative(): boolean; + + isNeg(): boolean; + + isZero(): boolean; + + /** + * Note: This method uses cmp method internally. + */ + lessThan(n: number | string | Decimal, base?: number): boolean; + + /** + * Note: This method uses cmp method internally. + */ + lt(n: number | string | Decimal, base?: number): boolean; + + /** + * Note: This method uses cmp method internally. + */ + lessThanOrEqualTo(n: number | string | Decimal, base?: number): boolean; + + /** + * Note: This method uses cmp method internally. + */ + lte(n: number | string | Decimal, base?: number): boolean; + + /** + * Returns a new Decimal whose value is the base n logarithm of the value of this Decimal, rounded to precision significant digits using rounding mode rounding. + * + * If n is null or undefined, then the base 10 logarithm of the value of this Decimal will be returned. + */ + logarithm(n?: number | string | Decimal, base?: number): Decimal; + + /** + * Returns a new Decimal whose value is the base n logarithm of the value of this Decimal, rounded to precision significant digits using rounding mode rounding. + * + * If n is null or undefined, then the base 10 logarithm of the value of this Decimal will be returned. + */ + log(n?: number | string | Decimal, base?: number): Decimal; + + /** + * Returns a new Decimal whose value is the value of this Decimal minus n, rounded to precision significant digits using rounding mode rounding. + */ + minus(n: number | string | Decimal, base?: number): Decimal; + + /** + * Returns a new Decimal whose value is the value of this Decimal modulo n, rounded to precision significant digits using rounding mode rounding. + * + * The value returned, and in particular its sign, is dependent on the value of the modulo property of this Decimal's constructor. If it is 1 (default value), the result will have the same sign as this Decimal, and it will match that of Javascript's % operator (within the limits of double precision) and BigDecimal's remainder method. + */ + modulo(n: number | string | Decimal, base?: number): Decimal; + + /** + * Returns a new Decimal whose value is the value of this Decimal modulo n, rounded to precision significant digits using rounding mode rounding. + * + * The value returned, and in particular its sign, is dependent on the value of the modulo property of this Decimal's constructor. If it is 1 (default value), the result will have the same sign as this Decimal, and it will match that of Javascript's % operator (within the limits of double precision) and BigDecimal's remainder method. + */ + mod(n: number | string | Decimal, base?: number): Decimal; + + /** + * Returns a new Decimal whose value is the natural logarithm of the value of this Decimal, rounded to precision significant digits using rounding mode rounding. + * + * The natual logarithm is the inverse of the exponential function. + */ + naturalLogarithm(): Decimal; + + /** + * Returns a new Decimal whose value is the natural logarithm of the value of this Decimal, rounded to precision significant digits using rounding mode rounding. + * + * The natual logarithm is the inverse of the exponential function. + */ + ln(): Decimal; + + /** + * The return value is not rounded. + */ + negated(): Decimal; + + /** + * The return value is not rounded. + */ + neg(): Decimal; + + /** + * Returns a new Decimal whose value is the value of this Decimal plus n, rounded to precision significant digits using rounding mode rounding. + */ + plus(n: number | string | Decimal, base?: number): Decimal; + + /** + * If include_zeros is true or 1 then any trailing zeros of the integer part of a number are counted as significant digits, otherwise they are not. + */ + precision(include_leading_zeros?: boolean | number): number; + + /** + * If include_zeros is true or 1 then any trailing zeros of the integer part of a number are counted as significant digits, otherwise they are not. + */ + sd(include_leading_zeros?: boolean | number): number; + + round(): Decimal; + + /** + * The return value will be correctly rounded, i.e. rounded as if the result was first calculated to an infinite number of correct digits before rounding. + * + * This method is much faster than using the toPower method with an exponent of 0.5. + */ + squareRoot(): Decimal; + + /** + * The return value will be correctly rounded, i.e. rounded as if the result was first calculated to an infinite number of correct digits before rounding. + * + * This method is much faster than using the toPower method with an exponent of 0.5. + */ + sqrt(): Decimal; + + /** + * Returns a new Decimal whose value is the value of this Decimal times n, rounded to precision significant digits using rounding mode rounding. + */ + times(n: number | string | Decimal, base?: number): Decimal; + + /** + * Returns a new Decimal whose value is the value of this Decimal rounded to dp decimal places using rounding mode rm. + * + * If dp is omitted or is null or undefined, the return value will have the same value as this Decimal. + * + * If rm is omitted or is null or undefined, rounding mode rounding is used. + */ + toDecimalPlaces(dp?: number, rm?: RoundingMode): Decimal; + + /** + * Returns a new Decimal whose value is the value of this Decimal rounded to dp decimal places using rounding mode rm. + * + * If dp is omitted or is null or undefined, the return value will have the same value as this Decimal. + * + * If rm is omitted or is null or undefined, rounding mode rounding is used. + */ + toDP(dp?: number, rm?: RoundingMode): Decimal; + + /** + * Returns a string representing the value of this Decimal in exponential notation rounded using rounding mode rm to dp decimal places, i.e with one digit before the decimal point and dp digits after it. + * + * If the value of this Decimal in exponential notation has fewer than dp fraction digits, the return value will be appended with zeros accordingly. + * + * If dp is omitted, or is null or undefined, the number of digits after the decimal point defaults to the minimum number of digits necessary to represent the value exactly. + * + * If rm is omitted or is null or undefined, rounding mode rounding is used. + */ + toExponential(dp?: number, rm?: RoundingMode): string; + + /** + * Returns a string representing the value of this Decimal in normal (fixed-point) notation rounded to dp decimal places using rounding mode rm. + * + * If the value of this Decimal in normal notation has fewer than dp fraction digits , the return value will be appended with zeros accordingly. + * + * Unlike Number.prototype.toFixed, which returns exponential notation if a number is greater or equal to 1021, this method will always return normal notation. + * + * If dp is omitted or is null or undefined, then the return value will be unrounded and in normal notation. This is unlike Number.prototype.toFixed, which returns the value to zero decimal places, but is useful when because of the current toExpNeg or toExpNeg values, toString returns exponential notation + * + * if rm is omitted or is null or undefined, rounding mode rounding is used. + */ + toFixed(dp?: number, rm?: RoundingMode): string; + + /** + * Returns a string representing the value of this Decimal in fixed-point notation rounded to dp decimal places using rounding mode rm (as toFixed), and formatted according to the properties of this Decimal's constructor's format object property. + * + * See the examples below for the properties of the format object, their types and their usage. + * + * If dp is omitted or is null or undefined, then the return value is not rounded to a fixed number of decimal places. + * + * if rm is omitted or is null or undefined, rounding mode rounding is used. + */ + toFormat(dp?: number, rm?: RoundingMode): string; + + /** + * Returns a string array representing the value of this Decimal as a simple fraction with an integer numerator and an integer denominator. The denominator will be a positive non-zero value less than or equal to max_denominator. + * + * If a maximum denominator is not specified, or is null or undefined, the denominator will be the lowest value necessary to represent the number exactly. + */ + toFraction(max_denominator?: number | string | Decimal): string[]; + + toJSON(): string; + + /** + * Returns a new Decimal whose value is the nearest multiple of n to the value of this Decimal. + * + * If the value of this Decimal is equidistant from two multiples of n, the rounding mode rm, or rounding if rm is omitted or is null or undefined, determines the direction of the nearest. + * + * In this context, rounding mode ROUND_HALF_UP is interpreted the same as rounding mode ROUND_UP, and so on. I.e. the rounding is either up, own, to ceil, to floor or to even. + * + * The return value will always have the same sign as this Decimal, unless either this Decimal or n is NaN, in which case the return value will be also be NaN. + * + * The return value is not rounded to precision. + */ + toNearest(n: number | string | Decimal, rm?: RoundingMode): Decimal; + + /** + * Returns the value of this Decimal converted to a number primitive. + * + * Type coercion with, for example, JavaScript's unary plus operator will also work, except that a Decimal with the value minus zero will convert to positive zero. + */ + toNumber(): number; + + /** + * Returns a new Decimal whose value is the value of this Decimal raised to the power n, rounded to precision significant digits using rounding mode rounding. + * + * The performance of this method degrades exponentially with increasing digits. For non-integer exponents in particular, the performance of this method may not be adequate. + */ + toPower(n: number | string | Decimal, base?: number): Decimal; + + /** + * Returns a new Decimal whose value is the value of this Decimal raised to the power n, rounded to precision significant digits using rounding mode rounding. + * + * The performance of this method degrades exponentially with increasing digits. For non-integer exponents in particular, the performance of this method may not be adequate. + */ + pow(n: number | string | Decimal, base?: number): Decimal; + + /** + * Returns a string representing the value of this Decimal rounded to sd significant digits using rounding mode rm. + * + * If sd is less than the number of digits necessary to represent the integer part of the value in normal (fixed-point) notation, then exponential notation is used. + * + * If sd is omitted or is null or undefined, then the return value is the same as toString. + * + * if rm is omitted or is null or undefined, rounding mode rounding is used. + */ + toPrecision(sd?: number, rm?: RoundingMode): string; + + /** + * Returns a new Decimal whose value is the value of this Decimal rounded to sd significant digits using rounding mode rm. + * + * If sd is omitted or is null or undefined, the return value will be rounded to precision significant digits. + * + * if rm is omitted or is null or undefined, rounding mode rounding will be used. + */ + toSignificantDigits(sd?: number, rm?: RoundingMode): Decimal; + + /** + * Returns a new Decimal whose value is the value of this Decimal rounded to sd significant digits using rounding mode rm. + * + * If sd is omitted or is null or undefined, the return value will be rounded to precision significant digits. + * + * if rm is omitted or is null or undefined, rounding mode rounding will be used. + */ + toSD(sd?: number, rm?: RoundingMode): Decimal; + + /** + * base: number: integer, 2 to 64 inclusive + * + * Returns a string representing the value of this Decimal in the specified base, or base 10 if base is omitted or is null or undefined. + * + * For bases above 10, values from 10 to 35 are represented by a-z (as with Number.prototype.toString), 36 to 61 by A-Z, and 62 and 63 by $ and _ respectively. + * + * If a base is specified the value is rounded to precision significant digits using rounding mode rounding. + * + * If a base is not specified and this Decimal has a positive exponent that is equal to or greater than toExpPos, or a negative exponent equal to or less than toExpNeg, then exponential notation is returned. + * + * If base is null or undefined it is ignored. + */ + toString(base?: number): string; + + /** + * Returns a new Decimal whose value is the value of this Decimal truncated to a whole number. + * + * The return value is not rounded to precision. + */ + truncated(): Decimal; + + /** + * Returns a new Decimal whose value is the value of this Decimal truncated to a whole number. + * + * The return value is not rounded to precision. + */ + trunc(): Decimal; + + /** + * As toString, but does not accept a base argument. + */ + valueOf(): string; + + /** + * coefficient + * + * Array of integers, each 0 - 1e7 + */ + c: number[]; + + /** + * exponent + * + * Integer, -9e15 to 9e15 inclusive + */ + e: number; + + /** + * sign + * + * -1 or 1 + */ + s: number; + } +} diff --git a/dexie/dexie-tests.ts b/dexie/dexie-tests.ts new file mode 100644 index 000000000..25deb115d --- /dev/null +++ b/dexie/dexie-tests.ts @@ -0,0 +1,256 @@ +/// + +import Dexie = require("Dexie"); + +module Utils { + + export class Console { + textarea: HTMLTextAreaElement; + + constructor() { + this.textarea = document.createElement('textarea'); + } + + log(txt: string, type?: string) { + if (type) this.textarea.value += type + " "; + this.textarea.value += txt + "\n"; + } + error = function (txt: string) { + this.log(txt, "ERROR!"); + } + } + +} + +module AppDb { + + export class AppDatabase extends Dexie { + + contacts: Dexie.Table; + emails: Dexie.Table; + phones: Dexie.Table; + + constructor() { + + super("MyTypeScriptAppDb"); + + var db = this; + + // + // Define tables and indexes + // + db.version(1).stores({ + contacts: '++id, first, last', + emails: '++id, contactId, type, email', + phones: '++id, contactId, type, phone', + }); + + // Let's physically map Contact class to contacts table. + // This will make it possible to call loadEmailsAndPhones() + // directly on retrieved database objects. + db.contacts.mapToClass(Contact); + } + } + + /* Just for code completion and compilation - defines + * the interface of objects stored in the emails table. + */ + export interface IEmailAddress { + id?: number; + contactId: number; + type: string; + email: string; + } + + /* Just for code completion and compilation - defines + * the interface of objects stored in the phones table. + */ + export interface IPhoneNumber { + id?: number; + contactId: number; + type: string; + phone: string; + } + + /* This is a 'physical' class that is mapped to + * the contacts table. We can have methods on it that + * we could call on retrieved database objects. + */ + export class Contact { + id: number; + first: string; + last: string; + emails: IEmailAddress[]; + phones: IPhoneNumber[]; + + constructor(first: string, last: string, id?: number) { + this.first = first; + this.last = last; + if (id) this.id = id; + } + + loadEmailsAndPhones() : Dexie.Promise { + return Dexie.Promise.all( + db.emails + .where('contactId').equals(this.id) + .toArray(emails => this.emails = emails) + , + db.phones + .where('contactId').equals(this.id) + .toArray(phones => this.phones = phones) + + ).then(() => this); + } + + save() { + return db.transaction('rw', db.contacts, db.emails, db.phones, () => { + Dexie.Promise.all( + // Save existing arrays + Dexie.Promise.all(this.emails.map(email => db.emails.put(email))), + Dexie.Promise.all(this.phones.map(phone => db.phones.put(phone)))) + .then(results => { + // Remove items from DB that is was not saved here: + var emailIds = results[0], // array of resulting primary keys + phoneIds = results[1]; // array of resulting primary keys + + db.emails.where('contactId').equals(this.id) + .and(email => emailIds.indexOf(email.id) === -1) + .delete(); + + db.phones.where('contactId').equals(this.id) + .and(phone => phoneIds.indexOf(phone.id) === -1) + .delete(); + + // At last, save our own properties. + // (Must not do put(this) because we would get + // reduntant emails/phones arrays saved into db) + db.contacts.put( + new Contact(this.first, this.last, this.id)) + .then(id => this.id = id); + }); + }); + } + } + + export var db = new AppDatabase(); + db.open(); +} + + +import Console = Utils.Console; +import db = AppDb.db; + +document.addEventListener('DOMContentLoaded', () => { + + // Initialize our Console widget - it will log browser window. + var console = new Console(); + document.getElementById('consoleArea').appendChild(console.textarea); + + // Test it: + console.log("Hello world!"); + + // Make sure to never miss any unexpected error: + Dexie.Promise.on.error.subscribe(e => { + // Log any uncatched error: + console.error(e); + }); + + // + // Let's clear and re-seed the database: + // + clearDatabase() + .then(seedDatabase) + .then(playALittle_add_phone_to_adam) + .then(printContacts); + + function clearDatabase() { + console.log("Clearing database..."); + return Dexie.Promise.all( + db.contacts.clear(), + db.emails.clear(), + db.phones.clear()); + } + + function seedDatabase() { + console.log("Seeding database with some contacts..."); + return db.transaction('rw', db.contacts, db.emails, db.phones, () => { + // Populate a contact + db.contacts.add(new AppDb.Contact('Arnold', 'Fitzgerald')).then(id => { + // Populate some emails and phone numbers for the contact + db.emails.add({ contactId: id, type: 'home', email: 'arnold@email.com' }); + db.emails.add({ contactId: id, type: 'work', email: 'arnold@abc.com' }); + db.phones.add({ contactId: id, type: 'home', phone: '12345678' }); + db.phones.add({ contactId: id, type: 'work', phone: '987654321' }); + }); + + // ... and another one... + db.contacts.add(new AppDb.Contact('Adam', 'Tensta')).then(id => { + // Populate some emails and phone numbers for the contact + db.emails.add({ contactId: id, type: 'home', email: 'adam@tensta.se' }); + db.phones.add({ contactId: id, type: 'work', phone: '88888888' }); + }); + }); + } + + function playALittle_add_phone_to_adam() { + // Now, just to examplify how to use the save() method as an alternative + // to db.phones.add(), we will add yet another phone number + // to an existing contact and then re-save it: + console.log("Playing a little: adding another phone entry for Adam Tensta..."); + return db.contacts + .where('last').equals('Tensta').first(c => c.loadEmailsAndPhones()) + .then(contact => { + // Also add another phone number to Adam Tensta: + contact.phones.push({ + contactId: contact.id, + type: 'custom', + phone: '112' + }); + contact.save(); + }); + } + + function printContacts() { + + // Now we're gonna list all contacts starting with letter 'A' + // and print them out. + // For each contact, also resolve its collection of + // phone number entries and email addresses by reverse-quering + // the foreign tables. + + // For atomicity and speed, use a single transaction for the + // queries to make: + db.transaction('r', [db.contacts, db.phones, db.emails], () => { + + // Query some contacts + return db.contacts + .where('first').startsWithIgnoreCase('a') + .sortBy('id') + .then(contacts => + + // Resolve array properties 'emails' and 'phones' + // on each and every contact: + Dexie.Promise.all( + contacts.map(contact => + contact.loadEmailsAndPhones())) + ); + + }).then(contacts => { + + // Print result + console.log("Database contains the following contacts:"); + contacts.forEach(contact => { + console.log(contact.id + ". " + contact.first + " " + contact.last); + console.log(" Phone numbers: "); + contact.phones.forEach(phone => { + console.log(" " + phone.phone + "(" + phone.type + ")"); + }); + console.log(" Emails: "); + contact.emails.forEach(email => { + console.log(" " + email.email + "(" + email.type + ")"); + }); + }); + }); + } +}); + diff --git a/dexie/dexie.d.ts b/dexie/dexie.d.ts new file mode 100644 index 000000000..eb6854ce2 --- /dev/null +++ b/dexie/dexie.d.ts @@ -0,0 +1,320 @@ +// Type definitions for Dexie v1.1 +// Project: https://github.com/dfahlander/Dexie.js +// Definitions by: David Fahlander +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +interface Thenable { + then(onFulfilled: (value: R) => Thenable, onRejected: (error: any) => Thenable): Thenable; + then(onFulfilled: (value: R) => Thenable, onRejected?: (error: any) => U): Thenable; + then(onFulfilled: (value: R) => U, onRejected: (error: any) => Thenable): Thenable; + then(onFulfilled?: (value: R) => U, onRejected?: (error: any) => U): Thenable; +} + +declare class Dexie { + constructor(databaseName: string); + + constructor(databaseName: string, options: { addons: Array<(db: Dexie) => void> }); + + name: string; + tables: Dexie.Table[]; + verno: number; + + static addons: Array<(db: Dexie) => void>; + static version: number; + + static getDatabaseNames(): Dexie.Promise>; + + static getDatabaseNames(onFulfilled: (value: Array) => Thenable): Dexie.Promise; + + static getDatabaseNames(onFulfilled: (value: Array) => U): Dexie.Promise; + + static getByKeyPath(obj: Object, keyPath: string): any; + + static setByKeyPath(obj: Object, keyPath: string, value: any): void; + + static delByKeyPath(obj: Object, keyPath: string): void; + + static shallowClone(obj: Object): Object; + + static deepClone(obj: Object): Object; + + version(versionNumber: Number): Dexie.Version + + on: { + (eventName: string, subscriber: () => any): void; + (eventName: string, subscriber: () => any, bSticky: boolean): void; + ready: Dexie.DexieOnReadyEvent; + error: Dexie.DexieErrorEvent; + populate: Dexie.DexieEvent; + blocked: Dexie.DexieEvent; + versionchange: Dexie.DexieVersionChangeEvent; + } + + open(): Dexie.Promise; + + table(tableName: string): Dexie.Table; + + table(tableName: string): Dexie.Table; + + table(tableName: string): Dexie.Table; + + transaction(mode: string, table: Dexie.Table, scope: () => Thenable): Dexie.Promise; + + transaction(mode: string, table: Dexie.Table, table2: Dexie.Table, scope: () => Thenable): Dexie.Promise; + + transaction(mode: string, table: Dexie.Table, table2: Dexie.Table, table3: Dexie.Table, scope: () => Thenable): Dexie.Promise; + + transaction(mode: string, tables: Dexie.Table[], scope: () => Thenable): Dexie.Promise; + + transaction(mode: string, table: Dexie.Table, scope: () => U): Dexie.Promise; + + transaction(mode: string, table: Dexie.Table, table2: Dexie.Table, scope: () => U): Dexie.Promise; + + transaction(mode: string, table: Dexie.Table, table2: Dexie.Table, table3: Dexie.Table, scope: () => U): Dexie.Promise; + + transaction(mode: string, tables: Dexie.Table[], scope: () => U): Dexie.Promise; + + close(): void; + + delete(): Dexie.Promise; + + isOpen(): boolean; + + hasFailed(): boolean; + + backendDB(): IDBDatabase; + + vip(scopeFunction: () => U): U; +} + +declare module Dexie { + + class Promise implements Thenable { + constructor(callback: (resolve: (value?: Thenable) => void, reject: (error?: any) => void) => void); + + constructor(callback: (resolve: (value?: R) => void, reject: (error?: any) => void) => void); + + then(onFulfilled: (value: R) => Thenable, onRejected: (error: any) => Thenable): Promise; + + then(onFulfilled: (value: R) => Thenable, onRejected?: (error: any) => U): Promise; + + then(onFulfilled: (value: R) => U, onRejected: (error: any) => Thenable): Promise; + + then(onFulfilled?: (value: R) => U, onRejected?: (error: any) => U): Promise; + + catch(onRejected: (error: any) => Promise): Promise; + + catch(ExceptionType: Function, onRejected: (error : any) => Promise): Promise; + + catch(errorName: string, onRejected: (error : any) => Promise): Promise; + + finally(onFinally: () => any): Promise; + + onuncatched: () => any; + } + + module Promise { + function resolve(value?: Thenable): Promise; + + function resolve(value?: R): Promise; + + function reject(error: any): Promise; + + function all(promises: Thenable[]): Promise; + + function all(...promises: Thenable[]): Promise; + + function race(promises: Thenable[]): Promise; + + function newPSD(scope: () => R): R; + + var PSD: any; + + var on: { + (eventName: string, subscriber: (...args : any[]) => any): void; + error: DexieErrorEvent; + } + } + + + interface Version { + stores(schema: { [key: string]: string }): Version; + upgrade(fn: (trans: Transaction) => void): Version; + } + + interface Transaction { + active: boolean; + db: Dexie; + mode: string; + idbtrans: IDBTransaction; + tables: { [type: string]: Table }; + storeNames: Array; + on: { + (eventName: string, subscriber: () => any): void; + complete: DexieEvent; + abort: DexieEvent; + error: DexieEvent; + } + abort(): void; + table(tableName: string): Table; + table(tableName: string): Table; + table(tableName: string): Table; + } + + interface DexieEvent { + subscribe(fn: () => any) : void; + unsubscribe(fn: () => any) : void; + fire() : any; + } + + interface DexieErrorEvent { + subscribe(fn: (error: any) => any) : void; + unsubscribe(fn: (error: any) => any) : void; + fire(error: any) : any; + } + + interface DexieVersionChangeEvent { + subscribe(fn: (event: IDBVersionChangeEvent) => any) : void; + unsubscribe(fn: (event: IDBVersionChangeEvent) => any) : void; + fire(event: IDBVersionChangeEvent) : any; + } + + interface DexieOnReadyEvent + { + subscribe(fn: () => any, bSticky: boolean) : void; + unsubscribe(fn: () => any) : void; + fire() : any; + } + + interface Table { + name: string; + schema: TableSchema; + hook: { + (eventName: string, subscriber: () => any): void; + creating: DexieEvent; + reading: DexieEvent; + updating: DexieEvent; + deleting: DexieEvent; + } + + get(key: Key): Promise; + where(index: string): WhereClause; + + filter(fn: (obj: T) => boolean): Collection; + + count(): Promise; + count(onFulfilled: (value: number) => Thenable): Promise; + count(onFulfilled: (value: number) => U): Promise; + + offset(n: number): Collection; + + limit(n: number): Collection; + + each(callback: (obj: T, cursor: IDBCursor) => any): Promise; + + toArray(): Promise>; + toArray(onFulfilled: (value: Array) => Thenable): Promise; + toArray(onFulfilled: (value: Array) => U): Promise; + + toCollection(): Collection; + orderBy(index: string): Collection; + reverse(): Collection; + mapToClass(constructor: Function): Function; + add(item: T, key?: Key): Promise; + update(key: Key, changes: { [keyPath: string]: any }) : Promise; + put(item: T, key?: Key): Promise; + delete(key: Key): Promise; + clear(): Promise; + } + + interface WhereClause { + above(key: number): Collection; + above(key: string): Collection; + above(key: Date): Collection; + above(key: Array): Collection; + aboveOrEqual(key: number): Collection; + aboveOrEqual(key: string): Collection; + aboveOrEqual(key: Date): Collection; + aboveOrEqual(key: Array): Collection; + anyOf(keys: Array): Collection; + anyOf(...keys: any[]): Collection; + below(key: number): Collection; + below(key: string): Collection; + below(key: Date): Collection; + below(key: Array): Collection; + belowOrEqual(key: number): Collection; + belowOrEqual(key: string): Collection; + belowOrEqual(key: Date): Collection; + belowOrEqual(key: Array): Collection; + between(lower: number, upper: number, includeLower?: boolean, includeUpper?: boolean): Collection; + between(lower: string, upper: string, includeLower?: boolean, includeUpper?: boolean): Collection; + between(lower: Date, upper: Date, includeLower?: boolean, includeUpper?: boolean): Collection; + between(lower: Array, upper: Array, includeLower?: boolean, includeUpper?: boolean): Collection; + equals(key: number): Collection; + equals(key: string): Collection; + equals(key: Date): Collection; + equals(key: Array): Collection; + equalsIgnoreCase(key: string): Collection; + startsWith(key: string): Collection; + startsWithIgnoreCase(key: string): Collection; + } + + interface Collection { + and(filter: (x: T) => boolean): Collection; + count(): Promise; + count(onFulfilled: (value: number) => Thenable): Promise; + count(onFulfilled: (value: number) => U): Promise; + distinct(): Collection; + each(callback: (obj: T, cursor: IDBCursor) => any): Promise; + eachKey(callback: (key: Key, cursor: IDBCursor) => any): Promise; + eachUniqueKey(callback: (key: Key, cursor: IDBCursor) => any): Promise; + first(): Promise; + first(onFulfilled: (value: T) => Thenable): Promise; + first(onFulfilled: (value: T) => U): Promise; + keys(): Promise; + keys(onFulfilled: (value: Key[]) => Thenable): Promise; + keys(onFulfilled: (value: Key[]) => U): Promise; + last(): Promise; + last(onFulfilled: (value: T) => Thenable): Promise; + last(onFulfilled: (value: T) => U): Promise; + limit(n: number): Collection; + offset(n: number): Collection; + or(indexOrPrimayKey: string): WhereClause; + reverse(): Collection; + sortBy(keyPath: string): Promise; + sortBy(keyPath: string, onFulfilled: (value: T[]) => Thenable): Promise; + sortBy(keyPath: string, onFulfilled: (value: T[]) => U): Promise; + toArray(): Promise>; + toArray(onFulfilled: (value: Array) => Thenable): Promise; + toArray(onFulfilled: (value: Array) => U): Promise; + uniqueKeys(): Promise; + uniqueKeys(onFulfilled: (value: Key[]) => Thenable): Promise; + uniqueKeys(onFulfilled: (value: Key[]) => U): Promise; + until(filter: (value: T) => boolean, includeStopEntry?: boolean): Collection; + // WriteableCollection: + delete(): Promise; + modify(changes: { [keyPath: string]: any }): Promise; + modify(changeCallback: (obj: T) => void): Promise; + } + + interface TableSchema { + name: string; + primKey: IndexSpec; + indexes: IndexSpec[]; + mappedClass: Function; + } + + interface IndexSpec { + name: string; + keyPath: any; + unique: boolean; + multi: boolean; + auto: boolean; + compound: boolean; + src: string; + } +} + +declare module 'Dexie' { + export = Dexie; +} diff --git a/dojo/dijit.d.ts b/dojo/dijit.d.ts index 33144b9da..0bb2ab67d 100644 --- a/dojo/dijit.d.ts +++ b/dojo/dijit.d.ts @@ -34291,7 +34291,7 @@ declare module dijit { * * @param id */ - byId(id: String): any; + byId(id: String): dijit._WidgetBase; /** * A synthetic clone of array.every acting explicitly on this WidgetSet * @@ -105714,14 +105714,14 @@ declare module dijit { * * @param id */ - byId(id: String): String; + byId(id: String): dijit._WidgetBase; /** * Find a widget by it's id. * If passed a widget then just returns the widget. * * @param id */ - byId(id: dijit._WidgetBase): String; + byId(id: dijit._WidgetBase): dijit._WidgetBase; /** * Returns the widget corresponding to the given DOMNode * @@ -105956,14 +105956,14 @@ declare module dijit { * * @param id */ - byId(id: String): String; + byId(id: String): dijit._WidgetBase; /** * Find a widget by it's id. * If passed a widget then just returns the widget. * * @param id */ - byId(id: dijit._WidgetBase): String; + byId(id: dijit._WidgetBase): dijit._WidgetBase; /** * Returns the widget corresponding to the given DOMNode * diff --git a/dojo/dojo.d.ts b/dojo/dojo.d.ts index 63cda16dd..7b95efdfa 100644 --- a/dojo/dojo.d.ts +++ b/dojo/dojo.d.ts @@ -927,7 +927,7 @@ declare module dojo { * * */ - class __Promise extends dojo.promise.Promise { + class __Promise implements dojo.promise.Promise { constructor(); /** * A promise resolving to an object representing @@ -988,7 +988,7 @@ declare module dojo { * @param errback OptionalCallback to be invoked when the promise is rejected.Receives the rejection error. * @param progback OptionalCallback to be invoked when the promise emits a progressupdate. Receives the progress update. */ - then(callback?: Function, errback?: Function, progback?: Function): dojo.promise.Promise; + then(callback?: Function, errback?: Function, progback?: Function): dojo.promise.Promise; /** * */ @@ -996,11 +996,11 @@ declare module dojo { /** * */ - trace(): dojo.promise.Promise; + trace(): dojo.promise.Promise; /** * */ - traceRejected(): dojo.promise.Promise; + traceRejected(): dojo.promise.Promise; } /** * Permalink: http://dojotoolkit.org/api/1.9/dojo/request/default.html @@ -1590,7 +1590,7 @@ declare module dojo { * @param listener * @param dontFix */ - once(target: any, type: any, listener: any, dontFix: any): any; + once(target: any, type: any, listener: any, dontFix?: any): any; /** * * @param target @@ -1783,7 +1783,7 @@ declare module dojo { * @param errback OptionalCallback to be invoked when the promise is rejected. * @param progback OptionalCallback to be invoked when the promise emits a progress update. */ - interface when{(valueOrPromise: any, callback?: Function, errback?: Function, progback?: Function): void} + interface when { (value: T|dojo.promise.Promise, callback: dojo.promise.Callback, errback?: any, progback?: any): U|dojo.promise.Promise } /** * Permalink: http://dojotoolkit.org/api/1.9/dojo/DeferredList.html * @@ -1822,7 +1822,7 @@ declare module dojo { /** * */ - "promise": dojo.promise.Promise; + "promise": dojo.promise.Promise; /** * Inform the deferred it may cancel its asynchronous operation. * Inform the deferred it may cancel its asynchronous operation. @@ -1863,7 +1863,7 @@ declare module dojo { * @param update The progress update. Passed to progbacks. * @param strict OptionalIf strict, will throw an error if the deferred has alreadybeen fulfilled and consequently no progress can be emitted. */ - progress(update: any, strict: boolean): dojo.promise.Promise; + progress(update: any, strict: boolean): dojo.promise.Promise; /** * Reject the deferred. * Reject the deferred, putting it in an error state. @@ -1879,7 +1879,7 @@ declare module dojo { * @param value The result of the deferred. Passed to callbacks. * @param strict OptionalIf strict, will throw an error if the deferred has alreadybeen fulfilled and consequently cannot be resolved. */ - resolve(value: any, strict?: boolean): dojo.promise.Promise; + resolve(value: any, strict?: boolean): dojo.promise.Promise; /** * Add new callbacks to the deferred. * Add new callbacks to the deferred. Callbacks can be added @@ -1889,7 +1889,7 @@ declare module dojo { * @param errback OptionalCallback to be invoked when the promise is rejected.Receives the rejection error. * @param progback OptionalCallback to be invoked when the promise emits a progressupdate. Receives the progress update. */ - then(callback: Function, errback: Function, progback: Function): dojo.promise.Promise; + then(callback: Function, errback: Function, progback: Function): dojo.promise.Promise; /** * */ @@ -3098,7 +3098,7 @@ declare module dojo { */ class Stateful { constructor(); - inherited: {(arguments: IArguments): any}; + inherited: {(args: IArguments): any}; /** * Get a property on a Stateful instance. * Get a named property on a Stateful object. The property may @@ -9119,7 +9119,7 @@ declare module dojo { * @param errback OptionalCallback to be invoked when the promise is rejected. * @param progback OptionalCallback to be invoked when the promise emits a progress update. */ - when(valueOrPromise: any, callback: Function, errback: Function, progback: Function): dojo.promise.Promise; + when(valueOrPromise: any, callback: Function, errback: Function, progback: Function): dojo.promise.Promise; /** * signal fired by impending window destruction. You may use * dojo.addOnWIndowUnload() or dojo.connect() to this method to perform @@ -16050,7 +16050,7 @@ declare module dojo { * * @param objectOrArray OptionalThe promise will be fulfilled with a list of results if invoked with anarray, or an object of results when passed an object (using the samekeys). If passed neither an object or array it is resolved with anundefined value. */ - interface all{(objectOrArray?: Object): void} + interface all{(value: Promise[]): Promise} /** * Permalink: http://dojotoolkit.org/api/1.9/dojo/promise/all.html * @@ -16063,7 +16063,7 @@ declare module dojo { * * @param objectOrArray OptionalThe promise will be fulfilled with a list of results if invoked with anarray, or an object of results when passed an object (using the samekeys). If passed neither an object or array it is resolved with anundefined value. */ - interface all{(objectOrArray?: any[]): void} + interface all{(value: Object): Promise} /** * Permalink: http://dojotoolkit.org/api/1.9/dojo/promise/first.html * @@ -16107,6 +16107,11 @@ declare module dojo { * @param Deferred */ interface instrumentation{(Deferred: any): void} + + interface Callback { + (arg: T): U|Promise; + } + /** * Permalink: http://dojotoolkit.org/api/1.9/dojo/promise/Promise.html * @@ -16115,15 +16120,14 @@ declare module dojo { * instances of this class. * */ - class Promise { - constructor(); + interface Promise { /** * Add a callback to be invoked when the promise is resolved * or rejected. * * @param callbackOrErrback OptionalA function that is used both as a callback and errback. */ - always(callbackOrErrback: Function): any; + always(callbackOrErrback: Callback): Promise; /** * Inform the deferred it may cancel its asynchronous operation. * Inform the deferred it may cancel its asynchronous operation. @@ -16160,7 +16164,7 @@ declare module dojo { * * @param errback OptionalCallback to be invoked when the promise is rejected. */ - otherwise(errback: Function): any; + otherwise(errback: Callback): Promise; /** * Add new callbacks to the promise. * Add new callbacks to the deferred. Callbacks can be added @@ -16170,7 +16174,7 @@ declare module dojo { * @param errback OptionalCallback to be invoked when the promise is rejected.Receives the rejection error. * @param progback OptionalCallback to be invoked when the promise emits a progressupdate. Receives the progress update. */ - then(callback: Function, errback?: Function, progback?: Function): dojo.promise.Promise; + then(callback: Callback, errback?: Callback, progback?: Callback): Promise; /** * */ @@ -16184,7 +16188,7 @@ declare module dojo { * to handle traces. * */ - trace(): dojo.promise.Promise; + trace(): Promise; /** * Trace rejection of the promise. * Tracing allows you to transparently log progress, @@ -16194,7 +16198,7 @@ declare module dojo { * to handle traces. * */ - traceRejected(): dojo.promise.Promise; + traceRejected(): Promise; } /** * Permalink: http://dojotoolkit.org/api/1.9/dojo/promise/tracer.html @@ -17467,7 +17471,7 @@ declare module dojo { * * @param results The result set as an array, or a promise for an array. */ - interface QueryResults{(results: dojo.promise.Promise): void} + interface QueryResults{(results: dojo.promise.Promise): void} /** * Permalink: http://dojotoolkit.org/api/1.9/dojo/store/util/SimpleQueryEngine.html * @@ -20456,7 +20460,7 @@ declare module dojo { * @param value the number to be formatted * @param options OptionalAn object with the following properties:pattern (String, optional): override formatting patternwith this string. Default value is based on locale. Overriding this property will defeatlocalization. Literal characters in patterns are not supported.type (String, optional): choose a format type based on the locale from the following:decimal, scientific (not yet supported), percent, currency. decimal by default.places (Number, optional): fixed number of decimal places to show. This overrides anyinformation in the provided pattern.round (Number, optional): 5 rounds to nearest .5; 0 rounds to nearest whole (default). -1means do not round.locale (String, optional): override the locale used to determine formatting rulesfractional (Boolean, optional): If false, show no decimal places, overriding places and pattern settings. */ - format(value: number, options: Object): any; + format(value: number, options?: Object): any; /** * Convert a properly formatted string to a primitive Number, using * locale-specific settings. @@ -20782,7 +20786,7 @@ declare module dojo { * @param root OptionalA default starting root node from which to start the parsing. Can beomitted, defaulting to the entire document. If omitted, the optionsobject can be passed in this place. If the options object has arootNode member, that is used. * @param options a kwArgs options object, see parse() for details */ - scan(root: HTMLElement, options: Object): dojo.promise.Promise; + scan(root: HTMLElement, options: Object): dojo.promise.Promise; } /** * Permalink: http://dojotoolkit.org/api/1.9/dojo/regexp.html @@ -24419,7 +24423,7 @@ declare module dojo { * @param errback OptionalCallback to be invoked when the promise is rejected. * @param progback OptionalCallback to be invoked when the promise emits a progress update. */ - when(valueOrPromise: any, callback: Function, errback: Function, progback: Function): dojo.promise.Promise; + when(valueOrPromise: any, callback: Function, errback: Function, progback: Function): dojo.promise.Promise; /** * signal fired by impending window destruction. You may use * dojo.addOnWIndowUnload() or dojo.connect() to this method to perform @@ -28268,8 +28272,8 @@ declare module "dojo/promise/tracer" { export=exp; } declare module "dojo/promise/Promise" { - var exp: typeof dojo.promise.Promise - export=exp; + interface Promise extends dojo.promise.Promise { } + export = Promise; } declare module "dojo/rpc/JsonpService" { var exp: typeof dojo.rpc.JsonpService diff --git a/dompurify/dompurify-tests.ts b/dompurify/dompurify-tests.ts new file mode 100644 index 000000000..d9d6e0bd6 --- /dev/null +++ b/dompurify/dompurify-tests.ts @@ -0,0 +1,8 @@ +/// + +import dompurify = require('dompurify'); + +dompurify.sanitize(''); +dompurify.addHook('beforeSanitizeElements', (el, data, config) => { + return el; +}); diff --git a/dompurify/dompurify.d.ts b/dompurify/dompurify.d.ts new file mode 100644 index 000000000..b1f24b00e --- /dev/null +++ b/dompurify/dompurify.d.ts @@ -0,0 +1,15 @@ +// Type definitions for DOM Purify +// Project: https://github.com/cure53/DOMPurify +// Definitions by: Dave Taylor +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +interface IDOMPurify { + sanitize(s:string):string; + addHook(hook:string, cb:(currentNode:Element, data:any, config:any) => Element):void; +} + +declare var DOMPurify:IDOMPurify; + +declare module 'dompurify' { + export = DOMPurify; +} diff --git a/donna/donna-tests.ts b/donna/donna-tests.ts new file mode 100644 index 000000000..a1695e42a --- /dev/null +++ b/donna/donna-tests.ts @@ -0,0 +1,81 @@ +/// + +import donna = require("donna"); +var metadata = donna.generateMetadata(['/path/to/my-module', '/path/to/another-module']); + +metadata = { + "files": { + "spec/metadata_templates/classes/class_with_prototype_properties.coffee": { + "objects": { + "3": { + "0": { + "type": "class", + "name": "TextBuffer", + "bindingType": null, + "classProperties": [], + "prototypeProperties": [ + [ + 4, + 9 + ], + [ + 11, + 11 + ] + ], + "doc": " Public: A mutable text container with undo/redo support and the ability to\nannotate logical regions in the text.\n\n ", + "range": [ + [ + 3, + 0 + ], + [ + 11, + 17 + ] + ] + } + }, + "4": { + "9": { + "name": "prop2", + "type": "primitive", + "range": [ + [ + 4, + 9 + ], + [ + 4, + 13 + ] + ], + "bindingType": "prototypeProperty" + } + }, + "11": { + "11": { + "name": "method2", + "bindingType": "prototypeProperty", + "type": "function", + "paramNames": [ + "a" + ], + "range": [ + [ + 11, + 11 + ], + [ + 11, + 16 + ] + ], + "doc": " Public: Takes an argument and does some stuff.\n\na - A {String}\n\nReturns {Boolean}. " + } + } + }, + "exports": {} + } + } +}; diff --git a/donna/donna.d.ts b/donna/donna.d.ts new file mode 100644 index 000000000..fed09fa98 --- /dev/null +++ b/donna/donna.d.ts @@ -0,0 +1,34 @@ +// Type definitions for donna +// Project: https://github.com/atom/donna +// Definitions by: vvakame +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module "donna" { + function generateMetadata(modules: string[]): DonnaTypes.Metadata; +} + +declare module DonnaTypes { + interface Metadata { + files: { [filePath: string]: File; }; + } + + interface File { + objects: { [line: number]: Line; }; + exports: any; + } + + interface Line { + [row: number]: Object; + } + + interface Object { + type: string; + name: string; + bindingType: string; + classProperties?: any[]; + prototypeProperties?: number[][]; + doc?: string; + range: number[][]; + + } +} diff --git a/drop/drop-tests.ts b/drop/drop-tests.ts index b5ae47456..22f83dc2e 100644 --- a/drop/drop-tests.ts +++ b/drop/drop-tests.ts @@ -10,7 +10,10 @@ var d = new Drop({ constrainToWindow: true, constrainToScrollParent: true, classes: "", - tetherOptions: {} + tetherOptions: {}, + remove: true, + target: yellowBox, + content: greenBox }); d.open(); @@ -19,6 +22,8 @@ d.remove(); d.toggle(); d.position(); d.destroy(); +d.element.appendChild(document.createElement("div")); +d.tether.position(); d.on("open", () => null); d.on("close", () => null); @@ -26,3 +31,8 @@ d.once("close", () => null); d.off("close", () => null); d.off("open"); +var e = new Drop({ + target: yellowBox, + content: () => greenBox +}); + diff --git a/drop/drop.d.ts b/drop/drop.d.ts index e3615d510..85cfd0766 100644 --- a/drop/drop.d.ts +++ b/drop/drop.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Drop v0.5 +// Type definitions for Drop v0.5.7 // Project: http://github.hubspot.com/drop/ // Definitions by: Adi Dahiya // Definitions: https://github.com/borisyankov/DefinitelyTyped @@ -19,7 +19,7 @@ declare module drop { interface IDropOptions { target?: Element; - content?: Element | string | (() => string); + content?: Element | string | ((drop?: Drop) => string) | ((drop?: Drop) => Element); position?: string; openOn?: string; constrainToWindow?: boolean; @@ -30,6 +30,8 @@ declare module drop { interface Drop { content: HTMLElement; + element: HTMLElement; + tether: tether.Tether; open(): void; close(): void; remove(): void; diff --git a/dsv/dsv-tests.ts b/dsv/dsv-tests.ts new file mode 100644 index 000000000..93ff59f04 --- /dev/null +++ b/dsv/dsv-tests.ts @@ -0,0 +1,8 @@ +/// + +import dsv = require("dsv"); + +var csv = dsv(","); + +var rows = csv.parse("a,b,c\n1,2,3\n4,5,6"); + diff --git a/dsv/dsv.d.ts b/dsv/dsv.d.ts new file mode 100644 index 000000000..797befb37 --- /dev/null +++ b/dsv/dsv.d.ts @@ -0,0 +1,68 @@ +// Type definitions for dsv +// Project: https://www.npmjs.com/package/dsv +// Definitions by: Jason Swearingen +// Definitions: https://github.com/borisyankov/DefinitelyTyped + + +//commonjs loader +declare module "dsv" { + + /** A parser and formatter for DSV (CSV and TSV) files. +Extracted from D3. */ + var loader: ( + /** the symbol used to seperate cells in the row.*/ + delimiter: string, + /** example: "text/plain" */ + encoding?: string) => _dsv.Dsv; + export = loader; +} + +declare module _dsv { + /** A parser and formatter for DSV (CSV and TSV) files. +Extracted from D3. */ + export class Dsv { + /** Parses the specified string, which is the contents of a CSV file, returning an array of objects representing the parsed rows. + The string is assumed to be RFC4180-compliant. + Unlike the parseRows method, this method requires that the first line of the CSV file contains a comma-separated list of column names; + these column names become the attributes on the returned objects. + For example, consider the following CSV file: + +Year,Make,Model,Length +1997,Ford,E350,2.34 +2000,Mercury,Cougar,2.38 + +The resulting JavaScript array is: + +[ {"Year": "1997", "Make": "Ford", "Model": "E350", "Length": "2.34"}, + {"Year": "2000", "Make": "Mercury", "Model": "Cougar", "Length": "2.38"} ] + */ + public parse( + table: string, + /** coerce cells (strings) into different types or modify them. return null to strip this row from the output results. */ + accessor?: (row: any) => TRow + ): TRow[]; + /** Parses the specified string, which is the contents of a CSV file, returning an array of arrays representing the parsed rows. The string is assumed to be RFC4180-compliant. Unlike the parse method, this method treats the header line as a standard row, and should be used whenever the CSV file does not contain a header. Each row is represented as an array rather than an object. Rows may have variable length. For example, consider the following CSV file: + +1997,Ford,E350,2.34 +2000,Mercury,Cougar,2.38 +The resulting JavaScript array is: + +[ ["1997", "Ford", "E350", "2.34"], + ["2000", "Mercury", "Cougar", "2.38"] ] +Note that the values themselves are always strings; they will not be automatically converted to numbers. See parse for details.*/ + public parseRows( + table: string, + /** coerce cells (strings) into different types or modify them. return null to strip this row from the output results.*/ + accessor?: (row: string[]) => TRow + ): TRow[]; + /** Converts the specified array of rows into comma-separated values format, returning a string. This operation is the reverse of parse. Each row will be separated by a newline (\n), and each column within each row will be separated by a comma (,). Values that contain either commas, double-quotes (") or newlines will be escaped using double-quotes. + +Each row should be an object, and all object properties will be converted into fields. For greater control over which properties are converted, convert the rows into arrays containing only the properties that should be converted and use formatRows. */ + public format(rows: any[]): string; + /** Converts the specified array of rows into comma-separated values format, returning a string. This operation is the reverse of parseRows. Each row will be separated by a newline (\n), and each column within each row will be separated by a comma (,). Values that contain either commas, double-quotes (") or newlines will be escaped using double-quotes. */ + public formatRows(rows: any[]): string; + + + } + +} \ No newline at end of file diff --git a/dymo-label-framework/dymo-label-framework-tests.ts b/dymo-label-framework/dymo-label-framework-tests.ts new file mode 100644 index 000000000..b64625eaa --- /dev/null +++ b/dymo-label-framework/dymo-label-framework-tests.ts @@ -0,0 +1,115 @@ +/// + +var f = dymo.label.framework; + +// Test checkEnvironment +var env = f.checkEnvironment(); + +env.errorDetails = ""; +env.isBrowserSupported = true; +env.isFrameworkInstalled = true; + +// Test getPrinters +var printers = f.getPrinters(); + +// Test PrinterInfo properties +printers.forEach((value) =>{ + value.isAutoCutSupported = true; + value.isConnected = true; + value.isLocal = true; + value.isTwinTurbo = true; + value.modelName = ""; + value.name = ""; +}); + +var testcolor:dymo.label.framework.Color = { alpha: 255, red: 0, green: 0, blue: 0}; + +// Test createLabelRenderParamsXml +var renderParamsXml: string = f.createLabelRenderParamsXml({ + flowDirection: f.FlowDirection.LeftToRight, + labelColor: testcolor, + pngUseDisplayResolution: true, + shadowColor: testcolor, + shadowDepth: 0 +}); +f.createLabelRenderParamsXml({}).charAt(0); // string, all optional params + +// Test renderLabel +f.renderLabel("", renderParamsXml, printers[0].name); + +// Test openLabelXml +var label = f.openLabelXml(""); + +// Test ILabel methods +label.getAddressBarcodePosition(0) == f.AddressBarcodePosition.AboveAddress; // enum +label.getAddressObjectCount().toFixed(); // number +label.getAddressText(0).charAt(0); // string +label.getLabelXml().charAt(0); // string +label.getObjectNames()[0].charAt(0); // string[] +label.getObjectText("").charAt(0); // string +label.print("", "", ""); +label.printAndPollStatus("", "", "", (printJob, printJobStatusInfo) => { + // Test PrintJob + printJob.getStatus((printJobStatusInfoA) => { + // Test PrintJobStatusInfo + printJobStatusInfoA.status.toFixed(); // number + printJobStatusInfoA.statusMessage.charAt(0); // string + }); + // Test callback (must return boolean) + return true; +}, 0); +label.render("", "").charAt(0); // string +// Test chainable "set" methods +label.setAddressBarcodePosition(0, dymo.label.framework.AddressBarcodePosition.AboveAddress) + .setAddressText(0, "") + .setObjectText("", "") + .setAddressText(1, ""); + +// Test LabelSetBuilder +var lsb = new f.LabelSetBuilder(); +var lsbRec = lsb.addRecord(); +lsb.toString().charAt(0); // string +lsb.getRecords().pop(); // array +lsb.getRecords()[0].setText("", ""); // array of ILabelSetRecord + +// Test chainable ILabelSetRecord methods. +lsbRec.setBase64Image("", "").setText("", "").setTextMarkup("", "").setText("", ""); + +// Test static toXml +f.LabelSetBuilder.toXml(lsb.getRecords()); + +// Test printLabel +f.printLabel("", "", "", ""); + +// Test printLabel2 +f.printLabel2("", "", "", "").getStatus((pjsi) => { + pjsi.status.toFixed(); + pjsi.statusMessage.charAt(0); +}); + + + +// Test createLabelWriterPrintParamsXml +var clwppxp: dymo.label.framework.CreateLabelWriterPrintParamsXmlParams = { + copies: 0, // number + flowDirection: dymo.label.framework.FlowDirection.LeftToRight, // enum + jobTitle: "", // string + printQuality: dymo.label.framework.LabelWriterPrintQuality.BarcodeAndGraphics, // enum + twinTurboRoll: dymo.label.framework.TwinTurboRoll.Left // enum +} +f.createLabelWriterPrintParamsXml(clwppxp).charAt(0); // string +f.createLabelWriterPrintParamsXml({}).charAt(0) // all optional params + +// Test createTapePrintParamsXml +var ctppxp: dymo.label.framework.CreateTapePrintParamsXmlParams = { + copies: 0, // number + flowDirection: dymo.label.framework.FlowDirection.RightToLeft, // enum + alignment: dymo.label.framework.TapeAlignment.Left, // enum + cutMode: dymo.label.framework.TapeCutMode.ChainMarks, // enum + jobTitle: "" // string +} +f.createTapePrintParamsXml(ctppxp).charAt(0); // string +f.createTapePrintParamsXml({}).charAt(0); // all optional params + +// Test VERSION +f.VERSION.charAt(0); // string diff --git a/dymo-label-framework/dymo-label-framework.d.ts b/dymo-label-framework/dymo-label-framework.d.ts new file mode 100644 index 000000000..b3209e15c --- /dev/null +++ b/dymo-label-framework/dymo-label-framework.d.ts @@ -0,0 +1,596 @@ +// Type definitions for DYMO Label Framework v1.2.6 +// Project: http://www.labelwriter.com/software/dls/sdk/docs/DYMOLabelFrameworkJavaScriptHelp/index.html +// Definitions by: Thijs Kuipers +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/** + * Top namespace for DYMO Label Framework JavaScript library. + * Latest library available at http://labelwriter.com/software/dls/sdk/js/DYMO.Label.Framework.latest.js + * + * Based on information from http://www.labelwriter.com/software/dls/sdk/docs/DYMOLabelFrameworkJavaScriptHelp/index.html + * which is Copyright (c), 2010, Sanford, L.P. All Rights Reserved. + * + * Based on information from http://developers.dymo.com/2010/06/02/dymo-label-framework-overview/ + * which is © 2013 DYMO Label Inside Out + */ +declare module dymo.label.framework { + + /** Enumeration that specifies where to draw the Intellegent Mail barcode for an Address object. */ + enum AddressBarcodePosition { + /** Indicates to print the barcode above the address. */ + AboveAddress, + /** Indicates to print the barcode below the address. */ + BelowAddress, + /** Indicates to not print the barcode at all. */ + Suppress + } + + /** + * Emuneration that specifies the direction in which objects and object text are laid out on the label. + * For Middle East labels/content specify "RightToLeft", otherwise specify "LeftToRight" (default). + */ + enum FlowDirection { + /** Indicates that the content flows from left to right. */ + LeftToRight, + /** Indicates that the content flows from right to left. */ + RightToLeft + } + + /** + * Enumeration that specifies the print quality when printing to a LabelWriter printer. + */ + enum LabelWriterPrintQuality { + /** Indicates that text print quality (fast) is used. */ + Text, + /** Indicates that barcode and images print quality (slow) is used. */ + BarcodeAndGraphics, + /** Indicates that the print quality is automatically determined based on the types of objects on the label. */ + Auto + } + + /** Print Job Status */ + enum PrintJobStatus { + Error, + Finished, + InQueue, + InvalidJobId, + NotSpooled, + PaperOut, + PrinterBusy, + Printing, + ProcessingError, + Unknown + } + + /** Enumeration that specifies the leader and trailer for a tape label when printing to a Tape printer. */ + enum TapeAlignment { + /** Indicates a 10mm leader and a 10mm trailer. */ + Center, + /** Indicates a 6mm leader and a 10mm trailer. */ + Left, + /** Indicates a 10mm leader and a 6mm trailer. */ + Right + } + + /** Enumeration that specifies the tape cut mode when printing multiple labels to a Tape printer. Note: This enumeration affects multiple page print jobs only. If a one page job is printed, the tape is always cut. */ + enum TapeCutMode { + /** Indicates to cut the tape between labels. */ + AutoCut, + /** Indicates to print cut marks between labels. */ + ChainMarks + } + + /** Enumeration that specifies which roll to print to when printing to a Twin Turbo printer. */ + enum TwinTurboRoll { + /** Indicates to print to the left roll only. */ + Left, + /** Indicates to print to the right roll only. */ + Right, + /** Indicates to continue printing to the other roll when the current roll is out of paper. Note: This does not indicate which roll to print to first; printing may start on either roll. */ + Auto + } + + /** Returns the library version number, e.g. "1.2.6" */ + var VERSION: string; + + /** Checks that the browser enviroment is suitable for the Framework. */ + function checkEnvironment(): { + /** Indicates whether the browser is supported or not. */ + isBrowserSupported: boolean; + /** Indicates whether the Framework is installed or not. */ + isFrameworkInstalled: boolean; + /** An empty string if no error is detected; an error message if an error is detected. */ + errorDetails: string; + }; + + /** + * Object with properties 'a' or 'alpha' to specify color's alpha channel, + * r/red, g/green, b/blue for red, green, blue channels. + * The valid range for a/r/g/b fields is [0..255]. + */ + interface Color { + /** alpha channel [0..255] default: 255 */ + alpha?: number; + /** red channel [0..255] default: 0 */ + red?: number; + /** green channel [0..255] default: 0 */ + green?: number; + /** blue channel [0..255] default: 0 */ + blue?: number; + } + + interface CreateLabelRenderParamsXmlParams { + /** The color of the label. */ + labelColor?: Color; + /** The color of label shadow. */ + shadowColor?: Color; + /** The shadow width in TWIPS. If '0' is specified, no shadow is rendered. */ + shadowDepth?: number; + /** The direction of the label content on the label (left-to-right or right-to-left). Use the dymo.label.framework.FlowDirection enumeration to specify the value. */ + flowDirection?: FlowDirection; + /** + * If true, the PNG will be generated using the display resolution. + * If false, the PNG will be generated using the printer resolution. + * If the display resolution is used, the resulting PNG will be smaller. + * Use the printer resolution if the resulting image will be zoomed. This will give the zoomed preview better quality. + */ + pngUseDisplayResolution?: boolean; + } + + /** + * Creates an XML string suitable to pass to the dymo.label.framework.renderLabel function + * as renderParamsXml parameter. Returns an XML string. + * + * @param params A JavaScript object with the following properties + * (not all properties must be defined; if a property is not defined, a default value is used) + */ + function createLabelRenderParamsXml(params: CreateLabelRenderParamsXmlParams): string; + + interface CreateLabelWriterPrintParamsXmlParams { + /** The number of copies to print. */ + copies?: number; + /** The print job title/description. */ + jobTitle?: string; + /** The direction of the label content on the label (left-to-right or right-to-left). Use the dymo.label.framework.FlowDirection enumeration to specify the value. */ + flowDirection?: FlowDirection; + /** The print quality. Use the dymo.label.framework.LabelWriterPrintQuality enumeration to specify the value. */ + printQuality?: LabelWriterPrintQuality; + /** The roll to print to if the printer is a TwinTurbo printer. Use the dymo.label.framework.TwinTurboRoll enumeration to specify the value. */ + twinTurboRoll?: TwinTurboRoll; + } + + /** + * Creates an XML string suitable to to pass to the dymo.label.framework.printLabel function + * as printParamsXml parameter. Created print parameters are for printing to LabelWriter printers. + * Returns an XML string. + * + * @param params A JavaScript object with the following properties + * (not all properties must be defined; if a property is not defined, a default value is used) + */ + function createLabelWriterPrintParamsXml(params: CreateLabelWriterPrintParamsXmlParams): string; + + interface CreateTapePrintParamsXmlParams { + /** The number of copies to print. */ + copies?: number; + /** The print job title/description. */ + jobTitle?: string; + /** The direction of the label content on the label (left-to-right or right-to-left). Use the dymo.label.framework.FlowDirection enumeration to specify the value. */ + flowDirection?: FlowDirection; + /** The label alignment on the tape. Use the dymo.label.framework.TapeAlignment enumeration to specify the value. */ + alignment?: TapeAlignment; + /** The cut mode (if auto-cut is supported by the printer). Use the dymo.label.framework.TapeCutMode enumeration to specify the value. */ + cutMode?: TapeCutMode; + } + + /** + * Creates an XML string suitable to pass to the dymo.label.framework.printLabel function as printParamsXml parameter. Created print parameters are for printing to Tape printers. + * Returns an XML string. + * + * @param params A JavaScript object with the following properties + * (not all properties must be defined; if a property is not defined, a default value is used) + */ + function createTapePrintParamsXml(params: CreateTapePrintParamsXmlParams): string; + + interface PrinterInfo { + /** Indicates whether the Auto-Cut feature is supported by the printer or not. Note: The property is only defined if printerType is "TapePrinter". */ + isAutoCutSupported: boolean; + /** Indicates whether the printer is connected to a computer or not. Note: Currently only returns properly for local USB-connected printers on Windows. */ + isConnected: boolean; + /** Indicates whether the printer is a local USB-connected printer or a shared network printer. Note: Currently only returns properly on Windows. */ + isLocal: boolean; + /** Indicates whether the printer is a "LabelWriter Twin Turbo" (has two rolls) or not. Note: The property is only defined if printerType is "LabelWriterPrinter". */ + isTwinTurbo: boolean; + /** Returns the printer model/driver name. */ + modelName: string; + /** Returns the printer name (print queue name on Mac). */ + name: string; + /** Returns the printer type; "LabelWriterPrinter" or "TapePrinter". */ + printerType: string; + } + + /** + * Gets a list of all printers supported by the DYMO Label Framework. + * Results are returned in an array-like object. + * Each item is of the type dymo.label.framework.PrinterInfo. + * In addition, items can be accessed by printer name. + */ + function getPrinters(): PrinterInfo[]; + + /** + * Convenience method (overload of getPrinters) to get a list of all printers of type "LabelWriterPrinter". + */ + function getLabelWriterPrinters(): PrinterInfo[]; + + /** + * Convenience method (overload of getPrinters) to get a list of all printers of type "TapePrinter". + */ + function getTapePrinters(): PrinterInfo[]; + + /** + * Loads an image from a URL or file and returns it as a base64-encoded PNG stream. + * The loaded image is not necessarily in PNG format. + * The image can be in any format supported by the Framework (by DYMO Label v.8). + * The loaded data can be used to set content for an image object on a label. + * Note: The comments for {@link openLabelFile} apply to this function as well. + * + * @param imageUri URL or file name to load the image from. + * + * @returns A base64-encoded PNG stream. + */ + function loadImageAsPngBase64(imageUri: string): string; + + /** Print Job */ + interface PrintJob { + /** + * Gets a status of the print job + * + * @param replyCallback a function called when the status is available + */ + getStatus(replyCallback: (printJobStatusInfo: PrintJobStatusInfo) => any): void; + } + + /** Print Job Status Info */ + interface PrintJobStatusInfo { + statusMessage: string; + status: PrintJobStatus; + } + + /** + * There is no constructor function for ILabel. To get ILabel instance use the + * dymo.label.framework.openLabelFile or dymo.label.framework.openLabelXml function. + * ILabel provides methods for manipulating label content, such as set address or text + * on the label. + */ + interface ILabel { + /** + * Gets the Intelligent Mail barcode position for an Address object. + * + * @param addressIndex The zero-based index of the Address object in a 'virtual' array of all Address objects on the label. + * + * @returns A string with one of the values defined by the dymo.label.framework.AddressBarcodePosition enumeration. + */ + getAddressBarcodePosition(addressIndex: number): AddressBarcodePosition; + + /** + * Gets the number of Address objects on the label. + */ + getAddressObjectCount(): number; + + /** + * Gets the text content of an Address object. + * + * @param addressIndex The zero-based index of the Address object in a 'virtual' array of all Address objects on the label. + * + * @returns The plain text from the Address object. + */ + getAddressText(addressIndex: number): string; + + /** + * Returns the current label as an XML string. The returned XML string can be passed + * to functions that accept label XML as a parameter, or can be used to direct content + * manipulations not currently supported by the Framework. + */ + getLabelXml(): string; + + /** + * Gets an array of object reference names on the label. Returns an array of strings. + */ + getObjectNames(): string[]; + + /** + * Gets the 'text' content of an object. The content depends on the object type. + * * Address and Text objects - Returns the object text without formatting. + * * Barcode object - Returns the barcode string. + * * Image - Returns the base64-encoded string on the image's PNG stream (only if image data is embedded with the label and not linked to a URL or file). + * * Circular Text object - Returns the object text. + * * Other objects - Returns an empty string. + * + * @param objectName The name of the object. + */ + getObjectText(objectName: string): string; + + /** + * Prints the label. + * + * @param printerName The name of the printer to print to. A list of printers can be obtained using dymo.label.framework.getPrinters. + * @param printParamsXml The print parameters, such as number of copies, print quality, etc. See [PrintParams.xsd]{@link http://labelwriter.com/software/dls/sdk/PrintParams.xsd}. + * @param labelSetXml + * The LabelSet to print. LabelSet is used to print multiple labels with the same layout, but with different + * data, such as multiple addresses. Use the dymo.label.framework.LabelSetBuilder class to create a LabelSet + * or construct XML manually according to [LabelSet.xsd]{@link http://labelwriter.com/software/dls/sdk/LabelSet.xsd}. + */ + print(printerName: string, printParamsXml: string, labelSetXml: string): void; + + /** + * Prints a label and runs status checking in a loop + * + * @param printerName The name of the printer to print to. A list of printers can be obtained using dymo.label.framework.getPrinters. + * @param printParamsXml The print parameters, such as number of copies, print quality, etc. See [PrintParams.xsd]{@link http://labelwriter.com/software/dls/sdk/PrintParams.xsd}. + * @param labelSetXml The LabelSet to print. + * LabelSet is used to print multiple labels with the same layout, but with different data, such as multiple + * addresses. Use the dymo.label.framework.LabelSetBuilder class to create a LabelSet or construct XML manually + * according to [LabelSet.xsd]{@link http://labelwriter.com/software/dls/sdk/LabelSet.xsd}. + * @param statusCallback Status callback function called when the service returned status information. + * The callback takes two parameters; the first is PrintJob object. It can be used to get the status information on demand, + * without using polling. Also, it might be extended in the future to provide more control over the print job, e.g. an ability + * to cancel it. The second parameter to the callback is PrintJobStatusInfo class. PrintJobStatusInfo has two properties: + * statusMessage that contains a status message string; and status that contains status code. The callback has to return a + * boolean value. If true is returned, than pritnAndPollStatus() will poll the service again after the pollInterval passed. + * If false is returned, then printAndPollStatus() finishes processing. + * @param pollInterval Interval in milliseconds to ask the proxy service for the job status information. + * + * @returns The print job. + */ + printAndPollStatus( + printerName: string, + printParamsXml: string, + labelSetXml: string, + statusCallback: (printJob: PrintJob, printJobStatusInfo: PrintJobStatusInfo) => boolean, + pollInterval: number): PrintJob; + + /** + * Creates a label raster image that can be used for label previewing. + * + * @param renderParamsXml Rendering parameters, such as shadow depth, label color, etc. + * See [LabelRenderParams.xsd]{@link http://labelwriter.com/software/dls/sdk/LabelRenderParams.xsd}. + * @param printerName The name of the printer that the preview is generated for. + * The preview/output can be different for different printers, + * especially for tape printers with different print head sizes. + * If it is not important what printer the label is printed to, + * an empty string can be passed. In this case, the default printer metrics will + * be used. The default is LW400 for LabelWriter printers and LW400 DUO Tape for + * tape printers. + */ + render(renderParamsXml: string, printerName: string): string; + + /** + * Sets the Intelligent Mail barcode position for an Address object. + * + * @param addressIndex The zero-based index of the Address object in a 'virtual' array of all Address objects on the label. + * @param barcodePosition The barcode position. + * + * @returns self + */ + setAddressBarcodePosition(addressIndex: number, barcodePosition: AddressBarcodePosition): ILabel; + + /** + * Sets the text content of an Address object. + * + * @param addressIndex The zero-based index of the Address object in a 'virtual' array of all Address objects on the label. + * @param text The plain text string that contains the content of the Address object. Note: The current text formatting is retained on a line-by-line basis. + * + * @returns self + */ + setAddressText(addressIndex: number, text: string): ILabel; + + /** + * Sets the text content for an object. The content and/or text formatting are set differently + * depending on the object type. + * + * * Address object - The formatting is applied on a line-by-line basis (using list). + * * Text object - The formatting of the current first character is applied to all text. + * * Barcode object - The barcode text. + * * Image object - The base64-encoded string of image's PNG stream. + * * CircularText object - The object text. + * * Date and Time and Counter objects - The object's 'Before' text. + * * Other objects - An empty string. + * + * @param objectName The name of the object. + * @param text The plain text string for new object content. + */ + setObjectText(objectName: string, text: string): ILabel; + } + + /** + * ILabelSetRecord instance holds data of one LabelSet record. ILabelSetRecord provides + * methods for adding data to the record. To create ILabelSetRecord instance, + * use dymo.label.framework.LabelSetBuilder.prototype.addRecord method. + */ + interface ILabelSetRecord { + /** + * Adds image data to the record. + * + * @param objectName The name of the object that the markup is set for. + * @param base64Image The string containing the base64-encoded PNG image stream. + * + * @returns self + */ + setBase64Image(objectName: string, base64Image: string): ILabelSetRecord; + + /** Adds data to the record specified as plain text. + * + * @param objectName The name of the object that the markup is set for. + * @param text The object text to set. + * + * @returns self + */ + setText(objectName: string, text: string): ILabelSetRecord; + + /** + * Adds data to the record specified as text markup. + * + * @param objectName The name of the object that the markup is set for. + * @param textMarkup The markup string. See [TextMarkup.xsd]{@link http://labelwriter.com/software/dls/sdk/TextMarkup.xsd}. + * + * @returns self + */ + setTextMarkup(objectName: string, textMarkup: string): ILabelSetRecord; + } + + /** + * Loads label content from a file or URL. + * The following considerations should be taken before using this function: + * + * * The full file name or URL should be specified. The function will not honor relative paths based on document.location.href. + * * The fileName can be an http:// or file:// URL. On Windows the file name can be a regular file name, for example 'c:\users\desktop\address.label'. + * * The content of the label will be loaded synchronously. Therefore, if the remote server is down there will be a timeout. + * * Any local file can be accessed or attempted to be accessed. The function is not limited by any browser restrictions. However, only a valid label file (according to label.xsd schema) can be loaded. This could still be a potential security concern. + * * The URL is not limited to same-site-origin browser policy. Any URL can be opened. + * * The proxy settings are the system default settings, these are not necessarily the browser settings. + * + * Use this function only when there is no other way to load label data. In most cases, label data should be loaded using dymo.label.framework.openLabelXml. + * + * @param fileName FileName or URL to load label from. + *  + * @returns Returns Label object; provides label manipulation methods. + */ + function openLabelFile(fileName: string): ILabel; + + /** + * Loads label content from an XML stream/string. + * Note: This is the preferred way to load/open label files. + * Use XMLHttpRequest() or other standard browser methods to get XML string. + * + * @param labelXml The label definition as an XML string. + * @returns Label object. + */ + function openLabelXml(labelXml: string): ILabel; + + /** + * Prints one or more labels. + * + * @param printerName The name of the printer to print to. A list of printers can be obtained using + * dymo.label.framework.getPrinters. + * @param printParamsXml The print parameters, such as number of copies, print quality, etc. + * See [PrintParams.xsd]{@link http://labelwriter.com/software/dls/sdk/PrintParams.xsd}. + * @param labelXml The label to print. + * @param labelSetXml The LabelSet to print. LabelSet is used to print multiple labels with the same layout, + * but with different data, such as multiple addresses. Use dymo.label.framework.LabelSetBuilder class to + * create a LabelSet, or construct XML manualy according to + * [LabelSet.xsd]{@link http://labelwriter.com/software/dls/sdk/LabelSet.xsd}. + */ + function printLabel(printerName: string, printParamsXml: string, labelXml: string, labelSetXml: string): void; + + /** + * Prints a label and returns a print job object + * + * @param printerName The printer to print on. A list of printers can be obtained by getPrinters() + * @param printParamsXml Printing parameters, like number of copies, print quality, etc. See [PrintParams.xsd]{@link http://labelwriter.com/software/dls/sdk/PrintParams.xsd} + * @param labelXml Label to print + * @param labelSetXml + * LabelSet to print. LabelSet is used to print multiple labels with same layout but different data, e.g. multiple addresses. + * Use LabelSetBuilder to create a LabelSet or construct xml manualy according to [LabelSet.xsd]{@link http://labelwriter.com/software/dls/sdk/LabelSet.xsd}. + */ + function printLabel2(printerName: string, printParamsXml: string, labelXml: string, labelSetXml: string): PrintJob; + + /** + * Prints a label and runs status checking in a loop + * + * @param printerName The printer to print on. A list of printers can be obtained by getPrinters() + * @param printParamsXml Printing parameters, like number of copies, print quality, etc. See [PrintParams.xsd]{@link http://labelwriter.com/software/dls/sdk/PrintParams.xsd} + * @param labelXml Label to print + * @param labelSetXml + * LabelSet to print. LabelSet is used to print multiple labels with same layout but different data, e.g. + * multiple addresses. + * Use LabelSetBuilder to create a LabelSet or construct xml manually according to + * [LabelSet.xsd]{@link http://labelwriter.com/software/dls/sdk/LabelSet.xsd} + * @param statusCallback + * Function to be called when a print job status is available. + * To continue polling the status the function should return true, false otherwise. + * @param pollInterval Polling interval in milliseconds + */ + function printLabelAndPollStatus( + printerName: string, + printParamsXml: string, + labelXml: string, + labelSetXml: string, + statusCallback: (printJob: PrintJob, printJobStatusInfo: PrintJobStatusInfo) => boolean, + pollInterval: number): PrintJob; + + /** + * Creates a label raster image that can be used for label previewing. + * Returns a string that is a base64-encoded PNG stream of the label image. + * This string can be used as data: url for element. + * Note: data: urls are not supported by IE6 and IE7. IE8 supports them with a 32KB limit (so it may not be possible to preview 'large' labels). + * + * @param labelXml Label to preview. + * @param renderParamsXml The rendering parameters, such as shadow depth, label color, etc. See [LabelRenderParams.xsd]{@link http://labelwriter.com/software/dls/sdk/LabelRenderParams.xsd}. + * @param printerName The name of the printer that the preview is generated for. + * The preview/output can be different for different printers, especially for tape printers + * with different print head sizes. If it is not important what printer the label is + * printed to, an empty string can be passed. In this case, the default printer metrics + * will be used. The default is LW400 for LabelWriter printers and LW400 DUO Tape for tape printers. + * + * @returns A base64-encoded PNG stream of the label image. + */ + function renderLabel(labelXml: string, renderParamsXml: string, printerName: string): string; + + /** + * Undocumented + */ + interface AddPrinterUriCallback { + (printerUri: string): any; + } + + /** + * Undocumented, removed, see http://developers.dymo.com/2013/08/14/dymo-sdk-qa/#comment-27119 + */ + function addPrinterUri( + printerUri: string, + location?: string, + successCallback?: AddPrinterUriCallback, + errorCallback?: AddPrinterUriCallback): void; + + /** + * Undocumented, removed, see http://developers.dymo.com/2013/08/14/dymo-sdk-qa/#comment-27119 + */ + function removePrinterUri(printerUri: string): void; + + /** + * Undocumented, removed, see http://developers.dymo.com/2013/08/14/dymo-sdk-qa/#comment-27119 + */ + function removeAllPrinterUri(): void; + + /** + * LabelSetBuilder is used to create a LabelSet to print multiple labels in one print job. + * LabelSet is a collection of records. Each record contains multiple pairs; each pair consists + * of the object name and the object text data/content. The data of each record are applied to all + * corresponend objects and for each record one label is printed. + */ + class LabelSetBuilder { + /** + * Converts record objects to XML format. The XML format schema is defined in [LabelSet.xsd]{@link http://labelwriter.com/software/dls/sdk/LabelSet.xsd}. + * Returned XML can be passed to dymo.label.framefork.printLabel as labelSetXml parameter. This function can be used independent of other LabelSetBuilder methods, if records data is generated by other functions. + * + * @param records The records to convert to XML. Records should be an array-like object of associative-arrays with object names as keys and object text as values. + * + * @returns An XML string. + */ + static toXml(records: {}[]): string; + + /** + * Adds a new record to the LabelSet. Returns a record object. + */ + addRecord(): ILabelSetRecord; + + /** + * Get all record objects in this LabelSetBuilder. + */ + getRecords(): ILabelSetRecord[]; + + /** + * Converts the builder's content to an XML string suitable to pass to dymo.label.framefork.printLabel. + */ + toString(): string; + } +} diff --git a/each/each-tests.ts b/each/each-tests.ts index 370e6ac39..4b07c694d 100644 --- a/each/each-tests.ts +++ b/each/each-tests.ts @@ -6,9 +6,9 @@ function testEach() { return { paused: true, readable: false, - started: true, - done: true, - total: true, + started: 11, + done: 12, + total: 22, on: function (eventName: string, cb: (a: any, b?: () => void) => void) { return EachStaticClass([]); }, diff --git a/each/each.d.ts b/each/each.d.ts index 65d0a3f9d..0e9b900dc 100644 --- a/each/each.d.ts +++ b/each/each.d.ts @@ -6,9 +6,9 @@ interface Each { paused: boolean; readable: boolean; - started: boolean; - done: boolean; - total: boolean; + started: number; + done: number; + total: number; on(eventName: string, onCallback: Function): Each; on(eventName: "item", onItem: (item: any, next: (error?: Error) => void) => void): Each; on(eventName: "error", onError: (error: Error[]) => void): Each; @@ -36,4 +36,4 @@ declare var each: EachStatic; declare module "each" { export = each; -} \ No newline at end of file +} diff --git a/easy-session/easy-session-tests.ts b/easy-session/easy-session-tests.ts new file mode 100644 index 000000000..2053b634c --- /dev/null +++ b/easy-session/easy-session-tests.ts @@ -0,0 +1,63 @@ +/// +/// +/// + +import express = require('express'); +import session = require('express-session'); +import cookieParser = require('cookie-parser'); +import easySession = require('easy-session'); // Require the module : line 1 + +var app = express(); + +app.use(cookieParser('secreet')); +app.use(session({ + secret: 'keyboard cat', + resave: false, + saveUninitialized: true +})); +app.use(easySession.main(session)); + +app.get('/login', function (req, res, next) { + req.session.login('user', {email: 'email'}, function (err) { + if(err) { + res.send(500); + return; + } + res.send(200); + }); +}); + +app.post('/logout', function (req, res, next) { + req.session.logout(function (err) { + if(err) { + res.send(500); + return; + } + res.send(200); + }); +}); + +app.get('/isloggedin', function (req, res, next) { + res.send(req.session.isLoggedIn('user')); +}); + +app.get('/isfresh', function (req, res, next) { + res.send(req.session.isFresh()); +}); + +app.get('/hasrole', function (req, res, next) { + res.send(req.session.hasRole('user')); +}); + +app.post('/setrole', function (req, res, next) { + req.session.setRole(req.query.role); + res.send(200); +}); + +app.get('/getrole', function (req, res, next) { + res.send(req.session.getRole()); +}); + +app.use(easySession.isLoggedIn()); +app.use(easySession.isFresh()); +app.use(easySession.checkRole('user')); \ No newline at end of file diff --git a/easy-session/easy-session.d.ts b/easy-session/easy-session.d.ts new file mode 100644 index 000000000..8300d8503 --- /dev/null +++ b/easy-session/easy-session.d.ts @@ -0,0 +1,41 @@ +// Type definitions for easy-session +// Project: https://github.com/DeadAlready/node-easy-session +// Definitions by: Karl Düüna +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module Express { + interface ErrorCallback { + (err?: any): void; + } + export interface Session { + login(callback: Function): void; + login(extend: Object, callback: ErrorCallback): void; + login(role: string, callback: ErrorCallback): void; + login(role: string, extend: Object, callback: ErrorCallback): void; + logout(callback: ErrorCallback): void; + isLoggedIn(role?: string): boolean; + isGuest(): boolean; + isFresh(): boolean; + setRole(role: string): Session; + getRole(): string; + hasRole(role: string): boolean; + } +} + +declare module "easy-session" { + import express = require('express'); + + interface SessionOptions { + ipCheck?: boolean; + uaCheck?: boolean; + freshTimeout?: number; + maxFreshTimeout?: number; + } + + export function main(session: any, options?: SessionOptions): express.RequestHandler; + export function isLoggedIn(errorCallback?: Function): express.RequestHandler; + export function isFresh(errorCallback?: Function): express.RequestHandler; + export function checkRole(role: string, errorCallback?: Function): express.RequestHandler; +} \ No newline at end of file diff --git a/egg.js/egg.js-tests.ts b/egg.js/egg.js-tests.ts new file mode 100644 index 000000000..d9eeefc86 --- /dev/null +++ b/egg.js/egg.js-tests.ts @@ -0,0 +1,27 @@ +/// + +var egg = new Egg(); +egg + .addCode("up,up,down,down,left,right,left,right,b,a", function () { + alert("Konami!"); +}, "konami-code") + .addHook(function () { + console.log("Hook called for: " + this.activeEgg.keys); + console.log(this.activeEgg.metadata); +}) + .listen(); + +var egg = new Egg("up,up,down,down,left,right,left,right,b,a", function () { + alert("Konami!"); +}).listen(); + +// EGGSAMPLE +var egg = new Egg(); +egg + .AddCode("up,up,down,down,left,right,left,right,b,a", function () { + alert("Konami!"); +}, "konami-code") + .AddHook(function () { + console.log("Hook called for: " + this.activeEgg.keys); + console.log(this.activeEgg.metadata); +}).Listen(); \ No newline at end of file diff --git a/egg.js/egg.js.d.ts b/egg.js/egg.js.d.ts new file mode 100644 index 000000000..14b57ba07 --- /dev/null +++ b/egg.js/egg.js.d.ts @@ -0,0 +1,93 @@ +// Type definitions for Egg.js 0.0.1 +// Project: https://github.com/mikeflynn/egg.js/ +// Definitions by: Markus Peloso +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare var egg: Egg; + +declare module "egg" { + export = egg; +} + +/** + * Egg.js is a simple JS library that has no prerequisites and allows you to easily add web easter + * eggs by watching the user's key strokes. + */ +declare class Egg { + /** + * Egg.js is a simple JS library that has no prerequisites and allows you to easily add web easter + * eggs by watching the user's key strokes. + */ + constructor(); + /** + * Egg.js is a simple JS library that has no prerequisites and allows you to easily add web easter + * eggs by watching the user's key strokes. + * @param keySequence You need to pass it the character sequence to trigger the easter egg + * callback (which can either be in plain English or JavaScript key codes). + * @param fn A function to trigger when it happens. + */ + constructor(keySequence: string, fn: () => any); + /** + * Egg.js is a simple JS library that has no prerequisites and allows you to easily add web easter + * eggs by watching the user's key strokes. + * @param keySequence You need to pass it the character sequence to trigger the easter egg + * callback (which can either be in plain English or JavaScript key codes). + * @param fn A function to trigger when it happens. + * @param metadata An optional set of metadata. + */ + constructor(keySequence: string, fn: () => any, metadata: any); + /** + * Use to add in your easter eggs. + * @param keySequence You need to pass it the character sequence to trigger the easter egg + * callback (which can either be in plain English or JavaScript key codes). + * @param fn A function to trigger when it happens. + */ + AddCode(keySequence: string, fn: () => any): Egg; + /** + * Use to add in your easter eggs. + * @param keySequence You need to pass it the character sequence to trigger the easter egg + * callback (which can either be in plain English or JavaScript key codes). + * @param fn A function to trigger when it happens. + * @param metadata An optional set of metadata. + */ + AddCode(keySequence: string, fn: () => any, metadata: any): Egg; + /** + * Add a hook, that will run after any egg code is triggered. You could use it to fire a Google + * Analytics event or send out a tweet that someone finally found your easter egg. Hooks get + * access to the whole Egg.js object so you can pull information about the easter egg that + * fired via this.activeEgg. + * @param fn A function to trigger when it happens. + */ + AddHook(fn: () => any): Egg; + /** + * Start listening to key codes. + */ + Listen(): Egg; + /** + * Use to add in your easter eggs. + * @param keySequence You need to pass it the character sequence to trigger the easter egg + * callback (which can either be in plain English or JavaScript key codes). + * @param fn A function to trigger when it happens. + */ + addCode(keySequence: string, fn: () => any): Egg; + /** + * Use to add in your easter eggs. + * @param keySequence You need to pass it the character sequence to trigger the easter egg + * callback (which can either be in plain English or JavaScript key codes). + * @param fn A function to trigger when it happens. + * @param metadata An optional set of metadata. + */ + addCode(keySequence: string, fn: () => any, metadata: any): Egg; + /** + * Add a hook, that will run after any egg code is triggered. You could use it to fire a Google + * Analytics event or send out a tweet that someone finally found your easter egg. Hooks get + * access to the whole Egg.js object so you can pull information about the easter egg that + * fired via this.activeEgg. + * @param fn A function to trigger when it happens. + */ + addHook(fn: () => any): Egg; + /** + * Start listening to key codes. + */ + listen(): Egg; +} \ No newline at end of file diff --git a/ember/ember.d.ts b/ember/ember.d.ts index 636a7af68..332d31b1a 100644 --- a/ember/ember.d.ts +++ b/ember/ember.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Ember.js 1.0.0 +// Type definitions for Ember.js 1.11.3 // Project: http://emberjs.com/ // Definitions by: Jed Mao // Definitions: https://github.com/borisyankov/DefinitelyTyped @@ -48,23 +48,23 @@ declare module EmberStates { /** A standard promise hook that resolves if the transition succeeds and rejects if it fails/redirects/aborts. - + Forwards to the internal `promise` property which you can use in situations where you want to pass around a thennable, but not the Transition itself. - + @arg {Function} onFulfilled @arg {Function} onRejected @arg {String} label optional string for labeling the promise. Useful for tooling. @return {Promise} */ - then(onFulfilled: Function, onRejected: Function, label?: string): Ember.RSVP.Promise; + then(onFulfilled: Function, onRejected?: Function, label?: string): Ember.RSVP.Promise; /** Forwards to the internal `promise` property which you can use in situations where you want to pass around a thennable, but not the Transition itself. - + @method catch @arg {Function} onRejection @arg {String} label optional string for labeling the promise. @@ -77,7 +77,7 @@ declare module EmberStates { Forwards to the internal `promise` property which you can use in situations where you want to pass around a thennable, but not the Transition itself. - + @method finally @arg {Function} callback @arg {String} label optional string for labeling the promise. @@ -85,7 +85,7 @@ declare module EmberStates { @return {Promise} */ finally(callback: Function, label?: string): Ember.RSVP.Promise; - + /** Aborts the Transition. Note you can also implicitly abort a transition by initiating another transition while a previous one is underway. @@ -123,9 +123,9 @@ declare module EmberStates { Fires an event on the current list of resolved/resolving handlers within this transition. Useful for firing events on route hierarchies that haven't fully been entered yet. - + Note: This method is also aliased as `send` - + @arg {Boolean} [ignoreFailure=false] a boolean specifying whether unhandled events throw an error @arg {String} name the name of the event to fire */ @@ -134,9 +134,9 @@ declare module EmberStates { Fires an event on the current list of resolved/resolving handlers within this transition. Useful for firing events on route hierarchies that haven't fully been entered yet. - + Note: This method is also aliased as `send` - + @arg {String} name the name of the event to fire */ trigger(eventName: string): void; @@ -147,7 +147,7 @@ declare module EmberStates { that will follow any redirects that occur and fulfill with the value fulfilled by any redirecting transitions that occur. - + @return {Promise} a promise that fulfills with the same value that the final redirecting transition fulfills with */ @@ -387,8 +387,10 @@ interface DisconnectOutletOptions { interface RenderOptions { into?: string; - outlet?: string; controller?: string; + model?: any; + outlet?: string; + view?: string; } interface ModifyObserver { @@ -412,7 +414,7 @@ declare module Ember { **/ function A(arr?: any[]): NativeArray; /** - The Ember.ActionHandler mixin implements support for moving an actions property to an _actions + The Ember.ActionHandler mixin implements support for moving an actions property to an _actions property at extend time, and adding _actions to the object's mergedProperties list. **/ class ActionHandlerMixin { @@ -420,7 +422,7 @@ declare module Ember { Triggers a named action on the ActionHandler **/ send(name: string, ...args: any[]): void; - /** + /** The collection of functions, keyed by name, available on this ActionHandler as action targets. **/ actions: ActionsHash; @@ -931,49 +933,149 @@ declare module Ember { frozenCopy(): Copyable; } class CoreObject { - static detect(obj: any): boolean; - static detectInstance(obj: any): boolean; /** - Iterate over each computed property for the class, passing its name and any - associated metadata (see metaForProperty) to the callback. + An overridable method called when objects are instantiated. By default, + does nothing unless it is overridden during class definition. + @method init **/ - static eachComputedProperty(callback: Function, binding: {}): void; - /** - Returns the original hash that was passed to meta(). - @param key property name - **/ - static metaForProperty(key: string): {}; - static isClass: boolean; - static isMethod: boolean; - /** - Destroys an object by setting the isDestroyed flag and removing its metadata, which effectively - destroys observers and bindings. If you try to set a property on a destroyed object, an exception - will be raised. Note that destruction is scheduled for the end of the run loop and does not - happen immediately. It will set an isDestroying flag immediately. - **/ - destroy(): CoreObject; init(): void; - /** - Returns a string representation which attempts to provide more information than Javascript's toString - typically does, in a generic way for all Ember objects (e.g., ""). - **/ - toString(): string; - willDestroy(): void; /** Defines the properties that will be concatenated from the superclass (instead of overridden). + @property concatenatedProperties + @type Array + @default null **/ concatenatedProperties: any[]; + /** Destroyed object property flag. If this property is true the observers and bindings were already removed by the effect of calling the destroy() method. + @property isDestroyed + @default false **/ isDestroyed: boolean; /** Destruction scheduled flag. The destroy() method has been called. The object stays intact until the end of the run loop at which point the isDestroyed flag is set. + @property isDestroying + @default false **/ isDestroying: boolean; + + /** + Destroys an object by setting the `isDestroyed` flag and removing its + metadata, which effectively destroys observers and bindings. + If you try to set a property on a destroyed object, an exception will be + raised. + Note that destruction is scheduled for the end of the run loop and does not + happen immediately. It will set an isDestroying flag immediately. + @method destroy + @return {Ember.Object} receiver + */ + destroy(): CoreObject; + + /** + Override to implement teardown. + @method willDestroy + */ + willDestroy(): void; + + /** + Returns a string representation which attempts to provide more information than Javascript's toString + typically does, in a generic way for all Ember objects (e.g., ""). + @method toString + @return {String} string representation + **/ + toString(): string; + + static isClass: boolean; + static isMethod: boolean; + + /** + Creates a new subclass. + @method extend + @static + @param {Object} [args] - Object containing values to use within the new class + **/ + static extend(args ?: CoreObjectArguments): T; + /** + Creates a new subclass. + @method extend + @static + @param {Mixin} [mixins] - One or more Mixin classes + @param {Object} [args] - Object containing values to use within the new class + **/ + static extend(mixins?: Mixin, args?: CoreObjectArguments): T; + + /** + Creates a new subclass. + @method extend + @param {Object} [args] - Object containing values to use within the new class + Non-static method because Ember classes aren't currently 'real' TypeScript classes. + **/ + extend(args ?: CoreObjectArguments): T; + /** + Creates a new subclass. + @method extend + @param {Mixin} [mixins] - One or more Mixin classes + @param {Object} [args] - Object containing values to use within the new class + Non-static method because Ember classes aren't currently 'real' TypeScript classes. + **/ + extend(mixins ? : Mixin, args ?: CoreObjectArguments): T; + + /** + Equivalent to doing extend(arguments).create(). If possible use the normal create method instead. + @method createWithMixins + @static + @param [args] + **/ + static createWithMixins(args?: {}): T; + + /** + Creates an instance of the class. + @method create + @static + @param [args] - A hash containing values with which to initialize the newly instantiated object. + **/ + static create(args?: {}): T; + + /** + Augments a constructor's prototype with additional properties and functions. + To add functions and properties to the constructor itself, see reopenClass. + @method reopen + **/ + static reopen(args?: {}): T; + + /** + Augments a constructor's own properties and functions. + To add functions and properties to instances of a constructor by extending the + constructor's prototype see reopen. + @method reopenClass + **/ + static reopenClass(args?: {}): T; + + static detect(obj: any): boolean; + static detectInstance(obj: any): boolean; + + /** + Returns the original hash that was passed to meta(). + @method metaForProperty + @static + @param key {String} property name + **/ + static metaForProperty(key: string): {}; + + /** + Iterate over each computed property for the class, passing its name and any + associated metadata (see metaForProperty) to the callback. + + @method eachComputedProperty + @static + @param {Function} callback + @param {Object} binding + **/ + static eachComputedProperty(callback: Function, binding: {}): void; } /** An abstract class that exists to give view-like behavior to both Ember's main view class Ember.View @@ -1578,51 +1680,26 @@ declare module Ember { } var ORDER_DEFINITION: string[]; class Object extends CoreObject implements Observable { - /** - Creates a subclass of the Object class. - **/ - static extend(args?: CoreObjectArguments): T; - static extend(mixins? : Mixin, args?: CoreObjectArguments): T; - /** - Creates an instance of the class. - @param arguments A hash containing values with which to initialize the newly instantiated object. - **/ - static create(args?: {}): T; - /** - Equivalent to doing extend(arguments).create(). If possible use the normal create method instead. - **/ - static createWithMixins(args?: {}): T; - static detect(obj: any): boolean; - static detectInstance(obj: any): boolean; - /** - Iterate over each computed property for the class, passing its name and any - associated metadata (see metaForProperty) to the callback. - **/ - static eachComputedProperty(callback: Function, binding: {}): void; - /** - Returns the original hash that was passed to meta(). - @param key property name - **/ - static metaForProperty(key: string): {}; - /** - Augments a constructor's prototype with additional properties and functions. - To add functions and properties to the constructor itself, see reopenClass. - **/ - static reopen(args?: {}): T; - /** - Augments a constructor's own properties and functions. - To add functions and properties to instances of a constructor by extending the - constructor's prototype see reopen. - **/ - static reopenClass(args?: {}): T; - static isClass: boolean; - static isMethod: boolean; addObserver: ModifyObserver; beginPropertyChanges(): Observable; cacheFor(keyName: string): any; decrementProperty(keyName: string, decrement?: number): number; endPropertyChanges(): Observable; + + /** + * Retrieves the value of a property from the object + * @param keyName + * @returns {} + */ get(keyName: string): any; + + /** + * Retrieves the value of a property from the object + * @param keyName + * @returns {} + */ + get(keyName: string): T; + getProperties(...args: string[]): {}; getProperties(keys: string[]): {}; getWithDefault(keyName: string, defaultValue: any): any; @@ -1703,10 +1780,70 @@ declare module Ember { remove(obj: any): void; toArray(): any[]; } + + // FYI - RSVP source comes from https://github.com/tildeio/rsvp.js/blob/master/lib/rsvp/promise.js module RSVP { + interface PromiseResolve { + (value?: any): void; + } + interface PromiseReject { + (reason?: any): void; + } + interface PromiseResolverFunction { + (resolve: PromiseResolve, reject: PromiseReject): void; + } + class Promise { - constructor(resolver: Function, label?: string); - then(done?: Function, fail?: Function): Promise; + + /** + Promise objects represent the eventual result of an asynchronous operation. The + primary way of interacting with a promise is through its `then` method, which + registers callbacks to receive either a promise's eventual value or the reason + why the promise cannot be fulfilled. + @class RSVP.Promise + @param {function} resolver + @param {String} label optional string for labeling the promise. + Useful for tooling. + @constructor + */ + constructor(resolver: PromiseResolverFunction, label?: string); + + /** + The primary way of interacting with a promise is through its `then` method, + which registers callbacks to receive either a promise's eventual value or the + reason why the promise cannot be fulfilled. + @method then + @param {Function} onFulfilled + @param {Function} onRejected + @param {String} label optional string for labeling the promise. + Useful for tooling. + @return {Promise} + */ + then(onFulfilled?: Function, onRejected?: Function): Promise; + + /** + `catch` is simply sugar for `then(undefined, onRejection)` which makes it the same + as the catch block of a try/catch statement. + + @method catch + @param {Function} onRejection + @param {String} label optional string for labeling the promise. + Useful for tooling. + @return {Promise} + */ + catch(onRejection: Function, label?: string): Promise; + + /** + `finally` will be invoked regardless of the promise's fate just as native + try/catch/finally behaves + + @method finally + @param {Function} callback + @param {String} label optional string for labeling the promise. + Useful for tooling. + @return {Promise} + */ + finally(callback: Function, label?: string): Promise; } } class RenderBuffer { @@ -1728,41 +1865,531 @@ declare module Ember { elementTag: string; parentBuffer: RenderBuffer; } - class Route extends Object implements ActionHandlerMixin { - static detect(obj: any): boolean; - static detectInstance(obj: any): boolean; - /** - Iterate over each computed property for the class, passing its name and any - associated metadata (see metaForProperty) to the callback. - **/ - static eachComputedProperty(callback: Function, binding: {}): void; - /** - Returns the original hash that was passed to meta(). - @param key property name - **/ - static metaForProperty(key: string): {}; + + /** + The `Ember.Route` class is used to define individual routes. Refer to + the [routing guide](http://emberjs.com/guides/routing/) for documentation. + */ + class Route extends Object implements ActionHandlerMixin, Evented { + static isClass: boolean; static isMethod: boolean; + + /** + This hook is executed when the router enters the route. It is not executed + when the model for the route changes. + @method activate + */ activate: Function; + + /** + This hook is called after this route's model has resolved. + It follows identical async/promise semantics to `beforeModel` + but is provided the route's resolved model in addition to + the `transition`, and is therefore suited to performing + logic that can only take place after the model has already + resolved. + + Refer to documentation for `beforeModel` for a description + of transition-pausing semantics when a promise is returned + from this hook. + @method afterModel + @param {Object} resolvedModel the value returned from `model`, + or its resolved value if it was a promise + @param {Transition} transition + @return {Promise} if the value returned from this hook is + a promise, the transition will pause until the transition + resolves. Otherwise, non-promise return values are not + utilized in any way. + */ afterModel(resolvedModel: any, transition: EmberStates.Transition): RSVP.Promise; + + /** + This hook is the first of the route entry validation hooks + called when an attempt is made to transition into a route + or one of its children. It is called before `model` and + `afterModel`, and is appropriate for cases when: + 1) A decision can be made to redirect elsewhere without + needing to resolve the model first. + 2) Any async operations need to occur first before the + model is attempted to be resolved. + This hook is provided the current `transition` attempt + as a parameter, which can be used to `.abort()` the transition, + save it for a later `.retry()`, or retrieve values set + on it from a previous hook. You can also just call + `this.transitionTo` to another route to implicitly + abort the `transition`. + You can return a promise from this hook to pause the + transition until the promise resolves (or rejects). This could + be useful, for instance, for retrieving async code from + the server that is required to enter a route. + + @method beforeModel + @param {Transition} transition + @return {Promise} if the value returned from this hook is + a promise, the transition will pause until the transition + resolves. Otherwise, non-promise return values are not + utilized in any way. + */ beforeModel(transition: EmberStates.Transition): RSVP.Promise; + + /** + The controller associated with this route. + + @property controller + @type Ember.Controller + @since 1.6.0 + */ + controller: Controller; + + /** + Returns the controller for a particular route or name. + The controller instance must already have been created, either through entering the + associated route or using `generateController`. + + @method controllerFor + @param {String} name the name of the route or controller + @return {Ember.Controller} + */ controllerFor(name: string): Controller; + + /** + The name of the controller to associate with this route. + By default, Ember will lookup a route's controller that matches the name + of the route (i.e. `App.PostController` for `App.PostRoute`). However, + if you would like to define a specific controller to use, you can do so + using this property. + This is useful in many ways, as the controller specified will be: + * passed to the `setupController` method. + * used as the controller for the view being rendered by the route. + * returned from a call to `controllerFor` for the route. + @property controllerName + @type String + @default null + @since 1.4.0 + */ + controllerName: string; + + /** + This hook is executed when the router completely exits this route. It is + not executed when the model for the route changes. + @method deactivate + */ deactivate: Function; - disconnectOutlet(options?: DisconnectOutletOptions): void; - generateController(name: string, model: {}): void; - model(params: {}, transition: EmberStates.Transition): any; + + /** + Deserializes value of the query parameter based on defaultValueType + @method deserializeQueryParam + @param {Object} value + @param {String} urlKey + @param {String} defaultValueType + */ + deserializeQueryParam(value: any, urlKey: string, defaultValueType: string): any; + + /** + Disconnects a view that has been rendered into an outlet. + You may pass any or all of the following options to `disconnectOutlet`: + * `outlet`: the name of the outlet to clear (default: 'main') + * `parentView`: the name of the view containing the outlet to clear + (default: the view rendered by the parent route) + + @method disconnectOutlet + @param {Object|String} options the options hash or outlet name + */ + disconnectOutlet(options: DisconnectOutletOptions|string): void; + + /** + @method findModel + @param {String} type the model type + @param {Object} value the value passed to find + */ + findModel(type: string, value: any): any; + + /** + Generates a controller for a route. + If the optional model is passed then the controller type is determined automatically, + e.g., an ArrayController for arrays. + + @method generateController + @param {String} name the name of the controller + @param {Object} model the model to infer the type of the controller (optional) + */ + generateController(name: string, model: {}): Controller; + + /** + Perform a synchronous transition into another route without attempting + to resolve promises, update the URL, or abort any currently active + asynchronous transitions (i.e. regular transitions caused by + `transitionTo` or URL changes). + This method is handy for performing intermediate transitions on the + way to a final destination route, and is called internally by the + default implementations of the `error` and `loading` handlers. + @method intermediateTransitionTo + @param {String} name the name of the route + @param {...Object} models the model(s) to be used while transitioning + to the route. + @since 1.2.0 + */ + intermediateTransitionTo(name: string, ...models: any[]): void; + + /** + A hook you can implement to convert the URL into the model for + this route. + + @method model + @param {Object} params the parameters extracted from the URL + @param {Transition} transition + @return {Object|Promise} the model for this route. If + a promise is returned, the transition will pause until + the promise resolves, and the resolved value of the promise + will be used as the model for this route. + */ + model(params: {}, transition: EmberStates.Transition): any|RSVP.Promise; + + /** + Returns the model of a parent (or any ancestor) route + in a route hierarchy. During a transition, all routes + must resolve a model object, and if a route + needs access to a parent route's model in order to + resolve a model (or just reuse the model from a parent), + it can call `this.modelFor(theNameOfParentRoute)` to + retrieve it. + + @method modelFor + @param {String} name the name of the route + @return {Object} the model object + */ modelFor(name: string): {}; + + /** + Retrieves parameters, for current route using the state.params + variable and getQueryParamsFor, using the supplied routeName. + @method paramsFor + @param {String} name + */ + paramsFor(name: string) : any; + + /** + Configuration hash for this route's queryParams. + @property queryParams + @for Ember.Route + @type Hash + */ + queryParams: {}; + + /** + Refresh the model on this route and any child routes, firing the + `beforeModel`, `model`, and `afterModel` hooks in a similar fashion + to how routes are entered when transitioning in from other route. + The current route params (e.g. `article_id`) will be passed in + to the respective model hooks, and if a different model is returned, + `setupController` and associated route hooks will re-fire as well. + An example usage of this method is re-querying the server for the + latest information using the same parameters as when the route + was first entered. + Note that this will cause `model` hooks to fire even on routes + that were provided a model object when the route was initially + entered. + @method refresh + @return {Transition} the transition object associated with this + attempted transition + @since 1.4.0 + */ + redirect(): EmberStates.Transition; + + + /** + Refresh the model on this route and any child routes, firing the + `beforeModel`, `model`, and `afterModel` hooks in a similar fashion + to how routes are entered when transitioning in from other route. + The current route params (e.g. `article_id`) will be passed in + to the respective model hooks, and if a different model is returned, + `setupController` and associated route hooks will re-fire as well. + An example usage of this method is re-querying the server for the + latest information using the same parameters as when the route + was first entered. + Note that this will cause `model` hooks to fire even on routes + that were provided a model object when the route was initially + entered. + @method refresh + @return {Transition} the transition object associated with this + attempted transition + @since 1.4.0 + */ + refresh(): EmberStates.Transition; + + /** + `render` is used to render a template into a region of another template + (indicated by an `{{outlet}}`). `render` is used both during the entry + phase of routing (via the `renderTemplate` hook) and later in response to + user interaction. + + @method render + @param {String} name the name of the template to render + @param {Object} [options] the options + @param {String} [options.into] the template to render into, + referenced by name. Defaults to the parent template + @param {String} [options.outlet] the outlet inside `options.template` to render into. + Defaults to 'main' + @param {String|Object} [options.controller] the controller to use for this template, + referenced by name or as a controller instance. Defaults to the Route's paired controller + @param {Object} [options.model] the model object to set on `options.controller`. + Defaults to the return value of the Route's model hook + */ render(name: string, options?: RenderOptions): void; + + /** + A hook you can use to render the template for the current route. + This method is called with the controller for the current route and the + model supplied by the `model` hook. By default, it renders the route's + template, configured with the controller for the route. + This method can be overridden to set up and render additional or + alternative templates. + + @method renderTemplate + @param {Object} controller the route's controller + @param {Object} model the route's model + */ renderTemplate(controller: Controller, model: {}): void; - // ReSharper disable once InconsistentNaming - replaceWith(name: string, ...object: any[]): void; - send(name: string, ...args: any[]): void; + + /** + Transition into another route while replacing the current URL, if possible. + This will replace the current history entry instead of adding a new one. + Beside that, it is identical to `transitionTo` in all other respects. See + 'transitionTo' for additional information regarding multiple models. + + @method replaceWith + @param {String} name the name of the route or a URL + @param {...Object} models the model(s) or identifier(s) to be used while + transitioning to the route. + @return {Transition} the transition object associated with this + attempted transition + */ + replaceWith(name: string, ...models: any[]): void; + + /** + A hook you can use to reset controller values either when the model + changes or the route is exiting. + + @method resetController + @param {Controller} controller instance + @param {Boolean} isExiting + @param {Object} transition + @since 1.7.0 + */ + resetController(controller: Ember.Controller, isExiting: boolean, transition: any): void; + + /** + A hook you can implement to convert the route's model into parameters + for the URL. + + The default `serialize` method will insert the model's `id` into the + route's dynamic segment (in this case, `:post_id`) if the segment contains '_id'. + If the route has multiple dynamic segments or does not contain '_id', `serialize` + will return `Ember.getProperties(model, params)` + This method is called when `transitionTo` is called with a context + in order to populate the URL. + @method serialize + @param {Object} model the route's model + @param {Array} params an Array of parameter names for the current + route (in the example, `['post_id']`. + @return {Object} the serialized parameters + */ serialize(model: {}, params: string[]): string; + + /** + Serializes value of the query parameter based on defaultValueType + @method serializeQueryParam + @param {Object} value + @param {String} urlKey + @param {String} defaultValueType + */ + serializeQueryParam(value: any, urlKey: string, defaultValueType: string): string; + + /** + Serializes the query parameter key + @method serializeQueryParamKey + @param {String} controllerPropertyName + */ + serializeQueryParamKey(controllerPropertyName: string): string; + + /** + A hook you can use to setup the controller for the current route. + This method is called with the controller for the current route and the + model supplied by the `model` hook. + By default, the `setupController` hook sets the `model` property of + the controller to the `model`. + If you implement the `setupController` hook in your Route, it will + prevent this default behavior. If you want to preserve that behavior + when implementing your `setupController` function, make sure to call + `_super` + @method setupController + @param {Controller} controller instance + @param {Object} model + */ setupController(controller: Controller, model: {}): void; - // ReSharper disable once InconsistentNaming + + /** + Store property provides a hook for data persistence libraries to inject themselves. + By default, this store property provides the exact same functionality previously + in the model hook. + Currently, the required interface is: + `store.find(modelName, findArguments)` + @method store + @param {Object} store + */ + store(store: any): any; + + /** + The name of the template to use by default when rendering this routes + template. + This is similar with `viewName`, but is useful when you just want a custom + template without a view. + + @property templateName + @type String + @default null + @since 1.4.0 + */ + templateName: string; + + /** + Transition the application into another route. The route may + be either a single route or route path + + @method transitionTo + @param {String} name the name of the route or a URL + @param {...Object} models the model(s) or identifier(s) to be used while + transitioning to the route. + @param {Object} [options] optional hash with a queryParams property + containing a mapping of query parameters + @return {Transition} the transition object associated with this + attempted transition + */ transitionTo(name: string, ...object: any[]): EmberStates.Transition; + + /** + The name of the view to use by default when rendering this routes template. + When rendering a template, the route will, by default, determine the + template and view to use from the name of the route itself. If you need to + define a specific view, set this property. + This is useful when multiple routes would benefit from using the same view + because it doesn't require a custom `renderTemplate` method. + @property viewName + @type String + @default null + @since 1.4.0 + */ + viewName: string; + + // ActionHandlerMixin methods + + /** + Sends an action to the router, which will delegate it to the currently + active route hierarchy per the bubbling rules explained under actions + + @method send + @param {String} actionName The action to trigger + @param {*} context a context to send with the action + */ + send(name: string, ...args: any[]): void; + + /** + The collection of functions, keyed by name, available on this + `ActionHandler` as action targets. + These functions will be invoked when a matching `{{action}}` is triggered + from within a template and the application's current route is this route. + Actions can also be invoked from other parts of your application + via `ActionHandler#send`. + The `actions` hash will inherit action handlers from + the `actions` hash defined on extended parent classes + or mixins rather than just replace the entire hash. + + Within a Controller, Route, View or Component's action handler, + the value of the `this` context is the Controller, Route, View or + Component object: + + It is also possible to call `this._super.apply(this, arguments)` from within an + action handler if it overrides a handler defined on a parent + class or mixin. + + ## Bubbling + By default, an action will stop bubbling once a handler defined + on the `actions` hash handles it. To continue bubbling the action, + you must return `true` from the handler + + @property actions + @type Hash + @default null + */ actions: ActionsHash; + + // Evented methods + + /** + Subscribes to a named event with given function. + + An optional target can be passed in as the 2nd argument that will + be set as the "this" for the callback. This is a good way to give your + function access to the object triggering the event. When the target + parameter is used the callback becomes the third argument. + + @method on + @param {String} name The name of the event + @param {Object} [target] The "this" binding for the callback + @param {Function} method The callback to execute + @return this + */ + on(name: string, target: any, method: Function): Evented; + + /** + Subscribes a function to a named event and then cancels the subscription + after the first time the event is triggered. It is good to use ``one`` when + you only care about the first time an event has taken place. + This function takes an optional 2nd argument that will become the "this" + value for the callback. If this argument is passed then the 3rd argument + becomes the function. + + @method one + @param {String} name The name of the event + @param {Object} [target] The "this" binding for the callback + @param {Function} method The callback to execute + @return this + */ + one(name: string, target: any, method: Function): Evented; + + /** + Triggers a named event for the object. Any additional arguments + will be passed as parameters to the functions that are subscribed to the + event. + + @method trigger + @param {String} name The name of the event + @param {Object...} args Optional arguments to pass on + */ + trigger(name: string, ...args: string[]): void; + + /** + Cancels subscription for given name, target, and method. + + @method off + @param {String} name The name of the event + @param {Object} target The target of the subscription + @param {Function} method The function of the subscription + @return this + */ + off(name: string, target:any , method: Function): Evented; + + /** + Checks to see if object has any subscriptions for named event. + + @method has + @param {String} name The name of the event + @return {Boolean} does the object have a subscription for event + */ + has(name: string): boolean; } + class Router extends Object { static detect(obj: any): boolean; static detectInstance(obj: any): boolean; @@ -2203,7 +2830,7 @@ declare module Ember { function compare(v: any, w: any): number; // ReSharper disable once DuplicatingLocalDeclaration var computed: { - (callback: Function): ComputedProperty; + (...args: any[]): ComputedProperty; alias(dependentKey: string): ComputedProperty; and(...args: string[]): ComputedProperty; any(...args: string[]): ComputedProperty; @@ -2289,7 +2916,7 @@ declare module Ember { **/ var none: typeof deprecateFunc; function normalizeTuple(target: any, path: string): any[]; - function observer(func: Function, ...args: string[]): Function; + function observer(...args: any[]): Function; function observersFor(obj: any, path: string): any[]; function onLoad(name: string, callback: Function): void; function oneWay(obj: any, to: string, from: string): Binding; @@ -2470,6 +3097,9 @@ declare module Em { class Observable extends Ember.Observable { } class OrderedSet extends Ember.OrderedSet { } module RSVP { + interface PromiseResolve extends Ember.RSVP.PromiseResolve { } + interface PromiseReject extends Ember.RSVP.PromiseReject { } + interface PromiseResolverFunction extends Ember.RSVP.PromiseResolverFunction { } class Promise extends Ember.RSVP.Promise { } } class RenderBuffer extends Ember.RenderBuffer { } @@ -2711,6 +3341,9 @@ declare module "Ember" { class Observable extends Ember.Observable { } class OrderedSet extends Ember.OrderedSet { } module RSVP { + interface PromiseResolve extends Ember.RSVP.PromiseResolve { } + interface PromiseReject extends Ember.RSVP.PromiseReject { } + interface PromiseResolverFunction extends Ember.RSVP.PromiseResolverFunction { } class Promise extends Ember.RSVP.Promise { } } class RenderBuffer extends Ember.RenderBuffer { } diff --git a/es6-promise/es6-promise-tests.ts b/es6-promise/es6-promise-tests.ts index dc54f3b1b..0980ac26c 100644 --- a/es6-promise/es6-promise-tests.ts +++ b/es6-promise/es6-promise-tests.ts @@ -160,3 +160,32 @@ getJSON('story.json').then(function(story: Story) { }).then(function() { (document.querySelector('.spinner')).style.display = 'none'; }); + +interface T1 { + __t1: string; +} + +interface T2 { + __t2: string; +} + +interface T3 { + __t3: string; +} + +function f1(): Promise { + return Promise.resolve({ __t1: "foo_t1" }); +} + +function f2(x: T1): T2 { + return { __t2: x.__t1 + ":foo_21" }; +} + +var x3 = f1() + .then(f2, (e: Error) => { + console.log("error 1"); + throw e; +}) + .then((x: T2) => { + return { __t3: x.__t2 + "bar" }; +}); \ No newline at end of file diff --git a/es6-promise/es6-promise.d.ts b/es6-promise/es6-promise.d.ts index 4a793e540..86c82273a 100644 --- a/es6-promise/es6-promise.d.ts +++ b/es6-promise/es6-promise.d.ts @@ -4,7 +4,8 @@ // Definitions: https://github.com/borisyankov/DefinitelyTyped interface Thenable { - then(onFulfilled?: (value: R) => U | Thenable, onRejected?: (error: any) => U | Thenable): Thenable; + then(onFulfilled?: (value: R) => U | Thenable, onRejected?: (error: any) => U | Thenable): Thenable; + then(onFulfilled?: (value: R) => U | Thenable, onRejected?: (error: any) => void): Thenable; } declare class Promise implements Thenable { @@ -27,7 +28,8 @@ declare class Promise implements Thenable { * @param onFulfilled called when/if "promise" resolves * @param onRejected called when/if "promise" rejects */ - then(onFulfilled?: (value: R) => U | Thenable, onRejected?: (error: any) => U | Thenable): Promise; + then(onFulfilled?: (value: R) => U | Thenable, onRejected?: (error: any) => U | Thenable): Promise; + then(onFulfilled?: (value: R) => U | Thenable, onRejected?: (error: any) => void): Promise; /** * Sugar for promise.then(undefined, onRejected) diff --git a/express-validator/express-validator-tests.ts b/express-validator/express-validator-tests.ts new file mode 100644 index 000000000..74bd277e4 --- /dev/null +++ b/express-validator/express-validator-tests.ts @@ -0,0 +1,46 @@ +/// + +/* Usage Example from https://github.com/ctavan/express-validator */ + +import util = require('util') +import express = require('express') +import expressValidator = require('express-validator') +var app = express(); + +app.use(expressValidator()); + +app.post('/:urlparam', function(req: express.Request, res: express.Response) { + + // checkBody only checks req.body; none of the other req parameters + // Similarly checkParams only checks in req.params (URL params) and + // checkQuery only checks req.query (GET params). + req.checkBody('postparam', 'Invalid postparam').notEmpty().isInt(); + req.checkParams('urlparam', 'Invalid urlparam').isAlpha(); + req.checkQuery('getparam', 'Invalid getparam').isInt(); + req.checkHeader('testHeader', 'Invalid testHeader').isLowercase().isUppercase(); + req.checkFiles('testFiles', 'Invalid testFiles').isUrl(); + + + // OR assert can be used to check on all 3 types of params. + // req.assert('postparam', 'Invalid postparam').notEmpty().isInt(); + // req.assert('urlparam', 'Invalid urlparam').isAlpha(); + // req.assert('getparam', 'Invalid getparam').isInt(); + + req.sanitize('postparam').toBoolean(); + req.filter('postparam').toBoolean(); + + var errors = req.validationErrors(); + var mappedErrors = req.validationErrors(true); + + if (errors) { + res.status(400).send('There have been validation errors: ' + util.inspect(errors)); + return; + } + res.json({ + urlparam: req.param('urlparam'), + getparam: req.param('getparam'), + postparam: req.param('postparam') + }); +}); + +app.listen(8888); diff --git a/express-validator/express-validator.d.ts b/express-validator/express-validator.d.ts index 5a5df2fa0..7fc04f70e 100644 --- a/express-validator/express-validator.d.ts +++ b/express-validator/express-validator.d.ts @@ -1,173 +1,192 @@ -// Type definitions for express-validator +// Type definitions for express-validator 2.9.0 // Project: https://github.com/ctavan/express-validator // Definitions by: Nathan Ridley , Jonathan Häberle // Definitions: https://github.com/borisyankov/DefinitelyTyped /// +// Add RequestValidation Interface on to Express's Request Interface. +declare module Express { + interface Request extends ExpressValidator.RequestValidation {} +} +// External express-validator module. declare module "express-validator" { - import express = require('express'); + import express = require('express'); - module ExpressValidator { + /** + * + * @middlewareOptions see: https://github.com/ctavan/express-validator#middleware-options + */ + function ExpressValidator(middlewareOptions?:any):express.RequestHandler; - export interface ValidationError { - msg: string; - param: string; - } + export = ExpressValidator; +} - export interface RequestValidation { - check(field:string, message:string): Validator; - assert(field:string, message:string): Validator; - sanitize(field:string): Sanitizer; - onValidationError(func:(msg:string) => void): void; - validationErrors() : any; - } +// Internal Module. +declare module ExpressValidator { - export interface Validator { - /** - * Alias for regex() - */ - is(): Validator; - /** - * Alias for notRegex() - */ - not(): Validator; - isEmail(): Validator; - /** - * Accepts http, https, ftp - */ - isUrl(): Validator; - /** - * Combines isIPv4 and isIPv6 - */ - isIP(): Validator; - isIPv4(): Validator; - isIPv6(): Validator; - isAlpha(): Validator; - isAlphanumeric(): Validator; - isNumeric(): Validator; - isHexadecimal(): Validator; - /** - * Accepts valid hexcolors with or without # prefix - */ - isHexColor(): Validator; - /** - * isNumeric accepts zero padded numbers, e.g. '001', isInt doesn't - */ - isInt(): Validator; - isLowercase(): Validator; - isUppercase(): Validator; - isDecimal(): Validator; - /** - * Alias for isDecimal - */ - isFloat(): Validator; - /** - * Check if length is 0 - */ - notNull(): Validator; - isNull(): Validator; - /** - * Not just whitespace (input.trim().length !== 0) - */ - notEmpty(): Validator; - equals(equals:any): Validator; - contains(str:string): Validator; - notContains(str:string): Validator; - /** - * Usage: regex(/[a-z]/i) or regex('[a-z]','i') - */ - regex(pattern:string, modifiers:string): Validator; - notRegex(pattern:string, modifiers:string): Validator; - /** - * max is optional - */ - len(min:number, max?:number): Validator; - /** - * Version can be 3, 4 or 5 or empty, see http://en.wikipedia.org/wiki/Universally_unique_identifier - */ - isUUID(version:number): Validator; - /** - * Alias for isUUID(3) - */ - isUUIDv3(): Validator; - /** - * Alias for isUUID(4) - */ - isUUIDv4(): Validator; - /** - * Alias for isUUID(5) - */ - isUUIDv5(): Validator; - /** - * Uses Date.parse() - regex is probably a better choice - */ - isDate(): Validator; - /** - * Argument is optional and defaults to today. Comparison is non-inclusive - */ - isAfter(date:Date): Validator; - /** - * Argument is optional and defaults to today. Comparison is non-inclusive - */ - isBefore(date:Date): Validator; - isIn(options:string): Validator; - isIn(options:string[]): Validator; - notIn(options:string): Validator; - notIn(options:string[]): Validator; - max(val:string): Validator; - min(val:string): Validator; - /** - * Will work against Visa, MasterCard, American Express, Discover, Diners Club, and JCB card numbering formats - */ - isCreditCard(): Validator; - } + export interface ValidationError { + msg: string; + param: string; + } - interface Sanitizer { - /** - * Trim optional `chars`, default is to trim whitespace (\r\n\t ) - */ - trim(...chars:string[]): Sanitizer; - ltrim(...chars:string[]): Sanitizer; - rtrim(...chars:string[]): Sanitizer; - ifNull(replace:any): Sanitizer; - toFloat(): Sanitizer; - toInt(): Sanitizer; - /** - * True unless str = '0', 'false', or str.length == 0 - */ - toBoolean(): Sanitizer; - /** - * False unless str = '1' or 'true' - */ - toBooleanStrict(): Sanitizer; - /** - * Decode HTML entities - */ - entityDecode(): Sanitizer; - entityEncode(): Sanitizer; - /** - * Escape &, <, >, and " - */ - escape(): Sanitizer; - /** - * Remove common XSS attack vectors from user-supplied HTML - */ - xss(): Sanitizer; - /** - * Remove common XSS attack vectors from images - */ - xss(fromImages:boolean): Sanitizer; - } - } + interface ValidatorFunction { (item: string, message: string): Validator; } + interface SanitizerFunction { (item: string): Sanitizer; } + interface Dictionary { [key: string]: T; } - /** - * - * @middlewareOptions see: https://github.com/ctavan/express-validator#middleware-options - */ - function ExpressValidator(middlewareOptions?:any):express.RequestHandler; + export interface RequestValidation { + assert: ValidatorFunction; + check: ValidatorFunction; + checkBody: ValidatorFunction; + checkFiles: ValidatorFunction; + checkHeader: ValidatorFunction; + checkParams: ValidatorFunction; + checkQuery: ValidatorFunction; + validate: ValidatorFunction; + filter: SanitizerFunction; + sanitize: SanitizerFunction; - export = ExpressValidator; + onValidationError(errback: (msg: string) => void): void; + validationErrors(mapped?: boolean): Dictionary | any[]; + } + + export interface Validator { + /** + * Alias for regex() + */ + is(): Validator; + /** + * Alias for notRegex() + */ + not(): Validator; + isEmail(): Validator; + /** + * Accepts http, https, ftp + */ + isUrl(): Validator; + /** + * Combines isIPv4 and isIPv6 + */ + isIP(): Validator; + isIPv4(): Validator; + isIPv6(): Validator; + isAlpha(): Validator; + isAlphanumeric(): Validator; + isNumeric(): Validator; + isHexadecimal(): Validator; + /** + * Accepts valid hexcolors with or without # prefix + */ + isHexColor(): Validator; + /** + * isNumeric accepts zero padded numbers, e.g. '001', isInt doesn't + */ + isInt(): Validator; + isLowercase(): Validator; + isUppercase(): Validator; + isDecimal(): Validator; + /** + * Alias for isDecimal + */ + isFloat(): Validator; + /** + * Check if length is 0 + */ + notNull(): Validator; + isNull(): Validator; + /** + * Not just whitespace (input.trim().length !== 0) + */ + notEmpty(): Validator; + equals(equals:any): Validator; + contains(str:string): Validator; + notContains(str:string): Validator; + /** + * Usage: regex(/[a-z]/i) or regex('[a-z]','i') + */ + regex(pattern:string, modifiers:string): Validator; + notRegex(pattern:string, modifiers:string): Validator; + /** + * max is optional + */ + len(min:number, max?:number): Validator; + /** + * Version can be 3, 4 or 5 or empty, see http://en.wikipedia.org/wiki/Universally_unique_identifier + */ + isUUID(version:number): Validator; + /** + * Alias for isUUID(3) + */ + isUUIDv3(): Validator; + /** + * Alias for isUUID(4) + */ + isUUIDv4(): Validator; + /** + * Alias for isUUID(5) + */ + isUUIDv5(): Validator; + /** + * Uses Date.parse() - regex is probably a better choice + */ + isDate(): Validator; + /** + * Argument is optional and defaults to today. Comparison is non-inclusive + */ + isAfter(date:Date): Validator; + /** + * Argument is optional and defaults to today. Comparison is non-inclusive + */ + isBefore(date:Date): Validator; + isIn(options:string): Validator; + isIn(options:string[]): Validator; + notIn(options:string): Validator; + notIn(options:string[]): Validator; + max(val:string): Validator; + min(val:string): Validator; + /** + * Will work against Visa, MasterCard, American Express, Discover, Diners Club, and JCB card numbering formats + */ + isCreditCard(): Validator; + } + + interface Sanitizer { + /** + * Trim optional `chars`, default is to trim whitespace (\r\n\t ) + */ + trim(...chars:string[]): Sanitizer; + ltrim(...chars:string[]): Sanitizer; + rtrim(...chars:string[]): Sanitizer; + ifNull(replace:any): Sanitizer; + toFloat(): Sanitizer; + toInt(): Sanitizer; + /** + * True unless str = '0', 'false', or str.length == 0 + */ + toBoolean(): Sanitizer; + /** + * False unless str = '1' or 'true' + */ + toBooleanStrict(): Sanitizer; + /** + * Decode HTML entities + */ + entityDecode(): Sanitizer; + entityEncode(): Sanitizer; + /** + * Escape &, <, >, and " + */ + escape(): Sanitizer; + /** + * Remove common XSS attack vectors from user-supplied HTML + */ + xss(): Sanitizer; + /** + * Remove common XSS attack vectors from images + */ + xss(fromImages:boolean): Sanitizer; + } + } diff --git a/express/express.d.ts b/express/express.d.ts index e31332077..0bd42b82f 100644 --- a/express/express.d.ts +++ b/express/express.d.ts @@ -349,6 +349,11 @@ declare module "express" { /** * Parse the "Host" header field hostname. */ + hostname: string; + + /** + * @deprecated Use hostname instead. + */ host: string; /** @@ -537,19 +542,19 @@ declare module "express" { sendFile(path: string, options: any, fn: Errback): void; /** - * deprecated, use sendFile instead. + * @deprecated Use sendFile instead. */ sendfile(path: string): void; /** - * deprecated, use sendFile instead. + * @deprecated Use sendFile instead. */ sendfile(path: string, options: any): void; /** - * deprecated, use sendFile instead. + * @deprecated Use sendFile instead. */ sendfile(path: string, fn: Errback): void; /** - * deprecated, use sendFile instead. + * @deprecated Use sendFile instead. */ sendfile(path: string, options: any, fn: Errback): void; diff --git a/eyes/eyes-tests.ts b/eyes/eyes-tests.ts new file mode 100644 index 000000000..3182195dd --- /dev/null +++ b/eyes/eyes-tests.ts @@ -0,0 +1,29 @@ +/// + +import eyes = require('eyes'); + +var testObj = { + color: 'red', + num: 227 +} + +eyes.inspect(testObj) + +var options = { + styles: { + all: 'green', + label: 'red', + other: 'red', + key: 'red', + special: 'red', + 'string': 'red', + 'number': 'red', + bool: 'red', + regexp: 'red' + }, + + pretty: false, + hideFunctions: true, + stream: process.stdout, + maxLength: 120 +} \ No newline at end of file diff --git a/eyes/eyes.d.ts b/eyes/eyes.d.ts new file mode 100644 index 000000000..091916821 --- /dev/null +++ b/eyes/eyes.d.ts @@ -0,0 +1,54 @@ +// Type definitions for eyes 0.1.8 +// Project: https://github.com/cloudhead/eyes.js +// Definitions by: bryn austin bellomy +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module "eyes" +{ + import stream = require('stream'); + + export function inspector(options?:EyesOptions): InspectorFunction; + export function inspect(thing:any, label?:string): void; + + export interface InspectorFunction { + (thing:any, label?:string): void; + } + + export interface EyesOptions + { + /** Styles applied to stdout */ + styles?: { + /** Overall base style applied to everything */ + all?: string; + /** Style when printing inspection labels, like 'array' in `array: [1, 2, 3]` */ + label?: string; + /** Style when printing objects which don't have a literal representation, such as functions */ + other?: string; + /** Style when printing the keys in object literals, like 'a' in `{a: 1}` */ + key?: string; + /** Style when printing `null`, `undefined`, etc. */ + special?: string; + /** Style when printing strings */ + string?: string; + /** Style when printing numbers */ + number?: string; + /** Style when printing booleans */ + bool?: string; + /** Style when printing RegExps */ + regexp?: string; + }; + + /** Indent object literals */ + pretty?: boolean; + /** Don't output functions at all */ + hideFunctions?: boolean; + /** Stream to write to, or null */ + stream?: stream.Writable; + /** Truncate output if longer */ + maxLength?: number; + } +} + + diff --git a/fabricjs/fabricjs-tests.ts b/fabricjs/fabricjs-tests.ts index e59212d80..c3dfd8d6d 100644 --- a/fabricjs/fabricjs-tests.ts +++ b/fabricjs/fabricjs-tests.ts @@ -1,1065 +1,1063 @@ /// function sample1() { - var canvas = new fabric.Canvas('c', { - hoverCursor: 'pointer', - selection: false, + var canvas = new fabric.Canvas('c', { + hoverCursor: 'pointer', + selection: false, + }); + + canvas.on('object:moving', function(e: fabric.IEvent) { + e.target.opacity = 0.5; + }); + canvas.on('object:modified', function(e: fabric.IEvent) { + e.target.opacity = 1; + }); + + for (var i = 0, len = 15; i < len; i++) { + fabric.Image.fromURL('../assets/ladybug.png', function(img) { + img.set({ + left: fabric.util.getRandomInt(0, 600), + top: fabric.util.getRandomInt(0, 500), + angle: fabric.util.getRandomInt(0, 90) + }); + + img.perPixelTargetFind = true; + // img.targetFindTolerance = 4; + img.hasControls = img.hasBorders = false; + + img.scale(fabric.util.getRandomInt(50, 100) / 100); + + canvas.add(img); }); - - canvas.on({ - 'object:moving': function (e) { - (e.target).opacity = 0.5; - }, - 'object:modified': function (e) { - (e.target).opacity = 1; - } - }); - - for (var i = 0, len = 15; i < len; i++) { - fabric.Image.fromURL('../assets/ladybug.png', function (img) { - img.set({ - left: fabric.util.getRandomInt(0, 600), - top: fabric.util.getRandomInt(0, 500), - angle: fabric.util.getRandomInt(0, 90) - }); - - img.perPixelTargetFind = true; - // img.targetFindTolerance = 4; - img.hasControls = img.hasBorders = false; - - img.scale(fabric.util.getRandomInt(50, 100) / 100); - - canvas.add(img); - }); - } + } } function sample2() { - var dot, i, - t1, t2, - startTimer = function () { - t1 = new Date().getTime(); - return t1; - }, - stopTimer = function () { - t2 = new Date().getTime(); - return t2 - t1; - }, - getRandomInt = fabric.util.getRandomInt, - rainbow = ["#ffcc66", "#ccff66", "#66ccff", "#ff6fcf", "#ff6666"], - rainbowEnd = rainbow.length - 1; + var dot, i, + t1, t2, + startTimer = function() { + t1 = new Date().getTime(); + return t1; + }, + stopTimer = function() { + t2 = new Date().getTime(); + return t2 - t1; + }, + getRandomInt = fabric.util.getRandomInt, + rainbow = ["#ffcc66", "#ccff66", "#66ccff", "#ff6fcf", "#ff6666"], + rainbowEnd = rainbow.length - 1; - // - // Rendering canvas #1 - // - var canvas1 = new fabric.Canvas('c1', { backgroundColor: "#000" }), - results1 = document.getElementById('results-c1'); + // + // Rendering canvas #1 + // + var canvas1 = new fabric.Canvas('c1', { backgroundColor: "#000" }), + results1 = document.getElementById('results-c1'); - startTimer(); - for (i = 100; i >= 0; i--) { - dot = new fabric.Circle({ - left: getRandomInt(0, 400), - top: getRandomInt(0, 350), - radius: 3, - fill: rainbow[getRandomInt(0, rainbowEnd)] - }); - canvas1.add(dot); - } - results1.innerHTML = 'Regular rendering of 100 elements in ' + stopTimer() + 'ms'; + startTimer(); + for (i = 100; i >= 0; i--) { + dot = new fabric.Circle({ + left: getRandomInt(0, 400), + top: getRandomInt(0, 350), + radius: 3, + fill: rainbow[getRandomInt(0, rainbowEnd)] + }); + canvas1.add(dot); + } + results1.innerHTML = 'Regular rendering of 100 elements in ' + stopTimer() + 'ms'; - // - // Rendering canvas #2 - // - var canvas2 = new fabric.Canvas('c2', { backgroundColor: "#000", renderOnAddition: false }), - results2 = document.getElementById('results-c2'); + // + // Rendering canvas #2 + // + var canvas2 = new fabric.Canvas('c2', { backgroundColor: "#000", renderOnAddition: false }), + results2 = document.getElementById('results-c2'); - startTimer(); - for (i = 1000; i >= 0; i--) { - dot = new fabric.Circle({ - left: getRandomInt(0, 400), - top: getRandomInt(0, 350), - radius: 3, - fill: rainbow[getRandomInt(0, rainbowEnd)] - }); - canvas2.add(dot); - } - canvas2.renderAll(); // Note, calling renderAll() is important in this case - results2.innerHTML = 'Rendering 1000 elements using canvas.renderOnAddition = false in ' + stopTimer() + 'ms'; + startTimer(); + for (i = 1000; i >= 0; i--) { + dot = new fabric.Circle({ + left: getRandomInt(0, 400), + top: getRandomInt(0, 350), + radius: 3, + fill: rainbow[getRandomInt(0, rainbowEnd)] + }); + canvas2.add(dot); + } + canvas2.renderAll(); // Note, calling renderAll() is important in this case + results2.innerHTML = 'Rendering 1000 elements using canvas.renderOnAddition = false in ' + stopTimer() + 'ms'; } function sample3() { - var $ = function (id) {return document.getElementById(id) }; + var $ = function(id) { return document.getElementById(id) }; - function applyFilter(index, filter) { - var obj = canvas.getActiveObject(); - obj.filters[index] = filter; - obj.applyFilters(canvas.renderAll.bind(canvas)); - } - - function applyFilterValue(index, prop, value) { - var obj = canvas.getActiveObject(); - if (obj.filters[index]) { - obj.filters[index][prop] = value; - obj.applyFilters(canvas.renderAll.bind(canvas)); - } - } - - var canvas = new fabric.Canvas('c', { backgroundImage: '../lib/bg.png' }), - f = fabric.Image.filters; - - canvas.on({ - 'object:selected': function () { - fabric.util.toArray(document.getElementsByTagName('input')).forEach(function (el) { el.disabled = false; }) - - var filters = ['grayscale', 'invert', 'remove-white', 'sepia', 'sepia2', 'brightness', - 'noise', 'gradient-transparency', 'pixelate', 'blur', 'sharpen']; - - for (var i = 0; i < filters.length; i++) { - var checkBox = $(filters[i]); - var image = canvas.getActiveObject(); - checkBox.checked = !!image.filters[i]; - } - }, - 'selection:cleared': function () { - fabric.util.toArray(document.getElementsByTagName('input')).forEach(function (el) { el.disabled = true; }) + function applyFilter(index, filter) { + var obj = canvas.getActiveObject(); + obj.filters[index] = filter; + obj.applyFilters(canvas.renderAll.bind(canvas)); } - }); - fabric.Image.fromURL('../assets/printio.png', function (img) { - var oImg = img.set({ left: 300, top: 300, angle: -15 }).scale(0.9); - canvas.add(oImg).renderAll(); - canvas.setActiveObject(oImg); - }); + function applyFilterValue(index, prop, value) { + var obj = canvas.getActiveObject(); + if (obj.filters[index]) { + obj.filters[index][prop] = value; + obj.applyFilters(canvas.renderAll.bind(canvas)); + } + } - $('grayscale').onclick = function () { - applyFilter(0, this.checked && new f.Grayscale()); - }; - $('invert').onclick = function () { - applyFilter(1, this.checked && new f.Invert()); - }; - $('remove-white').onclick = function () { - applyFilter(2, this.checked && new f.RemoveWhite({ - threshold: ($('remove-white-threshold')).value, - distance: ($('remove-white-distance')).value - })); - }; - $('remove-white-threshold').onchange = function () { - applyFilterValue(2, 'threshold', this.value); - }; - $('remove-white-distance').onchange = function () { - applyFilterValue(2, 'distance', this.value); - }; - $('sepia').onclick = function () { - applyFilter(3, this.checked && new f.Sepia()); - }; - $('sepia2').onclick = function () { - applyFilter(4, this.checked && new f.Sepia2()); - }; - $('brightness').onclick = function () { - applyFilter(5, this.checked && new f.Brightness({ - brightness: parseInt(($('brightness-value')).value, 10) - })); - }; - $('brightness-value').onchange = function () { - applyFilterValue(5, 'brightness', parseInt(this.value, 10)); - }; - $('noise').onclick = function () { - applyFilter(6, this.checked && new f.Noise({ - noise: parseInt(($('noise-value')).value, 10) - })); - }; - $('noise-value').onchange = function () { - applyFilterValue(6, 'noise', parseInt(this.value, 10)); - }; - $('gradient-transparency').onclick = function () { - applyFilter(7, this.checked && new f.GradientTransparency({ - threshold: parseInt(($('gradient-transparency-value')).value, 10) - })); - }; - $('gradient-transparency-value').onchange = function () { - applyFilterValue(7, 'threshold', parseInt(this.value, 10)); - }; - $('pixelate').onclick = function () { - applyFilter(8, this.checked && new f.Pixelate({ - blocksize: parseInt(($('pixelate-value')).value, 10) - })); - }; - $('pixelate-value').onchange = function () { - applyFilterValue(8, 'blocksize', parseInt(this.value, 10)); - }; - $('blur').onclick = function () { - applyFilter(9, this.checked && new f.Convolute({ - matrix: [1 / 9, 1 / 9, 1 / 9, - 1 / 9, 1 / 9, 1 / 9, - 1 / 9, 1 / 9, 1 / 9] - })); - }; - $('sharpen').onclick = function () { - applyFilter(10, this.checked && new f.Convolute({ - matrix: [0, -1, 0, - -1, 5, -1, - 0, -1, 0] - })); - }; - $('emboss').onclick = function () { - applyFilter(11, this.checked && new f.Convolute({ - matrix: [1, 1, 1, - 1, 0.7, -1, - -1, -1, -1] - })); - }; + var canvas = new fabric.Canvas('c', { backgroundImage: '../lib/bg.png' }), + f = fabric.Image.filters; + + canvas.on({ + 'object:selected': function() { + fabric.util.toArray(document.getElementsByTagName('input')).forEach(function(el) { el.disabled = false; }) + + var filters = ['grayscale', 'invert', 'remove-white', 'sepia', 'sepia2', 'brightness', + 'noise', 'gradient-transparency', 'pixelate', 'blur', 'sharpen']; + + for (var i = 0; i < filters.length; i++) { + var checkBox = $(filters[i]); + var image = canvas.getActiveObject(); + checkBox.checked = !!image.filters[i]; + } + }, + 'selection:cleared': function() { + fabric.util.toArray(document.getElementsByTagName('input')).forEach(function(el) { el.disabled = true; }) + } + }); + + fabric.Image.fromURL('../assets/printio.png', function(img) { + var oImg = img.set({ left: 300, top: 300, angle: -15 }).scale(0.9); + canvas.add(oImg).renderAll(); + canvas.setActiveObject(oImg); + }); + + $('grayscale').onclick = function() { + applyFilter(0, this.checked && new f.Grayscale()); + }; + $('invert').onclick = function() { + applyFilter(1, this.checked && new f.Invert()); + }; + $('remove-white').onclick = function() { + applyFilter(2, this.checked && new f.RemoveWhite({ + threshold: parseInt(($('remove-white-threshold')).value), + distance: parseInt(($('remove-white-distance')).value) + })); + }; + $('remove-white-threshold').onchange = function() { + applyFilterValue(2, 'threshold', this.value); + }; + $('remove-white-distance').onchange = function() { + applyFilterValue(2, 'distance', this.value); + }; + $('sepia').onclick = function() { + applyFilter(3, this.checked && new f.Sepia()); + }; + $('sepia2').onclick = function() { + applyFilter(4, this.checked && new f.Sepia2()); + }; + $('brightness').onclick = function() { + applyFilter(5, this.checked && new f.Brightness({ + brightness: parseInt(($('brightness-value')).value, 10) + })); + }; + $('brightness-value').onchange = function() { + applyFilterValue(5, 'brightness', parseInt(this.value, 10)); + }; + $('noise').onclick = function() { + applyFilter(6, this.checked && new f.Noise({ + noise: parseInt(($('noise-value')).value, 10) + })); + }; + $('noise-value').onchange = function() { + applyFilterValue(6, 'noise', parseInt(this.value, 10)); + }; + $('gradient-transparency').onclick = function() { + applyFilter(7, this.checked && new f.GradientTransparency({ + threshold: parseInt(($('gradient-transparency-value')).value, 10) + })); + }; + $('gradient-transparency-value').onchange = function() { + applyFilterValue(7, 'threshold', parseInt(this.value, 10)); + }; + $('pixelate').onclick = function() { + applyFilter(8, this.checked && new f.Pixelate({ + blocksize: parseInt(($('pixelate-value')).value, 10) + })); + }; + $('pixelate-value').onchange = function() { + applyFilterValue(8, 'blocksize', parseInt(this.value, 10)); + }; + $('blur').onclick = function() { + applyFilter(9, this.checked && new f.Convolute({ + matrix: [1 / 9, 1 / 9, 1 / 9, + 1 / 9, 1 / 9, 1 / 9, + 1 / 9, 1 / 9, 1 / 9] + })); + }; + $('sharpen').onclick = function() { + applyFilter(10, this.checked && new f.Convolute({ + matrix: [0, -1, 0, + -1, 5, -1, + 0, -1, 0] + })); + }; + $('emboss').onclick = function() { + applyFilter(11, this.checked && new f.Convolute({ + matrix: [1, 1, 1, + 1, 0.7, -1, + -1, -1, -1] + })); + }; } function sample4() { - var canvas = new fabric.Canvas('c'); - var $ = function (id) { return document.getElementById(id); }; + var canvas = new fabric.Canvas('c'); + var $ = function(id) { return document.getElementById(id); }; - var rect = new fabric.Rect({ - width: 100, - height: 100, - top: 150, - left: 150, - fill: 'rgba(255,0,0,0.5)' - }); + var rect = new fabric.Rect({ + width: 100, + height: 100, + top: 150, + left: 150, + fill: 'rgba(255,0,0,0.5)' + }); - canvas.add(rect); + canvas.add(rect); - var angleControl = $('angle-control'); - angleControl.onchange = function () { - rect.setAngle(this.value).setCoords(); - canvas.renderAll(); - }; + var angleControl = $('angle-control'); + angleControl.onchange = function() { + rect.setAngle(this.value).setCoords(); + canvas.renderAll(); + }; - var scaleControl = $('scale-control'); - scaleControl.onchange = function () { - rect.scale(this.value).setCoords(); - canvas.renderAll(); - }; + var scaleControl = $('scale-control'); + scaleControl.onchange = function() { + rect.scale(this.value).setCoords(); + canvas.renderAll(); + }; - var topControl = $('top-control'); - topControl.onchange = function () { - rect.setTop(this.value).setCoords(); - canvas.renderAll(); - }; + var topControl = $('top-control'); + topControl.onchange = function() { + rect.setTop(this.value).setCoords(); + canvas.renderAll(); + }; - var leftControl = $('left-control'); - leftControl.onchange = function () { - rect.setLeft(this.value).setCoords(); - canvas.renderAll(); - }; + var leftControl = $('left-control'); + leftControl.onchange = function() { + rect.setLeft(this.value).setCoords(); + canvas.renderAll(); + }; - function updateControls() { + function updateControls() { - scaleControl.value = rect.getScaleX().toString(); - angleControl.value = rect.getAngle().toString(); - leftControl.value = rect.getLeft().toString(); - topControl.value = rect.getTop().toString(); - } - canvas.on({ - 'object:moving': updateControls, - 'object:scaling': updateControls, - 'object:resizing': updateControls - }); + scaleControl.value = rect.getScaleX().toString(); + angleControl.value = rect.getAngle().toString(); + leftControl.value = rect.getLeft().toString(); + topControl.value = rect.getTop().toString(); + } + canvas.on({ + 'object:moving': updateControls, + 'object:scaling': updateControls, + 'object:resizing': updateControls + }); } module fabric { - export interface CircleWithLineInfos extends ICircle { - line1?: ILine; - line2?: ILine; - line3?: ILine; - line4?: ILine; - } + export interface CircleWithLineInfos extends ICircle { + line1?: ILine; + line2?: ILine; + line3?: ILine; + line4?: ILine; + } } function sample5() { - var makeCircle = function (left: number, top: number, line1?: fabric.ILine, line2?: fabric.ILine, line3?: fabric.ILine, line4?: fabric.ILine): fabric.ICircle { - var c = new fabric.Circle({ - left: left, - top: top, - strokeWidth: 5, - radius: 12, - fill: '#fff', - stroke: '#666' - }); - - c.line1 = line1; - c.line2 = line2; - c.line3 = line3; - c.line4 = line4; - c.hasControls = c.hasBorders = false; - return c; - } - -function makeLine(coords: number[]) { - return new fabric.Line(coords, { - fill: 'red', - strokeWidth: 5, - selectable: false - }); - } - - var canvas = new fabric.Canvas('c', { selection: false }); - - var line = makeLine([250, 125, 250, 175]), - line2 = makeLine([250, 175, 250, 250]), - line3 = makeLine([250, 250, 300, 350]), - line4 = makeLine([250, 250, 200, 350]), - line5 = makeLine([250, 175, 175, 225]), - line6 = makeLine([250, 175, 325, 225]); - - canvas.add(line, line2, line3, line4, line5, line6); - - canvas.add( - makeCircle(line.x1, line.y1, null, line), - makeCircle(line.x2, line.y2, line, line2, line5, line6), - makeCircle(line2.x2, line2.y2, line2, line3, line4), - makeCircle(line3.x2, line3.y2, line3), - makeCircle(line4.x2, line4.y2, line4), - makeCircle(line5.x2, line5.y2, line5), - makeCircle(line6.x2, line6.y2, line6) - ); - - canvas.on('object:moving', function (e) { - var p = e.target; - p.line1 && p.line1.set({ 'x2': p.left, 'y2': p.top }); - p.line2 && p.line2.set({ 'x1': p.left, 'y1': p.top }); - p.line3 && p.line3.set({ 'x1': p.left, 'y1': p.top }); - p.line4 && p.line4.set({ 'x1': p.left, 'y1': p.top }); - canvas.renderAll(); + var makeCircle = function(left: number, top: number, line1?: fabric.ILine, line2?: fabric.ILine, line3?: fabric.ILine, line4?: fabric.ILine): fabric.ICircle { + var c = new fabric.Circle({ + left: left, + top: top, + strokeWidth: 5, + radius: 12, + fill: '#fff', + stroke: '#666' }); + + c.line1 = line1; + c.line2 = line2; + c.line3 = line3; + c.line4 = line4; + c.hasControls = c.hasBorders = false; + return c; + } + + function makeLine(coords: number[]) { + return new fabric.Line(coords, { + fill: 'red', + strokeWidth: 5, + selectable: false + }); + } + + var canvas = new fabric.Canvas('c', { selection: false }); + + var line = makeLine([250, 125, 250, 175]), + line2 = makeLine([250, 175, 250, 250]), + line3 = makeLine([250, 250, 300, 350]), + line4 = makeLine([250, 250, 200, 350]), + line5 = makeLine([250, 175, 175, 225]), + line6 = makeLine([250, 175, 325, 225]); + + canvas.add(line, line2, line3, line4, line5, line6); + + canvas.add( + makeCircle(line.x1, line.y1, null, line), + makeCircle(line.x2, line.y2, line, line2, line5, line6), + makeCircle(line2.x2, line2.y2, line2, line3, line4), + makeCircle(line3.x2, line3.y2, line3), + makeCircle(line4.x2, line4.y2, line4), + makeCircle(line5.x2, line5.y2, line5), + makeCircle(line6.x2, line6.y2, line6) + ); + + canvas.on('object:moving', function(e) { + var p = e.target; + p.line1 && p.line1.set({ 'x2': p.left, 'y2': p.top }); + p.line2 && p.line2.set({ 'x1': p.left, 'y1': p.top }); + p.line3 && p.line3.set({ 'x1': p.left, 'y1': p.top }); + p.line4 && p.line4.set({ 'x1': p.left, 'y1': p.top }); + canvas.renderAll(); + }); } function sample6() { - var canvas = new fabric.Canvas('c'); - fabric.loadSVGFromURL('../assets/135.svg', function (objects) { - var obj = objects[0].scale(0.25); - canvas.centerObject(obj); - canvas.add(obj); + var canvas = new fabric.Canvas('c'); + fabric.loadSVGFromURL('../assets/135.svg', function(objects) { + var obj = objects[0].scale(0.25); + canvas.centerObject(obj); + canvas.add(obj); - canvas.add(obj.clone().set({ left: 100, top: 100, angle: -15 })); - canvas.add(obj.clone().set({ left: 480, top: 100, angle: 15 })); - canvas.add(obj.clone().set({ left: 100, top: 400, angle: -15 })); - canvas.add(obj.clone().set({ left: 480, top: 400, angle: 15 })); + canvas.add(obj.clone(() => {}).set({ left: 100, top: 100, angle: -15 })); + canvas.add(obj.clone(() => {}).set({ left: 480, top: 100, angle: 15 })); + canvas.add(obj.clone(() => {}).set({ left: 100, top: 400, angle: -15 })); + canvas.add(obj.clone(() => {}).set({ left: 480, top: 400, angle: 15 })); - canvas.on('mouse:move', function (options) { - var p = canvas.getPointer(options.e); + canvas.on('mouse:move', function(options) { + var p = canvas.getPointer(options.e); - canvas.forEachObject(function (obj) { - var distX = Math.abs(p.x - obj.left), - distY = Math.abs(p.y - obj.top), - dist = Math.round(Math.sqrt(Math.pow(distX, 2) + Math.pow(distY, 2))); - obj.setOpacity(1 / (dist / 20)); - }); - - }); + canvas.forEachObject(function(obj) { + var distX = Math.abs(p.x - obj.left), + distY = Math.abs(p.y - obj.top), + dist = Math.round(Math.sqrt(Math.pow(distX, 2) + Math.pow(distY, 2))); + obj.setOpacity(1 / (dist / 20)); + }); }); + + }); } module fabric { - export interface ImageWithInfo extends IImage { - movingLeft: boolean; - } + export interface ImageWithInfo extends IImage { + movingLeft: boolean; + } } function sample7() { - var canvas = new fabric.Canvas('c', { selection: false }); + var canvas = new fabric.Canvas('c', { selection: false }); - setInterval(function () { - fabric.Image.fromURL('../assets/ladybug.png', function (obj) { - var img = obj; - img.set('left', fabric.util.getRandomInt(200, 600)).set('top', -50); - img.movingLeft = !!Math.round(Math.random()); - canvas.add(img); - }); - }, 1000); - - - var animate = (function animate() { - canvas.forEachObject(function (obj) { - var img = obj; - img.left += (img.movingLeft ? -1 : 1); - img.top += 1; - if (img.left > 900 || img.top > 500) { - canvas.remove(img); - } - else { - img.setAngle(img.getAngle() + 2); - } - }); - canvas.renderAll(); - window.requestAnimationFrame(animate); + setInterval(function() { + fabric.Image.fromURL('../assets/ladybug.png', function(obj) { + var img = obj; + img.set('left', fabric.util.getRandomInt(200, 600)).set('top', -50); + img.movingLeft = !!Math.round(Math.random()); + canvas.add(img); }); + }, 1000); - animate(); + + var animate = (function animate() { + canvas.forEachObject(function(obj) { + var img = obj; + img.left += (img.movingLeft ? -1 : 1); + img.top += 1; + if (img.left > 900 || img.top > 500) { + canvas.remove(img); + } + else { + img.setAngle(img.getAngle() + 2); + } + }); + canvas.renderAll(); + window.requestAnimationFrame(animate); + }); + + animate(); } function sample8() { - function pad(str: string, length: number): string { - while (str.length < length) { - str = '0' + str; - } - return str; - }; + function pad(str: string, length: number): string { + while (str.length < length) { + str = '0' + str; + } + return str; + }; - var getRandomInt = fabric.util.getRandomInt; + var getRandomInt = fabric.util.getRandomInt; - function getRandomColor() { - return ( - pad(getRandomInt(0, 255).toString(16), 2) + - pad(getRandomInt(0, 255).toString(16), 2) + - pad(getRandomInt(0, 255).toString(16), 2) - ); + function getRandomColor() { + return ( + pad(getRandomInt(0, 255).toString(16), 2) + + pad(getRandomInt(0, 255).toString(16), 2) + + pad(getRandomInt(0, 255).toString(16), 2) + ); + } + + function getRandomNum(min: number, max: number): number { + return Math.random() * (max - min) + min; + } + + if (/(iPhone|iPod|iPad)/i.test(navigator.userAgent)) { + fabric.Object.prototype.cornersize = 30; + } + + var canvas = new fabric.Canvas('canvas'); + // canvas.controlsAboveOverlay = true; + + function updateComplexity() { + setTimeout(function() { + var element = document.getElementById('complexity').childNodes[1]; + element.innerHTML = ' ' + canvas.complexity(); + }, 100); + } + + document.getElementById('commands').onclick = function(ev: any) { + var ev: any = ev || window.event; + + if (ev.preventDefault) { + ev.preventDefault() + } + else if (ev.returnValue) { + ev.returnValue = false; } - function getRandomNum(min: number, max: number): number { - return Math.random() * (max - min) + min; + var element: any = ev.target || ev.srcElement; + if (element.nodeName.toLowerCase() === 'strong') { + element = element.parentNode; } - if (/(iPhone|iPod|iPad)/i.test(navigator.userAgent)) { - fabric.Object.prototype.cornersize = 30; - } - - var canvas = new fabric.Canvas('canvas'); - // canvas.controlsAboveOverlay = true; - - function updateComplexity() { - setTimeout(function () { - var element = document.getElementById('complexity').childNodes[1]; - element.innerHTML = ' ' + canvas.complexity(); - }, 100); - } - - document.getElementById('commands').onclick = function (ev: any) { - var ev: any = ev || window.event; - - if (ev.preventDefault) { - ev.preventDefault() - } - else if (ev.returnValue) { - ev.returnValue = false; - } - - var element: any = ev.target || ev.srcElement; - if (element.nodeName.toLowerCase() === 'strong') { - element = element.parentNode; - } - - var className = element.className, - offset = 50, - left = fabric.util.getRandomInt(0 + offset, 700 - offset), - top = fabric.util.getRandomInt(0 + offset, 500 - offset), - angle = fabric.util.getRandomInt(-20, 40), - width = fabric.util.getRandomInt(30, 50), - opacity = (function (min, max) { return Math.random() * (max - min) + min; })(0.5, 1); + var className = element.className, + offset = 50, + left = fabric.util.getRandomInt(0 + offset, 700 - offset), + top = fabric.util.getRandomInt(0 + offset, 500 - offset), + angle = fabric.util.getRandomInt(-20, 40), + width = fabric.util.getRandomInt(30, 50), + opacity = (function(min, max) { return Math.random() * (max - min) + min; })(0.5, 1); - switch (className) { - case 'rect': - canvas.add(new fabric.Rect({ - left: left, - top: top, - fill: '#' + getRandomColor(), - width: 50, - height: 50, - opacity: 0.8 - })); - break; + switch (className) { + case 'rect': + canvas.add(new fabric.Rect({ + left: left, + top: top, + fill: '#' + getRandomColor(), + width: 50, + height: 50, + opacity: 0.8 + })); + break; - case 'circle': - canvas.add(new fabric.Circle({ - left: left, - top: top, - fill: '#' + getRandomColor(), - radius: 50, - opacity: 0.8 - })); - break; + case 'circle': + canvas.add(new fabric.Circle({ + left: left, + top: top, + fill: '#' + getRandomColor(), + radius: 50, + opacity: 0.8 + })); + break; - case 'triangle': - canvas.add(new fabric.Triangle({ - left: left, - top: top, - fill: '#' + getRandomColor(), - width: 50, - height: 50, - opacity: 0.8 - })); - break; + case 'triangle': + canvas.add(new fabric.Triangle({ + left: left, + top: top, + fill: '#' + getRandomColor(), + width: 50, + height: 50, + opacity: 0.8 + })); + break; - case 'image1': - fabric.Image.fromURL('../assets/pug.jpg', function (image) { - image.set({ - left: left, - top: top, - angle: angle, - padding: 10, - cornersize: 10 - }); - image.scale(getRandomNum(0.1, 0.25)).setCoords(); - canvas.add(image); - }); - break; + case 'image1': + fabric.Image.fromURL('../assets/pug.jpg', function(image) { + image.set({ + left: left, + top: top, + angle: angle, + padding: 10, + cornersize: 10 + }); + image.scale(getRandomNum(0.1, 0.25)).setCoords(); + canvas.add(image); + }); + break; - case 'image2': - fabric.Image.fromURL('../assets/logo.png', function (image) { - image.set({ - left: left, - top: top, - angle: angle, - padding: 10, - cornersize: 10 - }); - image.scale(getRandomNum(0.1, 1)).setCoords(); - canvas.add(image); - updateComplexity(); - }); - break; + case 'image2': + fabric.Image.fromURL('../assets/logo.png', function(image) { + image.set({ + left: left, + top: top, + angle: angle, + padding: 10, + cornersize: 10 + }); + image.scale(getRandomNum(0.1, 1)).setCoords(); + canvas.add(image); + updateComplexity(); + }); + break; - case 'shape': - var id = element.id, match; - if (match = /\d+$/.exec(id)) { - fabric.loadSVGFromURL('../assets/' + match[0] + '.svg', function (objects, options) { - var loadedObject = fabric.util.groupSVGElements(objects, options); + case 'shape': + var id = element.id, match; + if (match = /\d+$/.exec(id)) { + fabric.loadSVGFromURL('../assets/' + match[0] + '.svg', function(objects, options) { + var loadedObject = fabric.util.groupSVGElements(objects, options); - loadedObject.set({ - left: left, - top: top, - angle: angle, - padding: 10, - cornersize: 10 - }); - loadedObject/*.scaleToWidth(300)*/.setCoords(); - - // loadedObject.hasRotatingPoint = true; - - canvas.add(loadedObject); - updateComplexity(); - canvas.calcOffset(); - }); - } - break; - - case 'clear': - if (confirm('Are you sure?')) { - canvas.clear(); - } - } - updateComplexity(); - }; - - document.getElementById('execute').onclick = function () { - var code = (document.getElementById('canvas-console')).value; - if (!(/^\s+$/).test(code)) { - eval(code); - } - }; - - - document.getElementById('rasterize').onclick = function () { - if (!fabric.Canvas.supports('toDataURL')) { - alert('This browser doesn\'t provide means to serialize canvas to an image'); - } - else { - window.open(canvas.toDataURL('png')); - } - }; - - var removeSelectedEl = document.getElementById('remove-selected'); - removeSelectedEl.onclick = function () { - var activeObject = canvas.getActiveObject(), - activeGroup = canvas.getActiveGroup(); - if (activeObject) { - canvas.remove(activeObject); - } - else if (activeGroup) { - var objectsInGroup = activeGroup.getObjects(); - canvas.discardActiveGroup(); - objectsInGroup.forEach(function (object) { - canvas.remove(object); + loadedObject.set({ + left: left, + top: top, + angle: angle, + padding: 10, + cornersize: 10 }); - } - }; + loadedObject/*.scaleToWidth(300)*/.setCoords(); - var supportsInputOfType = function (type) { - return function () { - var el = document.createElement('input'); - try { - el.type = type; - } - catch (err) { } - return el.type === type; - }; - }; - - var supportsSlider = supportsInputOfType('range'), - supportsColorpicker = supportsInputOfType('color'); - - if (supportsSlider()) { - (function () { - var controls = document.getElementById('controls'); - - var sliderLabel = document.createElement('label'); - sliderLabel.htmlFor = 'opacity'; - sliderLabel.innerHTML = 'Opacity: '; - - var slider = document.createElement('input'); - - try { slider.type = 'range'; } catch (err) { } - - slider.id = 'opacity'; - slider.value = "100"; - - controls.appendChild(sliderLabel); - controls.appendChild(slider); + // loadedObject.hasRotatingPoint = true; + canvas.add(loadedObject); + updateComplexity(); canvas.calcOffset(); + }); + } + break; - slider.onchange = function () { - var activeObject = canvas.getActiveObject(), - activeGroup = canvas.getActiveGroup(); - - if (activeObject || activeGroup) { - (activeObject || activeGroup).setOpacity(parseInt(this.value, 10) / 100); - canvas.renderAll(); - } - }; - })(); + case 'clear': + if (confirm('Are you sure?')) { + canvas.clear(); + } } + updateComplexity(); + }; - if (supportsColorpicker()) { - (function () { - var controls = document.getElementById('controls'); - - var label = document.createElement('label'); - label.htmlFor = 'color'; - label.innerHTML = 'Color: '; - label.style.marginLeft = '10px'; - - var colorpicker = document.createElement('input'); - colorpicker.type = 'color'; - colorpicker.id = 'color'; - colorpicker.style.width = '40px'; - - controls.appendChild(label); - controls.appendChild(colorpicker); - - canvas.calcOffset(); - - colorpicker.onchange = function () { - var activeObject = canvas.getActiveObject(), - activeGroup = canvas.getActiveGroup(); - - if (activeObject || activeGroup) { - (activeObject || activeGroup).setFill(this.value); - canvas.renderAll(); - } - }; - })(); + document.getElementById('execute').onclick = function() { + var code = (document.getElementById('canvas-console')).value; + if (!(/^\s+$/).test(code)) { + eval(code); } + }; - var lockHorizontallyEl = document.getElementById('lock-horizontally'); - lockHorizontallyEl.onclick = function () { - var activeObject: any = canvas.getActiveObject(); - if (activeObject) { - activeObject.lockMovementX = !activeObject.lockMovementX; - lockHorizontallyEl.innerHTML = activeObject.lockMovementX - ? 'Unlock horizontal movement' - : 'Lock horizontal movement'; - } - }; - var lockVerticallyEl = document.getElementById('lock-vertically'); - lockVerticallyEl.onclick = function () { - var activeObject: any = canvas.getActiveObject(); - if (activeObject) { - activeObject.lockMovementY = !activeObject.lockMovementY; - lockVerticallyEl.innerHTML = activeObject.lockMovementY - ? 'Unlock vertical movement' - : 'Lock vertical movement'; - } - }; - - var lockScalingXEl = document.getElementById('lock-scaling-x'); - lockScalingXEl.onclick = function () { - var activeObject: any = canvas.getActiveObject(); - if (activeObject) { - activeObject.lockScalingX = !activeObject.lockScalingX; - lockScalingXEl.innerHTML = activeObject.lockScalingX - ? 'Unlock horizontal scaling' - : 'Lock horizontal scaling'; - } - }; - - var lockScalingYEl = document.getElementById('lock-scaling-y'); - lockScalingYEl.onclick = function () { - var activeObject: any = canvas.getActiveObject(); - if (activeObject) { - activeObject.lockScalingY = !activeObject.lockScalingY; - lockScalingYEl.innerHTML = activeObject.lockScalingY - ? 'Unlock vertical scaling' - : 'Lock vertical scaling'; - } - }; - - var lockRotationEl = document.getElementById('lock-rotation'); - lockRotationEl.onclick = function () { - var activeObject: any = canvas.getActiveObject(); - if (activeObject) { - activeObject.lockRotation = !activeObject.lockRotation; - lockRotationEl.innerHTML = activeObject.lockRotation - ? 'Unlock rotation' - : 'Lock rotation'; - } - }; - - var gradientifyBtn = document.getElementById('gradientify'); - - var activeObjectButtons = [ - lockHorizontallyEl, - lockVerticallyEl, - lockScalingXEl, - lockScalingYEl, - lockRotationEl, - removeSelectedEl, - gradientifyBtn - ]; - - var opacityEl = document.getElementById('opacity'); - if (opacityEl) { - activeObjectButtons.push(opacityEl); + document.getElementById('rasterize').onclick = function() { + if (!fabric.Canvas.supports('toDataURL')) { + alert('This browser doesn\'t provide means to serialize canvas to an image'); } - var colorEl = document.getElementById('color'); - if (colorEl) { - activeObjectButtons.push(colorEl); + else { + window.open(canvas.toDataURL('png')); } + }; + + var removeSelectedEl = document.getElementById('remove-selected'); + removeSelectedEl.onclick = function() { + var activeObject = canvas.getActiveObject(), + activeGroup = canvas.getActiveGroup(); + if (activeObject) { + canvas.remove(activeObject); + } + else if (activeGroup) { + var objectsInGroup = activeGroup.getObjects(); + canvas.discardActiveGroup(); + objectsInGroup.forEach(function(object) { + canvas.remove(object); + }); + } + }; + + var supportsInputOfType = function(type) { + return function() { + var el = document.createElement('input'); + try { + el.type = type; + } + catch (err) { } + return el.type === type; + }; + }; + + var supportsSlider = supportsInputOfType('range'), + supportsColorpicker = supportsInputOfType('color'); + + if (supportsSlider()) { + (function() { + var controls = document.getElementById('controls'); + + var sliderLabel = document.createElement('label'); + sliderLabel.htmlFor = 'opacity'; + sliderLabel.innerHTML = 'Opacity: '; + + var slider = document.createElement('input'); + + try { slider.type = 'range'; } catch (err) { } + + slider.id = 'opacity'; + slider.value = "100"; + + controls.appendChild(sliderLabel); + controls.appendChild(slider); + + canvas.calcOffset(); + + slider.onchange = function() { + var activeObject = canvas.getActiveObject(), + activeGroup = canvas.getActiveGroup(); + + if (activeObject || activeGroup) { + (activeObject || activeGroup).setOpacity(parseInt(this.value, 10) / 100); + canvas.renderAll(); + } + }; + })(); + } + + if (supportsColorpicker()) { + (function() { + var controls = document.getElementById('controls'); + + var label = document.createElement('label'); + label.htmlFor = 'color'; + label.innerHTML = 'Color: '; + label.style.marginLeft = '10px'; + + var colorpicker = document.createElement('input'); + colorpicker.type = 'color'; + colorpicker.id = 'color'; + colorpicker.style.width = '40px'; + + controls.appendChild(label); + controls.appendChild(colorpicker); + + canvas.calcOffset(); + + colorpicker.onchange = function() { + var activeObject = canvas.getActiveObject(), + activeGroup = canvas.getActiveGroup(); + + if (activeObject || activeGroup) { + (activeObject || activeGroup).setFill(this.value); + canvas.renderAll(); + } + }; + })(); + } + + var lockHorizontallyEl = document.getElementById('lock-horizontally'); + lockHorizontallyEl.onclick = function() { + var activeObject: any = canvas.getActiveObject(); + if (activeObject) { + activeObject.lockMovementX = !activeObject.lockMovementX; + lockHorizontallyEl.innerHTML = activeObject.lockMovementX + ? 'Unlock horizontal movement' + : 'Lock horizontal movement'; + } + }; + + var lockVerticallyEl = document.getElementById('lock-vertically'); + lockVerticallyEl.onclick = function() { + var activeObject: any = canvas.getActiveObject(); + if (activeObject) { + activeObject.lockMovementY = !activeObject.lockMovementY; + lockVerticallyEl.innerHTML = activeObject.lockMovementY + ? 'Unlock vertical movement' + : 'Lock vertical movement'; + } + }; + + var lockScalingXEl = document.getElementById('lock-scaling-x'); + lockScalingXEl.onclick = function() { + var activeObject: any = canvas.getActiveObject(); + if (activeObject) { + activeObject.lockScalingX = !activeObject.lockScalingX; + lockScalingXEl.innerHTML = activeObject.lockScalingX + ? 'Unlock horizontal scaling' + : 'Lock horizontal scaling'; + } + }; + + var lockScalingYEl = document.getElementById('lock-scaling-y'); + lockScalingYEl.onclick = function() { + var activeObject: any = canvas.getActiveObject(); + if (activeObject) { + activeObject.lockScalingY = !activeObject.lockScalingY; + lockScalingYEl.innerHTML = activeObject.lockScalingY + ? 'Unlock vertical scaling' + : 'Lock vertical scaling'; + } + }; + + var lockRotationEl = document.getElementById('lock-rotation'); + lockRotationEl.onclick = function() { + var activeObject: any = canvas.getActiveObject(); + if (activeObject) { + activeObject.lockRotation = !activeObject.lockRotation; + lockRotationEl.innerHTML = activeObject.lockRotation + ? 'Unlock rotation' + : 'Lock rotation'; + } + }; + + var gradientifyBtn = document.getElementById('gradientify'); + + var activeObjectButtons = [ + lockHorizontallyEl, + lockVerticallyEl, + lockScalingXEl, + lockScalingYEl, + lockRotationEl, + removeSelectedEl, + gradientifyBtn + ]; + + var opacityEl = document.getElementById('opacity'); + if (opacityEl) { + activeObjectButtons.push(opacityEl); + } + var colorEl = document.getElementById('color'); + if (colorEl) { + activeObjectButtons.push(colorEl); + } + + for (var i = activeObjectButtons.length; i--;) { + activeObjectButtons[i].disabled = true; + } + + canvas.on('object:selected', onObjectSelected); + canvas.on('group:selected', onObjectSelected); + + function onObjectSelected(e) { + var selectedObject = e.target; for (var i = activeObjectButtons.length; i--;) { - activeObjectButtons[i].disabled = true; + activeObjectButtons[i].disabled = false; } - canvas.on('object:selected', onObjectSelected); - canvas.on('group:selected', onObjectSelected); + lockHorizontallyEl.innerHTML = (selectedObject.lockMovementX ? 'Unlock horizontal movement' : 'Lock horizontal movement'); + lockVerticallyEl.innerHTML = (selectedObject.lockMovementY ? 'Unlock vertical movement' : 'Lock vertical movement'); + lockScalingXEl.innerHTML = (selectedObject.lockScalingX ? 'Unlock horizontal scaling' : 'Lock horizontal scaling'); + lockScalingYEl.innerHTML = (selectedObject.lockScalingY ? 'Unlock vertical scaling' : 'Lock vertical scaling'); + lockRotationEl.innerHTML = (selectedObject.lockRotation ? 'Unlock rotation' : 'Lock rotation'); + } - function onObjectSelected(e) { - var selectedObject = e.target; - - for (var i = activeObjectButtons.length; i--;) { - activeObjectButtons[i].disabled = false; - } - - lockHorizontallyEl.innerHTML = (selectedObject.lockMovementX ? 'Unlock horizontal movement' : 'Lock horizontal movement'); - lockVerticallyEl.innerHTML = (selectedObject.lockMovementY ? 'Unlock vertical movement' : 'Lock vertical movement'); - lockScalingXEl.innerHTML = (selectedObject.lockScalingX ? 'Unlock horizontal scaling' : 'Lock horizontal scaling'); - lockScalingYEl.innerHTML = (selectedObject.lockScalingY ? 'Unlock vertical scaling' : 'Lock vertical scaling'); - lockRotationEl.innerHTML = (selectedObject.lockRotation ? 'Unlock rotation' : 'Lock rotation'); + canvas.on('selection:cleared', function(e) { + for (var i = activeObjectButtons.length; i--;) { + activeObjectButtons[i].disabled = true; } + }); - canvas.on('selection:cleared', function (e) { - for (var i = activeObjectButtons.length; i--;) { - activeObjectButtons[i].disabled = true; - } + var drawingModeEl = document.getElementById('drawing-mode'), + drawingOptionsEl = document.getElementById('drawing-mode-options'), + drawingColorEl = document.getElementById('drawing-color'), + drawingLineWidthEl = document.getElementById('drawing-line-width'); + + drawingModeEl.onclick = function() { + var canvasWithDrawingMode: any = canvas; + canvasWithDrawingMode.isDrawingMode = !canvasWithDrawingMode.isDrawingMode; + if (canvasWithDrawingMode.isDrawingMode) { + drawingModeEl.innerHTML = 'Cancel drawing mode'; + drawingModeEl.className = 'is-drawing'; + drawingOptionsEl.style.display = ''; + } + else { + drawingModeEl.innerHTML = 'Enter drawing mode'; + drawingModeEl.className = ''; + drawingOptionsEl.style.display = 'none'; + } + }; + + canvas.on('path:created', function() { + updateComplexity(); + }); + + drawingColorEl.onchange = function() { + canvas.freeDrawingColor = drawingColorEl.value; + }; + drawingLineWidthEl.onchange = function() { + canvas.freeDrawingLineWidth = parseInt(drawingLineWidthEl.value, 10) || 1; // disallow 0, NaN, etc. + }; + + canvas.freeDrawingColor = drawingColorEl.value; + canvas.freeDrawingLineWidth = parseInt(drawingLineWidthEl.value, 10) || 1; + + + var text = 'Lorem ipsum dolor sit amet,\nconsectetur adipisicing elit,\nsed do eiusmod tempor incididunt\nut labore et dolore magna aliqua.\n' + + 'Ut enim ad minim veniam,\nquis nostrud exercitation ullamco\nlaboris nisi ut aliquip ex ea commodo consequat.'; + + document.getElementById('add-text').onclick = function() { + var textSample = new fabric.Text(text.slice(0, getRandomInt(0, text.length)), { + left: getRandomInt(350, 400), + top: getRandomInt(350, 400), + fontFamily: 'helvetica', + angle: getRandomInt(-10, 10), + fill: '#' + getRandomColor(), + scaleX: 0.5, + scaleY: 0.5, + fontWeight: '' }); + canvas.add(textSample); + updateComplexity(); + }; - var drawingModeEl = document.getElementById('drawing-mode'), - drawingOptionsEl = document.getElementById('drawing-mode-options'), - drawingColorEl = document.getElementById('drawing-color'), - drawingLineWidthEl = document.getElementById('drawing-line-width'); - drawingModeEl.onclick = function () { - var canvasWithDrawingMode: any = canvas; - canvasWithDrawingMode.isDrawingMode = !canvasWithDrawingMode.isDrawingMode; - if (canvasWithDrawingMode.isDrawingMode) { - drawingModeEl.innerHTML = 'Cancel drawing mode'; - drawingModeEl.className = 'is-drawing'; - drawingOptionsEl.style.display = ''; + document.onkeydown = function(e) { + var obj = canvas.getActiveObject() || canvas.getActiveGroup(); + if (obj && e.keyCode === 8) { + // this is horrible. need to fix, so that unified interface can be used + if (obj.type === 'group') { + // var groupObjects = obj.getObjects(); + // canvas.discardActiveGroup(); + // groupObjects.forEach(function(obj) { + // canvas.remove(obj); + // }); + } + else { + //canvas.remove(obj); + } + canvas.renderAll(); + // return false; + } + }; + + setTimeout(function() { + canvas.calcOffset(); + }, 100); + + if (document.location.search.indexOf('guidelines') > -1) { + //initCenteringGuidelines(canvas); + //initAligningGuidelines(canvas); + } + + gradientifyBtn.onclick = function() { + var obj = canvas.getActiveObject(); + if (obj) { + obj.setGradient("fill", { + x2: (getRandomInt(0, 1) ? 0 : obj.width), + y2: (getRandomInt(0, 1) ? 0 : obj.height), + colorStops: { + 0: '#' + getRandomColor(), + 1: '#' + getRandomColor() + } + }); + canvas.renderAll(); + } + }; + + var textEl = document.getElementById('text'); + if (textEl) { + textEl.onfocus = function() { + var activeObject = canvas.getActiveObject(); + + if (activeObject && activeObject.type === 'text') { + this.value = (activeObject).text; + } + }; + textEl.onkeyup = function(e) { + var activeObject = canvas.getActiveObject(); + if (activeObject) { + if (!this.value) { + canvas.discardActiveObject(); } else { - drawingModeEl.innerHTML = 'Enter drawing mode'; - drawingModeEl.className = ''; - drawingOptionsEl.style.display = 'none'; + (activeObject).text = this.value; } + canvas.renderAll(); + } }; + } - canvas.on('path:created', function () { - updateComplexity(); + var cmdUnderlineBtn = document.getElementById('text-cmd-underline'); + if (cmdUnderlineBtn) { + activeObjectButtons.push(cmdUnderlineBtn); + cmdUnderlineBtn.disabled = true; + cmdUnderlineBtn.onclick = function() { + var activeObject = canvas.getActiveObject(); + if (activeObject && activeObject.type === 'text') { + activeObject.textDecoration = (activeObject.textDecoration == 'underline' ? '' : 'underline'); + this.className = activeObject.textDecoration ? 'selected' : ''; + canvas.renderAll(); + } + }; + } + + var cmdLinethroughBtn = document.getElementById('text-cmd-linethrough'); + if (cmdLinethroughBtn) { + activeObjectButtons.push(cmdLinethroughBtn); + cmdLinethroughBtn.disabled = true; + cmdLinethroughBtn.onclick = function() { + var activeObject = canvas.getActiveObject(); + if (activeObject && activeObject.type === 'text') { + activeObject.textDecoration = (activeObject.textDecoration == 'line-through' ? '' : 'line-through'); + this.className = activeObject.textDecoration ? 'selected' : ''; + canvas.renderAll(); + } + }; + } + + var cmdOverlineBtn = document.getElementById('text-cmd-overline'); + if (cmdOverlineBtn) { + activeObjectButtons.push(cmdOverlineBtn); + cmdOverlineBtn.disabled = true; + cmdOverlineBtn.onclick = function() { + var activeObject = canvas.getActiveObject(); + if (activeObject && activeObject.type === 'text') { + activeObject.textDecoration = (activeObject.textDecoration == 'overline' ? '' : 'overline'); + this.className = activeObject.textDecoration ? 'selected' : ''; + canvas.renderAll(); + } + }; + } + + var cmdBoldBtn = document.getElementById('text-cmd-bold'); + if (cmdBoldBtn) { + activeObjectButtons.push(cmdBoldBtn); + cmdBoldBtn.disabled = true; + cmdBoldBtn.onclick = function() { + var activeObject = canvas.getActiveObject(); + if (activeObject && activeObject.type === 'text') { + activeObject.fontWeight = (activeObject.fontWeight == 'bold' ? '' : 'bold'); + this.className = activeObject.fontWeight ? 'selected' : ''; + canvas.renderAll(); + } + }; + } + + var cmdItalicBtn = document.getElementById('text-cmd-italic'); + if (cmdItalicBtn) { + activeObjectButtons.push(cmdItalicBtn); + cmdItalicBtn.disabled = true; + cmdItalicBtn.onclick = function() { + var activeObject = canvas.getActiveObject(); + if (activeObject && activeObject.type === 'text') { + activeObject.fontStyle = (activeObject.fontStyle == 'italic' ? '' : 'italic'); + this.className = activeObject.fontStyle ? 'selected' : ''; + canvas.renderAll(); + } + }; + } + + var cmdShadowBtn = document.getElementById('text-cmd-shadow'); + if (cmdShadowBtn) { + activeObjectButtons.push(cmdShadowBtn); + cmdShadowBtn.disabled = true; + cmdShadowBtn.onclick = function() { + var activeObject = canvas.getActiveObject(); + if (activeObject && activeObject.type === 'text') { + activeObject.shadow = !activeObject.shadow ? 'rgba(0,0,0,0.2) 2px 2px 10px' : ''; + this.className = activeObject.shadow ? 'selected' : ''; + canvas.renderAll(); + } + }; + } + + var textAlignSwitch = document.getElementById('text-align'); + if (textAlignSwitch) { + activeObjectButtons.push(textAlignSwitch); + textAlignSwitch.disabled = true; + textAlignSwitch.onchange = function() { + var activeObject = canvas.getActiveObject(); + if (activeObject && activeObject.type === 'text') { + activeObject.textAlign = this.value.toLowerCase(); + canvas.renderAll(); + } + }; + } + + var fontFamilySwitch = document.getElementById('font-family'); + if (fontFamilySwitch) { + activeObjectButtons.push(fontFamilySwitch); + fontFamilySwitch.disabled = true; + fontFamilySwitch.onchange = function() { + var activeObject = canvas.getActiveObject(); + if (activeObject && activeObject.type === 'text') { + activeObject.fontFamily = this.value; + canvas.renderAll(); + } + }; + } + + var bgColorField = document.getElementById('text-bg-color'); + if (bgColorField) { + bgColorField.onchange = function() { + var activeObject = canvas.getActiveObject(); + if (activeObject && activeObject.type === 'text') { + activeObject.backgroundColor = this.value; + canvas.renderAll(); + } + }; + } + + var strokeColorField = document.getElementById('text-stroke-color'); + if (strokeColorField) { + strokeColorField.onchange = function() { + var activeObject = canvas.getActiveObject(); + if (activeObject && activeObject.type === 'text') { + activeObject.stroke = this.value; + canvas.renderAll(); + } + }; + } + + if (supportsSlider) { + (function() { + var container = document.getElementById('text-controls'); + var slider = document.createElement('input'); + var label = document.createElement('label'); + label.innerHTML = 'Line height: '; + try { slider.type = 'range'; } catch (err) { } + slider.min = "0"; + slider.max = "10"; + slider.step = "0.1"; + slider.value = "1.5"; + container.appendChild(label); + label.appendChild(slider); + slider.title = "Line height"; + slider.onchange = function() { + var activeObject = canvas.getActiveObject(); + if (activeObject && activeObject.type === 'text') { + activeObject.lineHeight = this.value; + canvas.renderAll(); + } + }; + + canvas.on('object:selected', function(e: fabric.IEvent) { + slider.value = String((e.target).lineHeight ); + }); + })(); + } + + document.getElementById('load-svg').onclick = function() { + var svg = (document.getElementById('svg-console')).value; + fabric.loadSVGFromString(svg, function(objects, options) { + var obj = fabric.util.groupSVGElements(objects, options); + canvas.add(obj).centerObject(obj).renderAll(); + obj.setCoords(); }); - - drawingColorEl.onchange = function () { - canvas.freeDrawingColor = drawingColorEl.value; - }; - drawingLineWidthEl.onchange = function () { - canvas.freeDrawingLineWidth = parseInt(drawingLineWidthEl.value, 10) || 1; // disallow 0, NaN, etc. - }; - - canvas.freeDrawingColor = drawingColorEl.value; - canvas.freeDrawingLineWidth = parseInt(drawingLineWidthEl.value, 10) || 1; - - - var text = 'Lorem ipsum dolor sit amet,\nconsectetur adipisicing elit,\nsed do eiusmod tempor incididunt\nut labore et dolore magna aliqua.\n' + - 'Ut enim ad minim veniam,\nquis nostrud exercitation ullamco\nlaboris nisi ut aliquip ex ea commodo consequat.'; - - document.getElementById('add-text').onclick = function () { - var textSample = new fabric.Text(text.slice(0, getRandomInt(0, text.length)), { - left: getRandomInt(350, 400), - top: getRandomInt(350, 400), - fontFamily: 'helvetica', - angle: getRandomInt(-10, 10), - fill: '#' + getRandomColor(), - scaleX: 0.5, - scaleY: 0.5, - fontWeight: '' - }); - canvas.add(textSample); - updateComplexity(); - }; - - - document.onkeydown = function (e) { - var obj = canvas.getActiveObject() || canvas.getActiveGroup(); - if (obj && e.keyCode === 8) { - // this is horrible. need to fix, so that unified interface can be used - if (obj.type === 'group') { - // var groupObjects = obj.getObjects(); - // canvas.discardActiveGroup(); - // groupObjects.forEach(function(obj) { - // canvas.remove(obj); - // }); - } - else { - //canvas.remove(obj); - } - canvas.renderAll(); - // return false; - } - }; - - setTimeout(function () { - canvas.calcOffset(); - }, 100); - - if (document.location.search.indexOf('guidelines') > -1) { - //initCenteringGuidelines(canvas); - //initAligningGuidelines(canvas); - } - - gradientifyBtn.onclick = function () { - var obj = canvas.getActiveObject(); - if (obj) { - obj.setGradientFill({ - x2: (getRandomInt(0, 1) ? 0 : obj.width), - y2: (getRandomInt(0, 1) ? 0 : obj.height), - colorStops: { - 0: '#' + getRandomColor(), - 1: '#' + getRandomColor() - } - }); - canvas.renderAll(); - } - }; - - var textEl = document.getElementById('text'); - if (textEl) { - textEl.onfocus = function () { - var activeObject = canvas.getActiveObject(); - - if (activeObject && activeObject.type === 'text') { - this.value = (activeObject).text; - } - }; - textEl.onkeyup = function (e) { - var activeObject = canvas.getActiveObject(); - if (activeObject) { - if (!this.value) { - canvas.discardActiveObject(); - } - else { - (activeObject).text = this.value; - } - canvas.renderAll(); - } - }; - } - - var cmdUnderlineBtn = document.getElementById('text-cmd-underline'); - if (cmdUnderlineBtn) { - activeObjectButtons.push(cmdUnderlineBtn); - cmdUnderlineBtn.disabled = true; - cmdUnderlineBtn.onclick = function () { - var activeObject = canvas.getActiveObject(); - if (activeObject && activeObject.type === 'text') { - activeObject.textDecoration = (activeObject.textDecoration == 'underline' ? '' : 'underline'); - this.className = activeObject.textDecoration ? 'selected' : ''; - canvas.renderAll(); - } - }; - } - - var cmdLinethroughBtn = document.getElementById('text-cmd-linethrough'); - if (cmdLinethroughBtn) { - activeObjectButtons.push(cmdLinethroughBtn); - cmdLinethroughBtn.disabled = true; - cmdLinethroughBtn.onclick = function () { - var activeObject = canvas.getActiveObject(); - if (activeObject && activeObject.type === 'text') { - activeObject.textDecoration = (activeObject.textDecoration == 'line-through' ? '' : 'line-through'); - this.className = activeObject.textDecoration ? 'selected' : ''; - canvas.renderAll(); - } - }; - } - - var cmdOverlineBtn = document.getElementById('text-cmd-overline'); - if (cmdOverlineBtn) { - activeObjectButtons.push(cmdOverlineBtn); - cmdOverlineBtn.disabled = true; - cmdOverlineBtn.onclick = function () { - var activeObject = canvas.getActiveObject(); - if (activeObject && activeObject.type === 'text') { - activeObject.textDecoration = (activeObject.textDecoration == 'overline' ? '' : 'overline'); - this.className = activeObject.textDecoration ? 'selected' : ''; - canvas.renderAll(); - } - }; - } - - var cmdBoldBtn = document.getElementById('text-cmd-bold'); - if (cmdBoldBtn) { - activeObjectButtons.push(cmdBoldBtn); - cmdBoldBtn.disabled = true; - cmdBoldBtn.onclick = function () { - var activeObject = canvas.getActiveObject(); - if (activeObject && activeObject.type === 'text') { - activeObject.fontWeight = (activeObject.fontWeight == 'bold' ? '' : 'bold'); - this.className = activeObject.fontWeight ? 'selected' : ''; - canvas.renderAll(); - } - }; - } - - var cmdItalicBtn = document.getElementById('text-cmd-italic'); - if (cmdItalicBtn) { - activeObjectButtons.push(cmdItalicBtn); - cmdItalicBtn.disabled = true; - cmdItalicBtn.onclick = function () { - var activeObject = canvas.getActiveObject(); - if (activeObject && activeObject.type === 'text') { - activeObject.fontStyle = (activeObject.fontStyle == 'italic' ? '' : 'italic'); - this.className = activeObject.fontStyle ? 'selected' : ''; - canvas.renderAll(); - } - }; - } - - var cmdShadowBtn = document.getElementById('text-cmd-shadow'); - if (cmdShadowBtn) { - activeObjectButtons.push(cmdShadowBtn); - cmdShadowBtn.disabled = true; - cmdShadowBtn.onclick = function () { - var activeObject = canvas.getActiveObject(); - if (activeObject && activeObject.type === 'text') { - activeObject.textShadow = !activeObject.textShadow ? 'rgba(0,0,0,0.2) 2px 2px 10px' : ''; - this.className = activeObject.textShadow ? 'selected' : ''; - canvas.renderAll(); - } - }; - } - - var textAlignSwitch = document.getElementById('text-align'); - if (textAlignSwitch) { - activeObjectButtons.push(textAlignSwitch); - textAlignSwitch.disabled = true; - textAlignSwitch.onchange = function () { - var activeObject = canvas.getActiveObject(); - if (activeObject && activeObject.type === 'text') { - activeObject.textAlign = this.value.toLowerCase(); - canvas.renderAll(); - } - }; - } - - var fontFamilySwitch = document.getElementById('font-family'); - if (fontFamilySwitch) { - activeObjectButtons.push(fontFamilySwitch); - fontFamilySwitch.disabled = true; - fontFamilySwitch.onchange = function () { - var activeObject = canvas.getActiveObject(); - if (activeObject && activeObject.type === 'text') { - activeObject.fontFamily = this.value; - canvas.renderAll(); - } - }; - } - - var bgColorField = document.getElementById('text-bg-color'); - if (bgColorField) { - bgColorField.onchange = function () { - var activeObject = canvas.getActiveObject(); - if (activeObject && activeObject.type === 'text') { - activeObject.backgroundColor = this.value; - canvas.renderAll(); - } - }; - } - - var strokeColorField = document.getElementById('text-stroke-color'); - if (strokeColorField) { - strokeColorField.onchange = function () { - var activeObject = canvas.getActiveObject(); - if (activeObject && activeObject.type === 'text') { - activeObject.strokeStyle = this.value; - canvas.renderAll(); - } - }; - } - - if (supportsSlider) { - (function () { - var container = document.getElementById('text-controls'); - var slider = document.createElement('input'); - var label = document.createElement('label'); - label.innerHTML = 'Line height: '; - try { slider.type = 'range'; } catch (err) { } - slider.min = "0"; - slider.max = "10"; - slider.step = "0.1"; - slider.value = "1.5"; - container.appendChild(label); - label.appendChild(slider); - slider.title = "Line height"; - slider.onchange = function () { - var activeObject = canvas.getActiveObject(); - if (activeObject && activeObject.type === 'text') { - activeObject.lineHeight = this.value; - canvas.renderAll(); - } - }; - - canvas.on('object:selected', function (e) { - slider.value = e.target.lineHeight; - }); - })(); - } - - document.getElementById('load-svg').onclick = function () { - var svg = (document.getElementById('svg-console')).value; - fabric.loadSVGFromString(svg, function (objects, options) { - var obj = fabric.util.groupSVGElements(objects, options); - canvas.add(obj).centerObject(obj).renderAll(); - obj.setCoords(); - }); - }; + }; } function sample9() { - var canvas = new fabric.Canvas('c'); - canvas.setBackgroundImage('yolo.jpg', () => {"a"}, {opacity: 45}); - canvas.setBackgroundImage('yolo.jpg', () => {"a"}); + var canvas = new fabric.Canvas('c'); + canvas.setBackgroundImage('yolo.jpg',() => { "a" }, { opacity: 45 }); + canvas.setBackgroundImage('yolo.jpg',() => { "a" }); } diff --git a/fabricjs/fabricjs.d.ts b/fabricjs/fabricjs.d.ts index f764d4768..503b8c7db 100644 --- a/fabricjs/fabricjs.d.ts +++ b/fabricjs/fabricjs.d.ts @@ -1,899 +1,4596 @@ -// Type definitions for FabricJS +// Type definitions for FabricJS v1.5.0 // Project: http://fabricjs.com/ -// Definitions by: Oliver Klemencic +// Definitions by: Oliver Klemencic , Joseph Livecchi // Definitions: https://github.com/borisyankov/DefinitelyTyped +/* tslint:disable:no-unused-variable */ +/* tslint:disable:whitespace */ +/* tslint:disable:typedef */ + +// Support AMD require +declare module "fabric" { + export = fabric; +} + declare module fabric { - function createCanvasForNode(width: number, height: number): ICanvas; - function getCSSRules(doc: SVGElement); - function getGradientDefs(doc: SVGElement); - function loadSVGFromString(text: string, callback: (results: IObject[], options) => void , reviver?: (el, obj) => void ); - function loadSVGFromURL(url, callback: (results: IObject[], options) => void , reviver?: (el, obj) => void ); - function log(values); - function parseAttributes(element, attributes: any[]): any; - function parseElements(elements: any[], callback, options, reviver); - function parsePointsAttribute(points: string): any[]; - function parseStyleAttribute(element: SVGElement); - function parseSVGDocument(doc: SVGElement, callback: (results, options) => void , reviver?: (el, obj) => void ); - function parseTransformAttribute(attributeValue: string); - function warn(values); - - var isLikelyNode: boolean; - var isTouchSupported: boolean; - - export interface IObservable { - observe(eventCollection: IEventList); - on(eventCollection: IEventList); - - observe(eventName: string, handler: (e) => any); - on(eventName: string, handler: (e) => any); - - fire(eventName: string, options); - stopObserving(eventName: string, handler: (e) => any); - - off(eventName, handler); - } - - export interface IFilter { - new (): IFilter; - new (options: any): IFilter; - } - - export interface IEventList { - [index: string]: (e: Event) => void; - } - - export interface IObjectOptions { - angle?: number; - borderColor?: string; - borderOpacityWhenMoving?: number; - borderScaleFactor?: number; - cornerColor?: string; - cornersize?: number; - fill?: string; - fillRule?: string; - flipX?: boolean; - flipY?: boolean; - hasBorders?: boolean; - hasControls?: boolean; - hasRotatingPoint?: boolean; - height?: number; - includeDefaultValues?: boolean; - left?: number; - lockMovementX?: boolean; - lockMovementY?: boolean; - lockScalingX?: boolean; - lockScalingY?: boolean; - lockUniScaling?: boolean; - lockRotation?: boolean; - opacity?: number; - originX?: string; - originY?: string; - overlayFill?: string; - padding?: number; - perPixelTargetFind?: boolean; - rotatingPointOffset?: number; - scaleX?: number; - scaleY?: number; - selectable?: boolean; - stateProperties?: any[]; - stroke?: string; - strokeDashArray?: any[]; - strokeWidth?: number; - top?: number; - transformMatrix?: any[]; - transparentCorners?: boolean; - type?: string; - width?: number; - } - - export interface ITextOptions extends IObjectOptions { - fontSize?: number; - fontWeight?: any; - fontFamily?: string; - textDecoration?: string; - textShadow?: string; - textAlign?: string; - fontStyle?: string; - lineHeight?: number; - strokeStyle?: string; - strokeWidth?: number; - backgroundColor?: string; - textBackgroundColor?: string; - path?: string; - type?: string; - useNative?: Boolean; - } - - export interface ICircleOptions extends IObjectOptions { - radius?: number; - } - - export interface IPoint { - add(that: IPoint): IPoint; - addEquals(that: IPoint): IPoint; - distanceFrom(that: IPoint); - divide(scalar: number); - divideEquals(scalar: number); - eq(that: IPoint); - gt(that: IPoint); - gte(that: IPoint); - init(x, y); - lerp(that: IPoint, t); - lt(that: IPoint); - lte(that: IPoint); - max(that: IPoint); - min(that: IPoint); - multiply(scalar); - multiplyEquals(scalar); - scalarAdd(scalar): IPoint; - scalarAddEquals(scalar: number, thisArg: IPoint); - scalarSubtract(scalar: number); - scalarSubtractEquals(scalar); - setFromPoint(that: IPoint); - setXY(x, y); - subtract(that: IPoint): IPoint; - subtractEquals(that: IPoint): IPoint; - swap(that: IPoint); - tostring(): string; - } - - export interface IRect extends IObject { - x: number; - y: number; - rx: number; - ry: number; - - complexity(): number; - initialize(options: any); - initialize(points: number[], options: any): IRect; - toObject(propertiesToInclude: any[]): any; - toSVG(): string; - } - - export interface IText extends IObject { - fontSize: number; - fontWeight: any; - fontFamily: string; - text: string; - textDecoration: string; - textShadow?: string; - textAlign: string; - fontStyle: string; - lineHeight: number; - strokeStyle: string; - strokeWidth: number; - backgroundColor: string; - textBackgroundColor: string; - path?: string; - type: string; - useNative: Boolean; - - initialize(options: any); - initialize(text: string, options: any): IText; - toString(): string; - render(ctx: CanvasRenderingContext2D, noTransform: boolean); - toObject(propertiesToInclude: any[]): IObject; - toSVG(): string; - setColor(value: string): IText; - setFontsize(value: number): IText; - getText(): string; - setText(value: string): IText; - } - - export interface ITriangle extends IObject { - complexity(): number; - initialize(options: any): ITriangle; - toSVG(): string; - } - - export interface IEllipse { - initialize(options: any): any; - toObject(propertiesToInclude: any[]): any; - toSVG(): string; - render(ctx: CanvasRenderingContext2D, noTransform: boolean); - complexity(): number; - } - - export interface IGradient { - initialize(options): any; - toObject(): any; - toLiveGradient(ctx: CanvasRenderingContext2D): any; - } - - export interface IColor { - getSource(): any[]; - setSource(source: any[]): any; - toRgb(): string; - toRgba(): string; - toHex(): string; - getAlpha(): number; - setAlpha(alpha: number): IColor; - toGrayscale(): IColor; - toBlackWhite(threshold): IColor; - overlayWith(otherColor: string): IColor; - overlayWith(otherColor: IColor): IColor; - } - - export interface IElement { - } - - export interface IObject extends IObservable { - - // constraint properties - lockMovementX: boolean; - lockMovementY: boolean; - lockScalingX: boolean; - lockScalingY: boolean; - lockScaling: boolean; - lockUniScaling: boolean; - lockRotation: boolean; - - getCurrentWidth(): number; - getCurrentHeight(): number; - - originX: string; - originY: string; - - angle: number; - getAngle(): number; - setAngle(value: number): IObject; - - borderColor: string; - getBorderColor(): string; - setBorderColor(value: string): IObject; - - borderOpacityWhenMoving: number; - borderScaleFactor: number; - getBorderScaleFactor(): number; - - cornerColor: string; - - cornersize: number; - getCornersize(): number; - setCornersize(value: number): IObject; - - fill: string; - getFill(): string; - setFill(value: string): IObject; - - fillRule: string; - getFillRule(): string; - setFillRule(value: string): IObject; - - flipX: boolean; - getFlipX(): boolean; - setFlipX(value: boolean): IObject; - - flipY: boolean; - getFlipY(): boolean; - setFlipY(value: boolean): IObject; - - hasBorders: boolean; - - hasControls: boolean; - hasRotatingPoint: boolean; - - height: number; - getHeight(): number; - setHeight(value: number): IObject; - - includeDefaultValues: boolean; - - left: number; - getLeft(): number; - setLeft(value: number): IObject; - - opacity: number; - getOpacity(): number; - setOpacity(value: number): IObject; - - overlayFill: string; - getOverlayFill(): string; - setOverlayFill(value: string): IObject; - - padding: number; - perPixelTargetFind: boolean; - rotatingPointOffset: number; - - scaleX: number; - getScaleX(): number; - setScaleX(value: number): IObject; - - scaleY: number; - getScaleY(): number; - setScaleY(value: number): IObject; - - selectable: boolean; - stateProperties: any[]; - stroke: string; - strokeDashArray: any[]; - strokeWidth: number; - - top: number; - getTop(): number; - setTop(value: number): IObject; - - transformMatrix: any[]; - transparentCorners: boolean; - type: string; - - width: number; - getWidth(): number; - setWidth(value: number): IObject; - - // methods - bringForward(intersecting?: boolean): IObject; - bringToFront(): IObject; - center(): IObject; - centerH(): IObject; - centerV(): IObject; - clone(callback?, propertiesToInclude?): IObject; - cloneAsImage(callback): IObject; - complexity(): number; - drawBorders(context: CanvasRenderingContext2D): IObject; - drawCorners(context: CanvasRenderingContext2D): IObject; - get (property: string): any; - getBoundingRect(): {left:number; top:number; width:number; height:number}; - getBoundingRectHeight(): number; - getBoundingRectWidth(): number; - getSvgStyles(): string; - getSvgTransform(): string; - hasStateChanged(): boolean; - initialize(options: any); - intersectsWithObject(other: IObject): boolean; - intersectsWithRect(selectionTL: any, selectionBR: any): boolean; - isActive(): boolean; - isContainedWithinObject(other: IObject): boolean; - isContainedWithinRect(selectionTL: any, selectionBR: any): boolean; - isType(type: string): boolean; - remove(): IObject; - render(ctx: CanvasRenderingContext2D, noTransform: boolean); - rotate(value: number): IObject; - saveState(): IObject; - scale(value: number): IObject; - scaleToHeight(value: number): IObject; - scaleToWidth(value: number): IObject; - sendBackwards(intersecting?: boolean): IObject; - sendToBack(): IObject; - - set (properties: IObjectOptions): IObject; - set (name: string, value: any): IObject; - setActive(active: boolean): IObject; - setCoords(); - setGradientFill(options); - setOptions(options: any); - setSourcePath(value: string): IObject; - toDatalessObject(propertiesToInclude): any; - toDataURL(callback): string; - toggle(property): IObject; - toGrayscale(): IObject; - toJSON(propertiesToInclude): string; - toObject(propertiesToInclude): any; - tostring(): string; - transform(ctx: CanvasRenderingContext2D); - } - - export interface IGroup extends IObject { - type: string; - - activateAllObjects(): IGroup; - add(object): IGroup; - addWithUpdate(object): IGroup; - complexity(): number; - contains(object): boolean; - containsPoint(point): boolean; - destroy(): IGroup; - getObjects(): IObject[]; - hasMoved(): boolean; - initialize(options: any); - initialize(objects, options): any; - item(index): IObject; - remove(object?): IGroup; - removeWithUpdate(object): IGroup; - render(ctx, noTransform): void; - saveCoords(): IGroup; - setObjectsCoords(): IGroup; - size(): number; - toGrayscale(): IGroup; - toObject(propertiesToInclude: any[]): any; - tostring(): string; - toSVG(): string; - } - - - export interface ILine extends IObject { - x1: number; - x2: number; - y1: number; - y2: number; - - complexity(): number; - initialize(options: any); - initialize(points: number[], options: any): ILine; - toObject(propertiesToInclude: any[]): any; - toSVG(): string; - } - - export interface IIntersection { - appendPoint(status: string); - appendPoints(status: string); - init(status: string); - } - - export interface IImage extends IObject { - filters: any; - - applyFilters(callback); - clone(callback?, propertiesToInclude?): IObject; - clone(propertiesToInclude, callback); - complexity(): number; - getElement(): HTMLImageElement; - getOriginalSize(): { width: number; height: number; }; - getSrc(): string; - initialize(options: any); - initialize(element: string, options: any); - initialize(element: HTMLImageElement, options: any); - render(ctx: CanvasRenderingContext2D, noTransform: boolean); - setElement(element): IImage; - toObject(propertiesToInclude): any; - tostring(): string; - toSVG(): string; - } - - export interface ICircle extends IObject { - // methods - complexity(): number; - getRadiusX(): number; - getRadiusY(): number; - initialize(options: ICircleOptions): ICircle; - setRadius(value: number): number; - toObject(propertiesToInclude): any; - toSVG(): string; - } - - - - export interface IPath extends IObject { - complexity(): number; - initialize(options: any); - initialize(path, options); - render(ctx: CanvasRenderingContext2D, noTransform: boolean); - toDatalessObject(propertiesToInclude): any; - toObject(propertiesToInclude): any; - tostring(): string; - toSVG(): string; - } - - export interface IPolygon extends IObject { - complexity(): number; - initialize(options: any); - initialize(points, options); - toObject(propertiesToInclude): any; - toSVG(): string; - } - - export interface IPolyline extends IObject { - complexity(): number; - initialize(options: any); - initialize(points, options); - toObject(propertiesToInclude): any; - toSVG(): string; - } - - export interface IPathGroup extends IObject { - complexity(): number; - initialize(options: any); - initialize(paths, options); - isSameColor(): boolean; - render(ctx: CanvasRenderingContext2D); - toDatalessObject(propertiesToInclude): any; - toGrayscale(): IPathGroup; - toObject(propertiesToInclude): any; - tostring(): string; - toSVG(): string; - } - - export interface IStaticCanvas extends IObservable { - - // fields - backgroundColor: string; - backgroundImage: string; - backgroundImageOpacity: number; - backgroundImageStretch: number; - clipTo(clipFunction: (context: CanvasRenderingContext2D) => void ); - controlsAboveOverlay: boolean; - includeDefaultValues: boolean; - overlayImage: string; - overlayImageLeft: number; - overlayImageTop: number; - renderOnAddition: boolean; - stateful: boolean; - - // static - EMPTY_JSON: string; - supports(methodName: string): boolean; - - // methods - add(...object: IObject[]): ICanvas; - bringForward(object: IObject): ICanvas; - calcOffset(): ICanvas; - centerObject(object: IObject): ICanvas; - centerObjectH(object: IObject): ICanvas; - centerObjectV(object: IObject): ICanvas; - clear(): ICanvas; - clearContext(context: CanvasRenderingContext2D): ICanvas; - complexity(): number; - dispose(): ICanvas; - drawControls(); - forEachObject(callback: (object: IObject) => void , context?: CanvasRenderingContext2D): ICanvas; - getActiveGroup(): IGroup; - getActiveObject(): IObject; - getCenter(): IObject; - getContext(): CanvasRenderingContext2D; - getElement(): HTMLCanvasElement; - getHeight(): number; - getObjects(): IObject[]; - getWidth(): number; - insertAt(object: IObject, index: number, nonSplicing: boolean): ICanvas; - isEmpty(): boolean; - item(index: number): IObject; - onBeforeScaleRotate(target: IObject); - remove(object: IObject): IObject; - renderAll(allOnTop?: boolean): ICanvas; - renderTop(): ICanvas; - - sendBackwards(object: IObject): ICanvas; - sendToBack(object: IObject): ICanvas; - setBackgroundImage(image: any, callback: () => any, options?): ICanvas; - setDimensions(object: { width: number; height: number; }): ICanvas; - setHeight(height: number): ICanvas; - setOverlayImage(url: string, callback: () => any, options): ICanvas; - setWidth(width: number): ICanvas; - toDatalessJSON(propertiesToInclude?: any[]): string; - toDatalessObject(propertiesToInclude?: any[]): string; - toDataURL(format: string, quality?: number): string; - toDataURLWithMultiplier(propertiesToInclude: any[]): string; - toGrayscale(propertiesToInclude: any[]): string; - toJSON(propertiesToInclude: any[]): string; - toObject(propertiesToInclude: any[]): string; - tostring(): string; - toSVG(): string; - } - - export interface ICanvas extends IStaticCanvas { - - // constructors - (element: HTMLCanvasElement): ICanvas; - (element: string): ICanvas; - - _objects: IObject[]; - - // fields - containerClass: string; - defaultCursor: string; - freeDrawingColor: string; - freeDrawingLineWidth: number; - hoverCursor: string; - interactive: boolean; - moveCursor: string; - perPixelTargetFind: boolean; - rotationCursor: string; - selection: boolean; - selectionBorderColor: string; - selectionColor: string; - selectionDashArray: number[]; - selectionLineWidth: number; - targetFindTolerance: number; - - // methods - containsPoint(e: Event, target: IObject): boolean; - deactivateAll(): ICanvas; - deactivateAllWithDispatch(): ICanvas; - discardActiveGroup(): ICanvas; - discardActiveObject(): ICanvas; - drawDashedLine(ctx: CanvasRenderingContext2D, x: number, y: number, x2: number, y2: number, dashArray: number[]): ICanvas; - findTarget(e: MouseEvent, skipGroup: boolean): ICanvas; - getActiveGroup(): IGroup; - getActiveObject(): IObject; - getPointer(e): { x: number; y: number; }; - getSelectionContext(): CanvasRenderingContext2D; - getSelectionElement(): HTMLCanvasElement; - setActiveGroup(group: IGroup): ICanvas; - setActiveObject(object: IObject, e?): ICanvas; - - loadFromJSON(json, callback: () => void): void; - loadFromDatalessJSON(json, callback: () => void): void; - } - - export interface IPattern { - (options: IPatternOptions): IPattern; - - initialise(options: IPatternOptions): IPattern; - - toLive(ctx: CanvasRenderingContext2D): IPattern; - toObject(): any; - toSVG(): string; - - offsetX: number; - offsetY: number; - repeat: string; - source: any; - } - - export interface IBrightnessFilter { - } - export interface IInvertFilter { - } - export interface IRemoveWhiteFilter { - } - export interface IGrayscaleFilter { - } - export interface ISepiaFilter { - } - export interface ISepia2Filter { - } - export interface INoiseFilter { - } - export interface IGradientTransparencyFilter { - } - export interface IPixelateFilter { - } - export interface IConvoluteFilter { - } - - export interface ICanvasOptions { - containerClass?: string; - defaultCursor?: string; - freeDrawingColor?: string; - freeDrawingLineWidth?: number; - hoverCursor?: string; - interactive?: boolean; - moveCursor?: string; - perPixelTargetFind?: boolean; - rotationCursor?: string; - selection?: boolean; - selectionBorderColor?: string; - selectionColor?: string; - selectionDashArray?: number[]; - selectionLineWidth?: number; - targetFindTolerance?: number; - - backgroundColor?: string; - backgroundImage?: string; - backgroundImageOpacity?: number; - backgroundImageStretch?: number; - controlsAboveOverlay?: boolean; - includeDefaultValues?: boolean; - overlayImage?: string; - overlayImageLeft?: number; - overlayImageTop?: number; - renderOnAddition?: boolean; - stateful?: boolean; - } - - export interface IPatternOptions { - source: any; - offsetX: number; - offsetY: number; - repeat: string; - } - - export interface IRectOptions extends IObjectOptions { - x?: number; - y?: number; - rx?: number; - ry?: number; - } - - export interface ITriangleOptions extends IObjectOptions { - } - - var Rect: { - fromElement(element: SVGElement, options: IRectOptions): IRect; - fromObject(object): IRect; - new (options?: IRectOptions): IRect; - prototype: any; - } - - var Triangle: { - new (options?: ITriangleOptions): ITriangle; - } - - var Canvas: { - new (element: HTMLCanvasElement, options?: ICanvasOptions): ICanvas; - new (element: string, options?: ICanvasOptions): ICanvas; - - EMPTY_JSON: string; - supports(methodName: string): boolean; - prototype: any; - } - - var StaticCanvas: { - new (element: HTMLCanvasElement, options?: ICanvasOptions): ICanvas; - new (element: string, options?: ICanvasOptions): ICanvas; - - EMPTY_JSON: string; - supports(methodName: string): boolean; - prototype: any; - } - - var Pattern: { - new (options: IPatternOptions): IPattern; - - prototype: any; - } - - var Circle: { - ATTRIBUTE_NAMES: string[]; - fromElement(element: SVGElement, options: ICircleOptions): ICircle; - fromObject(object): ICircle; - new (options?: ICircleOptions): ICircle; - prototype: any; - } - - var Group: { - new (items?: any[], options?: IObjectOptions): IGroup; - } - - var Line: { - ATTRIBUTE_NAMES: string[]; - fromElement(element: SVGElement, options): ILine; - fromObject(object): ILine; - prototype: any; - new (points: number[], objObjects?: IObjectOptions): ILine; - } - - var Intersection: { - intersectLineLine(a1, a2, b1, b2); - intersectLinePolygon(a1, a2, points); - intersectPolygonPolygon(points1, points2); - intersectPolygonRectangle(points, r1, r2); - } - - var Path: { - fromElement(element: SVGElement, options): IPath; - fromObject(object): IPath; - new (): IPath; - } - - var PathGroup: { - fromObject(object): IPathGroup; - new (): IPathGroup; - prototype: any; - } - - var Point: { - new (x, y): IPoint; - prototype: any; - } - - var Object: { - prototype: any; - } - - var Polygon: { - fromObject(object): IPolygon; - fromElement(element: SVGElement, options): IPolygon; - new (): IPolygon; - prototype: any; - } - - var Polyline: { - fromObject(object): IPolyline; - fromElement(element: SVGElement, options): IPolyline; - new (): IPolyline; - prototype: any; - } - - var Text: { - new (text: string, options?: ITextOptions): IText; - } - - var Image: { - fromURL(url: string): IImage; - fromURL(url: string, callback: (image: IImage) => any): IImage; - fromURL(url: string, callback: (image: IImage) => any, objObjects: IObjectOptions): IImage; - new (element: HTMLImageElement, objObjects: IObjectOptions): IImage; - prototype: any; - - filters: - { - Grayscale: { - new (): IGrayscaleFilter; - }; - Brightness: { - new (options?: { brightness: number; }): IBrightnessFilter; - }; - RemoveWhite: { - new (options?: { - threshold?: string; // TODO: Check this - distance?: string; // TODO: Check this - }): IRemoveWhiteFilter; - }; - Invert: { - new (): IInvertFilter; - }; - Sepia: { - new (): ISepiaFilter; - }; - Sepia2: { - new (): ISepia2Filter; - }; - Noise: { - new (options?: { - noise?: number; - }): INoiseFilter; - }; - GradientTransparency: { - new (options?: { - threshold?: number; - }): IGradientTransparencyFilter; - }; - Pixelate: { - new (options?: { - color?: any; - }): IPixelateFilter; - }; - Convolute: { - new (options?: { - matrix: any; - }): IConvoluteFilter; - }; - }; - - } - - var util: { - addClass(element: HTMLElement, className: string); - addListener(element, eventName: string, handler); - animate(options: { - onChange?: (value: number) => void; - onComplete?: () => void; - startValue?: number; - endValue?: number; - byValue?: number; - easing?: (currentTime, startValue, byValue, duration) => number; - duration?: number; - }); - createClass(parent, properties); - degreesToRadians(degrees: number): number; - falseFunction(): () => boolean; - getById(id: HTMLElement): HTMLElement; - getById(id: string): HTMLElement; - getElementOffset(element): { left: number; top: number; }; - getPointer(event: Event); - getRandomInt(min: number, max: number); - getScript(url: string, callback); - groupSVGElements(elements: any[], options, path?: string); - loadImage(url, callback, context); - makeElement(tagName: string, attributes); - makeElementSelectable(element: HTMLElement); - makeElementUnselectable(element: HTMLElement); - populateWithProperties(source, destination, properties): any[]; - radiansToDegrees(radians: number): number; - removeFromArray(array: any[], value); - removeListener(element: HTMLElement, eventName, handler); - request(url, options); - requestAnimFrame(callback, element); - setStyle(element: HTMLElement, styles); - 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); - - } + var isLikelyNode: boolean; + var isTouchSupported: boolean; + + ///////////////////////////////////////////////////////////// + // farbic Functions + ///////////////////////////////////////////////////////////// + + function createCanvasForNode(width: number, height: number): ICanvas; + + // Parse + // ---------------------------------------------------------- + /** + * Creates markup containing SVG referenced elements like patterns, gradients etc. + * @param {fabric.Canvas} canvas instance of fabric.Canvas + */ + function createSVGRefElementsMarkup(canvas: IStaticCanvas): string; + /** + * Creates markup containing SVG font faces + * @param {Array} objects Array of fabric objects + */ + function createSVGFontFacesMarkup(objects: IObject[]): string; + /** + * Takes string corresponding to an SVG document, and parses it into a set of fabric objects + * @param {String} string + * @param {Function} callback + * @param {Function} [reviver] Method for further parsing of SVG elements, called after each fabric object created. + */ + function loadSVGFromString(string: string, callback: (results: IObject[], options: any) => void, reviver?: Function); + /** + * Takes url corresponding to an SVG document, and parses it into a set of fabric objects. + * Note that SVG is fetched via XMLHttpRequest, so it needs to conform to SOP (Same Origin Policy) + * @param {String} url + * @param {Function} callback + * @param {Function} [reviver] Method for further parsing of SVG elements, called after each fabric object created. + */ + function loadSVGFromURL(url: string, callback: (results: IObject[], options: any) => void, reviver?: Function); + /** + * Returns CSS rules for a given SVG document + * @param {SVGDocument} doc SVG document to parse + */ + function getCSSRules(doc: SVGElement): any; + + function parseElements(elements: any[], callback: Function, options: any, reviver?: Function); + /** + * Parses "points" attribute, returning an array of values + * @param {String} points points attribute string + */ + function parsePointsAttribute(points: string): any[]; + /** + * Parses "style" attribute, retuning an object with values + * @param {SVGElement} element Element to parse + */ + function parseStyleAttribute(element: SVGElement): any; + /** + * Transforms an array of svg elements to corresponding fabric.* instances + * @param {Array} elements Array of elements to parse + * @param {Function} callback Being passed an array of fabric instances (transformed from SVG elements) + * @param {Object} [options] Options object + * @param {Function} [reviver] Method for further parsing of SVG elements, called after each fabric object created. + */ + function parseElements(elements: any[], callback: Function, options?: any, reviver?: Function): void; + /** + * Returns an object of attributes' name/value, given element and an array of attribute names; + * Parses parent "g" nodes recursively upwards. + * @param {DOMElement} element Element to parse + * @param {Array} attributes Array of attributes to parse + */ + function parseAttributes(elemen: HTMLElement, attributes: string[], svgUid?: string): { [key: string]: string } + /** + * Parses an SVG document, returning all of the gradient declarations found in it + * @param {SVGDocument} doc SVG document to parse + */ + function getGradientDefs(doc: SVGElement): { [key: string]: any }; + /** + * Parses a short font declaration, building adding its properties to a style object + * @param {String} value font declaration + * @param {Object} oStyle definition + */ + function parseFontDeclaration(value: string, oStyle: any): void; + /** + * Parses an SVG document, converts it to an array of corresponding fabric.* instances and passes them to a callback + * @param {SVGDocument} doc SVG document to parse + * @param {Function} callback Callback to call when parsing is finished; It's being passed an array of elements (parsed from a document). + * @param {Function} [reviver] Method for further parsing of SVG elements, called after each fabric object created. + */ + function parseSVGDocument(doc: SVGElement, callback: (results: IObject[], options: any) => void, reviver?: Function); + /** + * Parses "transform" attribute, returning an array of values + * @param {String} attributeValue String containing attribute value + */ + function parseTransformAttribute(attributeValue: string): number[]; + + // fabric Log + // --------------- + /** + * Wrapper around `console.log` (when available) + */ + function log(...values: any[]); + /** + * Wrapper around `console.warn` (when available) + */ + function warn(...values: any[]); + + //////////////////////////////////////////////////// + // Classes + //////////////////////////////////////////////////// + var Canvas: ICanvasStatic; + var StaticCanvas: IStaticCanvasStatic; + + var Color: IColorStatic; + var Pattern: IPatternStatic; + var Intersection: IIntersectionStatic; + var Point: IPointStatic; + + var Circle: ICircleStatic; + var Ellipse: IEllipseStatic; + var Group: IGroupStatic; + var Image: IImageStatic; + var Line: ILineStatic; + var Object: IObjectStatic; + var Path: IPathStatic; + var PathGroup: IPathGroupStatic; + var Polygon: IPolygonStatic; + var Polyline: IPolylineStatic; + var Rect: IRectStatic; + var Shadow: IShadowStatic; + var Text: ITextStatic; + var IText: IITextStatic; + var Triangle: ITriangleStatic; + + var util: IUtil; + + /////////////////////////////////////////////////////////////////////////////// + // Data Object Interfaces - These intrface are not specific part of fabric, + // They are just helpful for for defining function paramters + ////////////////////////////////////////////////////////////////////////////// + interface IDataURLOptions { + /** + * The format of the output image. Either "jpeg" or "png" + */ + format?: string; + /** + * Quality level (0..1). Only used for jpeg + */ + quality?: number; + /** + * Multiplier to scale by + */ + multiplier?: number; + /** + * Cropping left offset. Introduced in v1.2.14 + */ + left?: number; + /** + * Cropping top offset. Introduced in v1.2.14 + */ + top?: number; + /** + * Cropping width. Introduced in v1.2.14 + */ + width?: number; + /** + * Cropping height. Introduced in v1.2.14 + */ + height?: number; + } + + interface IEvent { + e: Event; + target?: IObject; + } + + interface IFillOptions { + /** + * options.source Pattern source + */ + source: string | HTMLImageElement; + /** + * Repeat property of a pattern (one of repeat, repeat-x, repeat-y or no-repeat) + */ + repeat?: string; + /** + * Pattern horizontal offset from object's left/top corner + */ + offsetX?: number; + /** + * Pattern vertical offset from object's left/top corner + */ + offsetY?: number; + } + + interface IToSVGOptions { + /** + * If true xml tag is not included + */ + suppressPreamble: boolean; + /** + * SVG viewbox object + */ + viewBox: IViewBox; + /** + * Encoding of SVG output + */ + encoding: string; + } + + interface IViewBox { + /** + * x-cooridnate of viewbox + */ + x: number; + /** + * y-coordinate of viewbox + */ + y: number; + /** + * Width of viewbox + */ + width: number; + /** + * Height of viewbox + */ + height: number; + } + + /////////////////////////////////////////////////////////////////////////////// + // Mixins Interfaces + ////////////////////////////////////////////////////////////////////////////// + interface ICollection { + /** + * Adds objects to collection, then renders canvas (if `renderOnAddRemove` is not `false`) + * Objects should be instances of (or inherit from) fabric.Object + * @param {...fabric.Object} object Zero or more fabric instances + */ + add(...object: IObject[]): T; + + /** + * Inserts an object into collection at specified index, then renders canvas (if `renderOnAddRemove` is not `false`) + * An object should be an instance of (or inherit from) fabric.Object + * @param {Object} object Object to insert + * @param {Number} index Index to insert object at + * @param {Boolean} nonSplicing When `true`, no splicing (shifting) of objects occurs + * @return {Self} thisArg + * @chainable + */ + insertAt(object: IObject, index: number, nonSplicing: boolean): T; + + /** + * Removes objects from a collection, then renders canvas (if `renderOnAddRemove` is not `false`) + * @param {...fabric.Object} object Zero or more fabric instances + * @return {Self} thisArg + * @chainable + */ + remove(...object: IObject[]): T; + + /** + * Executes given function for each object in this group + * @param {Function} callback + * @param {Object} context Context (aka thisObject) + * @return {Self} thisArg + */ + forEachObject(callback: (element: IObject, index: number, array: IObject[]) => any, context?: any): T; + + /** + * Returns an array of children objects of this instance + * Type parameter introduced in 1.3.10 + * @param {String} [type] When specified, only objects of this type are returned + * @return {Array} + */ + getObjects(type?: string): IObject[]; + + /** + * Returns object at specified index + * @param {Number} index + * @return {Self} thisArg + */ + item(index: number): T; + + /** + * Returns true if collection contains no objects + * @return {Boolean} true if collection is empty + */ + isEmpty(): boolean; + + /** + * Returns a size of a collection (i.e: length of an array containing its objects) + * @return {Number} Collection size + */ + size(): number; + + /** + * Returns true if collection contains an object + * @param {Object} object Object to check against + * @return {Boolean} `true` if collection contains an object + */ + contains(object: IObject): boolean; + + /** + * Returns number representation of a collection complexity + * @return {Number} complexity + */ + complexity(): number; + } + + interface IObservable { + /** + * Observes specified event + * @param eventName Event name (eg. 'after:render') + * @param handler Function that receives a notification when an event of the specified type occurs + */ + on(eventName: string, handler: (e: IEvent) => any): T; + + /** + * Observes specified event + * @param eventName Object with key/value pairs (eg. {'after:render': handler, 'selection:cleared': handler}) + */ + on(eventName: {[key:string] : Function}): T; + /** + * Fires event with an optional options object + * @deprecated `fire` deprecated since 1.0.7 (use `trigger` instead) + * @param {String} eventName Event name to fire + * @param {Object} [options] Options object + */ + trigger(eventName: string, options?: any): T; + /** + * Stops event observing for a particular event handler. Calling this method + * without arguments removes all handlers for all events + * @deprecated `stopObserving` deprecated since 0.8.34 (use `off` instead) + * @param eventName Event name (eg. 'after:render') or object with key/value pairs (eg. {'after:render': handler, 'selection:cleared': handler}) + * @param handler Function to be deleted from EventListeners + */ + off(eventName: string|any, handler: (e: IEvent) => any): T; + } + + // animation mixin + // ---------------------------------------------------- + interface ICanvasAnimation { + FX_DURATION: number; + /** + * Centers object horizontally with animation. + * @param {fabric.Object} object Object to center + * @param {Object} [callbacks] Callbacks object with optional "onComplete" and/or "onChange" properties + * @param {Function} [callbacks.onComplete] Invoked on completion + * @param {Function} [callbacks.onChange] Invoked on every step of animation + */ + fxCenterObjectH(object: IObject, callbacks?: { onComplete: Function; onChange: Function; }): T; + + /** + * Centers object vertically with animation. + * @param {fabric.Object} object Object to center + * @param {Object} [callbacks] Callbacks object with optional "onComplete" and/or "onChange" properties + * @param {Function} [callbacks.onComplete] Invoked on completion + * @param {Function} [callbacks.onChange] Invoked on every step of animation + */ + fxCenterObjectV(object: IObject, callbacks?: { onComplete: Function; onChange: Function; }): T; + + /** + * Same as `fabric.Canvas#remove` but animated + * @param {fabric.Object} object Object to remove + * @param {Object} [callbacks] Callbacks object with optional "onComplete" and/or "onChange" properties + * @param {Function} [callbacks.onComplete] Invoked on completion + * @param {Function} [callbacks.onChange] Invoked on every step of animation + * @return {fabric.Canvas} thisArg + * @chainable + */ + fxRemove(object: IObject, callbacks?: { onComplete: Function; onChange: Function; }): T; + } + interface IObjectAnimation { + /** + * Animates object's properties + * object.animate('left', ..., {duration: ...}); + * @param property Property to animate + * @param value Value to animate property + * @param options The animation options + */ + animate(property: string, value: number|string, options?: IAnimationOptions): IObject; + /** + * Animates object's properties + * object.animate({ left: ..., top: ... }, { duration: ... }); + * @param properties Properties to animate + * @param value Options object + */ + animate(properties: any, options?: IAnimationOptions): IObject; + } + interface IAnimationOptions { + /** + * Allows to specify starting value of animatable property (if we don't want current value to be used). + */ + from?: string|number; + /** + * Defaults to 500 (ms). Can be used to change duration of an animation. + */ + duration?: number; + /** + * Callback; invoked on every value change + */ + onChange?: Function; + /** + * Callback; invoked when value change is completed + */ + onComplete?: Function; + + /** + * Easing function. Default: fabric.util.ease.easeInSine + */ + easing?: Function; + /** + * Value to modify the property by, default: end - start + */ + by?: number; + } + + /////////////////////////////////////////////////////////////////////////////// + // General Fabric Interfaces + ////////////////////////////////////////////////////////////////////////////// + interface IColor { + /** + * Returns source of this color (where source is an array representation; ex: [200, 200, 100, 1]) + */ + getSource(): number[]; + + /** + * Sets source of this color (where source is an array representation; ex: [200, 200, 100, 1]) + */ + setSource(source: number[]); + + /** + * Returns color represenation in RGB format ex: rgb(0-255,0-255,0-255) + */ + toRgb(): string; + + /** + * Returns color represenation in RGBA format ex: rgba(0-255,0-255,0-255,0-1) + */ + toRgba(): string; + + /** + * Returns color represenation in HSL format ex: hsl(0-360,0%-100%,0%-100%) + */ + toHsl(): string; + + /** + * Returns color represenation in HSLA format ex: hsla(0-360,0%-100%,0%-100%,0-1) + */ + toHsla(): string; + + /** + * Returns color represenation in HEX format ex: FF5555 + */ + toHex(): string; + + /** + * Gets value of alpha channel for this color + */ + getAlpha(): number; + + /** + * Sets value of alpha channel for this color + * @param {Number} alpha Alpha value 0-1 + */ + setAlpha(alpha: number); + + /** + * Transforms color to its grayscale representation + */ + toGrayscale(): IColor; + + /** + * Transforms color to its black and white representation + * @param {Number} threshold + */ + toBlackWhite(threshold: number): IColor; + /** + * Overlays color with another color + * @param {String|fabric.Color} otherColor + */ + overlayWith(otherColor: string|IColor): IColor; + } + interface IColorStatic { + /** + * Color class + * The purpose of Color is to abstract and encapsulate common color operations; + * @param {String} color optional in hex or rgb(a) format + */ + new (color?: string): IColor; + + /** + * Returns new color object, when given a color in RGB format + * @param {String} color Color value ex: rgb(0-255,0-255,0-255) + */ + fromRgb(color: string): IColor; + /** + * Returns new color object, when given a color in RGBA format + * @param {String} color Color value ex: rgb(0-255,0-255,0-255) + */ + fromRgba(color: string): IColor; + /** + * Returns array represenatation (ex: [100, 100, 200, 1]) of a color that's in RGB or RGBA format + * @param {String} color Color value ex: rgb(0-255,0-255,0-255), rgb(0%-100%,0%-100%,0%-100%) + */ + sourceFromRgb(color: string): number[]; + /** + * Returns new color object, when given a color in HSL format + * @param {String} color Color value ex: hsl(0-260,0%-100%,0%-100%) + */ + fromHsl(color: string): IColor; + /** + * Returns new color object, when given a color in HSLA format + * @param {String} color Color value ex: hsl(0-260,0%-100%,0%-100%) + */ + fromHsla(color: string): IColor; + /** + * Returns array represenatation (ex: [100, 100, 200, 1]) of a color that's in HSL or HSLA format. + * @param {String} color Color value ex: hsl(0-360,0%-100%,0%-100%) or hsla(0-360,0%-100%,0%-100%, 0-1) + */ + sourceFromHsl(color: string): number[]; + /** + * Returns new color object, when given a color in HEX format + * @param {String} color Color value ex: FF5555 + */ + fromHex(color: string): IColor; + + /** + * Returns array represenatation (ex: [100, 100, 200, 1]) of a color that's in HEX format + * @param {String} color ex: FF5555 + */ + sourceFromHex(color: string): number[]; + /** + * Returns new color object, when given color in array representation (ex: [200, 100, 100, 0.5]) + * @param {Array} source + */ + fromSource(source: number[]): IColor; + prototype: any; + } + + interface IGradientOptions { + /** + * @param {String} [options.type] Type of gradient 'radial' or 'linear' + */ + type?: string; + /** + * x-coordinate of start point + */ + x1?: number; + /** + * y-coordinate of start point + */ + y1?: number; + /** + * x-coordinate of end point + */ + x2?: number; + /** + * y-coordinate of end point + */ + y2?: number; + /** + * Radius of start point (only for radial gradients) + */ + r1?: number; + /** + * Radius of end point (only for radial gradients) + */ + r2?: number; + /** + * Color stops object eg. {0:string; 1:string; + */ + colorStops?: any; + } + interface IGradient extends IGradientOptions { + /** + * Adds another colorStop + * @param {Object} colorStop Object with offset and color + */ + addColorStop(colorStop: any): IGradient; + /** + * Returns object representation of a gradient + */ + toObject(): any; + /** + * Returns SVG representation of an gradient + * @param {Object} object Object to create a gradient for + * @param {Boolean} normalize Whether coords should be normalized + * @return {String} SVG representation of an gradient (linear/radial) + */ + toSVG(object: IObject, normalize?: boolean): string; + + /** + * Returns an instance of CanvasGradient + * @param {CanvasRenderingContext2D} ctx Context to render on + */ + toLive(ctx: CanvasRenderingContext2D, object?: IPathGroup): CanvasGradient; + } + interface IGrandientStatic { + new (options?: IGradientOptions): IGradient; + /** + * Returns instance from an SVG element + * @param {SVGGradientElement} el SVG gradient element + * @param {fabric.Object} instance + */ + fromElement(el: SVGGradientElement, instance: IObject): IGradient; + /** + * Returns instance from its object representation + * @param {Object} obj + * @param {Object} [options] Options object + */ + fromObject(obj: any, options: any[]): IGradient; + } + + interface IIntersection { + /** + * Appends a point to intersection + */ + appendPoint(point: IPoint); + /** + * Appends points to intersection + */ + appendPoints(points: IPoint[]); + } + interface IIntersectionStatic { + /** + * Intersection class + */ + new (status?: string); + /** + * Checks if polygon intersects another polygon + */ + intersectPolygonPolygon(points1: IPoint[], points2: IPoint[]): IIntersection; + /** + * Checks if line intersects polygon + */ + intersectLinePolygon(a1: IPoint, a2: IPoint, points: IPoint[]): IIntersection; + /** + * Checks if one line intersects another + */ + intersectLineLine(a1: IPoint, a2: IPoint, b1: IPoint, b2: IPoint): IIntersection; + /** + * Checks if polygon intersects rectangle + */ + intersectPolygonRectangle(points: IPoint[], r1: number, r2: number): IIntersection; + } + + interface IPatternOptions { + /** + * Repeat property of a pattern (one of repeat, repeat-x, repeat-y or no-repeat) + */ + repeat: string; + + /** + * Pattern horizontal offset from object's left/top corner + */ + offsetX: number; + + /** + * Pattern vertical offset from object's left/top corner + */ + offsetY: number; + /** + * The source for the pattern + */ + source: string|HTMLImageElement; + } + interface IPattern extends IPatternOptions { + new (options?: IPatternOptions): IPattern; + + initialise(options?: IPatternOptions): IPattern; + /** + * Returns an instance of CanvasPattern + */ + toLive(ctx: CanvasRenderingContext2D): IPattern; + + /** + * Returns object representation of a pattern + */ + toObject(): any; + /** + * Returns SVG representation of a pattern + * @param {fabric.Object} object + */ + toSVG(object: IObject): string; + } + interface IPatternStatic { + new (options?: IPatternOptions): IPattern; + prototype: any; + } + + interface IPoint { + x: number; + y: number; + /** + * Adds another point to this one and returns another one + * @param {fabric.Point} that + */ + add(that: IPoint): IPoint; + + /** + * Adds another point to this one + * @param {fabric.Point} that + */ + addEquals(that: IPoint): IPoint; + + /** + * Adds value to this point and returns a new one + * @param {Number} scalar + */ + scalarAdd(scalar: number): IPoint; + + /** + * Adds value to this point + * @param {Number} scalar + */ + scalarAddEquals(scalar: number): IPoint; + + /** + * Subtracts another point from this point and returns a new one + * @param {fabric.Point} that + */ + subtract(that: IPoint): IPoint; + + /** + * Subtracts another point from this point + * @param {fabric.Point} that + */ + subtractEquals(that: IPoint): IPoint; + + /** + * Subtracts value from this point and returns a new one + * @param {Number} scalar + */ + scalarSubtract(scalar: number): IPoint; + + /** + * Subtracts value from this point + * @param {Number} scalar + */ + scalarSubtractEquals(scalar: number): IPoint; + + /** + * Miltiplies this point by a value and returns a new one + * @param {Number} scalar + */ + multiply(scalar: number): IPoint; + + /** + * Miltiplies this point by a value + * @param {Number} scalar + */ + multiplyEquals(scalar: number): IPoint; + + /** + * Divides this point by a value and returns a new one + * @param {Number} scalar + */ + divide(scalar: number): IPoint; + + /** + * Divides this point by a value + * @param {Number} scalar + */ + divideEquals(scalar: number): IPoint; + + /** + * Returns true if this point is equal to another one + * @param {fabric.Point} that + */ + eq(that: IPoint): IPoint; + + /** + * Returns true if this point is less than another one + * @param {fabric.Point} that + */ + lt(that: IPoint): IPoint; + + /** + * Returns true if this point is less than or equal to another one + * @param {fabric.Point} that + */ + lte(that: IPoint): IPoint; + + /** + * Returns true if this point is greater another one + * @param {fabric.Point} that + */ + gt(that: IPoint): IPoint; + + /** + * Returns true if this point is greater than or equal to another one + * @param {fabric.Point} that + */ + gte(that: IPoint): IPoint; + + /** + * Returns new point which is the result of linear interpolation with this one and another one + * @param {fabric.Point} that + * @param {Number} t + */ + lerp(that: IPoint, t: number): IPoint; + + /** + * Returns distance from this point and another one + * @param {fabric.Point} that + */ + distanceFrom(that: IPoint): number; + + /** + * Returns the point between this point and another one + * @param {fabric.Point} that + */ + midPointFrom(that: IPoint): IPoint; + + /** + * Returns a new point which is the min of this and another one + * @param {fabric.Point} that + */ + min(that: IPoint): IPoint; + + /** + * Returns a new point which is the max of this and another one + * @param {fabric.Point} that + */ + max(that: IPoint): IPoint; + + /** + * Returns string representation of this point + */ + toString(): string; + + /** + * Sets x/y of this point + * @param {Number} x + * @param {Number} y + */ + setXY(x:number, y: number): IPoint; + + /** + * Sets x/y of this point from another point + * @param {fabric.Point} that + */ + setFromPoint(that: IPoint): IPoint; + + /** + * Swaps x/y of this point and another point + * @param {fabric.Point} that + */ + swap(that: IPoint): IPoint; + } + interface IPointStatic { + new (x: number, y: number): IPoint; + prototype: any; + } + + interface IShadowOptions { + /** + * Whether the shadow should affect stroke operations + */ + affectStrike: boolean; + /** + * Shadow blur + */ + blur: number; + /** + * Shadow color + */ + color: string; + /** + * Indicates whether toObject should include default values + */ + includeDefaultValues: boolean; + /** + * Shadow horizontal offset + */ + offsetX: number; + /** + * Shadow vertical offset + */ + offsetY: number; + } + interface IShadow extends IShadowOptions { + initialize(options?: IShadowOptions|string): IShadow; + /** + * Returns object representation of a shadow + */ + toObject(): IObject; + /** + * Returns a string representation of an instance, CSS3 text-shadow declaration + */ + toString(): string; + /** + * Returns SVG representation of a shadow + * @param {fabric.Object} object + */ + toSVG(object: IObject): string; + + /** + * Regex matching shadow offsetX, offsetY and blur, Static + */ + reOffsetsAndBlur: RegExp + } + interface IShadowStatic { + new (options?: IShadowOptions): IShadow; + reOffsetsAndBlur: RegExp; + } + + /////////////////////////////////////////////////////////////////////////////// + // Canvas Interfaces + ////////////////////////////////////////////////////////////////////////////// + interface ICanvasDimensions { + /** + * Width of canvas element + */ + width: number; + /** + * Height of canvas element + */ + height: number; + } + interface ICanvasDimensionsOptions { + /** + * Set the given dimensions only as canvas backstore dimensions + */ + backstoreOnly?: boolean; + /** + * Set the given dimensions only as css dimensions + */ + cssOnly?: boolean; + } + + interface IStaticCanvasOptions { + /** + * Indicates whether the browser can be scrolled when using a touchscreen and dragging on the canvas + */ + allowTouchScrolling?: boolean; + /** + * Indicates whether this canvas will use image smoothing, this is on by default in browsers + */ + imageSmoothingEnabled?: boolean; + + /** + * Indicates whether objects should remain in current stack position when selected. + * When false objects are brought to top and rendered as part of the selection group + */ + preserveObjectStacking?: boolean; + + /** + * The transformation (in the format of Canvas transform) which focuses the viewport + */ + viewportTransform?: number[]; + + freeDrawingColor?: string; + freeDrawingLineWidth?: number; + + /** + * Background color of canvas instance. + * Should be set via setBackgroundColor + */ + backgroundColor?: string|IPattern; + /** + * Background image of canvas instance. + * Should be set via setBackgroundImage + * Backwards incompatibility note: The "backgroundImageOpacity" and "backgroundImageStretch" properties are deprecated since 1.3.9. + */ + backgroundImage?: IImage | string; + backgroundImageOpacity?: number; + backgroundImageStretch?: number; + /** + * Function that determines clipping of entire canvas area + * Being passed context as first argument. See clipping canvas area + */ + clipTo?: (context: CanvasRenderingContext2D) => void; + + /** + * Indicates whether object controls (borders/controls) are rendered above overlay image + */ + controlsAboveOverlay?: boolean; + + /** + * Indicates whether toObject/toDatalessObject should include default values + */ + includeDefaultValues?: boolean; + /** + * Overlay color of canvas instance. + * Should be set via setOverlayColor + */ + overlayColor?: string|IPattern; + /** + * Overlay image of canvas instance. + * Should be set via setOverlayImage + * Backwards incompatibility note: The "overlayImageLeft" and "overlayImageTop" properties are deprecated since 1.3.9. + */ + overlayImage?: IImage; + overlayImageLeft?: number; + overlayImageTop?: number; + /** + * Indicates whether add, insertAt and remove should also re-render canvas. + * Disabling this option could give a great performance boost when adding/removing a lot of objects to/from canvas at once + * (followed by a manual rendering after addition/deletion) + */ + renderOnAddRemove?: boolean; + /** + * Indicates whether objects' state should be saved + */ + stateful?: boolean; + } + interface IStaticCanvas extends IObservable, IStaticCanvasOptions, ICollection, ICanvasAnimation { + /** + * Calculates canvas element offset relative to the document + * This method is also attached as "resize" event handler of window + */ + calcOffset(): IStaticCanvas; + + /** + * Sets {@link fabric.StaticCanvas#overlayImage|overlay image} for this canvas + * @param {(fabric.Image|String)} image fabric.Image instance or URL of an image to set overlay to + * @param {Function} callback callback to invoke when image is loaded and set as an overlay + * @param {Object} [options] Optional options to set for the {@link fabric.Image|overlay image}. + */ + setOverlayImage(image: IImage|string, callback: Function, options?: IObjectOptions): IStaticCanvas; + + /** + * Sets {@link fabric.StaticCanvas#backgroundImage|background image} for this canvas + * @param {(fabric.Image|String)} image fabric.Image instance or URL of an image to set background to + * @param {Function} callback Callback to invoke when image is loaded and set as background + * @param {Object} [options] Optional options to set for the {@link fabric.Image|background image}. + */ + setBackgroundImage(image: IImage|string, callback: Function, options?: IObjectOptions): IStaticCanvas; + + /** + * Sets {@link fabric.StaticCanvas#overlayColor|background color} for this canvas + * @param {(String|fabric.Pattern)} overlayColor Color or pattern to set background color to + * @param {Function} callback Callback to invoke when background color is set + */ + setOverlayColor(overlayColor: string|IPattern, callback: Function): IStaticCanvas; + + /** + * Sets {@link fabric.StaticCanvas#backgroundColor|background color} for this canvas + * @param {(String|fabric.Pattern)} backgroundColor Color or pattern to set background color to + * @param {Function} callback Callback to invoke when background color is set + */ + setBackgroundColor(backgroundColor: string|IPattern, callback: Function): IStaticCanvas; + + /** + * Returns canvas width (in px) + */ + getWidth(): number; + + /** + * Returns canvas height (in px) + */ + getHeight(): number; + + /** + * Sets width of this canvas instance + * @param {Number|String} value Value to set width to + * @param {Object} [options] Options object + */ + setWidth(value: number|string, options?: ICanvasDimensionsOptions): IStaticCanvas + + /** + * Sets height of this canvas instance + * @param {Number|String} value Value to set height to + * @param {Object} [options] Options object + */ + setHeight(value: number|string, options?: ICanvasDimensionsOptions): IStaticCanvas; + + /** + * Sets dimensions (width, height) of this canvas instance. when options.cssOnly flag active you should also supply the unit of measure (px/%/em) + * @param {Object} dimensions Object with width/height properties + * @param {Object} [options] Options object + */ + setDimensions(dimensions: ICanvasDimensions, options?: ICanvasDimensionsOptions): IStaticCanvas; + + /** + * Returns canvas zoom level + */ + getZoom(): number; + + /** + * Sets viewport transform of this canvas instance + * @param {Array} vpt the transform in the form of context.transform + */ + setViewportTransform(vpt: number[]): IStaticCanvas; + + /** + * Sets zoom level of this canvas instance, zoom centered around point + * @param {fabric.Point} point to zoom with respect to + * @param {Number} value to set zoom to, less than 1 zooms out + */ + zoomToPoint(point: IPoint, value: number): IStaticCanvas; + + /** + * Sets zoom level of this canvas instance + * @param {Number} value to set zoom to, less than 1 zooms out + */ + setZoom(value: number): IStaticCanvas; + + /** + * Pan viewport so as to place point at top left corner of canvas + * @param {fabric.Point} point to move to + */ + absolutePan(point: IPoint): IStaticCanvas; + + /** + * Pans viewpoint relatively + * @param {fabric.Point} point (position vector) to move by + */ + relativePan(point: IPoint): IStaticCanvas; + + /** + * Returns element corresponding to this instance + */ + getElement(): HTMLCanvasElement; + + /** + * Returns currently selected object, if any + */ + getActiveObject(): IObject; + + /** + * Returns currently selected group of object, if any + */ + getActiveGroup(): IGroup; + + /** + * Clears specified context of canvas element + * @param {CanvasRenderingContext2D} ctx Context to clear + * @chainable + */ + clearContext(ctx: CanvasRenderingContext2D): IStaticCanvas; + + /** + * Returns context of canvas where objects are drawn + */ + getContext(): CanvasRenderingContext2D; + + /** + * Clears all contexts (background, main, top) of an instance + */ + clear(): IStaticCanvas; + + /** + * Renders both the top canvas and the secondary container canvas. + * @param {Boolean} [allOnTop] Whether we want to force all images to be rendered on the top canvas + * @chainable + */ + renderAll(allOnTop?: boolean): IStaticCanvas; + + /** + * Method to render only the top canvas. + * Also used to render the group selection box. + * @chainable + */ + renderTop(): IStaticCanvas; + + /** + * Returns coordinates of a center of canvas. + * Returned value is an object with top and left properties + */ + getCenter(): { top: number; left: number; }; + /** + * Centers object horizontally. + * You might need to call `setCoords` on an object after centering, to update controls area. + * @param {fabric.Object} object Object to center horizontally + */ + centerObjectH(object: IObject): IStaticCanvas; + + /** + * Centers object vertically. + * You might need to call `setCoords` on an object after centering, to update controls area. + * @param {fabric.Object} object Object to center vertically + */ + centerObjectV(object: IObject): IStaticCanvas; + + /** + * Centers object vertically and horizontally. + * You might need to call `setCoords` on an object after centering, to update controls area. + * @param {fabric.Object} object Object to center vertically and horizontally + */ + centerObject(object: IObject): IStaticCanvas; + + /** + * Returs dataless JSON representation of canvas + * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output + */ + toDatalessJSON(propertiesToInclude?: any[]): string; + + /** + * Returns object representation of canvas + * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output + */ + toObject(propertiesToInclude?: any[]): any; + + /** + * Returns dataless object representation of canvas + * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output + */ + toDatalessObject(propertiesToInclude?: any[]): any; + + /** + * When true, getSvgTransform() will apply the StaticCanvas.viewportTransform to the SVG transformation. When true, + * a zoomed canvas will then produce zoomed SVG output. + */ + svgViewportTransformation: boolean; + + /** + * Returns SVG representation of canvas + * @param {Object} [options] Options object for SVG output + * @param {Function} [reviver] Method for further parsing of svg elements, called after each fabric object converted into svg representation. + */ + toSVG(options: IToSVGOptions, reviver?: Function): string; + + /** + * Moves an object to the bottom of the stack of drawn objects + * @param {fabric.Object} object Object to send to back + * @chainable + */ + sendToBack(object: IObject): IStaticCanvas; + + /** + * Moves an object to the top of the stack of drawn objects + * @param {fabric.Object} object Object to send + * @chainable + */ + bringToFront(object: IObject): IStaticCanvas; + + /** + * Moves an object down in stack of drawn objects + * @param {fabric.Object} object Object to send + * @param {Boolean} [intersecting] If `true`, send object behind next lower intersecting object + * @chainable + */ + sendBackwards(object: IObject): IStaticCanvas; + + /** + * Moves an object up in stack of drawn objects + * @param {fabric.Object} object Object to send + * @param {Boolean} [intersecting] If `true`, send object in front of next upper intersecting object + * @chainable + */ + bringForward(object: IObject): IStaticCanvas; + /** + * Moves an object to specified level in stack of drawn objects + * @param {fabric.Object} object Object to send + * @param {Number} index Position to move to + * @chainable + */ + moveTo(object: IObject, index: number): IStaticCanvas; + + /** + * Clears a canvas element and removes all event listeners + */ + dispose(): IStaticCanvas; + + /** + * Returns a string representation of an instance + */ + toString(): string; + + /** + * Exports canvas element to a dataurl image. Note that when multiplier is used, cropping is scaled appropriately + * @param {Object} [options] Options object + */ + toDataURL(options?: IDataURLOptions): string; + + /** + * Provides a way to check support of some of the canvas methods + * (either those of HTMLCanvasElement itself, or rendering context) + * @param {String} methodName Method to check support for; Could be one of "getImageData", "toDataURL", "toDataURLWithQuality" or "setLineDash" + * @return {Boolean | null} `true` if method is supported (or at least exists), null` if canvas element or context can not be initialized + */ + supports(methodName: string): boolean; + + /** + * Populates canvas with data from the specified JSON. + * JSON format must conform to the one of toJSON formats + * @param {String|Object} json JSON string or object + * @param {Function} callback Callback, invoked when json is parsed + * and corresponding objects (e.g: {@link fabric.Image}) + * are initialized + * @param {Function} [reviver] Method for further parsing of JSON elements, called after each fabric object created. + */ + loadFromJSON(json: string|any, callback: Function, reviver?: Function): ICanvas; + /** + * Clones canvas instance + * @param {Object} [callback] Receives cloned instance as a first argument + * @param {Array} [properties] Array of properties to include in the cloned canvas and children + */ + clone(callback: (canvas: IStaticCanvas) => any, properties?: any[]): void; + + /** + * Clones canvas instance without cloning existing data. + * This essentially copies canvas dimensions, clipping properties, etc. + * but leaves data empty (so that you can populate it with your own) + * @param {Object} [callback] Receives cloned instance as a first argument + */ + cloneWithoutData(callback: (canvas: IStaticCanvas) => any): void; + + /** + * Callback; invoked right before object is about to be scaled/rotated + */ + onBeforeScaleRotate(target: IObject); + + // Functions from object straighten mixin + // -------------------------------------------------------------------------------------------------------------------------------- + + /** + * Straightens object, then rerenders canvas + * @param {fabric.Object} object Object to straighten + */ + straightenObject(object: IObject): IStaticCanvas + + /** + * Same as straightenObject, but animated + * @param {fabric.Object} object Object to straighten + */ + fxStraightenObject(object: IObject): IStaticCanvas + } + interface IStaticCanvasStatic { + /** + * Constructor + * @param {HTMLElement|String} element element to initialize instance on + * @param {Object} [options] Options object + */ + new (element: HTMLCanvasElement|string, options?: ICanvasOptions): IStaticCanvas; + + EMPTY_JSON: string; + /** + * Provides a way to check support of some of the canvas methods + * (either those of HTMLCanvasElement itself, or rendering context) + * @param {String} methodName Method to check support for; Could be one of "getImageData", "toDataURL", "toDataURLWithQuality" or "setLineDash" + */ + supports(methodName: string): boolean; + prototype: any; + /** + * Returns JSON representation of canvas + * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output + */ + toJSON(propertiesToInclude?: any[]): string; + } + + interface ICanvasOptions extends IStaticCanvasOptions { + /** + * When true, objects can be transformed by one side (unproportionally) + */ + uniScaleTransform?: boolean; + + /** + * When true, objects use center point as the origin of scale transformation. + * Backwards incompatibility note: This property replaces "centerTransform" (Boolean). + */ + centeredScaling?: boolean; + + /** + * When true, objects use center point as the origin of rotate transformation. + * Backwards incompatibility note: This property replaces "centerTransform" (Boolean). + */ + centeredRotation?: boolean; + + /** + * Indicates that canvas is interactive. This property should not be changed. + */ + interactive?: boolean; + + /** + * Indicates whether group selection should be enabled + */ + selection?: boolean; + + /** + * Color of selection + */ + selectionColor?: string; + + /** + * Default dash array pattern + * If not empty the selection border is dashed + */ + selectionDashArray?: any[]; + + /** + * Color of the border of selection (usually slightly darker than color of selection itself) + */ + selectionBorderColor?: string; + + /** + * Width of a line used in object/group selection + */ + selectionLineWidth?: number; + + /** + * Default cursor value used when hovering over an object on canvas + */ + hoverCursor?: string; + + /** + * Default cursor value used when moving an object on canvas + */ + moveCursor?: string; + + /** + * Default cursor value used for the entire canvas + */ + defaultCursor?: string; + + /** + * Cursor value used during free drawing + */ + freeDrawingCursor?: string; + + /** + * Cursor value used for rotation point + */ + rotationCursor?: string; + + /** + * Default element class that's given to wrapper (div) element of canvas + */ + containerClass?: string; + + /** + * When true, object detection happens on per-pixel basis rather than on per-bounding-box + */ + perPixelTargetFind?: boolean; + + /** + * Number of pixels around target pixel to tolerate (consider active) during object detection + */ + targetFindTolerance?: number; + + /** + * When true, target detection is skipped when hovering over canvas. This can be used to improve performance. + */ + skipTargetFind?: boolean; + + /** + * When true, mouse events on canvas (mousedown/mousemove/mouseup) result in free drawing. + * After mousedown, mousemove creates a shape, + * and then mouseup finalizes it and adds an instance of `fabric.Path` onto canvas. + */ + isDrawingMode?: boolean; + } + interface ICanvas extends IStaticCanvas, ICanvasOptions { + _objects: IObject[]; + + /** + * Checks if point is contained within an area of given object + * @param {Event} e Event object + * @param {fabric.Object} target Object to test against + */ + containsPoint(e: Event, target: IObject): boolean; + /** + * Deactivates all objects on canvas, removing any active group or object + * @return {fabric.Canvas} thisArg + */ + deactivateAll(): ICanvas; + /** + * Deactivates all objects and dispatches appropriate events + * @param {Event} [e] Event (passed along when firing) + * @return {fabric.Canvas} thisArg + */ + deactivateAllWithDispatch(e?: Event): ICanvas; + /** + * Discards currently active group + * @param {Event} [e] Event (passed along when firing) + * @return {fabric.Canvas} thisArg + */ + discardActiveGroup(e?: Event): ICanvas; + /** + * Discards currently active object + * @param {Event} [e] Event (passed along when firing) + * @return {fabric.Canvas} thisArg + * @chainable + */ + discardActiveObject(e?: Event): ICanvas; + /** + * Draws objects' controls (borders/controls) + * @param {CanvasRenderingContext2D} ctx Context to render controls on + */ + drawControls(ctx: CanvasRenderingContext2D): void; + /** + * Method that determines what object we are clicking on + * @param {Event} e mouse event + * @param {Boolean} skipGroup when true, group is skipped and only objects are traversed through + */ + findTarget(e: MouseEvent, skipGroup: boolean): ICanvas; + /** + * Returns currently active group + * @return {fabric.Group} Current group + */ + getActiveGroup(): IGroup; + /** + * Returns currently active object + * @return {fabric.Object} active object + */ + getActiveObject(): IObject; + /** + * Returns pointer coordinates relative to canvas. + * @param {Event} e + * @return {Object} object with "x" and "y" number values + */ + getPointer(e: Event, ignoreZoom?: boolean, upperCanvasEl?: CanvasRenderingContext2D): { x: number; y: number; }; + /** + * Returns context of canvas where object selection is drawn + * @return {CanvasRenderingContext2D} + */ + getSelectionContext(): CanvasRenderingContext2D; + /** + * Returns element on which object selection is drawn + * @return {HTMLCanvasElement} + */ + getSelectionElement(): HTMLCanvasElement; + /** + * Returns true if object is transparent at a certain location + * @param {fabric.Object} target Object to check + * @param {Number} x Left coordinate + * @param {Number} y Top coordinate + */ + isTargetTransparent(target: IObject, x: number, y: number): boolean; + /** + * Sets active group to a speicified one + * @param {fabric.Group} group Group to set as a current one + * @param {Event} [e] Event (passed along when firing) + */ + setActiveGroup(group: IGroup, e?: Event): ICanvas; + /** + * Sets given object as the only active object on canvas + * @param {fabric.Object} object Object to set as an active one + * @param {Event} [e] Event (passed along when firing "object:selected") + */ + setActiveObject(object: IObject, e?: Event): ICanvas; + /** + * Set the cursor type of the canvas element + * @param {String} value Cursor type of the canvas element. + * @see http://www.w3.org/TR/css3-ui/#cursor + */ + setCursor(value: string): void; + + /** + * Removes all event listeners + */ + removeListeners(): void + } + interface ICanvasStatic { + /** + * Constructor + * @param {HTMLElement|String} element element to initialize instance on + * @param {Object} [options] Options object + */ + new (element: HTMLCanvasElement | string, options?: ICanvasOptions): ICanvas; + + EMPTY_JSON: string; + /** + * Provides a way to check support of some of the canvas methods + * (either those of HTMLCanvasElement itself, or rendering context) + * @param {String} methodName Method to check support for; Could be one of "getImageData", "toDataURL", "toDataURLWithQuality" or "setLineDash" + */ + supports(methodName: string): boolean; + prototype: any; + /** + * Returns JSON representation of canvas + * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output + */ + toJSON(propertiesToInclude?: any[]): string; + } + + /////////////////////////////////////////////////////////////////////////////// + // Shape Interfaces + ////////////////////////////////////////////////////////////////////////////// + + interface ICircleOptions extends IObjectOptions { + /** + * Radius of this circle + */ + radius?: number; + /** + * Start angle of the circle, moving clockwise + */ + startAngle?: number; + + /** + * End angle of the circle + */ + endAngle?: number; + } + interface ICircle extends IObject, ICircleOptions { + /** + * Returns complexity of an instance + * @return {Number} complexity of this instance + */ + complexity(): number; + /** + * Returns horizontal radius of an object (according to how an object is scaled) + * @return {Number} + */ + getRadiusX(): number; + /** + * Returns vertical radius of an object (according to how an object is scaled) + * @return {Number} + */ + getRadiusY(): number; + /** + * Sets radius of an object (and updates width accordingly) + * @return {Number} + */ + setRadius(value: number): number; + + /** + * Returns object representation of an instance + * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output + * @return {Object} object representation of an instance + */ + toObject(propertiesToInclude?: any[]): any; + /** + * Returns svg representation of an instance + * @param {Function} [reviver] Method for further parsing of svg representation. + * @return {String} svg representation of an instance + */ + toSVG(reviver?: Function): string; + } + interface ICircleStatic { + /** + * List of attribute names to account for when parsing SVG element (used by {@link fabric.Circle.fromElement}) + */ + ATTRIBUTE_NAMES: string[]; + /** + * Returns Circle instance from an SVG element + * @param {SVGElement} element Element to parse + * @param {Object} [options] Options object + */ + fromElement(element: SVGElement, options: ICircleOptions): ICircle; + /** + * Returns Circle instance from an object representation + * @param {Object} object Object to create an instance from + */ + fromObject(object: any): ICircle; + /** + * Circle class + */ + new (options?: ICircleOptions): ICircle; + prototype: any; + } + + interface IEllipseOptions extends IObjectOptions { + /** + * Horizontal radius + */ + rx?: number; + /** + * Vertical radius + */ + ry?: number; + } + interface IEllipse extends IObject, IEllipseOptions { + /** + * Returns horizontal radius of an object (according to how an object is scaled) + * @return {Number} + */ + getRx(): number; + + /** + * Returns Vertical radius of an object (according to how an object is scaled) + * @return {Number} + */ + getRy(): number; + /** + * Returns object representation of an instance + * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output + * @return {Object} object representation of an instance + */ + toObject(propertiesToInclude?: any[]): any; + /** + * Returns svg representation of an instance + * @param {Function} [reviver] Method for further parsing of svg representation. + * @return {String} svg representation of an instance + */ + toSVG(reviver?: Function): string; + /** + * Returns complexity of an instance + * @return {Number} complexity + */ + complexity(): number; + } + interface IEllipseStatic { + new (options?: IEllipseOptions): IEllipse; + /** + * List of attribute names to account for when parsing SVG element (used by {@link fabric.Ellipse.fromElement}) + */ + ATTRIBUTE_NAMES: string[]; + + /** + * Returns Ellipse instance from an SVG element + * @param {SVGElement} element Element to parse + * @param {Object} [options] Options object + */ + fromElement(element: SVGElement, options?: IEllipseOptions): IEllipse; + + /** + * Returns Ellipse instance from an object representation + * @param {Object} object Object to create an instance from + */ + fromObject(object: any): IEllipse; + } + + interface IGroup extends IObject, ICollection { + activateAllObjects(): IGroup; + /** + * Adds an object to a group; Then recalculates group's dimension, position. + * @param {Object} object + * @return {fabric.Group} thisArg + * @chainable + */ + addWithUpdate(object: IObject): IGroup; + containsPoint(point: IPoint): boolean; + /** + * Destroys a group (restoring state of its objects) + * @return {fabric.Group} thisArg + * @chainable + */ + destroy(): IGroup; + /** + * Returns requested property + * @param {String} prop Property to get + * @return {Any} + */ + get(prop: string): any; + /** + * Checks whether this group was moved (since `saveCoords` was called last) + * @return {Boolean} true if an object was moved (since fabric.Group#saveCoords was called) + */ + hasMoved(): boolean; + /** + * Removes an object from a group; Then recalculates group's dimension, position. + * @param {Object} object + * @return {fabric.Group} thisArg + * @chainable + */ + removeWithUpdate(object: IObject): IGroup; + /** + * Renders instance on a given context + * @param {CanvasRenderingContext2D} ctx context to render instance on + */ + render(ctx: CanvasRenderingContext2D): void; + /** + * Removes objects from a collection, then renders canvas (if `renderOnAddRemove` is not `false`) + * @param {...fabric.Object} object Zero or more fabric instances + * @return {Self} thisArg + * @chainable + */ + remove(...object: IObject[]): IGroup; + /** + * Saves coordinates of this instance (to be used together with `hasMoved`) + * @saveCoords + * @return {fabric.Group} thisArg + * @chainable + */ + saveCoords(): IGroup; + /** + * Sets coordinates of all group objects + * @return {fabric.Group} thisArg + * @chainable + */ + setObjectsCoords(): IGroup; + /** + * Returns object representation of an instance + * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output + * @return {Object} object representation of an instance + */ + toObject(propertiesToInclude?: any[]): any; + /** + * Returns string represenation of a group + * @return {String} + */ + toString(): string; + /** + * Returns svg representation of an instance + * @param {Function} [reviver] Method for further parsing of svg representation. + * @return {String} svg representation of an instance + */ + toSVG(reviver?: Function): string; + } + interface IGroupStatic { + /** + * Constructor + * @param {Object} objects Group objects + * @param {Object} [options] Options object + */ + new (items?: any[], options?: IObjectOptions): IGroup; + /** + * Returns {@link fabric.Group} instance from an object representation + * @param {Object} object Object to create a group from + * @param {Function} [callback] Callback to invoke when an group instance is created + */ + fromObject(object: any, callback: (group: IGroup) => any): void; + } + + interface IImageOptions extends IObjectOptions { + /** + * crossOrigin value (one of "", "anonymous", "allow-credentials") + */ + crossOrigin: string; + + /** + * AlignX value, part of preserveAspectRatio (one of "none", "mid", "min", "max") + * This parameter defines how the picture is aligned to its viewport when image element width differs from image width. + */ + alignX: string; + + /** + * AlignY value, part of preserveAspectRatio (one of "none", "mid", "min", "max") + * This parameter defines how the picture is aligned to its viewport when image element height differs from image height. + */ + alignY: string; + + /** + * meetOrSlice value, part of preserveAspectRatio (one of "meet", "slice"). + * if meet the image is always fully visibile, if slice the viewport is always filled with image. + * @see http://www.w3.org/TR/SVG/coords.html#PreserveAspectRatioAttribute + */ + meetOrSlice: string; + + /** + * Image filter array + */ + filters: IBaseFilter[]; + } + interface IImage extends IObject, IImageOptions { + initialize(element?: string|HTMLImageElement, options?: IImageOptions); + /** + * Applies filters assigned to this image (from "filters" array) + * @param {Function} callback Callback is invoked when all filters have been applied and new image is generated + */ + applyFilters(callback: Function); + /** + * Returns a clone of an instance + * @param {Function} callback Callback is invoked with a clone as a first argument + * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output + */ + clone(callback?: Function, propertiesToInclude?: any[]): IObject; + /** + * Returns complexity of an instance + * @return {Number} complexity of this instance + */ + complexity(): number; + /** + * Returns image element which this instance if based on + * @return {HTMLImageElement} Image element + */ + getElement(): HTMLImageElement; + /** + * Returns original size of an image + * @return {Object} Object with "width" and "height" properties + */ + getOriginalSize(): { width: number; height: number; }; + /** + * Returns source of an image + * @return {String} Source of an image + */ + getSrc(): string; + render(ctx: CanvasRenderingContext2D, noTransform: boolean); + + /** + * Sets image element for this instance to a specified one. + * If filters defined they are applied to new image. + * You might need to call `canvas.renderAll` and `object.setCoords` after replacing, to render new image and update controls area. + * @param {HTMLImageElement} element + * @param {Function} [callback] Callback is invoked when all filters have been applied and new image is generated + * @param {Object} [options] Options object + */ + setElement(element: HTMLImageElement, callback: Function, options: IImageOptions): IImage; + /** + * Sets crossOrigin value (on an instance and corresponding image element) + */ + setCrossOrigin(value: string): IImage; + /** + * Returns object representation of an instance + * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output + * @return {Object} Object representation of an instance + */ + toObject(propertiesToInclude?: any[]): any; + /** + * Returns string representation of an instance + * @return {String} String representation of an instance + */ + toString(): string; + /** + * Returns SVG representation of an instance + * @param {Function} [reviver] Method for further parsing of svg representation. + * @return {String} svg representation of an instance + */ + toSVG(reviver?: Function): string; + /** + * Sets source of an image + * @param {String} src Source string (URL) + * @param {Function} [callback] Callback is invoked when image has been loaded (and all filters have been applied) + * @param {Object} [options] Options object + */ + setSrc(src: string, callback: Function, options: IImageOptions): IImage; + } + interface IImageStatic { + /** + * Constructor + * @param {HTMLImageElement | String} element Image element + * @param {Object} [options] Options object + */ + new (element: HTMLImageElement, objObjects: IObjectOptions): IImage; + /** + * Creates an instance of fabric.Image from an URL string + * @param {String} url URL to create an image from + * @param {Function} [callback] Callback to invoke when image is created (newly created image is passed as a first argument) + * @param {Object} [imgOptions] Options object + */ + fromURL(url: string, callback?: (image: IImage) => any, objObjects?: IObjectOptions): IImage; + /** + * Creates an instance of fabric.Image from its object representation + * @static + * @param {Object} object Object to create an instance from + * @param {Function} [callback] Callback to invoke when an image instance is created + */ + fromObject(object: any, callback: (image: IImage) => {}): void; + /** + * Returns Image instance from an SVG element + * @param {SVGElement} element Element to parse + * @param {Function} callback Callback to execute when fabric.Image object is created + * @param {Object} [options] Options object + */ + fromElement(element: SVGElement, callback: Function, options?: IImageOptions): void; + prototype: any; + /** + * Default CSS class name for canvas + */ + CSS_CANVAS: string; + + filters: IAllFilters + } + + interface ILineOptions extends IObjectOptions { + /** + * x value or first line edge + */ + x1: number; + /** + * x value or second line edge + */ + x2: number; + /** + * y value or first line edge + */ + y1: number; + /** + * y value or second line edge + */ + y2: number; + } + interface ILine extends IObject, ILineOptions { + /** + * Returns complexity of an instance + * @return {Number} complexity + */ + complexity(): number; + initialize(points?: number[], options?: ILineOptions): ILine; + /** + * Returns object representation of an instance + * @methd toObject + * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output + * @return {Object} object representation of an instance + */ + toObject(propertiesToInclude: any[]): any; + /** + * Returns SVG representation of an instance + * @param {Function} [reviver] Method for further parsing of svg representation. + * @return {String} svg representation of an instance + */ + toSVG(reviver?: Function): string; + } + interface ILineStatic { + ATTRIBUTE_NAMES: string[]; + /** + * Returns fabric.Line instance from an SVG element + * @param {SVGElement} element Element to parse + * @param {Object} [options] Options object + */ + fromElement(element: SVGElement, options?: ILineOptions): ILine; + /** + * Returns fabric.Line instance from an object representation + * @param {Object} object Object to create an instance from + */ + fromObject(object: any): ILine; + prototype: any; + /** + * Constructor + * @param {Array} [points] Array of points + * @param {Object} [options] Options object + */ + new (points?: number[], objObjects?: IObjectOptions): ILine; + } + + interface IObjectOptions { + /** + * Type of an object (rect, circle, path, etc.). + * Note that this property is meant to be read-only and not meant to be modified. + * If you modify, certain parts of Fabric (such as JSON loading) won't work correctly. + */ + type?: string; + + /** + * Horizontal origin of transformation of an object (one of "left", "right", "center") + */ + originX?: string; + + /** + * Vertical origin of transformation of an object (one of "top", "bottom", "center") + */ + originY?: string; + + /** + * Top position of an object. Note that by default it's relative to object center. You can change this by setting originY={top/center/bottom} + */ + top?: number; + + /** + * Left position of an object. Note that by default it's relative to object center. You can change this by setting originX={left/center/right} + */ + left?: number; + + /** + * Object width + */ + width?: number; + + /** + * Object height + */ + height?: number; + + /** + * Object scale factor (horizontal) + */ + scaleX?: number; + + /** + * Object scale factor (vertical) + */ + scaleY?: number; + + /** + * When true, an object is rendered as flipped horizontally + */ + flipX?: boolean; + + /** + * When true, an object is rendered as flipped vertically + */ + flipY?: boolean; + + /** + * Opacity of an object + */ + opacity?: number; + + /** + * Angle of rotation of an object (in degrees) + */ + angle?: number; + + /** + * Size of object's controlling corners (in pixels) + */ + cornerSize?: number; + + /** + * When true, object's controlling corners are rendered as transparent inside (i.e. stroke instead of fill) + */ + transparentCorners?: boolean; + + /** + * Default cursor value used when hovering over this object on canvas + */ + hoverCursor?: string; + + /** + * Padding between object and its controlling borders (in pixels) + */ + padding?: number; + + /** + * Color of controlling borders of an object (when it's active) + */ + borderColor?: string; + + /** + * Color of controlling corners of an object (when it's active) + */ + cornerColor?: string; + + /** + * When true, this object will use center point as the origin of transformation + * when being scaled via the controls. + * Backwards incompatibility note: This property replaces "centerTransform" (Boolean). + */ + centeredScaling?: boolean; + + /** + * When true, this object will use center point as the origin of transformation + * when being rotated via the controls. + * Backwards incompatibility note: This property replaces "centerTransform" (Boolean). + */ + centeredRotation?: boolean; + + /** + * Color of object's fill + */ + fill?: string; + + /** + * Fill rule used to fill an object + * accepted values are nonzero, evenodd + * Backwards incompatibility note: This property was used for setting globalCompositeOperation until v1.4.12, use `globalCompositeOperation` instead + */ + fillRule?: string; + + /** + * Composite rule used for canvas globalCompositeOperation + */ + globalCompositeOperation?: string; + + /** + * Background color of an object. Only works with text objects at the moment. + */ + backgroundColor?: string; + + /** + * When defined, an object is rendered via stroke and this property specifies its color + */ + stroke?: string; + + /** + * Width of a stroke used to render this object + */ + strokeWidth?: number; + + /** + * Array specifying dash pattern of an object's stroke (stroke must be defined) + */ + strokeDashArray?: any[]; + + /** + * Line endings style of an object's stroke (one of "butt", "round", "square") + */ + strokeLineCap?: string; + + /** + * Corner style of an object's stroke (one of "bevil", "round", "miter") + */ + strokeLineJoin?: string; + + /** + * Maximum miter length (used for strokeLineJoin = "miter") of an object's stroke + */ + strokeMiterLimit?: number; + + /** + * Shadow object representing shadow of this shape + */ + shadow?: IShadow|string; + + /** + * Opacity of object's controlling borders when object is active and moving + */ + borderOpacityWhenMoving?: number; + + /** + * Scale factor of object's controlling borders + */ + borderScaleFactor?: number; + + /** + * Transform matrix (similar to SVG's transform matrix) + */ + transformMatrix?: any[]; + + /** + * Minimum allowed scale value of an object + */ + minScaleLimit?: number; + + /** + * When set to `false`, an object can not be selected for modification (using either point-click-based or group-based selection). + * But events still fire on it. + */ + selectable?: boolean; + + /** + * When set to `false`, an object can not be a target of events. All events propagate through it. Introduced in v1.3.4 + */ + evented?: boolean; + + /** + * When set to `false`, an object is not rendered on canvas + */ + visible?: boolean; + + /** + * When set to `false`, object's controls are not displayed and can not be used to manipulate object + */ + hasControls?: boolean; + + /** + * When set to `false`, object's controlling borders are not rendered + */ + hasBorders?: boolean; + + /** + * When set to `false`, object's controlling rotating point will not be visible or selectable + */ + hasRotatingPoint?: boolean; + + /** + * Offset for object's controlling rotating point (when enabled via `hasRotatingPoint`) + */ + rotatingPointOffset?: number; + + /** + * When set to `true`, objects are "found" on canvas on per-pixel basis rather than according to bounding box + */ + perPixelTargetFind?: boolean; + + /** + * When `false`, default object's values are not included in its serialization + */ + includeDefaultValues?: boolean; + + /** + * Function that determines clipping of an object (context is passed as a first argument) + * Note that context origin is at the object's center point (not left/top corner) + * @type Function + */ + clipTo?: Function; + + /** + * When `true`, object horizontal movement is locked + */ + lockMovementX?: boolean; + + /** + * When `true`, object vertical movement is locked + */ + lockMovementY?: boolean; + + /** + * When `true`, object rotation is locked + */ + lockRotation?: boolean; + + /** + * When `true`, object horizontal scaling is locked + */ + lockScalingX?: boolean; + + /** + * When `true`, object vertical scaling is locked + */ + lockScalingY?: boolean; + + /** + * When `true`, object non-uniform scaling is locked + */ + lockUniScaling?: boolean; + + /** + * When `true`, object cannot be flipped by scaling into negative values + */ + lockScalingFlip?: boolean; + + /** + * Not used by fabric, just for convenience + */ + name?: string; + + /** + * Not used by fabric, just for convenience + */ + data?: any; + } + interface IObject extends IObservable, IObjectOptions, IObjectAnimation { + getCurrentWidth(): number; + getCurrentHeight(): number; + + getAngle(): number; + setAngle(value: number): IObject; + + getBorderColor(): string; + setBorderColor(value: string): IObject; + + getBorderScaleFactor(): number; + + getCornersize(): number; + setCornersize(value: number): IObject; + + getFill(): string; + setFill(value: string): IObject; + + getFillRule(): string; + setFillRule(value: string): IObject; + + getFlipX(): boolean; + setFlipX(value: boolean): IObject; + + getFlipY(): boolean; + setFlipY(value: boolean): IObject; + + getHeight(): number; + setHeight(value: number): IObject; + + getLeft(): number; + setLeft(value: number): IObject; + + getOpacity(): number; + setOpacity(value: number): IObject; + + overlayFill: string; + getOverlayFill(): string; + setOverlayFill(value: string): IObject; + + getScaleX(): number; + setScaleX(value: number): IObject; + + getScaleY(): number; + setScaleY(value: number): IObject; + + setShadow(options: any): IObject; + getShadow(): IObject; + + stateProperties: any[]; + getTop(): number; + setTop(value: number): IObject; + + getWidth(): number; + setWidth(value: number): IObject; + + /* * Sets object's properties from options + * @param {Object} [options] Options object + */ + setOptions(options: any): void; + + /** + * Transforms context when rendering an object + * @param {CanvasRenderingContext2D} ctx Context + * @param {Boolean} fromLeft When true, context is transformed to object's top/left corner. This is used when rendering text on Node + */ + transform(ctx: CanvasRenderingContext2D, fromLeft: boolean): void; + + /** + * Returns an object representation of an instance + * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output + */ + toObject(propertiesToInclude?: any[]): any; + + /** + * Returns (dataless) object representation of an instance + * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output + */ + toDatalessObject(propertiesToInclude?: any[]): any; + + /** + * Returns a string representation of an instance + */ + toString(): string; + + /** + * Basic getter + * @param {String} property Property name + */ + get(property: string): any; + + /** + * Sets property to a given value. + * When changing position/dimension -related properties (left, top, scale, angle, etc.) `set` does not update position of object's borders/controls. + * If you need to update those, call `setCoords()`. + * @param {String} key Property name + * @param {Object|Function} value Property value (if function, the value is passed into it and its return value is used as a new one) + */ + set(key: string, value: any|Function): IObject; + /** + * Sets property to a given value. + * When changing position/dimension -related properties (left, top, scale, angle, etc.) `set` does not update position of object's borders/controls. + * If you need to update those, call `setCoords()`. + * @param Object key Property object, iterate over the object properties + */ + set(key: any): IObject; + + /** + * Toggles specified property from `true` to `false` or from `false` to `true` + * @param {String} property Property to toggle + */ + toggle(property: string): IObject; + + /** + * Sets sourcePath of an object + * @param {String} value Value to set sourcePath to + */ + setSourcePath(value: string): IObject; + + /** + * Retrieves viewportTransform from Object's canvas if possible + */ + getViewportTransform(): boolean; + + /** + * Renders an object on a specified context + * @param {CanvasRenderingContext2D} ctx Context to render on + * @param {Boolean} [noTransform] When true, context is not transformed + */ + render(ctx: CanvasRenderingContext2D, noTransform?: boolean): void; + + /** + * Clones an instance + * @param {Function} callback Callback is invoked with a clone as a first argument + * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output + */ + clone(callback: Function, propertiesToInclude?: any[]): IObject; + + /** + * Creates an instance of fabric.Image out of an object + * @param {Function} callback callback, invoked with an instance as a first argument + */ + cloneAsImage(callback: (image: IImage) => any): IObject; + + /** + * Converts an object into a data-url-like string + * @param options Options object + */ + toDataURL(options: IDataURLOptions): string; + + /** + * Returns true if specified type is identical to the type of an instance + * @param {String} type Type to check against + */ + isType(type: string): boolean; + + /** + * Returns complexity of an instance + */ + complexity(): number; + + /** + * Returns a JSON representation of an instance + * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output + */ + toJSON(propertiesToInclude?: any[]): any; + + /** + * Sets gradient (fill or stroke) of an object + * Backwards incompatibility note: This method was named "setGradientFill" until v1.1.0 + * @param {String} property Property name 'stroke' or 'fill' + * @param {Object} [options] Options object + */ + setGradient(property: string, options: IGradientOptions): IObject; + /** + * Sets pattern fill of an object + * @param {Object} options Options object + */ + setPatternFill(options: IFillOptions): IObject; + + /** + * Sets shadow of an object + * @param {String} [options] Options object or string (e.g. "2px 2px 10px rgba(0,0,0,0.2)") + */ + setShadow(options?: string): IObject; + /** + * Sets shadow of an object + * @param [options] Options object + */ + setShadow(options: IShadow): IObject; + + /** + * Sets "color" of an instance (alias of `set('fill', …)`) + * @param {String} color Color value + */ + setColor(color: string): IObject; + + /** + * Sets "angle" of an instance + * @param {Number} angle Angle value + */ + setAngle(angle: number): IObject; + + /** + * Sets "angle" of an instance + * @param {Number} angle Angle value + */ + rotate(angle: number): IObject; + + /** + * Centers object horizontally on canvas to which it was added last. + * You might need to call `setCoords` on an object after centering, to update controls area. + */ + centerH(): void; + + /** + * Centers object vertically on canvas to which it was added last. + * You might need to call `setCoords` on an object after centering, to update controls area. + */ + centerV(): void; + + /** + * Centers object vertically and horizontally on canvas to which is was added last + * You might need to call `setCoords` on an object after centering, to update controls area. + */ + center(): void; + + /** + * Removes object from canvas to which it was added last + */ + remove(): IObject; + + /** + * Returns coordinates of a pointer relative to an object + * @param {Event} e Event to operate upon + * @param {Object} [pointer] Pointer to operate upon (instead of event) + */ + getLocalPointer(e: Event, pointer: any): any; + + /** + * Sets object's properties from options + * @param {Object} [options] Options object + */ + setOptions(options: any); + /** + * Sets sourcePath of an object + * @param {String} value Value to set sourcePath to + */ + setSourcePath(value: string): IObject; + // functions from object svg export mixin + // ----------------------------------------------------------------------------------------------------------------------------------- + /** + * Returns styles-string for svg-export + */ + getSvgStyles(): string; + /** + * Returns transform-string for svg-export + */ + getSvgTransform(): string; + /** + * Returns transform-string for svg-export from the transform matrix of single elements + */ + getSvgTransformMatrix(): string; + + // functions from stateful mixin + // ----------------------------------------------------------------------------------------------------------------------------------- + /** + * Returns true if object state (one of its state properties) was changed + */ + hasStateChanged(): boolean; + /** + * Saves state of an object + * @param {Object} [options] Object with additional `stateProperties` array to include when saving state + * @return {fabric.Object} thisArg + */ + saveState(options?: { stateProperties: any[] }): IObject; + /** + * Setups state of an object + */ + setupState(): IObject; + // functions from object straightening mixin + // ----------------------------------------------------------------------------------------------------------------------------------- + /** + * Straightens an object (rotating it from current angle to one of 0, 90, 180, 270, etc. depending on which is closer) + */ + straighten(): IObject; + /** + * Same as straighten but with animation + * @param {Object} callbacks Object with callback functions + * @param {Function} [callbacks.onComplete] Invoked on completion + * @param {Function} [callbacks.onChange] Invoked on every step of animation + */ + fxStraighten(callbacks: { onComplete?: Function; onChange: Function }): IObject; + + // functions from object stacking mixin + // ----------------------------------------------------------------------------------------------------------------------------------- + /** + * Moves an object up in stack of drawn objects + * @param {Boolean} [intersecting] If `true`, send object in front of next upper intersecting object + */ + bringForward(intersecting?: boolean): IObject; + /** + * Moves an object to the top of the stack of drawn objects + */ + bringToFront(): IObject; + /** + * Moves an object down in stack of drawn objects + * @param {Boolean} [intersecting] If `true`, send object behind next lower intersecting object + */ + sendBackwards(intersecting?: boolean): IObject; + /** + * Moves an object to the bottom of the stack of drawn objects + */ + sendToBack(): IObject; + /** + * Moves an object to specified level in stack of drawn objects + * @param {Number} index New position of object + */ + moveTo(index: number): IObject; + + // functions from object origin mixin + // ----------------------------------------------------------------------------------------------------------------------------------- + /** + * Translates the coordinates from origin to center coordinates (based on the object's dimensions) + * @param {fabric.Point} point The point which corresponds to the originX and originY params + * @param {String} originX Horizontal origin: 'left', 'center' or 'right' + * @param {String} originY Vertical origin: 'top', 'center' or 'bottom' + */ + translateToCenterPoint(point: IPoint, originX: string, originY: string): IPoint; + + /** + * Translates the coordinates from center to origin coordinates (based on the object's dimensions) + * @param {fabric.Point} center The point which corresponds to center of the object + * @param {String} originX Horizontal origin: 'left', 'center' or 'right' + * @param {String} originY Vertical origin: 'top', 'center' or 'bottom' + */ + translateToOriginPoint(center: IPoint, originX: string, originY: string): IPoint; + /** + * Returns the real center coordinates of the object + */ + getCenterPoint(): IPoint; + + /** + * Returns the coordinates of the object as if it has a different origin + * @param {String} originX Horizontal origin: 'left', 'center' or 'right' + * @param {String} originY Vertical origin: 'top', 'center' or 'bottom' + */ + getPointByOrigin(): IPoint; + + /** + * Returns the point in local coordinates + * @param {fabric.Point} point The point relative to the global coordinate system + * @param {String} originX Horizontal origin: 'left', 'center' or 'right' + * @param {String} originY Vertical origin: 'top', 'center' or 'bottom' + */ + toLocalPoint(point: IPoint, originX: string, originY: string): IPoint; + + /** + * Sets the position of the object taking into consideration the object's origin + * @param {fabric.Point} pos The new position of the object + * @param {String} originX Horizontal origin: 'left', 'center' or 'right' + * @param {String} originY Vertical origin: 'top', 'center' or 'bottom' + * @return {void} + */ + setPositionByOrigin(pos: IPoint, originX: string, originY: string): void; + + /** + * @param {String} to One of 'left', 'center', 'right' + */ + adjustPosition(to: string): void; + + // functions from interactivity mixin + // ----------------------------------------------------------------------------------------------------------------------------------- + /**- + * Draws borders of an object's bounding box. + * Requires public properties: width, height + * Requires public options: padding, borderColor + * @param {CanvasRenderingContext2D} ctx Context to draw on + */ + drawBorders(context: CanvasRenderingContext2D): IObject; + + /** + * Draws corners of an object's bounding box. + * Requires public properties: width, height + * Requires public options: cornerSize, padding + * @param {CanvasRenderingContext2D} ctx Context to draw on + */ + drawCorners(context: CanvasRenderingContext2D): IObject; + + /** + * Returns true if the specified control is visible, false otherwise. + * @param {String} controlName The name of the control. Possible values are 'tl', 'tr', 'br', 'bl', 'ml', 'mt', 'mr', 'mb', 'mtr'. + */ + isControlVisible(controlName: string): boolean; + /** + * Sets the visibility of the specified control. + * @param {String} controlName The name of the control. Possible values are 'tl', 'tr', 'br', 'bl', 'ml', 'mt', 'mr', 'mb', 'mtr'. + * @param {Boolean} visible true to set the specified control visible, false otherwise + */ + setControlVisible(controlName: string, visible: boolean): IObject; + + /** + * Sets the visibility state of object controls. + * @param {Object} [options] Options object + */ + setControlsVisibility(options?: { + bl?: boolean; + br?: boolean; + mb?: boolean; + ml?: boolean; + mr?: boolean; + mt?: boolean; + tl?: boolean; + tr?: boolean; + mtr?: boolean; }): IObject; + + // functions from geometry mixin + // ------------------------------------------------------------------------------------------------------------------------------- + /** + * Sets corner position coordinates based on current angle, width and height + * See https://github.com/kangax/fabric.js/wiki/When-to-call-setCoords + */ + setCoords(): IObject; + /** + * Returns coordinates of object's bounding rectangle (left, top, width, height) + * @return {Object} Object with left, top, width, height properties + */ + getBoundingRect(): { left: number; top: number; width: number; height: number }; + /** + * Checks if object is fully contained within area of another object + * @param {Object} other Object to test + */ + isContainedWithinObject(other: IObject): boolean; + /** + * Checks if object is fully contained within area formed by 2 points + * @param {Object} pointTL top-left point of area + * @param {Object} pointBR bottom-right point of area + */ + isContainedWithinRect(pointTL: any, pointBR: any): boolean; + /** + * Checks if point is inside the object + * @param {fabric.Point} point Point to check against + */ + containsPoint(point: IPoint): boolean; + /** + * Scales an object (equally by x and y) + * @param {Number} value Scale factor + * @return {fabric.Object} thisArg + */ + scale(value: number): IObject; + /** + * Scales an object to a given height, with respect to bounding box (scaling by x/y equally) + * @param {Number} value New height value + */ + scaleToHeight(value: number): IObject; + /** + * Scales an object to a given width, with respect to bounding box (scaling by x/y equally) + * @param {Number} value New width value + */ + scaleToWidth(value: number): IObject; + /** + * Checks if object intersects with another object + * @param {Object} other Object to test + */ + intersectsWithObject(other: IObject): boolean; + /** + * Checks if object intersects with an area formed by 2 points + * @param {Object} pointTL top-left point of area + * @param {Object} pointBR bottom-right point of area + */ + intersectsWithRect(pointTL: any, pointBR: any): boolean; + } + interface IObjectStatic { + prototype: any; + } + + interface IPathOptions extends IObjectOptions { + /** + * Array of path points + */ + path?: any[]; + + /** + * Minimum X from points values, necessary to offset points + */ + minX?: number; + + /** + * Minimum Y from points values, necessary to offset points + */ + minY?: number; + } + interface IPath extends IObject, IPathOptions { + initialize(path?: any[], options?: IPathOptions): IPath; + + /** + * Returns number representation of an instance complexity + * @return {Number} complexity of this instance + */ + complexity(): number; + + /** + * Renders path on a specified context + * @param {CanvasRenderingContext2D} ctx context to render path on + * @param {Boolean} [noTransform] When true, context is not transformed + */ + render(ctx: CanvasRenderingContext2D, noTransform: boolean): void; + /** + * Returns dataless object representation of an instance + * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output + * @return {Object} object representation of an instance + */ + toDatalessObject(propertiesToInclude?: any[]): any; + /** + * Returns object representation of an instance + * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output + * @return {Object} object representation of an instance + */ + toObject(propertiesToInclude?: any[]): any; + /** + * Returns string representation of an instance + * @return {String} string representation of an instance + */ + toString(): string; + /** + * Returns svg representation of an instance + * @param {Function} [reviver] Method for further parsing of svg representation. + * @return {String} svg representation of an instance + */ + toSVG(reviver?: Function): string; + } + interface IPathStatic { + /** + * Creates an instance of fabric.Path from an SVG element + * @param {SVGElement} element to parse + * @param {Function} callback Callback to invoke when an fabric.Path instance is created + * @param {Object} [options] Options object + */ + fromElement(element: SVGElement, callback: (path: IPath) => any, options?: IPathOptions): void; + /** + * Creates an instance of fabric.Path from an object + * @param {Object} object + * @param {Function} callback Callback to invoke when an fabric.Path instance is created + */ + fromObject(object: any, callback: (path: IPath) => any): void; + /** + * Constructor + * @param {Array|String} path Path data (sequence of coordinates and corresponding "command" tokens) + * @param {Object} [options] Options object + */ + new (path?: string|any[], options?: IPathOptions): IPath; + } + + interface IPathGroup extends IObject { + initialize(paths: IPath[], options?: IObjectOptions); + /** + * Returns number representation of object's complexity + * @return {Number} complexity + */ + complexity(): number; + /** + * Returns true if all paths in this group are of same color + * @return {Boolean} true if all paths are of the same color (`fill`) + */ + isSameColor(): boolean; + /** + * Renders this group on a specified context + * @param {CanvasRenderingContext2D} ctx Context to render this instance on + */ + render(ctx: CanvasRenderingContext2D); + /** + * Returns dataless object representation of this path group + * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output + * @return {Object} dataless object representation of an instance + */ + toDatalessObject(propertiesToInclude?: any[]): any; + /** + * Returns object representation of this path group + * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output + * @return {Object} object representation of an instance + */ + toObject(propertiesToInclude?: any[]): any; + /** + * Returns a string representation of this path group + * @return {String} string representation of an object + */ + toString(): string; + /** + * Returns svg representation of an instance + * @param {Function} [reviver] Method for further parsing of svg representation. + * @return {String} svg representation of an instance + */ + toSVG(reviver?: Function): string; + /** + * Returns all paths in this path group + * @return {Array} array of path objects included in this path group + */ + getObjects(): IPath[]; + } + interface IPathGroupStatic { + fromObject(object: any): IPathGroup; + /** + * Constructor + * @param {Array} paths + * @param {Object} [options] Options object + */ + new (paths: IPath[], options?: IObjectOptions): IPathGroup; + /** + * Creates fabric.PathGroup instance from an object representation + * @static + * @memberOf fabric.PathGroup + * @param {Object} object Object to create an instance from + * @param {Function} callback Callback to invoke when an fabric.PathGroup instance is created + */ + fromObject(object: any, callback: (group: IPathGroup) => any): void; + prototype: any; + } + + interface IPolygonOptions extends IObjectOptions { + /** + * Points array + */ + points?: IPoint[]; + + /** + * Minimum X from points values, necessary to offset points + */ + minX?: number; + + /** + * Minimum Y from points values, necessary to offset points + */ + minY?: number; + } + interface IPolygon extends IObject, IPolygonOptions { + /** + * Returns complexity of an instance + * @return {Number} complexity of this instance + */ + complexity(): number; + + /** + * Returns object representation of an instance + * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output + * @return {Object} object representation of an instance + */ + toObject(propertiesToInclude?: any[]): any; + /** + * Returns svg representation of an instance + * @param {Function} [reviver] Method for further parsing of svg representation. + * @return {String} svg representation of an instance + */ + toSVG(reviver?: Function): string; + } + interface IPolygonStatic { + /** + * List of attribute names to account for when parsing SVG element (used by `fabric.Polygon.fromElement`) + */ + ATTRIBUTE_NAMES: string[]; + + /** + * Returns Polygon instance from an SVG element + * @param {SVGElement} element Element to parse + * @param {Object} [options] Options object + */ + fromElement(element: SVGElement, options?: IPolygonOptions): IPolygon; + /** + * Returns fabric.Polygon instance from an object representation + * @param {Object} object Object to create an instance from + */ + fromObject(object: any): IPolygon; + /** + * Constructor + * @param {Array} points Array of points + * @param {Object} [options] Options object + */ + new (points: { x: number; y: number }[], options?: IObjectOptions, skipOffset?: boolean): IPolygon; + prototype: any; + } + + interface IPolylineOptions extends IObjectOptions { + /** + * Points array + */ + points?: IPoint[]; + + /** + * Minimum X from points values, necessary to offset points + */ + minX?: number; + + /** + * Minimum Y from points values, necessary to offset points + */ + minY?: number; + } + interface IPolyline extends IObject, IPolylineOptions { + initialize(points: IPoint[], options?: IPolylineOptions); + /** + * Returns complexity of an instance + * @return {Number} complexity of this instance + */ + complexity(): number; + /** + * Returns object representation of an instance + * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output + * @return {Object} Object representation of an instance + */ + toObject(propertiesToInclude?: any[]): any; + /** + * Returns SVG representation of an instance + * @param {Function} [reviver] Method for further parsing of svg representation. + * @return {String} svg representation of an instance + */ + toSVG(reviver?: Function): string; + } + interface IPolylineStatic { + /** + * List of attribute names to account for when parsing SVG element (used by `fabric.Polygon.fromElement`) + */ + ATTRIBUTE_NAMES: string[]; + + /** + * Returns Polyline instance from an SVG element + * @param {SVGElement} element Element to parse + * @param {Object} [options] Options object + */ + fromElement(element: SVGElement, options?: IPolylineOptions): IPolyline; + /** + * Returns fabric.Polyline instance from an object representation + * @param {Object} object Object to create an instance from + */ + fromObject(object: any): IPolyline; + /** + * Constructor + * @param {Array} points Array of points (where each point is an object with x and y) + * @param {Object} [options] Options object + * @param {Boolean} [skipOffset] Whether points offsetting should be skipped + */ + new (points: { x: number; y: number }[], options?: IPolylineOptions): IPolyline; + prototype: any; + } + + interface IRectOptions extends IObjectOptions { + x?: number; + y?: number; + /** + * Horizontal border radius + */ + rx?: number; + + /** + * Vertical border radius + */ + ry?: number; + + } + interface IRect extends IObject, IRectOptions { + initialize(points?: number[], options?: any): IRect; + /** + * Returns complexity of an instance + * @return {Number} complexity + */ + complexity(): number; + /** + * Returns object representation of an instance + * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output + * @return {Object} object representation of an instance + */ + toObject(propertiesToInclude: any[]): any; + /** + * Returns svg representation of an instance + * @param {Function} [reviver] Method for further parsing of svg representation. + * @return {String} svg representation of an instance + */ + toSVG(reviver?: Function): string; + } + interface IRectStatic { + /** + * List of attribute names to account for when parsing SVG element (used by `fabric.Rect.fromElement`) + */ + ATTRIBUTE_NAMES: string[]; + /** + * Returns Rect instance from an SVG element + * @param {SVGElement} element Element to parse + * @param {Object} [options] Options object + */ + fromElement(element: SVGElement, options?: IRectOptions): IRect; + /** + * Returns Rect instance from an object representation + * @param {Object} object Object to create an instance from + */ + fromObject(object: any): IRect; + /** + * Constructor + * @param {Object} [options] Options object + */ + new (options?: IRectOptions): IRect; + prototype: any; + } + + interface ITextOptions extends IObjectOptions { + /** + * Font size (in pixels) + */ + fontSize?: number; + /** + * Font weight (e.g. bold, normal, 400, 600, 800) + */ + fontWeight?: number|string; + /** + * Font family + */ + fontFamily?: string; + /** + * Text decoration Possible values?: "", "underline", "overline" or "line-through". + */ + textDecoration?: string; + /** + * Text alignment. Possible values?: "left", "center", or "right". + */ + textAlign?: string; + /** + * Font style . Possible values?: "", "normal", "italic" or "oblique". + */ + fontStyle?: string; + /** + * Line height + */ + lineHeight?: number; + /** + * When defined, an object is rendered via stroke and this property specifies its color. + * Backwards incompatibility note?: This property was named "strokeStyle" until v1.1.6 + */ + stroke?: string; + /** + * Shadow object representing shadow of this shape. + * Backwards incompatibility note?: This property was named "textShadow" (String) until v1.2.11 + */ + shadow?: IShadow|string; + /** + * Background color of text lines + */ + textBackgroundColor?: string; + + path?: string; + useNative?: Boolean; + text?: string; + } + interface IText extends IObject, ITextOptions { + /** + * Returns complexity of an instance + */ + complexity(): number; + /** + * Returns string representation of an instance + */ + toString(): string; + /** + * Renders text instance on a specified context + * @param {CanvasRenderingContext2D} ctx Context to render on + */ + render(ctx: CanvasRenderingContext2D, noTransform: boolean); + /** + * Returns object representation of an instance + * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output + */ + toObject(propertiesToInclude?: any[]): IObject; + /** + * Returns SVG representation of an instance + * @param {Function} [reviver] Method for further parsing of svg representation. + */ + toSVG(reviver?: Function): string; + /** + * Retrieves object's fontSize + */ + getFontSize(): number; + /** + * Sets object's fontSize + * @param {Number} fontSize Font size (in pixels) + */ + setFontSize(fontSize: number): IText; + /** + * Retrieves object's fontWeight + */ + getFontWeight(): number|string; + /** + * Sets object's fontWeight + * @param {(Number|String)} fontWeight Font weight + */ + setFontWeight(fontWeight: string|number): IText; + /** + * Retrieves object's fontFamily + */ + getFontFamily(): string; + /** + * Sets object's fontFamily + * @param {String} fontFamily Font family + */ + setFontFamily(fontFamily: string): IText; + /** + * Retrieves object's text + */ + getText(): string; + /** + * Sets object's text + * @param {String} text Text + */ + setText(text: string): IText; + /** + * Retrieves object's textDecoration + */ + getTextDecoration(): string; + /** + * Sets object's textDecoration + * @param {String} textDecoration Text decoration + */ + setTextDecoration(textDecoration: string): IText; + /** + * Retrieves object's fontStyle + */ + getFontStyle(): string; + /** + * Sets object's fontStyle + * @param {String} fontStyle Font style + */ + setFontStyle(fontStyle: string): IText; + /** + * Retrieves object's lineHeight + */ + getLineHeight(): number; + /** + * Sets object's lineHeight + * @param {Number} lineHeight Line height + */ + setLineHeight(lineHeight: number): IText; + /** + * Retrieves object's textAlign + */ + getTextAlign(): string; + /** + * Sets object's textAlign + * @param {String} textAlign Text alignment + */ + setTextAlign(textAlign: string): IText; + /** + * Retrieves object's textBackgroundColor + */ + getTextBackgroundColor(): string; + /** + * Sets object's textBackgroundColor + * @param {String} textBackgroundColor Text background color + */ + setTextBackgroundColor(textBackgroundColor: string): IText; + } + interface ITextStatic { + /** + * List of attribute names to account for when parsing SVG element (used by `fabric.Text.fromElement`) + */ + ATTRIBUTE_NAMES: string[]; + /** + * Default SVG font size + */ + DEFAULT_SVG_FONT_SIZE: number; + /** + * Constructor + * @param {String} text Text string + * @param {Object} [options] Options object + */ + new (text: string, options?: ITextOptions): IText; + + /** + * Returns fabric.Text instance from an SVG element (not yet implemented) + * @param {SVGElement} element Element to parse + * @param {Object} [options] Options object + */ + fromElement(element: SVGElement, options?: ITextOptions): IText; + /** + * Returns fabric.Text instance from an object representation + * @param {Object} object Object to create an instance from + */ + fromObject(object: any): IText; + } + + interface IITextOptions extends IObjectOptions, ITextOptions { + /** + * Index where text selection starts (or where cursor is when there is no selection) + */ + selectionStart?: number; + + /** + * Index where text selection ends + */ + selectionEnd?: number; + + /** + * Color of text selection + */ + selectionColor?: string; + + /** + * Indicates whether text is in editing mode + */ + isEditing?: boolean; + + /** + * Indicates whether a text can be edited + */ + editable?: boolean; + + /** + * Border color of text object while it's in editing mode + */ + editingBorderColor?: string; + + /** + * Width of cursor (in px) + */ + cursorWidth?: number; + + /** + * Color of default cursor (when not overwritten by character style) + */ + cursorColor?: string; + + /** + * Delay between cursor blink (in ms) + */ + cursorDelay?: number; + + /** + * Duration of cursor fadein (in ms) + */ + cursorDuration?: number; + + /** + * Object containing character styles + * (where top-level properties corresponds to line number and 2nd-level properties -- to char number in a line) + */ + styles?: any; + + /** + * Indicates whether internal text char widths can be cached + */ + caching?: boolean; + } + interface IIText extends IObject, IText, IITextOptions { + /** + * Returns true if object has no styling + */ + isEmptyStyles(): boolean; + render(ctx: CanvasRenderingContext2D, noTransform: boolean); + /** + * Returns object representation of an instance + * @method toObject + * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output + * @return {Object} object representation of an instance + */ + toObject(propertiesToInclude?: any[]): IObject; + + setText(value: string): IText; + /** + * Sets selection start (left boundary of a selection) + * @param {Number} index Index to set selection start to + */ + setSelectionStart(index: number): void; + /** + * Sets selection end (right boundary of a selection) + * @param {Number} index Index to set selection end to + */ + setSelectionEnd(index: number): void; + /** + * Gets style of a current selection/cursor (at the start position) + * @param {Number} [startIndex] Start index to get styles at + * @param {Number} [endIndex] End index to get styles at + * @return {Object} styles Style object at a specified (or current) index + */ + getSelectionStyles(startIndex: number, endIndex: number): any; + /** + * Sets style of a current selection + * @param {Object} [styles] Styles object + * @return {fabric.IText} thisArg + * @chainable + */ + setSelectionStyles(styles: any): IText; + + /** + * Renders cursor or selection (depending on what exists) + */ + renderCursorOrSelection(): void; + + /** + * Returns 2d representation (lineIndex and charIndex) of cursor (or selection start) + * @param {Number} [selectionStart] Optional index. When not given, current selectionStart is used. + */ + get2DCursorLocation(selectionStart?: number): void; + /** + * Returns complete style of char at the current cursor + * @param {Number} lineIndex Line index + * @param {Number} charIndex Char index + * @return {Object} Character style + */ + getCurrentCharStyle(lineIndex: number, charIndex: number): any; + + /** + * Returns fontSize of char at the current cursor + * @param {Number} lineIndex Line index + * @param {Number} charIndex Char index + * @return {Number} Character font size + */ + getCurrentCharFontSize(lineIndex: number, charIndex: number): number; + + /** + * Returns color (fill) of char at the current cursor + * @param {Number} lineIndex Line index + * @param {Number} charIndex Char index + * @return {String} Character color (fill) + */ + getCurrentCharColor(lineIndex: number, charIndex: number): string; + /** + * Renders cursor + * @param {Object} boundaries + */ + renderCursor(boundaries: any): void; + + /** + * Renders text selection + * @param {Array} chars Array of characters + * @param {Object} boundaries Object with left/top/leftOffset/topOffset + */ + renderSelection(chars: string[], boundaries: any): void; + + // functions from itext behavior mixin + // ------------------------------------------------------------------------------------------------------------------------ + /** + * Initializes all the interactive behavior of IText + */ + initBehavior(): void; + + /** + * Initializes "selected" event handler + */ + initSelectedHandler(): void; + + /** + * Initializes "added" event handler + */ + initAddedHandler(): void; + + initRemovedHandler(): void; + + /** + * Initializes delayed cursor + */ + initDelayedCursor(restart: boolean): void; + + /** + * Aborts cursor animation and clears all timeouts + */ + abortCursorAnimation(): void; + + /** + * Selects entire text + */ + selectAll(): void; + + /** + * Returns selected text + */ + getSelectedText(): string; + + /** + * Find new selection index representing start of current word according to current selection index + * @param {Number} startFrom Surrent selection index + * @return {Number} New selection index + */ + findWordBoundaryLeft(startFrom: number): number; + + /** + * Find new selection index representing end of current word according to current selection index + * @param {Number} startFrom Current selection index + * @return {Number} New selection index + */ + findWordBoundaryRight(startFrom: number): number; + + /** + * Find new selection index representing start of current line according to current selection index + * @param {Number} startFrom Current selection index + */ + findLineBoundaryLeft(startFrom: number): number; + + /** + * Find new selection index representing end of current line according to current selection index + * @param {Number} startFrom Current selection index + */ + findLineBoundaryRight(startFrom: number): number; + + /** + * Returns number of newlines in selected text + */ + getNumNewLinesInSelectedText(): number; + + /** + * Finds index corresponding to beginning or end of a word + * @param {Number} selectionStart Index of a character + * @param {Number} direction: 1 or -1 + */ + searchWordBoundary(selectionStart: number, direction: number): number; + + /** + * Selects a word based on the index + * @param {Number} selectionStart Index of a character + */ + selectWord(selectionStart: number): void; + /** + * Selects a line based on the index + * @param {Number} selectionStart Index of a character + */ + selectLine(selectionStart: number): void; + + /** + * Enters editing state + */ + enterEditing(): IIText; + + /** + * Initializes "mousemove" event handler + */ + initMouseMoveHandler(): void; + /** + * Exits from editing state + * @return {fabric.IText} thisArg + * @chainable + */ + exitEditing(): IIText; + + /** + * Inserts a character where cursor is (replacing selection if one exists) + * @param {String} _chars Characters to insert + */ + insertChars(_chars: string, useCopiedStyle?: boolean): void; + /** + * Inserts new style object + * @param {Number} lineIndex Index of a line + * @param {Number} charIndex Index of a char + * @param {Boolean} isEndOfLine True if it's end of line + */ + insertNewlineStyleObject(lineIndex: number, charIndex: number, isEndOfLine: boolean): void; + + /** + * Inserts style object for a given line/char index + * @param {Number} lineIndex Index of a line + * @param {Number} charIndex Index of a char + * @param {Object} [style] Style object to insert, if given + */ + insertCharStyleObject(lineIndex: number, charIndex: number, isEndOfLine: boolean): void; + + /** + * Inserts style object(s) + * @param {String} _chars Characters at the location where style is inserted + * @param {Boolean} isEndOfLine True if it's end of line + * @param {Boolean} [useCopiedStyle] Style to insert + */ + insertStyleObjects(_chars: string, isEndOfLine: boolean, useCopiedStyle?: boolean): void; + + /** + * Shifts line styles up or down + * @param {Number} lineIndex Index of a line + * @param {Number} offset Can be -1 or +1 + */ + shiftLineStyles(lineIndex: number, offset: number): void; + + /** + * Removes style object + * @param {Boolean} isBeginningOfLine True if cursor is at the beginning of line + * @param {Number} [index] Optional index. When not given, current selectionStart is used. + */ + removeStyleObject(isBeginningOfLine: boolean, index?: number): void; + /** + * Inserts new line + */ + insertNewline(): void; + + } + interface IITextStatic extends ITextStatic { + /** + * Constructor + * @param {String} text Text string + * @param {Object} [options] Options object + */ + new (text: string, options?: IITextOptions): IIText; + /** + * Returns fabric.IText instance from an object representation + * @param {Object} object Object to create an instance from + */ + fromObject(object: any): IIText; + } + + interface ITriangleOptions extends IObjectOptions { } + interface ITriangle extends IObject { + /** + * Returns complexity of an instance + * @return {Number} complexity of this instance + */ + + complexity(): number; + /** + * Returns SVG representation of an instance + * @param {Function} [reviver] Method for further parsing of svg representation. + * @return {String} svg representation of an instance + */ + toSVG(reviver?: Function): string; + } + interface ITriangleStatic { + /** + * Constructor + * @param {Object} [options] Options object + */ + new (options?: ITriangleOptions): ITriangle; + /** + * Returns Triangle instance from an object representation + * @param {Object} object Object to create an instance from + */ + fromObject(object: any): ITriangle; + } + + //////////////////////////////////////////////////////////// + // Filters + //////////////////////////////////////////////////////////// + interface IAllFilters { + BaseFilter: { + /** + * Constructor + * @param {Object} [options] Options object + */ + new (options?: any): IBaseFilter; + }; + Blend: { + /** + * Constructor + * @param {Object} [options] Options object + */ + new (options?: { color?: string; mode?: string; alpha?: number; image?: IImage }): IBlendFilter; + /** + * Returns filter instance from an object representation + * @param {Object} object Object to create an instance from + */ + fromObject(object: any): IBlendFilter + }; + Brightness: { + /** + * Constructor + * @param {Object} [options] Options object + * @param {Number} [options.brightness=0] Value to brighten the image up (0..255) + */ + new (options?: { brightness: number }): IBrightnessFilter; + /** + * Returns filter instance from an object representation + * @param {Object} object Object to create an instance from + */ + fromObject(object: any): IBrightnessFilter + }; + Convolute: { + /** + * Constructor + * @param {Object} [options] Options object + * @param {Boolean} [options.opaque=false] Opaque value (true/false) + * @param {Array} [options.matrix] Filter matrix + */ + new (options?: { opaque?: boolean; matrix?: number[] }): IConvoluteFilter; + /** + * Returns filter instance from an object representation + * @param {Object} object Object to create an instance from + */ + fromObject(object: any): IConvoluteFilter + }; + GradientTransparency: { + /** + * Constructor + * @param {Object} [options] Options object + * @param {Number} [options.threshold=100] Threshold value + */ + new (options?: { threshold?: number; }): IGradientTransparencyFilter; + /** + * Returns filter instance from an object representation + * @param {Object} object Object to create an instance from + */ + fromObject(object: any): IGradientTransparencyFilter + }; + Grayscale: { + /** + * Constructor + * @param {Object} [options] Options object + */ + new (options?: any): IGrayscaleFilter; + /** + * Returns filter instance from an object representation + * @param {Object} object Object to create an instance from + */ + fromObject(object: any): IGrayscaleFilter + }; + Invert: { + /** + * Constructor + * @param {Object} [options] Options object + */ + new (options?: any): IInvertFilter; + /** + * Returns filter instance from an object representation + * @param {Object} object Object to create an instance from + */ + fromObject(object: any): IInvertFilter + }; + Mask: { + /** + * Constructor + * @param {Object} [options] Options object + * @param {fabric.Image} [options.mask] Mask image object + * @param {Number} [options.channel=0] Rgb channel (0, 1, 2 or 3) + */ + new (options?: { mask?: IImage; channel: number; }): IMaskFilter; + /** + * Returns filter instance from an object representation + * @param {Object} object Object to create an instance from + */ + fromObject(object: any): IMaskFilter + }; + Multiply: { + /** + * Constructor + * @param {Object} [options] Options object + * @param {Number} [options.color=#000000] Color to multiply the image pixels with + */ + new (options?: { color: string; }): IMultiplyFilter; + /** + * Returns filter instance from an object representation + * @param {Object} object Object to create an instance from + */ + fromObject(object: any): IMultiplyFilter + }; + Noise: { + /** + * Constructor + * @param {Object} [options] Options object + * @param {Number} [options.noise=0] Noise value + */ + new (options?: { noise: number; }): INoiseFilter; + /** + * Returns filter instance from an object representation + * @param {Object} object Object to create an instance from + */ + fromObject(object: any): INoiseFilter + }; + Pixelate: { + /** + * Constructor + * @param {Object} [options] Options object + * @param {Number} [options.blocksize=4] Blocksize for pixelate + */ + new (options?: { blocksize?: number; }): IPixelateFilter; + /** + * Returns filter instance from an object representation + * @param {Object} object Object to create an instance from + */ + fromObject(object: any): IPixelateFilter + }; + RemoveWhite: { + /** + * Constructor + * @param {Object} [options] Options object + * @param {Number} [options.threshold=30] Threshold value + * @param {Number} [options.distance=20] Distance value + */ + new (options?: { threshold?: number; distance?: number; }): IRemoveWhiteFilter; + /** + * Returns filter instance from an object representation + * @param {Object} object Object to create an instance from + */ + fromObject(object: any): IRemoveWhiteFilter + }; + Resize: { + /** + * Constructor + * @param {Object} [options] Options object + */ + new (options?: any): IResizeFilter; + /** + * Returns filter instance from an object representation + * @param {Object} object Object to create an instance from + */ + fromObject(object: any): IResizeFilter + }; + Sepia2: { + /** + * Constructor + * @param {Object} [options] Options object + */ + new (options?: any): ISepia2Filter; + /** + * Returns filter instance from an object representation + * @param {Object} object Object to create an instance from + */ + fromObject(object: any): ISepia2Filter + }; + Sepia: { + /** + * Constructor + * @param {Object} [options] Options object + */ + new (options?: any): ISepiaFilter; + /** + * Returns filter instance from an object representation + * @param {Object} object Object to create an instance from + */ + fromObject(object: any): ISepiaFilter + }; + Tint: { + /** + * Constructor + * @param {Object} [options] Options object + * @param {String} [options.color=#000000] Color to tint the image with + * @param {Number} [options.opacity] Opacity value that controls the tint effect's transparency (0..1) + */ + new (options?: { color?: string; opacity?: number; }): ITintFilter; + /** + * Returns filter instance from an object representation + * @param {Object} object Object to create an instance from + */ + fromObject(object: any): ITintFilter + }; + } + interface IBaseFilter { + /** + * Sets filter's properties from options + * @param {Object} [options] Options object + */ + setOptions(options?: any): void; + /** + * Returns object representation of an instance + */ + toObject(): any; + /** + * Returns a JSON representation of an instance + */ + toJSON(): string; + } + interface IBlendFilter extends IBaseFilter { + /** + * Applies filter to canvas element + * @param {Object} canvasEl Canvas element to apply filter to + */ + applyTo(canvasEl: HTMLCanvasElement): void; + } + interface IBrightnessFilter extends IBaseFilter { + /** + * Applies filter to canvas element + * @param {Object} canvasEl Canvas element to apply filter to + */ + applyTo(canvasEl: HTMLCanvasElement): void; + } + interface IConvoluteFilter extends IBaseFilter { + /** + * Applies filter to canvas element + * @param {Object} canvasEl Canvas element to apply filter to + */ + applyTo(canvasEl: HTMLCanvasElement): void; + } + interface IGradientTransparencyFilter { + /** + * Applies filter to canvas element + * @param {Object} canvasEl Canvas element to apply filter to + */ + applyTo(canvasEl: HTMLCanvasElement): void; + } + interface IGrayscaleFilter { + /** + * Applies filter to canvas element + * @param {Object} canvasEl Canvas element to apply filter to + */ + applyTo(canvasEl: HTMLCanvasElement): void; + } + interface IInvertFilter { + /** + * Applies filter to canvas element + * @param {Object} canvasEl Canvas element to apply filter to + */ + applyTo(canvasEl: HTMLCanvasElement): void; + } + interface IMaskFilter { + /** + * Applies filter to canvas element + * @param {Object} canvasEl Canvas element to apply filter to + */ + applyTo(canvasEl: HTMLCanvasElement): void; + } + interface IMultiplyFilter { + /** + * Applies filter to canvas element + * @param {Object} canvasEl Canvas element to apply filter to + */ + applyTo(canvasEl: HTMLCanvasElement): void; + } + interface INoiseFilter { + /** + * Applies filter to canvas element + * @param {Object} canvasEl Canvas element to apply filter to + */ + applyTo(canvasEl: HTMLCanvasElement): void; + } + interface IPixelateFilter { + /** + * Applies filter to canvas element + * @param {Object} canvasEl Canvas element to apply filter to + */ + applyTo(canvasEl: HTMLCanvasElement): void; + } + interface IRemoveWhiteFilter { + /** + * Applies filter to canvas element + * @param {Object} canvasEl Canvas element to apply filter to + */ + applyTo(canvasEl: HTMLCanvasElement): void; + } + interface IResizeFilter { + /** + * Resize type + */ + resizeType: string; + + /** + * Scale factor for resizing, x axis + */ + scaleX: number; + + /** + * Scale factor for resizing, y axis + */ + scaleY: number; + + /** + * LanczosLobes parameter for lanczos filter + */ + lanczosLobes: number; + /** + * Applies filter to canvas element + * @param {Object} canvasEl Canvas element to apply filter to + */ + applyTo(canvasEl: HTMLCanvasElement): void; + } + interface ISepiaFilter { + /** + * Applies filter to canvas element + * @param {Object} canvasEl Canvas element to apply filter to + */ + applyTo(canvasEl: HTMLCanvasElement): void; + } + interface ISepia2Filter { + /** + * Applies filter to canvas element + * @param {Object} canvasEl Canvas element to apply filter to + */ + applyTo(canvasEl: HTMLCanvasElement): void; + } + interface ITintFilter { + /** + * Applies filter to canvas element + * @param {Object} canvasEl Canvas element to apply filter to + */ + applyTo(canvasEl: HTMLCanvasElement): void; + } + + //////////////////////////////////////////////////////////// + // Brushes + //////////////////////////////////////////////////////////// + interface IBaseBrush { + /** + * Color of a brush + */ + color: string; + + /** + * Width of a brush + */ + width: number; + + /** + * Shadow object representing shadow of this shape. + * Backwards incompatibility note: This property replaces "shadowColor" (String), "shadowOffsetX" (Number), + * "shadowOffsetY" (Number) and "shadowBlur" (Number) since v1.2.12 + */ + shadow: IShadow|string; + /** + * Line endings style of a brush (one of "butt", "round", "square") + */ + strokeLineCap: string; + + /** + * Corner style of a brush (one of "bevil", "round", "miter") + */ + strokeLineJoin: string; + + /** + * Stroke Dash Array. + */ + strokeDashArray: any[]; + + /** + * Sets shadow of an object + * @param {Object|String} [options] Options object or string (e.g. "2px 2px 10px rgba(0,0,0,0.2)") + */ + setShadow(options: string|any): IBaseBrush; + + } + interface ICircleBrush extends IBaseBrush { + /** + * Width of a brush + */ + width: number; + /** + * Invoked inside on mouse down and mouse move + * @param {Object} pointer + */ + drawDot(pointer: any): void; + + /** + * @param {Object} pointer + * @return {fabric.Point} Just added pointer point + */ + addPoint(pointer: any): IPoint + } + interface ISprayBrush extends IBaseBrush { + /** + * Width of a brush + */ + width: number; + /** + * Density of a spray (number of dots per chunk) + */ + density: number; + + /** + * Width of spray dots + */ + dotWidth: number; + /** + * Width variance of spray dots + */ + dotWidthVariance: number; + + /** + * Whether opacity of a dot should be random + */ + randomOpacity: boolean; + /** + * Whether overlapping dots (rectangles) should be removed (for performance reasons) + */ + optimizeOverlapping: boolean; + /** + * @param {Object} pointer + */ + addSprayChunk(pointer: any): void + } + interface IPatternBrush extends IPencilBrush { + getPatternSrc(): HTMLCanvasElement; + + getPatternSrcFunction(): string; + + /** + * Creates "pattern" instance property + */ + getPattern(): any; + /** + * Creates path + */ + createPath(pathData: string): IPath; + } + interface IPencilBrush extends IBaseBrush { + /** + * Converts points to SVG path + * @param {Array} points Array of points + * @param {Number} minX + * @param {Number} minY + */ + convertPointsToSVGPath(points: { x: number; y: number }[], minX?: number, minY?: number): string[]; + + /** + * Creates fabric.Path object to add on canvas + * @param {String} pathData Path data + */ + createPath(pathData: string): IPath; + } + var BaseBrush: { + new (): IBaseBrush + }; + var CircleBrush: { + new (canvas: fabric.ICanvas): ICircle + }; + var SprayBrush: { + new (canvas: fabric.ICanvas): ISprayBrush + }; + var PencilBrush: { + new (canvas: fabric.ICanvas): IPencilBrush + }; + var PatternBrush: { + new (canvas: fabric.ICanvas): IPatternBrush + }; + /////////////////////////////////////////////////////////////////////////////// + // Fabric util Interface + ////////////////////////////////////////////////////////////////////////////// + interface IUtilAnimationOptions { + /** + * Starting value + */ + startValue?: number; + /** + * Ending value + */ + endValue?: number; + /** + * Value to modify the property by + */ + byValue: number; + /** + * Duration of change (in ms) + */ + duration?: number; + /** + * Callback; invoked on every value change + */ + onChange?: Function; + /** + * Callback; invoked when value change is completed + */ + onComplete?: Function; + /** + * Easing function + */ + easing?: Function; + } + interface IUtilAnimation { + /** + * Changes value from one to another within certain period of time, invoking callbacks as value is being changed. + * @param {Object} [options] Animation options + */ + animate(options?: IUtilAnimationOptions): void; + /** + * requestAnimationFrame polyfill based on http://paulirish.com/2011/requestanimationframe-for-smart-animating/ + * In order to get a precise start time, `requestAnimFrame` should be called as an entry into the method + * @param {Function} callback Callback to invoke + */ + requestAnimFrame(callback: Function): void; + } + + interface IUtilAnimEase { + easeInBack(): Function; + easeInBounce(): Function; + easeInCirc(): Function; + easeInCubic(): Function; + easeInElastic(): Function; + easeInExpo(): Function; + easeInOutBack(): Function; + easeInOutBounce(): Function; + easeInOutCirc(): Function; + easeInOutCubic(): Function; + easeInOutElastic(): Function; + easeInOutExpo(): Function; + easeInOutQuad(): Function; + easeInOutQuart(): Function; + easeInOutQuint(): Function; + easeInOutSine(): Function; + easeInQuad(): Function; + easeInQuart(): Function; + easeInQuint(): Function; + easeInSine(): Function; + easeOutBack(): Function; + easeOutBounce(): Function; + easeOutCirc(): Function; + easeOutCubic(): Function; + easeOutElastic(): Function; + easeOutExpo(): Function; + easeOutQuad(): Function; + easeOutQuart(): Function; + easeOutQuint(): Function; + easeOutSine(): Function; + } + + interface IUtilArc { + /** + * Draws arc + * @param {CanvasRenderingContext2D} ctx + * @param {Number} fx + * @param {Number} fy + * @param {Array} coords + */ + drawArc(ctx: CanvasRenderingContext2D, fx: number, fy: number, coords: number[]): void; + /** + * Calculate bounding box of a elliptic-arc + * @param {Number} fx start point of arc + * @param {Number} fy + * @param {Number} rx horizontal radius + * @param {Number} ry vertical radius + * @param {Number} rot angle of horizontal axe + * @param {Number} large 1 or 0, whatever the arc is the big or the small on the 2 points + * @param {Number} sweep 1 or 0, 1 clockwise or counterclockwise direction + * @param {Number} tx end point of arc + * @param {Number} ty + */ + getBoundsOfArc(fx: number, fy: number, rx: number, ry: number, rot: number, large: number, sweep: number, tx: number, ty: number): IPoint[]; + /** + * Calculate bounding box of a beziercurve + * @param {Number} x0 starting point + * @param {Number} y0 + * @param {Number} x1 first control point + * @param {Number} y1 + * @param {Number} x2 secondo control point + * @param {Number} y2 + * @param {Number} x3 end of beizer + * @param {Number} y3 + */ + getBoundsOfCurve(x0: number, y0: number, x1: number, y1: number, x2: number, y2: number, x3: number, y3: number): IPoint[]; + + } + + interface IUtilDomEvent { + /** + * Cross-browser wrapper for getting event's coordinates + * @param {Event} event Event object + * @param {HTMLCanvasElement} upperCanvasEl <canvas> element on which object selection is drawn + */ + getPointer(event: Event, upperCanvasEl: HTMLCanvasElement): IPoint; + + /** + * Adds an event listener to an element + * @param {HTMLElement} element + * @param {String} eventName + * @param {Function} handler + */ + addListener(element: HTMLElement, eventName: string, handler: Function): void; + + /** + * Removes an event listener from an element + * @param {HTMLElement} element + * @param {String} eventName + * @param {Function} handler + */ + removeListener(element: HTMLElement, eventName: string, handler: Function): void; + } + + interface IUtilDomMisc { + /** + * Takes id and returns an element with that id (if one exists in a document) + * @param {String|HTMLElement} id + */ + getById(id: string|HTMLElement): HTMLElement; + /** + * Converts an array-like object (e.g. arguments or NodeList) to an array + * @param {Object} arrayLike + */ + toArray(arrayLike: any): any[]; + /** + * Creates specified element with specified attributes + * @memberOf fabric.util + * @param {String} tagName Type of an element to create + * @param {Object} [attributes] Attributes to set on an element + * @return {HTMLElement} Newly created element + */ + makeElement(tagName: string, attributes?: any): HTMLElement; + /** + * Adds class to an element + * @param {HTMLElement} element Element to add class to + * @param {String} className Class to add to an element + */ + addClass(element: HTMLElement, classname: string): void; + /** + * Wraps element with another element + * @param {HTMLElement} element Element to wrap + * @param {HTMLElement|String} wrapper Element to wrap with + * @param {Object} [attributes] Attributes to set on a wrapper + */ + wrapElement(element: HTMLElement, wrapper: HTMLElement|string, attributes?: any): HTMLElement; + /** + * Returns element scroll offsets + * @param {HTMLElement} element Element to operate on + * @param {HTMLElement} upperCanvasEl Upper canvas element + */ + getScrollLeftTop(element: HTMLElement, upperCanvasEl: HTMLElement): { left: number; right: number; }; + /** + * Returns offset for a given element + * @param {HTMLElement} element Element to get offset for + */ + getElementOffset(element: HTMLElement): { left: number; right: number; }; + /** + * Returns style attribute value of a given element + * @param {HTMLElement} element Element to get style attribute for + * @param {String} attr Style attribute to get for element + */ + getElementStyle(elment: HTMLElement, attr: string): string; + /** + * Inserts a script element with a given url into a document; invokes callback, when that script is finished loading + * @memberOf fabric.util + * @param {String} url URL of a script to load + * @param {Function} callback Callback to execute when script is finished loading + */ + getScript(url: string, callback: Function): void; + /** + * Makes element unselectable + * @param {HTMLElement} element Element to make unselectable + */ + makeElementUnselectable(element: HTMLElement): HTMLElement; + /** + * Makes element selectable + * @param {HTMLElement} element Element to make selectable + */ + makeElementSelectable(element: HTMLElement): HTMLElement; + } + + interface IUtilDomRequest { + /** + * Cross-browser abstraction for sending XMLHttpRequest + * @param {String} url URL to send XMLHttpRequest to + * @param {Object} [options] Options object + * @param {String} [options.method="GET"] + * @param {Function} options.onComplete Callback to invoke when request is completed + */ + request(url: string, options?: { method?: string; onComplete: Function }): XMLHttpRequest; + } + + interface IUtilDomStyle { + /** + * Cross-browser wrapper for setting element's style + * @param {HTMLElement} element + * @param {Object} styles + */ + setStyle(element: HTMLElement, styles: any): HTMLElement; + } + + interface IUtilArray { + /** + * Invokes method on all items in a given array + * @param {Array} array Array to iterate over + * @param {String} method Name of a method to invoke + */ + invoke(array: any[], method: string): any[]; + /** + * Finds minimum value in array (not necessarily "first" one) + * @param {Array} array Array to iterate over + * @param {String} byProperty + */ + min(array: any[], byProperty: string): any; + /** + * Finds maximum value in array (not necessarily "first" one) + * @param {Array} array Array to iterate over + * @param {String} byProperty + */ + max(array: any[], byProperty: string): any; + } + + interface IUtilClass { + /** + * Helper for creation of "classes". + * @param {Function} [parent] optional "Class" to inherit from + * @param {Object} [properties] Properties shared by all instances of this class + * (be careful modifying objects defined here as this would affect all instances) + */ + createClass(parent: Function, properties?: any); + /** + * Helper for creation of "classes". + * @param {Object} [properties] Properties shared by all instances of this class + * (be careful modifying objects defined here as this would affect all instances) + */ + createClass(properties?: any); + + } + + interface IUtilObject { + /** + * Copies all enumerable properties of one object to another + * @param {Object} destination Where to copy to + * @param {Object} source Where to copy from + */ + extend(destination: any, source: any): any; + + /** + * Creates an empty object and copies all enumerable properties of another object to it + * @memberOf fabric.util.object + * @param {Object} object Object to clone + * @return {Object} + */ + clone(object: any): any + } + + interface IUtilString { + /** + * Camelizes a string + * @param {String} string String to camelize + */ + camelize(string: string): string; + + /** + * Capitalizes a string + * @param {String} string String to capitalize + * @param {Boolean} [firstLetterOnly] If true only first letter is capitalized + * and other letters stay untouched, if false first letter is capitalized + * and other letters are converted to lowercase. + */ + capitalize(string: string, firstLetterOnly: boolean): string; + + /** + * Escapes XML in a string + * @param {String} string String to escape + */ + escapeXml(string: string): string; + } + + interface IUtilMisc { + /** + * Removes value from an array. + * Presence of value (and its position in an array) is determined via `Array.prototype.indexOf` + * @param {Array} array + * @param {Any} value + */ + removeFromArray(array: any[], value: any): any[]; + + /** + * Returns random number between 2 specified ones. + * @param {Number} min lower limit + * @param {Number} max upper limit + */ + getRandomInt(min: number, max: number): number; + + /** + * Transforms degrees to radians. + * @param {Number} degrees value in degrees + */ + degreesToRadians(degrees: number): number; + + /** + * Transforms radians to degrees. + * @memberOf fabric.util + * @param {Number} radians value in radians + */ + radiansToDegrees(radians: number): number; + + /** + * Rotates `point` around `origin` with `radians` + * @param {fabric.Point} point The point to rotate + * @param {fabric.Point} origin The origin of the rotation + * @param {Number} radians The radians of the angle for the rotation + */ + rotatePoint(point: IPoint, origin: IPoint, radians: number): IPoint; + + /** + * Apply transform t to point p + * @param {fabric.Point} p The point to transform + * @param {Array} t The transform + * @param {Boolean} [ignoreOffset] Indicates that the offset should not be applied + */ + transformPoint(p: IPoint, t: any[], ignoreOffset?: boolean): IPoint; + + /** + * Invert transformation t + * @param {Array} t The transform + */ + invertTransform(t: any[]): any[]; + + /** + * A wrapper around Number#toFixed, which contrary to native method returns number, not string. + * @param {Number|String} number number to operate on + * @param {Number} fractionDigits number of fraction digits to "leave" + */ + toFixed(number: number, fractionDigits: number): number; + + /** + * Converts from attribute value to pixel value if applicable. + * Returns converted pixels or original value not converted. + * @param {Number|String} value number to operate on + */ + parseUnit(value: number|string, fontSize?: number): number|string; + + /** + * Function which always returns `false`. + */ + falseFunction(): boolean; + + /** + * Returns klass "Class" object of given namespace + * @param {String} type Type of object (eg. 'circle') + * @param {String} namespace Namespace to get klass "Class" object from + */ + getKlass(type: string, namespace: string): any; + + /** + * Returns object of given namespace + * @param {String} namespace Namespace string e.g. 'fabric.Image.filter' or 'fabric' + */ + resolveNamespace(namespace: string): any; + + /** + * Loads image element from given url and passes it to a callback + * @param {String} url URL representing an image + * @param {Function} callback Callback; invoked with loaded image + * @param {Any} [context] Context to invoke callback in + * @param {Object} [crossOrigin] crossOrigin value to set image element to + */ + loadImage(url: string, callback: (image: HTMLImageElement) => {}, context?: any, crossOrigin?: boolean): void; + + /** + * Creates corresponding fabric instances from their object representations + * @param {Array} objects Objects to enliven + * @param {Function} callback Callback to invoke when all objects are created + * @param {String} namespace Namespace to get klass "Class" object from + * @param {Function} reviver Method for further parsing of object elements, called after each fabric object created. + */ + enlivenObjects(objects: any[], callback: Function, namespace: string, reviver?: Function): void; + + /** + * Groups SVG elements (usually those retrieved from SVG document) + * @param {Array} elements SVG elements to group + * @param {Object} [options] Options object + */ + groupSVGElements(elements: any[], options?: any, path?: any): IPathGroup; + + /** + * Populates an object with properties of another object + * @param {Object} source Source object + * @param {Object} destination Destination object + * @param {Array} properties Propertie names to include + */ + populateWithProperties(source: any, destination: any, properties: any): void; + + /** + * Draws a dashed line between two points + * This method is used to draw dashed line around selection area. + * @param {CanvasRenderingContext2D} ctx context + * @param {Number} x start x coordinate + * @param {Number} y start y coordinate + * @param {Number} x2 end x coordinate + * @param {Number} y2 end y coordinate + * @param {Array} da dash array pattern + */ + drawDashedLine(ctx: CanvasRenderingContext2D, x: number, y: number, x2: number, y2: number, da: any[]): void; + + /** + * Creates canvas element and initializes it via excanvas if necessary + * @param {CanvasElement} [canvasEl] optional canvas element to initialize; + * when not given, element is created implicitly + */ + createCanvasElement(canvasEl?: HTMLCanvasElement): HTMLCanvasElement; + + /** + * Creates image element (works on client and node) + */ + createImage(): HTMLImageElement; + + /** + * Creates accessors (getXXX, setXXX) for a "class", based on "stateProperties" array + * @param {Object} klass "Class" to create accessors for + */ + createAccessors(klass: any): any; + + /** + * @param {fabric.Object} receiver Object implementing `clipTo` method + * @param {CanvasRenderingContext2D} ctx Context to clip + */ + clipContext(receiver: IObject, ctx: CanvasRenderingContext2D): void; + + /** + * Multiply matrix A by matrix B to nest transformations + * @param {Array} a First transformMatrix + * @param {Array} b Second transformMatrix + */ + multiplyTransformMatrices(a: any[], b: any[]): any[]; + + /** + * Returns string representation of function body + * @param {Function} fn Function to get body of + */ + getFunctionBody(fn: Function): string; + + /** + * Returns true if context has transparent pixel + * at specified location (taking tolerance into account) + * @param {CanvasRenderingContext2D} ctx context + * @param {Number} x x coordinate + * @param {Number} y y coordinate + * @param {Number} tolerance Tolerance + */ + isTransparent(ctx: CanvasRenderingContext2D, x: number, y: number, tolerance: number): boolean; + } + + interface IUtil extends IUtilAnimation, IUtilArc, IObservable, IUtilDomEvent, IUtilDomMisc, + IUtilDomRequest, IUtilDomStyle, IUtilClass, IUtilMisc { + ease: IUtilAnimEase; + array: IUtilArray; + object: IUtilObject; + string: IUtilString; + } } diff --git a/farbtastic/farbtastic-tests.ts b/farbtastic/farbtastic-tests.ts new file mode 100644 index 000000000..ac5eb4074 --- /dev/null +++ b/farbtastic/farbtastic-tests.ts @@ -0,0 +1,100 @@ +/// + +var callback = () => {}; +var domNode = document.createElement("div"); + +// Basic usage + +// Can add a ready() handler to the document which initializes the color picker and links it to the text field +$(document).ready(function() { + $("#colorpicker").farbtastic("#color"); +}); + +// Advanced Usage: jQuery Method + +// Create color pickers in the selected objects +$("#colorpicker").farbtastic(); + +// Optional callback using a callback function +$("#colorpicker").farbtastic(callback); +$("#colourpicker").farbtastic(function (color) { + console.log(typeof color === "string"); +}); + +// Optional callback using a DOM node +$("#colorpicker").farbtastic(domNode); + +// Optional callback using a jQuery object +$("#colorpicker").farbtastic($("#color")); + +// Optional callback using a jQuery selector +$("#colorpicker").farbtastic("#color"); + +// Advanced Usage: Object + +// Can invoke method for returning Farbtastic object instead of a jQuery object +$.farbtastic(domNode); +$.farbtastic($("#color")); +$.farbtastic("#color"); + +// Optional callback using a callback function +$.farbtastic(domNode, callback); +$.farbtastic($("#color"), callback); +$.farbtastic("#color", callback); + +// Optional callback using a DOM node +$.farbtastic(domNode, domNode); +$.farbtastic($("#color"), domNode); +$.farbtastic("#color", domNode); + +// Optional callback using a jQuery object +$.farbtastic(domNode, $("#color")); +$.farbtastic($("#color"), $("#color")); +$.farbtastic("#color", $("#color")); + +// Optional callback using a jQuery selector +$.farbtastic(domNode, "#color"); +$.farbtastic($("#color"), "#color"); +$.farbtastic("#color", "#color"); + +// Advanced Usage: Options +$("#colorpicker").farbtastic({ + callback: (color) => { + console.log(color); + } +}); +$.farbtastic(domNode, { + width: 500 +}); +$.farbtastic($("#color"), { + wheelWidth: 300 +}); +$.farbtastic("#color", {}); + +// Advanced Usage: Methods +$.farbtastic("#colorpicker").linkTo(callback); +$.farbtastic("#colorpicker").linkTo(domNode); +$.farbtastic("#colorpicker").linkTo("#color"); +$.farbtastic("#colorpicker").linkTo($("#color")); + +$.farbtastic("#colorpicker").setColor("#aabbcc"); +$.farbtastic("#colorpicker").setColor([0.1, 0.2, 0.3]); +$.farbtastic("#colorpicker").setHSL([0.1, 0.2, 0.3]); + +// Advanced Usage: Properties +$.farbtastic("#colorpicker").color === "#aabbcc"; +$.farbtastic("#colorpicker").hsl === [0.1, 0.2, 0.3]; +$.farbtastic("#colorpicker").linked === $("#colorpicker"); +$.farbtastic("#colorpicker").linked === callback; + +// Can chain jQuery methods +$("#colorpicker") + .farbtastic() + .addClass("color-picker"); + +// Can chain Farbtastic methods +$.farbtastic("#colorpicker") + .linkTo(domNode) + .setColor("#000000") + .setHSL([0, 0, 0]); + \ No newline at end of file diff --git a/farbtastic/farbtastic.d.ts b/farbtastic/farbtastic.d.ts new file mode 100644 index 000000000..30e93d6f6 --- /dev/null +++ b/farbtastic/farbtastic.d.ts @@ -0,0 +1,40 @@ +// Type definitions for Farbtastic: jQuery Color Wheel v2.0.0-alpha.1 +// Project: http://mattfarina.github.io/farbtastic/ +// Definitions by: Matt Brooks +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module JQueryFarbtastic { + type Placeholder = string | Element | JQuery; + type CallbackFunction = (color: string) => any; + type Callback = CallbackFunction | Placeholder; + + interface Options { + callback?: Callback; + width?: number; + wheelWidth?: number; + } + + interface Farbtastic { + linked: CallbackFunction | JQuery; + color: string; + hsl: number[]; + + linkTo(callback: Callback): Farbtastic; + setColor(color: string | number[]): Farbtastic; + setHSL(hsl: number[]): Farbtastic; + } +} + +interface JQueryStatic { + farbtastic(placeholder: JQueryFarbtastic.Placeholder, callback: JQueryFarbtastic.Callback): JQueryFarbtastic.Farbtastic; + farbtastic(placeholder: JQueryFarbtastic.Placeholder, options: JQueryFarbtastic.Options): JQueryFarbtastic.Farbtastic; + farbtastic(placeholder: JQueryFarbtastic.Placeholder): JQueryFarbtastic.Farbtastic; +} + +interface JQuery { + farbtastic(callback: JQueryFarbtastic.Callback): JQuery; + farbtastic(options: JQueryFarbtastic.Options): JQuery; + farbtastic(): JQuery; +} \ No newline at end of file diff --git a/firebase/firebase.d.ts b/firebase/firebase.d.ts index fdb808ec4..f3c53b3ce 100644 --- a/firebase/firebase.d.ts +++ b/firebase/firebase.d.ts @@ -9,6 +9,11 @@ interface FirebaseAuthResult { } interface FirebaseDataSnapshot { + /** + * Returns true if this DataSnapshot contains any data. + * It is slightly more efficient than using snapshot.val() !== null. + */ + exists(): boolean; /** * Gets the JavaScript object representation of the DataSnapshot. */ @@ -108,6 +113,10 @@ interface FirebaseQuery { * Generates a new Query object ordered by key name. */ orderByKey(): FirebaseQuery; + /** + * Generates a new Query object ordered by child values. + */ + orderByValue(): FirebaseQuery; /** * Generates a new Query object ordered by priority. */ @@ -255,10 +264,14 @@ interface Firebase extends FirebaseQuery { * Creates a new user account using an email / password combination. */ createUser(credentials: FirebaseCredentials, onComplete: (error: any) => void): void; + /** + * Updates the email associated with an email / password user account. + */ + changeEmail(credentials: FirebaseChangeEmailCredentials, onComplete: (error: any) => void): void; /** * Change the password of an existing user using an email / password combination. */ - changePassword(credentials: { email: string; oldPassword: string; newPassword: string }, onComplete: (error: any) => void): void; + changePassword(credentials: FirebaseChangePasswordCredentials, onComplete: (error: any) => void): void; /** * Removes an existing user account using an email / password combination. */ @@ -266,7 +279,7 @@ interface Firebase extends FirebaseQuery { /** * Sends a password-reset email to the owner of the account, containing a token that may be used to authenticate and change the user password. */ - resetPassword(credentials: { email: string }, onComplete: (error: any) => void): void; + resetPassword(credentials: FirebaseResetPasswordCredentials, onComplete: (error: any) => void): void; onDisconnect(): FirebaseOnDisconnect; } interface FirebaseStatic { @@ -305,4 +318,20 @@ interface FirebaseAuthData { interface FirebaseCredentials { email: string; password: string; -} \ No newline at end of file +} + +interface FirebaseChangePasswordCredentials { + email: string; + oldPassword: string; + newPassword: string; +} + +interface FirebaseChangeEmailCredentials { + oldEmail: string; + newEmail: string; + password: string; +} + +interface FirebaseResetPasswordCredentials { + email: string; +} diff --git a/forge-di/forge-di-test.ts b/forge-di/forge-di-test.ts new file mode 100644 index 000000000..33bff4716 --- /dev/null +++ b/forge-di/forge-di-test.ts @@ -0,0 +1,52 @@ +/// + +import Forge = require('forge-di'); + +var forge = new Forge(); + +class Bar {} + +class Foo { + constructor(public bar: Bar) { + } +} + +forge.bind('foo').to.type(Foo); +forge.bind('bar').to.type(Bar); + +var foo: Foo = forge.get('foo'); +var barInst = foo.bar; + +// register functions +var createFoo = (bar: Bar) => new Foo(bar); +forge.bind('foo').to.function(createFoo); + +// Conditional bindings and resolution hints +class RedFoo {} +class BlueFoo {} + +forge.bind('foo').to.type(RedFoo).when('red'); +forge.bind('foo').to.type(BlueFoo).when((hint) => hint === 'blue'); + +// Lifecycles +forge.bind('foo').to.type(Foo).as.singleton(); +forge.bind('bar').to.type(Bar).as.transient(); + +// explicit arguments +var manuallyCreatedBar = new Bar(); +forge.bind('foo').to.type(Foo).with({bar: manuallyCreatedBar}); + +var bindingArgs: Forge.IBindingArguments = { + bar: manuallyCreatedBar +}; +forge.bind('foo').to.type(Foo).with(bindingArgs); + +// Ephemeral Bindings TODO +class DependsOnFoo { + constructor(public foo: Foo){} +} +var dependsOnFoo = forge.create(DependsOnFoo); + +// Unbinding and rebinding +forge.unbind('foo'); +forge.rebind('foo').to.type(Foo); \ No newline at end of file diff --git a/forge-di/forge-di.d.ts b/forge-di/forge-di.d.ts new file mode 100644 index 000000000..e28def38f --- /dev/null +++ b/forge-di/forge-di.d.ts @@ -0,0 +1,206 @@ +// Type definitions for forge-di v0.9.5 +// Project: https://github.com/nkohari/forge +// Definitions by: Adam Carr +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module "forge-di" { + /** + * Implementation of the forge dependency injection manager. + */ + class Forge { + /** + * Creates a new instance + * @returns {Forge} a new instance. + */ + new(): Forge; + + /** + * The bindings mapped to this forge instance. + */ + bindings: Forge.IBindingMap; + + /** + * Creates a new binding. + * @param {string} name The binding name. + */ + bind(name: string): Forge.IBinding; + /** + * Unbinds then recreates a binding for this name. + * @param {string} name The binding name. + */ + rebind(name: string): Forge.IBinding; + /** + * Unbinds all bindings for this name. Returns the number of bindings removed. + * @param {string} name The binding name. + */ + unbind(name: string): number; + /** + * Get instance or instances of type registered under the provided name and optional hint. + * @param {string} name The binding name. + * @param {string} hint The binding hint. + * @param {...args} args Additional args. + */ + get(name: string, hint?: string, ...args: any[]): T; + /** + * Get a single instance of type registered under the provided name and optional hint. + * @param {string} name The binding name. + * @param {string} hint The binding hint. + * @param {...args} args Additional args. + */ + getOne(name: string, hint?: string, ...args: any[]): T; + /** + * Gets all instances of the type registered under the provided name. + * @param {string} name The binding name. + * @param {...args} args Additional args. + */ + getAll(name: string, ...args: any[]): T | T[]; + /** + * Creates an instance of the target type attempting to resolve any dependencies. + * @param {T} target The target type. + * @param {...args} args Additional args. + */ + create(target: T, ...args: any[]): T; + /** + * Get all bindings registered under a binding name and optional hint. + * @param {string} name The binding name. + * @param {string} hint The binding hint. + */ + getMatchingBindings(name: string, hint?: string): Forge.IBinding[]; + /** + * Returns a string that represents all bindings within this forge instance. + */ + inspect(): string; + + resolve(name: string, context?: Forge.IContext, hint?: string, all?: boolean, ...args: any[]): T | T[]; + resolveBindings(context: Forge.IContext, bindings: Forge.IBinding[], hint: string, args: any[], unwrap: boolean): Forge.IBinding[]; + } + + module Forge { + interface IContext { + new (): IContext; + bindings: IBinding[]; + has(binding: IBinding): boolean; + push(binding: IBinding): void; + pop(): IBinding; + toString(indent: number): string; + } + + interface IType { + new (...args: any[]): any; + } + + /** + * Represents arguments to help with resolving a binding. + */ + interface IBindingArguments { + [name: string]: any; + } + + /** + * Represents a binding between a name, type/instance/function and optional hint. + */ + interface IBinding { + /** The forge that contains this binding. */ + forge: Forge; + /** The binding name. */ + name: string; + /** Alias mapping to this binding. */ + to: IBinding; + /** Alias mapping to this binding. */ + as: IBinding; + /** Whether or not this binding is currently resolving. */ + isResolving: boolean; + /** The resolver for this binding. */ + resolver: IResolver; + /** The lifecycle associated with this binding. Defaults to singleton. */ + lifecycle: ILifecycle; + /** The predicate associated with this binding. Used to support hints. */ + predicate: IPredicate; + /** The additional binding arguments to help resolve dependencies. */ + arguments: IBindingArguments; + + /** + * Checks whether or not this binding matches the hint by executing the predicate. + * @param {string} hint The hint to check against. + */ + matches(hint: string): boolean; + /** + * Registers a type to a binding. This type must have a constructor. + * @param {T} target The target type. + */ + type(target: T): IBinding; + /** + * Registers a type to a binding. This must be a callable function. + * @param {T} target The target function. + */ + function(target: T): IBinding; + /** + * Registeres an instance to a binding. This instance will always be returned. + * @param {T} target The target instance. + */ + instance(target: T): IBinding; + /** + * Configures this binding lifecycle as a singleton. This is the default lifecycle. + */ + singleton(): IBinding; + /** + * Configures this binding lifecycle as transient. + * New instances will be created, if this is a type based binding, on each get. + */ + transient(): IBinding; + /** + * Registers a predicate for this binding. + * @param {IPredicate} predicate The predicate. + */ + when(predicate:IPredicate): IBinding; + /** + * Registers a hint for this binding. + * @param {string} hint The hint. + */ + when(hint: string): IBinding; + /** + * Registers additional binding arguments to help with resolving. + * @param {IBindingArguments} args The additional binding arguments. + */ + with(args: IBindingArguments): IBinding; + /** + * Returns a string representing this binding. + */ + toString(): string; + } + + /** Represents a binding map. */ + interface IBindingMap { + /** Gets a binding by name. */ + [name: string]: IBinding[]; + } + + /** Represents a predicate. */ + interface IPredicate { + /** + * Returns whether or not the hit satisfies this predicate. + * @param {string} hint The hint to check against. + */ + (hint: string): boolean; + } + + /** Represents a resolver. */ + interface IResolver { + /** + * Resolves a specific type. + */ + resolve(): T; + } + + /** Represents a binding lifecycle. */ + interface ILifecycle { + /** + * Returns the instance from a resolver based on the configured lifecycle. + * @param {IResolver} resolver The type resolver. + */ + getInstance(resolver: IResolver): T; + } + } + + export = Forge; +} diff --git a/gapi/gapi.d.ts b/gapi/gapi.d.ts index d9d6fb90b..8c50826d4 100644 --- a/gapi/gapi.d.ts +++ b/gapi/gapi.d.ts @@ -65,6 +65,45 @@ declare module gapi.auth { * @param token The token to set. */ export function setToken(token: GoogleApiOAuth2TokenObject): void; + /** + * Initiates the client-side Google+ Sign-In OAuth 2.0 flow. + * When the method is called, the OAuth 2.0 authorization dialog is displayed to the user and when they accept, the callback function is called. + * @param params + */ + export function signIn(params: { + /** + * Your OAuth 2.0 client ID that you obtained from the Google Developers Console. + */ + clientid?: string; + /** + * Directs the sign-in button to store user and session information in a session cookie and HTML5 session storage on the user's client for the purpose of minimizing HTTP traffic and distinguishing between multiple Google accounts a user might be signed into. + */ + cookiepolicy?: string; + /** + * A function in the global namespace, which is called when the sign-in button is rendered and also called after a sign-in flow completes. + */ + callback?: Function; + /** + * If true, all previously granted scopes remain granted in each incremental request, for incremental authorization. The default value true is correct for most use cases; use false only if employing delegated auth, where you pass the bearer token to a less-trusted component with lower programmatic authority. + */ + includegrantedscopes?: boolean; + /** + * If your app will write moments, list the full URI of the types of moments that you intend to write. + */ + requestvisibleactions?: any; + /** + * The OAuth 2.0 scopes for the APIs that you would like to use as a space-delimited list. + */ + scope?: any; + /** + * If you have an Android app, you can drive automatic Android downloads from your web sign-in flow. + */ + apppackagename?: string; + }): void; + /** + * Signs a user out of your app without logging the user out of Google. This method will only work when the user is signed in with Google+ Sign-In. + */ + export function signOut(): void; } declare module gapi.client { diff --git a/github-electron/.editorconfig b/github-electron/.editorconfig new file mode 100644 index 000000000..2d98d905d --- /dev/null +++ b/github-electron/.editorconfig @@ -0,0 +1,2 @@ +[*.ts] +indent_style = tab diff --git a/github-electron/github-electron-main-tests.ts b/github-electron/github-electron-main-tests.ts new file mode 100644 index 000000000..d353dfeb3 --- /dev/null +++ b/github-electron/github-electron-main-tests.ts @@ -0,0 +1,437 @@ +/// +import app = require('app'); +import AutoUpdater = require('auto-updater'); +import BrowserWindow = require('browser-window'); +import ContentTracing = require('content-tracing'); +import Dialog = require('dialog'); +import GlobalShortcut = require('global-shortcut'); +import ipc = require('ipc'); +import Menu = require('menu'); +import MenuItem = require('menu-item'); +import PowerMonitor = require('power-monitor'); +import Protocol = require('protocol'); +import Tray = require('tray'); +import Clipboard = require('clipboard'); +import CrashReporter = require('crash-reporter'); +import NativeImage = require('native-image'); +import Screen = require('screen'); +import Shell = require('shell'); + +import path = require('path'); + +// Quick start +// https://github.com/atom/electron/blob/master/docs/tutorial/quick-start.md + +// Report crashes to our server. +require('crash-reporter').start(); + +// Keep a global reference of the window object, if you don't, the window will +// be closed automatically when the javascript object is GCed. +var mainWindow: GitHubElectron.BrowserWindow = null; + +// Quit when all windows are closed. +app.on('window-all-closed', () => { + if (process.platform !== 'darwin') + app.quit(); +}); + +// This method will be called when Electron has done everything +// initialization and ready for creating browser windows. +app.on('ready', () => { + // Create the browser window. + mainWindow = new BrowserWindow({ width: 800, height: 600 }); + + // and load the index.html of the app. + mainWindow.loadUrl(`file://${__dirname}/index.html`); + + // Emitted when the window is closed. + mainWindow.on('closed', () => { + // Dereference the window object, usually you would store windows + // in an array if your app supports multi windows, this is the time + // when you should delete the corresponding element. + mainWindow = null; + }); +}); + +// Desktop environment integration +// https://github.com/atom/electron/blob/master/docs/tutorial/desktop-environment-integration.md + +app.addRecentDocument('/Users/USERNAME/Desktop/work.type'); +app.clearRecentDocuments(); +var dockMenu = Menu.buildFromTemplate([ + { + label: 'New Window', + click: () => { + console.log('New Window'); + } + }, + { + label: 'New Window with Settings', + submenu: [ + { label: 'Basic' }, + { label: 'Pro' } + ] + }, + { label: 'New Command...' } +]); +app.dock.setMenu(dockMenu); + +app.setUserTasks([ + { + program: process.execPath, + arguments: '--new-window', + iconPath: process.execPath, + iconIndex: 0, + title: 'New Window', + description: 'Create a new window' + } +]); +app.setUserTasks([]); + +var window = new BrowserWindow(); +window.setProgressBar(0.5); +window.setRepresentedFilename('/etc/passwd'); +window.setDocumentEdited(true); + +// Online/Offline Event Detection +// https://github.com/atom/electron/blob/master/docs/tutorial/online-offline-events.md + +var onlineStatusWindow: GitHubElectron.BrowserWindow; + +app.on('ready', () => { + onlineStatusWindow = new BrowserWindow({ width: 0, height: 0, show: false }); + onlineStatusWindow.loadUrl(`file://${__dirname}/online-status.html`); +}); + +ipc.on('online-status-changed', (event: any, status: any) => { + console.log(status); +}); + +// Synopsis +// https://github.com/atom/electron/blob/master/docs/api/synopsis.md + +app.on('ready', () => { + window = new BrowserWindow({ width: 800, height: 600 }); + window.loadUrl('https://github.com'); +}); + +// Supported Chrome command line switches +// https://github.com/atom/electron/blob/master/docs/api/chrome-command-line-switches.md + +app.commandLine.appendSwitch('remote-debugging-port', '8315'); +app.commandLine.appendSwitch('host-rules', 'MAP * 127.0.0.1'); +app.commandLine.appendSwitch('v', -1); +app.commandLine.appendSwitch('vmodule', 'console=0'); + +// auto-updater +// https://github.com/atom/electron/blob/master/docs/api/auto-updater.md + +AutoUpdater.setFeedUrl('http://mycompany.com/myapp/latest?version=' + app.getVersion()); + +// browser-window +// https://github.com/atom/electron/blob/master/docs/api/browser-window.md + +var win = new BrowserWindow({ width: 800, height: 600, show: false }); +win.on('closed', () => { + win = null; +}); + +win.loadUrl('https://github.com'); +win.show(); + +// content-tracing +// https://github.com/atom/electron/blob/master/docs/api/content-tracing.md + +ContentTracing.startRecording('*', ContentTracing.DEFAULT_OPTIONS, () => { + console.log('Tracing started'); + + setTimeout(() => { + ContentTracing.stopRecording('', path => { + console.log('Tracing data recorded to ' + path); + }); + }, 5000); +}); + +// dialog +// https://github.com/atom/electron/blob/master/docs/api/dialog.md + +console.log(Dialog.showOpenDialog({ + properties: ['openFile', 'openDirectory', 'multiSelections'] +})); + +// global-shortcut +// https://github.com/atom/electron/blob/master/docs/api/global-shortcut.md + +// Register a 'ctrl+x' shortcut listener. +var ret = GlobalShortcut.register('ctrl+x', () => { + console.log('ctrl+x is pressed'); +}); +if (!ret) + console.log('registerion fails'); + +// Check whether a shortcut is registered. +console.log(GlobalShortcut.isRegistered('ctrl+x')); + +// Unregister a shortcut. +GlobalShortcut.unregister('ctrl+x'); + +// Unregister all shortcuts. +GlobalShortcut.unregisterAll(); + +// ipc +// https://github.com/atom/electron/blob/master/docs/api/ipc-main-process.md + +ipc.on('asynchronous-message', (event: any, arg: any) => { + console.log(arg); // prints "ping" + event.sender.send('asynchronous-reply', 'pong'); +}); + +ipc.on('synchronous-message', (event: any, arg: any) => { + console.log(arg); // prints "ping" + event.returnValue = 'pong'; +}); + +// menu +// https://github.com/atom/electron/blob/master/docs/api/menu.md + +var menu = new Menu(); +menu.append(new MenuItem({ label: 'MenuItem1', click: () => { console.log('item 1 clicked'); } })); +menu.append(new MenuItem({ type: 'separator' })); +menu.append(new MenuItem({ label: 'MenuItem2', type: 'checkbox', checked: true })); + +// main.js +var template = [ + { + label: 'Electron', + submenu: [ + { + label: 'About Electron', + selector: 'orderFrontStandardAboutPanel:' + }, + { + type: 'separator' + }, + { + label: 'Services', + submenu: [] + }, + { + type: 'separator' + }, + { + label: 'Hide Electron', + accelerator: 'Command+H', + selector: 'hide:' + }, + { + label: 'Hide Others', + accelerator: 'Command+Shift+H', + selector: 'hideOtherApplications:' + }, + { + label: 'Show All', + selector: 'unhideAllApplications:' + }, + { + type: 'separator' + }, + { + label: 'Quit', + accelerator: 'Command+Q', + click: () => { app.quit(); } + } + ] + }, + { + label: 'Edit', + submenu: [ + { + label: 'Undo', + accelerator: 'Command+Z', + selector: 'undo:' + }, + { + label: 'Redo', + accelerator: 'Shift+Command+Z', + selector: 'redo:' + }, + { + type: 'separator' + }, + { + label: 'Cut', + accelerator: 'Command+X', + selector: 'cut:' + }, + { + label: 'Copy', + accelerator: 'Command+C', + selector: 'copy:' + }, + { + label: 'Paste', + accelerator: 'Command+V', + selector: 'paste:' + }, + { + label: 'Select All', + accelerator: 'Command+A', + selector: 'selectAll:' + } + ] + }, + { + label: 'View', + submenu: [ + { + label: 'Reload', + accelerator: 'Command+R', + click: () => { BrowserWindow.getFocusedWindow().reloadIgnoringCache(); } + }, + { + label: 'Toggle DevTools', + accelerator: 'Alt+Command+I', + click: () => { BrowserWindow.getFocusedWindow().toggleDevTools(); } + } + ] + }, + { + label: 'Window', + submenu: [ + { + label: 'Minimize', + accelerator: 'Command+M', + selector: 'performMiniaturize:' + }, + { + label: 'Close', + accelerator: 'Command+W', + selector: 'performClose:' + }, + { + type: 'separator' + }, + { + label: 'Bring All to Front', + selector: 'arrangeInFront:' + } + ] + }, + { + label: 'Help', + submenu: [] + } +]; + +menu = Menu.buildFromTemplate(template); + +Menu.setApplicationMenu(menu); // Must be called within app.on('ready', function(){ ... }); + +Menu.buildFromTemplate([ + { label: '4', id: '4' }, + { label: '5', id: '5' }, + { label: '1', id: '1', position: 'before=4' }, + { label: '2', id: '2' }, + { label: '3', id: '3' } +]); + +Menu.buildFromTemplate([ + { label: 'a', position: 'endof=letters' }, + { label: '1', position: 'endof=numbers' }, + { label: 'b', position: 'endof=letters' }, + { label: '2', position: 'endof=numbers' }, + { label: 'c', position: 'endof=letters' }, + { label: '3', position: 'endof=numbers' } +]); + +// power-monitor +// https://github.com/atom/electron/blob/master/docs/api/power-monitor.md + +app.on('ready', () => { + PowerMonitor.on('suspend', () => { + console.log('The system is going to sleep'); + }); +}); + +// protocol +// https://github.com/atom/electron/blob/master/docs/api/protocol.md + +app.on('ready', () => { + Protocol.registerProtocol('atom', (request: any) => { + var url = request.url.substr(7); + return new Protocol.RequestFileJob(path.normalize(`${__dirname}/${url}`)); + }); +}); + +// tray +// https://github.com/atom/electron/blob/master/docs/api/tray.md + +var appIcon: GitHubElectron.Tray = null; +app.on('ready', () => { + appIcon = new Tray('/path/to/my/icon'); + var contextMenu = Menu.buildFromTemplate([ + { label: 'Item1', type: 'radio' }, + { label: 'Item2', type: 'radio' }, + { label: 'Item3', type: 'radio', checked: true }, + { label: 'Item4', type: 'radio' }, + ]); + appIcon.setToolTip('This is my application.'); + appIcon.setContextMenu(contextMenu); +}); + +// clipboard +// https://github.com/atom/electron/blob/master/docs/api/clipboard.md + +Clipboard.writeText('Example String'); +Clipboard.writeText('Example String', 'selection'); +console.log(Clipboard.readText('selection')); + +// crash-reporter +// https://github.com/atom/electron/blob/master/docs/api/crash-reporter.md + +CrashReporter.start({ + productName: 'YourName', + companyName: 'YourCompany', + submitUrl: 'https://your-domain.com/url-to-submit', + autoSubmit: true +}); + +// NativeImage +// https://github.com/atom/electron/blob/master/docs/api/native-image.md + +var appIcon2 = new Tray('/Users/somebody/images/icon.png'); +var window2 = new BrowserWindow({ icon: '/Users/somebody/images/window.png' }); +var image = Clipboard.readImage(); +var appIcon3 = new Tray(image); +var appIcon4 = new Tray('/Users/somebody/images/icon.png'); + +// screen +// https://github.com/atom/electron/blob/master/docs/api/screen.md + +app.on('ready', () => { + var size = Screen.getPrimaryDisplay().workAreaSize; + mainWindow = new BrowserWindow({ width: size.width, height: size.height }); +}); + +app.on('ready', () => { + var displays = Screen.getAllDisplays(); + var externalDisplay: any = null; + for (var i in displays) { + if (displays[i].bounds.x > 0 || displays[i].bounds.y > 0) { + externalDisplay = displays[i]; + break; + } + } + + if (externalDisplay) { + mainWindow = new BrowserWindow({ + x: externalDisplay.bounds.x + 50, + y: externalDisplay.bounds.y + 50, + }); + } +}); + +// shell +// https://github.com/atom/electron/blob/master/docs/api/shell.md + +Shell.openExternal('https://github.com'); diff --git a/github-electron/github-electron-main.d.ts b/github-electron/github-electron-main.d.ts new file mode 100644 index 000000000..0ecdbf030 --- /dev/null +++ b/github-electron/github-electron-main.d.ts @@ -0,0 +1,227 @@ +// Type definitions for the Electron 0.25.2 main process +// Project: http://electron.atom.io/ +// Definitions by: jedmao +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module 'app' { + var _app: GitHubElectron.App; + export = _app; +} + +declare module 'auto-updater' { + var _autoUpdater: GitHubElectron.AutoUpdater; + export = _autoUpdater; +} + +declare module 'browser-window' { + var BrowserWindow: typeof GitHubElectron.BrowserWindow; + export = BrowserWindow; +} + +declare module 'content-tracing' { + /** + * Get a set of category groups. The category groups can change as new code paths are reached. + * @param callback Called once all child processes have acked to the getCategories request. + */ + export function getCategories(callback: (categoryGroups: any[]) => void): void; + /** + * Start recording on all processes. Recording begins immediately locally, and asynchronously + * on child processes as soon as they receive the EnableRecording request. + * @param categoryFilter A filter to control what category groups should be traced. + * A filter can have an optional "-" prefix to exclude category groups that contain + * a matching category. Having both included and excluded category patterns in the + * same list would not be supported. + * @param options controls what kind of tracing is enabled, it could be a OR-ed + * combination of tracing.DEFAULT_OPTIONS, tracing.ENABLE_SYSTRACE, tracing.ENABLE_SAMPLING + * and tracing.RECORD_CONTINUOUSLY. + * @param callback Called once all child processes have acked to the startRecording request. + */ + export function startRecording(categoryFilter: string, options: number, callback: Function): void; + /** + * Stop recording on all processes. Child processes typically are caching trace data and + * only rarely flush and send trace data back to the main process. That is because it may + * be an expensive operation to send the trace data over IPC, and we would like to avoid + * much runtime overhead of tracing. So, to end tracing, we must asynchronously ask all + * child processes to flush any pending trace data. + * @param resultFilePath Trace data will be written into this file if it is not empty, + * or into a temporary file. + * @param callback Called once all child processes have acked to the stopRecording request. + */ + export function stopRecording(resultFilePath: string, callback: + /** + * @param filePath A file that contains the traced data. + */ + (filePath: string) => void + ): void; + /** + * Start monitoring on all processes. Monitoring begins immediately locally, and asynchronously + * on child processes as soon as they receive the startMonitoring request. + * @param callback Called once all child processes have acked to the startMonitoring request. + */ + export function startMonitoring(categoryFilter: string, options: number, callback: Function): void; + /** + * Stop monitoring on all processes. + * @param callback Called once all child processes have acked to the stopMonitoring request. + */ + export function stopMonitoring(callback: Function): void; + /** + * Get the current monitoring traced data. Child processes typically are caching trace data + * and only rarely flush and send trace data back to the main process. That is because it may + * be an expensive operation to send the trace data over IPC, and we would like to avoid much + * runtime overhead of tracing. So, to end tracing, we must asynchronously ask all child + * processes to flush any pending trace data. + * @param callback Called once all child processes have acked to the captureMonitoringSnapshot request. + */ + export function captureMonitoringSnapshot(resultFilePath: string, callback: + /** + * @param filePath A file that contains the traced data + * @returns {} + */ + (filePath: string) => void + ): void; + /** + * Get the maximum across processes of trace buffer percent full state. + * @param callback Called when the TraceBufferUsage value is determined. + */ + export function getTraceBufferUsage(callback: Function): void; + /** + * @param callback Called every time the given event occurs on any process. + */ + export function setWatchEvent(categoryName: string, eventName: string, callback: Function): void; + /** + * Cancel the watch event. If tracing is enabled, this may race with the watch event callback. + */ + export function cancelWatchEvent(): void; + export var DEFAULT_OPTIONS: number; + export var ENABLE_SYSTRACE: number; + export var ENABLE_SAMPLING: number; + export var RECORD_CONTINUOUSLY: number; +} + +declare module 'dialog' { + /** + * @param callback If supplied, the API call will be asynchronous. + * @returns On success, returns an array of file paths chosen by the user, + * otherwise returns undefined. + */ + export var showOpenDialog: typeof GitHubElectron.Dialog.showOpenDialog; + /** + * @param callback If supplied, the API call will be asynchronous. + * @returns On success, returns the path of file chosen by the user, otherwise + * returns undefined. + */ + export var showSaveDialog: typeof GitHubElectron.Dialog.showSaveDialog; + /** + * Shows a message box. It will block until the message box is closed. It returns . + * @param callback If supplied, the API call will be asynchronous. + * @returns The index of the clicked button. + */ + export var showMessageBox: typeof GitHubElectron.Dialog.showMessageBox; + + /** + * Runs a modal dialog that shows an error message. This API can be called safely + * before the ready event of app module emits, it is usually used to report errors + * in early stage of startup. + */ + export function showErrorBox(title: string, content: string): void; +} + +declare module 'global-shortcut' { + /** + * Registers a global shortcut of accelerator. + * @param accelerator Represents a keyboard shortcut. It can contain modifiers + * and key codes, combined by the "+" character. + * @param callback Called when the registered shortcut is pressed by the user. + * @returns {} + */ + export function register(accelerator: string, callback: Function): void; + /** + * @param accelerator Represents a keyboard shortcut. It can contain modifiers + * and key codes, combined by the "+" character. + * @returns Whether the accelerator is registered. + */ + export function isRegistered(accelerator: string): boolean; + /** + * Unregisters the global shortcut of keycode. + * @param accelerator Represents a keyboard shortcut. It can contain modifiers + * and key codes, combined by the "+" character. + */ + export function unregister(accelerator: string): void; + /** + * Unregisters all the global shortcuts. + */ + export function unregisterAll(): void; +} + +declare module 'ipc' { + var ipc: NodeJS.EventEmitter; + export = ipc; +} + +declare module 'menu' { + var Menu: typeof GitHubElectron.Menu; + export = Menu; +} + +declare module 'menu-item' { + var MenuItem: typeof GitHubElectron.MenuItem; + export = MenuItem; +} + +declare module 'power-monitor' { + var powerMonitor: NodeJS.EventEmitter; + export = powerMonitor; +} + +declare module 'protocol' { + export function registerProtocol(scheme: string, handler: (request: any) => void): void; + export function unregisterProtocol(scheme: string): void; + export function isHandledProtocol(scheme: string): boolean; + export function interceptProtocol(scheme: string, handler: (request: any) => void): void; + export function uninterceptProtocol(scheme: string): void; + export class RequestFileJob { + /** + * Create a request job which would query a file of path and set corresponding mime types. + */ + constructor(path: string); + } + export class RequestStringJob { + /** + * Create a request job which sends a string as response. + */ + constructor(options?: { + /** + * Default is "text/plain". + */ + mimeType?: string; + /** + * Default is "UTF-8". + */ + charset?: string; + data?: string; + }); + } + export class RequestBufferJob { + /** + * Create a request job which accepts a buffer and sends a string as response. + */ + constructor(options?: { + /** + * Default is "application/octet-stream". + */ + mimeType?: string; + /** + * Default is "UTF-8". + */ + encoding?: string; + data?: Buffer; + }); + } +} + +declare module 'tray' { + var Tray: typeof GitHubElectron.Tray; + export = Tray; +} diff --git a/github-electron/github-electron-renderer-tests.ts b/github-electron/github-electron-renderer-tests.ts new file mode 100644 index 000000000..4c940b651 --- /dev/null +++ b/github-electron/github-electron-renderer-tests.ts @@ -0,0 +1,116 @@ +/// +import ipc = require('ipc'); +import remote = require('remote'); +import WebFrame = require('web-frame'); +import Clipboard = require('clipboard'); +import CrashReporter = require('crash-reporter'); +import NativeImage = require('native-image'); +import Screen = require('screen'); +import Shell = require('shell'); + +import fs = require('fs'); + +// In renderer process (web page). +// https://github.com/atom/electron/blob/master/docs/api/ipc-renderer.md +console.log(ipc.sendSync('synchronous-message', 'ping')); // prints "pong" + +ipc.on('asynchronous-reply', (arg: any) => { + console.log(arg); // prints "pong" +}); +ipc.send('asynchronous-message', 'ping'); + +// remote +// https://github.com/atom/electron/blob/master/docs/api/remote.md + +var BrowserWindow: typeof GitHubElectron.BrowserWindow = remote.require('browser-window'); +var win = new BrowserWindow({ width: 800, height: 600 }); +win.loadUrl('https://github.com'); + +remote.getCurrentWindow().on('close', () => { + // blabla... +}); + +remote.getCurrentWindow().capturePage(buf => { + fs.writeFile('/tmp/screenshot.png', buf, err => { + console.log(err); + }); +}); + +remote.getCurrentWindow().capturePage(buf => { + remote.require('fs').writeFile('/tmp/screenshot.png', buf, (err: Error) => { + console.log(err); + }); +}); + +// web-frame +// https://github.com/atom/electron/blob/master/docs/api/web-frame.md + +WebFrame.setZoomFactor(2); + +WebFrame.setSpellCheckProvider('en-US', true, { + spellCheck: text => { + return !(require('spellchecker').isMisspelled(text)); + } +}); + +// clipboard +// https://github.com/atom/electron/blob/master/docs/api/clipboard.md + +Clipboard.writeText('Example String'); +Clipboard.writeText('Example String', 'selection'); +console.log(Clipboard.readText('selection')); + +// crash-reporter +// https://github.com/atom/electron/blob/master/docs/api/crash-reporter.md + +CrashReporter.start({ + productName: 'YourName', + companyName: 'YourCompany', + submitUrl: 'https://your-domain.com/url-to-submit', + autoSubmit: true +}); + +// NativeImage +// https://github.com/atom/electron/blob/master/docs/api/native-image.md + +var Tray: typeof GitHubElectron.Tray = remote.require('Tray'); +var appIcon2 = new Tray('/Users/somebody/images/icon.png'); +var window2 = new BrowserWindow({ icon: '/Users/somebody/images/window.png' }); +var image = Clipboard.readImage(); +var appIcon3 = new Tray(image); +var appIcon4 = new Tray('/Users/somebody/images/icon.png'); + +// screen +// https://github.com/atom/electron/blob/master/docs/api/screen.md + +var app: GitHubElectron.App = remote.require('app'); + +var mainWindow: GitHubElectron.BrowserWindow = null; + +app.on('ready', () => { + var size = Screen.getPrimaryDisplay().workAreaSize; + mainWindow = new BrowserWindow({ width: size.width, height: size.height }); +}); + +app.on('ready', () => { + var displays = Screen.getAllDisplays(); + var externalDisplay: any = null; + for (var i in displays) { + if (displays[i].bounds.x > 0 || displays[i].bounds.y > 0) { + externalDisplay = displays[i]; + break; + } + } + + if (externalDisplay) { + mainWindow = new BrowserWindow({ + x: externalDisplay.bounds.x + 50, + y: externalDisplay.bounds.y + 50, + }); + } +}); + +// shell +// https://github.com/atom/electron/blob/master/docs/api/shell.md + +Shell.openExternal('https://github.com'); diff --git a/github-electron/github-electron-renderer.d.ts b/github-electron/github-electron-renderer.d.ts new file mode 100644 index 000000000..e2a310d28 --- /dev/null +++ b/github-electron/github-electron-renderer.d.ts @@ -0,0 +1,105 @@ +// Type definitions for the Electron 0.25.2 renderer process (web page) +// Project: http://electron.atom.io/ +// Definitions by: jedmao +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module GitHubElectron { + + class InProcess implements NodeJS.EventEmitter { + addListener(event: string, listener: Function): InProcess; + on(event: string, listener: Function): InProcess; + once(event: string, listener: Function): InProcess; + removeListener(event: string, listener: Function): InProcess; + removeAllListeners(event?: string): InProcess; + setMaxListeners(n: number): void; + listeners(event: string): Function[]; + emit(event: string, ...args: any[]): boolean; + /** + * Send ...args to the renderer via channel in asynchronous message, the main + * process can handle it by listening to the channel event of ipc module. + */ + send(channel: string, ...args: any[]): void; + /** + * Send ...args to the renderer via channel in synchronous message, and returns + * the result sent from main process. The main process can handle it by listening + * to the channel event of ipc module, and returns by setting event.returnValue. + * Note: Usually developers should never use this API, since sending synchronous + * message would block the whole renderer process. + * @returns The result sent from the main process. + */ + sendSync(channel: string, ...args: any[]): string; + /** + * Like ipc.send but the message will be sent to the host page instead of the main process. + * This is mainly used by the page in to communicate with host page. + */ + sendToHost(channel: string, ...args: any[]): void; + } + + module Remote { + export function getCurrentWindow(): BrowserWindow; + } +} + +declare module 'ipc' { + var InProcess: GitHubElectron.InProcess; + export = InProcess; +} + +declare module 'remote' { + /** + * @returns The object returned by require(module) in the main process. + */ + export function require(module: string): any; + /** + * @returns The BrowserWindow object which this web page belongs to. + */ + export var getCurrentWindow: typeof GitHubElectron.Remote.getCurrentWindow; + /** + * @returns The global variable of name (e.g. global[name]) in the main process. + */ + export function getGlobal(name: string): any; + /** + * Returns the process object in the main process. This is the same as + * remote.getGlobal('process'), but gets cached. + */ + export var process: any; +} + +declare module 'web-frame' { + /** + * Changes the zoom factor to the specified factor, zoom factor is + * zoom percent / 100, so 300% = 3.0. + */ + export function setZoomFactor(factor: number): void; + /** + * @returns The current zoom factor. + */ + export function getZoomFactor(): number; + /** + * Changes the zoom level to the specified level, 0 is "original size", and each + * increment above or below represents zooming 20% larger or smaller to default + * limits of 300% and 50% of original size, respectively. + */ + export function setZoomLevel(level: number): void; + /** + * @returns The current zoom level. + */ + export function getZoomLevel(): number; + /** + * Sets a provider for spell checking in input fields and text areas. + */ + export function setSpellCheckProvider(language: string, autoCorrectWord: boolean, provider: { + /** + * @returns Whether the word passed is correctly spelled. + */ + spellCheck: (text: string) => boolean; + }): void; + /** + * Sets the scheme as secure scheme. Secure schemes do not trigger mixed content + * warnings. For example, https and data are secure schemes because they cannot be + * corrupted by active network attackers. + */ + export function registerUrlSchemeAsSecure(scheme: string): void; +} diff --git a/github-electron/github-electron.d.ts b/github-electron/github-electron.d.ts new file mode 100644 index 000000000..4e1e289ca --- /dev/null +++ b/github-electron/github-electron.d.ts @@ -0,0 +1,1295 @@ +// Type definitions for Electron 0.25.2 (shared between main and rederer processes) +// Project: http://electron.atom.io/ +// Definitions by: jedmao +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module GitHubElectron { + /** + * This class is used to represent an image. + */ + class NativeImage { + /** + * Creates an empty NativeImage instance. + */ + static createEmpty(): NativeImage; + /** + * Creates a new NativeImage instance from file located at path. + */ + static createFromPath(path: string): NativeImage; + /** + * Creates a new NativeImage instance from buffer. + * @param scaleFactor 1.0 by default. + */ + static createFromBuffer(buffer: Buffer, scaleFactor?: number): NativeImage; + /** + * Creates a new NativeImage instance from dataUrl + */ + static createFromDataUrl(dataUrl: string): NativeImage; + /** + * @returns Buffer Contains the image's PNG encoded data. + */ + toPng(): Buffer; + /** + * @returns Buffer Contains the image's JPEG encoded data. + */ + toJpeg(quality: number): Buffer; + /** + * @returns string The data URL of the image. + */ + toDataUrl(): string; + /** + * @returns boolean Whether the image is empty. + */ + isEmpty(): boolean; + /** + * @returns {} The size of the image. + */ + getSize(): any; + /** + * Marks the image as template image. + */ + setTemplateImage(option: boolean): void; + } + + module Clipboard { + /** + * @returns The contents of the clipboard as a NativeImage. + */ + function readImage(type?: string): NativeImage; + /** + * Writes the image into the clipboard. + */ + function writeImage(image: NativeImage, type?: string): void; + } + + class Screen implements NodeJS.EventEmitter { + addListener(event: string, listener: Function): Screen; + on(event: string, listener: Function): Screen; + once(event: string, listener: Function): Screen; + removeListener(event: string, listener: Function): Screen; + removeAllListeners(event?: string): Screen; + setMaxListeners(n: number): void; + listeners(event: string): Function[]; + emit(event: string, ...args: any[]): boolean; + /** + * @returns The current absolute position of the mouse pointer. + */ + getCursorScreenPoint(): any; + /** + * @returns The primary display. + */ + getPrimaryDisplay(): any; + /** + * @returns An array of displays that are currently available. + */ + getAllDisplays(): any[]; + /** + * @returns The display nearest the specified point. + */ + getDisplayNearestPoint(point: { + x: number; + y: number; + }): any; + /** + * @returns The display that most closely intersects the provided bounds. + */ + getDisplayMatching(rect: Rectangle): any; + } + + /** + * The BrowserWindow class gives you ability to create a browser window. + * You can also create a window without chrome by using Frameless Window API. + */ + class BrowserWindow implements NodeJS.EventEmitter { + addListener(event: string, listener: Function): WebContents; + on(event: string, listener: Function): WebContents; + once(event: string, listener: Function): WebContents; + removeListener(event: string, listener: Function): WebContents; + removeAllListeners(event?: string): WebContents; + setMaxListeners(n: number): void; + listeners(event: string): Function[]; + emit(event: string, ...args: any[]): boolean; + constructor(options?: BrowserWindowOptions); + /** + * @returns All opened browser windows. + */ + static getAllWindows(): BrowserWindow[]; + /** + * @returns The window that is focused in this application. + */ + static getFocusedWindow(): BrowserWindow; + /** + * Find a window according to the webContents it owns. + */ + static fromWebContents(webContents: WebContents): BrowserWindow; + /** + * Find a window according to its ID. + */ + static fromId(id: number): BrowserWindow; + /** + * Adds devtools extension located at path. The extension will be remembered + * so you only need to call this API once, this API is not for programming use. + * @returns The extension's name. + */ + static addDevToolsExtension(path: string): string; + /** + * Remove a devtools extension. + * @param name The name of the devtools extension to remove. + */ + static removeDevToolsExtension(name: string): void; + /** + * The WebContents object this window owns, all web page related events and + * operations would be done via it. + * Note: Users should never store this object because it may become null when + * the renderer process (web page) has crashed. + */ + webContents: WebContents; + /** + * Get the WebContents of devtools of this window. + * Note: Users should never store this object because it may become null when + * the devtools has been closed. + */ + devToolsWebContents: WebContents; + /** + * Get the unique ID of this window. + */ + id: number; + /** + * Force closing the window, the unload and beforeunload event won't be emitted + * for the web page, and close event would also not be emitted for this window, + * but it would guarantee the closed event to be emitted. + * You should only use this method when the renderer process (web page) has crashed. + */ + destroy(): void; + /** + * Try to close the window, this has the same effect with user manually clicking + * the close button of the window. The web page may cancel the close though, + * see the close event. + */ + close(): void; + /** + * Focus on the window. + */ + focus(): void; + /** + * @returns Whether the window is focused. + */ + isFocused(): boolean; + /** + * Shows and gives focus to the window. + */ + show(): void; + /** + * Shows the window but doesn't focus on it. + */ + showInactive(): void; + /** + * Hides the window. + */ + hide(): void; + /** + * @returns Whether the window is visible to the user. + */ + isVisible(): boolean; + /** + * Maximizes the window. + */ + maximize(): void; + /** + * Unmaximizes the window. + */ + unmaximize(): void; + /** + * @returns Whether the window is maximized. + */ + isMaximized(): boolean; + /** + * Minimizes the window. On some platforms the minimized window will be + * shown in the Dock. + */ + minimize(): void; + /** + * Restores the window from minimized state to its previous state. + */ + restore(): void; + /** + * @returns Whether the window is minimized. + */ + isMinimized(): boolean; + /** + * Sets whether the window should be in fullscreen mode. + */ + setFullScreen(flag: boolean): void; + /** + * @returns Whether the window is in fullscreen mode. + */ + isFullScreen(): boolean; + /** + * Resizes and moves the window to width, height, x, y. + */ + setBounds(options: Rectangle): void; + /** + * @returns The window's width, height, x and y values. + */ + getBounds(): Rectangle; + /** + * Resizes the window to width and height. + */ + setSize(width: number, height: number): void; + /** + * @returns The window's width and height. + */ + getSize(): number[]; + /** + * Resizes the window's client area (e.g. the web page) to width and height. + */ + setContentSize(width: number, height: number): void; + /** + * @returns The window's client area's width and height. + */ + getContentSize(): number[]; + /** + * Sets the minimum size of window to width and height. + */ + setMinimumSize(width: number, height: number): void; + /** + * @returns The window's minimum width and height. + */ + getMinimumSize(): number[]; + /** + * Sets the maximum size of window to width and height. + */ + setMaximumSize(width: number, height: number): void; + /** + * @returns The window's maximum width and height. + */ + getMaximumSize(): number[]; + /** + * Sets whether the window can be manually resized by user. + */ + setResizable(resizable: boolean): void; + /** + * @returns Whether the window can be manually resized by user. + */ + isResizable(): boolean; + /** + * Sets whether the window should show always on top of other windows. After + * setting this, the window is still a normal window, not a toolbox window + * which can not be focused on. + */ + setAlwaysOnTop(flag: boolean): void; + /** + * @returns Whether the window is always on top of other windows. + */ + isAlwaysOnTop(): boolean; + /** + * Moves window to the center of the screen. + */ + center(): void; + /** + * Moves window to x and y. + */ + setPosition(x: number, y: number): void; + /** + * @returns The window's current position. + */ + getPosition(): number[]; + /** + * Changes the title of native window to title. + */ + setTitle(title: string): void; + /** + * Note: The title of web page can be different from the title of the native window. + * @returns The title of the native window. + */ + getTitle(): string; + /** + * Starts or stops flashing the window to attract user's attention. + */ + flashFrame(flag: boolean): void; + /** + * Makes the window do not show in Taskbar. + */ + setSkipTaskbar(skip: boolean): void; + /** + * Enters or leaves the kiosk mode. + */ + setKiosk(flag: boolean): void; + /** + * @returns Whether the window is in kiosk mode. + */ + isKiosk(): boolean; + /** + * Sets the pathname of the file the window represents, and the icon of the + * file will show in window's title bar. + * Note: This API is available only on OS X. + */ + setRepresentedFilename(filename: string): void; + /** + * Note: This API is available only on OS X. + * @returns The pathname of the file the window represents. + */ + getRepresentedFilename(): string; + /** + * Specifies whether the window’s document has been edited, and the icon in + * title bar will become grey when set to true. + * Note: This API is available only on OS X. + */ + setDocumentEdited(edited: boolean): void; + /** + * Note: This API is available only on OS X. + * @returns Whether the window's document has been edited. + */ + isDocumentEdited(): boolean; + /** + * Opens the developer tools. + */ + openDevTools(options?: { + /** + * Opens devtools in a new window. + */ + detach?: boolean; + }): void; + /** + * Closes the developer tools. + */ + closeDevTools(): void; + /** + * Toggle the developer tools. + */ + toggleDevTools(): void; + reloadIgnoringCache(): void; + /** + * Starts inspecting element at position (x, y). + */ + inspectElement(x: number, y: number): void; + focusOnWebView(): void; + blurWebView(): void; + /** + * Captures the snapshot of page within rect, upon completion the callback + * will be called. Omitting the rect would capture the whole visible page. + * Note: Be sure to read documents on remote buffer in remote if you are going + * to use this API in renderer process. + * @param callback Supplies the image that stores data of the snapshot. + */ + capturePage(rect: Rectangle, callback: (image: NativeImage) => void): void; + capturePage(callback: (image: NativeImage) => void): void; + /** + * Prints the window's web page. Calling window.print() in a web page is + * equivalent to calling BrowserWindow.print({silent: false, printBackground: false}). + */ + print(options?: { + /** + * When false, Electron will pick up system's default printer and default + * settings for printing. + */ + silent?: boolean; + printBackground?: boolean; + }): void; + /** + * Same with webContents.loadUrl(url). + */ + loadUrl(url: string): void; + /** + * Same with webContents.reload. + */ + reload(): void; + /** + * Sets the menu as the window top menu. + * Note: This API is not available on OS X. + */ + setMenu(menu: Menu): void; + /** + * Sets the progress value in the progress bar. + * On Linux platform, only supports Unity desktop environment, you need to + * specify the *.desktop file name to desktopName field in package.json. + * By default, it will assume app.getName().desktop. + * @param progress Valid range is [0, 1.0]. If < 0, the progress bar is removed. + * If greater than 0, it becomes indeterminate. + */ + setProgressBar(progress: number): void; + /** + * Sets a 16px overlay onto the current Taskbar icon, usually used to convey + * some sort of application status or to passively notify the user. + * Note: This API is only available on Windows 7 or above. + * @param overlay The icon to display on the bottom right corner of the Taskbar + * icon. If this parameter is null, the overlay is cleared + * @param description Provided to Accessibility screen readers. + */ + setOverlayIcon(overlay: NativeImage, description: string): void; + /** + * Shows pop-up dictionary that searches the selected word on the page. + * Note: This API is available only on OS X. + */ + showDefinitionForSelection(): void; + /** + * Sets whether the window menu bar should hide itself automatically. Once set + * the menu bar will only show when users press the single Alt key. + * If the menu bar is already visible, calling setAutoHideMenuBar(true) won't + * hide it immediately. + */ + setAutoHideMenuBar(hide: boolean): void; + /** + * @returns Whether menu bar automatically hides itself. + */ + isMenuBarAutoHide(): boolean; + /** + * Sets whether the menu bar should be visible. If the menu bar is auto-hide, + * users can still bring up the menu bar by pressing the single Alt key. + */ + setMenuBarVisibility(visibile: boolean): void; + /** + * @returns Whether the menu bar is visible. + */ + isMenuBarVisible(): boolean; + /** + * Sets whether the window should be visible on all workspaces. + * Note: This API does nothing on Windows. + */ + setVisibleOnAllWorkspaces(visible: boolean): void; + /** + * Note: This API always returns false on Windows. + * @returns Whether the window is visible on all workspaces. + */ + isVisibleOnAllWorkspaces(): boolean; + } + + interface BrowserWindowOptions extends Rectangle { + show?: boolean; + } + + interface Rectangle { + x?: number; + y?: number; + width?: number; + height?: number; + } + + /** + * A WebContents is responsible for rendering and controlling a web page. + */ + class WebContents implements NodeJS.EventEmitter { + addListener(event: string, listener: Function): WebContents; + on(event: string, listener: Function): WebContents; + once(event: string, listener: Function): WebContents; + removeListener(event: string, listener: Function): WebContents; + removeAllListeners(event?: string): WebContents; + setMaxListeners(n: number): void; + listeners(event: string): Function[]; + emit(event: string, ...args: any[]): boolean; + /** + * Loads the url in the window. + * @param url Must contain the protocol prefix (e.g., the http:// or file://). + */ + loadUrl(url: string): void; + /** + * @returns The URL of current web page. + */ + getUrl(): string; + /** + * @returns The title of web page. + */ + getTitle(): string; + /** + * @returns The favicon of the web page. + */ + getFavicon(): NativeImage; + /** + * @returns Whether web page is still loading resources. + */ + isLoading(): boolean; + /** + * @returns Whether web page is waiting for a first-response for the main + * resource of the page. + */ + isWaitingForResponse(): boolean; + /** + * Stops any pending navigation. + */ + stop(): void; + /** + * Reloads current page. + */ + reload(): void; + /** + * Reloads current page and ignores cache. + */ + reloadIgnoringCache(): void; + /** + * @returns Whether the web page can go back. + */ + canGoBack(): boolean; + /** + * @returns Whether the web page can go forward. + */ + canGoForward(): boolean; + /** + * @returns Whether the web page can go to offset. + */ + canGoToOffset(offset: number): boolean; + /** + * Makes the web page go back. + */ + goBack(): void; + /** + * Makes the web page go forward. + */ + goForward(): void; + /** + * Navigates to the specified absolute index. + */ + goToIndex(index: number): void; + /** + * Navigates to the specified offset from the "current entry". + */ + goToOffset(offset: number): void; + /** + * @returns Whether the renderer process has crashed. + */ + isCrashed(): boolean; + /** + * Overrides the user agent for this page. + */ + setUserAgent(userAgent: string): void; + /** + * Injects CSS into this page. + */ + insertCSS(css: string): void; + /** + * Evaluates code in page. + * @param code Code to evaluate. + */ + executeJavaScript(code: string): void; + /** + * Executes Edit -> Undo command in page. + */ + undo(): void; + /** + * Executes Edit -> Redo command in page. + */ + redo(): void; + /** + * Executes Edit -> Cut command in page. + */ + cut(): void; + /** + * Executes Edit -> Copy command in page. + */ + copy(): void; + /** + * Executes Edit -> Paste command in page. + */ + paste(): void; + /** + * Executes Edit -> Delete command in page. + */ + delete(): void; + /** + * Executes Edit -> Select All command in page. + */ + selectAll(): void; + /** + * Executes Edit -> Unselect command in page. + */ + unselect(): void; + /** + * Executes Edit -> Replace command in page. + */ + replace(text: string): void; + /** + * Executes Edit -> Replace Misspelling command in page. + */ + replaceMisspelling(text: string): void; + /** + * Checks if any serviceworker is registered. + */ + hasServiceWorker(callback: (hasServiceWorker: boolean) => void): void; + /** + * Unregisters any serviceworker if present. + */ + unregisterServiceWorker(callback: + /** + * @param isFulfilled Whether the JS promise is fulfilled. + */ + (isFulfilled: boolean) => void): void; + /** + * Send args.. to the web page via channel in asynchronous message, the web page + * can handle it by listening to the channel event of ipc module. + * Note: + * 1. The IPC message handler in web pages do not have a event parameter, + * which is different from the handlers on the main process. + * 2. There is no way to send synchronous messages from the main process + * to a renderer process, because it would be very easy to cause dead locks. + */ + send(channel: string, ...args: any[]): void; + } + + /** + * The Menu class is used to create native menus that can be used as application + * menus and context menus. Each menu consists of multiple menu items, and each + * menu item can have a submenu. + */ + class Menu { + /** + * Creates a new menu. + */ + constructor(); + /** + * Sets menu as the application menu on OS X. On Windows and Linux, the menu + * will be set as each window's top menu. + */ + static setApplicationMenu(menu: Menu): void; + /** + * Sends the action to the first responder of application, this is used for + * emulating default Cocoa menu behaviors, usually you would just use the + * selector property of MenuItem. + * + * Note: This method is OS X only. + */ + static sendActionToFirstResponder(action: string): void; + /** + * @param template Generally, just an array of options for constructing MenuItem. + * You can also attach other fields to element of the template, and they will + * become properties of the constructed menu items. + */ + static buildFromTemplate(template: MenuItemOptions[]): Menu; + /** + * Popups this menu as a context menu in the browserWindow. You can optionally + * provide a (x,y) coordinate to place the menu at, otherwise it will be placed + * at the current mouse cursor position. + * @param x Horizontal coordinate where the menu will be placed. + * @param y Vertical coordinate where the menu will be placed. + */ + popup(browserWindow: BrowserWindow, x?: number, y?: number): void; + /** + * Appends the menuItem to the menu. + */ + append(menuItem: MenuItem): void; + /** + * Inserts the menuItem to the pos position of the menu. + */ + insert(position: number, menuItem: MenuItem): void; + items: MenuItem[]; + } + + class MenuItem { + constructor(options?: MenuItemOptions); + options: MenuItemOptions; + } + + interface MenuItemOptions { + /** + * Callback when the menu item is clicked. + */ + click?: Function; + /** + * Call the selector of first responder when clicked (OS X only). + */ + selector?: string; + /** + * Can be normal, separator, submenu, checkbox or radio. + */ + type?: string; + label?: string; + sublabel?: string; + /** + * An accelerator is string that represents a keyboard shortcut, it can contain + * multiple modifiers and key codes, combined by the + character. + * + * Examples: + * Command+A + * Ctrl+Shift+Z + * + * Platform notice: On Linux and Windows, the Command key would not have any effect, + * you can use CommandOrControl which represents Command on OS X and Control on + * Linux and Windows to define some accelerators. + * + * Available modifiers: + * Command (or Cmd for short) + * Control (or Ctrl for short) + * CommandOrControl (or CmdOrCtrl for short) + * Alt + * Shift + * + * Available key codes: + * 0 to 9 + * A to Z + * F1 to F24 + * Punctuations like ~, !, @, #, $, etc. + * Plus + * Space + * Backspace + * Delete + * Insert + * Return (or Enter as alias) + * Up, Down, Left and Right + * Home and End + * PageUp and PageDown + * Escape (or Esc for short) + * VolumeUp, VolumeDown and VolumeMute + * MediaNextTrack, MediaPreviousTrack, MediaStop and MediaPlayPause + */ + accelerator?: string; + /** + * In Electron for the APIs that take images, you can pass either file paths + * or NativeImage instances. When passing null, an empty image will be used. + */ + icon?: NativeImage|string; + enabled?: boolean; + visible?: boolean; + checked?: boolean; + /** + * Should be specified for submenu type menu item, when it's specified the + * type: 'submenu' can be omitted for the menu item + */ + submenu?: MenuItemOptions[]; + /** + * Unique within a single menu. If defined then it can be used as a reference + * to this item by the position attribute. + */ + id?: string; + /** + * This field allows fine-grained definition of the specific location within + * a given menu. + */ + position?: string; + } + + class BrowserWindowProxy { + /** + * Removes focus from the child window. + */ + blur(): void; + /** + * Forcefully closes the child window without calling its unload event. + */ + close(): void; + /** + * Set to true after the child window gets closed. + */ + closed: boolean; + /** + * Evaluates the code in the child window. + */ + eval(code: string): void; + /** + * Focuses the child window (brings the window to front). + */ + focus(): void; + /** + * Sends a message to the child window with the specified origin or * for no origin preference. + * In addition to these methods, the child window implements window.opener object with no + * properties and a single method. + */ + postMessage(message: string, targetOrigin: string): void; + } + + class App implements NodeJS.EventEmitter { + addListener(event: string, listener: Function): App; + on(event: string, listener: Function): App; + once(event: string, listener: Function): App; + removeListener(event: string, listener: Function): App; + removeAllListeners(event?: string): App; + setMaxListeners(n: number): void; + listeners(event: string): Function[]; + emit(event: string, ...args: any[]): boolean; + /** + * Try to close all windows. The before-quit event will first be emitted. + * If all windows are successfully closed, the will-quit event will be emitted + * and by default the application would be terminated. + * + * This method guarantees all beforeunload and unload handlers are correctly + * executed. It is possible that a window cancels the quitting by returning + * false in beforeunload handler. + */ + quit(): void; + /** + * Quit the application directly, it will not try to close all windows so + * cleanup code will not run. + */ + terminate(): void; + /** + * @param name One of: home, appData, userData, cache, userCache, temp, userDesktop, exe, module + * @returns The path to a special directory or file associated with name. + * On failure an Error would throw. + */ + getPath(name: string): string; + /** + * Overrides the path to a special directory or file associated with name. + * If the path specifies a directory that does not exist, the directory will + * be created by this method. On failure an Error would throw. + * + * You can only override paths of names defined in app.getPath. + * + * By default web pages' cookies and caches will be stored under userData + * directory, if you want to change this location, you have to override the + * userData path before the ready event of app module gets emitted. + */ + setPath(name: string, path: string): void; + /** + * @returns The version of loaded application, if no version is found in + * application's package.json, the version of current bundle or executable. + */ + getVersion(): string; + /** + * + * @returns The current application's name, the name in package.json would be used. + * Usually the name field of package.json is a short lowercased name, according to + * the spec of npm modules. So usually you should also specify a productName field, + * which is your application's full capitalized name, and it will be preferred over + * name by Electron. + */ + getName(): string; + /** + * Resolves the proxy information for url, the callback would be called with + * callback(proxy) when the request is done. + */ + resolveProxy(url: string, callback: Function): void; + /** + * Adds path to recent documents list. + * + * This list is managed by the system, on Windows you can visit the list from + * task bar, and on Mac you can visit it from dock menu. + */ + addRecentDocument(path: string): void; + /** + * Clears the recent documents list. + */ + clearRecentDocuments(): void; + /** + * Adds tasks to the Tasks category of JumpList on Windows. + * + * Note: This API is only available on Windows. + */ + setUserTasks(tasks: Task[]): void; + dock: BrowserWindow; + commandLine: CommandLine; + } + + interface CommandLine { + /** + * Append a switch [with optional value] to Chromium's command line. + * + * Note: This will not affect process.argv, and is mainly used by developers + * to control some low-level Chromium behaviors. + */ + appendSwitch(_switch: string, value?: string|number): void; + /** + * Append an argument to Chromium's command line. The argument will quoted properly. + * + * Note: This will not affect process.argv. + */ + appendArgument(value: any): void; + } + + interface Task { + /** + * Path of the program to execute, usually you should specify process.execPath + * which opens current program. + */ + program: string; + /** + * The arguments of command line when program is executed. + */ + arguments: string; + /** + * The string to be displayed in a JumpList. + */ + title: string; + /** + * Description of this task. + */ + description: string; + /** + * The absolute path to an icon to be displayed in a JumpList, it can be + * arbitrary resource file that contains an icon, usually you can specify + * process.execPath to show the icon of the program. + */ + iconPath: string; + /** + * The icon index in the icon file. If an icon file consists of two or more + * icons, set this value to identify the icon. If an icon file consists of + * one icon, this value is 0. + */ + iconIndex: number; + commandLine: CommandLine; + dock: { + /** + * When critical is passed, the dock icon will bounce until either the + * application becomes active or the request is canceled. + * + * When informational is passed, the dock icon will bounce for one second. + * The request, though, remains active until either the application becomes + * active or the request is canceled. + * + * Note: This API is only available on Mac. + * @param type Can be critical or informational, the default is informational. + * @returns An ID representing the request + */ + bounce(type?: string): any; + /** + * Cancel the bounce of id. + * + * Note: This API is only available on Mac. + */ + cancelBounce(id: number): void; + /** + * Sets the string to be displayed in the dock’s badging area. + * + * Note: This API is only available on Mac. + */ + setBadge(text: string): void; + /** + * Returns the badge string of the dock. + * + * Note: This API is only available on Mac. + */ + getBadge(): string; + /** + * Hides the dock icon. + * + * Note: This API is only available on Mac. + */ + hide(): void; + /** + * Shows the dock icon. + * + * Note: This API is only available on Mac. + */ + show(): void; + /** + * Sets the application dock menu. + * + * Note: This API is only available on Mac. + */ + setMenu(menu: Menu): void; + } + } + + class AutoUpdater implements NodeJS.EventEmitter { + addListener(event: string, listener: Function): AutoUpdater; + on(event: string, listener: Function): AutoUpdater; + once(event: string, listener: Function): AutoUpdater; + removeListener(event: string, listener: Function): AutoUpdater; + removeAllListeners(event?: string): AutoUpdater; + setMaxListeners(n: number): void; + listeners(event: string): Function[]; + emit(event: string, ...args: any[]): boolean; + /** + * Set the url and initialize the auto updater. + * The url cannot be changed once it is set. + */ + setFeedUrl(url: string): void; + /** + * Ask the server whether there is an update, you have to call setFeedUrl + * before using this API + */ + checkForUpdates(): any; + } + + module Dialog { + /** + * @param callback If supplied, the API call will be asynchronous. + * @returns On success, returns an array of file paths chosen by the user, + * otherwise returns undefined. + */ + export function showOpenDialog( + browserWindow?: BrowserWindow, + options?: OpenDialogOptions, + callback?: (fileNames: string[]) => void + ): void; + export function showOpenDialog( + options?: OpenDialogOptions, + callback?: (fileNames: string[]) => void + ): void; + + interface OpenDialogOptions { + title?: string; + defaultPath?: string; + /** + * File types that can be displayed or selected. + */ + filters?: { + name: string; + extensions: string[]; + }[]; + /** + * Contains which features the dialog should use, can contain openFile, + * openDirectory, multiSelections and createDirectory + */ + properties?: string|string[]; + } + + /** + * @param browserWindow + * @param options + * @param callback If supplied, the API call will be asynchronous. + * @returns On success, returns the path of file chosen by the user, otherwise + * returns undefined. + */ + export function showSaveDialog(browserWindow?: BrowserWindow, options?: { + title?: string; + defaultPath?: string; + /** + * File types that can be displayed, see dialog.showOpenDialog for an example. + */ + filters?: string[]; + }, callback?: (fileName: string) => void): void; + + /** + * Shows a message box. It will block until the message box is closed. It returns . + * @param callback If supplied, the API call will be asynchronous. + * @returns The index of the clicked button. + */ + export function showMessageBox( + browserWindow?: BrowserWindow, + options?: ShowMessageBoxOptions, + callback?: (response: any) => void + ): number; + export function showMessageBox( + options: ShowMessageBoxOptions, + callback?: (response: any) => void + ): number; + + export interface ShowMessageBoxOptions { + /** + * Can be "none", "info" or "warning". + */ + type?: string; + /** + * Texts for buttons. + */ + buttons?: string[]; + /** + * Title of the message box (some platforms will not show it). + */ + title?: string; + /** + * Contents of the message box. + */ + message?: string; + /** + * Extra information of the message. + */ + detail?: string; + icon?: NativeImage; + } + } + + class Tray implements NodeJS.EventEmitter { + addListener(event: string, listener: Function): Tray; + on(event: string, listener: Function): Tray; + once(event: string, listener: Function): Tray; + removeListener(event: string, listener: Function): Tray; + removeAllListeners(event?: string): Tray; + setMaxListeners(n: number): void; + listeners(event: string): Function[]; + emit(event: string, ...args: any[]): boolean; + /** + * Creates a new tray icon associated with the image. + */ + constructor(image: NativeImage|string); + /** + * Destroys the tray icon immediately. + */ + destroy(): void; + /** + * Sets the image associated with this tray icon. + */ + setImage(image: NativeImage): void; + /** + * Sets the image associated with this tray icon when pressed. + */ + setPressedImage(image: NativeImage): void; + /** + * Sets the hover text for this tray icon. + */ + setToolTip(toolTip: string): void; + /** + * Sets the title displayed aside of the tray icon in the status bar. + * Note: This is only implemented on OS X. + */ + setTitle(title: string): void; + /** + * Sets whether the tray icon is highlighted when it is clicked. + * Note: This is only implemented on OS X. + */ + setHighlightMode(highlight: boolean): void; + /** + * Displays a tray balloon. + * Note: This is only implemented on Windows. + */ + displayBalloon(options?: { + icon?: NativeImage; + title?: string; + content?: string; + }): void; + /** + * Sets the context menu for this icon. + */ + setContextMenu(menu: Menu): void; + } +} + +declare module 'clipboard' { + /** + * @returns The contents of the clipboard as plain text. + */ + export function readText(type?: string): string; + /** + * Writes the text into the clipboard as plain text. + */ + export function writeText(text: string, type?: string): void; + /** + * @returns The contents of the clipboard as a NativeImage. + */ + export var readImage: typeof GitHubElectron.Clipboard.readImage; + /** + * Writes the image into the clipboard. + */ + export var writeImage: typeof GitHubElectron.Clipboard.writeImage; + /** + * Clears everything in clipboard. + */ + export function clear(type?: string): void; + /** + * Note: This API is experimental and could be removed in future. + * @returns Whether the clipboard has data in the specified format. + */ + export function has(format: string, type?: string): boolean; + /** + * Reads the data in the clipboard of the specified format. + * Note: This API is experimental and could be removed in future. + */ + export function read(format: string, type?: string): any; +} + +declare module 'crash-reporter' { + export function start(options?: { + /** + * Default: Electron + */ + productName?: string; + /** + * Default: GitHub, Inc. + */ + companyName?: string; + /** + * URL that crash reports would be sent to as POST. + * Default: http://54.249.141.255:1127/post + */ + submitUrl?: string; + /** + * Send the crash report without user interaction. + * Default: true. + */ + autoSubmit?: boolean; + /** + * Default: false. + */ + ignoreSystemCrashHandler?: boolean; + /** + * An object you can define which content will be send along with the report. + * Only string properties are send correctly. + * Nested objects are not supported. + */ + extra?: {} + }): void; + + /** + * @returns The date and ID of the last crash report. When there was no crash report + * sent or the crash reporter is not started, null will be returned. + */ + export function getLastCrashReport(): CrashReporterPayload; + + interface CrashReporterPayload extends Object { + /** + * E.g., "electron-crash-service". + */ + rept: string; + /** + * The version of Electron. + */ + ver: string; + /** + * E.g., "win32". + */ + platform: string; + /** + * E.g., "renderer". + */ + process_type: string; + ptime: number; + /** + * The version in package.json. + */ + _version: string; + /** + * The product name in the crashReporter options object. + */ + _productName: string; + /** + * Name of the underlying product. In this case, Electron. + */ + prod: string; + /** + * The company name in the crashReporter options object. + */ + _companyName: string; + /** + * The crashreporter as a file. + */ + upload_file_minidump: File; + } +} + +declare module 'native-image' { + var NativeImage: typeof GitHubElectron.NativeImage; + export = NativeImage; +} + +declare module 'screen' { + var screen: GitHubElectron.Screen; + export = screen; +} + +declare module 'shell' { + /** + * Show the given file in a file manager. If possible, select the file. + */ + export function showItemInFolder(fullPath: string): void; + /** + * Open the given file in the desktop's default manner. + */ + export function openItem(fullPath: string): void; + /** + * Open the given external protocol URL in the desktop's default manner + * (e.g., mailto: URLs in the default mail user agent). + */ + export function openExternal(url: string): void; + /** + * Move the given file to trash and returns boolean status for the operation. + */ + export function moveItemToTrash(fullPath: string): void; + /** + * Play the beep sound. + */ + export function beep(): void; +} + +interface Window { + /** + * Creates a new window. + * @returns An instance of BrowserWindowProxy class. + */ + open(url: string, frameName?: string, features?: string): GitHubElectron.BrowserWindowProxy; +} + +interface File { + /** + * Exposes the real path of the filesystem. + */ + path: string; +} diff --git a/gl-matrix/gl-matrix-tests.ts b/gl-matrix/gl-matrix-tests.ts new file mode 100644 index 000000000..ce5251eda --- /dev/null +++ b/gl-matrix/gl-matrix-tests.ts @@ -0,0 +1,357 @@ +/// + +// common +var result: number = glMatrix.toRadian(180); + +var out: GLM.IArray; +var outVal: number; +var outStr: string; + +// vec2 +var vecA: GLM.IArray, vecB: GLM.IArray, matA: GLM.IArray; +var vecArray: GLM.IArray; + +vecA = [1, 2]; +vecB = new Float32Array([3, 4]); +out = [0, 0]; +matA = [1, 2, 3, 4, 5, 6]; +vecArray = [1, 2, 3, 4, 0, 0]; + +out = vec2.create(); +out = vec2.clone(vecA); +out = vec2.fromValues(1, 2); +out = vec2.copy(out, vecA); +out = vec2.set(out, 1, 2); +out = vec2.add(out, vecA, vecB); +out = vec2.subtract(out, vecA, vecB); +out = vec2.sub(out, vecA, vecB); +out = vec2.multiply(out, vecA, vecB); +out = vec2.mul(out, vecA, vecB); +out = vec2.divide(out, vecA, vecB); +out = vec2.div(out, vecA, vecB); +out = vec2.min(out, vecA, vecB); +out = vec2.max(out, vecA, vecB); +out = vec2.scale(out, vecA, 2); +out = vec2.scaleAndAdd(out, vecA, vecB, 0.5); +outVal = vec2.distance(vecA, vecB); +outVal = vec2.dist(vecA, vecB); +outVal = vec2.squaredDistance(vecA, vecB); +outVal = vec2.sqrDist(vecA, vecB); +outVal = vec2.length(vecA); +outVal = vec2.len(vecA); +outVal = vec2.squaredLength(vecA); +outVal = vec2.sqrLen(vecA); +out = vec2.negate(out, vecA); +out = vec2.inverse(out, vecA); +out = vec2.normalize(out, vecA); +outVal = vec2.dot(vecA, vecB); +out = vec2.cross(out, vecA, vecB); +out = vec2.lerp(out, vecA, vecB, 0.5); +out = vec2.random(out); +out = vec2.random(out, 5.0); +out = vec2.transformMat2(out, vecA, matA); +out = vec2.transformMat2d(out, vecA, matA); +out = vec2.transformMat3(out, vecA, matA); +out = vec2.transformMat4(out, vecA, matA); +out = vec2.forEach(vecArray, 0, 0, 0, vec2.normalize); +outStr = vec2.str(vecA); + +// vec3 +var matr: GLM.IArray; +var q: GLM.IArray; + +vecA = [1, 2, 3]; +vecB = new Float32Array([4, 5, 6]); +out = [0, 0, 0]; +vecArray = [1, 2, 3, 4, 5, 6, 0, 0, 0]; +matr = [1, 0, 0, 0, 1, 0, 0, 0, 1 ]; + +out = vec3.create(); +out = vec3.clone(vecA); +out = vec3.fromValues(1, 2, 3); +out = vec3.copy(out, vecA); +out = vec3.set(out, 1, 2, 3); +out = vec3.add(out, vecA, vecB); +out = vec3.subtract(out, vecA, vecB); +out = vec3.sub(out, vecA, vecB); +out = vec3.multiply(out, vecA, vecB); +out = vec3.mul(out, vecA, vecB); +out = vec3.divide(out, vecA, vecB); +out = vec3.div(out, vecA, vecB); +out = vec3.min(out, vecA, vecB); +out = vec3.max(out, vecA, vecB); +out = vec3.scale(out, vecA, 2); +out = vec3.scaleAndAdd(out, vecA, vecB, 0.5); +outVal = vec3.distance(vecA, vecB); +outVal = vec3.dist(vecA, vecB); +outVal = vec3.squaredDistance(vecA, vecB); +outVal = vec3.sqrDist(vecA, vecB); +outVal = vec3.length(vecA); +outVal = vec3.len(vecA); +outVal = vec3.squaredLength(vecA); +outVal = vec3.sqrLen(vecA); +out = vec3.negate(out, vecA); +out = vec3.inverse(out, vecA); +out = vec3.normalize(out, vecA); +outVal = vec3.dot(vecA, vecB); +out = vec3.cross(out, vecA, vecB); +out = vec3.lerp(out, vecA, vecB, 0.5); +out = vec3.random(out); +out = vec3.random(out, 5.0); +out = vec3.rotateX(out, vecA, vecB, Math.PI); +out = vec3.rotateY(out, vecA, vecB, Math.PI); +out = vec3.rotateZ(out, vecA, vecB, Math.PI); +out = vec3.transformMat3(out, vecA, matr); + +matr = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ]; +out = vec3.transformMat4(out, vecA, matr); + +q = [1, 2, 3, 4]; +out = vec3.transformQuat(out, vecA, matr); + +out = vec3.forEach(vecArray, 0, 0, 0, vec3.normalize); +outVal = vec3.angle(vecA, vecB); +outStr = vec3.str(vecA); + +// vec4 +var q: GLM.IArray; + +vecA = [1, 2, 3, 4]; +vecB = new Float32Array([5, 6, 7, 8]); +out = [0, 0, 0, 0]; +q = [1, 2, 3, 4]; + +out = vec4.create(); +out = vec4.clone(vecA); +out = vec4.fromValues(1, 2, 3, 4); +out = vec4.copy(out, vecA); +out = vec4.set(out, 1, 2, 3, 4); +out = vec4.add(out, vecA, vecB); +out = vec4.subtract(out, vecA, vecB); +out = vec4.sub(out, vecA, vecB); +out = vec4.multiply(out, vecA, vecB); +out = vec4.mul(out, vecA, vecB); +out = vec4.divide(out, vecA, vecB); +out = vec4.div(out, vecA, vecB); +out = vec4.min(out, vecA, vecB); +out = vec4.max(out, vecA, vecB); +out = vec4.scale(out, vecA, 2); +out = vec4.scaleAndAdd(out, vecA, vecB, 0.5); +outVal = vec4.distance(vecA, vecB); +outVal = vec4.dist(vecA, vecB); +outVal = vec4.squaredDistance(vecA, vecB); +outVal = vec4.sqrDist(vecA, vecB); +outVal = vec4.length(vecA); +outVal = vec4.len(vecA); +outVal = vec4.squaredLength(vecA); +outVal = vec4.sqrLen(vecA); +out = vec4.negate(out, vecA); +out = vec4.inverse(out, vecA); +out = vec4.normalize(out, vecA); +outVal = vec4.dot(vecA, vecB); +out = vec4.lerp(out, vecA, vecB, 0.5); +out = vec4.random(out); +out = vec4.random(out, 5.0); + +matr = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ] +out = vec4.transformMat4(out, vecA, matr); +out = vec4.transformQuat(out, vecA, q); + +vecArray = [1, 2, 3, 4, 5, 6, 7, 8, 0, 0, 0, 0]; +out = vec4.forEach(vecArray, 0, 0, 0, vec4.normalize); +outStr = vec4.str(vecA); + +// mat2 +var matB: GLM.IArray, identity: GLM.IArray; + +matA = [1, 2, 3, 4]; +matB = new Float32Array([5, 6, 7, 8]); +out = [0, 0, 0, 0]; +identity = [1, 0, 0, 1]; + +out = mat2.create(); +out = mat2.clone(matA); +out = mat2.copy(out, matA); +out = mat2.identity(out); +out = mat2.transpose(out, matA); +out = mat2.invert(out, matA); +out = mat2.adjoint(out, matA); +outVal = mat2.determinant(matA); +out = mat2.multiply(out, matA, matB); +out = mat2.mul(out, matA, matB); +out = mat2.rotate(out, matA, Math.PI * 0.5); + +vecA = [2, 3]; +out = mat2.scale(out, matA, vecA); +outStr = mat2.str(matA); +outVal = mat2.frob(matA); + +var L = mat2.create(); +var D = mat2.create(); +var U = mat2.create(); +out = mat2.LDU(L, D, U, [4,3,6,3]); + +// mat2d +matA = [1, 2, 3, 4, 5, 6]; +matB = [7, 8, 9, 10, 11, 12]; +out = [0, 0, 0, 0, 0, 0]; +identity = [1, 0, 0, 1, 0, 0]; + +out = mat2d.create(); +out = mat2d.clone(matA); +out = mat2d.copy(out, matA); +out = mat2d.identity(out); +out = mat2d.invert(out, matA); +outVal = mat2d.determinant(matA); +out = mat2d.multiply(out, matA, matB); +out = mat2d.mul(out, matA, matB); +out = mat2d.rotate(out, matA, Math.PI * 0.5); + +vecA = [2, 3]; +out = mat2d.scale(out, matA, vecA); +out = mat2d.translate(out, matA, vecA); +outStr = mat2d.str(matA); +outVal = mat2d.frob(matA); + +// mat3 +matA = [1, 0, 0, 0, 1, 0, 1, 2, 1]; +matB = [1, 0, 0, 0, 1, 0, 3, 4, 1]; +out = [0, 0, 0, 0, 0, 0, 0, 0, 0]; +identity = [1, 0, 0, 0, 1, 0, 0, 0, 1]; + +out = mat3.create(); +out = mat3.clone(matA); +out = mat3.copy(out, matA); +out = mat3.identity(out); +out = mat3.transpose(out, matA); +out = mat3.invert(out, matA); +out = mat3.adjoint(out, matA); +outVal = mat3.determinant(matA); +out = mat3.multiply(out, matA, matB); +out = mat3.mul(out, matA, matB); +outStr = mat3.str(matA); +outVal = mat3.frob(matA); + +matA = [1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 0, 0, 0, 1]; +out = mat3.normalFromMat4(out, matA); + +q = [ 0, -0.7071067811865475, 0, 0.7071067811865475 ]; +out = mat3.fromQuat(out, q); + +out = mat3.normalFromMat4(out, [ 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12, 13,14,15,16]); +out = mat3.fromMat4(out, [ 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12, 13,14,15,16]); +out = mat3.scale(out, matA, [2,2]); +out = mat3.fromMat2d(out, [1, 2, 3, 4, 5, 6]); + +out = mat3.translate(out, matA, [1, 2, 3]); +out = mat3.rotate(out, matA, Math.PI/2); + +// mat4 +matA = [1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 1, 2, 3, 1]; + +matB = [1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 4, 5, 6, 1]; + +out = [0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0]; + +identity = [1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 0, 0, 0, 1]; + +out = mat4.create(); +out = mat4.clone(matA); +out = mat4.copy(out, matA); +out = mat4.identity(out); +out = mat4.transpose(out, matA); +out = mat4.invert(out, matA); +out = mat4.adjoint(out, matA); +outVal = mat4.determinant(matA); +out = mat4.multiply(out, matA, matB); +out = mat4.mul(out, matA, matB); +out = mat4.translate(out, matA, [4, 5, 6]); +out = mat4.scale(out, matA, [4, 5, 6]); + +var rad = Math.PI * 0.5; +var axis = [1, 0, 0]; +out = mat4.rotate(out, matA, rad, axis); +out = mat4.rotateX(out, matA, rad); +out = mat4.rotateY(out, matA, rad); +out = mat4.rotateZ(out, matA, rad); + +out = mat4.frustum(out, -1, 1, -1, 1, -1, 1); + +var fovy = Math.PI * 0.5; +out = mat4.perspective(out, fovy, 1, 0, 1); +out = mat4.ortho(out, -1, 1, -1, 1, -1, 1); + +var eye = [0, 0, 1]; +var center = [0, 0, -1]; +var up = [0, 1, 0]; +out = mat4.lookAt(out, eye, center, up); + +outStr = mat4.str(matA); +outVal = mat4.frob(matA); + +q = [0, 0, 0, 1]; +out = mat4.fromRotationTranslation(out, q, [1, 2, 3]); +out = mat4.fromQuat(out, q); + +// quat +var quatA = [1, 2, 3, 4]; +var quatB = [5, 6, 7, 8]; +out = [0, 0, 0, 0]; +var vec = [1, 1, -1]; +var id = [0, 0, 0, 1]; +var deg90 = Math.PI / 2; + +out = quat.create(); +out = quat.clone(quatA); +out = quat.fromValues(1, 2, 3, 4); +out = quat.copy(out, quatA); +out = quat.set(out, 1, 2, 3, 4); +out = quat.identity(out); +out = quat.setAxisAngle(out, [1, 0, 0], Math.PI * 0.5); +out = quat.add(out, quatA, quatB); +out = quat.multiply(out, quatA, quatB); +out = quat.mul(out, quatA, quatB); +out = quat.scale(out, quatA, 2); +outVal = quat.length(quatA); +outVal = quat.len(quatA); +outVal = quat.squaredLength(quatA); +outVal = quat.sqrLen(quatA); +out = quat.normalize(out, quatA); +outVal = quat.dot(out, quatA, quatB); +out = quat.lerp(out, quatA, quatB, 0.5); +out = quat.slerp(out, quatA, quatB, 0.5); +out = quat.invert(out, quatA); +out = quat.conjugate(out, quatA); +outStr = quat.str(quatA); +out = quat.rotateX(out, id, deg90); +out = quat.rotateY(out, id, deg90); +out = quat.rotateZ(out, id, deg90); + +matr = [ 1, 0, 0, + 0, 0, -1, + 0, 1, 0 ]; +out = quat.fromMat3(out, matr); + +var view = [-1, 0, 0]; +up = [ 0, 1, 0]; +var right= [ 0, 0,-1]; +out = quat.setAxes([], view, right, up); + +out = quat.rotationTo(out, [0, 1, 0], [1, 0, 0]); +out = quat.calculateW(out, quatA); + diff --git a/gl-matrix/gl-matrix.d.ts b/gl-matrix/gl-matrix.d.ts new file mode 100644 index 000000000..392a39220 --- /dev/null +++ b/gl-matrix/gl-matrix.d.ts @@ -0,0 +1,2144 @@ +// Type definitions for gl-matrix 2.2.2 +// Project: https://github.com/toji/gl-matrix +// Definitions by: Tat +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module GLM { + interface IArray + { + /** + * Must be indexable like an array + */ + [index: number]: number; + } +} + +// Common +declare module glMatrix { + /** + * Convert Degree To Radian + * + * @param a Angle in Degrees + */ + export function toRadian(a: number): number; +} + +// vec2 +declare module vec2 { + /** + * Creates a new, empty vec2 + * + * @returns a new 2D vector + */ + export function create(): GLM.IArray; + + /** + * Creates a new vec2 initialized with values from an existing vector + * + * @param a a vector to clone + * @returns a new 2D vector + */ + export function clone(a: GLM.IArray): GLM.IArray; + + /** + * Creates a new vec2 initialized with the given values + * + * @param x X component + * @param y Y component + * @returns a new 2D vector + */ + export function fromValues(x: number, y: number): GLM.IArray; + + /** + * Copy the values from one vec2 to another + * + * @param out the receiving vector + * @param a the source vector + * @returns out + */ + export function copy(out: GLM.IArray, a: GLM.IArray): GLM.IArray; + + /** + * Set the components of a vec2 to the given values + * + * @param out the receiving vector + * @param x X component + * @param y Y component + * @returns out + */ + export function set(out: GLM.IArray, x: number, y: number): GLM.IArray; + + /** + * Adds two vec2's + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @returns out + */ + export function add(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray; + + /** + * Subtracts vector b from vector a + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @returns out + */ + export function subtract(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray; + + /** + * Subtracts vector b from vector a + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @returns out + */ + export function sub(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray; + + /** + * Multiplies two vec2's + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @returns out + */ + export function multiply(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray; + + /** + * Multiplies two vec2's + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @returns out + */ + export function mul(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray; + + /** + * Divides two vec2's + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @returns out + */ + export function divide(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray; + + /** + * Divides two vec2's + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @returns out + */ + export function div(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray; + + /** + * Returns the minimum of two vec2's + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @returns out + */ + export function min(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray; + + /** + * Returns the maximum of two vec2's + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @returns out + */ + export function max(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray; + + /** + * Scales a vec2 by a scalar number + * + * @param out the receiving vector + * @param a the vector to scale + * @param b amount to scale the vector by + * @returns out + */ + export function scale(out: GLM.IArray, a: GLM.IArray, b: number): GLM.IArray; + + /** + * Adds two vec2's after scaling the second operand by a scalar value + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @param scale the amount to scale b by before adding + * @returns out + */ + export function scaleAndAdd(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray, scale: number): GLM.IArray; + + /** + * Calculates the euclidian distance between two vec2's + * + * @param a the first operand + * @param b the second operand + * @returns distance between a and b + */ + export function distance(a: GLM.IArray, b: GLM.IArray): number; + + /** + * Calculates the euclidian distance between two vec2's + * + * @param a the first operand + * @param b the second operand + * @returns distance between a and b + */ + export function dist(a: GLM.IArray, b: GLM.IArray): number; + + /** + * Calculates the squared euclidian distance between two vec2's + * + * @param a the first operand + * @param b the second operand + * @returns squared distance between a and b + */ + export function squaredDistance(a: GLM.IArray, b: GLM.IArray): number; + + /** + * Calculates the squared euclidian distance between two vec2's + * + * @param a the first operand + * @param b the second operand + * @returns squared distance between a and b + */ + export function sqrDist(a: GLM.IArray, b: GLM.IArray): number; + + /** + * Calculates the length of a vec2 + * + * @param a vector to calculate length of + * @returns length of a + */ + export function length(a: GLM.IArray): number; + + /** + * Calculates the length of a vec2 + * + * @param a vector to calculate length of + * @returns length of a + */ + export function len(a: GLM.IArray): number; + + /** + * Calculates the squared length of a vec2 + * + * @param a vector to calculate squared length of + * @returns squared length of a + */ + export function squaredLength(a: GLM.IArray): number; + + /** + * Calculates the squared length of a vec2 + * + * @param a vector to calculate squared length of + * @returns squared length of a + */ + export function sqrLen(a: GLM.IArray): number; + + /** + * Negates the components of a vec2 + * + * @param out the receiving vector + * @param a vector to negate + * @returns out + */ + export function negate(out: GLM.IArray, a: GLM.IArray): GLM.IArray; + + /** + * Returns the inverse of the components of a vec2 + * + * @param out the receiving vector + * @param a vector to invert + * @returns out + */ + export function inverse(out: GLM.IArray, a: GLM.IArray): GLM.IArray; + + /** + * Normalize a vec2 + * + * @param out the receiving vector + * @param a vector to normalize + * @returns out + */ + export function normalize(out: GLM.IArray, a: GLM.IArray): GLM.IArray; + + /** + * Calculates the dot product of two vec2's + * + * @param a the first operand + * @param b the second operand + * @returns dot product of a and b + */ + export function dot(a: GLM.IArray, b: GLM.IArray): number; + + /** + * Computes the cross product of two vec2's + * Note that the cross product must by definition produce a 3D vector + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @returns out + */ + export function cross(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray; + + /** + * Performs a linear interpolation between two vec2's + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @param t interpolation amount between the two inputs + * @returns out + */ + export function lerp(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray, t: number): GLM.IArray; + + /** + * Generates a random unit vector + * + * @param out the receiving vector + * @returns out + */ + export function random(out: GLM.IArray): GLM.IArray; + + /** + * Generates a random vector with the given scale + * + * @param out the receiving vector + * @param scale Length of the resulting vector. If ommitted, a unit vector will be returned + * @returns out + */ + export function random(out: GLM.IArray, scale: number): GLM.IArray; + + /** + * Transforms the vec2 with a mat2 + * + * @param out the receiving vector + * @param a the vector to transform + * @param m matrix to transform with + * @returns out + */ + export function transformMat2(out: GLM.IArray, a: GLM.IArray, m: GLM.IArray): GLM.IArray; + + /** + * Transforms the vec2 with a mat2d + * + * @param out the receiving vector + * @param a the vector to transform + * @param m matrix to transform with + * @returns out + */ + export function transformMat2d(out: GLM.IArray, a: GLM.IArray, m: GLM.IArray): GLM.IArray; + + /** + * Transforms the vec2 with a mat3 + * 3rd vector component is implicitly '1' + * + * @param out the receiving vector + * @param a the vector to transform + * @param m matrix to transform with + * @returns out + */ + export function transformMat3(out: GLM.IArray, a: GLM.IArray, m: GLM.IArray): GLM.IArray; + + /** + * Transforms the vec2 with a mat4 + * 3rd vector component is implicitly '0' + * 4th vector component is implicitly '1' + * + * @param out the receiving vector + * @param a the vector to transform + * @param m matrix to transform with + * @returns out + */ + export function transformMat4(out: GLM.IArray, a: GLM.IArray, m: GLM.IArray): GLM.IArray; + + /** + * Perform some operation over an array of vec2s. + * + * @param a the array of vectors to iterate over + * @param stride Number of elements between the start of each vec2. If 0 assumes tightly packed + * @param offset Number of elements to skip at the beginning of the array + * @param count Number of vec2s to iterate over. If 0 iterates over entire array + * @param fn Function to call for each vector in the array + * @param arg additional argument to pass to fn + * @returns a + */ + export function forEach(a: GLM.IArray, stride: number, offset: number, count: number, + fn: (a: GLM.IArray, b: GLM.IArray, arg: any) => void, arg: any): GLM.IArray; + + /** + * Perform some operation over an array of vec2s. + * + * @param a the array of vectors to iterate over + * @param stride Number of elements between the start of each vec2. If 0 assumes tightly packed + * @param offset Number of elements to skip at the beginning of the array + * @param count Number of vec2s to iterate over. If 0 iterates over entire array + * @param fn Function to call for each vector in the array + * @returns a + */ + export function forEach(a: GLM.IArray, stride: number, offset: number, count: number, + fn: (a: GLM.IArray, b: GLM.IArray) => void): GLM.IArray; + + /** + * Returns a string representation of a vector + * + * @param vec vector to represent as a string + * @returns string representation of the vector + */ + export function str(a: GLM.IArray): string; +} + +// vec3 +declare module vec3 { + + /** + * Creates a new, empty vec3 + * + * @returns a new 3D vector + */ + export function create(): GLM.IArray; + + /** + * Creates a new vec3 initialized with values from an existing vector + * + * @param a vector to clone + * @returns a new 3D vector + */ + export function clone(a: GLM.IArray): GLM.IArray; + + /** + * Creates a new vec3 initialized with the given values + * + * @param x X component + * @param y Y component + * @param z Z component + * @returns a new 3D vector + */ + export function fromValues(x: number, y: number, z: number): GLM.IArray; + + /** + * Copy the values from one vec3 to another + * + * @param out the receiving vector + * @param a the source vector + * @returns out + */ + export function copy(out: GLM.IArray, a: GLM.IArray): GLM.IArray; + + /** + * Set the components of a vec3 to the given values + * + * @param out the receiving vector + * @param x X component + * @param y Y component + * @param z Z component + * @returns out + */ + export function set(out: GLM.IArray, x: number, y: number, z: number): GLM.IArray; + + /** + * Adds two vec3's + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @returns out + */ + export function add(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray; + + /** + * Subtracts vector b from vector a + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @returns out + */ + export function subtract(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray; + + /** + * Subtracts vector b from vector a + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @returns out + */ + export function sub(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray + + /** + * Multiplies two vec3's + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @returns out + */ + export function multiply(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray; + + /** + * Multiplies two vec3's + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @returns out + */ + export function mul(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray; + + /** + * Divides two vec3's + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @returns out + */ + export function divide(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray; + + /** + * Divides two vec3's + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @returns out + */ + export function div(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray; + + /** + * Returns the minimum of two vec3's + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @returns out + */ + export function min(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray; + + /** + * Returns the maximum of two vec3's + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @returns out + */ + export function max(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray; + + /** + * Scales a vec3 by a scalar number + * + * @param out the receiving vector + * @param a the vector to scale + * @param b amount to scale the vector by + * @returns out + */ + export function scale(out: GLM.IArray, a: GLM.IArray, b: number): GLM.IArray; + + /** + * Adds two vec3's after scaling the second operand by a scalar value + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @param scale the amount to scale b by before adding + * @returns out + */ + export function scaleAndAdd(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray, scale: number): GLM.IArray; + + /** + * Calculates the euclidian distance between two vec3's + * + * @param a the first operand + * @param b the second operand + * @returns distance between a and b + */ + export function distance(a: GLM.IArray, b: GLM.IArray): number; + + /** + * Calculates the euclidian distance between two vec3's + * + * @param a the first operand + * @param b the second operand + * @returns distance between a and b + */ + export function dist(a: GLM.IArray, b: GLM.IArray): number; + + /** + * Calculates the squared euclidian distance between two vec3's + * + * @param a the first operand + * @param b the second operand + * @returns squared distance between a and b + */ + export function squaredDistance(a: GLM.IArray, b: GLM.IArray): number; + + /** + * Calculates the squared euclidian distance between two vec3's + * + * @param a the first operand + * @param b the second operand + * @returns squared distance between a and b + */ + export function sqrDist(a: GLM.IArray, b: GLM.IArray): number; + + /** + * Calculates the length of a vec3 + * + * @param a vector to calculate length of + * @returns length of a + */ + export function length(a: GLM.IArray): number; + + /** + * Calculates the length of a vec3 + * + * @param a vector to calculate length of + * @returns length of a + */ + export function len(a: GLM.IArray): number; + + /** + * Calculates the squared length of a vec3 + * + * @param a vector to calculate squared length of + * @returns squared length of a + */ + export function squaredLength(a: GLM.IArray): number; + + /** + * Calculates the squared length of a vec3 + * + * @param a vector to calculate squared length of + * @returns squared length of a + */ + export function sqrLen(a: GLM.IArray): number; + + /** + * Negates the components of a vec3 + * + * @param out the receiving vector + * @param a vector to negate + * @returns out + */ + export function negate(out: GLM.IArray, a: GLM.IArray): GLM.IArray; + + /** + * Returns the inverse of the components of a vec3 + * + * @param out the receiving vector + * @param a vector to invert + * @returns out + */ + export function inverse(out: GLM.IArray, a: GLM.IArray): GLM.IArray; + + /** + * Normalize a vec3 + * + * @param out the receiving vector + * @param a vector to normalize + * @returns out + */ + export function normalize(out: GLM.IArray, a: GLM.IArray): GLM.IArray; + + /** + * Calculates the dot product of two vec3's + * + * @param a the first operand + * @param b the second operand + * @returns dot product of a and b + */ + export function dot(a: GLM.IArray, b: GLM.IArray): number; + + /** + * Computes the cross product of two vec3's + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @returns out + */ + export function cross(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray; + + /** + * Performs a linear interpolation between two vec3's + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @param t interpolation amount between the two inputs + * @returns out + */ + export function lerp(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray, t: number): GLM.IArray; + + /** + * Generates a random unit vector + * + * @param out the receiving vector + * @returns out + */ + export function random(out: GLM.IArray): GLM.IArray; + + /** + * Generates a random vector with the given scale + * + * @param out the receiving vector + * @param [scale] Length of the resulting vector. If ommitted, a unit vector will be returned + * @returns out + */ + export function random(out: GLM.IArray, scale: number): GLM.IArray; + + /** + * Rotate a 3D vector around the x-axis + * @param out The receiving vec3 + * @param a The vec3 point to rotate + * @param b The origin of the rotation + * @param c The angle of rotation + * @returns out + */ + export function rotateX(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray, c: number): GLM.IArray; + + /** + * Rotate a 3D vector around the y-axis + * @param out The receiving vec3 + * @param a The vec3 point to rotate + * @param b The origin of the rotation + * @param c The angle of rotation + * @returns out + */ + export function rotateY(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray, c: number): GLM.IArray; + + /** + * Rotate a 3D vector around the z-axis + * @param out The receiving vec3 + * @param a The vec3 point to rotate + * @param b The origin of the rotation + * @param c The angle of rotation + * @returns out + */ + export function rotateZ(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray, c: number): GLM.IArray; + + /** + * Transforms the vec3 with a mat3. + * + * @param out the receiving vector + * @param a the vector to transform + * @param m the 3x3 matrix to transform with + * @returns out + */ + export function transformMat3(out: GLM.IArray, a: GLM.IArray, m: GLM.IArray): GLM.IArray; + + /** + * Transforms the vec3 with a mat4. + * 4th vector component is implicitly '1' + * + * @param out the receiving vector + * @param a the vector to transform + * @param m matrix to transform with + * @returns out + */ + export function transformMat4(out: GLM.IArray, a: GLM.IArray, m: GLM.IArray): GLM.IArray; + + /** + * Transforms the vec3 with a quat + * + * @param out the receiving vector + * @param a the vector to transform + * @param q quaternion to transform with + * @returns out + */ + export function transformQuat(out: GLM.IArray, a: GLM.IArray, q: GLM.IArray): GLM.IArray; + + + /** + * Perform some operation over an array of vec3s. + * + * @param a the array of vectors to iterate over + * @param stride Number of elements between the start of each vec3. If 0 assumes tightly packed + * @param offset Number of elements to skip at the beginning of the array + * @param count Number of vec3s to iterate over. If 0 iterates over entire array + * @param fn Function to call for each vector in the array + * @param arg additional argument to pass to fn + * @returns a + * @function + */ + export function forEach(out: GLM.IArray, string: number, offset: number, count: number, + fn: (a: GLM.IArray, b: GLM.IArray, arg: any) => void, arg: any): GLM.IArray; + + /** + * Perform some operation over an array of vec3s. + * + * @param a the array of vectors to iterate over + * @param stride Number of elements between the start of each vec3. If 0 assumes tightly packed + * @param offset Number of elements to skip at the beginning of the array + * @param count Number of vec3s to iterate over. If 0 iterates over entire array + * @param fn Function to call for each vector in the array + * @returns a + * @function + */ + export function forEach(out: GLM.IArray, string: number, offset: number, count: number, + fn: (a: GLM.IArray, b: GLM.IArray) => void): GLM.IArray; + + /** + * Get the angle between two 3D vectors + * @param a The first operand + * @param b The second operand + * @returns The angle in radians + */ + export function angle(a: GLM.IArray, b: GLM.IArray): number; + + /** + * Returns a string representation of a vector + * + * @param vec vector to represent as a string + * @returns string representation of the vector + */ + export function str(a: GLM.IArray): string; +} + +// vec4 +declare module vec4 { + + /** + * Creates a new, empty vec4 + * + * @returns a new 4D vector + */ + export function create(): GLM.IArray; + + /** + * Creates a new vec4 initialized with values from an existing vector + * + * @param a vector to clone + * @returns a new 4D vector + */ + export function clone(a: GLM.IArray): GLM.IArray; + + /** + * Creates a new vec4 initialized with the given values + * + * @param x X component + * @param y Y component + * @param z Z component + * @param w W component + * @returns a new 4D vector + */ + export function fromValues(x: number, y: number, z: number, w: number): GLM.IArray; + + /** + * Copy the values from one vec4 to another + * + * @param out the receiving vector + * @param a the source vector + * @returns out + */ + export function copy(out: GLM.IArray, a: GLM.IArray): GLM.IArray; + + /** + * Set the components of a vec4 to the given values + * + * @param out the receiving vector + * @param x X component + * @param y Y component + * @param z Z component + * @param w W component + * @returns out + */ + export function set(out: GLM.IArray, x: number, y: number, z: number, w: number): GLM.IArray; + + /** + * Adds two vec4's + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @returns out + */ + export function add(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray; + + /** + * Subtracts vector b from vector a + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @returns out + */ + export function subtract(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray; + + /** + * Subtracts vector b from vector a + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @returns out + */ + export function sub(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray; + + /** + * Multiplies two vec4's + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @returns out + */ + export function multiply(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray; + + /** + * Multiplies two vec4's + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @returns out + */ + export function mul(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray; + + /** + * Divides two vec4's + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @returns out + */ + export function divide(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray; + + /** + * Divides two vec4's + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @returns out + */ + export function div(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray; + + /** + * Returns the minimum of two vec4's + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @returns out + */ + export function min(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray; + + /** + * Returns the maximum of two vec4's + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @returns out + */ + export function max(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray; + + /** + * Scales a vec4 by a scalar number + * + * @param out the receiving vector + * @param a the vector to scale + * @param b amount to scale the vector by + * @returns out + */ + export function scale(out: GLM.IArray, a: GLM.IArray, b: number): GLM.IArray; + + /** + * Adds two vec4's after scaling the second operand by a scalar value + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @param scale the amount to scale b by before adding + * @returns out + */ + export function scaleAndAdd(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray, scale: number): GLM.IArray; + + /** + * Calculates the euclidian distance between two vec4's + * + * @param a the first operand + * @param b the second operand + * @returns distance between a and b + */ + export function distance(a: GLM.IArray, b: GLM.IArray): number; + + /** + * Calculates the euclidian distance between two vec4's + * + * @param a the first operand + * @param b the second operand + * @returns distance between a and b + */ + export function dist(a: GLM.IArray, b: GLM.IArray): number; + + /** + * Calculates the squared euclidian distance between two vec4's + * + * @param a the first operand + * @param b the second operand + * @returns squared distance between a and b + */ + export function squaredDistance(a: GLM.IArray, b: GLM.IArray): number; + + /** + * Calculates the squared euclidian distance between two vec4's + * + * @param a the first operand + * @param b the second operand + * @returns squared distance between a and b + */ + export function sqrDist(a: GLM.IArray, b: GLM.IArray): number; + + /** + * Calculates the length of a vec4 + * + * @param a vector to calculate length of + * @returns length of a + */ + export function length(a: GLM.IArray): number; + + /** + * Calculates the length of a vec4 + * + * @param a vector to calculate length of + * @returns length of a + */ + export function len(a: GLM.IArray): number; + + /** + * Calculates the squared length of a vec4 + * + * @param a vector to calculate squared length of + * @returns squared length of a + */ + export function squaredLength(a: GLM.IArray): number; + + /** + * Calculates the squared length of a vec4 + * + * @param a vector to calculate squared length of + * @returns squared length of a + */ + export function sqrLen(a: GLM.IArray): number; + + /** + * Negates the components of a vec4 + * + * @param out the receiving vector + * @param a vector to negate + * @returns out + */ + export function negate(out: GLM.IArray, a: GLM.IArray): GLM.IArray; + + /** + * Returns the inverse of the components of a vec4 + * + * @param out the receiving vector + * @param a vector to invert + * @returns out + */ + export function inverse(out: GLM.IArray, a: GLM.IArray): GLM.IArray; + + /** + * Normalize a vec4 + * + * @param out the receiving vector + * @param a vector to normalize + * @returns out + */ + export function normalize(out: GLM.IArray, a: GLM.IArray): GLM.IArray; + + /** + * Calculates the dot product of two vec4's + * + * @param a the first operand + * @param b the second operand + * @returns dot product of a and b + */ + export function dot(a: GLM.IArray, b: GLM.IArray): number; + + /** + * Performs a linear interpolation between two vec4's + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @param t interpolation amount between the two inputs + * @returns out + */ + export function lerp(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray, t: number): GLM.IArray; + + /** + * Generates a random unit vector + * + * @param out the receiving vector + * @returns out + */ + export function random(out: GLM.IArray): GLM.IArray; + + /** + * Generates a random vector with the given scale + * + * @param out the receiving vector + * @param Length of the resulting vector. If ommitted, a unit vector will be returned + * @returns out + */ + export function random(out: GLM.IArray, scale: number): GLM.IArray; + + /** + * Transforms the vec4 with a mat4. + * + * @param out the receiving vector + * @param a the vector to transform + * @param m matrix to transform with + * @returns out + */ + export function transformMat4(out: GLM.IArray, a: GLM.IArray, mat: GLM.IArray): GLM.IArray; + + /** + * Transforms the vec4 with a quat + * + * @param out the receiving vector + * @param a the vector to transform + * @param q quaternion to transform with + * @returns out + */ + export function transformQuat(out: GLM.IArray, a: GLM.IArray, quat: GLM.IArray): GLM.IArray; + + /** + * Perform some operation over an array of vec4s. + * + * @param a the array of vectors to iterate over + * @param stride Number of elements between the start of each vec4. If 0 assumes tightly packed + * @param offset Number of elements to skip at the beginning of the array + * @param count Number of vec4s to iterate over. If 0 iterates over entire array + * @param fn Function to call for each vector in the array + * @param additional argument to pass to fn + * @returns a + * @function + */ + export function forEach(out: GLM.IArray, string: number, offset: number, count: number, + callback: (a: GLM.IArray, b: GLM.IArray, arg: any) => void, arg: any): GLM.IArray; + + /** + * Perform some operation over an array of vec4s. + * + * @param a the array of vectors to iterate over + * @param stride Number of elements between the start of each vec4. If 0 assumes tightly packed + * @param offset Number of elements to skip at the beginning of the array + * @param count Number of vec4s to iterate over. If 0 iterates over entire array + * @param fn Function to call for each vector in the array + * @returns a + * @function + */ + export function forEach(out: GLM.IArray, string: number, offset: number, count: number, + callback: (a: GLM.IArray, b: GLM.IArray) => void): GLM.IArray; + + /** + * Returns a string representation of a vector + * + * @param vec vector to represent as a string + * @returns string representation of the vector + */ + export function str(a: GLM.IArray): string; +} + +// mat2 +declare module mat2 { + + /** + * Creates a new identity mat2 + * + * @returns a new 2x2 matrix + */ + export function create(): GLM.IArray; + + /** + * Creates a new mat2 initialized with values from an existing matrix + * + * @param a matrix to clone + * @returns a new 2x2 matrix + */ + export function clone(a: GLM.IArray): GLM.IArray; + + /** + * Copy the values from one mat2 to another + * + * @param out the receiving matrix + * @param a the source matrix + * @returns out + */ + export function copy(out: GLM.IArray, a: GLM.IArray): GLM.IArray; + + /** + * Set a mat2 to the identity matrix + * + * @param out the receiving matrix + * @returns out + */ + export function identity(out: GLM.IArray): GLM.IArray; + + /** + * Transpose the values of a mat2 + * + * @param out the receiving matrix + * @param a the source matrix + * @returns out + */ + export function transpose(out: GLM.IArray, a: GLM.IArray): GLM.IArray; + + /** + * Inverts a mat2 + * + * @param out the receiving matrix + * @param a the source matrix + * @returns out + */ + export function invert(out: GLM.IArray, a: GLM.IArray): GLM.IArray; + + /** + * Calculates the adjugate of a mat2 + * + * @param out the receiving matrix + * @param a the source matrix + * @returns out + */ + export function adjoint(out: GLM.IArray, a: GLM.IArray): GLM.IArray; + + /** + * Calculates the determinant of a mat2 + * + * @param a the source matrix + * @returns determinant of a + */ + export function determinant(a: GLM.IArray): number; + + /** + * Multiplies two mat2's + * + * @param out the receiving matrix + * @param a the first operand + * @param b the second operand + * @returns out + */ + export function multiply(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray; + + /** + * Multiplies two mat2's + * + * @param out the receiving matrix + * @param a the first operand + * @param b the second operand + * @returns out + */ + export function mul(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray; + + /** + * Rotates a mat2 by the given angle + * + * @param out the receiving matrix + * @param a the matrix to rotate + * @param rad the angle to rotate the matrix by + * @returns out + */ + export function rotate(out: GLM.IArray, a: GLM.IArray, rad: number): GLM.IArray; + + /** + * Scales the mat2 by the dimensions in the given vec2 + * + * @param out the receiving matrix + * @param a the matrix to rotate + * @param v the vec2 to scale the matrix by + * @returns out + **/ + export function scale(out: GLM.IArray, a: GLM.IArray, v: GLM.IArray): GLM.IArray; + + /** + * Returns a string representation of a mat2 + * + * @param a matrix to represent as a string + * @returns string representation of the matrix + */ + export function str(a: GLM.IArray): string; + + /** + * Returns Frobenius norm of a mat2 + * + * @param a the matrix to calculate Frobenius norm of + * @returns Frobenius norm + */ + export function frob(a: GLM.IArray): number; + + /** + * Returns L, D and U matrices (Lower triangular, Diagonal and Upper triangular) by factorizing the input matrix + * @param L the lower triangular matrix + * @param D the diagonal matrix + * @param U the upper triangular matrix + * @param a the input matrix to factorize + */ + export function LDU(L: GLM.IArray, D: GLM.IArray, U: GLM.IArray, a: GLM.IArray): GLM.IArray; +} + +// mat2d +declare module mat2d { + + /** + * Creates a new identity mat2d + * + * @returns a new 2x3 matrix + */ + export function create(): GLM.IArray; + + /** + * Creates a new mat2d initialized with values from an existing matrix + * + * @param a matrix to clone + * @returns a new 2x3 matrix + */ + export function clone(a: GLM.IArray): GLM.IArray; + + /** + * Copy the values from one mat2d to another + * + * @param out the receiving matrix + * @param a the source matrix + * @returns out + */ + export function copy(out: GLM.IArray, a: GLM.IArray): GLM.IArray; + + /** + * Set a mat2d to the identity matrix + * + * @param out the receiving matrix + * @returns out + */ + export function identity(out: GLM.IArray): GLM.IArray; + + /** + * Inverts a mat2d + * + * @param out the receiving matrix + * @param a the source matrix + * @returns out + */ + export function invert(out: GLM.IArray, a: GLM.IArray): GLM.IArray; + + /** + * Calculates the determinant of a mat2d + * + * @param a the source matrix + * @returns determinant of a + */ + export function determinant(a: GLM.IArray): number; + + /** + * Multiplies two mat2d's + * + * @param out the receiving matrix + * @param a the first operand + * @param b the second operand + * @returns out + */ + export function multiply(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray; + + /** + * Multiplies two mat2d's + * + * @param out the receiving matrix + * @param a the first operand + * @param b the second operand + * @returns out + */ + export function mul(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray; + + /** + * Rotates a mat2d by the given angle + * + * @param out the receiving matrix + * @param a the matrix to rotate + * @param rad the angle to rotate the matrix by + * @returns out + */ + export function rotate(out: GLM.IArray, a: GLM.IArray, rad: number): GLM.IArray; + + /** + * Scales the mat2d by the dimensions in the given vec2 + * + * @param out the receiving matrix + * @param a the matrix to translate + * @param v the vec2 to scale the matrix by + * @returns out + **/ + export function scale(out: GLM.IArray, a: GLM.IArray, v: GLM.IArray): GLM.IArray; + + /** + * Translates the mat2d by the dimensions in the given vec2 + * + * @param out the receiving matrix + * @param a the matrix to translate + * @param v the vec2 to translate the matrix by + * @returns out + **/ + export function translate(out: GLM.IArray, a: GLM.IArray, v: GLM.IArray): GLM.IArray; + + /** + * Returns a string representation of a mat2d + * + * @param a matrix to represent as a string + * @returns string representation of the matrix + */ + export function str(a: GLM.IArray): string; + + /** + * Returns Frobenius norm of a mat2d + * + * @param a the matrix to calculate Frobenius norm of + * @returns Frobenius norm + */ + export function frob(a: GLM.IArray): number; +} + +// mat3 +declare module mat3 { + + /** + * Creates a new identity mat3 + * + * @returns a new 3x3 matrix + */ + export function create(): GLM.IArray; + + /** + * Creates a new mat3 initialized with values from an existing matrix + * + * @param a matrix to clone + * @returns a new 3x3 matrix + */ + export function clone(a: GLM.IArray): GLM.IArray; + + /** + * Copy the values from one mat3 to another + * + * @param out the receiving matrix + * @param a the source matrix + * @returns out + */ + export function copy(out: GLM.IArray, a: GLM.IArray): GLM.IArray; + + /** + * Set a mat3 to the identity matrix + * + * @param out the receiving matrix + * @returns out + */ + export function identity(out: GLM.IArray): GLM.IArray; + + /** + * Transpose the values of a mat3 + * + * @param out the receiving matrix + * @param a the source matrix + * @returns out + */ + export function transpose(out: GLM.IArray, a: GLM.IArray): GLM.IArray; + + /** + * Inverts a mat3 + * + * @param out the receiving matrix + * @param a the source matrix + * @returns out + */ + export function invert(out: GLM.IArray, a: GLM.IArray): GLM.IArray; + + /** + * Calculates the adjugate of a mat3 + * + * @param out the receiving matrix + * @param a the source matrix + * @returns out + */ + export function adjoint(out: GLM.IArray, a: GLM.IArray): GLM.IArray; + + /** + * Calculates the determinant of a mat3 + * + * @param a the source matrix + * @returns determinant of a + */ + export function determinant(a: GLM.IArray): number; + + /** + * Multiplies two mat3's + * + * @param out the receiving matrix + * @param a the first operand + * @param b the second operand + * @returns out + */ + export function multiply(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray; + + /** + * Multiplies two mat3's + * + * @param out the receiving matrix + * @param a the first operand + * @param b the second operand + * @returns out + */ + export function mul(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray; + + /** + * Returns a string representation of a mat3 + * + * @param mat matrix to represent as a string + * @returns string representation of the matrix + */ + export function str(mat: GLM.IArray): string; + + /** + * Returns Frobenius norm of a mat3 + * + * @param a the matrix to calculate Frobenius norm of + * @returns Frobenius norm + */ + export function frob(a: GLM.IArray): number; + + /** + * Calculates a 3x3 normal matrix (transpose inverse) from the 4x4 matrix + * + * @param out mat3 receiving operation result + * @param a Mat4 to derive the normal matrix from + * + * @returns out + */ + export function normalFromMat4(out: GLM.IArray, a: GLM.IArray): GLM.IArray; + + /** + * Calculates a 3x3 matrix from the given quaternion + * + * @param out mat3 receiving operation result + * @param q Quaternion to create matrix from + * + * @returns out + */ + export function fromQuat(out: GLM.IArray, q: GLM.IArray): GLM.IArray; + + /** + * Copies the upper-left 3x3 values into the given mat3. + * + * @param out the receiving 3x3 matrix + * @param a the source 4x4 matrix + * @returns out + */ + export function fromMat4(out: GLM.IArray, a: GLM.IArray): GLM.IArray; + + /** + * Scales the mat3 by the dimensions in the given vec2 + * + * @param out the receiving matrix + * @param a the matrix to rotate + * @param v the vec2 to scale the matrix by + * @returns out + **/ + export function scale(out: GLM.IArray, a: GLM.IArray, v: GLM.IArray): GLM.IArray; + + /** + * Copies the values from a mat2d into a mat3 + * + * @param out the receiving matrix + * @param {mat2d} a the matrix to copy + * @returns out + **/ + export function fromMat2d(out: GLM.IArray, a: GLM.IArray): GLM.IArray; + + /** + * Translate a mat3 by the given vector + * + * @param out the receiving matrix + * @param a the matrix to translate + * @param v vector to translate by + * @returns out + */ + export function translate(out: GLM.IArray, a: GLM.IArray, v: GLM.IArray): GLM.IArray; + + /** + * Rotates a mat3 by the given angle + * + * @param out the receiving matrix + * @param a the matrix to rotate + * @param rad the angle to rotate the matrix by + * @returns out + */ + export function rotate(out: GLM.IArray, a: GLM.IArray, rad: number): GLM.IArray; +} + +// mat4 +declare module mat4 { + + /** + * Creates a new identity mat4 + * + * @returns a new 4x4 matrix + */ + export function create(): GLM.IArray; + + /** + * Creates a new mat4 initialized with values from an existing matrix + * + * @param a matrix to clone + * @returns a new 4x4 matrix + */ + export function clone(a: GLM.IArray): GLM.IArray; + + /** + * Copy the values from one mat4 to another + * + * @param out the receiving matrix + * @param a the source matrix + * @returns out + */ + export function copy(out: GLM.IArray, a: GLM.IArray): GLM.IArray; + + /** + * Set a mat4 to the identity matrix + * + * @param out the receiving matrix + * @returns out + */ + export function identity(a: GLM.IArray): GLM.IArray; + + /** + * Transpose the values of a mat4 + * + * @param out the receiving matrix + * @param a the source matrix + * @returns out + */ + export function transpose(out: GLM.IArray, a: GLM.IArray): GLM.IArray; + + /** + * Inverts a mat4 + * + * @param out the receiving matrix + * @param a the source matrix + * @returns out + */ + export function invert(out: GLM.IArray, a: GLM.IArray): GLM.IArray; + + /** + * Calculates the adjugate of a mat4 + * + * @param out the receiving matrix + * @param a the source matrix + * @returns out + */ + export function adjoint(out: GLM.IArray, a: GLM.IArray): GLM.IArray; + + /** + * Calculates the determinant of a mat4 + * + * @param a the source matrix + * @returns determinant of a + */ + export function determinant(a: GLM.IArray): number; + + /** + * Multiplies two mat4's + * + * @param out the receiving matrix + * @param a the first operand + * @param b the second operand + * @returns out + */ + export function multiply(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray; + + /** + * Multiplies two mat4's + * + * @param out the receiving matrix + * @param a the first operand + * @param b the second operand + * @returns out + */ + export function mul(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray; + + /** + * Translate a mat4 by the given vector + * + * @param out the receiving matrix + * @param a the matrix to translate + * @param v vector to translate by + * @returns out + */ + export function translate(out: GLM.IArray, a: GLM.IArray, v: GLM.IArray): GLM.IArray; + + /** + * Scales the mat4 by the dimensions in the given vec3 + * + * @param out the receiving matrix + * @param a the matrix to scale + * @param v the vec3 to scale the matrix by + * @returns out + **/ + export function scale(out: GLM.IArray, a: GLM.IArray, v: GLM.IArray): GLM.IArray; + + /** + * Rotates a mat4 by the given angle + * + * @param out the receiving matrix + * @param a the matrix to rotate + * @param rad the angle to rotate the matrix by + * @param axis the axis to rotate around + * @returns out + */ + export function rotate(out: GLM.IArray, a: GLM.IArray, rad: number, axis: GLM.IArray): GLM.IArray; + + /** + * Rotates a matrix by the given angle around the X axis + * + * @param out the receiving matrix + * @param a the matrix to rotate + * @param rad the angle to rotate the matrix by + * @returns out + */ + export function rotateX(out: GLM.IArray, a: GLM.IArray, rad: number): GLM.IArray; + + /** + * Rotates a matrix by the given angle around the Y axis + * + * @param out the receiving matrix + * @param a the matrix to rotate + * @param rad the angle to rotate the matrix by + * @returns out + */ + export function rotateY(out: GLM.IArray, a: GLM.IArray, rad: number): GLM.IArray; + + /** + * Rotates a matrix by the given angle around the Z axis + * + * @param out the receiving matrix + * @param a the matrix to rotate + * @param rad the angle to rotate the matrix by + * @returns out + */ + export function rotateZ(out: GLM.IArray, a: GLM.IArray, rad: number): GLM.IArray; + + /** + * Generates a frustum matrix with the given bounds + * + * @param out mat4 frustum matrix will be written into + * @param left Left bound of the frustum + * @param right Right bound of the frustum + * @param bottom Bottom bound of the frustum + * @param top Top bound of the frustum + * @param near Near bound of the frustum + * @param far Far bound of the frustum + * @returns out + */ + export function frustum(out: GLM.IArray, left: number, right: number, + bottom: number, top: number, near: number, far: number): GLM.IArray; + + /** + * Generates a perspective projection matrix with the given bounds + * + * @param out mat4 frustum matrix will be written into + * @param fovy Vertical field of view in radians + * @param aspect Aspect ratio. typically viewport width/height + * @param near Near bound of the frustum + * @param far Far bound of the frustum + * @returns out + */ + export function perspective(out: GLM.IArray, fovy: number, aspect: number, + near: number, far: number): GLM.IArray; + + /** + * Generates a orthogonal projection matrix with the given bounds + * + * @param out mat4 frustum matrix will be written into + * @param left Left bound of the frustum + * @param right Right bound of the frustum + * @param bottom Bottom bound of the frustum + * @param top Top bound of the frustum + * @param near Near bound of the frustum + * @param far Far bound of the frustum + * @returns out + */ + export function ortho(out: GLM.IArray, left: number, right: number, + bottom: number, top: number, near: number, far: number): GLM.IArray; + + /** + * Generates a look-at matrix with the given eye position, focal point, and up axis + * + * @param out mat4 frustum matrix will be written into + * @param eye Position of the viewer + * @param center Point the viewer is looking at + * @param up vec3 pointing up + * @returns out + */ + export function lookAt(out: GLM.IArray, eye: GLM.IArray, + center: GLM.IArray, up: GLM.IArray): GLM.IArray; + + /** + * Returns a string representation of a mat4 + * + * @param mat matrix to represent as a string + * @returns string representation of the matrix + */ + export function str(mat: GLM.IArray): string; + + /** + * Returns Frobenius norm of a mat4 + * + * @param a the matrix to calculate Frobenius norm of + * @returns Frobenius norm + */ + export function frob(a: GLM.IArray): number; + + /** + * Creates a matrix from a quaternion rotation and vector translation + * This is equivalent to (but much faster than): + * + * mat4.identity(dest); + * mat4.translate(dest, vec); + * var quatMat = mat4.create(); + * quat4.toMat4(quat, quatMat); + * mat4.multiply(dest, quatMat); + * + * @param out mat4 receiving operation result + * @param q Rotation quaternion + * @param v Translation vector + * @returns out + */ + export function fromRotationTranslation(out: GLM.IArray, q: GLM.IArray, + v: GLM.IArray): GLM.IArray; + + /** + * Creates a matrix from a quaternion + * + * @param out mat4 receiving operation result + * @param q Rotation quaternion + * @returns out + */ + export function fromQuat(out: GLM.IArray, q: GLM.IArray): GLM.IArray; +} + +// quat +declare module quat { + + /** + * Creates a new identity quat + * + * @returns a new quaternion + */ + export function create(): GLM.IArray; + + /** + * Creates a new quat initialized with values from an existing quaternion + * + * @param a quaternion to clone + * @returns a new quaternion + * @function + */ + export function clone(a: GLM.IArray): GLM.IArray; + + /** + * Creates a new quat initialized with the given values + * + * @param x X component + * @param y Y component + * @param z Z component + * @param w W component + * @returns a new quaternion + * @function + */ + export function fromValues(x: number, y: number, z: number, w: number): GLM.IArray; + + /** + * Copy the values from one quat to another + * + * @param out the receiving quaternion + * @param a the source quaternion + * @returns out + * @function + */ + export function copy(out: GLM.IArray, a: GLM.IArray): GLM.IArray; + + /** + * Set the components of a quat to the given values + * + * @param out the receiving quaternion + * @param x X component + * @param y Y component + * @param z Z component + * @param w W component + * @returns out + * @function + */ + export function set(out: GLM.IArray, x: number, y: number, z: number, w: number): GLM.IArray; + + /** + * Set a quat to the identity quaternion + * + * @param out the receiving quaternion + * @returns out + */ + export function identity(out: GLM.IArray): GLM.IArray; + + /** + * Sets a quat from the given angle and rotation axis, + * then returns it. + * + * @param out the receiving quaternion + * @param axis the axis around which to rotate + * @param rad the angle in radians + * @returns out + **/ + export function setAxisAngle(out: GLM.IArray, axis: GLM.IArray, rad: number): GLM.IArray; + + /** + * Adds two quat's + * + * @param out the receiving quaternion + * @param a the first operand + * @param b the second operand + * @returns out + * @function + */ + export function add(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray; + + /** + * Multiplies two quat's + * + * @param out the receiving quaternion + * @param a the first operand + * @param b the second operand + * @returns out + */ + export function multiply(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray; + + /** + * Multiplies two quat's + * + * @param out the receiving quaternion + * @param a the first operand + * @param b the second operand + * @returns out + */ + export function mul(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray; + + /** + * Scales a quat by a scalar number + * + * @param out the receiving vector + * @param a the vector to scale + * @param b amount to scale the vector by + * @returns out + * @function + */ + export function scale(out: GLM.IArray, a: GLM.IArray, b: number): GLM.IArray; + + /** + * Calculates the length of a quat + * + * @param a vector to calculate length of + * @returns length of a + * @function + */ + export function length(a: GLM.IArray): number; + + /** + * Calculates the length of a quat + * + * @param a vector to calculate length of + * @returns length of a + * @function + */ + export function len(a: GLM.IArray): number; + + /** + * Calculates the squared length of a quat + * + * @param a vector to calculate squared length of + * @returns squared length of a + * @function + */ + export function squaredLength(a: GLM.IArray): number; + + /** + * Calculates the squared length of a quat + * + * @param a vector to calculate squared length of + * @returns squared length of a + * @function + */ + export function sqrLen(a: GLM.IArray): number; + + /** + * Normalize a quat + * + * @param out the receiving quaternion + * @param a quaternion to normalize + * @returns out + * @function + */ + export function normalize(out: GLM.IArray, a: GLM.IArray): GLM.IArray; + + /** + * Calculates the dot product of two quat's + * + * @param a the first operand + * @param b the second operand + * @returns dot product of a and b + * @function + */ + export function dot(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): number; + + /** + * Performs a linear interpolation between two quat's + * + * @param out the receiving quaternion + * @param a the first operand + * @param b the second operand + * @param t interpolation amount between the two inputs + * @returns out + * @function + */ + export function lerp(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray, t: number): GLM.IArray; + + /** + * Performs a spherical linear interpolation between two quat + * + * @param out the receiving quaternion + * @param a the first operand + * @param b the second operand + * @param t interpolation amount between the two inputs + * @returns out + */ + export function slerp(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray, t: number): GLM.IArray; + + /** + * Calculates the inverse of a quat + * + * @param out the receiving quaternion + * @param a quat to calculate inverse of + * @returns out + */ + export function invert(out: GLM.IArray, a: GLM.IArray): GLM.IArray; + + /** + * Calculates the conjugate of a quat + * If the quaternion is normalized, this function is faster than quat.inverse and produces the same result. + * + * @param out the receiving quaternion + * @param a quat to calculate conjugate of + * @returns out + */ + export function conjugate(out: GLM.IArray, a: GLM.IArray): GLM.IArray; + + /** + * Returns a string representation of a quatenion + * + * @param vec vector to represent as a string + * @returns string representation of the vector + */ + export function str(a: GLM.IArray): string; + + /** + * Rotates a quaternion by the given angle about the X axis + * + * @param out quat receiving operation result + * @param a quat to rotate + * @param rad angle (in radians) to rotate + * @returns out + */ + export function rotateX(out: GLM.IArray, a: GLM.IArray, rad: number): GLM.IArray; + + /** + * Rotates a quaternion by the given angle about the Y axis + * + * @param out quat receiving operation result + * @param a quat to rotate + * @param rad angle (in radians) to rotate + * @returns out + */ + export function rotateY(out: GLM.IArray, a: GLM.IArray, rad: number): GLM.IArray; + + /** + * Rotates a quaternion by the given angle about the Z axis + * + * @param out quat receiving operation result + * @param a quat to rotate + * @param rad angle (in radians) to rotate + * @returns out + */ + export function rotateZ(out: GLM.IArray, a: GLM.IArray, rad: number): GLM.IArray; + + /** + * Creates a quaternion from the given 3x3 rotation matrix. + * + * NOTE: The resultant quaternion is not normalized, so you should be sure + * to renormalize the quaternion yourself where necessary. + * + * @param out the receiving quaternion + * @param m rotation matrix + * @returns out + * @function + */ + export function fromMat3(out: GLM.IArray, m: GLM.IArray): GLM.IArray; + + /** + * Sets the specified quaternion with values corresponding to the given + * axes. Each axis is a vec3 and is expected to be unit length and + * perpendicular to all other specified axes. + * + * @param view the vector representing the viewing direction + * @param right the vector representing the local "right" direction + * @param up the vector representing the local "up" direction + * @returns out + */ + export function setAxes(out: GLM.IArray, view: GLM.IArray, right: GLM.IArray, + up: GLM.IArray): GLM.IArray; + + /** + * Sets a quaternion to represent the shortest rotation from one + * vector to another. + * + * Both vectors are assumed to be unit length. + * + * @param out the receiving quaternion. + * @param a the initial vector + * @param b the destination vector + * @returns out + */ + export function rotationTo(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray; + + /** + * Calculates the W component of a quat from the X, Y, and Z components. + * Assumes that quaternion is 1 unit in length. + * Any existing W component will be ignored. + * + * @param out the receiving quaternion + * @param a quat to calculate W component of + * @returns out + */ + export function calculateW(out: GLM.IArray, a: GLM.IArray): GLM.IArray; +} \ No newline at end of file diff --git a/googlemaps/google.maps-tests.ts b/googlemaps/google.maps-tests.ts new file mode 100644 index 000000000..1079f78b2 --- /dev/null +++ b/googlemaps/google.maps-tests.ts @@ -0,0 +1,107 @@ +// Test file for Google Maps JavaScript API Definition file +/// + +var map = new google.maps.Map(document.querySelector("☺")); + +/***** Data *****/ + +new google.maps.Data(); +new google.maps.Data({ map: map }); + +var latLng = new google.maps.LatLng(52.201203, -1.724370), + feature = new google.maps.Data.Feature(), + geometry = new google.maps.Data.Geometry(); + +var data = map.data; + +data.add(feature); + +data.add({ + geometry: latLng, + id: "Test feature", + properties: {} +}); + +var isIn: boolean = map.data.contains(feature); + +data.forEach((feature: google.maps.Data.Feature) => { + console.log(feature.getId()); +}); + +var map: google.maps.Map = data.getMap(); +data.setMap(map); + +var style = data.getStyle(); +data.setStyle(style); + +data.setStyle({ + clickable: true, + cursor: "pointer", + fillColor: "#79B55B", + fillOpacity: 1, + icon: {}, + shape: { coords: [1, 2, 3], type: "circle" }, + strokeColor: "#79B55B", + strokeOpacity: 1, + strokeWeight: 1, + title: "string", + visible: true, + zIndex: 1 +}); + +data.overrideStyle(feature, { visible: true }); + +data.revertStyle(feature); + +data.addGeoJson({}); +data.addGeoJson({}, { idPropertyName: "Test feature" }); + +data.loadGeoJson("http://magicGeoJsonSource.com"); + +data.loadGeoJson( + "http://magicGeoJsonSource.com", + { idPropertyName: "test" }); + +data.loadGeoJson( + "http://magicGeoJsonSource.com", + { idPropertyName: "test" }, + (features) => { + for (var i = 0, len = features.length; i < len; i++) { + console.log(features[i].getId()); + } + }); + +data.toGeoJson((feature) => { }); + +var dataMouseEvent: google.maps.Data.MouseEvent = { + feature: feature, + latLng: latLng, + stop: (): void => {} +}; + +var addFeatureEvent : google.maps.Data.AddFeatureEvent = { + feature: feature +}; + +var removeFeatureEvent: google.maps.Data.RemoveFeatureEvent = { + feature: feature +}; + +var setGeometryEvent: google.maps.Data.SetGeometryEvent = { + feature: feature, + newGeometry: geometry, + oldGeometry: geometry, +}; + +var setPropertyEvent: google.maps.Data.SetPropertyEvent = { + feature: feature, + name: "test", + newValue: {}, + oldValue: {} +}; + +var removePropertyEvent: google.maps.Data.RemovePropertyEvent = { + feature: feature, + name: "test", + oldValue: {} +}; \ No newline at end of file diff --git a/googlemaps/google.maps.d.ts b/googlemaps/google.maps.d.ts index 3ba451c8a..fe4e7459c 100644 --- a/googlemaps/google.maps.d.ts +++ b/googlemaps/google.maps.d.ts @@ -1,6 +1,6 @@ -// Type definitions for Google Geolocation 0.4.8 +// Type definitions for Google Maps JavaScript API 3.19 // Project: https://developers.google.com/maps/ -// Definitions by: Folia A/S +// Definitions by: Folia A/S , Chris Wrench // Definitions: https://github.com/borisyankov/DefinitelyTyped /* @@ -80,9 +80,10 @@ declare module google.maps { setStreetView(panorama: StreetViewPanorama): void; setTilt(tilt: number): void; setZoom(zoom: number): void; - controls: MVCArray[]; //Array.> + controls: MVCArray[]; //Array> + data: Data; mapTypes: MapTypeRegistry; - overlayMapTypes: MVCArray; // MVCArray. + overlayMapTypes: MVCArray; // MVCArray } export interface MapOptions { @@ -206,6 +207,159 @@ declare module google.maps { ZOOM_PAN } + /***** Data *****/ + export class Data extends MVCObject { + constructor(options?: Data.DataOptions); + add(feature: Data.Feature|Data.FeatureOptions): Data.Feature; + addGeoJson(geoJson: Object, options?: Data.GeoJsonOptions): Data.Feature[]; + contains(feature: Data.Feature): boolean; + forEach(callback: (feature: Data.Feature) => void): void; + getFeatureById(id: number|string): Data.Feature; + getMap(): Map; + getStyle(): Data.StylingFunction|Data.StyleOptions; + loadGeoJson(url: string, options?: Data.GeoJsonOptions, callback?: (features: Data.Feature[]) => void): void; + overrideStyle(feature: Data.Feature, style: Data.StyleOptions): void; + remove(feature: Data.Feature): void; + revertStyle(feature?: Data.Feature): void; + setMap(map: Map): void; + setStyle(style: Data.StylingFunction|Data.StyleOptions): void; + toGeoJson(callback: (feature: Object) => void): void; + } + + export module Data { + export interface DataOptions { + map?: Map; + style?: Data.StylingFunction|Data.StyleOptions; + } + + export interface GeoJsonOptions { + idPropertyName?: string; + } + + export interface StyleOptions { + clickable?: boolean; + cursor?: string; + fillColor?: string; + fillOpacity?: number; + icon?: any; // TODO string|Icon|Symbol; + shape?: MarkerShape; + strokeColor?: string; + strokeOpacity?: number; + strokeWeight?: number; + title?: string; + visible?: boolean; + zIndex?: number; + } + + export type StylingFunction = (feature: Data.Feature) => Data.StyleOptions; + + export class Feature { + constructor(options?: Data.FeatureOptions); + forEachProperty(callback: (value: any, name: string) => void): void; + getGeometry(): Data.Geometry; + getId(): number|string; + getProperty(name: string): any; + removeProperty(name: string): void; + setGeometry(newGeometry: Data.Geometry|LatLng): void; // TODO LatLngLiteral + setProperty(name: string, newValue: any): void + toGeoJson(callback: (feature: Object) => void): void + } + + export interface FeatureOptions { + geometry?: Data.Geometry|LatLng; // TODO LatLngLiteral + id?: number|string; + properties?: Object; + } + + export class Geometry { + getType(): string; + } + + export class Point extends Data.Geometry { + constructor(latLng: LatLng); // TODO LatLngLiteral + get(): LatLng; + } + + export class MultiPoint extends Data.Geometry { + constructor(elements: LatLng[]); // TODO LatLngLiteral + getAt(n: number): LatLng; + getLength(): number; + } + + export class LineString extends Data.Geometry { + constructor(elements: LatLng[]); // TODO LatLngLiteral + getArray(): LatLng[]; + getAt(n: number): LatLng; + getLength(): number; + } + + export class MultiLineString extends Data.Geometry { + constructor(elements: Data.LineString[]|LatLng[]); // TODO LatLngLiteral + getArray(): Data.LineString[]; + getAt(n: number): Data.LineString; + getLength(): number; + } + + export class LinearRing extends Data.Geometry { + constructor(elements: LatLng[]); // TODO LatLngLiteral + getArray(): LatLng[]; + getAt(n: number): LatLng; + getLength(): number; + } + + export class Polygon extends Data.Geometry { + constructor(elements: LinearRing[]|LatLng[][]); // TODO LatLngLiteral + getArray(): LinearRing[]; + getAt(n: number): LinearRing; + getLength(): number; + } + + export class MultiPolygon extends Data.Geometry { + constructor(elements: Data.Polygon[]|LinearRing[][]|LatLng[][][]); // TODO LatLngLiteral + getArray(): Data.Polygon[]; + getAt(n: number): Data.Polygon; + getLength(): number; + } + + export class GeometryCollection extends Data.Geometry { + constructor(elements: Data.Geometry[]|LatLng[]); // TODO LatLngLiteral + getArray(): Data.Geometry[]; + getAt(n: number): Data.Geometry; + getLength(): number; + } + + export interface MouseEvent extends google.maps.MouseEvent { + feature: Data.Feature; + } + + export interface AddFeatureEvent { + feature: Data.Feature; + } + + export interface RemoveFeatureEvent { + feature: Data.Feature; + } + + export interface SetGeometryEvent { + feature: Data.Feature; + newGeometry: Data.Geometry; + oldGeometry: Data.Geometry; + } + + export interface SetPropertyEvent { + feature: Data.Feature; + name: string; + newValue: any; + oldValue: any; + } + + export interface RemovePropertyEvent { + feature: Data.Feature; + name: string; + oldValue: any; + } + } + /***** Overlays *****/ export class Marker extends MVCObject { static MAX_ZINDEX: number; @@ -470,7 +624,7 @@ declare module google.maps { visible?: boolean; zIndex?: number; } - + export enum StrokePosition { CENTER, INSIDE, @@ -1345,54 +1499,54 @@ declare module google.maps { } export module places { - - export class AutocompleteService extends MVCObject { - constructor(); - getPlacePredictions(request: AutocompletionRequest, callback: (result: AutocompletePrediction[], status: PlacesServiceStatus) => void): void; - getQueryPredictions(request: QueryAutocompletionRequest, callback: (result: QueryAutocompletePrediction[], status: PlacesServiceStatus) => void): void; - } - - export interface AutocompletionRequest { - input: string; - bounds?: LatLngBounds; - componentRestrictions?: ComponentRestrictions; - location?: LatLng; - offset?: number; - radius?: number; - types?: string[]; - } - - export interface QueryAutocompletionRequest { - input: string; - bounds?: LatLngBounds; - location?: LatLng; - offset?: number; - radius?: number; - } - - export interface AutocompletePrediction { - description: string; - matched_substrings: PredictionSubstring[]; - place_id: string; - terms: PredictionTerm[]; - types: string[] - } - - export interface PredictionTerm { - offset: number; - value: string; - } - - export interface PredictionSubstring { - length: number; - offset: number; - } - - export interface QueryAutocompletePrediction { - description: string; - matched_substrings: PredictionSubstring[]; - place_id: string; - terms: PredictionTerm[]; + + export class AutocompleteService extends MVCObject { + constructor(); + getPlacePredictions(request: AutocompletionRequest, callback: (result: AutocompletePrediction[], status: PlacesServiceStatus) => void): void; + getQueryPredictions(request: QueryAutocompletionRequest, callback: (result: QueryAutocompletePrediction[], status: PlacesServiceStatus) => void): void; + } + + export interface AutocompletionRequest { + input: string; + bounds?: LatLngBounds; + componentRestrictions?: ComponentRestrictions; + location?: LatLng; + offset?: number; + radius?: number; + types?: string[]; + } + + export interface QueryAutocompletionRequest { + input: string; + bounds?: LatLngBounds; + location?: LatLng; + offset?: number; + radius?: number; + } + + export interface AutocompletePrediction { + description: string; + matched_substrings: PredictionSubstring[]; + place_id: string; + terms: PredictionTerm[]; + types: string[] + } + + export interface PredictionTerm { + offset: number; + value: string; + } + + export interface PredictionSubstring { + length: number; + offset: number; + } + + export interface QueryAutocompletePrediction { + description: string; + matched_substrings: PredictionSubstring[]; + place_id: string; + terms: PredictionTerm[]; } export class Autocomplete extends MVCObject { @@ -1414,8 +1568,19 @@ declare module google.maps { country: string; } + export interface PhotoOptions { + maxHeight?: number; + maxWidth?: number; + } + + export interface PlaceAspectRating { + rating: number; + type: string; + } + export interface PlaceDetailsRequest { - reference: string; + placeId: string; + reference?: string; } export interface PlaceGeometry { @@ -1423,29 +1588,53 @@ declare module google.maps { viewport: LatLngBounds; } + export interface PlacePhoto { + height: number; + html_attributions: string[]; + width: number; + getUrl(opts: PhotoOptions): string; + } + export interface PlaceResult { address_components: GeocoderAddressComponent[]; + aspects: PlaceAspectRating[]; formatted_address: string; formatted_phone_number: string; geometry: PlaceGeometry; html_attributions: string[]; icon: string; - id: string; + id?: string; international_phone_number: string; name: string; + permanently_closed: boolean; + photos: PlacePhoto[]; + place_id: string; + price_level: number; rating: number; - reference: string; + reference?: string; + reviews: PlaceReview[]; types: string[]; url: string; vicinity: string; website: string; } + export interface PlaceReview { + aspects: PlaceAspectRating[]; + author_name: string; + author_url: string; + language: string; + text: string; + } + export interface PlaceSearchRequest { bounds: LatLngBounds; keyword: string; location: LatLng; + maxPriceLevel?: number; + minPriceLevel?: number; name: string; + openNow: boolean; radius: number; rankBy: RankBy; types: string[]; @@ -1461,6 +1650,7 @@ declare module google.maps { constructor (attrContainer: Map); getDetails(request: PlaceDetailsRequest, callback: (result: PlaceResult, status: PlacesServiceStatus) => void ): void; nearbySearch(request: PlaceSearchRequest, callback: (results: PlaceResult[], status: PlacesServiceStatus, pagination: PlaceSearchPagination) => void ): void; + radarSearch(request: RadarSearchRequest, callback: (results: PlaceResult[], status: PlacesServiceStatus) => void ): void; textSearch(request: TextSearchRequest, callback: (results: PlaceResult[], status: PlacesServiceStatus) => void ): void; } @@ -1473,27 +1663,37 @@ declare module google.maps { ZERO_RESULTS } + export interface RadarSearchRequest { + bounds: LatLngBounds; + keyword: string; + location: LatLng; + name: string; + radius: number; + types: string[]; + } + export enum RankBy { DISTANCE, PROMINENCE } - - export class SearchBox { - constructor(inputField: HTMLInputElement, opts?: SearchBoxOptions); - getBounds(): LatLngBounds; - setBounds(bounds: LatLngBounds): void; - getPlaces(): PlaceResult[]; - } - export interface SearchBoxOptions { - bounds: LatLngBounds; - } + export class SearchBox extends MVCObject { + constructor(inputField: HTMLInputElement, opts?: SearchBoxOptions); + getBounds(): LatLngBounds; + setBounds(bounds: LatLngBounds): void; + getPlaces(): PlaceResult[]; + } + + export interface SearchBoxOptions { + bounds: LatLngBounds; + } export interface TextSearchRequest { bounds: LatLngBounds; location: LatLng; query: string; radius: number; + types: string[]; } } @@ -1643,6 +1843,6 @@ declare module google.maps { export class MapsEventListener { - } + } } } diff --git a/grecaptcha/grecaptcha-tests.ts b/grecaptcha/grecaptcha-tests.ts new file mode 100644 index 000000000..cfc86e71b --- /dev/null +++ b/grecaptcha/grecaptcha-tests.ts @@ -0,0 +1,21 @@ +/// + +var params: ReCaptchaV2.Parameters = { + "sitekey": "mySuperSecretKey", + "theme": "black", // no type-checking here. + "type": "image", + "tabindex": 5, + "callback": (response: string) => { }, + "expired-callback": () => { }, +} + +var id1: number = grecaptcha.render("foo"); +var id2: number = grecaptcha.render("foo", params); +var id3: number = grecaptcha.render(document.getElementById("foo")); +var id4: number = grecaptcha.render(document.getElementById("foo"), params); + +// response takes a number and returns a string +var response1: string = grecaptcha.getResponse(id1); + +// reset takes a number +grecaptcha.reset(id1); diff --git a/grecaptcha/grecaptcha.d.ts b/grecaptcha/grecaptcha.d.ts new file mode 100644 index 000000000..e246aaf17 --- /dev/null +++ b/grecaptcha/grecaptcha.d.ts @@ -0,0 +1,67 @@ +// Type definitions for Google Recaptcha v2 +// Project: https://www.google.com/recaptcha +// Definitions by: Kristof Mattei +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare var grecaptcha: ReCaptchaV2.ReCaptcha; + +declare module ReCaptchaV2 +{ + class ReCaptcha + { + /** + * Renders the container as a reCAPTCHA widget and returns the ID of the newly created widget. + * @param container The HTML element to render the reCAPTCHA widget. Specify either the ID of the container (string) or the DOM element itself. + * @param parameters An object containing parameters as key=value pairs, for example, {"sitekey": "your_site_key", "theme": "light"}. See @see render parameters. + * @return the ID of the newly created widget. + **/ + render(container: (string | HTMLElement), parameters?: Parameters): number; + /** + * Resets the reCAPTCHA widget. + * @param opt_widget_id Optional widget ID, defaults to the first widget created if unspecified. + **/ + reset(opt_widget_id?: number): void; + /** + * Gets the response for the reCAPTCHA widget. + * @param opt_widget_id Optional widget ID, defaults to the first widget created if unspecified. + * @return the response of the reCAPTCHA widget. + **/ + getResponse(opt_widget_id?: number): string; + } + + interface Parameters + { + /** + * Your sitekey. + **/ + sitekey: string; + /** + * Optional. The color theme of the widget. + * Accepted values: "light", "dark" + * @default "light" + **/ + theme?: string; + /** + * Optional. The type of CAPTCHA to serve. + * Accepted values: "audio ", "image" + * @default "image" + **/ + type?: string; + /** + * Optional. The tabindex of the widget and challenge. + * If other elements in your page use tabindex, it should be set to make user navigation easier. + **/ + tabindex?: number; + /** + * Optional. Your callback function that's executed when the user submits a successful CAPTCHA response. + * The user's response, g-recaptcha-response, will be the input for your callback function. + **/ + callback?: (response: string) => void; + /** + * Optional. Your callback function that's executed when the recaptcha response expires and the user needs to solve a new CAPTCHA. + **/ + // Notice to the reader + // I need to surround this object with quotes, this will however break intellisense in VS 2013. + "expired-callback"?: () => void; + } +} diff --git a/greensock/greensock.d.ts b/greensock/greensock.d.ts index a9a46d113..a43c0d77f 100644 --- a/greensock/greensock.d.ts +++ b/greensock/greensock.d.ts @@ -1,167 +1,169 @@ -// Type definitions for GreenSock Animation Platform 1.1 +// Type definitions for GreenSock Animation Platform 1.15.1 // Project: http://www.greensock.com/get-started-js/ // Definitions by: Robert S // Definitions: https://github.com/borisyankov/DefinitelyTyped // JavaScript Docs http://api.greensock.com/js/ -// Version 1.1 (TypeScript 0.9) +// Version 1.15.1 (TypeScript 1.4) interface IDispatcher { addEventListener(type:string, callback:Function, scope?:Object, useParam?:boolean, priority?:number):void; removeEventListener(type:string, callback:Function):void; } +declare type Tween = TweenLite | TweenMax; +declare type Timeline = SimpleTimeline | TimelineLite | TimelineMax; + //com.greensock.core declare class Animation { - data:any; - static ticker:IDispatcher; - timeline:SimpleTimeline; - vars:Object; + static ticker: IDispatcher; + data: any; + timeline: SimpleTimeline; + vars: Object; - constructor(duration?:number, vars?:Object); + constructor(duration?: number, vars?: Object); - delay(value:number):any; - duration(value:number):any; - eventCallback(type:string, callback?:Function, params?:any[], scope?:any):any; - invalidate():any; - isActive():boolean; - kill(vars?:Object, target?:Object):any; - pause(atTime?:any, suppressEvents?:boolean):any; - paused(value?:boolean):any; - play(from?:any, suppressEvents?:boolean):any; - restart(includeDelay?:boolean, suppressEvents?:boolean):any; - resume(from?:any, suppressEvents?:boolean):any; - reverse(from?:any, suppressEvents?:boolean):any; - reversed(value?:boolean):any; - seek(time:any, suppressEvents?:boolean):any; - startTime(value:number):any; - time(value:number, suppressEvents?:boolean):any; - timeScale(value:number):any; - totalDuration(value:number):any; - totalTime(time:number, suppressEvents?:boolean):any; + delay(): number; + delay(value: number): Animation; + duration(): number; + duration(value: number): Animation; + eventCallback(type: string): Function; + eventCallback(type: string, callback: Function, params?: any[], scope?: any): Animation; + invalidate(): Animation; + isActive(): boolean; + kill(vars?: Object, target?: Object): Animation; + pause(atTime?: any, suppressEvents?: boolean): Animation; + paused(): boolean; + paused(value: boolean): Animation; + play(from?: any, suppressEvents?: boolean): Animation; + progress(): number; + progress(value: number, supressEvents?: boolean): Animation; + restart(includeDelay?: boolean, suppressEvents?: boolean): Animation; + resume(from?: any, suppressEvents?: boolean): Animation; + reverse(from?: any, suppressEvents?: boolean): Animation; + reversed(): boolean; + reversed(value: boolean): Animation; + seek(time: any, suppressEvents?: boolean): Animation; + startTime(): number; + startTime(value: number): Animation; + time(): number; + time(value: number, suppressEvents?: boolean): Animation; + timeScale(): number; + timeScale(value: number): Animation; + totalDuration(): number; + totalDuration(value: number): Animation; + totalProgress(): number; + totalProgress(value: number): Animation; + totalTime(): number; + totalTime(time: number, suppressEvents?: boolean): Animation; } declare class SimpleTimeline extends Animation { - autoRemoveChildren:boolean; - smoothChildTiming:boolean; + autoRemoveChildren: boolean; + smoothChildTiming: boolean; - constructor(vars?:Object); + constructor(vars?: Object); - add(value:any, position?:any, align?:string, stagger?:number):any; - insert(tween:any, time:any):any; - render(time:number, suppressEvents?:boolean, force?:boolean):void; + add(value: any, position?: any, align?: string, stagger?: number): SimpleTimeline; + render(time: number, suppressEvents?: boolean, force?: boolean): void; } //com.greensock declare class TweenLite extends Animation { - static defaultEase:Ease; - static defaultOverwrite:string; - static selector:any; - target:Object; - static ticker:IDispatcher; - timeline:SimpleTimeline; - vars:Object; + static defaultEase: Ease; + static defaultOverwrite: string; + static selector: any; + target: Object; - constructor(target:Object, duration:number, vars:Object); + constructor(target: Object, duration: number, vars: Object); - static delayedCall(delay:number, callback:Function, params?:any[], scope?:any, useFrames?:boolean):TweenLite; - static from(target:Object, duration:number, vars:Object):TweenLite; - static fromTo(target:Object, duration:number, fromVars:Object, toVars:Object):TweenLite; - static getTweensOf(target:Object):any[]; - invalidate():any; - static killDelayedCallsTo(func:Function):void; - static killTweensOf(target:Object, vars?:Object):void; - static set(target:Object, vars:Object):TweenLite; - static to(target:Object, duration:number, vars:Object):TweenLite; + static delayedCall(delay: number, callback: Function, params?: any[], scope?: any, useFrames?: boolean): TweenLite; + endTime(includeRepeats?: boolean): number; + static from(target: Object | Object[], duration: number, vars: Object): TweenLite; + static fromTo(target: Object | Object[], duration: number, fromVars: Object, toVars: Object): TweenLite; + static getTweensOf(target: Object, onlyActive: boolean): Tween[]; + static killDelayedCallsTo(func: Function): void; + static killTweensOf(target: Object, onlyActive?: boolean, vars?: Object): void; + static lagSmoothing(threshold: number, adjustedLag: number): void; + static set(target: Object, vars: Object): TweenLite; + static to(target: Object, duration: number, vars: Object): TweenLite; } declare class TweenMax extends TweenLite { - static ticker:IDispatcher; + constructor(target: Object, duration: number, vars: Object); - constructor(target:Object, duration:number, vars:Object); - - static delayedCall(delay:number, callback:Function, params?:any[], scope?:any, useFrames?:boolean):TweenMax; - static from(target:Object, duration:number, vars:Object):TweenMax; - static fromTo(target:Object, duration:number, fromVars:Object, toVars:Object):TweenMax; - static getAllTweens(includeTimelines?:boolean):any[]; - static getTweensOf(target:Object):any[]; - invalidate():any; - static isTweening(target:Object):boolean; - static killAll(complete?:boolean, tweens?:boolean, delayedCalls?:boolean, timelines?:boolean):void; - static killChildTweensOf(parent:any, complete?:boolean):void; - static killDelayedCallsTo(func:Function):void; - static killTweensOf(target:Object, vars?:Object):void; - static pauseAll(tweens?:boolean, delayedCalls?:boolean, timelines?:boolean):void; - progress(value:number):any; - repeat(value:number):any; - repeatDelay(value:number):any; - static resumeAll(tweens?:boolean, delayedCalls?:boolean, timelines?:boolean):void; - static set(target:Object, vars:Object):TweenMax; - static staggerFrom(targets:any, duration:number, vars:Object, stagger:number, onCompleteAll?:Function, onCompleteAllParams?:any[], onCompleteAllScope?:any):any[]; - static staggerFromTo(targets:any, duration:number, fromVars:Object, toVars:Object, stagger:number, onCompleteAll?:Function, onCompleteAllParams?:any[], onCompleteAllScope?:any):any[]; - static staggerTo(targets:any, duration:number, vars:Object, stagger:number, onCompleteAll?:Function, onCompleteAllParams?:any[], onCompleteAllScope?:any):any[]; - time(value:number, suppressEvents?:boolean):any; + static delayedCall(delay: number, callback: Function, params?: any[], scope?: Object, useFrames?: boolean): TweenMax; + static from(target: Object, duration: number, vars: Object): TweenMax; + static fromTo(target: Object, duration: number, fromVars: Object, toVars: Object): TweenMax; + static getAllTweens(includeTimelines?: boolean): Tween[]; + static getTweensOf(target: Object): Tween[]; + static isTweening(target: Object): boolean; + static killAll(complete?: boolean, tweens?: boolean, delayedCalls?: boolean, timelines?: boolean): void; + static killChildTweensOf(parent: any, complete?: boolean): void; + static killDelayedCallsTo(func: Function): void; + static killTweensOf(target: Object, vars?: Object): void; + static pauseAll(tweens?: boolean, delayedCalls?: boolean, timelines?: boolean): void; + repeat(): number; + repeat(value: number): TweenMax; + repeatDelay(): number; + repeatDelay(value: number): TweenMax; + static resumeAll(tweens?: boolean, delayedCalls?: boolean, timelines?: boolean): void; + static set(target: Object, vars: Object): TweenMax; + static staggerFrom(targets: any, duration: number, vars: Object, stagger: number, onCompleteAll?: Function, onCompleteAllParams?: any[], onCompleteAllScope?: any): any[]; + static staggerFromTo(targets: any, duration: number, fromVars: Object, toVars: Object, stagger: number, onCompleteAll?: Function, onCompleteAllParams?: any[], onCompleteAllScope?: any): any[]; + static staggerTo(targets: any, duration: number, vars: Object, stagger: number, onCompleteAll?: Function, onCompleteAllParams?: any[], onCompleteAllScope?: any): any[]; static to(target:Object, duration:number, vars:Object):TweenMax; - totalDuration(value:number):any; - totalProgress(value:number):any; - updateTo(vars:Object, resetDuration?:boolean):any; - yoyo(value?:boolean):any; + updateTo(vars: Object, resetDuration?: boolean): TweenMax; + yoyo(): boolean; + yoyo(value?: boolean): TweenMax; } declare class TimelineLite extends SimpleTimeline { - constructor(vars?:Object); + constructor(vars?: Object); - add(value:any, position?:any, align?:string, stagger?:number):any; - addLabel(label:string, position:any):any; - addPause(position?:any, callback?:Function, params?:any[], scope?:any):any; - append(value:any, offsetOrLabel?:any):any; - appendMultiple(tweens:any[], offsetOrLabel?:any, align?:string, stagger?:number):any; - call(callback:Function, params?:any[], scope?:any, position?:any):any; - clear(labels?:boolean):any; - duration(value:number):any; - exportRoot(vars?:Object, omitDelayedCalls?:boolean):TimelineLite; - from(target:Object, duration:number, vars:Object, position?:any):any; - fromTo(target:Object, duration:number, fromVars:Object, toVars:Object, position?:any):any; - getChildren(nested?:boolean, tweens?:boolean, timelines?:boolean, ignoreBeforeTime?:number):any[]; - getLabelTime(label:string):number; - getTweensOf(target:Object, nested?:boolean):any[]; - insert(value:any, timeOrLabel?:any):any; - insertMultiple(tweens:any[], timeOrLabel?:any, align?:string, stagger?:number):any; - invalidate():any; - progress(value:number):any; - remove(value:any):any; - removeLabel(label:string):any; - set(target: Object, vars: Object, position?:any):any; - seek(position:any, suppressEvents?:boolean):any; - shiftChildren(amount:number, adjustLabels?:boolean, ignoreBeforeTime?:number):any; - staggerFrom(targets:any, duration:number, vars:Object, stagger?:number, position?:any, onCompleteAll?:Function, onCompleteAllParams?:any[], onCompleteScope?:any):any; - staggerFromTo(targets:any, duration:number, fromVars:Object, toVars:Object, stagger?:number, position?:any, onCompleteAll?:Function, onCompleteAllParams?:any[], onCompleteAllScope?:any):any; - staggerTo(targets:any, duration:number, vars:Object, stagger:number, position?:any, onCompleteAll?:Function, onCompleteAllParams?:any[], onCompleteAllScope?:any):any; - stop():any; - to(target:Object, duration:number, vars:Object, position?:any):any; - usesFrames():Boolean; + add(value: any, position?: any, align?: string, stagger?: number): TimelineLite; + addLabel(label: string, position: any): TimelineLite; + addPause(position?: any, callback?: Function, params?: any[], scope?: any): TimelineLite; + call(callback: Function, params?: any[], scope?: any, position?: any): TimelineLite; + clear(labels?: boolean): TimelineLite; + endTime(includeRepeats?: boolean): number; + static exportRoot(vars?: Object, omitDelayedCalls?: boolean): TimelineLite; + from(target: Object, duration: number, vars: Object, position?: any): TimelineLite; + fromTo(target: Object, duration: number, fromVars: Object, toVars: Object, position?: any): TimelineLite; + getChildren(nested?: boolean, tweens?: boolean, timelines?: boolean, ignoreBeforeTime?: number): Tween | Timeline[]; + getLabelTime(label: string): number; + getTweensOf(target: Object, nested?: boolean): Tween[]; + recent(): Animation; + remove(value: any): TimelineLite; + removeLabel(label: string): any; + set(target: Object, vars: Object, position?: any): TimelineLite; + shiftChildren(amount: number, adjustLabels?: boolean, ignoreBeforeTime?: number): TimelineLite; + staggerFrom(targets: any, duration: number, vars: Object, stagger?: number, position?: any, onCompleteAll?: Function, onCompleteAllParams?: any[], onCompleteScope?: any): TimelineLite; + staggerFromTo(targets: any, duration: number, fromVars: Object, toVars: Object, stagger?: number, position?: any, onCompleteAll?: Function, onCompleteAllParams?: any[], onCompleteAllScope?: any): TimelineLite; + staggerTo(targets: any, duration: number, vars: Object, stagger: number, position?: any, onCompleteAll?: Function, onCompleteAllParams?: any[], onCompleteAllScope?: any): TimelineLite; + to(target: Object, duration: number, vars: Object, position?: any): TimelineLite; + usesFrames(): boolean; } declare class TimelineMax extends TimelineLite { - constructor(vars?:Object); + constructor(vars?: Object); - addCallback(callback:Function, position:any, params?:any[], scope?:any):TimelineMax; - currentLabel(value?:string):any; - getActive(nested?:boolean, tweens?:boolean, timelines?:boolean):any[]; - getLabelAfter(time:number):string; - getLabelBefore(time:number):string; - getLabelsArray():any[]; - invalidate():any; - progress(value:number):any; - removeCallback(callback:Function, timeOrLabel?:any):TimelineMax; - repeat(value?:number):any; - repeatDelay(value?:number):any; - time(value:number, suppressEvents?:boolean):any; - totalDuration(value:number):any; - totalProgress(value:number):any; - tweenFromTo(fromPosition:any, toPosition:any, vars?:Object):TweenLite; - tweenTo(position:any, vars?:Object):TweenLite; - yoyo(value?:boolean):any; + addCallback(callback: Function, position: any, params?: any[], scope?: any): TimelineMax; + currentLabel(): string; + currentLabel(value: string): TimelineMax; + getActive(nested?: boolean, tweens?: boolean, timelines?: boolean): Tween | Timeline[]; + getLabelAfter(time: number): string; + getLabelBefore(time: number): string; + getLabelsArray(): any[]; + removeCallback(callback: Function, timeOrLabel?: any): TimelineMax; + repeat(): number; + repeat(value: number): TimelineMax; + repeatDelay(): number; + repeatDelay(value: number): TimelineMax; + tweenFromTo(fromPosition: any, toPosition: any, vars?: Object): TweenLite; + tweenTo(position: any, vars?: Object): TweenLite; + yoyo(): boolean; + yoyo(value: boolean): TimelineMax; } //com.greensock.easing diff --git a/gruntjs/gruntjs-tests.ts b/gruntjs/gruntjs-tests.ts index 6b8607329..55f106d53 100644 --- a/gruntjs/gruntjs-tests.ts +++ b/gruntjs/gruntjs-tests.ts @@ -68,7 +68,17 @@ exports = (grunt: IGrunt) => { asyncedTwoArgs(2, "values", (result: string) => { console.log(result); }); - var fileMaps = grunt.file.expandMapping([''], '', { ext: '.js' }); + + // tests for module grunt.file + var expandedFilesConfig: grunt.file.IExpandedFilesConfig = { + expand: true, + cwd: 'src', + src: ['**/*.ts'], + dest: 'build', + ext: '.js', + flatten: false + }; + var fileMaps = grunt.file.expandMapping([''], '', expandedFilesConfig); fileMaps.length; fileMaps[0].src.length; fileMaps[0].dest; diff --git a/gruntjs/gruntjs.d.ts b/gruntjs/gruntjs.d.ts index baea9dcfb..850d0b226 100644 --- a/gruntjs/gruntjs.d.ts +++ b/gruntjs/gruntjs.d.ts @@ -604,7 +604,7 @@ declare module grunt { /** * All {@link IExpandedFilesConfig.src} matches are relative to (but don't include) this path. */ - cwd?: boolean + cwd?: string /** * Replace any existing extension with this value in generated {@link IExpandedFilesConfig.dest} paths. diff --git a/gulp-istanbul/gulp-istanbul-0.8.1.d.ts b/gulp-istanbul/gulp-istanbul-0.8.1.d.ts new file mode 100644 index 000000000..3a10dfdba --- /dev/null +++ b/gulp-istanbul/gulp-istanbul-0.8.1.d.ts @@ -0,0 +1,51 @@ +// Type definitions for gulp-istanbul v0.8.1 +// Project: https://github.com/SBoudrias/gulp-istanbul +// Definitions by: Asana +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module "gulp-istanbul" { + function GulpIstanbul(opts?: GulpIstanbul.Options): NodeJS.ReadWriteStream; + + module GulpIstanbul { + export function hookRequire(): NodeJS.ReadWriteStream; + export function summarizeCoverage(opts?: {coverageVariable?: string}): Coverage; + export function writeReports(opts?: ReportOptions): NodeJS.ReadWriteStream; + + interface Options { + coverageVariable?: string; + includeUntested?: boolean; + embedSource?: boolean; + preserveComments?: boolean; + noCompact?: boolean; + noAutoWrap?: boolean; + codeGenerationOptions?: Object; + debug?: boolean; + walkDebug?: boolean; + } + + interface Coverage { + lines: CoverageStats; + statements: CoverageStats; + functions: CoverageStats; + branches: CoverageStats; + } + + interface CoverageStats { + total: number; + covered: number; + skipped: number; + pct: number; + } + + interface ReportOptions { + dir?: string; + reporters?: string[]; + reportOpts?: {dir?: string}; + coverageVariable?: string; + } + } + + export = GulpIstanbul; +} diff --git a/gulp-istanbul/gulp-istanbul-tests.ts b/gulp-istanbul/gulp-istanbul-tests.ts index 7f2327d07..0d64b53d0 100644 --- a/gulp-istanbul/gulp-istanbul-tests.ts +++ b/gulp-istanbul/gulp-istanbul-tests.ts @@ -29,4 +29,17 @@ gulp.task('test', function (cb) { .pipe(istanbul.writeReports({reporters: ['text']})) // Creating the reports after tests runned .on('end', cb); }); +}); + +gulp.task('test', function (cb) { + gulp.src(['lib/**/*.js', 'main.js']) + .pipe(istanbul({includeUntested: true})) // Covering files + .pipe(istanbul.hookRequire()) + .on('finish', function () { + gulp.src(['test/*.html']) + .pipe(testFramework()) + .pipe(istanbul.writeReports({reporters: ['text']})) // Creating the reports after tests runned + .pipe(istanbul.enforceThresholds({ thresholds: { global: 90 } })) // + .on('end', cb); + }); }); \ No newline at end of file diff --git a/gulp-istanbul/gulp-istanbul.d.ts b/gulp-istanbul/gulp-istanbul.d.ts index bf7a13bb0..d917d64b1 100644 --- a/gulp-istanbul/gulp-istanbul.d.ts +++ b/gulp-istanbul/gulp-istanbul.d.ts @@ -1,4 +1,4 @@ -// Type definitions for gulp-istanbul +// Type definitions for gulp-istanbul v0.9.0 // Project: https://github.com/SBoudrias/gulp-istanbul // Definitions by: Asana // Definitions: https://github.com/borisyankov/DefinitelyTyped @@ -12,6 +12,7 @@ declare module "gulp-istanbul" { export function hookRequire(): NodeJS.ReadWriteStream; export function summarizeCoverage(opts?: {coverageVariable?: string}): Coverage; export function writeReports(opts?: ReportOptions): NodeJS.ReadWriteStream; + export function enforceThresholds(opts?: ThresholdOptions): NodeJS.ReadWriteStream; interface Options { coverageVariable?: string; @@ -45,7 +46,19 @@ declare module "gulp-istanbul" { reportOpts?: {dir?: string}; coverageVariable?: string; } + + interface ThresholdOptions { + coverageVariable?: string; + thresholds?: { global?: Coverage|number; each?: Coverage|number }; + } + + interface CoverageOptions { + lines?: number; + statements?: number; + functions?: number; + branches?: number; + } } export = GulpIstanbul; -} \ No newline at end of file +} diff --git a/highcharts/highcharts-tests.ts b/highcharts/highcharts-tests.ts index f1a4befd0..464f536d9 100644 --- a/highcharts/highcharts-tests.ts +++ b/highcharts/highcharts-tests.ts @@ -1,15 +1,33 @@ /// /// +Highcharts.setOptions({ + global: { + useUTC: false + } +}); -var animate: HighchartsBoolOrAnimation; -animate = true; -animate = { duration: 200, easing: "linear" }; +Highcharts.setOptions({ + lang: { + months: ['Janvier', 'Février', 'Mars', 'Avril', 'Mai', 'Juin', 'Juillet', 'Août', 'Septembre', 'Octobre', 'Novembre', 'Décembre'], + weekdays: ['Dimanche', 'Lundi', 'Mardi', 'Mercredi', 'Jeudi', 'Vendredi', 'Samedi'] + } +}); -var gradient: HighchartsColorOrGradient; -gradient = { - linearGradient: { x0: 0, y0: 0, x1: 500, y1: 500 }, +var animate: HighchartsAnimation = { + duration: 200, + easing: "linear" +}; + + +var gradient: HighchartsGradient = { + linearGradient: { + x0: 0, + y0: 0, + x1: 500, + y1: 500 + }, stops: [ [0, 'rgb(255, 255, 255)'], [1, 'rgb(200, 200, 255)'] @@ -18,22 +36,28 @@ gradient = { var color = "#fcfcff"; -var backgound: HighchartsColorOrGradient; - -backgound = gradient; -backgound = color; - var chart1 = new Highcharts.Chart({ chart: { renderTo: "container" }, xAxis: [{ }], - series: [{ - data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4] + series: [{ + data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4], + type: "line", + allowPointSelect: true }] }); + +chart1.addSeries({ + enableMouseTracking: true, + data: [1, 2, 3, 4, 5] +}); + + +console.log((chart1.series[0].options).dashStyle); + var chart2 = new Highcharts.Chart({ chart: { renderTo: 'container', @@ -63,7 +87,7 @@ var chart2 = new Highcharts.Chart({ legend: { enabled: false }, - series: [{ + series: [{ data: [ [550, 870], [738, 362], [719, 711], [547, 665], [595, 197], [332, 144], [581, 555], [196, 862], [6, 837], [400, 924], [888, 148], [785, 730], @@ -105,15 +129,11 @@ var highChartSettings: HighchartsOptions = { }, xAxis: [{ }], - series: [{ + series: [{ data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4] }] }; -var container = $("#container").highcharts(highChartSettings, function (chart) { +var container = $("#container").highcharts(highChartSettings, (chart) => { chart.series[0].setVisible(true, true); -}); - -var options = Highcharts.getOptions(); - -var options2 = Highcharts.setOptions(options); +}); \ No newline at end of file diff --git a/highcharts/highcharts.d.ts b/highcharts/highcharts.d.ts index 3b0801651..584d61c9b 100644 --- a/highcharts/highcharts.d.ts +++ b/highcharts/highcharts.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Highcharts 2.3.3 +// Type definitions for Highcharts 4.0.4 // Project: http://www.highcharts.com/ // Definitions by: Damiano Gambarotto // Definitions: https://github.com/borisyankov/DefinitelyTyped @@ -151,9 +151,6 @@ interface HighchartsAnimation { easing?: string; // "linear" | "swing" } -interface HighchartsBoolOrAnimation extends HighchartsAnimation { -} - interface HighchartsSelectionEvent extends Event { xAxis: HighchartsAxisOptions[]; yAxis: HighchartsAxisOptions[]; @@ -167,7 +164,7 @@ interface HighchartsChartEvents { selection?: (event: HighchartsSelectionEvent) => void; } -interface HighchartsColorOrGradient { +interface HighchartsGradient { linearGradient?: { x0: number; y0: number; x1: number; y1: number; }; @@ -175,12 +172,11 @@ interface HighchartsColorOrGradient { cx: number; cy: number; r: number; }; stops?: any[][]; - - brighten?(amount: number): HighchartsColorOrGradient; - get?(type: string): string; + brighten? (amount: number): string | HighchartsGradient; + get? (type: string): string; } -interface HighchartsBoolOrShadow { +interface HighchartsShadow { color?: string; offsetX?: number; offsetY?: number; @@ -191,21 +187,21 @@ interface HighchartsBoolOrShadow { interface HighchartsChartResetZoomButton { position: HighchartsPosition; relativeTo?: string; - theme?: HighchartsChartResetZoomButtonTheme; //TO DO + theme?: HighchartsChartResetZoomButtonTheme; } interface HighchartsChartResetZoomButtonTheme { - fill?:string; //css HEX colours. + 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' + display?: string; // css attr eg: 'none' } interface HighchartsChartOptions { alignTicks?: boolean; - animation?: HighchartsBoolOrAnimation; - backgroundColor?: HighchartsColorOrGradient; + animation?: boolean | HighchartsAnimation; + backgroundColor?: string | HighchartsGradient; borderColor?: string; borderRadius?: number; borderWidth?: number; @@ -220,17 +216,17 @@ interface HighchartsChartOptions { marginLeft?: number; marginRight?: number; marginTop?: number; - plotBackGroundColor?: HighchartsColorOrGradient; + plotBackGroundColor?: string | HighchartsGradient; plotBackGroundImage?: string; plotBorderColor?: string; plotBorderWidth?: number; - plotShadow?: HighchartsBoolOrShadow; + plotShadow?: boolean | HighchartsShadow; polar?: boolean; reflow?: boolean; renderTo?: any; resetZoomButton?: HighchartsChartResetZoomButton; selectionMarkerFill?: string; - shadow?: HighchartsBoolOrShadow; + shadow?: boolean | HighchartsShadow; showAxes?: boolean; spacingBottom?: number; spacingLeft?: number; @@ -272,7 +268,7 @@ interface HighchartsMenuItem { interface HighchartsButton { align?: string; - backgroundColor?: HighchartsColorOrGradient; + backgroundColor?: string | HighchartsGradient; borderColor?: string; borderRadius?: number; borderWidth?: number; @@ -309,9 +305,11 @@ interface HighchartsExportingOptions { width?: number; } -interface HighchartsGlobalOptions { +interface HighchartsGlobalObject { + Date?: any; VMLRadialGradientURL?: string; canvasToolsURL?: string; + timezoneOffset?: number; useUTC?: boolean; } @@ -325,17 +323,19 @@ interface HighchartsLabelsOptions { style?: HighchartsCSSObject; } -interface HighchartsLangOptions { +interface HighchartsLangObject { + contextButtonTitle?: string; decimalPoint?: string; downloadJPEG?: string; downloadPDF?: string; downloadPNG?: string; downloadSVG?: string; - exportButtonTitle?: string; + drillUpText?: string; loading?: string; months?: string[]; + noData?: string; numericSymbols?: string[]; - printButtonTitle?: string; + printChart?: string; resetZoom?: string; resetZoomTitle?: string; shortMonths?: string[]; @@ -345,7 +345,7 @@ interface HighchartsLangOptions { interface HighchartsLegendNavigationOptions { activeColor?: string; - animation?: HighchartsBoolOrAnimation; + animation?: boolean | HighchartsAnimation; arrowSize?: number; inactiveColor?: string; style?: HighchartsCSSObject; @@ -353,7 +353,7 @@ interface HighchartsLegendNavigationOptions { interface HighchartsLegendOptions { align?: string; - backgroundColor?: HighchartsColorOrGradient; + backgroundColor?: string | HighchartsGradient; borderColor?: string; borderRadius?: number; borderWidth?: number; @@ -375,7 +375,7 @@ interface HighchartsLegendOptions { reversed?: boolean; rtl?: boolean; verticalAlign?: string; - shadow?: HighchartsBoolOrShadow; + shadow?: boolean | HighchartsShadow; style?: HighchartsCSSObject; symbolPadding?: number; symbolWidth?: number; @@ -401,7 +401,7 @@ interface HighchartsNavigationOptions { // Not sure of this interface interface HighchartsPaneBackground { - backgroundColor: HighchartsColorOrGradient; + backgroundColor: string | HighchartsGradient; borderColor?: string; borderWidth?: number; innerRadius?: string; @@ -410,14 +410,15 @@ interface HighchartsPaneBackground { interface HighchartsPaneOptions { background?: HighchartsPaneBackground[]; - center?: any[]; // [x,y] | ["50%","50%" ] + center?: [number|string, number|string]; // [x,y] | ["50%","50%" ] endAngle?: number; + size?: number | string; startAngle?: number; } interface HighchartsDataLabels { align?: string; - backgroundColor?: HighchartsColorOrGradient; + backgroundColor?: string | HighchartsGradient; borderColor?: string; borderRadius?: number; borderWidth?: number; @@ -428,7 +429,7 @@ interface HighchartsDataLabels { overflow?: string; padding?: number; rotation?: number; - shadow?: HighchartsBoolOrShadow; + shadow?: boolean | HighchartsShadow; staggerLines?: any; // ?? need to check API step?: any; // ?? need to check API style?: HighchartsCSSObject; @@ -492,63 +493,23 @@ interface HighchartsBarStates extends HighchartsAreaStates { brightness?: number; } -interface HighchartsAreaChart { - allowPointSelect?: boolean; - animation?: boolean; - color?: string; - connectEnds?: boolean; - connectNulls?: boolean; - cropThreshold?: number; - cursor?: string; - dashStyle?: string; //Solid ShortDash ShortDot ShortDashDot ShortDashDotDot Dot Dash LongDash DashDot LongDashDot LongDashDotDot - dataLabels?: HighchartsDataLabels; - enableMouseTracking?: boolean; - events?: HighchartsPlotEvents; - fillColor?: HighchartsColorOrGradient; - fillOpacity?: boolean; - id?: string; - lineColor?: string; - lineWidth?: number; - marker?: HighchartsMarker; - point?: { - events: HighchartsPointEvents; - }; - pointInterval?: number; - pointPlacement?: string; // null, "on", "between" - pointStart?: number; - selected?: boolean; - shadow?: HighchartsBoolOrShadow; - showCheckbox?: boolean; - showInLegend?: boolean; - stacking?: string; - states?: { - hover: HighchartsAreaStates; - }; - stickyTracking?: boolean; - threshold?: number; - tooltip?: HighchartsTooltipOptions; - trackByArea?: boolean; - turboThreshold?: number; - visible?: number; - zIndex?: number; -} - interface HighchartsRangeDataLabels { align?: string; - backgroundColor?: HighchartsColorOrGradient; + backgroundColor?: string | HighchartsGradient; borderColor?: string; borderRadius?: number; borderWidth?: number; color?: string; crop?: boolean; + defer?: boolean; enabled?: boolean; + format?: string; formatter?: () => any; + inside?: boolean; overflow?: string; padding?: number; rotation?: number; - shadow?: HighchartsBoolOrShadow; - staggerLines?: any; // ?? need to check API - step?: any; // ?? need to check API + shadow?: boolean | HighchartsShadow; style?: HighchartsCSSObject; useHTML?: boolean; verticalAlign?: string; @@ -556,125 +517,6 @@ interface HighchartsRangeDataLabels { xLow?: number; yHigh?: number; yLow?: number; -} - -interface HighchartsAreaRangeChart { - allowPointSelect?: boolean; - animation?: boolean; - color?: string; - connectNulls?: boolean; - cropThreshold?: number; - cursor?: string; - dashStyle?: string; //Solid ShortDash ShortDot ShortDashDot ShortDashDotDot Dot Dash LongDash DashDot LongDashDot LongDashDotDot - dataLabels?: HighchartsRangeDataLabels; - enableMouseTracking?: boolean; - events?: HighchartsPlotEvents; - fillColor?: HighchartsColorOrGradient; - fillOpacity?: boolean; - id?: string; - lineColor?: string; - lineWidth?: number; - point?: { - events: HighchartsPointEvents; - }; - pointInterval?: number; - pointPlacement?: string; // null, "on", "between" - pointStart?: number; - selected?: boolean; - shadow?: HighchartsBoolOrShadow; - showCheckbox?: boolean; - showInLegend?: boolean; - stacking?: string; - states?: { - hover: HighchartsAreaStates; - }; - stickyTracking?: boolean; - threshold?: number; - trackByArea?: boolean; - turboThreshold?: number; - visible?: number; - zIndex?: number; -} - -interface HighchartsBarChart { - allowPointSelect?: boolean; - animation?: boolean; - borderColor?: string; - borderRadius?: number; - borderWidth?: number; - color?: string; - colorByPoint?: boolean; - cropThreshold?: number; - cursor?: string; - dataLabels?: HighchartsDataLabels; - enableMouseTracking?: boolean; - events?: HighchartsPlotEvents; - groupPadding?: number; - grouping?: boolean; - id?: string; - minPointLength?: number; - point?: { - events: HighchartsPointEvents; - }; - pointInterval?: number; - pointPadding?: number; - pointPlacement?: string; // null, "on", "between" - pointRange?: number; - pointStart?: number; - pointWidth?: number; - selected?: boolean; - shadow?: HighchartsBoolOrShadow; - showCheckbox?: boolean; - showInLegend?: boolean; - stacking?: string; - states?: { - hover: HighchartsBarStates; - }; - stickyTracking?: boolean; - tooltip?: HighchartsTooltipOptions; - turboThreshold?: number; - visible?: number; - zIndex?: number; -} - -interface HighchartsColumnRangeChart { - allowPointSelect?: boolean; - animation?: boolean; - borderColor?: string; - borderRadius?: number; - borderWidth?: number; - color?: string; - colorByPoint?: boolean; - cropThreshold?: number; - cursor?: string; - dataLabels?: HighchartsRangeDataLabels; - enableMouseTracking?: boolean; - events?: HighchartsPlotEvents; - groupPadding?: number; - grouping?: boolean; - id?: string; - minPointLength?: number; - point?: { - events: HighchartsPointEvents; - }; - pointInterval?: number; - pointPadding?: number; - pointPlacement?: string; // null, "on", "between" - pointRange?: number; - pointStart?: number; - pointWidth?: number; - selected?: boolean; - shadow?: HighchartsBoolOrShadow; - showCheckbox?: boolean; - showInLegend?: boolean; - stacking?: string; - states?: { - hover: HighchartsBarStates; - }; - stickyTracking?: boolean; - tooltip?: HighchartsTooltipOptions; - turboThreshold?: number; - visible?: number; zIndex?: number; } @@ -696,6 +538,283 @@ interface HighchartsPivot { radius?: number; } +interface HighchartsAreaChart { + allowPointSelect?: boolean; + animation?: boolean; + color?: string; + connectEnds?: boolean; + connectNulls?: boolean; + cropThreshold?: number; + cursor?: string; + dashStyle?: string; //Solid ShortDash ShortDot ShortDashDot ShortDashDotDot Dot Dash LongDash DashDot LongDashDot LongDashDotDot + dataLabels?: HighchartsDataLabels; + enableMouseTracking?: boolean; + events?: HighchartsPlotEvents; + fillColor?: string | HighchartsGradient; + fillOpacity?: number; + linkedTo?: string; + lineColor?: string; + lineWidth?: number; + marker?: HighchartsMarker; + negativeColor?: string; + negativeFillColor?: string; + point?: { + events: HighchartsPointEvents; + }; + pointInterval?: number; + pointPlacement?: string | number; // null, "on", "between" + pointStart?: number; + selected?: boolean; + shadow?: boolean | HighchartsShadow; + showCheckbox?: boolean; + showInLegend?: boolean; + stacking?: string; + states?: { + hover: HighchartsAreaStates; + }; + step?: string; + stickyTracking?: boolean; + threshold?: number; + tooltip?: HighchartsTooltipOptions; + trackByArea?: boolean; + turboThreshold?: number; + visible?: boolean; + zIndex?: number; +} + +interface HighchartsAreaRangeChart { + allowPointSelect?: boolean; + animation?: boolean; + color?: string; + connectNulls?: boolean; + cropThreshold?: number; + cursor?: string; + dashStyle?: string; //Solid ShortDash ShortDot ShortDashDot ShortDashDotDot Dot Dash LongDash DashDot LongDashDot LongDashDotDot + dataLabels?: HighchartsRangeDataLabels; + enableMouseTracking?: boolean; + events?: HighchartsPlotEvents; + fillColor?: string | HighchartsGradient; + fillOpacity?: number; + lineColor?: string; + lineWidth?: number; + linkedTo?: string; + negativeColor?: string; + negativeFillColor?: string; + point?: { + events: HighchartsPointEvents; + }; + pointInterval?: number; + pointPlacement?: string | number; // null, "on", "between" + pointStart?: number; + selected?: boolean; + shadow?: boolean | HighchartsShadow; + showCheckbox?: boolean; + showInLegend?: boolean; + stacking?: string; + states?: { + hover: HighchartsAreaStates; + }; + step?: string; + stickyTracking?: boolean; + tooltip?: HighchartsTooltipOptions; + threshold?: number; + trackByArea?: boolean; + turboThreshold?: number; + visible?: boolean; +} + +interface HighchartsAreaSplineChart extends HighchartsAreaChart { + connectEnds?: boolean; +} + +interface HighchartsAreaSplineRangeChart extends HighchartsAreaRangeChart { +} + +interface HighchartsBarChart { + allowPointSelect?: boolean; + animation?: boolean; + borderColor?: string; + borderRadius?: number; + borderWidth?: number; + color?: string; + colorByPoint?: boolean; + cropThreshold?: number; + colors?: string[]; + cursor?: string; + dataLabels?: HighchartsDataLabels; + depth?: number; + edgeColor?: string; + edgeWidth?: number; + enableMouseTracking?: boolean; + events?: HighchartsPlotEvents; + groupPadding?: number; + groupZPadding?: number; + grouping?: boolean; + linkedTo?: string; + minPointLength?: number; + negativeColor?: string; + point?: { + events: HighchartsPointEvents; + }; + pointInterval?: number; + pointPadding?: number; + pointPlacement?: string; // null, "on", "between" + pointRange?: number; + pointStart?: number; + pointWidth?: number; + selected?: boolean; + shadow?: boolean | HighchartsShadow; + showCheckbox?: boolean; + showInLegend?: boolean; + stacking?: string; + states?: { + hover: HighchartsBarStates; + }; + stickyTracking?: boolean; + threshold?: number; + tooltip?: HighchartsTooltipOptions; + turboThreshold?: number; + visible?: boolean; +} + +interface HighchartsBoxPlotChart { + allowPointSelect?: boolean; + color?: string; + colorByPoint?: boolean; + colors?: string[]; + cursor?: string; + depth?: number; + edgecolor?: string; + edgewidth?: number; + enableMouseTracking?: boolean; + events?: HighchartsPlotEvents; + fillColor?: string; + groupPadding?: number; + groupZPadding?: number; + grouping?: boolean; + lineWidth?: number; + linkedTo?: string; + medianColor?: string; + negativeColor?: string; + point?: { + events: HighchartsPointEvents; + }; + pointInterval?: number; + pointPadding?: number; + pointPlacement?: string | number; + pointRange?: number; + pointStart?: number; + pointWidth?: number; + selected?: boolean; + showCheckbox?: boolean; + showInLegend?: boolean; + states?: { + hover: HighchartsBarStates; + }; + stemColor?: string; + stemDashStyle?: string; + stemWidth?: number; + stickyTracking?: boolean; + tooltip?: HighchartsTooltipOptions; + turboThreshold?: number; + visible?: boolean; + whiskerColor?: string; + whiskerLength?: number | string; // 100 | "50%" + whiskerWidth?: number; +} + +interface HighchartsBubbleChart { + allowPointSelect?: boolean; + animation?: boolean; + color?: string; + cropThreshold?: number; + cursor?: string; + dashStyle?: string; //Solid ShortDash ShortDot ShortDashDot ShortDashDotDot Dot Dash LongDash DashDot LongDashDot LongDashDotDot + dataLabels?: HighchartsRangeDataLabels; + displayNegative?: boolean; + enableMouseTracking?: boolean; + events?: HighchartsPlotEvents; + lineWidth?: number; + linkedTo?: string; + marker?: HighchartsMarker; + maxSize?: string; + minSize?: string; + negativeColor?: string; + point?: { + events: HighchartsPointEvents; + }; + pointInterval?: number; + pointStart?: number; + selected?: boolean; + shadow?: boolean | HighchartsShadow; + showCheckbox?: boolean; + showInLegend?: boolean; + sizeBy?: string; + states?: { + hover: HighchartsBarStates; + }; + stickyTracking?: boolean; + tooltip?: HighchartsTooltipOptions; + turboThreshold?: number; + visible?: boolean; + zMax?: number; + zMin?: number; + zThreshold?: number; +} + +interface HighchartsColumnChart extends HighchartsBarChart { +} + +interface HighchartsColumnRangeChart { + allowPointSelect?: boolean; + animation?: boolean; + borderColor?: string; + borderRadius?: number; + borderWidth?: number; + color?: string; + colorByPoint?: boolean; + colors?: string[]; + cropThreshold?: number; + cursor?: string; + dataLabels?: HighchartsRangeDataLabels; + enableMouseTracking?: boolean; + events?: HighchartsPlotEvents; + groupPadding?: number; + grouping?: boolean; + linkedTo?: string; + minPointLength?: number; + negativeColor?: string; + point?: { + events: HighchartsPointEvents; + }; + pointInterval?: number; + pointPadding?: number; + pointPlacement?: string | number; // null, "on", "between" + pointRange?: number; + pointStart?: number; + pointWidth?: number; + selected?: boolean; + shadow?: boolean | HighchartsShadow; + showCheckbox?: boolean; + showInLegend?: boolean; + stacking?: string; + states?: { + hover: HighchartsBarStates; + }; + stickyTracking?: boolean; + tooltip?: HighchartsTooltipOptions; + turboThreshold?: number; + visible?: boolean; +} + +interface HighchartsErrorBarChart { + // TODO +} + +interface HighchartsFunnelChart { + // TODO +} + interface HighchartsGaugeChart { animation?: boolean; color?: string; @@ -721,6 +840,10 @@ interface HighchartsGaugeChart { zIndex?: number; } +interface HighchartsHeatMapChart { + // TODO +} + interface HighchartsLineChart { allowPointSelect?: boolean; animation?: boolean; @@ -743,7 +866,7 @@ interface HighchartsLineChart { pointPlacement?: string; // null, "on", "between" pointStart?: number; selected?: boolean; - shadow?: HighchartsBoolOrShadow; + shadow?: boolean | HighchartsShadow; showCheckbox?: boolean; showInLegend?: boolean; stacking?: string; @@ -771,7 +894,7 @@ interface HighchartsPieChart { events?: HighchartsPlotEvents; id?: string; ignoreHiddenPoint?: boolean; - innerSize?: any; // string or number; + innerSize?: number | string; lineWidth?: number; marker?: HighchartsMarker; point?: { @@ -779,9 +902,9 @@ interface HighchartsPieChart { }; pointPlacement?: string; // null, "on", "between" selected?: boolean; - shadow?: HighchartsBoolOrShadow; + shadow?: boolean | HighchartsShadow; showInLegend?: boolean; - size?: any; // string or number; + size?: number | string; slicedOffset?: number; states?: { hover: HighchartsAreaStates; @@ -792,6 +915,14 @@ interface HighchartsPieChart { zIndex?: number; } +interface HighchartsPolygonChart { + // TODO +} + +interface HighchartsPyramidChart { + // TODO +} + interface HighchartsScatterChart { allowPointSelect?: boolean; animation?: boolean; @@ -813,7 +944,7 @@ interface HighchartsScatterChart { pointPlacement?: string; // null, "on", "between" pointStart?: number; selected?: boolean; - shadow?: HighchartsBoolOrShadow; + shadow?: boolean | HighchartsShadow; showCheckbox?: boolean; showInLegend?: boolean; states?: { @@ -826,6 +957,22 @@ interface HighchartsScatterChart { zIndex?: number; } +interface HighchartsSolidGaugeChart { + // TODO +} + +interface HighchartsSplineChart extends HighchartsSeriesChart { +} + +interface HighchartsTreeMapChart { + // TODO +} + +interface HighchartsWaterFallChart { + // TODO +} + + // General options for all series types interface HighchartsSeriesChart { allowPointSelect?: boolean; @@ -849,7 +996,7 @@ interface HighchartsSeriesChart { pointPlacement?: string; // null, "on", "between" pointStart?: number; selected?: boolean; - shadow?: HighchartsBoolOrShadow; + shadow?: boolean | HighchartsShadow; showCheckbox?: boolean; showInLegend?: boolean; stacking?: string; @@ -863,25 +1010,71 @@ interface HighchartsSeriesChart { zIndex?: number; } -interface HighchartsSplineChart extends HighchartsSeriesChart { -} - interface HighchartsPlotOptions { area?: HighchartsAreaChart; arearange?: HighchartsAreaRangeChart; - areaspline?: HighchartsAreaChart; - areasplinerange?: HighchartsAreaRangeChart; + areaspline?: HighchartsAreaSplineChart; + areasplinerange?: HighchartsAreaSplineRangeChart; bar?: HighchartsBarChart; - column?: HighchartsBarChart; + boxplot?: HighchartsBoxPlotChart; + bubble?: HighchartsBubbleChart; + column?: HighchartsColumnChart; columnrange?: HighchartsColumnRangeChart; + errorbar?: HighchartsErrorBarChart; + funnel?: HighchartsFunnelChart; gauge?: HighchartsGaugeChart; + heatmap?: HighchartsHeatMapChart; line?: HighchartsLineChart; pie?: HighchartsPieChart; + polygon?: HighchartsPolygonChart; + pyramid?: HighchartsPyramidChart; scatter?: HighchartsScatterChart; series?: HighchartsSeriesChart; + solidgauge?: HighchartsSolidGaugeChart; spline?: HighchartsSplineChart; + treemap?: HighchartsTreeMapChart; + waterfall?: HighchartsWaterFallChart; } +/* You will rarely, if ever, want to use this interface directly. Instead it is much more useful to use one of the derived + * interfaces (HighchartsAreaChartSeriesOptions, HighchartsLineChartSeriesOptions, etc.) + */ +interface HighchartsIndividualSeriesOptions { + data?: number[]|[number, number][]| HighchartsDataPoint[]; // [value1,value2, ... ] | [[x1,y1],[x2,y2],... ] | HighchartsDataPoint[] + index?: number; + legendIndex?: number; + name?: string; + stack?: any; // type doesn't matter, as long as grouped series' stack options match each other. + type?: string; + xAxis?: number; + yAxis?: number; +} + +interface HighchartsSeriesOptions extends HighchartsIndividualSeriesOptions, HighchartsSeriesChart { } + +interface HighchartsAreaChartSeriesOptions extends HighchartsIndividualSeriesOptions, HighchartsAreaChart { } +interface HighchartsAreaRangeChartSeriesOptions extends HighchartsIndividualSeriesOptions, HighchartsAreaRangeChart { } +interface HighchartsAreaSplineChartSeriesOptions extends HighchartsIndividualSeriesOptions, HighchartsAreaSplineChart { } +interface HighchartsAreaSplineRangeChartSeriesOptions extends HighchartsIndividualSeriesOptions, HighchartsAreaSplineRangeChart { } +interface HighchartsBarChartSeriesOptions extends HighchartsIndividualSeriesOptions, HighchartsBarChart { } +interface HighchartsBoxPlotChartSeriesOptions extends HighchartsIndividualSeriesOptions, HighchartsBoxPlotChart { } +interface HighchartsBubbleChartSeriesOptions extends HighchartsIndividualSeriesOptions, HighchartsBubbleChart { } +interface HighchartsColumnChartSeriesOptions extends HighchartsIndividualSeriesOptions, HighchartsColumnChart { } +interface HighchartsColumnRangeChartSeriesOptions extends HighchartsIndividualSeriesOptions, HighchartsColumnRangeChart { } +interface HighchartsErrorBarChartSeriesOptions extends HighchartsIndividualSeriesOptions, HighchartsErrorBarChart { } +interface HighchartsFunnelChartSeriesOptions extends HighchartsIndividualSeriesOptions, HighchartsFunnelChart { } +interface HighchartsGaugeChartSeriesOptions extends HighchartsIndividualSeriesOptions, HighchartsGaugeChart { } +interface HighchartsHeatMapSeriesOptions extends HighchartsIndividualSeriesOptions, HighchartsHeatMapChart { } +interface HighchartsLineChartSeriesOptions extends HighchartsIndividualSeriesOptions, HighchartsLineChart { } +interface HighchartsPieChartSeriesOptions extends HighchartsIndividualSeriesOptions, HighchartsPieChart { } +interface HighchartsPolygonChartSeriesOptions extends HighchartsIndividualSeriesOptions, HighchartsPolygonChart { } +interface HighchartsPyramidChartSeriesOptions extends HighchartsIndividualSeriesOptions, HighchartsPyramidChart { } +interface HighchartsScatterChartSeriesOptions extends HighchartsIndividualSeriesOptions, HighchartsScatterChart { } +interface HighchartsSolidGaugeChartSeriesOptions extends HighchartsIndividualSeriesOptions, HighchartsSolidGaugeChart { } +interface HighchartsSplineChartSeriesOptions extends HighchartsIndividualSeriesOptions, HighchartsSplineChart { } +interface HighchartsTreeMapChartSeriesOptions extends HighchartsIndividualSeriesOptions, HighchartsTreeMapChart { } +interface HighchartsWaterFallChartSeriesOptions extends HighchartsIndividualSeriesOptions, HighchartsWaterFallChart { } + interface HighchartsDataPoint { color?: string; dataLabels?: HighchartsDataLabels; @@ -895,13 +1088,13 @@ interface HighchartsDataPoint { y?: number; } -interface HighchartsSeriesOptions extends HighchartsSeriesChart{ - data?: any[]; // [value1,value2, ... ] | [[x1,y1],[x2,y2],... ] | HighchartsDataPoint[] +interface HighchartsSeriesOptions extends HighchartsSeriesChart { + type?: string; + data?: number[]| number[][]| HighchartsDataPoint[]; index?: number; legendIndex?: number; name?: string; - stack?: any; // String | Number | any to match - type?: string; + stack?: string | number; xAxis?: number; yAxis?: number; } @@ -935,11 +1128,11 @@ interface HighchartsPlotPoint { interface HighchartsTooltipOptions { animation?: boolean; - backgroundColor?: HighchartsColorOrGradient; + backgroundColor?: string | HighchartsGradient; borderColor?: string; borderRadius?: number; borderWidth?: number; - crosshairs?: any; // boolean | [boolean,bool] | CrosshairObject | [CrosshairObject,CrosshairObject] + crosshairs?: boolean |[boolean, boolean]| HighchartsCrosshairObject |[HighchartsCrosshairObject, HighchartsCrosshairObject]; enabled?: boolean; footerFormat?: string; formatter?: () => any; @@ -960,16 +1153,17 @@ interface HighchartsOptions { chart?: HighchartsChartOptions; colors?: string[]; credits?: HighchartsCreditsOptions; + data?: any; // TODO + drilldown?: any; // TODO exporting?: HighchartsExportingOptions; - global?: HighchartsGlobalOptions; labels?: HighchartsLabelsOptions; - lang?: HighchartsLangOptions; legend?: HighchartsLegendOptions; loading?: HighchartsLoadingOptions; navigation?: HighchartsNavigationOptions; + noData?: any; // TODO pane?: HighchartsPaneOptions; plotOptions?: HighchartsPlotOptions; - series?: HighchartsSeriesOptions[]; + series?: HighchartsIndividualSeriesOptions[]; subtitle?: HighchartsSubtitleOptions; title?: HighchartsTitleOptions; tooltip?: HighchartsTooltipOptions; @@ -977,6 +1171,10 @@ interface HighchartsOptions { yAxis?: HighchartsAxisOptions; } +interface HighchartsGlobalOptions extends HighchartsOptions { + global?: HighchartsGlobalObject; + lang?: HighchartsLangObject; +} interface HighchartsAxisObject { addPlotBand(options: HighchartsPlotBands): void; @@ -988,22 +1186,22 @@ interface HighchartsAxisObject { setCategories(categories: string[], redraw: boolean): void; setExtremes(min: number, max: number): void; setExtremes(min: number, max: number, redraw: boolean): void; - setExtremes(min: number, max: number, redraw: boolean, animation: HighchartsBoolOrAnimation): void; + setExtremes(min: number, max: number, redraw: boolean, animation: boolean | HighchartsAnimation): void; setTitle(title: HighchartsAxisTitle): void; setTitle(title: HighchartsAxisTitle, redraw: boolean): void; } interface HighchartsChartObject { - addSeries(options: HighchartsSeriesOptions, redraw?: boolean, animation?: boolean): HighchartsSeriesOptions; - addSeries(options: HighchartsSeriesOptions, redraw?: boolean, animation?: HighchartsAnimation): HighchartsSeriesOptions; - addAxis(options: HighchartsAxisOptions, isX?: boolean, redraw?: boolean, animation?: boolean): HighchartsAxisObject; - addAxis(options: HighchartsAxisOptions, isX?: boolean, redraw?: boolean, animation?: HighchartsAnimation): HighchartsAxisObject; + addAxis(options: HighchartsAxisOptions, isX?: boolean, redraw?: boolean, animation?: boolean | HighchartsAnimation): HighchartsAxisObject; + addSeries(options: T, redraw?: boolean, animation?: boolean | HighchartsAnimation): T; + addSeriesAsDrilldown(point: HighchartsPointObject, seriesOptions: HighchartsSeriesOptions): void; container: HTMLElement; destroy(): void; + drillUp(): void; exportChart(): void; exportChart(options: HighchartsExportingOptions): void; exportChart(options: HighchartsExportingOptions, chartOptions: HighchartsChartOptions): void; - get(id: string): any; // Axis|Series|Point + get(id: string): HighchartsAxisObject | HighchartsSeriesObject | HighchartsPointObject; getSVG(): string; getSVG(additionalOptions: HighchartsChartOptions): string; getSelectedPoints(): HighchartsPointObject[]; @@ -1012,12 +1210,14 @@ interface HighchartsChartObject { options: HighchartsChartOptions; print(): void; redraw(): void; + reflow(): void; series: HighchartsSeriesObject[]; setSize(width: number, height: number): void; - setSize(width: number, height: number, anumation: boolean): void; - setSize(width: number, height: number, anumation: HighchartsAnimation): void; + setSize(width: number, height: number, animation: boolean): void; + setSize(width: number, height: number, animation: HighchartsAnimation): void; setTitle(title: HighchartsTitleOptions): void; setTitle(title: HighchartsTitleOptions, subtitle: HighchartsSubtitleOptions): void; + setTitle(title: HighchartsTitleOptions, subtitle: HighchartsSubtitleOptions, redraw: boolean): void; showLoading(): void; showLoading(str: string): void; xAxis: HighchartsAxisObject[]; @@ -1028,17 +1228,18 @@ interface HighchartsChartObject { interface HighchartsChart { new (options: HighchartsOptions): HighchartsChartObject; - new (options: HighchartsOptions, callback: (chart: HighchartsChartObject) => void ): HighchartsChartObject; + new (options: HighchartsOptions, callback: (chart: HighchartsChartObject) => void): HighchartsChartObject; } interface HighchartsElementObject { add(): HighchartsElementObject; add(parent: HighchartsElementObject): HighchartsElementObject; + animate(attributes: any, animation?: any): HighchartsElementObject; attr(hash: any): HighchartsElementObject; css(hash: HighchartsCSSObject): HighchartsElementObject; destroy(): void; getBBox(): { x: number; y: number; height: number; width: number; }; - on(eventType: string, handler: () => void ): HighchartsElementObject; + on(eventType: string, handler: () => void): HighchartsElementObject; toFront(): HighchartsElementObject; } @@ -1059,19 +1260,20 @@ interface HighchartsRenderer { interface HighchartsStatic { Chart: HighchartsChart; Renderer: HighchartsRenderer; - Color(color: HighchartsColorOrGradient): HighchartsColorOrGradient; + Color(color: string | HighchartsGradient): string | HighchartsGradient; dateFormat(format: string, time?: number, capitalize?: boolean): string; numberFormat(value: number, decimals?: number, decimalPoint?: string, thousandsSep?: string): string; - setOptions(options: HighchartsOptions): HighchartsOptions; + setOptions(options: HighchartsGlobalOptions): HighchartsOptions; getOptions(): HighchartsOptions; map(array: any[], fn: Function): any[]; } + declare var Highcharts: HighchartsStatic; interface HighchartsPointObject { - category: any; // String|Number + category: string | number; percentage: number; remove(): void; remove(redraw: boolean): void; @@ -1087,6 +1289,7 @@ interface HighchartsPointObject { slice(sliced: boolean, redraw: boolean): void; slice(sliced: boolean, redraw: boolean, animation: boolean): void; slice(sliced: boolean, redraw: boolean, animation: HighchartsAnimation): void; + total: number; update(options: any): void; update(options: any, redraw: boolean): void; update(options: any, redraw: boolean, animation: boolean): void; @@ -1096,20 +1299,19 @@ interface HighchartsPointObject { } interface HighchartsSeriesObject { - addPoint(options: any): void; - addPoint(options: any, redraw: boolean, shift: boolean): void; - addPoint(options: any, redraw: boolean, shift: boolean, animation: boolean): void; - addPoint(options: any, redraw: boolean, shift: boolean, animation: HighchartsAnimation): void; + addPoint(options: number |[number, number]| HighchartsDataPoint): void; + addPoint(options: number |[number, number]| HighchartsDataPoint, redraw: boolean, shift: boolean): void; + addPoint(options: number |[number, number]| HighchartsDataPoint, redraw: boolean, shift: boolean, animation: boolean): void; + addPoint(options: number |[number, number]| HighchartsDataPoint, redraw: boolean, shift: boolean, animation: HighchartsAnimation): void; chart: HighchartsChartObject; data: HighchartsDataPoint[]; hide(): void; + name: string; options: HighchartsSeriesOptions; remove(): void; remove(redraw: boolean): void; - name: string; - points: HighchartsPointObject[]; select(): void; - select(selected?: boolean): void; + select(selected: boolean): void; selected: boolean; setData(data: number[]): void; // [value1,value2, ... ] setData(data: number[], redraw: boolean): void; @@ -1121,6 +1323,7 @@ interface HighchartsSeriesObject { setVisible(visible: boolean, redraw: boolean): void; show(): void; type: string; + update(options: HighchartsSeriesOptions, redraw?: boolean): void; visible: boolean; xAxis: HighchartsAxisObject; yAxis: HighchartsAxisObject; diff --git a/highcharts/highstock-tests.ts b/highcharts/highstock-tests.ts new file mode 100644 index 000000000..fac6fa676 --- /dev/null +++ b/highcharts/highstock-tests.ts @@ -0,0 +1,64 @@ +/// + +var someData = [1, 2, 3, 4, 5, 6, 7, 8, 9]; + +$(function () { + $('#container').highcharts('StockChart', { + + chart: { + type: "arearange" + }, + + navigator: { + height: 80, + maskFill: 'rgba(255, 198, 220, 0.75)', + handles: { + backgroundColor: 'yellow', + borderColor: 'red' + } + }, + + rangeSelector: { + allButtonsEnabled: true, + selected: 1, + buttonTheme: { // styles for the buttons + fill: 'none', + stroke: 'none', + 'stroke-width': 0, + r: 8, + style: { + color: '#039', + fontWeight: 'bold' + }, + states: { + hover: { + }, + select: { + fill: '#039', + style: { + color: 'white' + } + } + } + }, + inputBoxBorderColor: 'gray', + inputBoxWidth: 120, + inputBoxHeight: 18, + inputStyle: { + color: '#039', + fontWeight: 'bold' + }, + labelStyle: { + color: 'silver', + fontWeight: 'bold' + } + }, + + series: [{ + name: 'USD to EUR', + data: someData, + lineColor: "blue" + }] + }); +}); + diff --git a/highcharts/highstock.d.ts b/highcharts/highstock.d.ts new file mode 100644 index 000000000..162d15655 --- /dev/null +++ b/highcharts/highstock.d.ts @@ -0,0 +1,120 @@ +// Type definitions for Highstock 2.1.5 +// Project: http://www.highcharts.com/ +// Definitions by: David Deutsch +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +interface HighstockChartObject extends HighchartsChartObject { + options: HighstockOptions; +} + +interface HighstockNavigatorOptions { + adaptToUpdatedData?: boolean; + baseSeries?: string | number; + enabled?: boolean; + handles?: { + backgoundColor?: string; + borderColor?: string; + }; + height?: number; + margin?: number; + maskFill?: string; + maskInside?: boolean; + outlineColor?: string; + outlineWidth?: number; + series?: HighchartsIndividualSeriesOptions; + xAxis?: HighchartsAxisOptions; + yAxis?: HighchartsAxisOptions; +} + +interface RangeSelectorButton { + type: string; //Defines the timespan, can be one of 'millisecond', 'second', 'minute', 'day', 'week', 'month', 'ytd' (year to date), 'year' and 'all'. + count: number; + text: string; + dataGrouping?: any; //not sure how this works +} + +interface HighstockRangeSelectorOptions { + allButtonsEnabled?: boolean; + buttonSpacing?: number; + buttonTheme?: any; + buttons?: RangeSelectorButton[]; + enabled?: boolean; + inputBoxBorderColor?: string; + inputBoxHeight?: number; + inputBoxWidth?: number; + inputDateFormat?: string; + inputDateParser?: (date: string) => number; + inputEditDateFormat?: string; + inputEnabled?: boolean; + inputPosition?: { + align?: string; + verticalAlign?: string; + x?: number; + y?: number; + }; + inputStyle?: HighchartsCSSObject; + labelStyle?: HighchartsCSSObject; + selected?: number; +} + +interface HighstockScrollbarOptions { + barBackgroundColor?: string; + barBorderColor?: string; + barBorderRadius?: number; + barBorderWidth?: number; + buttonArrowColor?: string; + buttonBackgroundColor?: string; + buttonBorderColor?: string; + buttonBorderRadius?: number; + buttonBorderWidth?: number; + enabled?: boolean; + height?: number; + liveRedraw?: boolean; + minWidth?: number; + rifleColor?: string; + trackBackgroundColor?: string; + trackBorderColor?: string; + trackBorderRadius?: number; + trackBorderWidth?: number; +} + +interface HighstockOptions extends HighchartsOptions { + navigator?: HighstockNavigatorOptions; + rangeSelector?: HighstockRangeSelectorOptions; + scrollbar?: HighstockScrollbarOptions; +} + +interface HighstockChart { + new (options: HighstockOptions): HighstockChartObject; + new (options: HighstockOptions, callback: (chart: HighstockChartObject) => void): HighstockChartObject; +} + +interface HighchartsStatic { + StockChart: HighstockChart; +} + +interface JQuery { + highcharts(type: "StockChart"): HighstockChartObject; + /** + * Creates a new Highcharts.Chart for the current JQuery selector; usually + * a div selected by $('#container') + * @param {HighchartsOptions} options Options for this chart + * @return current {JQuery} selector the current JQuery selector + **/ + highcharts(type: "StockChart", options: HighstockOptions): JQuery; + /** + * Creates a new Highcharts.Chart for the current JQuery selector; usually + * a div selected by $('#container') + * @param {HighchartsOptions} options Options for this chart + * @param callback Callback function used to manipulate the constructed chart instance + * @return current {JQuery} selector the current JQuery selector + **/ + highcharts(type: "StockChart", options: HighstockOptions, callback: (chart: HighstockChartObject) => void): JQuery; + + + highcharts(type: string): HighchartsChartObject; + highcharts(type: string, options: HighchartsOptions): JQuery; + highcharts(type: string, options: HighchartsOptions, callback: (chart: HighchartsChartObject) => void): JQuery; +} \ No newline at end of file diff --git a/hypertext-application-language/hypertext-application-language-tests.ts b/hypertext-application-language/hypertext-application-language-tests.ts new file mode 100644 index 000000000..13a88fe87 --- /dev/null +++ b/hypertext-application-language/hypertext-application-language-tests.ts @@ -0,0 +1,20 @@ +/// + +// Link object + +// Fields format: +var link:Hal.Link = { + "deprecation": "", + "href": "", + "hreflang": "", + "name": "", + "profile": "", + "templated": true, + "title": "", + "type": "", +}; + +// Required fields: +var link:Hal.Link = { + "href": "", +}; diff --git a/hypertext-application-language/hypertext-application-language.d.ts b/hypertext-application-language/hypertext-application-language.d.ts new file mode 100644 index 000000000..648a89634 --- /dev/null +++ b/hypertext-application-language/hypertext-application-language.d.ts @@ -0,0 +1,22 @@ +// Type definitions for Hypertext Application Language Draft 6 +// Project: https://tools.ietf.org/html/draft-kelly-json-hal-06 +// Definitions by: Maks3w +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module Hal { + /** + * Describe a HAL Link object + * + * https://tools.ietf.org/html/draft-kelly-json-hal-06#section-5 + */ + interface Link { + deprecation?: string; + href: string; + hreflang?: string; + name?: string; + profile?: string; + templated?: boolean; + title?: string; + type?: string; + } +} diff --git a/interactjs/interact-tests.ts b/interactjs/interact-tests.ts index b57a02c97..90f43a966 100644 --- a/interactjs/interact-tests.ts +++ b/interactjs/interact-tests.ts @@ -16,9 +16,9 @@ var interactable = interact(button); interactable.draggable(); interactable.draggable(true); interactable.draggable({ - onstart: (event: InteractEvent) => {}, - onmove : (event: InteractEvent) => {}, - onend : (event: InteractEvent) => {} + onstart: (event: Interact.InteractEvent) => {}, + onmove : (event: Interact.InteractEvent) => {}, + onend : (event: Interact.InteractEvent) => {} }); interactable.dropzone(); interactable.dropzone(true); @@ -45,7 +45,7 @@ interactable.inertia({ }); interactable.inertia(true); interactable.actionChecker(); -interactable.actionChecker((event: MouseEvent, defaultAction: string, interactable2: Interactable) => defaultAction); +interactable.actionChecker((event: MouseEvent, defaultAction: string, interactable2: Interact.Interactable) => defaultAction); var rect: ClientRect = interactable.getRect(); interactable.rectChecker(); interactable.styleCursor(); diff --git a/interactjs/interact.d.ts b/interactjs/interact.d.ts index 1ad864607..495e5e1a3 100644 --- a/interactjs/interact.d.ts +++ b/interactjs/interact.d.ts @@ -1,245 +1,245 @@ // Type definitions for Interacting for interact.js v1.0.25 // Project: https://github.com/taye/interact.js -// Definitions by: Douglas Eichelberger , Adi Dahiya +// Definitions by: Douglas Eichelberger , Adi Dahiya , Tom Hasner // Definitions: https://github.com/borisyankov/DefinitelyTyped // API documentation: http://interactjs.io/docs -interface Interactable { - // returns Element or string - accept(): any; - accept(newValue: Element): Interactable; - accept(newValue: string): Interactable; - actionChecker(): Function; - actionChecker(checker: Function): Interactable; - // returns boolean or {[key: string]: any} - autoScroll(): any; - autoScroll(options: boolean): Interactable; - autoScroll(options: {[key: string]: any}): Interactable; - context(): Node; - defaultActionChecker(event: any): string; - deltaSource(): string; - // returns Interactable if newValue is "page" or "client", otherwise returns string - deltaSource(newValue: String): Interactable; - draggable(): boolean; - draggable(options: boolean): Interactable; - draggable(options: {[key: string]: any}): Interactable; - dropCheck(event: MouseEvent): boolean; - dropCheck(event: TouchEvent): boolean; - dropChecker(): Function; - dropChecker(checker: Function): Interactable; - // returns boolean or {[key: string]: any} - dropzone(): any; - dropzone(options: boolean): Interactable; - dropzone(options: {[key: string]: any}): Interactable; - // return HTMLElement or SVGElement - element(): Element; - fire(iEvent: InteractEvent): Interactable; - // returns boolean or {[key: string]: any} - gesturable(): any; - gesturable(options: boolean): Interactable; - gesturable(options: {[key: string]: any}): Interactable; - getRect(): ClientRect; - // returns Element or string - ignoreFrom(): any; - ignoreFrom(newValue: string): Interactable; - ignoreFrom(newValue: Element): Interactable; - // returns boolean or {[key: string]: any} - inertia(): any; - inertia(options: boolean): Interactable; - inertia(options: {[key: string]: any}): Interactable; - off(eventType: string, listener: Function, useCapture?: boolean): Interactable; - on(eventType: string, listener: Function, useCapture?: boolean): Interactable; - origin(): Point; - origin(newValue: HTMLElement): Interactable; - origin(newValue: SVGElement): Interactable; - origin(newValue: Point): Interactable; - rectChecker(): Function; - rectChecker(newValue: Function): Interactable; - resizable(): Interactable; - resizable(options: boolean): Interactable; - resizable(options: {[key: string]: any}): Interactable; - restrict(): Restrict; - restrict(newValue: Restrict): Interactable; - set(options: {[key: string]: any}): Interactable; - // returns boolean or {[key: string]: any} - snap(): any; - snap(options: boolean): Interactable; - snap(options: {[key: string]: any}): Interactable; - squareResize(): boolean; - squareResize(newValue: boolean): Interactable; - styleCursor(): boolean; - styleCursor(newValue: boolean): Interactable; - unset(): InteractStatic; - validateSetting(context: string, option: string, value: any): any; +declare module Interact { + interface Interactable { + // returns Element or string + accept(): any; + accept(newValue: Element): Interactable; + accept(newValue: string): Interactable; + actionChecker(): Function; + actionChecker(checker: Function): Interactable; + // returns boolean or {[key: string]: any} + autoScroll(): any; + autoScroll(options: boolean): Interactable; + autoScroll(options: {[key: string]: any}): Interactable; + context(): Node; + defaultActionChecker(event: any): string; + deltaSource(): string; + // returns Interactable if newValue is "page" or "client", otherwise returns string + deltaSource(newValue: String): Interactable; + draggable(): boolean; + draggable(options: boolean): Interactable; + draggable(options: {[key: string]: any}): Interactable; + dropCheck(event: MouseEvent): boolean; + dropCheck(event: TouchEvent): boolean; + dropChecker(): Function; + dropChecker(checker: Function): Interactable; + // returns boolean or {[key: string]: any} + dropzone(): any; + dropzone(options: boolean): Interactable; + dropzone(options: {[key: string]: any}): Interactable; + // return HTMLElement or SVGElement + element(): Element; + fire(iEvent: InteractEvent): Interactable; + // returns boolean or {[key: string]: any} + gesturable(): any; + gesturable(options: boolean): Interactable; + gesturable(options: {[key: string]: any}): Interactable; + getRect(): ClientRect; + // returns Element or string + ignoreFrom(): any; + ignoreFrom(newValue: string): Interactable; + ignoreFrom(newValue: Element): Interactable; + // returns boolean or {[key: string]: any} + inertia(): any; + inertia(options: boolean): Interactable; + inertia(options: {[key: string]: any}): Interactable; + off(eventType: string, listener: Function, useCapture?: boolean): Interactable; + on(eventType: string, listener: Function, useCapture?: boolean): Interactable; + origin(): Point; + origin(newValue: HTMLElement): Interactable; + origin(newValue: SVGElement): Interactable; + origin(newValue: Point): Interactable; + rectChecker(): Function; + rectChecker(newValue: Function): Interactable; + resizable(): Interactable; + resizable(options: boolean): Interactable; + resizable(options: {[key: string]: any}): Interactable; + restrict(): Restrict; + restrict(newValue: Restrict): Interactable; + set(options: {[key: string]: any}): Interactable; + // returns boolean or {[key: string]: any} + snap(): any; + snap(options: boolean): Interactable; + snap(options: {[key: string]: any}): Interactable; + squareResize(): boolean; + squareResize(newValue: boolean): Interactable; + styleCursor(): boolean; + styleCursor(newValue: boolean): Interactable; + unset(): InteractStatic; + validateSetting(context: string, option: string, value: any): any; + } + + interface Coordinates { + clientX: number; + clientY: number; + pageX: number; + pageY: number; + timeStamp: number; + } + + interface Debug { + target: any; + dragging: any; + resizing: any; + gesturing: any; + prepared: any; + + prevCoords: Coordinates; + downCoords: Coordinates; + + pointerIds: any[]; + pointerMoves: any[]; + addPointer: any; + removePointer: any; + recordPointers: any; + + inertia: InertiaStatus; + + downTime: any; + downEvent: any; + prevEvent: any; + + Interactable: any; + IOptions: any; + interactables: any; + dropzones: any; + pointerIsDown: any; + defaultOptions: any; + defaultActionChecker: any; + + actions: any; + dragMove: any; + resizeMove: any; + gestureMove: any; + pointerUp: any; + pointerDown: any; + pointerMove: any; + pointerHover: any; + + events: any; + globalEvents: any; + delegatedEvents: any; + } + + interface InertiaStatus { + active: boolean; + target: any; + targetElement: any; + + startEvent: any; + pointerUp: any + + xe: number; + ye: number; + duration: number; + + t0: number; + vx0: number; + vys: number; + + lambda_v0: number; + one_ve_v0: number; + i: any; + } + + interface Point { + x: number; + y: number; + } + + // value types are either ClientRect or Element + interface Restrict { + drag?: any; + gesture?: any; + resize?: any; + elementRect?: {[direction: string]: number}; + } + + interface InteractEvent { + altKey: boolean; + axes: string; + button: number + clientX0: number; + clientX: number + clientY0: number; + clientY: number + ctrlKey: boolean + dt: number; + duration: number; + dx: number; + dy: number; + metaKey: boolean; + pageX: number; + pageY: number; + shiftKey: boolean; + speed: number; + t0: number; + target: any; + timeStamp: number; + type: string; + velocityX: number; + velocityY: number; + x0: number; + y0: number; + } + + interface TouchEvent { + pageX: number; + pageY: number; + type: string; + } + + interface InteractStatic { + (element: HTMLElement): Interactable; + (element: SVGElement): Interactable; + (element: string): Interactable; + // returns boolean or {[key: string]: any} + autoScroll(): any; + autoScroll(options: boolean): InteractStatic; + autoScroll(options: {[key: string]: any}): InteractStatic; + currentAction(): string + debug(): Debug; + deltaSource(): string; + // "page" and "client" are the valid parameters + deltaSource(newValue: string): InteractStatic; + dynamicDrop(): boolean; + dynamicDrop(newValue: boolean): InteractStatic; + enableDragging(): boolean; + enableDragging(newValue: boolean): InteractStatic; + enableGesturing(): boolean; + enableGesturing(newValue: boolean): InteractStatic; + enableResizing(): boolean; + enableResizing(newValue: boolean): InteractStatic; + // returns boolean or {[key: string]: any} + inertia(): any; + inertia(options: boolean): InteractStatic; + inertia(options: {[key: string]: any}): InteractStatic; + isSet(element: Element): boolean; + margin(): number; + margin(newvalue: number): InteractStatic; + off(type: string, listener: Function, useCapture?: boolean): InteractStatic; + on(type: string, listener: Function, useCapture?: boolean): InteractStatic; + restrict(): Restrict; + restrict(newValue: Restrict): InteractStatic; + simulate(action: string, element: Element, pointerEvent?: any): InteractStatic; + // returns boolean or {[key: string]: any} + snap(): any; + snap(options: boolean): InteractStatic; + snap(options: {[key: string]: any}): InteractStatic; + stop(event: Event): InteractStatic; + styleCursor(): boolean; + styleCursor(newValue: boolean): InteractStatic; + supportsTouch(): boolean + } } -interface Coordinates { - clientX: number; - clientY: number; - pageX: number; - pageY: number; - timeStamp: number; -} - -interface Debug { - target: any; - dragging: any; - resizing: any; - gesturing: any; - prepared: any; - - prevCoords: Coordinates; - downCoords: Coordinates; - - pointerIds: any[]; - pointerMoves: any[]; - addPointer: any; - removePointer: any; - recordPointers: any; - - inertia: InertiaStatus; - - downTime: any; - downEvent: any; - prevEvent: any; - - Interactable: any; - IOptions: any; - interactables: any; - dropzones: any; - pointerIsDown: any; - defaultOptions: any; - defaultActionChecker: any; - - actions: any; - dragMove: any; - resizeMove: any; - gestureMove: any; - pointerUp: any; - pointerDown: any; - pointerMove: any; - pointerHover: any; - - events: any; - globalEvents: any; - delegatedEvents: any; -} - -interface InertiaStatus { - active: boolean; - target: any; - targetElement: any; - - startEvent: any; - pointerUp: any - - xe: number; - ye: number; - duration: number; - - t0: number; - vx0: number; - vys: number; - - lambda_v0: number; - one_ve_v0: number; - i: any; -} - -interface Point { - x: number; - y: number; -} - -// value types are either ClientRect or Element -interface Restrict { - drag?: any; - gesture?: any; - resize?: any; - elementRect?: {[direction: string]: number}; -} - -interface InteractEvent { - altKey: boolean; - axes: string; - button: number - clientX0: number; - clientX: number - clientY0: number; - clientY: number - ctrlKey: boolean - dt: number; - duration: number; - dx: number; - dy: number; - metaKey: boolean; - pageX: number; - pageY: number; - shiftKey: boolean; - speed: number; - t0: number; - target: any; - timeStamp: number; - type: string; - velocityX: number; - velocityY: number; - x0: number; - y0: number; -} - -interface TouchEvent { - changedTouches: any[]; - pageX: number; - pageY: number; - touches: any[]; - type: string; -} - -interface InteractStatic { - (element: HTMLElement): Interactable; - (element: SVGElement): Interactable; - (element: string): Interactable; - // returns boolean or {[key: string]: any} - autoScroll(): any; - autoScroll(options: boolean): InteractStatic; - autoScroll(options: {[key: string]: any}): InteractStatic; - currentAction(): string - debug(): Debug; - deltaSource(): string; - // "page" and "client" are the valid parameters - deltaSource(newValue: string): InteractStatic; - dynamicDrop(): boolean; - dynamicDrop(newValue: boolean): InteractStatic; - enableDragging(): boolean; - enableDragging(newValue: boolean): InteractStatic; - enableGesturing(): boolean; - enableGesturing(newValue: boolean): InteractStatic; - enableResizing(): boolean; - enableResizing(newValue: boolean): InteractStatic; - // returns boolean or {[key: string]: any} - inertia(): any; - inertia(options: boolean): InteractStatic; - inertia(options: {[key: string]: any}): InteractStatic; - isSet(element: Element): boolean; - margin(): number; - margin(newvalue: number): InteractStatic; - off(type: string, listener: Function, useCapture?: boolean): InteractStatic; - on(type: string, listener: Function, useCapture?: boolean): InteractStatic; - restrict(): Restrict; - restrict(newValue: Restrict): InteractStatic; - simulate(action: string, element: Element, pointerEvent?: any): InteractStatic; - // returns boolean or {[key: string]: any} - snap(): any; - snap(options: boolean): InteractStatic; - snap(options: {[key: string]: any}): InteractStatic; - stop(event: Event): InteractStatic; - styleCursor(): boolean; - styleCursor(newValue: boolean): InteractStatic; - supportsTouch(): boolean -} - -declare var interact: InteractStatic; +declare var interact: Interact.InteractStatic; declare module "interact" { export = interact; diff --git a/inversify/inversify-tests.ts b/inversify/inversify-tests.ts new file mode 100644 index 000000000..46b5cab97 --- /dev/null +++ b/inversify/inversify-tests.ts @@ -0,0 +1,75 @@ +/// + +interface FooInterface { + name : string; + greet() : string; +} + +interface BarInterface { + name : string; + greet() : string; +} + +interface FooBarInterface { + foo : FooInterface; + bar : BarInterface; + greet() : string; +} + +class Foo implements FooInterface { + public name : string; + constructor() { + this.name = "foo"; + } + public greet() : string { + return this.name; + } +} + +class Bar implements BarInterface { + public name : string; + constructor() { + this.name = "bar"; + } + public greet() : string { + return this.name; + } +} + +class FooBar implements FooBarInterface { + public foo : FooInterface; + public bar : BarInterface; + constructor(FooInterface : FooInterface, BarInterface : BarInterface) { + this.foo = FooInterface; + this.bar = BarInterface; + } + public greet() : string{ + return this.foo.greet() + this.bar.greet(); + } +} + +// Kernel +var kernel = new inversify.Kernel(); + +// Identifiers +var fooRuntimeIdentifier = "FooInterface"; +var barRuntimeIdentifier = "BarInterface"; +var fooBarRuntimeIdentifier = "FooBarInterface"; + +// Bindings +var fooBinding = new inversify.TypeBinding(fooRuntimeIdentifier, Foo); +var barBinding = new inversify.TypeBinding(barRuntimeIdentifier, Bar); +var fooBarBinding = new inversify.TypeBinding(fooBarRuntimeIdentifier, FooBar); + +kernel.bind(fooBinding); +kernel.bind(barBinding); +kernel.bind(fooBarBinding); + +// Resolve +var foo = kernel.resolve(fooRuntimeIdentifier); +var bar = kernel.resolve(barRuntimeIdentifier); +var fooBar = kernel.resolve(fooBarRuntimeIdentifier); + +// Unbind +kernel.unbind(fooRuntimeIdentifier); +kernel.unbindAll(); diff --git a/inversify/inversify.d.ts b/inversify/inversify.d.ts new file mode 100644 index 000000000..f3c924e82 --- /dev/null +++ b/inversify/inversify.d.ts @@ -0,0 +1,51 @@ +// Type definitions for inversify 1.0.0 +// Project: https://github.com/inversify/InversifyJS +// Definitions by: inversify +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module inversify { + + interface TypeBindingInterface { + runtimeIdentifier : string; + implementationType : { new(): TServiceType ;}; + cache : TServiceType; + scope : number; // TypeBindingScopeEnum + } + + interface KernelInterface { + bind(typeBinding : TypeBindingInterface) : void; + unbind(runtimeIdentifier : string) : void; + unbindAll() : void; + resolve(runtimeIdentifier : string) : TImplementationType; + } + + enum TypeBindingScopeEnum { + Transient = 0, + Singleton = 1, + } + + class TypeBinding implements TypeBindingInterface { + runtimeIdentifier: string; + implementationType: { + new (): TServiceType; + }; + cache: TServiceType; + scope: TypeBindingScopeEnum; + constructor(runtimeIdentifier: string, implementationType: { + new (...args: any[]): TServiceType; + }, scopeType?: TypeBindingScopeEnum); + } + + class Kernel implements KernelInterface { + private _bindings; + bind(typeBinding: TypeBindingInterface): void; + unbind(runtimeIdentifier: string): void; + unbindAll(): void; + resolve(runtimeIdentifier: string): TImplementationType; + private _validateBinding(typeBinding); + private _getConstructorArguments(func); + private _injectDependencies(func); + private _construct(constr, args); + constructor(); + } +} diff --git a/irc/irc-tests.ts b/irc/irc-tests.ts new file mode 100644 index 000000000..edda5e14f --- /dev/null +++ b/irc/irc-tests.ts @@ -0,0 +1,54 @@ +/// +// https://github.com/martynsmith/node-irc/blob/master/example/bot.js + +import irc = require('irc'); + +var bot = new irc.Client('irc.dollyfish.net.nz', 'nodebot', { + debug: true, + channels: ['#blah', '#test'] +}); + +bot.addListener('error', ((message: irc.IMessage) => { + console.error('ERROR: %s: %s', message.command, message.args.join(' ')); +})); + +bot.addListener('message#blah', ((from: string, message: string) => { + console.log('<%s> %s', from, message); +})); + +bot.addListener('message', ((from: string, to: string, message: string) => { + console.log('%s => %s: %s', from, to, message); + + if (to.match(/^[#&]/)) { + // channel message + if (message.match(/hello/i)) { + bot.say(to, 'Hello there ' + from); + } + if (message.match(/dance/)) { + setTimeout(() => { bot.say(to, '\u0001ACTION dances: :D\\-<\u0001'); }, 1000); + setTimeout(() => { bot.say(to, '\u0001ACTION dances: :D|-<\u0001'); }, 2000); + setTimeout(() => { bot.say(to, '\u0001ACTION dances: :D/-<\u0001'); }, 3000); + setTimeout(() => { bot.say(to, '\u0001ACTION dances: :D|-<\u0001'); }, 4000); + } + } + else { + // private message + console.log('private message'); + } +})); + +bot.addListener('pm', ((nick: string, message: string) => { + console.log('Got private message from %s: %s', nick, message); +})); + +bot.addListener('join', ((channel: string, who: string) => { + console.log('%s has joined %s', who, channel); +})); + +bot.addListener('part', ((channel: string, who: string, reason: string) => { + console.log('%s has left %s: %s', who, channel, reason); +})); + +bot.addListener('kick', ((channel: string, who: string, by: string, reason: string) => { + console.log('%s was kicked from %s by %s: %s', who, channel, by, reason); +})); diff --git a/irc/irc.d.ts b/irc/irc.d.ts new file mode 100644 index 000000000..11f14ab6f --- /dev/null +++ b/irc/irc.d.ts @@ -0,0 +1,879 @@ +// Type definitions for irc v0.3.12 +// Project: https://github.com/martynsmith/node-irc +// Definitions by: phillips1012 +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +/** This library provides IRC client functionality. */ +declare module 'irc' { + import events = require('events'); + import crypto = require('crypto'); + import net = require('net'); + + /** This library provides IRC client functionality. */ + module NodeIRC { + /** A nick connect to an IRC server. */ + export class Client extends events.EventEmitter { + /** + * Socket to the server. Rarely, if ever needed. Use Client#send + * instead. + */ + public conn: net.Socket + + /** + * Channels joined. Includes channel modes, user list, and topic + * information. Only updated after the server recognizes the join. + */ + public chans: { + [index: string]: { + key: string; + serverName: string; + users: { + [index: string]: string; + }; + mode: string; + created: string; + } + } + + /** Features supported by the server */ + public supported: { + channel: { + idlength: string[]; + length: number; + limit: string[]; + modes: { + [index: string]: string; + } + types: string; + }; + + kicklength: number; + maxlist: number[]; + maxtargets: string[]; + modes: number; + nicklength: number + topiclength: number; + usermodes: string; + } + + /** + * The current nick of the client. Updated if the nick changes + */ + public nick: string; + + /** Channel listing data. */ + public channellist: IChannel[]; + + /** IRC server MOTD */ + public motd: string; + + /** Maximum line length */ + public maxLineLength: number; + + /** Bot options */ + public opt: IClientOpts; + + /** Host mask */ + public hostMask: string; + + /** + * Connect to an IRC server + * @param server - server hostname + * @param nick - nickname + * @param opts + */ + constructor( + server: string, + nick: string, + opts?: IClientOpts + ); + + /** + * Send a raw message to the server; generally speaking, it’s best + * not to use this method unless you know what you’re doing. + * @param command - irc command + * @param args - command arguments (splat) + */ + public send( + command: string, + ...args: string[] + ): void; + + /** + * Join the specified channel + * @param channel - channel to join + * @param callback + */ + public join( + channel: string, + callback?: handlers.IJoinChannel + ): void; + + /** + * Part the specified channel + * @param channel - channel to part + * @param message - optional message to send + * @param callback + */ + public part( + channel: string, + message: string, + callback: handlers.IPartChannel + ): void; + + /** + * Send a message to the specified target + * @param target - nick or channel + * @param message - message to send + */ + public say( + target: string, + message: string + ): void; + + /** + * Send a CTCP message to the specified target + * @param target - nick or channel + * @param type - "privmsg" for PRIVMSG, anything else for NOTICE + * @param text - CTCP message + */ + public ctcp( + target: string, + type: string, + text: string + ): void; + + /** + * Send an action to the specified target + * @param target - target + * @param message - message + */ + public action( + target: string, + message: string + ): void; + + /** + * Send a notice to the specified target. + * @param target - nick or channel + * @param message - message to send + */ + public notice( + target: string, + message: string + ): void; + + /** + * Request a whois for the specified nick + * @param nick - nickname + * @param callback + */ + public whois( + nick: string, + callback: handlers.IWhois + ): void; + + /** + * Request a channel listing from the server. The arguments for this + * are farily server specific, this method passes them as specified. + * + * Responses from the server are available via `channellist_start`, + * `channellist_item`, and `channellist` events. + * + * @param args - arguments + */ + public list( + ...args: string[] + ): void; + + /** + * Connect to the server. Use when `autoConnect` is false. + * @param retryCount - times to retry + * @param callback + */ + public connect( + retryCount?: number, + callback?: handlers.IRaw + ): void; + + /** + * Disconnect from the IRC server + * @param message - message to send + * @param callback + */ + public disconnect( + message: string, + callback: () => void + ): void; + + /** + * Activate flood protection “after the fact”. You can also use + * floodProtection while instantiating the Client to enable flood + * protection, and floodProtectionDelay to set the default message + * interval. + * @param interval - ms to wait between messages + */ + public activateFloodProtection( + interval: number + ): void; + } + + /** Client options object */ + export interface IClientOpts { + /** + * IRC username + * @default 'nodebot' + */ + userName?: string; + + /** + * IRC "real name" + * @default 'nodeJS IRC client' + */ + realName?: string; + + /** + * IRC connection port. See + * https://nodejs.org/api/net.html#net_socket_remoteport + * @default 6667 + */ + port?: number; + + /** + * Local interface to bind to for network connections. See + * https://nodejs.org/api/net.html#net_socket_localaddress + */ + localAddress?: string; + + /** + * Should we output debug messages to STDOUT? + * @default false + */ + debug?: boolean; + + /** + * Should we output IRC errors? + * @default false + */ + showErrors?: boolean; + + /** + * Should we auto-rejoin channels? + * @default false + */ + autoRejoin?: boolean; + + /** + * Should we auto-reconnect to networks? + * @default true + */ + autoConnect?: boolean; + + /** + * Channels to join + * @default [] + */ + channels?: string[]; + + /** + * Should SSL be used? Can either be true or crypto credentials. + * @default false + */ + secure?: boolean | crypto.Credentials; + + /** + * Should we accept self-signed certificates? + * @default false + */ + selfSigned?: boolean; + + + /** + * Should we accept expired certificates? + * @default false + */ + certExpired?: boolean; + + /** + * Should we queue our messages to ensure we don't get kicked? + * @default false + */ + floodProtection?: boolean; + + /** + * Delay between messages when flood protection is active + * @default 1000 + */ + floodProtectionDelay?: number; + + /** + * Should we use SASL authentication? + * @default false + */ + sasl?: boolean; + + /** + * Should we strip mIRC colors from the output messages? + * @default false + */ + stripColors?: boolean; + + /** + * Channel prefix + * @default '&#' + */ + channelPrefixes?: string; + + /** + * Characters to split a message at. + * @default 512 + */ + messageSplit?: number; + + /** + * Encoding to use. See + * https://nodejs.org/api/stream.html#stream_readable_setencoding_encoding + * @default 'utf-8' + */ + encoding?: string; + } + + /** Command types */ + export enum CommandType { + normal, reply, error + } + + /** Parsed IRC message. */ + export interface IMessage { + /** Prefix */ + prefix?: string; + + /** Mapped IRC command */ + command: string; + + /** Raw IRC command */ + rawCommand: string; + + /** Command type */ + commandType: CommandType; + + /** Command arguments */ + args: string[]; + } + + /** Whois data */ + export interface IWhoisData { + /** Nickname */ + nick: string; + + /** Username */ + user: string; + + /** Hostnamej */ + host: string; + + /** Real name" */ + realname: string; + + /** Channels */ + channels: string[]; + + /** Server */ + server: string; + + /** Server description string */ + serverinfo: string; + + /** Is this user an operator? */ + operator: string; + } + + /** A channel returned by a channel listing. */ + export interface IChannel { + /** Channel name */ + name: string; + + /** User count */ + users: string; + + /** Topic string */ + topic: string; + } + + /** + * Handler functions for Client. + */ + module handlers { + /** + * 'registered': Emitted when the server sends the initial 001 line, + * indicating you’ve connected to the server. See the raw event for + * details on the message object. + */ + export interface IRegistered { + /** + * @param message - raw message + */ + (message: IMessage): void; + } + + /** + * 'motd': Emitted when the server sends the message of the day to + * clients. + */ + export interface IMotd { + /** + * @param motd - motd string + */ + (motd: string): void; + } + + /** + * 'names': Emitted when the server sends a list of nicks for a channel + * (which happens immediately after joining and on request. The nicks + * object passed to the callback is keyed by nick names, and has + * values ‘’, ‘+’, or ‘@’ depending on the level of that nick in the + * channel. + */ + export interface INames { + /** + * @param channel - channel name + * @param nicks - nicks list + */ + (channel: string, nicks: string[]): void; + } + + /** + * 'names#*' As per ‘names’ event but only emits for the subscribed + * channel. + */ + export interface INamesChannel { + /** + * @param channel - channel name + * @param nicks - nicks list + */ + (nicks: string[]): void; + } + + /** + * 'topic': Emitted when the server sends the channel topic on joining + * a channel, or when a user changes the topic on a channel. See the + * raw event for details on the message object. + */ + export interface ITopic { + /** + * @param channel - channel name + * @param topic - topic + * @param nick - nick + * @param message - raw message + */ + ( + channel: string, + topic: string, + nick: string, + message: IMessage + ): void; + } + + /** + * 'join': Emitted when a user joins a channel (including when the + * client itself joins a channel). See the raw event for details on the + * message object. + */ + export interface IJoin { + /** + * @param channel - channel name + * @param nick - who joined + * @param message - raw message + */ + (channel: string, nick: string, message: IMessage): void; + } + + /** + * 'join#*': As per ‘join’ event but only emits for the subscribed + * channel. See the raw event for details on the message object. + */ + export interface IJoinChannel { + /** + * @param nick - who joined + * @param message - raw message + */ + (nick: string, message: IMessage): void; + } + + /** + * 'part': Emitted when a user parts a channel (including when the + * client itself parts a channel). See the raw event for details on the + * message object. + */ + export interface IPart { + /** + * @param channel - channel name + * @param nick - who parted + * @param reason - part reason + * @param message - raw message + */ + ( + channel: string, + nick: string, + reason: string, + message: IMessage + ): void + } + + /** + * 'part': As per ‘part’ event but only emits for the subscribed + * channel. See the raw event for details on the message object. + */ + export interface IPartChannel { + /** + * @param nick - who parted + * @param reason - part reason + * @param message - raw message + */ + ( + nick: string, + reason: string, + message: IMessage + ): void + } + + /** + * 'kick': Emitted when a user is kicked from a channel. See the raw + * event for details on the message object. + */ + export interface IKick { + /** + * @param channel - channel name + * @param nick - who was kicked + * @param by - kicker + * @param reason - kick reason + * @param message - raw message + */ + ( + channel: string, + nick: string, + by: string, + reason: string, + message: IMessage + ): void; + } + + /** + * 'kick#*': Emitted when a user is kicked from a channel. See the raw + * event for details on the message object. + */ + export interface IKickChannel { + /** + * @param nick - who was kicked + * @param by - kicker + * @param reason - kick reason + * @param message - raw message + */ + ( + nick: string, + by: string, + reason: string, + message: IMessage + ): void; + } + + /** + * 'message': Emitted when a message is sent. to can be either a nick + * (which is most likely this clients nick and means a private message), + * or a channel (which means a message to that channel). See the raw + * event for details on the message object. + */ + export interface IRecievedMessage { + /** + * @param nick - who sent the message + * @param to - to whom was the message sent + * @param text - message text + * @param message - raw message + */ + ( + nick: string, to: string, text: string, message: IMessage + ): void; + } + + /** + * 'message#': Emitted when a message is sent to any channel (i.e. + * exactly the same as the message event but excluding private + * messages. See the raw event for details on the message object. + */ + export interface IMessageAllChannels { + /** + * @param nick - who sent the message + * @param to - to whom was the message sent + * @param text - message text + * @param message - raw message + */ + ( + nick: string, to: string, text: string, message: IMessage + ): void; + } + + /** + * 'message#*': As per ‘message’ event but only emits for the + * subscribed channel. See the raw event for details on the message + * object. + */ + export interface IMessageChannel { + /** + * @param nick - who sent the message + * @param text - message text + * @param message - raw message + */ + (nick: string, text: string, message: IMessage): void; + } + + /** + * 'selfMessage': Emitted when a message is sent from the client. + * `to` is who the message was sent to. It can be either a nick + * (which most likely means a private message), or a channel (which + * means a message to that channel). + */ + export interface ISelfMessage { + (to: string, text: string): void; + } + + /** + * 'notice': Emitted when a notice is sent. to can be either a nick + * (which is most likely this clients nick and means a private + * message), or a channel (which means a message to that channel). nick + * is either the senders nick or null which means that the notice comes + * from the server. See the raw event for details on the message object. + */ + export interface INotice { + /** + * @param nick - from + * @param to - to + * @param text - text + * @param message - raw message + */ + (nick: string, to: string, text: string, message: IMessage): void; + } + + /** + * 'ping': Emitted when a server PINGs the client. The client will + * automatically send a PONG request just before this is emitted. + */ + export interface IPing { + /** + * @param server - server that adiministered the ping + */ + (server: string): void; + } + + /** + * 'pm': As per ‘message’ event but only emits when the message is + * direct to the client. See the raw event for details on the message + * object. + */ + export interface IPm { + /** + * @param nick - sender + * @param text - message text + * @param message - raw message + */ + (nick: string, text: string, message: IMessage): void; + } + + /** + * 'ctcp': Emitted when a CTCP notice or privmsg was received (type + * is either ‘notice’ or ‘privmsg’). See the raw event for details + * on the message object. + */ + export interface ICtcp { + /** + * @param from - sender + * @param to - recievier + * @param text - ctcp text + * @param type - ctcp type + * @param message - raw message + */ + ( + from: string, + to: string, + text: string, + type: string, + message: IMessage + ): void; + } + + + /** + * 'ctcp-*': Emitted when a specific type of CTCP request was + * recieved. + */ + export interface ICtcpSpecific { + /** + * @param from - sender + * @param to - recievier + * @param message - raw message + */ + ( + from: string, + to: string, + text: string, + message: IMessage + ): void; + + ( + from: string, + to: string, + text: string, + type: string, + message: IMessage + ): void; + } + + /** + * 'nick': Emitted when a user changes nick along with the channels + * the user is in. See the raw event for details on the message + * object. + */ + export interface INick { + /** + * @param oldnick - old nickname + * @param newnick - new nickname + * @param channels - channels the nick changed in + * @param message - raw message + */ + ( + oldnick: string, + newnick: string, + channels: string[], + message: IMessage + ): void; + } + + /** + * 'invite': Emitted when the client receives an /invite. See the + * raw event for details on the message object. + */ + export interface IInvite { + /** + * @param channel - channel user was invited to + * @param from - user who invited + * @param message - raw message + */ + (channel: string, from: string, message: IMessage): void; + } + + /** + * '+mode'/'-mode': Emitted when a mode is added or removed from a user or + * channel. channel is the channel which the mode is being set on/in + * . by is the user setting the mode. mode is the single character + * mode identifier. If the mode is being set on a user, argument is + * the nick of the user. If the mode is being set on a channel, + * argument is the argument to the mode. If a channel mode doesn’t + * have any arguments, argument will be ‘undefined’. See the raw + * event for details on the message object. + */ + export interface IModeChange { + /** + * @param channel - channel + * @param by - nick that changed mode + * @param mode - single character mode identifier + * @param argument - mode argument + * @param message - raw message + */ + ( + channel: string, + by: string, + mode: string, + argument: string, + message: IMessage + ): void; + } + + /** + * 'whois': Emitted whenever the server finishes outputting a WHOIS + * response. + */ + export interface IWhois { + (info: IWhoisData): void; + } + + /** + * 'channellist': Emitted when the server has finished returning a + * channel list. The channel_list array is simply a list of the + * objects that were returned in the intervening channellist_item + * events. + * + * This data is also available via the Client.channellist property + * after this event has fired. + */ + export interface IChannelList { + /** + * @param list - channels + */ + ( + list: IChannel[] + ): void; + } + + /** + * 'raw': Emitted when ever the client receives a “message” from + * the server. A message is a parsed line from the server. + */ + export interface IRaw { + /** + * @param message - raw message + */ + (message: IMessage): void; + } + + /** + * 'error': Emitted when ever the server responds with an error-type message. The message parameter is exactly as in the ‘raw’ event. + */ + export interface IError { + /** + * @param message - raw message + */ + (message: IMessage): void; + } + + /** + * 'action': Emitted whenever a user performs an action + * (e.g. /me waves). + */ + export interface IAction { + /** + * @param from - sender + * @param to - reciever + * @param text - text + * @param message - raw message + */ + ( + from: string, to: string, text: string, message: IMessage + ): void; + } + } + } + + /** Colors */ + module NodeIRC.colors { + /** + * Takes a color by name, text, and optionally what color to return. + * @param color - name of color + * @param text - text to color + * @param reset_color - color to set after text + */ + export function wrap( + color: string, text: string, reset_color?: string + ): string; + + /** + * This contains the set of colors available and a function to wrap + * text in a color. + */ + export var codes: { + [index: string]: string; + }; + } + + export = NodeIRC; +} diff --git a/jasmine/jasmine-tests.ts b/jasmine/jasmine-tests.ts index ef0572303..1bdf964dd 100644 --- a/jasmine/jasmine-tests.ts +++ b/jasmine/jasmine-tests.ts @@ -1,6 +1,6 @@ /// -// tests based on http://jasmine.github.io/2.0/introduction.html +// tests based on http://jasmine.github.io/2.2/introduction.html describe("A suite", function () { it("contains spec with an expectation", function () { @@ -248,7 +248,8 @@ describe("Pending specs", function () { it("can be declared by calling 'pending' in the spec body", function () { expect(true).toBe(false); - pending(); + pending(); // without reason + pending('this is why it is pending'); }); }); @@ -747,6 +748,82 @@ describe("Fail", function () { }); +// test based on http://jasmine.github.io/2.2/custom_equality.html +describe("custom equality", function() { + var myCustomEquality: jasmine.CustomEqualityTester = function(first: any, second: any): boolean { + if (typeof first == "string" && typeof second == "string") { + return first[0] == second[1]; + } + }; + + beforeEach(function() { + jasmine.addCustomEqualityTester(myCustomEquality); + }); + + + it("should be custom equal", function() { + expect("abc").toEqual("aaa"); + }); + + it("should be custom not equal", function() { + expect("abc").not.toEqual("abc"); + }); +}); + +// test based on http://jasmine.github.io/2.2/custom_matcher.html +var customMatchers: jasmine.CustomMatcherFactories = { + toBeGoofy: function (util: jasmine.MatchersUtil, customEqualityTesters: Array) { + return { + compare: function (actual: any, expected: any): jasmine.CustomMatcherResult { + if (expected === undefined) { + expected = ''; + } + var result: jasmine.CustomMatcherResult = { pass: false, message: ''}; + + result.pass = util.equals(actual.hyuk, "gawrsh" + expected, customEqualityTesters); + + if (result.pass) { + result.message = "Expected " + actual + " not to be quite so goofy"; + } else { + result.message = "Expected " + actual + " to be goofy, but it was not very goofy"; + } + + return result; + } + }; + } +}; +// add the custom matchers to interface jasmine.Matchers via TypeScript declaration merging +declare module jasmine { + interface Matchers { + toBeGoofy(expected?: any): boolean; + } +} + +describe("Custom matcher: 'toBeGoofy'", function () { + beforeEach(function () { + jasmine.addMatchers(customMatchers); + }); + + it("is available on an expectation", function () { + expect({ + hyuk: 'gawrsh' + }).toBeGoofy(); + }); + + it("can take an 'expected' parameter", function () { + expect({ + hyuk: 'gawrsh is fun' + }).toBeGoofy(' is fun'); + }); + + it("can be negated", function () { + expect({ + hyuk: 'this is fun' + }).not.toBeGoofy(); + }); +}); + (() => { // from boot.js var env = jasmine.getEnv(); diff --git a/jasmine/jasmine.d.ts b/jasmine/jasmine.d.ts index 3727f8839..43831c68a 100644 --- a/jasmine/jasmine.d.ts +++ b/jasmine/jasmine.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Jasmine 2.1 +// Type definitions for Jasmine 2.2 // Project: http://jasmine.github.io/ // Definitions by: Boris Yankov , Theodore Brown , David Pärsson // Definitions: https://github.com/borisyankov/DefinitelyTyped @@ -18,7 +18,7 @@ declare function xit(expectation: string, assertion?: () => void, timeout?: numb 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 pending(reason?: string): void; declare function beforeEach(action: () => void, timeout?: number): void; declare function beforeEach(action: (done: () => void) => void, timeout?: number): void; @@ -52,7 +52,8 @@ declare module jasmine { function createSpyObj(baseName: string, methodNames: any[]): T; function pp(value: any): string; function getEnv(): Env; - function addMatchers(matchers: any): Any; + function addCustomEqualityTester(equalityTester: CustomEqualityTester): void; + function addMatchers(matchers: CustomMatcherFactories): void; interface Any { @@ -62,6 +63,12 @@ declare module jasmine { jasmineToString(): string; } + // taken from TypeScript lib.core.es6.d.ts, applicable to CustomMatchers.contains() + interface ArrayLike { + length: number; + [n: number]: T; + } + interface ObjectContaining { new (sample: any): any; @@ -91,6 +98,34 @@ declare module jasmine { tick(ms: number): void; } + interface CustomEqualityTester { + (first: any, second: any): boolean; + } + + interface CustomMatcher { + compare(actual: T, expected: T): CustomMatcherResult; + compare(actual: any, expected: any): CustomMatcherResult; + } + + interface CustomMatcherFactory { + (util: MatchersUtil, customEqualityTesters: Array): CustomMatcher; + } + + interface CustomMatcherFactories { + [index: string]: CustomMatcherFactory; + } + + interface CustomMatcherResult { + pass: boolean; + message: string; + } + + interface MatchersUtil { + equals(a: any, b: any, customTesters?: Array): boolean; + contains(haystack: ArrayLike | string, needle: any, customTesters?: Array): boolean; + buildFailureMessage(matcherName: string, isNot: boolean, actual: any, ...expected: Array): string; + } + interface Env { setTimeout: any; clearTimeout: void; @@ -122,7 +157,8 @@ declare module jasmine { compareObjects_(a: any, b: any, mismatchKeys: string[], mismatchValues: string[]): boolean; equals_(a: any, b: any, mismatchKeys: string[], mismatchValues: string[]): boolean; contains_(haystack: any, needle: any): boolean; - addEqualityTester(equalityTester: (a: any, b: any, env: Env, mismatchKeys: string[], mismatchValues: string[]) => boolean): void; + addCustomEqualityTester(equalityTester: CustomEqualityTester): void; + addMatchers(matchers: CustomMatcherFactories): void; specFilter(spec: Spec): boolean; } @@ -320,7 +356,7 @@ declare module jasmine { waitsFor(latchFunction: SpecFunction, timeoutMessage?: string, timeout?: number): Spec; fail(e?: any): void; getMatchersClass_(): Matchers; - addMatchers(matchersPrototype: any): void; + addMatchers(matchersPrototype: CustomMatcherFactories): void; finishCallback(): void; finish(onComplete?: () => void): void; after(doAfter: SpecFunction): void; diff --git a/joi/joi.d.ts b/joi/joi.d.ts index 951fc4045..5e4bfc37b 100644 --- a/joi/joi.d.ts +++ b/joi/joi.d.ts @@ -61,6 +61,11 @@ declare module 'joi' { options?: ValidationOptions; } + export interface ValidationResult { + error: ValidationError; + value: T; + } + export interface SchemaMap { [key: string]: Schema; } @@ -252,6 +257,11 @@ declare module 'joi' { * Requires the string value to contain no whitespace before or after. If the validation convert option is on (enabled by default), the string will be trimmed. */ trim(): StringSchema; + + /** + * Requires the string value to be a valid uri with the passed scheme. + */ + uri(options?: { scheme?: string }): StringSchema; } export interface ArraySchema extends AnySchema { @@ -461,8 +471,7 @@ declare module 'joi' { */ export function validate(value: T, schema: Schema, callback: (err: ValidationError, value: T) => void): void; export function validate(value: T, schema: Object, callback: (err: ValidationError, value: T) => void): void; - export function validate(value: T, schema: Schema, options?: ValidationOptions, callback?: (err: ValidationError, value: T) => void): void; - export function validate(value: T, schema: Object, options?: ValidationOptions, callback?: (err: ValidationError, value: T) => void): void; + export function validate(value: T, schema: Object, options?: ValidationOptions, callback?: (err: ValidationError, value: T) => void): ValidationResult; /** * Converts literal schema definition to joi schema object (or returns the same back if already a joi schema object). diff --git a/jquery-sortable/jquery-sortable-tests.ts b/jquery-sortable/jquery-sortable-tests.ts new file mode 100644 index 000000000..67dcf01b4 --- /dev/null +++ b/jquery-sortable/jquery-sortable-tests.ts @@ -0,0 +1,225 @@ +/// + + +/** + * http://johnny.github.io/jquery-sortable/#connected + */ +function connectedListsWithDropAnimation() { + var adjustment: any; + + $('ol.simple_with_animation').sortable({ + group: 'simple_with_animation', + pullPlaceholder: false, + // animation on drop + onDrop: function (item, targetContainer, _super) { + var clonedItem = $('
  • ').css({height: 0}) + item.before(clonedItem) + clonedItem.animate({'height': item.height()}) + + item.animate(clonedItem.position(), function () { + clonedItem.detach(); + _super(item); + }) + }, + + // set item relative to cursor position + onDragStart: function ($item, container, _super) { + var offset = $item.offset(), + pointer = container.rootGroup.pointer; + + adjustment = { + left: pointer.left - offset.left, + top: pointer.top - offset.top + }; + + _super($item, container); + }, + onDrag: function ($item, position) { + $item.css({ + left: position.left - adjustment.left, + top: position.top - adjustment.top + }) + } + }); +} + + +/** + * http://johnny.github.io/jquery-sortable/#handle + */ +function sortHandleAndLimitedDragDrop() { + $('ol.simple_with_drop').sortable({ + group: 'no-drop', + handle: 'i.icon-move', + onDragStart: function (item, container, _super) { + // Duplicate items of the no drop area + if(!container.options.drop) + item.clone().insertAfter(item) + _super(item) + } + }); + + $('ol.simple_with_no_drop').sortable({ + group: 'no-drop', + drop: false + }); + + $('ol.simple_with_no_drag').sortable({ + group: 'no-drop', + drag: false + }); +} + + +/** + * http://johnny.github.io/jquery-sortable/#nested + */ +function toggleNestedLists() { + var oldContainer: any; + + $('ol.nested_with_switch').sortable({ + group: 'nested', + afterMove: function (placeholder, container) { + if(oldContainer != container){ + if(oldContainer) + oldContainer.el.removeClass('active') + container.el.addClass('active') + + oldContainer = container + } + }, + onDrop: function (item, container, _super) { + container.el.removeClass('active') + _super(item) + } + }); + + $('.switch-container').on('click', '.switch', function (e) { + var method = $(this).hasClass('active') ? 'enable' : 'disable' + $(e.delegateTarget).next().sortable(method) + }); +} + + +/** + * http://johnny.github.io/jquery-sortable/#limited-target + */ +function connectedListsWithLimitedDropTargets() { + var group = $('ol.limited_drop_targets').sortable({ + group: 'limited_drop_targets', + isValidTarget: function (item, container) { + if(item.is('.highlight')) + return true + else { + return item.parent('ol')[0] == container.el[0] + } + }, + onDrop: function (item, container, _super) { + $('#serialize_output').text(group.sortable('serialize').get().join('\n')); + _super(item, container); + }, + serialize: function (parent, children, isContainer) { + return isContainer ? children.join() : 24; + }, + tolerance: 6, + distance: 10 + }); +} + + +/** + * http://johnny.github.io/jquery-sortable/#bootstrap + */ +function sortingABootstrapMenu() { + $('ol.nav').sortable({ + group: 'nav', + nested: false, + vertical: false, + exclude: '.divider-vertical', + onDragStart: function($item, container, _super) { + $item.find('ol.dropdown-menu').sortable('disable'); + _super($item, container); + }, + onDrop: function($item, container, _super) { + $item.find('ol.dropdown-menu').sortable('enable'); + _super($item, container); + } + }); + + $('ol.dropdown-menu').sortable({ + group: 'nav' + }); +} + + +/** + * http://johnny.github.io/jquery-sortable#serialization + */ +function serializationAndDelay() { + var group = $('ol.serialization').sortable({ + group: 'serialization', + delay: 500, + onDrop: function (item, container, _super) { + var data = group.sortable('serialize').get(); + + var jsonString = JSON.stringify(data, null, ' '); + + $('#serialize_output2').text(jsonString); + _super(item, container); + } + }); +} + + +/** + * http://johnny.github.io/jquery-sortable/#table + */ +function sortTables() { + // Sortable rows + $('.sorted_table').sortable({ + containerSelector: 'table', + itemPath: '> tbody', + itemSelector: 'tr', + placeholder: '' + }); + + // Sortable column heads + var oldIndex: any; + + $('.sorted_head tr').sortable({ + containerSelector: 'tr', + itemSelector: 'th', + placeholder: '', + vertical: false, + onDragStart: function (item, group, _super) { + oldIndex = item.index(); + item.appendTo(item.parent()); + _super(item); + }, + onDrop: function (item, container, _super) { + var field: any, + newIndex = item.index() + + if (newIndex != oldIndex) + item.closest('table').find('tbody tr').each(function (i, row) { + var $row = $(row); + field = $row.children().eq(oldIndex); + if(newIndex) + field.before($row.children()[newIndex]); + else + $row.prepend(field); + }); + + _super(item); + } + }); +} + + +/** + * http://johnny.github.io/jquery-sortable/#docs + */ +function api() { + $('.horatio').sortable().sortable('disable').sortable('enable') + .sortable('refresh').sortable('serialize').sortable('destroy'); +} \ No newline at end of file diff --git a/jquery-sortable/jquery-sortable.d.ts b/jquery-sortable/jquery-sortable.d.ts new file mode 100644 index 000000000..82f4e8aa0 --- /dev/null +++ b/jquery-sortable/jquery-sortable.d.ts @@ -0,0 +1,104 @@ +// Type definitions for jQuery Sortable v0.9.12 +// Project: http://johnny.github.io/jquery-sortable/ +// Definitions by: Nathan Pitman +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module JQuerySortable { + + interface Position { + top: number; + left: number; + } + + type Dimensions = number[]; + + interface ContainerGroup { + $document: JQuery; + containerDimensions: Dimensions[] + containers: Container[]; + delayMet: boolean; + dragInitDone: boolean; + dragProxy: any; + dragging: boolean; + dropProxy: any; + item: JQuery; + itemContainer: Container; + lastAppendedItem: JQuery; + lastPointer: Position; + lastRelativePointer: Position; + offsetParent: JQuery; + options: Options; + placeholder: JQuery; + pointer: Position; + relativePointer: Position; + sameResultBox: { bottom: number; left: number; right: number; top: number; }; + scrollProxy: any; + } + + interface Container { + el: JQuery; + options: Options; + group: ContainerGroup; + rootGroup: ContainerGroup; + handle: string; + target: JQuery; + itemDimensions: Dimensions[]; + items: HTMLElement[]; + } + + + type GenericEventHandler = ($item?: JQuery, container?: Container, _super?: GenericEventHandler, event?: Event) => void; + type OnDragEventHandler = ($item?: JQuery, position?: Position, _super?: OnDragEventHandler, event?: Event) => void; + type OnMousedownHandler = ($item?: JQuery, _super?: OnMousedownHandler, event?: Event) => void; + type OnCancelHandler = ($item?: JQuery, container?: Container, _super?: OnCancelHandler, event?: Event) => void; + + // Deliberately typing $children as an any here as it makes it much easier to use. Actual type is JQuery | any[] + type SerializeFunc = ($parent: JQuery, $children: any, parentIsContainer: boolean) => void; + + interface GroupOptions { + afterMove?: ($placeholder: JQuery, container: Container, $closestItemOrContainer: JQuery) => void; + containerPath?: string; + containerSelector?: string; + distance?: number; + delay?: number; + handle?: string; + itemPath?: string; + itemSelector?: string; + isValidTarget?: ($item: JQuery, container: Container) => boolean; + onCancel?: OnCancelHandler; + onDrag?: OnDragEventHandler; + onDragStart?: GenericEventHandler; + onDrop?: GenericEventHandler; + onMousedown?: OnMousedownHandler; + placeholder?: JQuery | any[] | Element | string; + pullPlaceholder?: boolean; + serialize?: SerializeFunc; + tolerance?: number; + } + + + interface ContainerOptions { + drag?: boolean; + drop?: boolean; + exclude?: string; + nested?: boolean; + vertical?: boolean; + } + + interface Options extends GroupOptions, ContainerOptions { + } +} + + +interface JQuery { + sortable(options?: JQuerySortable.Options): JQuery; + + sortable(methodName: 'enable'): JQuery; + sortable(methodName: 'disable'): JQuery; + sortable(methodName: 'refresh'): JQuery; + sortable(methodName: 'destroy'): JQuery; + sortable(methodName: 'serialize'): JQuery; + sortable(methodName: string): JQuery; +} diff --git a/jquery.dataTables/jquery.dataTables-tests.ts b/jquery.dataTables/jquery.dataTables-tests.ts index c90b40d09..552b997b8 100755 --- a/jquery.dataTables/jquery.dataTables-tests.ts +++ b/jquery.dataTables/jquery.dataTables-tests.ts @@ -44,6 +44,9 @@ $(document).ready(function () { }; var colDataFunc: DataTables.FunctionColumnData = function (row, type, set, meta) { + meta.col; + meta.row; + meta.settings; }; var colRenderObject: DataTables.ObjectColumnRender = { @@ -54,7 +57,9 @@ $(document).ready(function () { }; var colRenderFunc: DataTables.FunctionColumnRender = function (data, type, row, meta) { - + meta.col; + meta.row; + meta.settings; }; var col: DataTables.ColumnSettings = diff --git a/jquery.dataTables/jquery.dataTables.d.ts b/jquery.dataTables/jquery.dataTables.d.ts index cbcb1c025..50ff52edd 100755 --- a/jquery.dataTables/jquery.dataTables.d.ts +++ b/jquery.dataTables/jquery.dataTables.d.ts @@ -1498,7 +1498,7 @@ declare module DataTables { } interface FunctionColumnData { - (row: any, t: string, s: any, meta: Object): void; + (row: any, t: string, s: any, meta: CellMetaSettings): void; } interface ObjectColumnData { @@ -1513,7 +1513,13 @@ declare module DataTables { } interface FunctionColumnRender { - (data: Node, t: Node, row: Node, meta: Object): void; + (data: any, t: string, row: any, meta: CellMetaSettings): void; + } + + interface CellMetaSettings { + row: number; + col: number; + settings: DataTables.Settings; } //#endregion "colunm-settings" diff --git a/jquery.pickadate/jquery.pickadate-tests.ts b/jquery.pickadate/jquery.pickadate-tests.ts deleted file mode 100644 index fde52f3e3..000000000 --- a/jquery.pickadate/jquery.pickadate-tests.ts +++ /dev/null @@ -1,420 +0,0 @@ -/// - -/* -* Date picker tests -* From http://amsul.ca/pickadate.js/date.htm -*/ - -$('.datepicker').pickadate(); - -$('.datepicker').pickadate({ - weekdaysShort: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'], - showMonthsShort: true -}); - -$('.datepicker').pickadate({ - today: '', - clear: 'Clear selection' -}); - -// Extend the default picker options for all instances. -$.extend($.fn.pickadate.defaults, { - monthsFull: ['Janvier', 'Février', 'Mars', 'Avril', 'Mai', 'Juin', 'Juillet', 'Août', 'Septembre', 'Octobre', 'Novembre', 'Décembre'], - weekdaysShort: ['Dim', 'Lun', 'Mar', 'Mer', 'Jeu', 'Ven', 'Sam'], - today: 'aujourd\'hui', - clear: 'effacer', - formatSubmit: 'yyyy/mm/dd' -}); - -// Or, pass the months and weekdays as an array for each invocation. -$('.datepicker').pickadate({ - monthsFull: ['Janvier', 'Février', 'Mars', 'Avril', 'Mai', 'Juin', 'Juillet', 'Août', 'Septembre', 'Octobre', 'Novembre', 'Décembre'], - weekdaysShort: ['Dim', 'Lun', 'Mar', 'Mer', 'Jeu', 'Ven', 'Sam'], - today: 'aujourd\'hui', - clear: 'effacer', - formatSubmit: 'yyyy/mm/dd' -}); - -$('.datepicker').pickadate({ - // Escape any "rule" characters with an exclamation mark (!). - format: 'You selecte!d: dddd, dd mmm, yyyy', - formatSubmit: 'yyyy/mm/dd', - hiddenPrefix: 'prefix__', - hiddenSuffix: '__suffix' -}); - -$('.datepicker').pickadate({ - selectYears: true, - selectMonths: true -}); - -$('.datepicker').pickadate({ - // `true` defaults to 10. - selectYears: 4 -}); - -$('.datepicker').pickadate({ - firstDay: 1 -}); - -$('.datepicker').pickadate({ - min: new Date(2013, 3, 20), - max: new Date(2013, 7, 14) -}); - -$('.datepicker').pickadate({ - min: [2013, 3, 20], - max: [2013, 7, 14] -}); - -$('.datepicker').pickadate({ - // An integer (positive/negative) sets it relative to today. - min: -15, - // `true` sets it to today. `false` removes any limits. - max: true -}); - -$('.datepicker').pickadate({ - disable: [ - [2013, 3, 3], - [2013, 3, 12], - [2013, 3, 20], - [2013, 3, 29] - ] -}); - -$('.datepicker').pickadate({ - disable: [ - 1, 4, 7 - ] -}); - -$('.datepicker').pickadate({ - disable: [ - new Date(2013, 3, 13), - new Date(2013, 3, 29) - ] -}); - -$('.datepicker').pickadate({ - disable: [ - true, - 1, 4, 7, - [2013, 3, 3], - [2013, 3, 12], - [2013, 3, 20], - [2013, 3, 29] - ] -}); - -$('.datepicker').pickadate({ - container: '#root-outlet' -}); - -$('.datepicker').pickadate({ - onStart: function () { - console.log('Hello there :)') - }, - onRender: function () { - console.log('Whoa.. rendered anew') - }, - onOpen: function () { - console.log('Opened up') - }, - onClose: function () { - console.log('Closed now') - }, - onStop: function () { - console.log('See ya.') - }, - onSet: function (event) { - console.log('Just set stuff:', event) - } -}); - -/* -* Time picker tests -* From http://amsul.ca/pickadate.js/time.htm -*/ - -$('.timepicker').pickatime(); - -$('.timepicker').pickatime({ - clear: '' -}); - -$('.timepicker').pickatime({ - // Escape any "rule" characters with an exclamation mark (!). - format: 'T!ime selected: h:i a', - formatLabel: 'h:i a', - formatSubmit: 'HH:i', - hiddenPrefix: 'prefix__', - hiddenSuffix: '__suffix' -}); - -$('.timepicker').pickatime({ - formatLabel: function (time: TimePickerItemObject) { - var hours = (time.pick - this.get('now').pick) / 60, - label = hours < 0 ? ' !hours to now' : hours > 0 ? ' !hours from now' : 'now' - return 'h:i a ' + (hours ? Math.abs(hours).toString() : '') + label + '' - } -}); - -$('.datepicker').pickadate({ - interval: 150 -}); - -$('.timepicker').pickatime({ - min: [7, 30], - max: [14, 0] -}); - -$('.timepicker').pickatime({ - // An integer (positive/negative) sets it as intervals relative from now. - min: -5, - // `true` sets it to now. `false` removes any limits. - max: true -}); - -$('.timepicker').pickatime({ - disable: [ - [0, 30], - [2, 0], - [8, 30], - [9, 0] - ] -}); - -$('.timepicker').pickatime({ - disable: [ - 3, 5, 7 - ] -}); - -$('.timepicker').pickatime({ - disable: [ - true, - 3, 5, 7, - [0, 30], - [2, 0], - [8, 30], - [9, 0] - ] -}); - -$('.timepicker').pickatime({ - container: '#root-outlet' -}); - -$('.timepicker').pickatime({ - onStart: function () { - console.log('Hello there :)') - }, - onRender: function () { - console.log('Whoa.. rendered anew') - }, - onOpen: function () { - console.log('Opened up') - }, - onClose: function () { - console.log('Closed now') - }, - onStop: function () { - console.log('See ya.') - }, - onSet: function (event) { - console.log('Just set stuff:', event) - } -}); - -/* -* API tests -* From http://amsul.ca/pickadate.js/api.htm -*/ - -var $input = $('.datepicker').pickadate(); - -// Use the picker object directly. -var picker = $input.pickadate('picker'); - -picker.open().clear().close(); - -picker.open(); -picker.close(); -picker.close(true); - -picker.open(false) -$(document).on('click', function () { - picker.close() -}); - -picker.start(); -picker.stop(); -picker.render(); -picker.clear(); - -picker.get() // Short for `picker.get('value')` - -picker.get('select'); -picker.get('select', 'yyyy/mm/dd'); - -picker.get('highlight'); -picker.get('highlight', 'yyyy/mm/dd'); - -picker.get('view'); - -picker.get('min'); -picker.get('min', 'yyyy/mm/dd'); -picker.get('max'); -picker.get('max', 'yyyy/mm/dd'); - -picker.get('open'); -picker.get('start'); -picker.get('id'); -picker.get('disable'); - -picker.set('clear'); - -// reset disabled dates -picker.set('disable', undefined); - -// Using arrays formatted as [YEAR,MONTH,DATE]. -picker.set('select', [2013, 3, 20]); - -// Using JavaScript Date objects. -picker.set('select', new Date(2013,03,20)); - -// Using positive integers as UNIX timestamps. -picker.set('select', 1365961912346); - -// Using arrays formatted as [HOUR,MINUTE]. -picker.set('select', [3, 0]); - -// Using positive integers as minutes. -picker.set('select', 540); - -// Using arrays formatted as [YEAR,MONTH,DATE]. -picker.set('highlight', [2013, 3, 20]); - -// Using JavaScript Date objects. -picker.set('highlight', new Date(2013,7,14)); - -// Using positive integers as UNIX timestamps. -picker.set('highlight', 1365961912346); - -// Using arrays formatted as [HOUR,MINUTE]. -picker.set('highlight', [15, 30]); - -// Using positive integers as minutes. -picker.set('highlight', 1080); - -// Using arrays formatted as [YEAR,MONTH,DATE]. -picker.set('view', [2000, 3, 20]); - -// Using JavaScript Date objects. -picker.set('view', new Date(1988,7,14)); - -// Using positive integers as UNIX timestamps. -picker.set('view', 1587355200000); - -// Using arrays formatted as [HOUR,MINUTE]. -picker.set('view', [15, 30]); - -// Using positive integers as minutes. -picker.set('view', 1080); - -// Using arrays formatted as [YEAR,MONTH,DATE]. -picker.set('min', [2013, 3, 20]); - -// Using JavaScript Date objects. -picker.set('min', new Date(2013,7,14)); - -// Using integers as days relative to today. -picker.set('min', -4); - -// Using `true` for "today". -picker.set('min', true); - -// Using `false` to remove. -picker.set('min', false); - -// Using arrays formatted as [HOUR,MINUTE]. -picker.set('min', [15, 30]); - -// Using integers as intervals relative from now. -picker.set('min', -4); - -// Using `true` for "now". -picker.set('min', true); - -// Using `false` to remove. -picker.set('min', false); - -// Using arrays formatted as [YEAR,MONTH,DATE]. -picker.set('max', [2013, 3, 20]); - -// Using JavaScript Date objects. -picker.set('max', new Date(2013,7,14)); - -// Using integers as days relative to today. -picker.set('max', 4); - -// Using `true` for "today". -picker.set('max', true); - -// Using `false` to remove. -picker.set('max', false); - -// Using arrays formatted as [HOUR,MINUTE]. -picker.set('max', [15, 30]); - -// Using integers as intervals relative from now. -picker.set('max', 4); - -// Using `true` for "now". -picker.set('max', true); - -// Using `false` to remove. -picker.set('max', false); - -picker.on('open', function () { - console.log('Opened.. and here I am!'); -}); - -picker.on({ - open: function () { - console.log('Opened.. and here I am!'); - }, - close: function () { - console.log('Closed.. and here I am!'); - } -}); - -$('.datepicker').pickadate({ - onOpen: function () { - console.log('Opened up!') - }, - onClose: function () { - console.log('Closed now') - }, - onRender: function () { - console.log('Just rendered anew') - }, - onStart: function () { - console.log('Hello there :)') - }, - onStop: function () { - console.log('See ya') - }, - onSet: function (event) { - console.log('Set stuff:', event) - } -}); - -picker.on('open', function () { - console.log('Didn\'t open.. yet here I am!'); -}) -picker.trigger('open'); - -picker.$node; -picker.$root; \ No newline at end of file diff --git a/jquery.pickadate/jquery.pickadate-tests.ts.tscparams b/jquery.pickadate/jquery.pickadate-tests.ts.tscparams deleted file mode 100644 index d3f5a12fa..000000000 --- a/jquery.pickadate/jquery.pickadate-tests.ts.tscparams +++ /dev/null @@ -1 +0,0 @@ - diff --git a/jquery.pickadate/jquery.pickadate.d.ts b/jquery.pickadate/jquery.pickadate.d.ts deleted file mode 100644 index 62b20bb22..000000000 --- a/jquery.pickadate/jquery.pickadate.d.ts +++ /dev/null @@ -1,319 +0,0 @@ -// Type definitions for pickadate.js 3.3.0 -// Project: https://github.com/amsul/pickadate.js -// Definitions by: Theodore Brown -// Definitions: https://github.com/borisyankov/DefinitelyTyped - -/// - -/** Options shared between date and time pickers */ -interface pickerOptions { - /** Set clear button text */ - clear?: string; // default 'Clear' - - /** Specify where to insert the picker's root element by passing any valid CSS selector to this option */ - container?: any; - - // Events - onStart?: (event: any) => void; - onRender?: (event: any) => void; - onOpen?: (event: any) => void; - onClose?: (event: any) => void; - onSet?: (event: any) => void; - onStop?: (event: any) => void; -} - -interface pickadateOptions extends pickerOptions { - // Strings and translations - monthsFull?: string[]; // default 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December' - monthsShort?: string[]; // default 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec' - weekdaysFull?: string[]; // default 'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday' - weekdaysShort?: string[]; // default 'Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat' - showMonthsShort?: boolean; - showWeekdaysFull?: boolean; - - // Buttons - today?: string; // default 'Today' - - // Formats - format?: string; // default 'd mmmm, yyyy' - formatSubmit?: string; // e.g. 'yyyy/mm/dd' - hiddenPrefix?: string; // default undefined - hiddenSuffix?: string; // default '_submit' - hiddenName?: boolean; // default undefined - - // Dropdown selectors - selectYears?: any; // Specify the number of years selectable using an even integer - half before and half after the year in focus: - selectMonths?: boolean; - - // First day of the week - firstDay?: any; // The first day of the week can be set to either Sunday or Monday. Anything truth-y sets it as Monday and anything false-y as Sunday - - // Date limits - min?: any; // date object, array formatted as [YEAR,MONTH,DATE], or dates relative to today using integers or a boolean (`true` sets it to today. `false` removes any limits). - max?: any; - - // Disable dates - disable?: any[]; // Date objects, arrays formatted as [YEAR,MONTH,DATE], or integers representing days of the week (from 1 to 7). Switch to whitelist by setting first item in collection to `true`. - - // Classes - klass?: { - - // The element states - input?: string; // default 'picker__input' - active?: string; // default 'picker__input--active' - - // The root picker and states - picker?: string; // default 'picker' - opened?: string; // default 'picker--opened' - focused?: string; // default 'picker--focused' - - // The picker holder - holder?: string; // default 'picker__holder' - - // The picker frame, wrapper, and box - frame?: string; // default 'picker__frame' - wrap?: string; // default 'picker__wrap' - box?: string; // default 'picker__box' - - // The picker header - header?: string; // default 'picker__header' - - // Month navigation - navPrev?: string; // default 'picker__nav--prev' - navNext?: string; // default 'picker__nav--next' - navDisabled?: string; // default 'picker__nav--disabled' - - // Month & year labels - month?: string; // default 'picker__month' - year?: string; // default 'picker__year' - - // Month & year dropdowns - selectMonth?: string; // default 'picker__select--month' - selectYear?: string; // default 'picker__select--year' - - // Table of dates - table?: string; // default 'picker__table' - - // Weekday labels - weekdays?: string; // default 'picker__weekday' - - // Day states - day?: string; // default 'picker__day' - disabled?: string; // default 'picker__day--disabled' - selected?: string // default 'picker__day--selected' - highlighted?: string // default 'picker__day--highlighted' - now?: string; // default 'picker__day--today' - infocus?: string; // default 'picker__day--infocus' - outfocus?: string; // default 'picker__day--outfocus' - - // The picker footer - footer?: string; // default 'picker__footer' - - // Today & clear buttons - buttonClear?: string; // default 'picker__button--clear' - buttonToday?: string; // default 'picker__button--today' - } -} - -interface pickatimeOptions extends pickerOptions { - - // Formats - format?: string; // default 'h:i A' - formatLabel?: any; - formatSubmit?: string; - hiddenPrefix?: string; // default undefined - hiddenSuffix?: string; // default '_submit' - - // Time intervals - interval?: number; // interval in minutes. default 30. - - // Time limits - min?: any; // array formatted as [HOUR,MINUTE], or as times relative to now using integers or a boolean (`true` sets it to now, `false` removes any limits). - max?: any; - - // Disable times - disable?: any[]; // arrays formatted as [HOUR,MINUTE] or integers representing hours (from 0 to 23). Switch to whitelist by setting true as the first item in the collection. - - // Classes - klass?: { - - // The element states - input?: string; // default 'picker__input' - active?: string; // default 'picker__input--active' - - // The root picker and states - picker?: string; // default 'picker picker--time' - opened?: string; // default 'picker--opened' - focused?: string; // default 'picker--focused' - - // The picker holder - holder?: string; // default 'picker__holder' - - // The picker frame, wrapper, and box - frame?: string; // default 'picker__frame' - wrap?: string; // default 'picker__wrap' - box?: string; // default 'picker__box' - - // List of times - list?: string; // default 'picker__list' - listItem?: string; // default 'picker__list-item' - - // Time states - disabled?: string; // default 'picker__list-item--disabled' - selected?: string; // default 'picker__list-item--selected' - highlighted?: string; // default 'picker__list-item--highlighted' - viewset?: string; // default 'picker__list-item--viewset' - now?: string; // default 'picker__list-item--now' - - // Clear button - buttonClear?: string; // default 'picker__button--clear' - } -} - -interface PickerItemObject { - /** The "pick" value used for comparisons. */ - pick: number; -} - -interface DatePickerItemObject extends PickerItemObject { - /** The full year. */ - year: number; - - /** The month with zero-as-index. */ - month: number; - - /** The date of the month. */ - date: number; - - /** The day of the week with zero-as-index. */ - day: number; - - /** The underlying JavaScript Date object. */ - obj: Date; -} - -interface TimePickerItemObject extends PickerItemObject { - /** Hour of the day from 0 to 23. */ - hour: number; - - /** The minutes of the hour from 0 to 59 (based on the interval). */ - mins: number; -} - -interface CallbackObject { - open?: () => void; - close?: () => void; - render?: () => void; - start?: () => void; - stop?: () => void; - set?: () => void; -} - -interface SetThings { - clear?; - select?: any; - highlight?: any; - view?: any; - min?: any; - max?: any; - disable?: any; - enable?: any; -} - -interface TimePickerSetThings extends SetThings { - interval?: any; -} - -interface PickerObject { - /** The picker's relative input element wrapped as a jQuery object. */ - $node: JQuery; - - /** The picker's relative root holder element wrapped as a jQuery object. */ - $root: JQuery; - - open(withoutFocus?: boolean): TPickerObject; - close(withFocus?: boolean): TPickerObject; - - /** Rebuild the picker. */ - start(): TPickerObject; - - /** Destroy the picker. */ - stop(): TPickerObject; - - /** - * Refresh the picker box after adding something to the holder. - * By default, only the "face" of the picker (i.e. the box element) - * has it’s contents re-rendered. To render the entire picker from - * the root up, pass true as the first argument. - */ - render(entirePicker?: boolean): TPickerObject; - - /** Clear the value in the picker's input element. */ - clear(): TPickerObject; - - /** Short for picker.get('value') */ - get(): string; - - /** Get the properties, objects, and states that make up the current state of the picker. */ - get(thing: string): any; - - /** Returns the string value of the picker's input element. */ - get(thing: 'value'): string; - - /** Returns the item object that is visually selected. */ - get(thing: 'select'): TItemObject; - - /** Returns the item object that is visually highlighted. */ - get(thing: 'highlight'): TItemObject; - - /** Returns the item object that sets the current view. */ - get(thing: 'view'): TItemObject; - - /** Returns the item object that limits the picker's lower range. */ - get(thing: 'min'): TItemObject; - - /** Returns the item object that limits the picker's upper range. */ - get(thing: 'max'): TItemObject; - - /** Returns a boolean value of whether the picker is open or not. */ - get(thing: 'open'): boolean; - - /** Returns a boolean value of whether the picker has started or not. */ - get(thing: 'start'): boolean; - - /** Returns a unique 9-digit integer that is the ID of the picker. */ - get(thing: 'id'): number; - - /** Returns an array of items that determine which item objects to disable on the picker. */ - get(thing: 'disable'): any[]; - - /** Returns a formatted string for the item object specified by `thing` */ - get(thing: string, format: string): string; - - /** Set the properties, objects, and states to change the state of the picker. */ - set(thing: string, value?: any, options?: any): TPickerObject; - set(things: TOptions, options?: any): TPickerObject; - - /** Bind callbacks to get fired off when the relative picker method is called. */ - on(methodName, callback: () => void): TPickerObject; - - /** Bind multiple callbacks at once to get fired off when the relative picker method is called. */ - on(callbackObject: CallbackObject): TPickerObject; - - /** Trigger callbacks that have been queued up using the the on method. */ - trigger(event: string): TPickerObject; -} - -interface DatePickerObject extends PickerObject { } -interface TimePickerObject extends PickerObject { } - -interface JQuery { - pickadate(methodName: "picker"): DatePickerObject; - pickadate(methodName: string): any; - pickadate(options?: pickadateOptions): JQuery; - - pickatime(methodName: "picker"): TimePickerObject; - pickatime(methodName: string): any; - pickatime(options?: pickatimeOptions): JQuery; -} - diff --git a/jquery.pickadate/jquery.pickadate.d.ts.tscparams b/jquery.pickadate/jquery.pickadate.d.ts.tscparams deleted file mode 100644 index d3f5a12fa..000000000 --- a/jquery.pickadate/jquery.pickadate.d.ts.tscparams +++ /dev/null @@ -1 +0,0 @@ - diff --git a/jquery.placeholder/jquery.placeholder-tests.ts b/jquery.placeholder/jquery.placeholder-tests.ts index 072c03721..b0e7629f3 100644 --- a/jquery.placeholder/jquery.placeholder-tests.ts +++ b/jquery.placeholder/jquery.placeholder-tests.ts @@ -2,3 +2,7 @@ /// $('input').placeholder(); + +// specify custom class +$('input').placeholder({ customClass: 'my-placeholder' }); + diff --git a/jquery.placeholder/jquery.placeholder.d.ts b/jquery.placeholder/jquery.placeholder.d.ts index b9af72494..d475adfce 100644 --- a/jquery.placeholder/jquery.placeholder.d.ts +++ b/jquery.placeholder/jquery.placeholder.d.ts @@ -1,13 +1,12 @@ -// Type definitions for jquery.placeholder.js 2.0.7 +// Type definitions for jquery.placeholder.js 2.1.1 // Project: https://github.com/mathiasbynens/jquery-placeholder -// Definitions by: Peter Gill +// Definitions by: Peter Gill , Neil Culver // Definitions: https://github.com/borisyankov/DefinitelyTyped /// interface JQuery { - - placeholder() : void; - + placeholder(options: { customClass: string }) : JQuery + placeholder() : JQuery } diff --git a/jquery.ui.layout/jquery.ui.layout.d.ts b/jquery.ui.layout/jquery.ui.layout.d.ts index b15dd3386..dae9dc067 100644 --- a/jquery.ui.layout/jquery.ui.layout.d.ts +++ b/jquery.ui.layout/jquery.ui.layout.d.ts @@ -27,12 +27,12 @@ interface JQueryLayout { resizeContent(pane: any): any; resizeAll(): any; - addToggleBtn(selector: string, pane: any) - addCloseBtn(selector: string, pane: any) - addOpenBtn(selector: string, pane: any) - addPinBtn(selector: string, pane: any) - allowOverflow(elemOrPane: any) - resetOverflow(elemOrPane: any) + addToggleBtn(selector: string, pane: any): any; + addCloseBtn(selector: string, pane: any): any; + addOpenBtn(selector: string, pane: any): any; + addPinBtn(selector: string, pane: any): any; + allowOverflow(elemOrPane: any): any; + resetOverflow(elemOrPane: any): any; } interface JQuery { diff --git a/jquery/jquery-tests.ts b/jquery/jquery-tests.ts index 006140f2f..3853a8d5f 100644 --- a/jquery/jquery-tests.ts +++ b/jquery/jquery-tests.ts @@ -2511,10 +2511,10 @@ function test_jQuery() { $foo.triggerHandler('eventName'); $("div > p").css("border", "1px solid gray"); $("input:radio", document.forms[0]); - var xml: any; + var xml: any; $("div", xml.responseXML); $(document.body).css("background", "black"); - var myForm: any; + var myForm: any; $(myForm.elements).hide(); $('

    My new text

    ').appendTo('body'); $(''); @@ -2537,6 +2537,10 @@ function test_jQuery() { } }).appendTo("body"); jQuery(function ($) { + // Your code using failsafe $ alias here... + }); + jQuery(document).ready(function ($) { + // Your code using failsafe $ alias here... }); } diff --git a/jquery/jquery.d.ts b/jquery/jquery.d.ts index 61fd62442..6a7bc47c2 100644 --- a/jquery/jquery.d.ts +++ b/jquery/jquery.d.ts @@ -725,30 +725,42 @@ interface JQueryStatic { * @param context A DOM Element, Document, or jQuery to use as context */ (selector: string, context?: Element|JQuery): JQuery; + /** * Accepts a string containing a CSS selector which is then used to match a set of elements. * * @param element A DOM element to wrap in a jQuery object. */ (element: Element): JQuery; + /** * Accepts a string containing a CSS selector which is then used to match a set of elements. * * @param elementArray An array containing a set of DOM elements to wrap in a jQuery object. */ (elementArray: Element[]): JQuery; + + /** + * Binds a function to be executed when the DOM has finished loading. + * + * @param callback A function to execute after the DOM is ready. + */ + (callback: (jQueryAlias?: JQueryStatic) => any): JQuery; + /** * Accepts a string containing a CSS selector which is then used to match a set of elements. * * @param object A plain object to wrap in a jQuery object. */ (object: {}): JQuery; + /** * Accepts a string containing a CSS selector which is then used to match a set of elements. * * @param object An existing jQuery object to clone. */ (object: JQuery): JQuery; + /** * Specify a function to execute when the DOM is fully loaded. */ @@ -761,6 +773,7 @@ interface JQueryStatic { * @param ownerDocument A document in which the new elements will be created. */ (html: string, ownerDocument?: Document): JQuery; + /** * Creates DOM elements on the fly from the provided string of raw HTML. * @@ -769,13 +782,6 @@ interface JQueryStatic { */ (html: string, attributes: Object): JQuery; - /** - * Binds a function to be executed when the DOM has finished loading. - * - * @param callback A function to execute after the DOM is ready. - */ - (callback: Function): JQuery; - /** * Relinquish jQuery's control of the $ variable. * @@ -2352,7 +2358,7 @@ interface JQuery { * * @param handler A function to execute after the DOM is ready. */ - ready(handler: Function): JQuery; + ready(handler: (jQueryAlias?: JQueryStatic) => any): JQuery; /** * Trigger the "resize" event on an element. diff --git a/js-signals/js-signals.d.ts b/js-signals/js-signals.d.ts index ebc8f72ae..c396bf490 100644 --- a/js-signals/js-signals.d.ts +++ b/js-signals/js-signals.d.ts @@ -5,6 +5,10 @@ declare var signals: SignalWrapper; +declare module "signals" { + export = signals; +} + interface SignalWrapper { Signal: Signal } diff --git a/jsnox/jsnox-tests.ts b/jsnox/jsnox-tests.ts index 4e990766b..e34d71b4a 100644 --- a/jsnox/jsnox-tests.ts +++ b/jsnox/jsnox-tests.ts @@ -9,8 +9,8 @@ interface PersonProps { age: number } -var Person = React.createClass({ - render(): React.ReactHTMLElement { return null } +var Person = React.createClass({ + render():React.ReactElement { return null; } }); var PersonTag = React.createFactory(Person); @@ -19,7 +19,7 @@ var clickHandler: React.MouseEventHandler // Tests with spec string function spec_string () { - var result: React.ReactHTMLElement + var result: React.HTMLComponent // just spec string result = $('div') @@ -38,7 +38,7 @@ function spec_string () { // Tests with react component function react_component() { - var result: React.ReactHTMLElement + var result: React.ReactElement<{}> // with nothing more result = $(Person) @@ -54,4 +54,4 @@ function react_component() { result = $(Person, props, 'hello') // one string child result = $(Person, props, $('span', 'world')) // one element child result = $(Person, props, ['hello', PersonTag()]) // mixed array of children -} \ No newline at end of file +} diff --git a/jsnox/jsnox.d.ts b/jsnox/jsnox.d.ts index 72584563b..dfb59e280 100644 --- a/jsnox/jsnox.d.ts +++ b/jsnox/jsnox.d.ts @@ -1,12 +1,14 @@ -// Type definitions for JSnoX +// Type definitions for JSnoX // Project: https://github.com/af/jsnox // Definitions by: Steve Baker // Definitions: https://github.com/borisyankov/DefinitelyTyped -/// +/// declare module 'jsnox' { + import React = require("react"); + /* * JSnoX requires an object with a createElement method. * This will normally be the React object but could be something else @@ -29,7 +31,7 @@ declare module 'jsnox' { * @param children A single React node (string or ReactElement) or array of nodes. * Note that unlike with React itself, multiple children must be placed into an array. */ - (specString: string, children: React.ReactNode): React.ReactHTMLElement + (specString: string, children: React.ReactNode): React.HTMLComponent /** * Renders an HTML element from the given spec string, with optional props @@ -40,7 +42,7 @@ declare module 'jsnox' { * @param children A single React node (string or ReactElement) or array of nodes. * Note that unlike with React itself, multiple children must be placed into an array. */ - (specString: string, props?: React.HTMLAttributes, children?: React.ReactNode): React.ReactHTMLElement + (specString: string, props?: React.HTMLAttributes, children?: React.ReactNode): React.HTMLComponent /** diff --git a/json-patch/json-patch-tests.ts b/json-patch/json-patch-tests.ts new file mode 100644 index 000000000..c2736c403 --- /dev/null +++ b/json-patch/json-patch-tests.ts @@ -0,0 +1,35 @@ +/// + +import jp = require("json-patch"); + +// Add property, result: {foo: 'bar'} +jsonpatch.apply({}, [{ op: 'add', path: '/foo', value: 'bar' }]); +// Add array element, result: {foo: [1, 2, 3]} +jsonpatch.apply({ foo: [1, 3] }, [{ op: 'add', path: '/foo/1', value: 2 }]); +// Complex, result: {foo: [{bar: 'baz'}]} +jsonpatch.apply({ foo: [{}] }, [{ op: 'add', path: '/foo/0/bar', value: 'baz' }]); + +// Remove property, result: {} +jsonpatch.apply({ foo: 'bar' }, [{ op: 'remove', path: '/foo' }]); +// Remove array element, result: {foo: [1, 3]} +jsonpatch.apply({ foo: [1, 2, 3] }, [{ op: 'remove', path: '/foo/1' }]); +// Complex, result: {foo: [{}]} +jsonpatch.apply({ foo: [{ bar: 'baz' }] }, [{ op: 'remove', path: '/foo/0/bar' }]); + +// Replace property, result: {foo: 1} +jsonpatch.apply({ foo: 'bar' }, [{ op: 'replace', path: '/foo', value: 1 }]); +// Repalce array element, result: {foo: [1, 4, 3]} +jsonpatch.apply({ foo: [1, 2, 3] }, [{ op: 'replace', path: '/foo/1', value: 4 }]); +// Complex, result: {foo: [{bar: 1}]} +jsonpatch.apply({ foo: [{ bar: 'baz' }] }, [{ op: 'replace', path: '/foo/0/bar', value: 1 }]); + +// Move property, result {bar: [1, 2, 3]} +jsonpatch.apply({ foo: [1, 2, 3] }, [{ op: 'move', from: '/foo', path: '/bar' }]); +// Copy property, result {foo: [1, 2, 3], bar: 2} +jsonpatch.apply({ foo: [1, 2, 3] }, [{ op: 'copy', from: '/foo/1', path: '/bar' }]); +// Test equality of property to value, result: true +jsonpatch.apply({ foo: 'bar' }, [{ op: 'test', path: '/foo', value: 'bar' }]); + +jsonpatch.compile([{ op: 'test', path: '/foo', value: 'bar' }])({ foo: 'bar' }); + +jp.apply({}, [{ op: 'add', path: '/foo', value: 'bar' }]); diff --git a/json-patch/json-patch.d.ts b/json-patch/json-patch.d.ts new file mode 100644 index 000000000..308fe35c6 --- /dev/null +++ b/json-patch/json-patch.d.ts @@ -0,0 +1,41 @@ +// Type definitions for json-patch +// Project: https://github.com/bruth/jsonpatch-js +// Definitions by: vvakame +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module jsonpatch { + type OpPatch = AddPath | RemovePath | ReplacePath | MovePath | CopyPath | TestPath; + interface Patch { + op: string; + } + interface AddPath extends Patch { + path: string; + value: any; + } + interface RemovePath extends Patch { + path: string; + } + interface ReplacePath extends Patch { + path: string; + value: any; + } + interface MovePath extends Patch { + from: string; + path: string; + } + interface CopyPath extends Patch { + from: string; + path: string; + } + interface TestPath extends Patch { + path: string; + value: any; + } + + function apply(document: any, patches: OpPatch[]): any; + function compile(patches: OpPatch[]): (document: any) => any; +} + +declare module "json-patch" { + export = jsonpatch; +} diff --git a/json5/json5-tests.ts b/json5/json5-tests.ts new file mode 100644 index 000000000..da945c341 --- /dev/null +++ b/json5/json5-tests.ts @@ -0,0 +1,7 @@ +/// +import JSON5 = require('json5'); + +var obj = JSON5.parse("{ key:'val', 'key2':[0,1,2,] } //comment "); +var str = JSON5.stringify(obj, null, "\t"); +console.log(str); + diff --git a/json5/json5.d.ts b/json5/json5.d.ts new file mode 100644 index 000000000..2ea49bf96 --- /dev/null +++ b/json5/json5.d.ts @@ -0,0 +1,45 @@ +// Type definitions for JSON5 +// Project: http://json5.org/ +// Definitions by: Jason Swearingen +// Definitions: https://github.com/borisyankov/DefinitelyTyped + + +//commonjs loader +declare module "json5" { + /** + * The following is the exact list of additions to JSON's syntax introduced by JSON5. All of these are optional, and all of these come from ES5. + +Objects + +Object keys can be unquoted if they're valid identifiers. Yes, even reserved keywords (like default) are valid unquoted keys in ES5 [§11.1.5, §7.6]. (More info) + +(TODO: Unicode characters and escape sequences aren’t yet supported in this implementation.) + +Objects can have trailing commas. + +Arrays + +Arrays can have trailing commas. +Strings + +Strings can be single-quoted. + +Strings can be split across multiple lines; just prefix each newline with a backslash. [ES5 §7.8.4] + +Numbers + +Numbers can be hexadecimal (base 16). + +Numbers can begin or end with a (leading or trailing) decimal point. + +Numbers can include Infinity, -Infinity, NaN, and -NaN. + +Numbers can begin with an explicit plus sign. + +Comments + +Both inline (single-line) and block (multi-line) comments are allowed. + */ + var json5: JSON; + export = json5; +} \ No newline at end of file diff --git a/jsuri/jsuri-tests.ts b/jsuri/jsuri-tests.ts new file mode 100644 index 000000000..73ecbc50d --- /dev/null +++ b/jsuri/jsuri-tests.ts @@ -0,0 +1,82 @@ +/// + +function test_createUri() { + var uri = new jsuri.Uri('http://user:pass@www.test.com:81/index.html?q=books#fragment'); + + var getTests = { + protocol: 'http' == uri.protocol(), + userInfo: 'user:pass' == uri.userInfo(), + host: 'www.test.com' == uri.host(), + port: 81 == uri.port(), + path: '/index.html' == uri.path(), + query: 'q=books' == uri.query(), + anchor: 'fragment' == uri.anchor() + }; + + uri.protocol('https'); + var setProtocolTest = uri.toString() == 'https://user:pass@www.test.com:81/index.html?q=books#fragment'; + + uri.host('mydomain.com'); + var setHostTest = uri.toString() == 'https://user:pass@mydomain.com:81/index.html?q=books#fragment'; +} + +function test_chainable() { + new jsuri.Uri() + .setPath('/archives/1979/') + .setQuery('?page=1'); // /archives/1979?page=1 + + new jsuri.Uri() + .setPath('/index.html') + .setAnchor('content') + .setHost('www.test.com') + .setPort(8080) + .setUserInfo('username:password') + .setProtocol('https') + .setQuery('this=that&some=thing'); // https://username:password@www.test.com:8080/index.html?this=that&some=thing#content + + new jsuri.Uri('http://www.test.com') + .setHost('www.yahoo.com') + .setProtocol('https'); // https://www.yahoo.com +} + +function test_queryParams() { + new jsuri.Uri('?cat=1&cat=2&cat=3').getQueryParamValue('cat'); // 1 + + new jsuri.Uri('?cat=1&cat=2&cat=3').getQueryParamValues('cat'); // [1, 2, 3] + + new jsuri.Uri().addQueryParam('q', 'books'); // ?q=books + + new jsuri.Uri('http://www.github.com') + .addQueryParam('testing', '123') + .addQueryParam('one', 1); // http://www.github.com/?testing=123&one=1 + + // insert param at index 0 + new jsuri.Uri('?b=2&c=3&d=4').addQueryParam('a', '1', 0); // ?a=1&b=2&c=3&d=4 + + new jsuri.Uri().replaceQueryParam('page', 2); // ?page=2 + + new jsuri.Uri('?a=1&b=2&c=3') + .replaceQueryParam('a', 'eh'); // ?a=eh&b=2&c=3 + + new jsuri.Uri('?a=1&b=2&c=3&c=4&c=5&c=6') + .replaceQueryParam('c', 'five', '5'); // ?a=1&b=2&c=3&c=4&c=five&c=6 + + new jsuri.Uri('?a=1&b=2&c=3') + .deleteQueryParam('a'); // ?b=2&c=3 + + new jsuri.Uri('test.com?a=1&b=2&c=3&a=eh') + .deleteQueryParam('a', 'eh'); // test.com/?a=1&b=2&c=3 + + new jsuri.Uri('?a=1&b=2&c=3') + .hasQueryParam('a'); // true + + new jsuri.Uri('?a=1&b=2&c=3') + .hasQueryParam('d'); // false +} + +function test_clone() { + var baseUri = new jsuri.Uri('http://localhost/'); + + baseUri.clone().setProtocol('https'); // https://localhost/ + baseUri; // http://localhost/ +} diff --git a/jsuri/jsuri.d.ts b/jsuri/jsuri.d.ts new file mode 100644 index 000000000..a50002140 --- /dev/null +++ b/jsuri/jsuri.d.ts @@ -0,0 +1,139 @@ +// Type definitions for jsUri 1.3+ +// Project: https://github.com/derek-watson/jsUri +// Definitions by: Chris Charabaruk +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module jsuri { + type Primitive = string | number | boolean; + + export class Uri { + /** + * Creates a new Uri object + * @constructor + * @param {string} str + */ + constructor(str?: string); + + /** + * Define getter/setter methods + */ + protocol(val?: string): string; + userInfo(val?: string): string; + host(val?: string): string; + port(val?: number): number; + path(val?: string): string; + anchor(val?: string): string; + + /** + * if there is no protocol, the leading // can be enabled or disabled + * @param {Boolean} val + * @return {Boolean} + */ + hasAuthorityPrefix(val?: boolean): boolean; + + isColonUri(val?: boolean): boolean; + + /** + * Serializes the internal state of the query pairs + * @param {string} [val] set a new query string + * @return {string} query string + */ + query(val?: string): string; + + /** + * returns the first query param value found for the key + * @param {string} key query key + * @return {string} first value found for key + */ + getQueryParamValue(key: string): string; + + /** + * returns an array of query param values for the key + * @param {string} key query key + * @return {array} array of values + */ + getQueryParamValues(key: string): string[]; + + /** + * removes query parameters + * @param {string} key remove values for key + * @param {val} [val] remove a specific value, otherwise removes all + * @return {Uri} returns self for fluent chaining + */ + deleteQueryParam(key: string, val?: string): Uri; + + /** + * adds a query parameter + * @param {string} key add values for key + * @param {string} val value to add + * @param {integer} [index] specific index to add the value at + * @return {Uri} returns self for fluent chaining + */ + addQueryParam(key: string, val: Primitive, index?: number): Uri; + + /** + * test for the existence of a query parameter + * @param {string} key check values for key + * @return {Boolean} true if key exists, otherwise false + */ + hasQueryParam(key: string): boolean; + + /** + * replaces query param values + * @param {string} key key to replace value for + * @param {string} newVal new value + * @param {string} [oldVal] replace only one specific value (otherwise replaces all) + * @return {Uri} returns self for fluent chaining + */ + replaceQueryParam(key: string, newVal: Primitive, oldVal?: Primitive): Uri; + + /** + * Define fluent setter methods (setProtocol, setHasAuthorityPrefix, etc) + */ + setProtocol(val: string): Uri; + setHasAuthorityPrefix(val: boolean): Uri; + setIsColonUri(val: boolean): Uri; + setUserInfo(val: string): Uri; + setHost(val: string): Uri; + setPort(val: number): Uri; + setPath(val: string): Uri; + setQuery(val: string): Uri; + setAnchor(val: string): Uri; + + /** + * Scheme name, colon and doubleslash, as required + * @return {string} http:// or possibly just // + */ + scheme(): string; + + /** + * Same as Mozilla nsIURI.prePath + * @return {string} scheme://user:password@host:port + * @see https://developer.mozilla.org/en/nsIURI + */ + origin(): string; + + /** + * Adds a trailing slash to the path + */ + addTrailingSlash(): Uri; + + /** + * Serializes the internal state of the Uri object + * @return {string} + */ + toString(): string; + + /** + * Clone a Uri object + * @return {Uri} duplicate copy of the Uri + */ + clone(): Uri; + } +} + +declare type Uri = jsuri.Uri; + +declare module 'jsuri' { + export = Uri; +} diff --git a/jszip/jszip-tests.ts b/jszip/jszip-tests.ts index 97fd10450..514beb501 100644 --- a/jszip/jszip-tests.ts +++ b/jszip/jszip-tests.ts @@ -33,18 +33,18 @@ function testJSZip() { var folder = newJszip.folder("test"); if(folder.file("test.txt").asText() == "test string") { log(SEVERITY.INFO, "all ok"); - } + } else { log(SEVERITY.ERROR, "wrong file"); } var folders = newJszip.folder(new RegExp("^test")); - + if(folders.length == 1) { log(SEVERITY.INFO, "all ok"); if(folders[0].dir == true) { log(SEVERITY.INFO, "all ok"); - } + } else { log(SEVERITY.ERROR, "wrong file"); } @@ -59,14 +59,14 @@ function testJSZip() { log(SEVERITY.INFO, "all ok"); } else { - log(SEVERITY.ERROR, "wrong data in files"); + log(SEVERITY.ERROR, "wrong data in files"); } - } + } else { log(SEVERITY.ERROR, "wrong number of files"); } - var filterFiles = newJszip.filter((relativePath: string, file: JSZipObject) => { + var filterFiles = newJszip.filter((relativePath: string, file: JSZipObject) => { if (file.asText() == "test string") { return true; } @@ -82,7 +82,7 @@ function testJSZip() { newJszip.remove("test/test.txt"); - filterFiles = newJszip.filter((relativePath: string, file: JSZipObject) => { + filterFiles = newJszip.filter((relativePath: string, file: JSZipObject) => { if (file.asText() == "test string") { return true; } @@ -95,24 +95,43 @@ function testJSZip() { else { log(SEVERITY.ERROR, "wrong number of files"); } + + var uncompressedStr = JSZip.compressions.DEFLATE.uncompress( + JSZip.compressions.DEFLATE.compress("\0\1\2\3\4\5\6\7",{level:9})); + var uncompressedArr = JSZip.compressions.DEFLATE.uncompress( + JSZip.compressions.DEFLATE.compress([0,1,2,3,4,5,6,7],{level:9})); + var uncompressedUint8Arr = JSZip.compressions.DEFLATE.uncompress( + JSZip.compressions.DEFLATE.compress(new Uint8Array([0,1,2,3,4,5,6,7]),{level:9})); + + var every_match = [0,1,2,3,4,5,6,7].every(function(val, i){ + return uncompressedStr[i] === val && + uncompressedArr[i] === val && + uncompressedUint8Arr[i] === val; + }); + if(every_match) { + log(SEVERITY.INFO, "compress and uncompress ok."); + }else{ + log(SEVERITY.ERROR, "compress or uncompress failed."); + } + } function log(severity:number, message: any) { var log = ""; switch(severity) { - case 0: + case 0: log += "[DEBUG] "; break; - case 1: + case 1: log += "[INFO] "; break; - case 2: + case 2: log += "[WARN] "; break; - case 3: + case 3: log += "[ERROR] "; break; - case 4: + case 4: log += "[FATAL] "; break; default: @@ -122,4 +141,4 @@ function log(severity:number, message: any) { console.log(log += message); } -testJSZip(); \ No newline at end of file +testJSZip(); diff --git a/jszip/jszip.d.ts b/jszip/jszip.d.ts index df571793b..651a26da5 100644 --- a/jszip/jszip.d.ts +++ b/jszip/jszip.d.ts @@ -32,7 +32,7 @@ interface JSZip { /** * Return an new JSZip instance with the given folder as root - * + * * @param name Name of the folder * @return New JSZip object with the given folder as root or null */ @@ -40,7 +40,7 @@ interface JSZip { /** * Returns new JSZip instances with the matching folders as root - * + * * @param name RegExp to match * @return New array of JSZipFile objects which match the RegExp */ @@ -56,7 +56,7 @@ interface JSZip { /** * Removes the file or folder from the archive - * + * * @param path Relative path of file or folder * @return Returns the JSZip instance */ @@ -140,6 +140,18 @@ interface JSZipSupport { nodebuffer: boolean; } +interface DEFLATE { + /** pako.deflateRaw, level:0-9 */ + compress(input: string, compressionOptions: {level:number}): Uint8Array; + compress(input: number[], compressionOptions: {level:number}): Uint8Array; + compress(input: Uint8Array, compressionOptions: {level:number}): Uint8Array; + + /** pako.inflateRaw */ + uncompress(input: string): Uint8Array; + uncompress(input: number[]): Uint8Array; + uncompress(input: Uint8Array): Uint8Array; +} + declare var JSZip: { /** * Create JSZip instance @@ -169,6 +181,9 @@ declare var JSZip: { prototype: JSZip; support: JSZipSupport; + compressions: { + DEFLATE: DEFLATE; + } } declare module "jszip" { diff --git a/kendo-ui/kendo-ui-tests.ts b/kendo-ui/kendo-ui-tests.ts new file mode 100644 index 000000000..a9944b6af --- /dev/null +++ b/kendo-ui/kendo-ui-tests.ts @@ -0,0 +1 @@ +/// \ No newline at end of file diff --git a/kendo-ui/kendo-ui.d.ts b/kendo-ui/kendo-ui.d.ts new file mode 100644 index 000000000..3f5cb5d4f --- /dev/null +++ b/kendo-ui/kendo-ui.d.ts @@ -0,0 +1,15682 @@ +// Type definitions for Kendo UI +// Project: http://www.telerik.com/kendo-ui +// Definitions by: Stefan Rahnev +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module kendo { + function culture(): { + name: string; + calendar: { + AM: string[]; + PM: string[]; + days: { + names: string[]; + namesAbbr: string[]; + namesShort: string[]; + firstDay: number; + }; + months: { + names: string[]; + namesAbbr: string[]; + }; + patterns: { + D: string; + F: string; + G: string; + M: string; + T: string; + Y: string; + d: string; + g: string; + m: string; + s: string; + t: string; + u: string; + y: string; + }; + twoDigitYearMax: number; + }; + calendars: { + standard: { + AM: string[]; + PM: string[]; + days: { + names: string[]; + namesAbbr: string[]; + namesShort: string[]; + firstDay: number; + }; + months: { + names: string[]; + namesAbbr: string[]; + }; + patterns: { + D: string; + F: string; + G: string; + M: string; + T: string; + Y: string; + d: string; + g: string; + m: string; + s: string; + t: string; + u: string; + y: string; + }; + twoDigitYearMax: number; + }; + }; + numberFormat: { + currency: { + decimals: number; + groupSize: number[]; + pattern: string[]; + symbol: string; + }; + decimals: number; + groupSize: number[]; + pattern: string[]; + percent: { + decimals: number; + groupSize: number[]; + pattern: string[]; + symbol: string; + }; + }; + }; + + var cultures: {[culture:string] : { + name?: string; + calendar?: { + AM: string[]; + PM: string[]; + days: { + names: string[]; + namesAbbr: string[]; + namesShort: string[]; + firstDay: number; + }; + months: { + names: string[]; + namesAbbr: string[]; + }; + patterns: { + D: string; + F: string; + G: string; + M: string; + T: string; + Y: string; + d: string; + g: string; + m: string; + s: string; + t: string; + u: string; + y: string; + }; + twoDigitYearMax: number; + }; + calendars?: { + standard: { + AM: string[]; + PM: string[]; + days: { + names: string[]; + namesAbbr: string[]; + namesShort: string[]; + firstDay: number; + }; + months: { + names: string[]; + namesAbbr: string[]; + }; + patterns: { + D: string; + F: string; + G: string; + M: string; + T: string; + Y: string; + d: string; + g: string; + m: string; + s: string; + t: string; + u: string; + y: string; + }; + twoDigitYearMax: number; + }; + }; + numberFormat?: { + currency: { + decimals: number; + groupSize: number[]; + pattern: string[]; + symbol: string; + }; + decimals: number; + groupSize: number[]; + pattern: string[]; + percent: { + decimals: number; + groupSize: number[]; + pattern: string[]; + symbol: string; + }; + }; + }}; + + function format(format: string, ...values: any[]): string; + + function fx(selector: string): effects.Element; + function fx(element: Element): effects.Element; + function fx(element: JQuery): effects.Element; + + function init(selector: string, ...namespaces: any[]): void; + function init(element: JQuery, ...namespaces: any[]): void; + function init(element: Element, ...namespaces: any[]): void; + + function observable(data: any): kendo.data.ObservableObject; + function observableHierarchy(array: any[]): kendo.data.ObservableArray; + + function render(template:(data: any) => string, data: any[]): string; + function template(template: string, options?: TemplateOptions): (data: any) => string; + + function guid(): string; + + function widgetInstance(element: JQuery, suite: typeof kendo.ui): kendo.ui.Widget; + function widgetInstance(element: JQuery, suite: typeof kendo.mobile.ui): kendo.ui.Widget; + function widgetInstance(element: JQuery, suite: typeof kendo.dataviz.ui): kendo.ui.Widget; + + + var ns: string; + + var keys: { + INSERT: number; + DELETE: number; + BACKSPACE: number; + TAB: number; + ENTER: number; + ESC: number; + LEFT: number; + UP: number; + RIGHT: number; + DOWN: number; + END: number; + HOME: number; + SPACEBAR: number; + PAGEUP: number; + PAGEDOWN: number; + F2: number; + F10: number; + F12: number; + } + + var support: { + touch: boolean; + pointers: boolean; + scrollbar(): number; + hasHW3D: boolean; + hasNativeScrolling: boolean; + devicePixelRatio: number; + placeHolder: boolean; + zoomLevel: number; + mobileOS: { + device: string; + tablet: any; + browser: string; + name: string; + majorVersion: string; + minorVersion: string; + flatVersion: number; + appMode: boolean; + }; + browser: { + msie: boolean; + webkit: boolean; + safari: boolean; + opera: boolean; + version: string; + }; + } + + interface TemplateOptions { + paramName?: string; + useWithBlock?: boolean; + } + + class Class { + static fn: Class; + static extend(prototype: Object): Class; + } + + class Observable extends Class { + static fn: Observable; + static extend(prototype: Object): Observable; + + bind(eventName: string, handler: Function): Observable; + one(eventName: string, handler: Function): Observable; + trigger(eventName: string, e?: any): boolean; + unbind(eventName: string, handler?: any): Observable; + } + + interface ViewOptions { + tagName?: string; + wrap?: boolean; + model?: Object; + init?: (e: ViewEvent) => void; + show?: (e: ViewEvent) => void; + hide?: (e: ViewEvent) => void; + } + + interface ViewEvent { + sender: View; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + class View extends Observable { + constructor(element: Element, options?: ViewOptions); + constructor(element: string, options?: ViewOptions); + init(element: Element, options?: ViewOptions): void; + init(element: string, options?: ViewOptions): void; + render(container?: any): JQuery; + destroy(): void; + element: JQuery; + content: any; + tagName: string; + model: Object; + } + + class ViewContainer extends Observable { + view: View; + } + + class Layout extends View { + showIn(selector: string, view: View): void; + containers: { [selector: string]: ViewContainer; }; + } + + class History extends Observable { + start(options: Object): void; + stop(): void; + current: string; + root: string; + change(callback: Function): void; + navigate(location: string, silent?: boolean): void; + } + + var history: History; + + interface RouterOptions { + init?: (e: RouterEvent) => void; + routeMissing?: (e: RouterEvent) => void; + change?: (e: RouterEvent) => void; + } + + interface RouterEvent { + sender: Router; + isDefaultPrevented(): boolean; + preventDefault: Function; + url: string; + } + + class Route extends Class { + route: RegExp; + callback(url: string): void; + worksWith(url: string): void; + } + + class Router extends Observable { + constructor(options?: RouterOptions); + init(options?: RouterOptions): void; + start(): void; + destroy(): void; + route(route: string, callback: Function): void; + navigate(location: string, silent?: boolean): void; + routes: Route[]; + } + +} + +declare module kendo.effects { + interface Element { + expand(direction: string): effects.Expand; + expandHorizontal(): effects.Expand; + expandVertical(): effects.Expand; + fade(direction: string): effects.Fade; + fadeIn(): effects.Fade; + fadeOut(): effects.Fade; + flip(axis: string, face: JQuery, back: JQuery): effects.Flip; + flipHorizontal(face: JQuery, back: JQuery): effects.Flip; + flipVertical(face: JQuery, back: JQuery): effects.Flip; + pageturn(axis: string, face: JQuery, back: JQuery): effects.PageTurn; + pageturnHorizontal(face: JQuery, back: JQuery): effects.PageTurn; + pageturnVertical(face: JQuery, back: JQuery): effects.PageTurn; + slideIn(direction: string): effects.SlideIn; + slideInDown(): effects.SlideIn; + slideInLeft(): effects.SlideIn; + slideInRight(): effects.SlideIn; + slideInUp(): effects.SlideIn; + tile(direction: string, previous: JQuery): effects.Tile; + tileDown(previous: JQuery): effects.Tile; + tileLeft(previous: JQuery): effects.Tile; + tileRight(previous: JQuery): effects.Tile; + tileUp(previous: JQuery): effects.Tile; + transfer(target: JQuery): effects.Transfer; + zoom(direction: string): effects.Zoom; + zoomIn(): effects.Zoom; + zoomOut(): effects.Zoom; + } + + interface Effect { + play(): JQueryPromise; + reverse(): JQueryPromise; + duration(value: number): Effect; + add(effect: Effect): Effect; + stop(): Effect; + } + + interface Expand extends Effect { + duration(value: number): Expand; + direction(value: string): Expand; + stop(): Expand; + add(effect: Effect): Expand; + } + + interface Fade extends Effect { + duration(value: number): Fade; + direction(value: string): Fade; + stop(): Fade; + add(effect: Effect): Fade; + startValue(value: number): Fade; + endValue(value: number): Fade; + } + + interface Flip extends Effect { + duration(value: number): Flip; + direction(value: string): Flip; + stop(): Flip; + add(effect: Effect): Flip; + } + + interface PageTurn extends Effect { + duration(value: number): PageTurn; + direction(value: string): PageTurn; + stop(): PageTurn; + add(effect: Effect): PageTurn; + } + + interface SlideIn extends Effect { + duration(value: number): SlideIn; + direction(value: string): SlideIn; + stop(): SlideIn; + add(effect: Effect): SlideIn; + } + + interface Tile extends Effect { + duration(value: number): Tile; + direction(value: string): Tile; + stop(): Tile; + add(effect: Effect): Tile; + } + + interface Transfer extends Effect { + duration(value: number): Transfer; + stop(): Transfer; + add(effect: Effect): Transfer; + } + + interface Zoom extends Effect { + duration(value: number): Zoom; + direction(value: string): Zoom; + stop(): Zoom; + add(effect: Effect): Zoom; + startValue(value: number): Zoom; + endValue(value: number): Zoom; + } +} + +declare module kendo.data { + interface ObservableObjectEvent { + sender?: ObservableObject; + field?: string; + } + + interface ObservableObjectSetEvent extends ObservableObjectEvent { + value?: any; + preventDefault?: Function; + } + + + class Binding extends Observable { + source: any; + parents: any[]; + path: string; + dependencies: { [path: string]: boolean; }; + observable: boolean; + constructor(parents: any[], path: string); + change(e: Object): void; + start(source: kendo.Observable): void; + stop(source: kendo.Observable): void; + get (): any; + set (value: any): void; + destroy(): void; + } + + class BindingTarget { + target: any; + options: any; + source: any; + } + + class EventBinding extends Binding { + get (): void; + } + + class TemplateBinding extends Binding { + constructor(source: kendo.Observable, path: string, template: Function); + render(value: Object): string; + } + + module binders { } + + interface Bindings { + [key: string]: Binding; + } + + class Binder extends Class { + static fn: Binder; + static extend(prototype: Object): Binder; + + element: any; + bindings: Bindings; + constructor(element: any, bindings: Bindings, options?: BinderOptions); + init(element: any, bindings: Bindings, options?: BinderOptions): void; + bind(binding: Binding, attribute: string): void; + destroy(): void; + refresh(): void; + refresh(attribute: string): void; + options: BinderOptions; + } + + interface BinderOptions { + } + + class ObservableObject extends Observable{ + constructor(value?: any); + init(value?: any): void; + get(name: string): any; + parent(): ObservableObject; + set(name: string, value: any): void; + toJSON(): Object; + uid: string; + } + + class Model extends ObservableObject { + idField: string; + _defaultId: any; + fields: DataSourceSchemaModelFields; + defaults: { + [field: string]: any; + }; + constructor(data?: any); + init(data?: any):void; + accept(data?: any): void; + dirty: boolean; + id: any; + editable(field: string): boolean; + isNew(): boolean; + static idField: string; + static fields: DataSourceSchemaModelFields; + static define(options: DataSourceSchemaModelWithFieldsObject): typeof Model; + static define(options: DataSourceSchemaModelWithFieldsArray): typeof Model; + } + + interface SchedulerEventData { + description?: string; + end?: Date; + endTimezone?: string; + isAllDay?: boolean; + id?: any; + start?: Date; + startTimezone?: string; + recurrenceId?: any; + recurrenceRule?: string; + recurrenceException?: string; + title?: string; + } + + class SchedulerEvent extends Model { + constructor(data?: SchedulerEventData); + init(data?: SchedulerEventData): void; + + description: string; + end: Date; + endTimezone: string; + isAllDay: boolean; + id: any; + start: Date; + startTimezone: string; + recurrenceId: any; + recurrenceRule: string; + recurrenceException: string; + title: string; + static idField: string; + static fields: DataSourceSchemaModelFields; + static define(options: DataSourceSchemaModelWithFieldsObject): typeof SchedulerEvent; + static define(options: DataSourceSchemaModelWithFieldsArray): typeof SchedulerEvent; + clone(options: any, updateUid: boolean): SchedulerEvent; + duration(): number; + expand(start: Date, end: Date, zone: any): SchedulerEvent[]; + update(eventInfo: SchedulerEventData): void; + isMultiDay(): boolean; + isException(): boolean; + isOccurrence(): boolean; + isRecurring(): boolean; + isRecurrenceHead(): boolean; + toOccurrence(options: any): SchedulerEvent; + } + + class TreeListModel extends Model { + constructor(data?: any); + init(data?: any): void; + + id: any; + parentId: any; + + loaded(value: boolean): void; + loaded(): boolean; + + static idField: string; + static fields: DataSourceSchemaModelFields; + static define(options: DataSourceSchemaModelWithFieldsObject): typeof TreeListModel; + static define(options: DataSourceSchemaModelWithFieldsArray): typeof TreeListModel; + } + + class TreeListDataSource extends DataSource { + load(model: kendo.data.TreeListModel): JQueryPromise; + childNodes(model: kendo.data.TreeListModel): kendo.data.TreeListModel[]; + rootNodes(): kendo.data.TreeListModel[]; + parentNode(model: kendo.data.TreeListModel): kendo.data.TreeListModel; + level(model: kendo.data.TreeListModel): number; + level(model: any): number; + + add(model: Object): kendo.data.TreeListModel; + add(model: kendo.data.TreeListModel): kendo.data.TreeListModel; + at(index: number): kendo.data.TreeListModel; + cancelChanges(model?: kendo.data.TreeListModel): void; + get(id: any): kendo.data.TreeListModel; + getByUid(uid: string): kendo.data.TreeListModel; + indexOf(value: kendo.data.TreeListModel): number; + insert(index: number, model: kendo.data.TreeListModel): kendo.data.TreeListModel; + insert(index: number, model: Object): kendo.data.TreeListModel; + remove(model: kendo.data.TreeListModel): void; + } + + class GanttTask extends Model { + constructor(data?: any); + init(data?: any): void; + + id: any; + parentId: number; + orderId: number; + title: string; + start: Date; + end: Date; + percentComplete: number; + summary: boolean; + expanded: boolean; + static idField: string; + static fields: DataSourceSchemaModelFields; + static define(options: DataSourceSchemaModelWithFieldsObject): typeof GanttTask; + static define(options: DataSourceSchemaModelWithFieldsArray): typeof GanttTask; + } + + class GanttDependency extends Model { + constructor(data?: any); + init(data?: any): void; + + id: any; + predecessorId: number; + successorId: number; + type: number; + static idField: string; + static fields: DataSourceSchemaModelFields; + static define(options: DataSourceSchemaModelWithFieldsObject): typeof GanttDependency; + static define(options: DataSourceSchemaModelWithFieldsArray): typeof GanttDependency; + } + + class Node extends Model { + children: HierarchicalDataSource; + + append(model: any): void; + level(): number; + load(id: any): void; + loaded(value: boolean): void; + loaded(): boolean; + parentNode(): Node; + } + + class SchedulerDataSource extends DataSource { + add(model: Object): kendo.data.SchedulerEvent; + add(model: kendo.data.SchedulerEvent): kendo.data.SchedulerEvent; + at(index: number): kendo.data.SchedulerEvent; + cancelChanges(model?: kendo.data.SchedulerEvent): void; + get(id: any): kendo.data.SchedulerEvent; + getByUid(uid: string): kendo.data.SchedulerEvent; + indexOf(value: kendo.data.SchedulerEvent): number; + insert(index: number, model: kendo.data.SchedulerEvent): kendo.data.SchedulerEvent; + insert(index: number, model: Object): kendo.data.SchedulerEvent; + remove(model: kendo.data.SchedulerEvent): void; + } + + class GanttDataSource extends DataSource { + add(model: Object): kendo.data.GanttTask; + add(model: kendo.data.GanttTask): kendo.data.GanttTask; + at(index: number): kendo.data.GanttTask; + cancelChanges(model?: kendo.data.GanttTask): void; + get(id: any): kendo.data.GanttTask; + getByUid(uid: string): kendo.data.GanttTask; + indexOf(value: kendo.data.GanttTask): number; + insert(index: number, model: Object): kendo.data.GanttTask; + insert(index: number, model: kendo.data.GanttTask): kendo.data.GanttTask; + remove(model: kendo.data.GanttTask): void; + } + + class GanttDependencyDataSource extends DataSource { + add(model: Object): kendo.data.GanttDependency; + add(model: kendo.data.GanttDependency): kendo.data.GanttDependency; + at(index: number): kendo.data.GanttDependency; + cancelChanges(model?: kendo.data.GanttDependency): void; + get(id: any): kendo.data.GanttDependency; + getByUid(uid: string): kendo.data.GanttDependency; + indexOf(value: kendo.data.GanttDependency): number; + insert(index: number, model: Object): kendo.data.GanttDependency; + insert(index: number, model: kendo.data.GanttDependency): kendo.data.GanttDependency; + remove(model: kendo.data.GanttDependency): void; + } + + class HierarchicalDataSource extends DataSource { + constructor(options?: HierarchicalDataSourceOptions); + init(options?: HierarchicalDataSourceOptions): void; + } + + interface HierarchicalDataSourceOptions extends DataSourceOptions { + schema?: HierarchicalDataSourceSchema; + } + + + interface HierarchicalDataSourceSchema extends DataSourceSchemaWithOptionsModel { + model?: HierarchicalDataSourceSchemaModel; + } + + interface HierarchicalDataSourceSchemaModel extends DataSourceSchemaModel { + hasChildren?: any; + children?: any; + } + + interface PivotDiscoverRequestRestrictionOptions { + catalogName: string; + cubeName: string; + } + + interface PivotDiscoverRequestDataOptions { + command: string; + restrictions: PivotDiscoverRequestRestrictionOptions; + } + + interface PivotDiscoverRequestOptions { + data: PivotDiscoverRequestDataOptions; + } + + interface PivotTransportConnection { + catalog?: string; + cube?: string; + } + + interface PivotTransportDiscover { + cache?: boolean; + contentType?: string; + data?: any; + dataType?: string; + type?: string; + url?: any; + } + + interface PivotTransport { + discover?: any; + read?: any; + } + + interface PivotTransportWithObjectOperations extends PivotTransport { + connection: PivotTransportConnection; + discover?: PivotTransportDiscover; + read?: DataSourceTransportRead; + } + + interface PivotTransportWithFunctionOperations extends PivotTransport { + discover?: (options: DataSourceTransportOptions) => void; + read?: (options: DataSourceTransportOptions) => void; + } + + interface PivotDataSourceAxisOptions { + name: string; + expand?: boolean; + } + + interface PivotDataSourceMeasureOptions { + values: string[]; + axis?: string; + } + + interface PivotDataSourceOptions extends DataSourceOptions { + columns?: PivotDataSourceAxisOptions[]; + measures?: PivotDataSourceMeasureOptions[]; + rows?: PivotDataSourceAxisOptions[]; + transport?: PivotTransport; + schema?: PivotSchema; + } + + interface PivotTupleModel { + children: PivotTupleModel[]; + caption?: string; + name: string; + levelName?: string; + levelNum: number; + hasChildren?: boolean; + hierarchy?: string; + } + + interface PivotSchemaRowAxis { + tuples: PivotTupleModel[]; + } + + interface PivotSchemaColumnAxis { + tuples: PivotTupleModel[]; + } + + interface PivotSchemaAxes { + rows: PivotSchemaRowAxis; + columns: PivotSchemaColumnAxis; + } + + interface PivotSchema extends DataSourceSchema{ + axes?: any; + catalogs?: any; + cubes?: any; + data?: any; + dimensions?: any; + hierarchies?: any; + levels?: any; + measures?: any; + } + + class PivotDataSource extends DataSource { + axes(): PivotSchemaAxes; + constructor(options?: PivotDataSourceOptions); + init(options?: PivotDataSourceOptions): void; + catalog(val: string): void; + columns(val: string[]): string[]; + cube(val: string): void; + discover(options: PivotDiscoverRequestOptions): JQueryPromise; + measures(val: string[]): string[]; + measuresAxis(): string; + rows(val: string[]): string[]; + schemaCatalogs(): JQueryPromise; + schemaCubes(): JQueryPromise; + schemaDimensions(): JQueryPromise; + schemaHierarchies(): JQueryPromise; + schemaLevels(): JQueryPromise; + schemaMeasures(): JQueryPromise; + } + + interface DataSourceTransport { + parameterMap?(data: DataSourceTransportParameterMapData, type: string): any; + create?: DataSourceTransportCreate; + destroy?: DataSourceTransportDestroy; + push?: Function; + read?: DataSourceTransportRead; + signalr?: DataSourceTransportSignalr; + update?: DataSourceTransportUpdate; + } + + interface DataSourceTransportSignalrClient { + create?: string; + destroy?: string; + read?: string; + update?: string; + } + + interface DataSourceTransportSignalrServer { + create?: string; + destroy?: string; + read?: string; + update?: string; + } + + interface DataSourceTransportSignalr { + client?: DataSourceTransportSignalrClient; + hub?: any; + promise?: any; + server?: DataSourceTransportSignalrServer; + } + + + interface DataSourceParameterMapDataAggregate { + field?: string; + aggregate?: string; + } + + interface DataSourceParameterMapDataGroup { + aggregate?: DataSourceParameterMapDataAggregate[]; + field?: string; + dir?: string; + } + + interface DataSourceParameterMapDataFilter { + field?: string; + filters?: DataSourceParameterMapDataFilter[]; + logic?: string; + operator?: string; + value?: any; + } + + interface DataSourceParameterMapDataSort { + field?: string; + dir?: string; + } + + interface DataSourceTransportParameterMapData { + aggregate?: DataSourceParameterMapDataAggregate[]; + group?: DataSourceParameterMapDataGroup[]; + filter?: DataSourceParameterMapDataFilter; + models?: Model[]; + page?: number; + pageSize?: number; + skip?: number; + sort?: DataSourceParameterMapDataSort[]; + take?: number; + } + + interface DataSourceSchema { + model?: any; + } + + interface DataSourceSchemaWithOptionsModel extends DataSourceSchema { + model?: DataSourceSchemaModel; + } + + interface DataSourceSchemaWithConstructorModel extends DataSourceSchema { + model?: typeof Model; + } + + interface DataSourceSchemaModel { + id?: string; + fields?: any; + } + + interface DataSourceSchemaModelWithFieldsArray extends DataSourceSchemaModel { + fields?: DataSourceSchemaModelField[]; + } + + interface DataSourceSchemaModelWithFieldsObject extends DataSourceSchemaModel { + fields?: DataSourceSchemaModelFields; + } + + interface DataSourceSchemaModelFields { + [index: string]: DataSourceSchemaModelField; + } + + interface DataSourceSchemaModelField { + field?: string; + from?: string; + defaultValue?: any; + editable?: boolean; + nullable?: boolean; + parse?: Function; + type?: string; + validation?: DataSourceSchemaModelFieldValidation; + } + + interface DataSourceSchemaModelFieldValidation { + required?: boolean; + min?: any; + max?: any; + } + + class ObservableArray extends Observable { + constructor(array: any[]); + init(array: any[]): void; + [index: number]: any; + + empty(): void; + every(callback: (item: Object, index: number, source: ObservableArray) => boolean): boolean; + filter(callback: (item: Object, index: number, source: ObservableArray) => boolean): any[]; + find(callback: (item: Object, index: number, source: ObservableArray) => boolean): any; + forEach(callback: (item: Object, index: number, source: ObservableArray) => void ): void; + indexOf(item: any): number; + join(separator: string): string; + length: number; + map(callback: (item: Object, index: number, source: ObservableArray) => any): any[]; + parent(): ObservableObject; + pop(): ObservableObject; + push(...items: any[]): number; + remove(item: Object): void; + shift(): any; + slice(begin: number, end?: number): any[]; + some(callback: (item: Object, index: number, source: ObservableArray) => boolean): boolean; + splice(start: number): any[]; + splice(start: number, deleteCount: number, ...items: any[]): any[]; + toJSON(): any[]; + unshift(...items: any[]): number; + wrap(object: Object, parent: Object): any; + wrapAll(source: Object, target: Object): any; + } + + interface ObservableArrayEvent { + field?: string; + action?: string; + index?: number; + items?: kendo.data.Model[]; + } + + class DataSource extends Observable{ + constructor(options?: DataSourceOptions); + init(options?: DataSourceOptions): void; + static create(options?: DataSourceOptions): DataSource; + options: DataSourceOptions; + add(model: Object): kendo.data.Model; + add(model: kendo.data.Model): kendo.data.Model; + aggregate(val: any): void; + aggregate(): any; + aggregates(): any; + at(index: number): kendo.data.ObservableObject; + cancelChanges(model?: kendo.data.Model): void; + data(): kendo.data.ObservableArray; + data(value: any): void; + fetch(callback?: Function): JQueryPromise; + filter(filters: DataSourceFilterItem): void; + filter(filters: DataSourceFilterItem[]): void; + filter(filters: DataSourceFilters): void; + filter(): DataSourceFilters; + get(id: any): kendo.data.Model; + getByUid(uid: string): kendo.data.Model; + group(groups: any): void; + group(): any; + hasChanges(): boolean; + indexOf(value: kendo.data.ObservableObject): number; + insert(index: number, model: kendo.data.Model): kendo.data.Model; + insert(index: number, model: Object): kendo.data.Model; + online(value: boolean): void; + online(): boolean; + offlineData(data: any[]): void; + offlineData(): any[]; + page(): number; + page(page: number): void; + pageSize(): number; + pageSize(size: number): void; + query(options?: any): JQueryPromise; + read(data?: any): JQueryPromise; + remove(model: kendo.data.ObservableObject): void; + sort(sort: DataSourceSortItem): void; + sort(sort: DataSourceSortItem[]): void; + sort(): DataSourceSortItem[]; + sync(): JQueryPromise; + total(): number; + totalPages(): number; + view(): kendo.data.ObservableArray; + } + + interface DataSourceAggregateItem { + field?: string; + aggregate?: string; + } + + interface DataSourceFilter { + } + + interface DataSourceFilterItem extends DataSourceFilter { + operator?: string; + field?: string; + value?: any; + } + + interface DataSourceFilters extends DataSourceFilter { + logic?: string; + filters?: DataSourceFilter[]; + } + + interface DataSourceGroupItemAggregate { + field?: string; + aggregate?: string; + } + + interface DataSourceGroupItem { + field?: string; + dir?: string; + aggregates?: DataSourceGroupItemAggregate[]; + } + + interface DataSourceSchema { + aggregates?: any; + data?: any; + errors?: any; + groups?: any; + parse?: Function; + total?: any; + type?: string; + } + + interface DataSourceSortItem { + field?: string; + dir?: string; + } + + interface DataSourceTransportCreate { + cache?: boolean; + contentType?: string; + data?: any; + dataType?: string; + type?: string; + url?: any; + } + + interface DataSourceTransportDestroy { + cache?: boolean; + contentType?: string; + data?: any; + dataType?: string; + type?: string; + url?: any; + } + + interface DataSourceTransportRead { + cache?: boolean; + contentType?: string; + data?: any; + dataType?: string; + type?: string; + url?: any; + } + + interface DataSourceTransportUpdate { + cache?: boolean; + contentType?: string; + data?: any; + dataType?: string; + type?: string; + url?: any; + } + + interface DataSourceTransportWithObjectOperations extends DataSourceTransport { + create?: DataSourceTransportCreate; + destroy?: DataSourceTransportDestroy; + read?: DataSourceTransportRead; + update?: DataSourceTransportUpdate; + } + + interface DataSourceTransportWithFunctionOperations extends DataSourceTransport { + create?: (options: DataSourceTransportOptions) => void; + destroy?: (options: DataSourceTransportOptions) => void; + read?: (options: DataSourceTransportReadOptions) => void; + update?: (options: DataSourceTransportOptions) => void; + } + + interface DataSourceTransportOptions { + success: (data?: any) => void; + error: (error?: any) => void; + data: any; + } + + interface DataSourceTransportReadOptionsData { + sort?: DataSourceSortItem[]; + filter?: DataSourceFilters; + group?: DataSourceGroupItem[]; + take?: number; + skip?: number; + } + + interface DataSourceTransportReadOptions extends DataSourceTransportOptions { + data: DataSourceTransportReadOptionsData; + } + + interface DataSourceTransportBatchOptionsData { + models: any[]; + } + + interface DataSourceTransportBatchOptions extends DataSourceTransportOptions { + data: DataSourceTransportBatchOptionsData; + } + + interface DataSourceOptions { + aggregate?: DataSourceAggregateItem[]; + autoSync?: boolean; + batch?: boolean; + data?: any; + filter?: any; + group?: DataSourceGroupItem[]; + offlineStorage?: any; + page?: number; + pageSize?: number; + schema?: DataSourceSchema; + serverAggregates?: boolean; + serverFiltering?: boolean; + serverGrouping?: boolean; + serverPaging?: boolean; + serverSorting?: boolean; + sort?: any; + transport?: DataSourceTransport; + type?: string; + change? (e: DataSourceChangeEvent): void; + error?(e: DataSourceErrorEvent): void; + sync?(e: DataSourceEvent): void; + requestStart?(e: DataSourceRequestStartEvent): void; + requestEnd?(e: DataSourceRequestEndEvent): void; + } + + interface DataSourceEvent { + sender?: DataSource; + } + + interface DataSourceItemOrGroup { + } + + interface DataSourceGroup extends DataSourceItemOrGroup { + aggregates: any[]; + field: string; + hasSubgroups: boolean; + items: DataSourceItemOrGroup[]; + value: any; + } + + interface DataSourceChangeEvent extends DataSourceEvent { + field?: string; + value?: Model; + action?: string; + index?: number; + items?: DataSourceItemOrGroup[]; + node?: any; + } + + interface DataSourceErrorEvent extends DataSourceEvent { + xhr: JQueryXHR; + status: string; + errorThrown: any; + errors?: any; + } + + interface DataSourceRequestStartEvent extends DataSourceEvent { + type?: string; + } + + interface DataSourceRequestEndEvent extends DataSourceEvent { + response?: any; + type?: string; + } +} + +declare module kendo.data.transports { + var odata : DataSourceTransport; +} + +declare module kendo.ui { + function progress(container: JQuery, toggle: boolean): void; + + class Widget extends Observable { + static fn: Widget; + static extend(prototype: Object): Widget; + + constructor(element: Element, options?: Object); + constructor(element: JQuery, options?: Object); + constructor(selector: String, options?: Object); + init(element: Element, options?: Object): void; + init(element: JQuery, options?: Object): void; + init(selector: String, options?: Object): void; + destroy(): void; + element: JQuery; + setOptions(options: Object): void; + resize(force?: boolean): void; + options: Object; + events: string[]; + } + + function plugin(widget: typeof kendo.ui.Widget, register?: typeof kendo.ui, prefix?: String): void; + function plugin(widget: any, register?: typeof kendo.ui, prefix?: String): void; + function plugin(widget: typeof kendo.ui.Widget, register?: typeof kendo.mobile.ui, prefix?: String): void; + function plugin(widget: any, register?: typeof kendo.mobile.ui, prefix?: String): void; + function plugin(widget: typeof kendo.ui.Widget, register?: typeof kendo.dataviz.ui, prefix?: String): void; + function plugin(widget: any, register?: typeof kendo.dataviz.ui, prefix?: String): void; + + class Draggable extends kendo.ui.Widget{ + element: JQuery; + currentTarget: JQuery; + constructor(element: Element, options?: DraggableOptions); + options: DraggableOptions; + } + + interface DraggableEvent { + sender?: Draggable; + } + + class DropTarget extends kendo.ui.Widget{ + element: JQuery; + constructor(element: Element, options?: DropTargetOptions); + options: DropTargetOptions; + static destroyGroup(groupName: string): void; + } + + interface DropTargetOptions { + group?: string; + dragenter?(e: DropTargetDragenterEvent): void; + dragleave?(e: DropTargetDragleaveEvent): void; + drop?(e: DropTargetDropEvent): void; + } + + interface DropTargetEvent { + sender?: DropTarget; + } + + interface DropTargetDragenterEvent extends DropTargetEvent { + draggable?: kendo.ui.Draggable; + } + + interface DropTargetDragleaveEvent extends DropTargetEvent { + draggable?: kendo.ui.Draggable; + } + + interface DropTargetDropEvent extends DropTargetEvent { + draggable?: kendo.ui.Draggable; + } + + class DropTargetArea extends kendo.ui.Widget{ + element: JQuery; + constructor(element: Element, options?: DropTargetAreaOptions); + options: DropTargetAreaOptions; + } + + interface DropTargetAreaOptions { + group?: string; + filter?: string; + dragenter?(e: DropTargetAreaDragenterEvent): void; + dragleave?(e: DropTargetAreaDragleaveEvent): void; + drop?(e: DropTargetAreaDropEvent): void; + } + + interface DropTargetAreaEvent { + sender: DropTargetArea; + } + + interface DropTargetAreaDragenterEvent extends DropTargetAreaEvent { + draggable?: JQuery; + dropTarget?: JQuery; + } + + interface DropTargetAreaDragleaveEvent extends DropTargetAreaEvent { + draggable?: JQuery; + dropTarget?: JQuery; + } + + interface DropTargetAreaDropEvent extends DropTargetAreaEvent { + draggable?: kendo.ui.Draggable; + dropTarget?: JQuery; + } + + interface DraggableOptions { + axis?: string; + container?: JQuery; + cursorOffset?: any; + distance?: number; + filter?: string; + group?: string; + hint?: Function; + ignore?: string; + drag?(e: DraggableEvent): void; + dragcancel?(e: DraggableEvent): void; + dragend?(e: DraggableEvent): void; + dragstart?(e: DraggableEvent): void; + } + + interface GridColumnEditorOptions { + field?: string; + format?: string; + model?: kendo.data.Model; + values?: any[]; + } + + interface GridColumn { + editor?(container: JQuery, options: GridColumnEditorOptions): void; + } +} + +declare module kendo.mobile { + function init(selector: string): void; + function init(element: JQuery): void; + function init(element: Element): void; + + class Application extends Observable { + constructor(element?: any, options?: ApplicationOptions); + init(element?: any, options?: ApplicationOptions): void; + options: ApplicationOptions; + hideLoading(): void; + navigate(url: string, transition?: string): void; + scroller(): kendo.mobile.ui.Scroller; + showLoading(): void; + view(): kendo.mobile.ui.View; + router: kendo.Router; + pane: kendo.mobile.ui.Pane; + } + + interface ApplicationOptions { + hideAddressBar?: boolean; + updateDocumentTitle?: boolean; + initial?: string; + layout?: string; + loading?: string; + platform?: string; + serverNavigation?: boolean; + transition?: string; + } + + interface ApplicationEvent { + sender: Application; + } +} + +declare module kendo.mobile.ui { + + class Widget extends kendo.ui.Widget { + } + + interface TouchAxis { + location?: number; + startLocation?: number; + client?: number; + delta?: number; + velocity?: number; + } + + interface TouchEventOptions { + target?: JQuery; + x?: TouchAxis; + y?: TouchAxis; + } + + interface Point { + x?: number; + y?: number; + } +} +declare module kendo.dataviz.ui { + function registerTheme(name: string, options: any): void; + + function plugin(widget: typeof kendo.ui.Widget): void; + function plugin(widget: any): void; +} + +declare module kendo.dataviz.map { + class Marker { + } +} + +declare module kendo.dataviz.map.layer { + class Shape { + } +} + +declare module kendo.drawing { + class Arc extends kendo.drawing.Element { + constructor(options?: ArcOptions); + options: ArcOptions; + bbox(): kendo.geometry.Rect; + clip(): kendo.drawing.Path; + clip(clip: kendo.drawing.Path): void; + clippedBBox(): kendo.geometry.Rect; + geometry(): kendo.geometry.Arc; + geometry(value: kendo.geometry.Arc): void; + fill(color: string, opacity?: number): kendo.drawing.Arc; + opacity(): number; + opacity(opacity: number): void; + stroke(color: string, width?: number, opacity?: number): kendo.drawing.Arc; + transform(): kendo.geometry.Transformation; + transform(transform: kendo.geometry.Transformation): void; + visible(): boolean; + visible(visible: boolean): void; + } + + interface ArcOptions { + name?: string; + clip?: kendo.drawing.Path; + fill?: kendo.drawing.FillOptions; + opacity?: number; + stroke?: kendo.drawing.StrokeOptions; + transform?: kendo.geometry.Transformation; + visible?: boolean; + } + interface ArcEvent { + sender: Arc; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + class Circle extends kendo.drawing.Element { + constructor(options?: CircleOptions); + options: CircleOptions; + bbox(): kendo.geometry.Rect; + clip(): kendo.drawing.Path; + clip(clip: kendo.drawing.Path): void; + clippedBBox(): kendo.geometry.Rect; + geometry(): kendo.geometry.Circle; + geometry(value: kendo.geometry.Circle): void; + fill(color: string, opacity?: number): kendo.drawing.Circle; + opacity(): number; + opacity(opacity: number): void; + stroke(color: string, width?: number, opacity?: number): kendo.drawing.Circle; + transform(): kendo.geometry.Transformation; + transform(transform: kendo.geometry.Transformation): void; + visible(): boolean; + visible(visible: boolean): void; + } + + interface CircleOptions { + name?: string; + clip?: kendo.drawing.Path; + fill?: kendo.drawing.FillOptions; + opacity?: number; + stroke?: kendo.drawing.StrokeOptions; + transform?: kendo.geometry.Transformation; + visible?: boolean; + } + interface CircleEvent { + sender: Circle; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + class Element extends kendo.Class { + constructor(options?: ElementOptions); + options: ElementOptions; + bbox(): kendo.geometry.Rect; + clip(): kendo.drawing.Path; + clip(clip: kendo.drawing.Path): void; + clippedBBox(): kendo.geometry.Rect; + opacity(): number; + opacity(opacity: number): void; + transform(): kendo.geometry.Transformation; + transform(transform: kendo.geometry.Transformation): void; + visible(): boolean; + visible(visible: boolean): void; + } + + interface ElementOptions { + name?: string; + clip?: kendo.drawing.Path; + opacity?: number; + transform?: kendo.geometry.Transformation; + visible?: boolean; + } + interface ElementEvent { + sender: Element; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + interface FillOptions { + color: string; + opacity: number; + } + + + + class Gradient extends kendo.Class { + constructor(options?: GradientOptions); + options: GradientOptions; + addStop(offset: number, color: string, opacity: number): kendo.drawing.GradientStop; + removeStop(stop: kendo.drawing.GradientStop): void; + stops: any; + } + + interface GradientOptions { + name?: string; + stops?: any; + } + interface GradientEvent { + sender: Gradient; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + class GradientStop extends kendo.Class { + constructor(options?: GradientStopOptions); + options: GradientStopOptions; + } + + interface GradientStopOptions { + name?: string; + offset?: number; + color?: string; + opacity?: number; + } + interface GradientStopEvent { + sender: GradientStop; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + class Group extends kendo.drawing.Element { + constructor(options?: GroupOptions); + options: GroupOptions; + append(element: kendo.drawing.Element): void; + clear(): void; + clip(): kendo.drawing.Path; + clip(clip: kendo.drawing.Path): void; + clippedBBox(): kendo.geometry.Rect; + opacity(): number; + opacity(opacity: number): void; + remove(element: kendo.drawing.Element): void; + removeAt(index: number): void; + visible(): boolean; + visible(visible: boolean): void; + children: any; + } + + interface GroupOptions { + name?: string; + clip?: kendo.drawing.Path; + opacity?: number; + pdf?: kendo.drawing.PDFOptions; + transform?: kendo.geometry.Transformation; + visible?: boolean; + } + interface GroupEvent { + sender: Group; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + class Image extends kendo.drawing.Element { + constructor(options?: ImageOptions); + options: ImageOptions; + bbox(): kendo.geometry.Rect; + clip(): kendo.drawing.Path; + clip(clip: kendo.drawing.Path): void; + clippedBBox(): kendo.geometry.Rect; + opacity(): number; + opacity(opacity: number): void; + src(): string; + src(value: string): void; + rect(): kendo.geometry.Rect; + rect(value: kendo.geometry.Rect): void; + transform(): kendo.geometry.Transformation; + transform(transform: kendo.geometry.Transformation): void; + visible(): boolean; + visible(visible: boolean): void; + } + + interface ImageOptions { + name?: string; + clip?: kendo.drawing.Path; + opacity?: number; + transform?: kendo.geometry.Transformation; + visible?: boolean; + } + interface ImageEvent { + sender: Image; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + class Layout extends kendo.drawing.Group { + constructor(options?: LayoutOptions); + options: LayoutOptions; + rect(): kendo.geometry.Rect; + rect(rect: kendo.geometry.Rect): void; + reflow(): void; + } + + interface LayoutOptions { + name?: string; + alignContent?: string; + alignItems?: string; + justifyContent?: string; + lineSpacing?: number; + spacing?: number; + orientation?: string; + wrap?: boolean; + } + interface LayoutEvent { + sender: Layout; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + class LinearGradient extends kendo.drawing.Gradient { + constructor(options?: LinearGradientOptions); + options: LinearGradientOptions; + addStop(offset: number, color: string, opacity: number): kendo.drawing.GradientStop; + end(): kendo.geometry.Point; + end(end: any): void; + end(end: kendo.geometry.Point): void; + start(): kendo.geometry.Point; + start(start: any): void; + start(start: kendo.geometry.Point): void; + removeStop(stop: kendo.drawing.GradientStop): void; + stops: any; + } + + interface LinearGradientOptions { + name?: string; + stops?: any; + } + interface LinearGradientEvent { + sender: LinearGradient; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + class MultiPath extends kendo.drawing.Element { + constructor(options?: MultiPathOptions); + options: MultiPathOptions; + bbox(): kendo.geometry.Rect; + clip(): kendo.drawing.Path; + clip(clip: kendo.drawing.Path): void; + clippedBBox(): kendo.geometry.Rect; + close(): kendo.drawing.MultiPath; + curveTo(controlOut: any, controlIn: any): kendo.drawing.MultiPath; + curveTo(controlOut: any, controlIn: kendo.geometry.Point): kendo.drawing.MultiPath; + curveTo(controlOut: kendo.geometry.Point, controlIn: any): kendo.drawing.MultiPath; + curveTo(controlOut: kendo.geometry.Point, controlIn: kendo.geometry.Point): kendo.drawing.MultiPath; + fill(color: string, opacity?: number): kendo.drawing.MultiPath; + lineTo(x: number, y?: number): kendo.drawing.MultiPath; + lineTo(x: any, y?: number): kendo.drawing.MultiPath; + lineTo(x: kendo.geometry.Point, y?: number): kendo.drawing.MultiPath; + moveTo(x: number, y?: number): kendo.drawing.MultiPath; + moveTo(x: any, y?: number): kendo.drawing.MultiPath; + moveTo(x: kendo.geometry.Point, y?: number): kendo.drawing.MultiPath; + opacity(): number; + opacity(opacity: number): void; + stroke(color: string, width?: number, opacity?: number): kendo.drawing.MultiPath; + transform(): kendo.geometry.Transformation; + transform(transform: kendo.geometry.Transformation): void; + visible(): boolean; + visible(visible: boolean): void; + paths: any; + } + + interface MultiPathOptions { + name?: string; + clip?: kendo.drawing.Path; + fill?: kendo.drawing.FillOptions; + opacity?: number; + stroke?: kendo.drawing.StrokeOptions; + transform?: kendo.geometry.Transformation; + visible?: boolean; + } + interface MultiPathEvent { + sender: MultiPath; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + class OptionsStore extends kendo.Class { + options: OptionsStoreOptions; + get(field: string): any; + set(field: string, value: any): void; + observer: any; + } + + interface OptionsStoreOptions { + name?: string; + } + interface OptionsStoreEvent { + sender: OptionsStore; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + interface PDFOptions { + creator: string; + date: Date; + keywords: string; + landscape: boolean; + margin: any; + paperSize: any; + subject: string; + title: string; + } + + + + class Path extends kendo.drawing.Element { + constructor(options?: PathOptions); + options: PathOptions; + bbox(): kendo.geometry.Rect; + clip(): kendo.drawing.Path; + clip(clip: kendo.drawing.Path): void; + clippedBBox(): kendo.geometry.Rect; + close(): kendo.drawing.Path; + curveTo(controlOut: any, controlIn: any): kendo.drawing.Path; + curveTo(controlOut: any, controlIn: kendo.geometry.Point): kendo.drawing.Path; + curveTo(controlOut: kendo.geometry.Point, controlIn: any): kendo.drawing.Path; + curveTo(controlOut: kendo.geometry.Point, controlIn: kendo.geometry.Point): kendo.drawing.Path; + fill(color: string, opacity?: number): kendo.drawing.Path; + lineTo(x: number, y?: number): kendo.drawing.Path; + lineTo(x: any, y?: number): kendo.drawing.Path; + lineTo(x: kendo.geometry.Point, y?: number): kendo.drawing.Path; + moveTo(x: number, y?: number): kendo.drawing.Path; + moveTo(x: any, y?: number): kendo.drawing.Path; + moveTo(x: kendo.geometry.Point, y?: number): kendo.drawing.Path; + opacity(): number; + opacity(opacity: number): void; + stroke(color: string, width?: number, opacity?: number): kendo.drawing.Path; + transform(): kendo.geometry.Transformation; + transform(transform: kendo.geometry.Transformation): void; + visible(): boolean; + visible(visible: boolean): void; + static fromPoints(points: any): kendo.drawing.Path; + static fromRect(rect: kendo.geometry.Rect): kendo.drawing.Path; + static parse(svgPath: string, options?: any): kendo.drawing.Path; + segments: any; + } + + interface PathOptions { + name?: string; + clip?: kendo.drawing.Path; + fill?: kendo.drawing.FillOptions; + opacity?: number; + stroke?: kendo.drawing.StrokeOptions; + transform?: kendo.geometry.Transformation; + visible?: boolean; + } + interface PathEvent { + sender: Path; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + class RadialGradient extends kendo.drawing.Gradient { + constructor(options?: RadialGradientOptions); + options: RadialGradientOptions; + addStop(offset: number, color: string, opacity: number): kendo.drawing.GradientStop; + center(): kendo.geometry.Point; + center(center: any): void; + center(center: kendo.geometry.Point): void; + radius(): number; + radius(value: number): void; + removeStop(stop: kendo.drawing.GradientStop): void; + stops: any; + } + + interface RadialGradientOptions { + name?: string; + center?: any; + radius?: number; + stops?: any; + } + interface RadialGradientEvent { + sender: RadialGradient; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + class Segment extends kendo.Class { + options: SegmentOptions; + anchor(): kendo.geometry.Point; + anchor(value: kendo.geometry.Point): void; + controlIn(): kendo.geometry.Point; + controlIn(value: kendo.geometry.Point): void; + controlOut(): kendo.geometry.Point; + controlOut(value: kendo.geometry.Point): void; + } + + interface SegmentOptions { + name?: string; + } + interface SegmentEvent { + sender: Segment; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + interface StrokeOptions { + color: string; + dashType: string; + lineCap: string; + lineJoin: string; + opacity: number; + width: number; + } + + + + class Surface extends kendo.Observable { + constructor(options?: SurfaceOptions); + options: SurfaceOptions; + clear(): void; + draw(element: kendo.drawing.Element): void; + eventTarget(e: any): kendo.drawing.Element; + resize(force?: boolean): void; + static create(element: JQuery, options?: any): kendo.drawing.Surface; + static create(element: Element, options?: any): kendo.drawing.Surface; + } + + interface SurfaceOptions { + name?: string; + type?: string; + height?: string; + width?: string; + click?(e: SurfaceClickEvent): void; + mouseenter?(e: SurfaceMouseenterEvent): void; + mouseleave?(e: SurfaceMouseleaveEvent): void; + } + interface SurfaceEvent { + sender: Surface; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + interface SurfaceClickEvent extends SurfaceEvent { + element?: kendo.drawing.Element; + originalEvent?: any; + } + + interface SurfaceMouseenterEvent extends SurfaceEvent { + element?: kendo.drawing.Element; + originalEvent?: any; + } + + interface SurfaceMouseleaveEvent extends SurfaceEvent { + element?: kendo.drawing.Element; + originalEvent?: any; + } + + + class Text extends kendo.drawing.Element { + constructor(options?: TextOptions); + options: TextOptions; + bbox(): kendo.geometry.Rect; + clip(): kendo.drawing.Path; + clip(clip: kendo.drawing.Path): void; + clippedBBox(): kendo.geometry.Rect; + content(): string; + content(value: string): void; + fill(color: string, opacity?: number): kendo.drawing.Text; + opacity(): number; + opacity(opacity: number): void; + position(): kendo.geometry.Point; + position(value: kendo.geometry.Point): void; + stroke(color: string, width?: number, opacity?: number): kendo.drawing.Text; + transform(): kendo.geometry.Transformation; + transform(transform: kendo.geometry.Transformation): void; + visible(): boolean; + visible(visible: boolean): void; + } + + interface TextOptions { + name?: string; + clip?: kendo.drawing.Path; + fill?: kendo.drawing.FillOptions; + font?: string; + opacity?: number; + stroke?: kendo.drawing.StrokeOptions; + transform?: kendo.geometry.Transformation; + visible?: boolean; + } + interface TextEvent { + sender: Text; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + +} +declare module kendo.geometry { + class Arc extends Observable { + options: ArcOptions; + bbox(matrix: kendo.geometry.Matrix): kendo.geometry.Rect; + getAnticlockwise(): boolean; + getCenter(): kendo.geometry.Point; + getEndAngle(): number; + getRadiusX(): number; + getRadiusY(): number; + getStartAngle(): number; + pointAt(angle: number): kendo.geometry.Point; + setAnticlockwise(value: boolean): kendo.geometry.Arc; + setCenter(value: kendo.geometry.Point): kendo.geometry.Arc; + setEndAngle(value: number): kendo.geometry.Arc; + setRadiusX(value: number): kendo.geometry.Arc; + setRadiusY(value: number): kendo.geometry.Arc; + setStartAngle(value: number): kendo.geometry.Arc; + anticlockwise: boolean; + center: kendo.geometry.Point; + endAngle: number; + radiusX: number; + radiusY: number; + startAngle: number; + } + + interface ArcOptions { + name?: string; + } + interface ArcEvent { + sender: Arc; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + class Circle extends Observable { + options: CircleOptions; + bbox(matrix: kendo.geometry.Matrix): kendo.geometry.Rect; + clone(): kendo.geometry.Circle; + equals(other: kendo.geometry.Circle): boolean; + getCenter(): kendo.geometry.Point; + getRadius(): number; + pointAt(angle: number): kendo.geometry.Point; + setCenter(value: kendo.geometry.Point): kendo.geometry.Point; + setCenter(value: any): kendo.geometry.Point; + setRadius(value: number): kendo.geometry.Circle; + center: kendo.geometry.Point; + radius: number; + } + + interface CircleOptions { + name?: string; + } + interface CircleEvent { + sender: Circle; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + class Matrix extends Observable { + options: MatrixOptions; + clone(): kendo.geometry.Matrix; + equals(other: kendo.geometry.Matrix): boolean; + round(digits: number): kendo.geometry.Matrix; + multiplyCopy(matrix: kendo.geometry.Matrix): kendo.geometry.Matrix; + toArray(digits: number): any; + toString(digits: number, separator: string): string; + static rotate(angle: number, x: number, y: number): kendo.geometry.Matrix; + static scale(scaleX: number, scaleY: number): kendo.geometry.Matrix; + static translate(x: number, y: number): kendo.geometry.Matrix; + static unit(): kendo.geometry.Matrix; + a: number; + b: number; + c: number; + d: number; + e: number; + f: number; + } + + interface MatrixOptions { + name?: string; + } + interface MatrixEvent { + sender: Matrix; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + class Point extends Observable { + options: PointOptions; + clone(): kendo.geometry.Point; + distanceTo(point: kendo.geometry.Point): number; + equals(other: kendo.geometry.Point): boolean; + getX(): number; + getY(): number; + move(x: number, y: number): kendo.geometry.Point; + rotate(angle: number, center: kendo.geometry.Point): kendo.geometry.Point; + rotate(angle: number, center: any): kendo.geometry.Point; + round(digits: number): kendo.geometry.Point; + scale(scaleX: number, scaleY: number): kendo.geometry.Point; + scaleCopy(scaleX: number, scaleY: number): kendo.geometry.Point; + setX(value: number): kendo.geometry.Point; + setY(value: number): kendo.geometry.Point; + toArray(digits: number): any; + toString(digits: number, separator: string): string; + transform(tansformation: kendo.geometry.Transformation): kendo.geometry.Point; + transformCopy(tansformation: kendo.geometry.Transformation): kendo.geometry.Point; + translate(dx: number, dy: number): kendo.geometry.Point; + translateWith(vector: kendo.geometry.Point): kendo.geometry.Point; + translateWith(vector: any): kendo.geometry.Point; + static create(x: number, y: number): kendo.geometry.Point; + static create(x: any, y: number): kendo.geometry.Point; + static create(x: kendo.geometry.Point, y: number): kendo.geometry.Point; + static min(): kendo.geometry.Point; + static max(): kendo.geometry.Point; + static minPoint(): kendo.geometry.Point; + static maxPoint(): kendo.geometry.Point; + x: number; + y: number; + } + + interface PointOptions { + name?: string; + } + interface PointEvent { + sender: Point; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + class Rect extends Observable { + options: RectOptions; + bbox(matrix: kendo.geometry.Matrix): kendo.geometry.Rect; + bottomLeft(): kendo.geometry.Point; + bottomRight(): kendo.geometry.Point; + center(): kendo.geometry.Point; + clone(): kendo.geometry.Rect; + equals(other: kendo.geometry.Rect): boolean; + getOrigin(): kendo.geometry.Point; + getSize(): kendo.geometry.Size; + height(): number; + setOrigin(value: kendo.geometry.Point): kendo.geometry.Rect; + setOrigin(value: any): kendo.geometry.Rect; + setSize(value: kendo.geometry.Size): kendo.geometry.Rect; + setSize(value: any): kendo.geometry.Rect; + topLeft(): kendo.geometry.Point; + topRight(): kendo.geometry.Point; + width(): number; + static fromPoints(pointA: kendo.geometry.Point, pointB: kendo.geometry.Point): kendo.geometry.Rect; + static union(rectA: kendo.geometry.Rect, rectB: kendo.geometry.Rect): kendo.geometry.Rect; + origin: kendo.geometry.Point; + size: kendo.geometry.Size; + } + + interface RectOptions { + name?: string; + } + interface RectEvent { + sender: Rect; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + class Size extends Observable { + options: SizeOptions; + clone(): kendo.geometry.Size; + equals(other: kendo.geometry.Size): boolean; + getWidth(): number; + getHeight(): number; + setWidth(value: number): kendo.geometry.Size; + setHeight(value: number): kendo.geometry.Size; + static create(width: number, height: number): kendo.geometry.Size; + static create(width: any, height: number): kendo.geometry.Size; + static create(width: kendo.geometry.Size, height: number): kendo.geometry.Size; + width: number; + height: number; + } + + interface SizeOptions { + name?: string; + } + interface SizeEvent { + sender: Size; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + class Transformation extends Observable { + options: TransformationOptions; + clone(): kendo.geometry.Transformation; + equals(other: kendo.geometry.Transformation): boolean; + matrix(): kendo.geometry.Matrix; + multiply(transformation: kendo.geometry.Transformation): kendo.geometry.Transformation; + rotate(angle: number, center: any): kendo.geometry.Transformation; + rotate(angle: number, center: kendo.geometry.Point): kendo.geometry.Transformation; + scale(scaleX: number, scaleY: number): kendo.geometry.Transformation; + translate(x: number, y: number): kendo.geometry.Transformation; + } + + interface TransformationOptions { + name?: string; + } + interface TransformationEvent { + sender: Transformation; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + +} +declare module kendo.ui { + class AutoComplete extends kendo.ui.Widget { + static fn: AutoComplete; + static extend(proto: Object): AutoComplete; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: AutoCompleteOptions); + options: AutoCompleteOptions; + dataSource: kendo.data.DataSource; + close(): void; + dataItem(index: number): any; + destroy(): void; + enable(enable: boolean): void; + focus(): void; + readonly(readonly: boolean): void; + refresh(): void; + search(word: string): void; + select(item: string): void; + select(item: Element): void; + select(item: JQuery): void; + setDataSource(dataSource: kendo.data.DataSource): void; + suggest(value: string): void; + value(): string; + value(value: string): void; + list: JQuery; + ul: JQuery; + } + + interface AutoCompleteAnimationClose { + duration?: number; + effects?: string; + } + + interface AutoCompleteAnimationOpen { + duration?: number; + effects?: string; + } + + interface AutoCompleteAnimation { + close?: AutoCompleteAnimationClose; + open?: AutoCompleteAnimationOpen; + } + + interface AutoCompleteVirtual { + itemHeight?: number; + valueMapper?: Function; + } + + interface AutoCompleteOptions { + name?: string; + animation?: AutoCompleteAnimation; + dataSource?: any; + dataTextField?: string; + delay?: number; + enable?: boolean; + filter?: string; + fixedGroupTemplate?: any; + groupTemplate?: any; + height?: number; + highlightFirst?: boolean; + ignoreCase?: boolean; + minLength?: number; + placeholder?: string; + separator?: string; + suggest?: boolean; + headerTemplate?: any; + template?: any; + valuePrimitive?: boolean; + virtual?: AutoCompleteVirtual; + change?(e: AutoCompleteChangeEvent): void; + close?(e: AutoCompleteCloseEvent): void; + dataBound?(e: AutoCompleteDataBoundEvent): void; + filtering?(e: AutoCompleteFilteringEvent): void; + open?(e: AutoCompleteOpenEvent): void; + select?(e: AutoCompleteSelectEvent): void; + } + interface AutoCompleteEvent { + sender: AutoComplete; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + interface AutoCompleteChangeEvent extends AutoCompleteEvent { + } + + interface AutoCompleteCloseEvent extends AutoCompleteEvent { + } + + interface AutoCompleteDataBoundEvent extends AutoCompleteEvent { + } + + interface AutoCompleteFilteringEvent extends AutoCompleteEvent { + filter?: any; + } + + interface AutoCompleteOpenEvent extends AutoCompleteEvent { + } + + interface AutoCompleteSelectEvent extends AutoCompleteEvent { + item?: JQuery; + } + + + class Button extends kendo.ui.Widget { + static fn: Button; + static extend(proto: Object): Button; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: ButtonOptions); + options: ButtonOptions; + enable(toggle: boolean): void; + } + + interface ButtonOptions { + name?: string; + enable?: boolean; + icon?: string; + imageUrl?: string; + spriteCssClass?: string; + click?(e: ButtonClickEvent): void; + } + interface ButtonEvent { + sender: Button; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + interface ButtonClickEvent extends ButtonEvent { + event?: any; + } + + + class Calendar extends kendo.ui.Widget { + static fn: Calendar; + static extend(proto: Object): Calendar; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: CalendarOptions); + options: CalendarOptions; + current(): Date; + destroy(): void; + max(): Date; + max(value: Date): void; + max(value: string): void; + min(): Date; + min(value: Date): void; + min(value: string): void; + navigate(value: Date, view: string): void; + navigateDown(value: Date): void; + navigateToFuture(): void; + navigateToPast(): void; + navigateUp(): void; + value(): Date; + value(value: Date): void; + value(value: string): void; + view(): any; + } + + interface CalendarMonth { + content?: string; + empty?: string; + } + + interface CalendarOptions { + name?: string; + culture?: string; + dates?: any; + depth?: string; + footer?: any; + format?: string; + max?: Date; + min?: Date; + month?: CalendarMonth; + start?: string; + value?: Date; + change?(e: CalendarEvent): void; + navigate?(e: CalendarEvent): void; + } + interface CalendarEvent { + sender: Calendar; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + class ColorPalette extends kendo.ui.Widget { + static fn: ColorPalette; + static extend(proto: Object): ColorPalette; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: ColorPaletteOptions); + options: ColorPaletteOptions; + value(): string; + value(color?: string): void; + color(): kendo.Color; + color(color?: kendo.Color): void; + enable(enable?: boolean): void; + } + + interface ColorPaletteTileSize { + width?: number; + height?: number; + } + + interface ColorPaletteOptions { + name?: string; + palette?: any; + columns?: number; + tileSize?: ColorPaletteTileSize; + value?: string; + change?(e: ColorPaletteEvent): void; + } + interface ColorPaletteEvent { + sender: ColorPalette; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + class ColorPicker extends kendo.ui.Widget { + static fn: ColorPicker; + static extend(proto: Object): ColorPicker; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: ColorPickerOptions); + options: ColorPickerOptions; + close(): void; + open(): void; + toggle(): void; + value(): string; + value(color?: string): void; + color(): kendo.Color; + color(color?: kendo.Color): void; + enable(enable?: boolean): void; + } + + interface ColorPickerMessages { + apply?: string; + cancel?: string; + } + + interface ColorPickerTileSize { + width?: number; + height?: number; + } + + interface ColorPickerOptions { + name?: string; + buttons?: boolean; + columns?: number; + tileSize?: ColorPickerTileSize; + messages?: ColorPickerMessages; + palette?: any; + opacity?: boolean; + preview?: boolean; + toolIcon?: string; + value?: string; + change?(e: ColorPickerChangeEvent): void; + select?(e: ColorPickerSelectEvent): void; + open?(e: ColorPickerEvent): void; + close?(e: ColorPickerEvent): void; + } + interface ColorPickerEvent { + sender: ColorPicker; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + interface ColorPickerChangeEvent extends ColorPickerEvent { + value?: string; + } + + interface ColorPickerSelectEvent extends ColorPickerEvent { + value?: string; + } + + + class ComboBox extends kendo.ui.Widget { + static fn: ComboBox; + static extend(proto: Object): ComboBox; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: ComboBoxOptions); + options: ComboBoxOptions; + dataSource: kendo.data.DataSource; + close(): void; + dataItem(index?: number): any; + destroy(): void; + enable(enable: boolean): void; + readonly(readonly: boolean): void; + focus(): void; + open(): void; + refresh(): void; + search(word: string): void; + select(): number; + select(li: JQuery): void; + select(li: number): void; + select(li: Function): void; + setDataSource(dataSource: kendo.data.DataSource): void; + suggest(value: string): void; + text(): string; + text(text: string): void; + toggle(toggle: boolean): void; + value(): string; + value(value: string): void; + input: JQuery; + list: JQuery; + ul: JQuery; + } + + interface ComboBoxAnimationClose { + effects?: string; + duration?: number; + } + + interface ComboBoxAnimationOpen { + effects?: string; + duration?: number; + } + + interface ComboBoxAnimation { + close?: ComboBoxAnimationClose; + open?: ComboBoxAnimationOpen; + } + + interface ComboBoxVirtual { + itemHeight?: number; + valueMapper?: Function; + } + + interface ComboBoxOptions { + name?: string; + animation?: ComboBoxAnimation; + autoBind?: boolean; + cascadeFrom?: string; + cascadeFromField?: string; + dataSource?: any; + dataTextField?: string; + dataValueField?: string; + delay?: number; + enable?: boolean; + filter?: string; + fixedGroupTemplate?: any; + groupTemplate?: any; + height?: number; + highlightFirst?: boolean; + ignoreCase?: string; + index?: number; + minLength?: number; + placeholder?: string; + suggest?: boolean; + headerTemplate?: any; + template?: any; + text?: string; + value?: string; + valuePrimitive?: boolean; + virtual?: ComboBoxVirtual; + change?(e: ComboBoxChangeEvent): void; + close?(e: ComboBoxCloseEvent): void; + dataBound?(e: ComboBoxDataBoundEvent): void; + filtering?(e: ComboBoxFilteringEvent): void; + open?(e: ComboBoxOpenEvent): void; + select?(e: ComboBoxSelectEvent): void; + cascade?(e: ComboBoxCascadeEvent): void; + } + interface ComboBoxEvent { + sender: ComboBox; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + interface ComboBoxChangeEvent extends ComboBoxEvent { + } + + interface ComboBoxCloseEvent extends ComboBoxEvent { + } + + interface ComboBoxDataBoundEvent extends ComboBoxEvent { + } + + interface ComboBoxFilteringEvent extends ComboBoxEvent { + filter?: any; + } + + interface ComboBoxOpenEvent extends ComboBoxEvent { + } + + interface ComboBoxSelectEvent extends ComboBoxEvent { + item?: JQuery; + } + + interface ComboBoxCascadeEvent extends ComboBoxEvent { + } + + + class ContextMenu extends kendo.ui.Widget { + static fn: ContextMenu; + static extend(proto: Object): ContextMenu; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: ContextMenuOptions); + options: ContextMenuOptions; + append(item: any, referenceItem: string): kendo.ui.ContextMenu; + append(item: any, referenceItem: JQuery): kendo.ui.ContextMenu; + close(element: Element): kendo.ui.ContextMenu; + close(element: JQuery): kendo.ui.ContextMenu; + destroy(): void; + enable(element: string, enable: boolean): kendo.ui.ContextMenu; + enable(element: Element, enable: boolean): kendo.ui.ContextMenu; + enable(element: JQuery, enable: boolean): kendo.ui.ContextMenu; + insertAfter(item: string, referenceItem: string): kendo.ui.ContextMenu; + insertAfter(item: string, referenceItem: Element): kendo.ui.ContextMenu; + insertAfter(item: string, referenceItem: JQuery): kendo.ui.ContextMenu; + insertAfter(item: Element, referenceItem: string): kendo.ui.ContextMenu; + insertAfter(item: Element, referenceItem: Element): kendo.ui.ContextMenu; + insertAfter(item: Element, referenceItem: JQuery): kendo.ui.ContextMenu; + insertAfter(item: JQuery, referenceItem: string): kendo.ui.ContextMenu; + insertAfter(item: JQuery, referenceItem: Element): kendo.ui.ContextMenu; + insertAfter(item: JQuery, referenceItem: JQuery): kendo.ui.ContextMenu; + insertBefore(item: string, referenceItem: string): kendo.ui.ContextMenu; + insertBefore(item: string, referenceItem: Element): kendo.ui.ContextMenu; + insertBefore(item: string, referenceItem: JQuery): kendo.ui.ContextMenu; + insertBefore(item: Element, referenceItem: string): kendo.ui.ContextMenu; + insertBefore(item: Element, referenceItem: Element): kendo.ui.ContextMenu; + insertBefore(item: Element, referenceItem: JQuery): kendo.ui.ContextMenu; + insertBefore(item: JQuery, referenceItem: string): kendo.ui.ContextMenu; + insertBefore(item: JQuery, referenceItem: Element): kendo.ui.ContextMenu; + insertBefore(item: JQuery, referenceItem: JQuery): kendo.ui.ContextMenu; + open(x: number, y: number): kendo.ui.ContextMenu; + open(x: Element, y: number): kendo.ui.ContextMenu; + open(x: JQuery, y: number): kendo.ui.ContextMenu; + remove(element: string): kendo.ui.ContextMenu; + remove(element: Element): kendo.ui.ContextMenu; + remove(element: JQuery): kendo.ui.ContextMenu; + } + + interface ContextMenuAnimationClose { + effects?: string; + duration?: number; + } + + interface ContextMenuAnimationOpen { + effects?: string; + duration?: number; + } + + interface ContextMenuAnimation { + close?: ContextMenuAnimationClose; + open?: ContextMenuAnimationOpen; + } + + interface ContextMenuOptions { + name?: string; + alignToAnchor?: boolean; + animation?: ContextMenuAnimation; + closeOnClick?: boolean; + dataSource?: any; + direction?: string; + filter?: string; + hoverDelay?: number; + orientation?: string; + popupCollision?: string; + showOn?: string; + target?: any; + close?(e: ContextMenuCloseEvent): void; + open?(e: ContextMenuOpenEvent): void; + activate?(e: ContextMenuActivateEvent): void; + deactivate?(e: ContextMenuDeactivateEvent): void; + select?(e: ContextMenuSelectEvent): void; + } + interface ContextMenuEvent { + sender: ContextMenu; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + interface ContextMenuCloseEvent extends ContextMenuEvent { + item?: Element; + type?: string; + target?: Element; + event?: JQueryEventObject; + } + + interface ContextMenuOpenEvent extends ContextMenuEvent { + item?: Element; + type?: string; + target?: Element; + event?: JQueryEventObject; + } + + interface ContextMenuActivateEvent extends ContextMenuEvent { + item?: Element; + type?: string; + target?: Element; + } + + interface ContextMenuDeactivateEvent extends ContextMenuEvent { + item?: Element; + type?: string; + target?: Element; + } + + interface ContextMenuSelectEvent extends ContextMenuEvent { + item?: Element; + type?: string; + target?: Element; + } + + + class DatePicker extends kendo.ui.Widget { + static fn: DatePicker; + static extend(proto: Object): DatePicker; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: DatePickerOptions); + options: DatePickerOptions; + close(): void; + destroy(): void; + enable(enable: boolean): void; + readonly(readonly: boolean): void; + max(): Date; + max(value: Date): void; + max(value: string): void; + min(): Date; + min(value: Date): void; + min(value: string): void; + open(): void; + setOptions(options: any): void; + value(): Date; + value(value: Date): void; + value(value: string): void; + } + + interface DatePickerAnimationClose { + effects?: string; + duration?: number; + } + + interface DatePickerAnimationOpen { + effects?: string; + duration?: number; + } + + interface DatePickerAnimation { + close?: DatePickerAnimationClose; + open?: DatePickerAnimationOpen; + } + + interface DatePickerMonth { + content?: string; + empty?: string; + } + + interface DatePickerOptions { + name?: string; + animation?: DatePickerAnimation; + ARIATemplate?: string; + culture?: string; + dates?: any; + depth?: string; + footer?: any; + format?: string; + max?: Date; + min?: Date; + month?: DatePickerMonth; + parseFormats?: any; + start?: string; + value?: Date; + change?(e: DatePickerChangeEvent): void; + close?(e: DatePickerCloseEvent): void; + open?(e: DatePickerOpenEvent): void; + } + interface DatePickerEvent { + sender: DatePicker; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + interface DatePickerChangeEvent extends DatePickerEvent { + } + + interface DatePickerCloseEvent extends DatePickerEvent { + } + + interface DatePickerOpenEvent extends DatePickerEvent { + } + + + class DateTimePicker extends kendo.ui.Widget { + static fn: DateTimePicker; + static extend(proto: Object): DateTimePicker; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: DateTimePickerOptions); + options: DateTimePickerOptions; + close(view: string): void; + destroy(): void; + enable(enable: boolean): void; + readonly(readonly: boolean): void; + max(): Date; + max(value: Date): void; + max(value: string): void; + min(): Date; + min(value: Date): void; + min(value: string): void; + open(view: string): void; + setOptions(options: any): void; + toggle(view: string): void; + value(): Date; + value(value: Date): void; + value(value: string): void; + } + + interface DateTimePickerAnimationClose { + effects?: string; + duration?: number; + } + + interface DateTimePickerAnimationOpen { + effects?: string; + duration?: number; + } + + interface DateTimePickerAnimation { + close?: DateTimePickerAnimationClose; + open?: DateTimePickerAnimationOpen; + } + + interface DateTimePickerMonth { + content?: string; + empty?: string; + } + + interface DateTimePickerOptions { + name?: string; + animation?: DateTimePickerAnimation; + ARIATemplate?: string; + culture?: string; + dates?: any; + depth?: string; + footer?: string; + format?: string; + interval?: number; + max?: Date; + min?: Date; + month?: DateTimePickerMonth; + parseFormats?: any; + start?: string; + timeFormat?: string; + value?: Date; + change?(e: DateTimePickerChangeEvent): void; + close?(e: DateTimePickerCloseEvent): void; + open?(e: DateTimePickerOpenEvent): void; + } + interface DateTimePickerEvent { + sender: DateTimePicker; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + interface DateTimePickerChangeEvent extends DateTimePickerEvent { + } + + interface DateTimePickerCloseEvent extends DateTimePickerEvent { + view?: string; + } + + interface DateTimePickerOpenEvent extends DateTimePickerEvent { + view?: string; + } + + + class DropDownList extends kendo.ui.Widget { + static fn: DropDownList; + static extend(proto: Object): DropDownList; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: DropDownListOptions); + options: DropDownListOptions; + dataSource: kendo.data.DataSource; + close(): void; + dataItem(index?: number): any; + destroy(): void; + focus(): void; + open(): void; + enable(enable: boolean): void; + readonly(readonly: boolean): void; + refresh(): void; + search(word: string): void; + select(): number; + select(li: JQuery): void; + select(li: number): void; + select(li: Function): void; + setDataSource(dataSource: kendo.data.DataSource): void; + text(): string; + text(text: string): void; + toggle(toggle: boolean): void; + value(): string; + value(value: string): void; + span: JQuery; + filterInput: JQuery; + list: JQuery; + ul: JQuery; + } + + interface DropDownListAnimationClose { + effects?: string; + duration?: number; + } + + interface DropDownListAnimationOpen { + effects?: string; + duration?: number; + } + + interface DropDownListAnimation { + close?: DropDownListAnimationClose; + open?: DropDownListAnimationOpen; + } + + interface DropDownListVirtual { + itemHeight?: number; + valueMapper?: Function; + } + + interface DropDownListOptions { + name?: string; + animation?: DropDownListAnimation; + autoBind?: boolean; + cascadeFrom?: string; + cascadeFromField?: string; + dataSource?: any; + dataTextField?: string; + dataValueField?: string; + delay?: number; + enable?: boolean; + filter?: string; + fixedGroupTemplate?: any; + groupTemplate?: any; + height?: number; + ignoreCase?: string; + index?: number; + minLength?: number; + optionLabel?: any; + optionLabelTemplate?: any; + headerTemplate?: any; + template?: any; + valueTemplate?: any; + text?: string; + value?: string; + valuePrimitive?: boolean; + virtual?: DropDownListVirtual; + change?(e: DropDownListChangeEvent): void; + close?(e: DropDownListCloseEvent): void; + dataBound?(e: DropDownListDataBoundEvent): void; + filtering?(e: DropDownListFilteringEvent): void; + open?(e: DropDownListOpenEvent): void; + select?(e: DropDownListSelectEvent): void; + cascade?(e: DropDownListCascadeEvent): void; + } + interface DropDownListEvent { + sender: DropDownList; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + interface DropDownListChangeEvent extends DropDownListEvent { + } + + interface DropDownListCloseEvent extends DropDownListEvent { + } + + interface DropDownListDataBoundEvent extends DropDownListEvent { + } + + interface DropDownListFilteringEvent extends DropDownListEvent { + filter?: any; + } + + interface DropDownListOpenEvent extends DropDownListEvent { + } + + interface DropDownListSelectEvent extends DropDownListEvent { + item?: JQuery; + } + + interface DropDownListCascadeEvent extends DropDownListEvent { + } + + + class Editor extends kendo.ui.Widget { + static fn: Editor; + static extend(proto: Object): Editor; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: EditorOptions); + options: EditorOptions; + createRange(document?: Document): Range; + destroy(): void; + encodedValue(): void; + exec(name: string, params: any): void; + focus(): void; + getRange(): Range; + getSelection(): Selection; + paste(html: string, options: any): void; + selectedHtml(): string; + refresh(): void; + saveAsPDF(): JQueryPromise; + selectRange(range: Range): void; + update(): void; + state(toolName: string): boolean; + value(): string; + value(value: string): void; + body: Element; + } + + interface EditorFileBrowserMessages { + uploadFile?: string; + orderBy?: string; + orderByName?: string; + orderBySize?: string; + directoryNotFound?: string; + emptyFolder?: string; + deleteFile?: string; + invalidFileType?: string; + overwriteFile?: string; + search?: string; + } + + interface EditorFileBrowserSchemaModelFieldsName { + field?: string; + parse?: Function; + } + + interface EditorFileBrowserSchemaModelFieldsSize { + field?: string; + parse?: Function; + } + + interface EditorFileBrowserSchemaModelFieldsType { + parse?: Function; + field?: string; + } + + interface EditorFileBrowserSchemaModelFields { + name?: EditorFileBrowserSchemaModelFieldsName; + type?: EditorFileBrowserSchemaModelFieldsType; + size?: EditorFileBrowserSchemaModelFieldsSize; + } + + interface EditorFileBrowserSchemaModel { + id?: string; + fields?: EditorFileBrowserSchemaModelFields; + } + + interface EditorFileBrowserSchema { + } + + interface EditorFileBrowserTransportCreate { + contentType?: string; + data?: any; + dataType?: string; + type?: string; + url?: any; + } + + interface EditorFileBrowserTransportDestroy { + contentType?: string; + data?: any; + dataType?: string; + type?: string; + url?: any; + } + + interface EditorFileBrowserTransportRead { + contentType?: string; + data?: any; + dataType?: string; + type?: string; + url?: any; + } + + interface EditorFileBrowserTransport { + read?: EditorFileBrowserTransportRead; + uploadUrl?: string; + fileUrl?: any; + destroy?: EditorFileBrowserTransportDestroy; + create?: EditorFileBrowserTransportCreate; + } + + interface EditorFileBrowser { + fileTypes?: string; + path?: string; + transport?: EditorFileBrowserTransport; + schema?: EditorFileBrowserSchema; + messages?: EditorFileBrowserMessages; + } + + interface EditorImageBrowserMessages { + uploadFile?: string; + orderBy?: string; + orderByName?: string; + orderBySize?: string; + directoryNotFound?: string; + emptyFolder?: string; + deleteFile?: string; + invalidFileType?: string; + overwriteFile?: string; + search?: string; + } + + interface EditorImageBrowserSchemaModelFieldsName { + field?: string; + parse?: Function; + } + + interface EditorImageBrowserSchemaModelFieldsSize { + field?: string; + parse?: Function; + } + + interface EditorImageBrowserSchemaModelFieldsType { + parse?: Function; + field?: string; + } + + interface EditorImageBrowserSchemaModelFields { + name?: EditorImageBrowserSchemaModelFieldsName; + type?: EditorImageBrowserSchemaModelFieldsType; + size?: EditorImageBrowserSchemaModelFieldsSize; + } + + interface EditorImageBrowserSchemaModel { + id?: string; + fields?: EditorImageBrowserSchemaModelFields; + } + + interface EditorImageBrowserSchema { + } + + interface EditorImageBrowserTransportCreate { + contentType?: string; + data?: any; + dataType?: string; + type?: string; + url?: any; + } + + interface EditorImageBrowserTransportDestroy { + contentType?: string; + data?: any; + dataType?: string; + type?: string; + url?: any; + } + + interface EditorImageBrowserTransportRead { + contentType?: string; + data?: any; + dataType?: string; + type?: string; + url?: any; + } + + interface EditorImageBrowserTransport { + read?: EditorImageBrowserTransportRead; + thumbnailUrl?: any; + uploadUrl?: string; + imageUrl?: any; + destroy?: EditorImageBrowserTransportDestroy; + create?: EditorImageBrowserTransportCreate; + } + + interface EditorImageBrowser { + fileTypes?: string; + path?: string; + transport?: EditorImageBrowserTransport; + schema?: EditorImageBrowserSchema; + messages?: EditorImageBrowserMessages; + } + + interface EditorMessages { + bold?: string; + italic?: string; + underline?: string; + strikethrough?: string; + superscript?: string; + subscript?: string; + justifyCenter?: string; + justifyLeft?: string; + justifyRight?: string; + justifyFull?: string; + insertUnorderedList?: string; + insertOrderedList?: string; + indent?: string; + outdent?: string; + createLink?: string; + unlink?: string; + insertImage?: string; + insertFile?: string; + insertHtml?: string; + viewHtml?: string; + fontName?: string; + fontNameInherit?: string; + fontSize?: string; + fontSizeInherit?: string; + formatBlock?: string; + formatting?: string; + foreColor?: string; + backColor?: string; + style?: string; + emptyFolder?: string; + uploadFile?: string; + editAreaTitle?: string; + orderBy?: string; + orderBySize?: string; + orderByName?: string; + invalidFileType?: string; + deleteFile?: string; + overwriteFile?: string; + directoryNotFound?: string; + imageWebAddress?: string; + imageAltText?: string; + imageWidth?: string; + imageHeight?: string; + fileWebAddress?: string; + fileTitle?: string; + linkWebAddress?: string; + linkText?: string; + linkToolTip?: string; + linkOpenInNewWindow?: string; + dialogUpdate?: string; + dialogInsert?: string; + dialogCancel?: string; + createTable?: string; + createTableHint?: string; + addColumnLeft?: string; + addColumnRight?: string; + addRowAbove?: string; + addRowBelow?: string; + deleteRow?: string; + deleteColumn?: string; + } + + interface EditorPdfMargin { + bottom?: any; + left?: any; + right?: any; + top?: any; + } + + interface EditorPdf { + author?: string; + creator?: string; + date?: Date; + fileName?: string; + forceProxy?: boolean; + keywords?: string; + landscape?: boolean; + margin?: EditorPdfMargin; + paperSize?: any; + proxyURL?: string; + proxyTarget?: string; + subject?: string; + title?: string; + } + + interface EditorResizable { + min?: number; + max?: number; + } + + interface EditorSerialization { + entities?: boolean; + scripts?: boolean; + semantic?: boolean; + } + + interface EditorToolItem { + text?: string; + value?: string; + context?: string; + } + + interface EditorTool { + name?: string; + tooltip?: string; + exec?: Function; + items?: EditorToolItem[]; + template?: string; + } + + interface EditorExecParams { + value?: any; + } + + interface EditorPasteOptions { + split?: boolean; + } + + interface EditorOptions { + name?: string; + domain?: string; + encoded?: boolean; + messages?: EditorMessages; + pdf?: EditorPdf; + resizable?: EditorResizable; + serialization?: EditorSerialization; + stylesheets?: any; + tools?: EditorTool[]; + imageBrowser?: EditorImageBrowser; + fileBrowser?: EditorFileBrowser; + change?(e: EditorEvent): void; + execute?(e: EditorExecuteEvent): void; + keydown?(e: EditorEvent): void; + keyup?(e: EditorEvent): void; + paste?(e: EditorPasteEvent): void; + pdfExport?(e: EditorPdfExportEvent): void; + select?(e: EditorEvent): void; + } + interface EditorEvent { + sender: Editor; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + interface EditorExecuteEvent extends EditorEvent { + name?: string; + command?: any; + } + + interface EditorPasteEvent extends EditorEvent { + html?: any; + } + + interface EditorPdfExportEvent extends EditorEvent { + promise?: JQueryPromise; + } + + + class FlatColorPicker extends kendo.ui.Widget { + static fn: FlatColorPicker; + static extend(proto: Object): FlatColorPicker; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: FlatColorPickerOptions); + options: FlatColorPickerOptions; + focus(): void; + value(): string; + value(color?: string): void; + color(): kendo.Color; + color(color?: kendo.Color): void; + enable(enable?: boolean): void; + } + + interface FlatColorPickerMessages { + apply?: string; + cancel?: string; + } + + interface FlatColorPickerOptions { + name?: string; + opacity?: boolean; + buttons?: boolean; + value?: string; + preview?: boolean; + autoupdate?: boolean; + messages?: FlatColorPickerMessages; + change?(e: FlatColorPickerChangeEvent): void; + } + interface FlatColorPickerEvent { + sender: FlatColorPicker; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + interface FlatColorPickerChangeEvent extends FlatColorPickerEvent { + value?: string; + } + + + class Gantt extends kendo.ui.Widget { + static fn: Gantt; + static extend(proto: Object): Gantt; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: GanttOptions); + options: GanttOptions; + dataSource: kendo.data.DataSource; + clearSelection(): void; + dataItem(row: string): kendo.data.GanttTask; + dataItem(row: Element): kendo.data.GanttTask; + dataItem(row: JQuery): kendo.data.GanttTask; + destroy(): void; + refresh(): void; + refreshDependencies(): void; + removeDependency(dependency: string): void; + removeDependency(dependency: kendo.data.GanttDependency): void; + removeTask(task: string): void; + removeTask(task: kendo.data.GanttTask): void; + saveAsPDF(): JQueryPromise; + select(): JQuery; + select(row: string): void; + select(row: Element): void; + select(row: JQuery): void; + setDataSource(dataSource: kendo.data.GanttDataSource): void; + setDependenciesDataSource(dataSource: kendo.data.GanttDependencyDataSource): void; + view(): kendo.ui.GanttView; + view(type?: string): void; + dependencies: kendo.data.GanttDependencyDataSource; + } + + interface GanttAssignments { + dataSource?: any; + dataResourceIdField?: string; + dataTaskIdField?: string; + dataValueField?: string; + } + + interface GanttColumn { + field?: string; + title?: string; + format?: string; + width?: any; + editable?: boolean; + sortable?: boolean; + } + + interface GanttCurrentTimeMarker { + updateInterval?: number; + } + + interface GanttEditable { + confirmation?: boolean; + template?: any; + } + + interface GanttMessagesActions { + addChild?: string; + append?: string; + insertAfter?: string; + insertBefore?: string; + pdf?: string; + } + + interface GanttMessagesEditor { + assignButton?: string; + editorTitle?: string; + end?: string; + percentComplete?: string; + resources?: string; + resourcesEditorTitle?: string; + resourcesHeader?: string; + start?: string; + title?: string; + unitsHeader?: string; + } + + interface GanttMessagesViews { + day?: string; + end?: string; + month?: string; + start?: string; + week?: string; + year?: string; + } + + interface GanttMessages { + actions?: GanttMessagesActions; + cancel?: string; + deleteDependencyWindowTitle?: string; + deleteTaskWindowTitle?: string; + destroy?: string; + editor?: GanttMessagesEditor; + save?: string; + views?: GanttMessagesViews; + } + + interface GanttPdfMargin { + bottom?: any; + left?: any; + right?: any; + top?: any; + } + + interface GanttPdf { + author?: string; + creator?: string; + date?: Date; + fileName?: string; + forceProxy?: boolean; + keywords?: string; + landscape?: boolean; + margin?: GanttPdfMargin; + paperSize?: any; + proxyURL?: string; + proxyTarget?: string; + subject?: string; + title?: string; + } + + interface GanttResources { + dataFormatField?: string; + dataColorField?: string; + dataSource?: any; + dataTextField?: string; + field?: string; + } + + interface GanttToolbarItem { + name?: string; + template?: any; + text?: string; + } + + interface GanttTooltip { + template?: any; + visible?: boolean; + } + + interface GanttView { + type?: string; + selected?: boolean; + slotSize?: any; + timeHeaderTemplate?: any; + dayHeaderTemplate?: any; + weekHeaderTemplate?: any; + monthHeaderTemplate?: any; + yearHeaderTemplate?: any; + resizeTooltipFormat?: string; + } + + interface GanttOptions { + name?: string; + assignments?: GanttAssignments; + autoBind?: boolean; + columns?: GanttColumn[]; + currentTimeMarker?: GanttCurrentTimeMarker; + dataSource?: any; + dependencies?: any; + editable?: GanttEditable; + navigatable?: boolean; + workDayStart?: Date; + workDayEnd?: Date; + workWeekStart?: number; + workWeekEnd?: number; + hourSpan?: number; + snap?: boolean; + height?: any; + listWidth?: any; + messages?: GanttMessages; + pdf?: GanttPdf; + selectable?: boolean; + showWorkDays?: boolean; + showWorkHours?: boolean; + toolbar?: GanttToolbarItem[]; + tooltip?: GanttTooltip; + views?: GanttView[]; + resources?: GanttResources; + dataBinding?(e: GanttDataBindingEvent): void; + dataBound?(e: GanttDataBoundEvent): void; + add?(e: GanttAddEvent): void; + edit?(e: GanttEditEvent): void; + remove?(e: GanttRemoveEvent): void; + cancel?(e: GanttCancelEvent): void; + save?(e: GanttSaveEvent): void; + change?(e: GanttChangeEvent): void; + navigate?(e: GanttNavigateEvent): void; + moveStart?(e: GanttMoveStartEvent): void; + move?(e: GanttMoveEvent): void; + moveEnd?(e: GanttMoveEndEvent): void; + pdfExport?(e: GanttPdfExportEvent): void; + resizeStart?(e: GanttResizeStartEvent): void; + resize?(e: GanttResizeEvent): void; + resizeEnd?(e: GanttResizeEndEvent): void; + } + interface GanttEvent { + sender: Gantt; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + interface GanttDataBindingEvent extends GanttEvent { + } + + interface GanttDataBoundEvent extends GanttEvent { + } + + interface GanttAddEvent extends GanttEvent { + task?: kendo.data.GanttTask; + dependency?: kendo.data.GanttDependency; + } + + interface GanttEditEvent extends GanttEvent { + container?: JQuery; + task?: kendo.data.GanttTask; + } + + interface GanttRemoveEvent extends GanttEvent { + task?: kendo.data.GanttTask; + dependencies?: any; + } + + interface GanttCancelEvent extends GanttEvent { + container?: JQuery; + task?: kendo.data.GanttTask; + } + + interface GanttSaveEvent extends GanttEvent { + task?: kendo.data.GanttTask; + values?: any; + } + + interface GanttChangeEvent extends GanttEvent { + } + + interface GanttNavigateEvent extends GanttEvent { + view?: string; + } + + interface GanttMoveStartEvent extends GanttEvent { + task?: kendo.data.GanttTask; + } + + interface GanttMoveEvent extends GanttEvent { + task?: kendo.data.GanttTask; + start?: Date; + end?: Date; + } + + interface GanttMoveEndEvent extends GanttEvent { + task?: kendo.data.GanttTask; + start?: Date; + end?: Date; + } + + interface GanttPdfExportEvent extends GanttEvent { + promise?: JQueryPromise; + } + + interface GanttResizeStartEvent extends GanttEvent { + task?: kendo.data.GanttTask; + } + + interface GanttResizeEvent extends GanttEvent { + task?: kendo.data.GanttTask; + start?: Date; + end?: Date; + } + + interface GanttResizeEndEvent extends GanttEvent { + task?: kendo.data.GanttTask; + start?: Date; + end?: Date; + } + + + class Grid extends kendo.ui.Widget { + static fn: Grid; + static extend(proto: Object): Grid; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: GridOptions); + options: GridOptions; + dataSource: kendo.data.DataSource; + addRow(): void; + autoFitColumn(column: number): void; + autoFitColumn(column: string): void; + autoFitColumn(column: any): void; + cancelChanges(): void; + cancelRow(): void; + cellIndex(cell: string): number; + cellIndex(cell: Element): number; + cellIndex(cell: JQuery): number; + clearSelection(): void; + closeCell(isCancel?: boolean): void; + collapseGroup(row: string): void; + collapseGroup(row: Element): void; + collapseGroup(row: JQuery): void; + collapseRow(row: string): void; + collapseRow(row: Element): void; + collapseRow(row: JQuery): void; + current(): JQuery; + current(cell: JQuery): void; + dataItem(row: string): kendo.data.ObservableObject; + dataItem(row: Element): kendo.data.ObservableObject; + dataItem(row: JQuery): kendo.data.ObservableObject; + destroy(): void; + editCell(cell: JQuery): void; + editRow(row: JQuery): void; + expandGroup(row: string): void; + expandGroup(row: Element): void; + expandGroup(row: JQuery): void; + expandRow(row: string): void; + expandRow(row: Element): void; + expandRow(row: JQuery): void; + getOptions(): GridOptions; + hideColumn(column: number): void; + hideColumn(column: string): void; + hideColumn(column: any): void; + lockColumn(column: number): void; + lockColumn(column: string): void; + refresh(): void; + removeRow(row: string): void; + removeRow(row: Element): void; + removeRow(row: JQuery): void; + reorderColumn(destIndex: number, column: any): void; + saveAsExcel(): void; + saveAsPDF(): JQueryPromise; + saveChanges(): void; + saveRow(): void; + select(): JQuery; + select(rows: string): void; + select(rows: Element): void; + select(rows: JQuery): void; + setDataSource(dataSource: kendo.data.DataSource): void; + setOptions(options: any): void; + showColumn(column: number): void; + showColumn(column: string): void; + showColumn(column: any): void; + unlockColumn(column: number): void; + unlockColumn(column: string): void; + columns: GridColumn[]; + footer: JQuery; + pager: kendo.ui.Pager; + table: JQuery; + tbody: JQuery; + thead: JQuery; + content: JQuery; + lockedHeader: JQuery; + lockedTable: JQuery; + lockedContent: JQuery; + } + + interface GridAllowCopy { + delimeter?: any; + } + + interface GridColumnMenuMessages { + columns?: string; + filter?: string; + sortAscending?: string; + sortDescending?: string; + settings?: string; + done?: string; + lock?: string; + unlock?: string; + } + + interface GridColumnMenu { + columns?: boolean; + filterable?: boolean; + sortable?: boolean; + messages?: GridColumnMenuMessages; + } + + interface GridColumnCommandItemText { + edit?: string; + cancel?: string; + update?: string; + } + + interface GridColumnCommandItem { + name?: string; + text?: GridColumnCommandItemText; + className?: string; + click?: Function; + } + + interface GridColumnFilterableCell { + dataSource?: any; + dataTextField?: string; + delay?: number; + inputWidth?: number; + suggestionOperator?: string; + minLength?: number; + enabled?: boolean; + operator?: string; + showOperators?: boolean; + template?: Function; + } + + interface GridColumnFilterable { + cell?: GridColumnFilterableCell; + multi?: boolean; + dataSource?: any; + checkAll?: boolean; + itemTemplate?: Function; + ui?: any; + } + + interface GridColumnSortable { + compare?: Function; + } + + interface GridColumn { + aggregates?: any; + attributes?: any; + columns?: any; + command?: GridColumnCommandItem[]; + encoded?: boolean; + field?: string; + filterable?: GridColumnFilterable; + footerTemplate?: any; + format?: string; + groupable?: boolean; + groupHeaderTemplate?: any; + groupFooterTemplate?: any; + headerAttributes?: any; + headerTemplate?: any; + hidden?: boolean; + locked?: boolean; + lockable?: boolean; + minScreenWidth?: number; + sortable?: GridColumnSortable; + template?: any; + title?: string; + width?: any; + values?: any; + menu?: boolean; + } + + interface GridEditable { + confirmation?: any; + cancelDelete?: string; + confirmDelete?: string; + createAt?: string; + destroy?: boolean; + mode?: string; + template?: any; + update?: boolean; + window?: any; + } + + interface GridExcel { + allPages?: boolean; + fileName?: string; + filterable?: boolean; + forceProxy?: boolean; + proxyURL?: string; + } + + interface GridFilterableMessages { + and?: string; + clear?: string; + filter?: string; + info?: string; + isFalse?: string; + isTrue?: string; + or?: string; + selectValue?: string; + cancel?: string; + operator?: string; + value?: string; + checkAll?: string; + } + + interface GridFilterableOperatorsDate { + eq?: string; + neq?: string; + gte?: string; + gt?: string; + lte?: string; + lt?: string; + } + + interface GridFilterableOperatorsEnums { + eq?: string; + neq?: string; + } + + interface GridFilterableOperatorsNumber { + eq?: string; + neq?: string; + gte?: string; + gt?: string; + lte?: string; + lt?: string; + } + + interface GridFilterableOperatorsString { + eq?: string; + neq?: string; + startswith?: string; + contains?: string; + doesnotcontain?: string; + endswith?: string; + } + + interface GridFilterableOperators { + string?: GridFilterableOperatorsString; + number?: GridFilterableOperatorsNumber; + date?: GridFilterableOperatorsDate; + enums?: GridFilterableOperatorsEnums; + } + + interface GridFilterable { + extra?: boolean; + messages?: GridFilterableMessages; + operators?: GridFilterableOperators; + mode?: string; + } + + interface GridGroupableMessages { + empty?: string; + } + + interface GridGroupable { + enabled?: boolean; + showFooter?: boolean; + messages?: GridGroupableMessages; + } + + interface GridMessagesCommands { + cancel?: string; + canceledit?: string; + create?: string; + destroy?: string; + edit?: string; + excel?: string; + save?: string; + update?: string; + } + + interface GridMessages { + commands?: GridMessagesCommands; + } + + interface GridPageableMessages { + display?: string; + empty?: string; + page?: string; + of?: string; + itemsPerPage?: string; + first?: string; + last?: string; + next?: string; + previous?: string; + refresh?: string; + morePages?: string; + } + + interface GridPageable { + pageSize?: number; + previousNext?: boolean; + numeric?: boolean; + buttonCount?: number; + input?: boolean; + pageSizes?: any; + refresh?: boolean; + info?: boolean; + messages?: GridPageableMessages; + } + + interface GridPdfMargin { + bottom?: any; + left?: any; + right?: any; + top?: any; + } + + interface GridPdf { + allPages?: boolean; + author?: string; + creator?: string; + date?: Date; + fileName?: string; + forceProxy?: boolean; + keywords?: string; + landscape?: boolean; + margin?: GridPdfMargin; + paperSize?: any; + proxyURL?: string; + proxyTarget?: string; + subject?: string; + title?: string; + } + + interface GridScrollable { + virtual?: boolean; + } + + interface GridSortable { + allowUnsort?: boolean; + mode?: string; + } + + interface GridToolbarItem { + name?: string; + template?: any; + text?: string; + } + + interface GridOptions { + name?: string; + allowCopy?: GridAllowCopy; + altRowTemplate?: any; + autoBind?: boolean; + columnResizeHandleWidth?: number; + columns?: GridColumn[]; + columnMenu?: GridColumnMenu; + dataSource?: any; + detailTemplate?: any; + editable?: GridEditable; + excel?: GridExcel; + filterable?: GridFilterable; + groupable?: GridGroupable; + height?: any; + messages?: GridMessages; + mobile?: any; + navigatable?: boolean; + pageable?: GridPageable; + pdf?: GridPdf; + reorderable?: boolean; + resizable?: boolean; + rowTemplate?: any; + scrollable?: GridScrollable; + selectable?: any; + sortable?: GridSortable; + toolbar?: GridToolbarItem[]; + cancel?(e: GridCancelEvent): void; + change?(e: GridChangeEvent): void; + columnHide?(e: GridColumnHideEvent): void; + columnMenuInit?(e: GridColumnMenuInitEvent): void; + columnReorder?(e: GridColumnReorderEvent): void; + columnResize?(e: GridColumnResizeEvent): void; + columnShow?(e: GridColumnShowEvent): void; + dataBinding?(e: GridDataBindingEvent): void; + dataBound?(e: GridDataBoundEvent): void; + detailCollapse?(e: GridDetailCollapseEvent): void; + detailExpand?(e: GridDetailExpandEvent): void; + detailInit?(e: GridDetailInitEvent): void; + edit?(e: GridEditEvent): void; + excelExport?(e: GridExcelExportEvent): void; + pdfExport?(e: GridPdfExportEvent): void; + filterMenuInit?(e: GridFilterMenuInitEvent): void; + remove?(e: GridRemoveEvent): void; + save?(e: GridSaveEvent): void; + saveChanges?(e: GridSaveChangesEvent): void; + columnLock?(e: GridColumnLockEvent): void; + columnUnlock?(e: GridColumnUnlockEvent): void; + } + interface GridEvent { + sender: Grid; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + interface GridCancelEvent extends GridEvent { + container?: JQuery; + model?: kendo.data.Model; + } + + interface GridChangeEvent extends GridEvent { + } + + interface GridColumnHideEvent extends GridEvent { + column?: any; + } + + interface GridColumnMenuInitEvent extends GridEvent { + container?: JQuery; + field?: string; + } + + interface GridColumnReorderEvent extends GridEvent { + column?: any; + newIndex?: number; + oldIndex?: number; + } + + interface GridColumnResizeEvent extends GridEvent { + column?: any; + newWidth?: number; + oldWidth?: number; + } + + interface GridColumnShowEvent extends GridEvent { + column?: any; + } + + interface GridDataBindingEvent extends GridEvent { + action?: string; + index?: number; + items?: any; + } + + interface GridDataBoundEvent extends GridEvent { + } + + interface GridDetailCollapseEvent extends GridEvent { + detailRow?: JQuery; + masterRow?: JQuery; + } + + interface GridDetailExpandEvent extends GridEvent { + detailRow?: JQuery; + masterRow?: JQuery; + } + + interface GridDetailInitEvent extends GridEvent { + data?: kendo.data.ObservableObject; + detailCell?: JQuery; + detailRow?: JQuery; + masterRow?: JQuery; + } + + interface GridEditEvent extends GridEvent { + container?: JQuery; + model?: kendo.data.Model; + } + + interface GridExcelExportEvent extends GridEvent { + data?: any; + workbook?: kendo.ooxml.Workbook; + } + + interface GridPdfExportEvent extends GridEvent { + promise?: JQueryPromise; + } + + interface GridFilterMenuInitEvent extends GridEvent { + container?: JQuery; + field?: string; + } + + interface GridRemoveEvent extends GridEvent { + model?: kendo.data.Model; + row?: JQuery; + } + + interface GridSaveEvent extends GridEvent { + model?: kendo.data.Model; + container?: JQuery; + values?: any; + } + + interface GridSaveChangesEvent extends GridEvent { + } + + interface GridColumnLockEvent extends GridEvent { + column?: any; + } + + interface GridColumnUnlockEvent extends GridEvent { + column?: any; + } + + + class ListView extends kendo.ui.Widget { + static fn: ListView; + static extend(proto: Object): ListView; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: ListViewOptions); + options: ListViewOptions; + dataSource: kendo.data.DataSource; + add(): void; + cancel(): void; + clearSelection(): void; + dataItem(row: string): kendo.data.ObservableObject; + dataItem(row: Element): kendo.data.ObservableObject; + dataItem(row: JQuery): kendo.data.ObservableObject; + dataItems(): void; + destroy(): void; + edit(item: JQuery): void; + refresh(): void; + remove(item: any): void; + save(): void; + select(): JQuery; + select(items: JQuery): void; + select(items: any): void; + setDataSource(dataSource: kendo.data.DataSource): void; + } + + interface ListViewOptions { + name?: string; + autoBind?: boolean; + dataSource?: any; + editTemplate?: Function; + navigatable?: boolean; + selectable?: any; + template?: Function; + altTemplate?: Function; + cancel?(e: ListViewCancelEvent): void; + change?(e: ListViewEvent): void; + dataBound?(e: ListViewEvent): void; + dataBinding?(e: ListViewEvent): void; + edit?(e: ListViewEditEvent): void; + remove?(e: ListViewRemoveEvent): void; + save?(e: ListViewSaveEvent): void; + } + interface ListViewEvent { + sender: ListView; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + interface ListViewCancelEvent extends ListViewEvent { + container?: JQuery; + model?: kendo.data.Model; + } + + interface ListViewEditEvent extends ListViewEvent { + item?: JQuery; + model?: kendo.data.Model; + } + + interface ListViewRemoveEvent extends ListViewEvent { + item?: JQuery; + model?: kendo.data.Model; + } + + interface ListViewSaveEvent extends ListViewEvent { + model?: kendo.data.Model; + item?: JQuery; + } + + + class MaskedTextBox extends kendo.ui.Widget { + static fn: MaskedTextBox; + static extend(proto: Object): MaskedTextBox; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: MaskedTextBoxOptions); + options: MaskedTextBoxOptions; + destroy(): void; + enable(enable: boolean): void; + readonly(readonly: boolean): void; + raw(): string; + value(): string; + value(value: string): void; + } + + interface MaskedTextBoxOptions { + name?: string; + clearPromptChar?: boolean; + culture?: string; + mask?: string; + promptChar?: string; + rules?: any; + unmaskOnPost?: boolean; + value?: string; + change?(e: MaskedTextBoxChangeEvent): void; + } + interface MaskedTextBoxEvent { + sender: MaskedTextBox; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + interface MaskedTextBoxChangeEvent extends MaskedTextBoxEvent { + } + + + class Menu extends kendo.ui.Widget { + static fn: Menu; + static extend(proto: Object): Menu; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: MenuOptions); + options: MenuOptions; + append(item: any, referenceItem: string): kendo.ui.Menu; + append(item: any, referenceItem: JQuery): kendo.ui.Menu; + close(element: string): kendo.ui.Menu; + close(element: Element): kendo.ui.Menu; + close(element: JQuery): kendo.ui.Menu; + destroy(): void; + enable(element: string, enable: boolean): kendo.ui.Menu; + enable(element: Element, enable: boolean): kendo.ui.Menu; + enable(element: JQuery, enable: boolean): kendo.ui.Menu; + insertAfter(item: string, referenceItem: string): kendo.ui.Menu; + insertAfter(item: string, referenceItem: Element): kendo.ui.Menu; + insertAfter(item: string, referenceItem: JQuery): kendo.ui.Menu; + insertAfter(item: Element, referenceItem: string): kendo.ui.Menu; + insertAfter(item: Element, referenceItem: Element): kendo.ui.Menu; + insertAfter(item: Element, referenceItem: JQuery): kendo.ui.Menu; + insertAfter(item: JQuery, referenceItem: string): kendo.ui.Menu; + insertAfter(item: JQuery, referenceItem: Element): kendo.ui.Menu; + insertAfter(item: JQuery, referenceItem: JQuery): kendo.ui.Menu; + insertBefore(item: string, referenceItem: string): kendo.ui.Menu; + insertBefore(item: string, referenceItem: Element): kendo.ui.Menu; + insertBefore(item: string, referenceItem: JQuery): kendo.ui.Menu; + insertBefore(item: Element, referenceItem: string): kendo.ui.Menu; + insertBefore(item: Element, referenceItem: Element): kendo.ui.Menu; + insertBefore(item: Element, referenceItem: JQuery): kendo.ui.Menu; + insertBefore(item: JQuery, referenceItem: string): kendo.ui.Menu; + insertBefore(item: JQuery, referenceItem: Element): kendo.ui.Menu; + insertBefore(item: JQuery, referenceItem: JQuery): kendo.ui.Menu; + open(element: string): kendo.ui.Menu; + open(element: Element): kendo.ui.Menu; + open(element: JQuery): kendo.ui.Menu; + remove(element: string): kendo.ui.Menu; + remove(element: Element): kendo.ui.Menu; + remove(element: JQuery): kendo.ui.Menu; + } + + interface MenuAnimationClose { + effects?: string; + duration?: number; + } + + interface MenuAnimationOpen { + effects?: string; + duration?: number; + } + + interface MenuAnimation { + close?: MenuAnimationClose; + open?: MenuAnimationOpen; + } + + interface MenuOptions { + name?: string; + animation?: MenuAnimation; + closeOnClick?: boolean; + dataSource?: any; + direction?: string; + hoverDelay?: number; + openOnClick?: boolean; + orientation?: string; + popupCollision?: string; + close?(e: MenuCloseEvent): void; + open?(e: MenuOpenEvent): void; + activate?(e: MenuActivateEvent): void; + deactivate?(e: MenuDeactivateEvent): void; + select?(e: MenuSelectEvent): void; + } + interface MenuEvent { + sender: Menu; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + interface MenuCloseEvent extends MenuEvent { + item?: HTMLElement; + } + + interface MenuOpenEvent extends MenuEvent { + item?: HTMLElement; + } + + interface MenuActivateEvent extends MenuEvent { + item?: HTMLElement; + } + + interface MenuDeactivateEvent extends MenuEvent { + item?: HTMLElement; + } + + interface MenuSelectEvent extends MenuEvent { + item?: HTMLElement; + } + + + class MultiSelect extends kendo.ui.Widget { + static fn: MultiSelect; + static extend(proto: Object): MultiSelect; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: MultiSelectOptions); + options: MultiSelectOptions; + dataSource: kendo.data.DataSource; + close(): void; + dataItems(): any; + destroy(): void; + enable(enable: boolean): void; + readonly(readonly: boolean): void; + focus(): void; + open(): void; + refresh(): void; + search(word: string): void; + setDataSource(dataSource: kendo.data.DataSource): void; + toggle(toggle: boolean): void; + value(): any; + value(value: any): void; + value(value: string): void; + input: JQuery; + list: JQuery; + ul: JQuery; + tagList: JQuery; + } + + interface MultiSelectAnimationClose { + effects?: string; + duration?: number; + } + + interface MultiSelectAnimationOpen { + effects?: string; + duration?: number; + } + + interface MultiSelectAnimation { + close?: MultiSelectAnimationClose; + open?: MultiSelectAnimationOpen; + } + + interface MultiSelectVirtual { + itemHeight?: number; + valueMapper?: Function; + } + + interface MultiSelectOptions { + name?: string; + animation?: MultiSelectAnimation; + autoBind?: boolean; + autoClose?: boolean; + dataSource?: any; + dataTextField?: string; + dataValueField?: string; + delay?: number; + enable?: boolean; + filter?: string; + fixedGroupTemplate?: any; + groupTemplate?: any; + height?: number; + highlightFirst?: boolean; + ignoreCase?: string; + minLength?: number; + maxSelectedItems?: number; + placeholder?: string; + headerTemplate?: any; + itemTemplate?: any; + tagTemplate?: string; + value?: any; + valuePrimitive?: boolean; + virtual?: MultiSelectVirtual; + change?(e: MultiSelectChangeEvent): void; + close?(e: MultiSelectCloseEvent): void; + dataBound?(e: MultiSelectDataBoundEvent): void; + filtering?(e: MultiSelectFilteringEvent): void; + open?(e: MultiSelectOpenEvent): void; + select?(e: MultiSelectSelectEvent): void; + } + interface MultiSelectEvent { + sender: MultiSelect; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + interface MultiSelectChangeEvent extends MultiSelectEvent { + } + + interface MultiSelectCloseEvent extends MultiSelectEvent { + } + + interface MultiSelectDataBoundEvent extends MultiSelectEvent { + } + + interface MultiSelectFilteringEvent extends MultiSelectEvent { + filter?: any; + } + + interface MultiSelectOpenEvent extends MultiSelectEvent { + } + + interface MultiSelectSelectEvent extends MultiSelectEvent { + item?: JQuery; + } + + + class Notification extends kendo.ui.Widget { + static fn: Notification; + static extend(proto: Object): Notification; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: NotificationOptions); + options: NotificationOptions; + error(data: any): void; + error(data: string): void; + error(data: Function): void; + getNotifications(): JQuery; + hide(): void; + info(data: any): void; + info(data: string): void; + info(data: Function): void; + show(data: any, type: string): void; + show(data: string, type: string): void; + show(data: Function, type: string): void; + success(data: any): void; + success(data: string): void; + success(data: Function): void; + warning(data: any): void; + warning(data: string): void; + warning(data: Function): void; + } + + interface NotificationPosition { + bottom?: number; + left?: number; + pinned?: boolean; + right?: number; + top?: number; + } + + interface NotificationTemplate { + type?: string; + template?: string; + } + + interface NotificationOptions { + name?: string; + allowHideAfter?: number; + animation?: any; + appendTo?: any; + autoHideAfter?: number; + button?: boolean; + height?: any; + hideOnClick?: boolean; + position?: NotificationPosition; + stacking?: string; + templates?: NotificationTemplate[]; + width?: any; + hide?(e: NotificationHideEvent): void; + show?(e: NotificationShowEvent): void; + } + interface NotificationEvent { + sender: Notification; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + interface NotificationHideEvent extends NotificationEvent { + element?: JQuery; + } + + interface NotificationShowEvent extends NotificationEvent { + element?: JQuery; + } + + + class NumericTextBox extends kendo.ui.Widget { + static fn: NumericTextBox; + static extend(proto: Object): NumericTextBox; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: NumericTextBoxOptions); + options: NumericTextBoxOptions; + destroy(): void; + enable(enable: boolean): void; + readonly(readonly: boolean): void; + focus(): void; + max(): number; + max(value: number): void; + max(value: string): void; + min(): number; + min(value: number): void; + min(value: string): void; + step(): number; + step(value: number): void; + step(value: string): void; + value(): number; + value(value: number): void; + value(value: string): void; + } + + interface NumericTextBoxOptions { + name?: string; + culture?: string; + decimals?: number; + downArrowText?: string; + format?: string; + max?: number; + min?: number; + placeholder?: string; + spinners?: boolean; + step?: number; + upArrowText?: string; + value?: number; + change?(e: NumericTextBoxChangeEvent): void; + spin?(e: NumericTextBoxSpinEvent): void; + } + interface NumericTextBoxEvent { + sender: NumericTextBox; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + interface NumericTextBoxChangeEvent extends NumericTextBoxEvent { + } + + interface NumericTextBoxSpinEvent extends NumericTextBoxEvent { + } + + + class Pager extends kendo.ui.Widget { + static fn: Pager; + static extend(proto: Object): Pager; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: PagerOptions); + options: PagerOptions; + dataSource: kendo.data.DataSource; + totalPages(): number; + pageSize(): number; + page(page: boolean): number; + refresh(): void; + destroy(): void; + } + + interface PagerMessages { + display?: string; + empty?: string; + page?: string; + of?: string; + itemsPerPage?: string; + first?: string; + previous?: string; + next?: string; + last?: string; + refresh?: string; + } + + interface PagerOptions { + name?: string; + autoBind?: boolean; + buttonCount?: number; + dataSource?: any; + selectTemplate?: string; + linkTemplate?: string; + info?: boolean; + input?: boolean; + numeric?: boolean; + pageSizes?: any; + previousNext?: boolean; + refresh?: boolean; + messages?: PagerMessages; + change?(e: PagerChangeEvent): void; + } + interface PagerEvent { + sender: Pager; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + interface PagerChangeEvent extends PagerEvent { + } + + + class PanelBar extends kendo.ui.Widget { + static fn: PanelBar; + static extend(proto: Object): PanelBar; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: PanelBarOptions); + options: PanelBarOptions; + append(item: string, referenceItem: string): kendo.ui.PanelBar; + append(item: string, referenceItem: Element): kendo.ui.PanelBar; + append(item: string, referenceItem: JQuery): kendo.ui.PanelBar; + append(item: Element, referenceItem: string): kendo.ui.PanelBar; + append(item: Element, referenceItem: Element): kendo.ui.PanelBar; + append(item: Element, referenceItem: JQuery): kendo.ui.PanelBar; + append(item: JQuery, referenceItem: string): kendo.ui.PanelBar; + append(item: JQuery, referenceItem: Element): kendo.ui.PanelBar; + append(item: JQuery, referenceItem: JQuery): kendo.ui.PanelBar; + append(item: any, referenceItem: string): kendo.ui.PanelBar; + append(item: any, referenceItem: Element): kendo.ui.PanelBar; + append(item: any, referenceItem: JQuery): kendo.ui.PanelBar; + clearSelection(): void; + collapse(element: string, useAnimation: boolean): kendo.ui.PanelBar; + collapse(element: Element, useAnimation: boolean): kendo.ui.PanelBar; + collapse(element: JQuery, useAnimation: boolean): kendo.ui.PanelBar; + destroy(): void; + enable(element: string, enable: boolean): void; + enable(element: Element, enable: boolean): void; + enable(element: JQuery, enable: boolean): void; + expand(element: string, useAnimation: boolean): kendo.ui.PanelBar; + expand(element: Element, useAnimation: boolean): kendo.ui.PanelBar; + expand(element: JQuery, useAnimation: boolean): kendo.ui.PanelBar; + insertAfter(item: string, referenceItem: string): void; + insertAfter(item: string, referenceItem: Element): void; + insertAfter(item: string, referenceItem: JQuery): void; + insertAfter(item: Element, referenceItem: string): void; + insertAfter(item: Element, referenceItem: Element): void; + insertAfter(item: Element, referenceItem: JQuery): void; + insertAfter(item: JQuery, referenceItem: string): void; + insertAfter(item: JQuery, referenceItem: Element): void; + insertAfter(item: JQuery, referenceItem: JQuery): void; + insertAfter(item: any, referenceItem: string): void; + insertAfter(item: any, referenceItem: Element): void; + insertAfter(item: any, referenceItem: JQuery): void; + insertBefore(item: string, referenceItem: string): kendo.ui.PanelBar; + insertBefore(item: string, referenceItem: Element): kendo.ui.PanelBar; + insertBefore(item: string, referenceItem: JQuery): kendo.ui.PanelBar; + insertBefore(item: Element, referenceItem: string): kendo.ui.PanelBar; + insertBefore(item: Element, referenceItem: Element): kendo.ui.PanelBar; + insertBefore(item: Element, referenceItem: JQuery): kendo.ui.PanelBar; + insertBefore(item: JQuery, referenceItem: string): kendo.ui.PanelBar; + insertBefore(item: JQuery, referenceItem: Element): kendo.ui.PanelBar; + insertBefore(item: JQuery, referenceItem: JQuery): kendo.ui.PanelBar; + insertBefore(item: any, referenceItem: string): kendo.ui.PanelBar; + insertBefore(item: any, referenceItem: Element): kendo.ui.PanelBar; + insertBefore(item: any, referenceItem: JQuery): kendo.ui.PanelBar; + reload(element: string): void; + reload(element: Element): void; + reload(element: JQuery): void; + remove(element: string): void; + remove(element: Element): void; + remove(element: JQuery): void; + select(): JQuery; + select(element?: string): void; + select(element?: Element): void; + select(element?: JQuery): void; + } + + interface PanelBarAnimationCollapse { + duration?: number; + effects?: string; + } + + interface PanelBarAnimationExpand { + duration?: number; + effects?: string; + } + + interface PanelBarAnimation { + collapse?: PanelBarAnimationCollapse; + expand?: PanelBarAnimationExpand; + } + + interface PanelBarOptions { + name?: string; + animation?: PanelBarAnimation; + contentUrls?: any; + dataSource?: any; + expandMode?: string; + activate?(e: PanelBarActivateEvent): void; + collapse?(e: PanelBarCollapseEvent): void; + contentLoad?(e: PanelBarContentLoadEvent): void; + error?(e: PanelBarErrorEvent): void; + expand?(e: PanelBarExpandEvent): void; + select?(e: PanelBarSelectEvent): void; + } + interface PanelBarEvent { + sender: PanelBar; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + interface PanelBarActivateEvent extends PanelBarEvent { + item?: Element; + } + + interface PanelBarCollapseEvent extends PanelBarEvent { + item?: Element; + } + + interface PanelBarContentLoadEvent extends PanelBarEvent { + item?: Element; + contentElement?: Element; + } + + interface PanelBarErrorEvent extends PanelBarEvent { + xhr?: JQueryXHR; + status?: string; + } + + interface PanelBarExpandEvent extends PanelBarEvent { + item?: Element; + } + + interface PanelBarSelectEvent extends PanelBarEvent { + item?: Element; + } + + + class PivotConfigurator extends kendo.ui.Widget { + static fn: PivotConfigurator; + static extend(proto: Object): PivotConfigurator; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: PivotConfiguratorOptions); + options: PivotConfiguratorOptions; + dataSource: kendo.data.DataSource; + destroy(): void; + refresh(): void; + setDataSource(dataSource: kendo.data.PivotDataSource): void; + } + + interface PivotConfiguratorMessagesFieldMenuOperators { + contains?: string; + doesnotcontain?: string; + startswith?: string; + endswith?: string; + eq?: string; + neq?: string; + } + + interface PivotConfiguratorMessagesFieldMenu { + info?: string; + sortAscending?: string; + sortDescending?: string; + filterFields?: string; + filter?: string; + include?: string; + title?: string; + clear?: string; + ok?: string; + cancel?: string; + operators?: PivotConfiguratorMessagesFieldMenuOperators; + } + + interface PivotConfiguratorMessages { + measures?: string; + columns?: string; + rows?: string; + measuresLabel?: string; + rowsLabel?: string; + columnsLabel?: string; + fieldsLabel?: string; + fieldMenu?: PivotConfiguratorMessagesFieldMenu; + } + + interface PivotConfiguratorSortable { + allowUnsort?: boolean; + } + + interface PivotConfiguratorOptions { + name?: string; + dataSource?: any; + filterable?: boolean; + sortable?: PivotConfiguratorSortable; + height?: any; + messages?: PivotConfiguratorMessages; + } + interface PivotConfiguratorEvent { + sender: PivotConfigurator; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + class PivotGrid extends kendo.ui.Widget { + static fn: PivotGrid; + static extend(proto: Object): PivotGrid; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: PivotGridOptions); + options: PivotGridOptions; + dataSource: kendo.data.DataSource; + cellInfo(columnIndex: number, rowIndex: number): any; + cellInfoByElement(cell: string): any; + cellInfoByElement(cell: Element): any; + cellInfoByElement(cell: JQuery): any; + destroy(): void; + refresh(): void; + setDataSource(dataSource: kendo.data.PivotDataSource): void; + saveAsExcel(): void; + saveAsPDF(): JQueryPromise; + } + + interface PivotGridExcel { + fileName?: string; + filterable?: boolean; + forceProxy?: boolean; + proxyURL?: string; + } + + interface PivotGridMessagesFieldMenuOperators { + contains?: string; + doesnotcontain?: string; + startswith?: string; + endswith?: string; + eq?: string; + neq?: string; + } + + interface PivotGridMessagesFieldMenu { + info?: string; + sortAscending?: string; + sortDescending?: string; + filterFields?: string; + filter?: string; + include?: string; + title?: string; + clear?: string; + ok?: string; + cancel?: string; + operators?: PivotGridMessagesFieldMenuOperators; + } + + interface PivotGridMessages { + measureFields?: string; + columnFields?: string; + rowFields?: string; + fieldMenu?: PivotGridMessagesFieldMenu; + } + + interface PivotGridPdfMargin { + bottom?: any; + left?: any; + right?: any; + top?: any; + } + + interface PivotGridPdf { + author?: string; + creator?: string; + date?: Date; + fileName?: string; + forceProxy?: boolean; + keywords?: string; + landscape?: boolean; + margin?: PivotGridPdfMargin; + paperSize?: any; + proxyURL?: string; + proxyTarget?: string; + subject?: string; + title?: string; + } + + interface PivotGridSortable { + allowUnsort?: boolean; + } + + interface PivotGridOptions { + name?: string; + dataSource?: any; + autoBind?: boolean; + reorderable?: boolean; + excel?: PivotGridExcel; + pdf?: PivotGridPdf; + filterable?: boolean; + sortable?: PivotGridSortable; + columnWidth?: number; + height?: any; + columnHeaderTemplate?: any; + dataCellTemplate?: any; + kpiStatusTemplate?: any; + kpiTrendTemplate?: any; + rowHeaderTemplate?: any; + messages?: PivotGridMessages; + dataBinding?(e: PivotGridDataBindingEvent): void; + dataBound?(e: PivotGridDataBoundEvent): void; + expandMember?(e: PivotGridExpandMemberEvent): void; + collapseMember?(e: PivotGridCollapseMemberEvent): void; + excelExport?(e: PivotGridExcelExportEvent): void; + pdfExport?(e: PivotGridPdfExportEvent): void; + } + interface PivotGridEvent { + sender: PivotGrid; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + interface PivotGridDataBindingEvent extends PivotGridEvent { + } + + interface PivotGridDataBoundEvent extends PivotGridEvent { + } + + interface PivotGridExpandMemberEvent extends PivotGridEvent { + axis?: string; + path?: string; + } + + interface PivotGridCollapseMemberEvent extends PivotGridEvent { + axis?: string; + path?: string; + } + + interface PivotGridExcelExportEvent extends PivotGridEvent { + data?: any; + workbook?: any; + } + + interface PivotGridPdfExportEvent extends PivotGridEvent { + promise?: JQueryPromise; + } + + + class ProgressBar extends kendo.ui.Widget { + static fn: ProgressBar; + static extend(proto: Object): ProgressBar; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: ProgressBarOptions); + options: ProgressBarOptions; + enable(enable: boolean): void; + value(): number; + value(value: number): void; + progressStatus: JQuery; + progressWrapper: JQuery; + } + + interface ProgressBarAnimation { + duration?: number; + } + + interface ProgressBarOptions { + name?: string; + animation?: ProgressBarAnimation; + chunkCount?: number; + enable?: boolean; + max?: number; + min?: number; + orientation?: string; + reverse?: boolean; + showStatus?: boolean; + type?: string; + value?: number; + change?(e: ProgressBarChangeEvent): void; + complete?(e: ProgressBarCompleteEvent): void; + } + interface ProgressBarEvent { + sender: ProgressBar; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + interface ProgressBarChangeEvent extends ProgressBarEvent { + value?: number; + } + + interface ProgressBarCompleteEvent extends ProgressBarEvent { + value?: number; + } + + + class RangeSlider extends kendo.ui.Widget { + static fn: RangeSlider; + static extend(proto: Object): RangeSlider; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: RangeSliderOptions); + options: RangeSliderOptions; + destroy(): void; + enable(enable: boolean): void; + value(): any; + value(selectionStart: number, selectionEnd: number): void; + resize(): void; + } + + interface RangeSliderTooltip { + enabled?: boolean; + format?: string; + template?: string; + } + + interface RangeSliderOptions { + name?: string; + largeStep?: number; + max?: number; + min?: number; + orientation?: string; + selectionEnd?: number; + selectionStart?: number; + smallStep?: number; + tickPlacement?: string; + tooltip?: RangeSliderTooltip; + change?(e: RangeSliderChangeEvent): void; + slide?(e: RangeSliderSlideEvent): void; + } + interface RangeSliderEvent { + sender: RangeSlider; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + interface RangeSliderChangeEvent extends RangeSliderEvent { + value?: number; + } + + interface RangeSliderSlideEvent extends RangeSliderEvent { + value?: number; + } + + + class ResponsivePanel extends kendo.ui.Widget { + static fn: ResponsivePanel; + static extend(proto: Object): ResponsivePanel; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: ResponsivePanelOptions); + options: ResponsivePanelOptions; + close(): void; + destroy(): void; + open(): void; + } + + interface ResponsivePanelOptions { + name?: string; + autoClose?: boolean; + breakpoint?: number; + orientation?: string; + toggleButton?: string; + close?(e: ResponsivePanelEvent): void; + open?(e: ResponsivePanelEvent): void; + } + interface ResponsivePanelEvent { + sender: ResponsivePanel; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + class Scheduler extends kendo.ui.Widget { + static fn: Scheduler; + static extend(proto: Object): Scheduler; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: SchedulerOptions); + options: SchedulerOptions; + dataSource: kendo.data.DataSource; + addEvent(data: any): void; + cancelEvent(): void; + data(): void; + date(): Date; + date(value?: Date): void; + destroy(): void; + editEvent(event: string): void; + editEvent(event: kendo.data.SchedulerEvent): void; + occurrenceByUid(uid: string): kendo.data.SchedulerEvent; + occurrencesInRange(start: Date, end: Date): any; + refresh(): void; + removeEvent(event: string): void; + removeEvent(event: kendo.data.SchedulerEvent): void; + resourcesBySlot(slot: any): any; + saveAsPDF(): JQueryPromise; + saveEvent(): void; + select(): void; + select(events: any, options: any): void; + setDataSource(dataSource: kendo.data.SchedulerDataSource): void; + slotByPosition(xPosition: number, yPosition: number): any; + slotByElement(element: Element): any; + slotByElement(element: JQuery): any; + view(): kendo.ui.SchedulerView; + view(type?: string): void; + } + + interface SchedulerCurrentTimeMarker { + updateInterval?: number; + useLocalTimezone?: boolean; + } + + interface SchedulerEditable { + confirmation?: any; + create?: boolean; + destroy?: boolean; + editRecurringMode?: string; + move?: boolean; + resize?: boolean; + template?: any; + update?: boolean; + window?: any; + } + + interface SchedulerFooter { + command?: any; + } + + interface SchedulerGroup { + resources?: any; + orientation?: string; + } + + interface SchedulerMessagesEditor { + allDayEvent?: string; + description?: string; + editorTitle?: string; + end?: string; + endTimezone?: string; + repeat?: string; + separateTimezones?: string; + start?: string; + startTimezone?: string; + timezone?: string; + timezoneEditorButton?: string; + timezoneEditorTitle?: string; + title?: string; + } + + interface SchedulerMessagesRecurrenceEditorDaily { + interval?: string; + repeatEvery?: string; + } + + interface SchedulerMessagesRecurrenceEditorEnd { + after?: string; + occurrence?: string; + label?: string; + never?: string; + mobileLabel?: string; + on?: string; + } + + interface SchedulerMessagesRecurrenceEditorFrequencies { + daily?: string; + monthly?: string; + never?: string; + weekly?: string; + yearly?: string; + } + + interface SchedulerMessagesRecurrenceEditorMonthly { + day?: string; + interval?: string; + repeatEvery?: string; + repeatOn?: string; + } + + interface SchedulerMessagesRecurrenceEditorOffsetPositions { + first?: string; + second?: string; + third?: string; + fourth?: string; + last?: string; + } + + interface SchedulerMessagesRecurrenceEditorWeekdays { + day?: string; + weekday?: string; + weekend?: string; + } + + interface SchedulerMessagesRecurrenceEditorWeekly { + interval?: string; + repeatEvery?: string; + repeatOn?: string; + } + + interface SchedulerMessagesRecurrenceEditorYearly { + of?: string; + repeatEvery?: string; + repeatOn?: string; + interval?: string; + } + + interface SchedulerMessagesRecurrenceEditor { + daily?: SchedulerMessagesRecurrenceEditorDaily; + end?: SchedulerMessagesRecurrenceEditorEnd; + frequencies?: SchedulerMessagesRecurrenceEditorFrequencies; + monthly?: SchedulerMessagesRecurrenceEditorMonthly; + offsetPositions?: SchedulerMessagesRecurrenceEditorOffsetPositions; + weekly?: SchedulerMessagesRecurrenceEditorWeekly; + weekdays?: SchedulerMessagesRecurrenceEditorWeekdays; + yearly?: SchedulerMessagesRecurrenceEditorYearly; + } + + interface SchedulerMessagesRecurrenceMessages { + deleteRecurring?: string; + deleteWindowOccurrence?: string; + deleteWindowSeries?: string; + deleteWindowTitle?: string; + editRecurring?: string; + editWindowOccurrence?: string; + editWindowSeries?: string; + editWindowTitle?: string; + } + + interface SchedulerMessagesViews { + day?: string; + week?: string; + month?: string; + agenda?: string; + } + + interface SchedulerMessages { + allDay?: string; + ariaEventLabel?: string; + ariaSlotLabel?: string; + cancel?: string; + date?: string; + deleteWindowTitle?: string; + destroy?: string; + event?: string; + defaultRowText?: string; + pdf?: string; + save?: string; + showFullDay?: string; + showWorkDay?: string; + time?: string; + today?: string; + editor?: SchedulerMessagesEditor; + recurrenceEditor?: SchedulerMessagesRecurrenceEditor; + recurrenceMessages?: SchedulerMessagesRecurrenceMessages; + views?: SchedulerMessagesViews; + } + + interface SchedulerPdfMargin { + bottom?: any; + left?: any; + right?: any; + top?: any; + } + + interface SchedulerPdf { + author?: string; + creator?: string; + date?: Date; + fileName?: string; + forceProxy?: boolean; + keywords?: string; + landscape?: boolean; + margin?: SchedulerPdfMargin; + paperSize?: any; + proxyURL?: string; + proxyTarget?: string; + subject?: string; + title?: string; + } + + interface SchedulerResource { + dataColorField?: string; + dataSource?: any; + dataTextField?: string; + dataValueField?: string; + field?: string; + multiple?: boolean; + name?: string; + title?: string; + valuePrimitive?: boolean; + } + + interface SchedulerToolbarItem { + name?: string; + } + + interface SchedulerViewEditable { + create?: boolean; + destroy?: boolean; + update?: boolean; + } + + interface SchedulerViewGroup { + orientation?: string; + } + + interface SchedulerView { + allDayEventTemplate?: any; + allDaySlot?: boolean; + allDaySlotTemplate?: any; + columnWidth?: number; + dateHeaderTemplate?: any; + dayTemplate?: any; + editable?: SchedulerViewEditable; + endTime?: Date; + eventHeight?: number; + eventTemplate?: any; + eventTimeTemplate?: any; + group?: SchedulerViewGroup; + majorTick?: number; + majorTimeHeaderTemplate?: any; + minorTickCount?: number; + minorTimeHeaderTemplate?: any; + selected?: boolean; + selectedDateFormat?: string; + showWorkHours?: boolean; + slotTemplate?: any; + startTime?: Date; + title?: string; + type?: string; + workWeekStart?: number; + workWeekEnd?: number; + } + + interface SchedulerSelectOptions { + events?: any; + resources?: any; + start?: Date; + end?: Date; + isAllDay?: boolean; + } + + interface SchedulerOptions { + name?: string; + allDayEventTemplate?: any; + allDaySlot?: boolean; + autoBind?: boolean; + currentTimeMarker?: SchedulerCurrentTimeMarker; + dataSource?: any; + date?: Date; + dateHeaderTemplate?: any; + editable?: SchedulerEditable; + endTime?: Date; + eventTemplate?: any; + footer?: SchedulerFooter; + group?: SchedulerGroup; + height?: any; + majorTick?: number; + majorTimeHeaderTemplate?: any; + max?: Date; + messages?: SchedulerMessages; + min?: Date; + minorTickCount?: number; + minorTimeHeaderTemplate?: any; + mobile?: any; + pdf?: SchedulerPdf; + resources?: SchedulerResource[]; + selectable?: boolean; + showWorkHours?: boolean; + snap?: boolean; + startTime?: Date; + timezone?: string; + toolbar?: SchedulerToolbarItem[]; + views?: SchedulerView[]; + groupHeaderTemplate?: any; + width?: any; + workDayStart?: Date; + workDayEnd?: Date; + workWeekStart?: number; + workWeekEnd?: number; + add?(e: SchedulerAddEvent): void; + cancel?(e: SchedulerCancelEvent): void; + change?(e: SchedulerChangeEvent): void; + dataBinding?(e: SchedulerDataBindingEvent): void; + dataBound?(e: SchedulerDataBoundEvent): void; + edit?(e: SchedulerEditEvent): void; + moveStart?(e: SchedulerMoveStartEvent): void; + move?(e: SchedulerMoveEvent): void; + moveEnd?(e: SchedulerMoveEndEvent): void; + navigate?(e: SchedulerNavigateEvent): void; + pdfExport?(e: SchedulerPdfExportEvent): void; + remove?(e: SchedulerRemoveEvent): void; + resizeStart?(e: SchedulerResizeStartEvent): void; + resize?(e: SchedulerResizeEvent): void; + resizeEnd?(e: SchedulerResizeEndEvent): void; + save?(e: SchedulerSaveEvent): void; + } + interface SchedulerEvent { + sender: Scheduler; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + interface SchedulerAddEvent extends SchedulerEvent { + event?: any; + } + + interface SchedulerCancelEvent extends SchedulerEvent { + container?: JQuery; + event?: kendo.data.SchedulerEvent; + } + + interface SchedulerChangeEvent extends SchedulerEvent { + start?: Date; + end?: Date; + events?: any; + slots?: any; + resources?: any; + } + + interface SchedulerDataBindingEvent extends SchedulerEvent { + } + + interface SchedulerDataBoundEvent extends SchedulerEvent { + } + + interface SchedulerEditEvent extends SchedulerEvent { + container?: JQuery; + event?: kendo.data.SchedulerEvent; + } + + interface SchedulerMoveStartEvent extends SchedulerEvent { + event?: kendo.data.SchedulerEvent; + } + + interface SchedulerMoveEvent extends SchedulerEvent { + event?: kendo.data.SchedulerEvent; + slot?: any; + } + + interface SchedulerMoveEndEvent extends SchedulerEvent { + start?: Date; + end?: Date; + event?: kendo.data.SchedulerEvent; + slot?: any; + resources?: any; + } + + interface SchedulerNavigateEvent extends SchedulerEvent { + action?: string; + date?: Date; + view?: string; + } + + interface SchedulerPdfExportEvent extends SchedulerEvent { + promise?: JQueryPromise; + } + + interface SchedulerRemoveEvent extends SchedulerEvent { + event?: kendo.data.SchedulerEvent; + } + + interface SchedulerResizeStartEvent extends SchedulerEvent { + event?: kendo.data.SchedulerEvent; + } + + interface SchedulerResizeEvent extends SchedulerEvent { + event?: kendo.data.SchedulerEvent; + slot?: any; + } + + interface SchedulerResizeEndEvent extends SchedulerEvent { + event?: kendo.data.SchedulerEvent; + slot?: any; + } + + interface SchedulerSaveEvent extends SchedulerEvent { + container?: JQuery; + event?: kendo.data.SchedulerEvent; + } + + + class Slider extends kendo.ui.Widget { + static fn: Slider; + static extend(proto: Object): Slider; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: SliderOptions); + options: SliderOptions; + destroy(): void; + enable(enable: boolean): void; + value(): number; + value(value: number): void; + resize(): void; + } + + interface SliderTooltip { + enabled?: boolean; + format?: string; + template?: string; + } + + interface SliderOptions { + name?: string; + decreaseButtonTitle?: string; + increaseButtonTitle?: string; + largeStep?: number; + max?: number; + min?: number; + orientation?: string; + showButtons?: boolean; + smallStep?: number; + tickPlacement?: string; + tooltip?: SliderTooltip; + value?: number; + change?(e: SliderChangeEvent): void; + slide?(e: SliderSlideEvent): void; + } + interface SliderEvent { + sender: Slider; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + interface SliderChangeEvent extends SliderEvent { + value?: number; + } + + interface SliderSlideEvent extends SliderEvent { + value?: number; + } + + + class Sortable extends kendo.ui.Widget { + static fn: Sortable; + static extend(proto: Object): Sortable; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: SortableOptions); + options: SortableOptions; + indexOf(element: JQuery): number; + items(): JQuery; + } + + interface SortableCursorOffset { + left?: number; + top?: number; + } + + interface SortableOptions { + name?: string; + axis?: string; + container?: any; + connectWith?: any; + cursor?: string; + cursorOffset?: SortableCursorOffset; + disabled?: string; + filter?: string; + handler?: string; + hint?: any; + holdToDrag?: boolean; + ignore?: string; + placeholder?: any; + start?(e: SortableStartEvent): void; + move?(e: SortableMoveEvent): void; + end?(e: SortableEndEvent): void; + change?(e: SortableChangeEvent): void; + cancel?(e: SortableCancelEvent): void; + } + interface SortableEvent { + sender: Sortable; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + interface SortableStartEvent extends SortableEvent { + draggableEvent?: any; + item?: JQuery; + } + + interface SortableMoveEvent extends SortableEvent { + item?: JQuery; + target?: JQuery; + list?: kendo.ui.Sortable; + draggableEvent?: any; + } + + interface SortableEndEvent extends SortableEvent { + action?: string; + item?: JQuery; + oldIndex?: number; + newIndex?: number; + draggableEvent?: any; + } + + interface SortableChangeEvent extends SortableEvent { + action?: string; + item?: JQuery; + oldIndex?: number; + newIndex?: number; + draggableEvent?: any; + } + + interface SortableCancelEvent extends SortableEvent { + item?: JQuery; + } + + + class Splitter extends kendo.ui.Widget { + static fn: Splitter; + static extend(proto: Object): Splitter; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: SplitterOptions); + options: SplitterOptions; + ajaxRequest(pane: string, url: string, data: any): void; + ajaxRequest(pane: string, url: string, data: string): void; + ajaxRequest(pane: Element, url: string, data: any): void; + ajaxRequest(pane: Element, url: string, data: string): void; + ajaxRequest(pane: JQuery, url: string, data: any): void; + ajaxRequest(pane: JQuery, url: string, data: string): void; + append(config?: any): JQuery; + collapse(pane: string): void; + collapse(pane: Element): void; + collapse(pane: JQuery): void; + destroy(): void; + expand(pane: string): void; + expand(pane: Element): void; + expand(pane: JQuery): void; + insertAfter(config: any, referencePane: string): JQuery; + insertAfter(config: any, referencePane: Element): JQuery; + insertAfter(config: any, referencePane: JQuery): JQuery; + insertBefore(config: any, referencePane: string): JQuery; + insertBefore(config: any, referencePane: Element): JQuery; + insertBefore(config: any, referencePane: JQuery): JQuery; + max(pane: string, value: string): void; + max(pane: Element, value: string): void; + max(pane: JQuery, value: string): void; + min(pane: string, value: string): void; + min(pane: Element, value: string): void; + min(pane: JQuery, value: string): void; + remove(pane: string): void; + remove(pane: Element): void; + remove(pane: JQuery): void; + size(pane: string, value: string): void; + size(pane: Element, value: string): void; + size(pane: JQuery, value: string): void; + toggle(pane: string, expand?: boolean): void; + toggle(pane: Element, expand?: boolean): void; + toggle(pane: JQuery, expand?: boolean): void; + } + + interface SplitterPane { + collapsed?: boolean; + collapsedSize?: string; + collapsible?: boolean; + contentUrl?: string; + max?: string; + min?: string; + resizable?: boolean; + scrollable?: boolean; + size?: string; + } + + interface SplitterOptions { + name?: string; + orientation?: string; + panes?: SplitterPane[]; + collapse?(e: SplitterCollapseEvent): void; + contentLoad?(e: SplitterContentLoadEvent): void; + error?(e: SplitterErrorEvent): void; + expand?(e: SplitterExpandEvent): void; + layoutChange?(e: SplitterEvent): void; + resize?(e: SplitterEvent): void; + } + interface SplitterEvent { + sender: Splitter; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + interface SplitterCollapseEvent extends SplitterEvent { + pane?: Element; + } + + interface SplitterContentLoadEvent extends SplitterEvent { + pane?: Element; + } + + interface SplitterErrorEvent extends SplitterEvent { + xhr?: JQueryXHR; + status?: string; + } + + interface SplitterExpandEvent extends SplitterEvent { + pane?: Element; + } + + + class TabStrip extends kendo.ui.Widget { + static fn: TabStrip; + static extend(proto: Object): TabStrip; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: TabStripOptions); + options: TabStripOptions; + activateTab(item: JQuery): void; + append(tab: any): kendo.ui.TabStrip; + contentElement(itemIndex: number): Element; + contentHolder(itemIndex: number): Element; + deactivateTab(item: JQuery): void; + destroy(): void; + disable(element: string): kendo.ui.TabStrip; + disable(element: Element): kendo.ui.TabStrip; + disable(element: JQuery): kendo.ui.TabStrip; + enable(element: string, enable?: boolean): kendo.ui.TabStrip; + enable(element: Element, enable?: boolean): kendo.ui.TabStrip; + enable(element: JQuery, enable?: boolean): kendo.ui.TabStrip; + insertAfter(item: string, referenceTab: string): kendo.ui.TabStrip; + insertAfter(item: string, referenceTab: Element): kendo.ui.TabStrip; + insertAfter(item: string, referenceTab: JQuery): kendo.ui.TabStrip; + insertAfter(item: Element, referenceTab: string): kendo.ui.TabStrip; + insertAfter(item: Element, referenceTab: Element): kendo.ui.TabStrip; + insertAfter(item: Element, referenceTab: JQuery): kendo.ui.TabStrip; + insertAfter(item: JQuery, referenceTab: string): kendo.ui.TabStrip; + insertAfter(item: JQuery, referenceTab: Element): kendo.ui.TabStrip; + insertAfter(item: JQuery, referenceTab: JQuery): kendo.ui.TabStrip; + insertBefore(item: string, referenceTab: string): kendo.ui.TabStrip; + insertBefore(item: string, referenceTab: Element): kendo.ui.TabStrip; + insertBefore(item: string, referenceTab: JQuery): kendo.ui.TabStrip; + insertBefore(item: Element, referenceTab: string): kendo.ui.TabStrip; + insertBefore(item: Element, referenceTab: Element): kendo.ui.TabStrip; + insertBefore(item: Element, referenceTab: JQuery): kendo.ui.TabStrip; + insertBefore(item: JQuery, referenceTab: string): kendo.ui.TabStrip; + insertBefore(item: JQuery, referenceTab: Element): kendo.ui.TabStrip; + insertBefore(item: JQuery, referenceTab: JQuery): kendo.ui.TabStrip; + items(): HTMLCollection; + reload(element: string): kendo.ui.TabStrip; + reload(element: Element): kendo.ui.TabStrip; + reload(element: JQuery): kendo.ui.TabStrip; + remove(element: string): kendo.ui.TabStrip; + remove(element: number): kendo.ui.TabStrip; + select(): JQuery; + select(element: string): void; + select(element: Element): void; + select(element: JQuery): void; + select(element: number): void; + setDataSource(): void; + tabGroup: JQuery; + } + + interface TabStripAnimationClose { + duration?: number; + effects?: string; + } + + interface TabStripAnimationOpen { + duration?: number; + effects?: string; + } + + interface TabStripAnimation { + close?: TabStripAnimationClose; + open?: TabStripAnimationOpen; + } + + interface TabStripOptions { + name?: string; + animation?: TabStripAnimation; + collapsible?: boolean; + contentUrls?: any; + dataContentField?: string; + dataContentUrlField?: string; + dataImageUrlField?: string; + dataSpriteCssClass?: string; + dataTextField?: string; + dataUrlField?: string; + navigatable?: boolean; + tabPosition?: string; + activate?(e: TabStripActivateEvent): void; + contentLoad?(e: TabStripContentLoadEvent): void; + error?(e: TabStripErrorEvent): void; + select?(e: TabStripSelectEvent): void; + show?(e: TabStripShowEvent): void; + } + interface TabStripEvent { + sender: TabStrip; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + interface TabStripActivateEvent extends TabStripEvent { + item?: Element; + contentElement?: Element; + } + + interface TabStripContentLoadEvent extends TabStripEvent { + item?: Element; + contentElement?: Element; + } + + interface TabStripErrorEvent extends TabStripEvent { + xhr?: JQueryXHR; + status?: string; + } + + interface TabStripSelectEvent extends TabStripEvent { + item?: Element; + contentElement?: Element; + } + + interface TabStripShowEvent extends TabStripEvent { + item?: Element; + contentElement?: Element; + } + + + class TimePicker extends kendo.ui.Widget { + static fn: TimePicker; + static extend(proto: Object): TimePicker; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: TimePickerOptions); + options: TimePickerOptions; + close(): void; + destroy(): void; + enable(enable: boolean): void; + readonly(readonly: boolean): void; + max(): Date; + max(value: Date): void; + max(value: string): void; + min(): Date; + min(value: Date): void; + min(value: string): void; + open(): void; + setOptions(options: any): void; + value(): Date; + value(value: Date): void; + value(value: string): void; + } + + interface TimePickerAnimationClose { + effects?: string; + duration?: number; + } + + interface TimePickerAnimationOpen { + effects?: string; + duration?: number; + } + + interface TimePickerAnimation { + close?: TimePickerAnimationClose; + open?: TimePickerAnimationOpen; + } + + interface TimePickerOptions { + name?: string; + animation?: TimePickerAnimation; + culture?: string; + dates?: any; + format?: string; + interval?: number; + max?: Date; + min?: Date; + parseFormats?: any; + value?: Date; + change?(e: TimePickerChangeEvent): void; + close?(e: TimePickerCloseEvent): void; + open?(e: TimePickerOpenEvent): void; + } + interface TimePickerEvent { + sender: TimePicker; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + interface TimePickerChangeEvent extends TimePickerEvent { + } + + interface TimePickerCloseEvent extends TimePickerEvent { + } + + interface TimePickerOpenEvent extends TimePickerEvent { + } + + + class ToolBar extends kendo.ui.Widget { + static fn: ToolBar; + static extend(proto: Object): ToolBar; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: ToolBarOptions); + options: ToolBarOptions; + add(command: any): void; + destroy(): void; + enable(command: string, enable: boolean): void; + enable(command: Element, enable: boolean): void; + enable(command: JQuery, enable: boolean): void; + getSelectedFromGroup(groupName: string): void; + remove(command: string): void; + remove(command: Element): void; + remove(command: JQuery): void; + toggle(): void; + } + + interface ToolBarItemButton { + attributes?: any; + click?: Function; + enable?: boolean; + group?: string; + icon?: string; + id?: string; + imageUrl?: string; + selected?: boolean; + showIcon?: string; + showText?: string; + spriteCssClass?: string; + toggle?: Function; + togglable?: boolean; + text?: string; + url?: string; + } + + interface ToolBarItemMenuButton { + attributes?: any; + enable?: boolean; + icon?: string; + id?: string; + imageUrl?: string; + spriteCssClass?: string; + text?: string; + url?: string; + } + + interface ToolBarItem { + attributes?: any; + buttons?: ToolBarItemButton[]; + click?: Function; + enable?: boolean; + group?: string; + icon?: string; + id?: string; + imageUrl?: string; + menuButtons?: ToolBarItemMenuButton[]; + overflow?: string; + overflowTemplate?: any; + primary?: boolean; + selected?: boolean; + showIcon?: string; + showText?: string; + spriteCssClass?: string; + template?: any; + text?: string; + togglable?: boolean; + toggle?: Function; + type?: string; + url?: string; + } + + interface ToolBarOptions { + name?: string; + resizable?: boolean; + items?: ToolBarItem[]; + click?(e: ToolBarClickEvent): void; + close?(e: ToolBarCloseEvent): void; + open?(e: ToolBarOpenEvent): void; + toggle?(e: ToolBarToggleEvent): void; + overflowClose?(e: ToolBarOverflowCloseEvent): void; + overflowOpen?(e: ToolBarOverflowOpenEvent): void; + } + interface ToolBarEvent { + sender: ToolBar; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + interface ToolBarClickEvent extends ToolBarEvent { + target?: JQuery; + id?: string; + } + + interface ToolBarCloseEvent extends ToolBarEvent { + SplitButton?: JQuery; + } + + interface ToolBarOpenEvent extends ToolBarEvent { + SplitButton?: JQuery; + } + + interface ToolBarToggleEvent extends ToolBarEvent { + target?: JQuery; + checked?: boolean; + id?: string; + } + + interface ToolBarOverflowCloseEvent extends ToolBarEvent { + } + + interface ToolBarOverflowOpenEvent extends ToolBarEvent { + } + + + class Tooltip extends kendo.ui.Widget { + static fn: Tooltip; + static extend(proto: Object): Tooltip; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: TooltipOptions); + options: TooltipOptions; + show(element: JQuery): void; + hide(): void; + refresh(): void; + target(): JQuery; + } + + interface TooltipAnimationClose { + effects?: string; + duration?: number; + } + + interface TooltipAnimationOpen { + effects?: string; + duration?: number; + } + + interface TooltipAnimation { + close?: TooltipAnimationClose; + open?: TooltipAnimationOpen; + } + + interface TooltipContent { + url?: string; + } + + interface TooltipOptions { + name?: string; + autoHide?: boolean; + animation?: TooltipAnimation; + content?: TooltipContent; + callout?: boolean; + filter?: string; + iframe?: boolean; + height?: number; + width?: number; + position?: string; + showAfter?: number; + showOn?: string; + contentLoad?(e: TooltipEvent): void; + show?(e: TooltipEvent): void; + hide?(e: TooltipEvent): void; + requestStart?(e: TooltipRequestStartEvent): void; + error?(e: TooltipErrorEvent): void; + } + interface TooltipEvent { + sender: Tooltip; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + interface TooltipRequestStartEvent extends TooltipEvent { + target?: JQuery; + options?: any; + } + + interface TooltipErrorEvent extends TooltipEvent { + xhr?: JQueryXHR; + status?: string; + } + + + class Touch extends kendo.ui.Widget { + static fn: Touch; + static extend(proto: Object): Touch; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: TouchOptions); + options: TouchOptions; + cancel(): void; + destroy(): void; + } + + interface TouchOptions { + name?: string; + filter?: string; + surface?: JQuery; + multiTouch?: boolean; + enableSwipe?: boolean; + minXDelta?: number; + maxYDelta?: number; + maxDuration?: number; + minHold?: number; + doubleTapTimeout?: number; + touchstart?(e: TouchTouchstartEvent): void; + dragstart?(e: TouchDragstartEvent): void; + drag?(e: TouchDragEvent): void; + dragend?(e: TouchDragendEvent): void; + tap?(e: TouchTapEvent): void; + doubletap?(e: TouchDoubletapEvent): void; + hold?(e: TouchHoldEvent): void; + swipe?(e: TouchSwipeEvent): void; + gesturestart?(e: TouchGesturestartEvent): void; + gesturechange?(e: TouchGesturechangeEvent): void; + gestureend?(e: TouchGestureendEvent): void; + } + interface TouchEvent { + sender: Touch; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + interface TouchTouchstartEvent extends TouchEvent { + touch?: kendo.mobile.ui.TouchEventOptions; + event?: JQueryEventObject; + } + + interface TouchDragstartEvent extends TouchEvent { + touch?: kendo.mobile.ui.TouchEventOptions; + event?: JQueryEventObject; + } + + interface TouchDragEvent extends TouchEvent { + touch?: kendo.mobile.ui.TouchEventOptions; + event?: JQueryEventObject; + } + + interface TouchDragendEvent extends TouchEvent { + touch?: kendo.mobile.ui.TouchEventOptions; + event?: JQueryEventObject; + } + + interface TouchTapEvent extends TouchEvent { + touch?: kendo.mobile.ui.TouchEventOptions; + event?: JQueryEventObject; + } + + interface TouchDoubletapEvent extends TouchEvent { + touch?: kendo.mobile.ui.TouchEventOptions; + event?: JQueryEventObject; + } + + interface TouchHoldEvent extends TouchEvent { + touch?: kendo.mobile.ui.TouchEventOptions; + event?: JQueryEventObject; + } + + interface TouchSwipeEvent extends TouchEvent { + touch?: kendo.mobile.ui.TouchEventOptions; + event?: JQueryEventObject; + } + + interface TouchGesturestartEvent extends TouchEvent { + touches?: any; + event?: JQueryEventObject; + distance?: number; + center?: kendo.mobile.ui.Point; + } + + interface TouchGesturechangeEvent extends TouchEvent { + touches?: any; + event?: JQueryEventObject; + distance?: number; + center?: kendo.mobile.ui.Point; + } + + interface TouchGestureendEvent extends TouchEvent { + touches?: any; + event?: JQueryEventObject; + distance?: number; + center?: kendo.mobile.ui.Point; + } + + + class TreeList extends kendo.ui.Widget { + static fn: TreeList; + static extend(proto: Object): TreeList; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: TreeListOptions); + options: TreeListOptions; + dataSource: kendo.data.DataSource; + addRow(parentRow: string): void; + addRow(parentRow: Element): void; + addRow(parentRow: JQuery): void; + cancelRow(): void; + clearSelection(): void; + collapse(): void; + dataItem(row: string): kendo.data.TreeListModel; + dataItem(row: Element): kendo.data.TreeListModel; + dataItem(row: JQuery): kendo.data.TreeListModel; + destroy(): void; + editRow(row: JQuery): void; + expand(): void; + refresh(): void; + removeRow(row: string): void; + removeRow(row: Element): void; + removeRow(row: JQuery): void; + saveAsExcel(): void; + saveAsPDF(): JQueryPromise; + saveRow(): void; + select(): JQuery; + select(rows: Element): void; + select(rows: JQuery): void; + setDataSource(dataSource: kendo.data.TreeListDataSource): void; + showColumn(column: number): void; + showColumn(column: string): void; + hideColumn(column: number): void; + hideColumn(column: string): void; + lockColumn(column: number): void; + lockColumn(column: string): void; + unlockColumn(column: number): void; + unlockColumn(column: string): void; + reorderColumn(destIndex: number, column: any): void; + } + + interface TreeListColumnMenuMessages { + columns?: string; + filter?: string; + sortAscending?: string; + sortDescending?: string; + } + + interface TreeListColumnMenu { + columns?: boolean; + filterable?: boolean; + sortable?: boolean; + messages?: TreeListColumnMenuMessages; + } + + interface TreeListColumnCommandItem { + className?: string; + click?: Function; + name?: string; + text?: string; + } + + interface TreeListColumnFilterable { + ui?: any; + } + + interface TreeListColumnSortable { + compare?: Function; + } + + interface TreeListColumn { + attributes?: any; + command?: TreeListColumnCommandItem[]; + encoded?: boolean; + expandable?: boolean; + field?: string; + filterable?: TreeListColumnFilterable; + footerTemplate?: any; + format?: string; + headerAttributes?: any; + headerTemplate?: any; + sortable?: TreeListColumnSortable; + template?: any; + title?: string; + width?: any; + hidden?: boolean; + menu?: boolean; + locked?: boolean; + lockable?: boolean; + } + + interface TreeListEditable { + mode?: string; + template?: any; + window?: any; + } + + interface TreeListExcel { + fileName?: string; + filterable?: boolean; + forceProxy?: boolean; + proxyURL?: string; + } + + interface TreeListFilterableMessages { + and?: string; + clear?: string; + filter?: string; + info?: string; + isFalse?: string; + isTrue?: string; + or?: string; + selectValue?: string; + cancel?: string; + operator?: string; + } + + interface TreeListFilterable { + extra?: boolean; + messages?: TreeListFilterableMessages; + } + + interface TreeListMessagesCommands { + canceledit?: string; + create?: string; + createchild?: string; + destroy?: string; + edit?: string; + excel?: string; + pdf?: string; + update?: string; + } + + interface TreeListMessages { + commands?: TreeListMessagesCommands; + loading?: string; + noRows?: string; + requestFailed?: string; + retry?: string; + } + + interface TreeListPdfMargin { + bottom?: any; + left?: any; + right?: any; + top?: any; + } + + interface TreeListPdf { + author?: string; + creator?: string; + date?: Date; + fileName?: string; + forceProxy?: boolean; + keywords?: string; + landscape?: boolean; + margin?: TreeListPdfMargin; + paperSize?: any; + proxyURL?: string; + proxyTarget?: string; + subject?: string; + title?: string; + } + + interface TreeListSortable { + allowUnsort?: boolean; + mode?: string; + } + + interface TreeListToolbarItem { + name?: string; + text?: string; + } + + interface TreeListOptions { + name?: string; + autoBind?: boolean; + columns?: TreeListColumn[]; + resizable?: boolean; + reorderable?: boolean; + columnMenu?: TreeListColumnMenu; + dataSource?: any; + editable?: TreeListEditable; + excel?: TreeListExcel; + filterable?: TreeListFilterable; + height?: any; + messages?: TreeListMessages; + pdf?: TreeListPdf; + scrollable?: any; + selectable?: any; + sortable?: TreeListSortable; + toolbar?: TreeListToolbarItem[]; + cancel?(e: TreeListCancelEvent): void; + change?(e: TreeListChangeEvent): void; + collapse?(e: TreeListCollapseEvent): void; + dataBinding?(e: TreeListDataBindingEvent): void; + dataBound?(e: TreeListDataBoundEvent): void; + edit?(e: TreeListEditEvent): void; + excelExport?(e: TreeListExcelExportEvent): void; + expand?(e: TreeListExpandEvent): void; + filterMenuInit?(e: TreeListFilterMenuInitEvent): void; + pdfExport?(e: TreeListPdfExportEvent): void; + remove?(e: TreeListRemoveEvent): void; + save?(e: TreeListSaveEvent): void; + columnShow?(e: TreeListColumnShowEvent): void; + columnHide?(e: TreeListColumnHideEvent): void; + columnReorder?(e: TreeListColumnReorderEvent): void; + columnMenuInit?(e: TreeListColumnMenuInitEvent): void; + columnLock?(e: TreeListColumnLockEvent): void; + columnUnlock?(e: TreeListColumnUnlockEvent): void; + } + interface TreeListEvent { + sender: TreeList; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + interface TreeListCancelEvent extends TreeListEvent { + container?: JQuery; + model?: kendo.data.TreeListModel; + } + + interface TreeListChangeEvent extends TreeListEvent { + } + + interface TreeListCollapseEvent extends TreeListEvent { + model?: kendo.data.TreeListModel; + } + + interface TreeListDataBindingEvent extends TreeListEvent { + } + + interface TreeListDataBoundEvent extends TreeListEvent { + } + + interface TreeListEditEvent extends TreeListEvent { + container?: JQuery; + model?: kendo.data.TreeListModel; + } + + interface TreeListExcelExportEvent extends TreeListEvent { + data?: any; + workbook?: any; + } + + interface TreeListExpandEvent extends TreeListEvent { + model?: kendo.data.TreeListModel; + } + + interface TreeListFilterMenuInitEvent extends TreeListEvent { + container?: JQuery; + field?: string; + } + + interface TreeListPdfExportEvent extends TreeListEvent { + promise?: JQueryPromise; + } + + interface TreeListRemoveEvent extends TreeListEvent { + model?: kendo.data.TreeListModel; + row?: JQuery; + } + + interface TreeListSaveEvent extends TreeListEvent { + model?: kendo.data.TreeListModel; + container?: JQuery; + } + + interface TreeListColumnShowEvent extends TreeListEvent { + column?: any; + } + + interface TreeListColumnHideEvent extends TreeListEvent { + column?: any; + } + + interface TreeListColumnReorderEvent extends TreeListEvent { + column?: any; + newIndex?: number; + oldIndex?: number; + } + + interface TreeListColumnMenuInitEvent extends TreeListEvent { + container?: JQuery; + field?: string; + } + + interface TreeListColumnLockEvent extends TreeListEvent { + column?: any; + } + + interface TreeListColumnUnlockEvent extends TreeListEvent { + column?: any; + } + + + class TreeView extends kendo.ui.Widget { + static fn: TreeView; + static extend(proto: Object): TreeView; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: TreeViewOptions); + options: TreeViewOptions; + dataSource: kendo.data.DataSource; + append(nodeData: any, parentNode?: JQuery, success?: Function): JQuery; + append(nodeData: JQuery, parentNode?: JQuery, success?: Function): JQuery; + collapse(nodes: JQuery): void; + collapse(nodes: Element): void; + collapse(nodes: string): void; + dataItem(node: JQuery): kendo.data.Node; + dataItem(node: Element): kendo.data.Node; + dataItem(node: string): kendo.data.Node; + destroy(): void; + detach(node: JQuery): JQuery; + detach(node: Element): JQuery; + detach(node: string): JQuery; + enable(nodes: JQuery, enable?: boolean): void; + enable(nodes: Element, enable?: boolean): void; + enable(nodes: string, enable?: boolean): void; + expand(nodes: JQuery): void; + expand(nodes: Element): void; + expand(nodes: string): void; + expandPath(path: any, complete: Function): void; + expandTo(targetNode: kendo.data.Node): void; + expandTo(targetNode: any): void; + findByText(text: string): JQuery; + findByUid(text: string): JQuery; + insertAfter(nodeData: any, referenceNode: JQuery): void; + insertBefore(nodeData: any, referenceNode: JQuery): void; + parent(node: JQuery): JQuery; + parent(node: Element): JQuery; + parent(node: string): JQuery; + remove(node: JQuery): void; + remove(node: Element): void; + remove(node: string): void; + select(): JQuery; + select(node?: JQuery): void; + select(node?: Element): void; + select(node?: string): void; + setDataSource(dataSource: kendo.data.HierarchicalDataSource): void; + text(): string; + text(node: JQuery, newText: string): void; + text(node: Element, newText: string): void; + text(node: string, newText: string): void; + toggle(node: JQuery): void; + toggle(node: Element): void; + toggle(node: string): void; + updateIndeterminate(node: JQuery): void; + } + + interface TreeViewAnimationCollapse { + duration?: number; + effects?: string; + } + + interface TreeViewAnimationExpand { + duration?: number; + effects?: string; + } + + interface TreeViewAnimation { + collapse?: TreeViewAnimationCollapse; + expand?: TreeViewAnimationExpand; + } + + interface TreeViewCheckboxes { + checkChildren?: boolean; + name?: string; + template?: any; + } + + interface TreeViewMessages { + loading?: string; + requestFailed?: string; + retry?: string; + } + + interface TreeViewOptions { + name?: string; + animation?: TreeViewAnimation; + autoBind?: boolean; + checkboxes?: TreeViewCheckboxes; + dataImageUrlField?: string; + dataSource?: any; + dataSpriteCssClassField?: string; + dataTextField?: any; + dataUrlField?: string; + dragAndDrop?: boolean; + loadOnDemand?: boolean; + messages?: TreeViewMessages; + template?: any; + change?(e: TreeViewEvent): void; + check?(e: TreeViewCheckEvent): void; + collapse?(e: TreeViewCollapseEvent): void; + dataBound?(e: TreeViewDataBoundEvent): void; + drag?(e: TreeViewDragEvent): void; + dragend?(e: TreeViewDragendEvent): void; + dragstart?(e: TreeViewDragstartEvent): void; + drop?(e: TreeViewDropEvent): void; + expand?(e: TreeViewExpandEvent): void; + navigate?(e: TreeViewNavigateEvent): void; + select?(e: TreeViewSelectEvent): void; + } + interface TreeViewEvent { + sender: TreeView; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + interface TreeViewCheckEvent extends TreeViewEvent { + node?: Element; + } + + interface TreeViewCollapseEvent extends TreeViewEvent { + node?: Element; + } + + interface TreeViewDataBoundEvent extends TreeViewEvent { + node?: JQuery; + } + + interface TreeViewDragEvent extends TreeViewEvent { + sourceNode?: Element; + dropTarget?: Element; + pageX?: number; + pageY?: number; + statusClass?: string; + setStatusClass?: Function; + } + + interface TreeViewDragendEvent extends TreeViewEvent { + sourceNode?: Element; + destinationNode?: Element; + dropPosition?: string; + } + + interface TreeViewDragstartEvent extends TreeViewEvent { + sourceNode?: Element; + } + + interface TreeViewDropEvent extends TreeViewEvent { + sourceNode?: Element; + destinationNode?: Element; + valid?: boolean; + setValid?: Function; + dropTarget?: Element; + dropPosition?: string; + } + + interface TreeViewExpandEvent extends TreeViewEvent { + node?: Element; + } + + interface TreeViewNavigateEvent extends TreeViewEvent { + node?: Element; + } + + interface TreeViewSelectEvent extends TreeViewEvent { + node?: Element; + } + + + class Upload extends kendo.ui.Widget { + static fn: Upload; + static extend(proto: Object): Upload; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: UploadOptions); + options: UploadOptions; + destroy(): void; + disable(): void; + enable(enable?: boolean): void; + toggle(enable: boolean): void; + } + + interface UploadAsync { + autoUpload?: boolean; + batch?: boolean; + removeField?: string; + removeUrl?: string; + removeVerb?: string; + saveField?: string; + saveUrl?: string; + withCredentials?: boolean; + } + + interface UploadFile { + extension?: string; + name?: string; + size?: number; + } + + interface UploadLocalization { + cancel?: string; + dropFilesHere?: string; + headerStatusUploaded?: string; + headerStatusUploading?: string; + remove?: string; + retry?: string; + select?: string; + statusFailed?: string; + statusUploaded?: string; + statusUploading?: string; + uploadSelectedFiles?: string; + } + + interface UploadOptions { + name?: string; + async?: UploadAsync; + enabled?: boolean; + files?: UploadFile[]; + localization?: UploadLocalization; + multiple?: boolean; + showFileList?: boolean; + template?: any; + cancel?(e: UploadCancelEvent): void; + complete?(e: UploadEvent): void; + error?(e: UploadErrorEvent): void; + progress?(e: UploadProgressEvent): void; + remove?(e: UploadRemoveEvent): void; + select?(e: UploadSelectEvent): void; + success?(e: UploadSuccessEvent): void; + upload?(e: UploadUploadEvent): void; + } + interface UploadEvent { + sender: Upload; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + interface UploadCancelEvent extends UploadEvent { + files?: any; + } + + interface UploadErrorEvent extends UploadEvent { + files?: any; + operation?: string; + XMLHttpRequest?: any; + } + + interface UploadProgressEvent extends UploadEvent { + files?: any; + percentComplete?: number; + } + + interface UploadRemoveEvent extends UploadEvent { + files?: any; + data?: any; + } + + interface UploadSelectEvent extends UploadEvent { + e?: any; + files?: any; + } + + interface UploadSuccessEvent extends UploadEvent { + files?: any; + operation?: string; + response?: string; + XMLHttpRequest?: any; + } + + interface UploadUploadEvent extends UploadEvent { + files?: any; + data?: any; + formData?: any; + XMLHttpRequest?: any; + } + + + class Validator extends kendo.ui.Widget { + static fn: Validator; + static extend(proto: Object): Validator; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: ValidatorOptions); + options: ValidatorOptions; + errors(): any; + hideMessages(): void; + validate(): boolean; + validateInput(input: Element): boolean; + validateInput(input: JQuery): boolean; + } + + interface ValidatorOptions { + name?: string; + errorTemplate?: string; + messages?: any; + rules?: any; + validateOnBlur?: boolean; + validate?(e: ValidatorValidateEvent): void; + } + interface ValidatorEvent { + sender: Validator; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + interface ValidatorValidateEvent extends ValidatorEvent { + } + + + class Window extends kendo.ui.Widget { + static fn: Window; + static extend(proto: Object): Window; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: WindowOptions); + options: WindowOptions; + center(): kendo.ui.Window; + close(): kendo.ui.Window; + content(): any; + content(content?: string): void; + destroy(): void; + maximize(): kendo.ui.Window; + minimize(): kendo.ui.Window; + open(): kendo.ui.Window; + pin(): void; + refresh(options: any): kendo.ui.Window; + restore(): kendo.ui.Window; + setOptions(options: any): void; + title(): kendo.ui.Window; + title(text?: string): void; + toFront(): kendo.ui.Window; + toggleMaximization(): kendo.ui.Window; + unpin(): void; + } + + interface WindowAnimationClose { + effects?: string; + duration?: number; + } + + interface WindowAnimationOpen { + effects?: string; + duration?: number; + } + + interface WindowAnimation { + close?: WindowAnimationClose; + open?: WindowAnimationOpen; + } + + interface WindowContent { + template?: string; + } + + interface WindowPosition { + top?: any; + left?: any; + } + + interface WindowRefreshOptions { + url?: string; + data?: any; + type?: string; + template?: string; + iframe?: boolean; + } + + interface WindowOptions { + name?: string; + actions?: any; + animation?: WindowAnimation; + appendTo?: any; + autoFocus?: boolean; + content?: WindowContent; + draggable?: boolean; + iframe?: boolean; + maxHeight?: number; + maxWidth?: number; + minHeight?: number; + minWidth?: number; + modal?: boolean; + pinned?: boolean; + position?: WindowPosition; + resizable?: boolean; + title?: any; + visible?: boolean; + width?: any; + height?: any; + activate?(e: WindowEvent): void; + close?(e: WindowCloseEvent): void; + deactivate?(e: WindowEvent): void; + dragend?(e: WindowEvent): void; + dragstart?(e: WindowEvent): void; + error?(e: WindowErrorEvent): void; + open?(e: WindowEvent): void; + refresh?(e: WindowEvent): void; + resize?(e: WindowEvent): void; + } + interface WindowEvent { + sender: Window; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + interface WindowCloseEvent extends WindowEvent { + userTriggered?: boolean; + } + + interface WindowErrorEvent extends WindowEvent { + xhr?: JQueryXHR; + status?: string; + } + + +} +declare module kendo.dataviz.ui { + class Barcode extends kendo.ui.Widget { + static fn: Barcode; + static extend(proto: Object): Barcode; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: BarcodeOptions); + options: BarcodeOptions; + exportImage(options: any): JQueryPromise; + exportPDF(options?: kendo.drawing.PDFOptions): JQueryPromise; + exportSVG(options: any): JQueryPromise; + imageDataURL(): string; + redraw(): void; + resize(force?: boolean): void; + svg(): string; + value(): string; + value(value: number): void; + value(value: string): void; + } + + interface BarcodeBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface BarcodePadding { + bottom?: number; + left?: number; + right?: number; + top?: number; + } + + interface BarcodeTextMargin { + bottom?: number; + left?: number; + right?: number; + top?: number; + } + + interface BarcodeText { + color?: string; + font?: string; + margin?: BarcodeTextMargin; + visible?: boolean; + } + + interface BarcodeExportImageOptions { + width?: string; + height?: string; + } + + interface BarcodeExportSVGOptions { + raw?: boolean; + } + + interface BarcodeOptions { + name?: string; + renderAs?: string; + background?: string; + border?: BarcodeBorder; + checksum?: boolean; + color?: string; + height?: number; + padding?: BarcodePadding; + text?: BarcodeText; + type?: string; + value?: string; + width?: number; + } + interface BarcodeEvent { + sender: Barcode; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + class Chart extends kendo.ui.Widget { + static fn: Chart; + static extend(proto: Object): Chart; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: ChartOptions); + options: ChartOptions; + dataSource: kendo.data.DataSource; + destroy(): void; + exportImage(options: any): JQueryPromise; + exportPDF(options?: kendo.drawing.PDFOptions): JQueryPromise; + exportSVG(options: any): JQueryPromise; + getAxis(name: string): kendo.dataviz.ChartAxis; + redraw(): void; + refresh(): void; + resize(force?: boolean): void; + saveAsPDF(): void; + setDataSource(dataSource: kendo.data.DataSource): void; + setOptions(options: any): void; + svg(): string; + imageDataURL(): string; + toggleHighlight(show: boolean, options: any): void; + } + + interface ChartCategoryAxisItemAutoBaseUnitSteps { + seconds?: any; + minutes?: any; + hours?: any; + days?: any; + weeks?: any; + months?: any; + years?: any; + } + + interface ChartCategoryAxisItemCrosshairTooltipBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface ChartCategoryAxisItemCrosshairTooltipPadding { + bottom?: number; + left?: number; + right?: number; + top?: number; + } + + interface ChartCategoryAxisItemCrosshairTooltip { + background?: string; + border?: ChartCategoryAxisItemCrosshairTooltipBorder; + color?: string; + font?: string; + format?: string; + padding?: ChartCategoryAxisItemCrosshairTooltipPadding; + template?: any; + visible?: boolean; + } + + interface ChartCategoryAxisItemCrosshair { + color?: string; + opacity?: number; + tooltip?: ChartCategoryAxisItemCrosshairTooltip; + visible?: boolean; + width?: number; + } + + interface ChartCategoryAxisItemLabelsBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface ChartCategoryAxisItemLabelsDateFormats { + days?: string; + hours?: string; + months?: string; + weeks?: string; + years?: string; + } + + interface ChartCategoryAxisItemLabelsMargin { + bottom?: number; + left?: number; + right?: number; + top?: number; + } + + interface ChartCategoryAxisItemLabelsPadding { + bottom?: number; + left?: number; + right?: number; + top?: number; + } + + interface ChartCategoryAxisItemLabels { + background?: string; + border?: ChartCategoryAxisItemLabelsBorder; + color?: string; + culture?: string; + dateFormats?: ChartCategoryAxisItemLabelsDateFormats; + font?: string; + format?: string; + margin?: ChartCategoryAxisItemLabelsMargin; + mirror?: boolean; + padding?: ChartCategoryAxisItemLabelsPadding; + rotation?: number; + skip?: number; + step?: number; + template?: any; + visible?: boolean; + visual?: Function; + } + + interface ChartCategoryAxisItemLine { + color?: string; + dashType?: string; + visible?: boolean; + width?: number; + } + + interface ChartCategoryAxisItemMajorGridLines { + color?: string; + dashType?: string; + visible?: boolean; + width?: number; + step?: number; + skip?: number; + } + + interface ChartCategoryAxisItemMajorTicks { + color?: string; + size?: number; + visible?: boolean; + width?: number; + step?: number; + skip?: number; + } + + interface ChartCategoryAxisItemMinorGridLines { + color?: string; + dashType?: string; + visible?: boolean; + width?: number; + step?: number; + skip?: number; + } + + interface ChartCategoryAxisItemMinorTicks { + color?: string; + size?: number; + visible?: boolean; + width?: number; + step?: number; + skip?: number; + } + + interface ChartCategoryAxisItemNotesDataItemIconBorder { + color?: string; + width?: number; + } + + interface ChartCategoryAxisItemNotesDataItemIcon { + background?: string; + border?: ChartCategoryAxisItemNotesDataItemIconBorder; + size?: number; + type?: string; + visible?: boolean; + } + + interface ChartCategoryAxisItemNotesDataItemLabelBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface ChartCategoryAxisItemNotesDataItemLabel { + background?: string; + border?: ChartCategoryAxisItemNotesDataItemLabelBorder; + color?: string; + font?: string; + template?: any; + visible?: boolean; + rotation?: number; + format?: string; + text?: string; + position?: string; + } + + interface ChartCategoryAxisItemNotesDataItemLine { + width?: number; + color?: string; + length?: number; + } + + interface ChartCategoryAxisItemNotesDataItem { + value?: any; + position?: string; + icon?: ChartCategoryAxisItemNotesDataItemIcon; + label?: ChartCategoryAxisItemNotesDataItemLabel; + line?: ChartCategoryAxisItemNotesDataItemLine; + } + + interface ChartCategoryAxisItemNotesIconBorder { + color?: string; + width?: number; + } + + interface ChartCategoryAxisItemNotesIcon { + background?: string; + border?: ChartCategoryAxisItemNotesIconBorder; + size?: number; + type?: string; + visible?: boolean; + } + + interface ChartCategoryAxisItemNotesLabelBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface ChartCategoryAxisItemNotesLabel { + background?: string; + border?: ChartCategoryAxisItemNotesLabelBorder; + color?: string; + font?: string; + template?: any; + visible?: boolean; + rotation?: number; + format?: string; + position?: string; + } + + interface ChartCategoryAxisItemNotesLine { + width?: number; + color?: string; + length?: number; + } + + interface ChartCategoryAxisItemNotes { + position?: string; + icon?: ChartCategoryAxisItemNotesIcon; + label?: ChartCategoryAxisItemNotesLabel; + line?: ChartCategoryAxisItemNotesLine; + data?: ChartCategoryAxisItemNotesDataItem[]; + visual?: Function; + } + + interface ChartCategoryAxisItemPlotBand { + color?: string; + from?: number; + opacity?: number; + to?: number; + } + + interface ChartCategoryAxisItemSelectMousewheel { + reverse?: boolean; + zoom?: string; + } + + interface ChartCategoryAxisItemSelect { + from?: any; + max?: any; + min?: any; + mousewheel?: ChartCategoryAxisItemSelectMousewheel; + to?: any; + } + + interface ChartCategoryAxisItemTitleBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface ChartCategoryAxisItemTitleMargin { + bottom?: number; + left?: number; + right?: number; + top?: number; + } + + interface ChartCategoryAxisItemTitlePadding { + bottom?: number; + left?: number; + right?: number; + top?: number; + } + + interface ChartCategoryAxisItemTitle { + background?: string; + border?: ChartCategoryAxisItemTitleBorder; + color?: string; + font?: string; + margin?: ChartCategoryAxisItemTitleMargin; + padding?: ChartCategoryAxisItemTitlePadding; + position?: string; + rotation?: number; + text?: string; + visible?: boolean; + visual?: Function; + } + + interface ChartCategoryAxisItem { + autoBaseUnitSteps?: ChartCategoryAxisItemAutoBaseUnitSteps; + axisCrossingValue?: any; + background?: string; + baseUnit?: string; + baseUnitStep?: any; + categories?: any; + color?: string; + crosshair?: ChartCategoryAxisItemCrosshair; + field?: string; + justified?: boolean; + labels?: ChartCategoryAxisItemLabels; + line?: ChartCategoryAxisItemLine; + majorGridLines?: ChartCategoryAxisItemMajorGridLines; + majorTicks?: ChartCategoryAxisItemMajorTicks; + max?: any; + maxDateGroups?: number; + min?: any; + minorGridLines?: ChartCategoryAxisItemMinorGridLines; + minorTicks?: ChartCategoryAxisItemMinorTicks; + name?: string; + pane?: string; + plotBands?: ChartCategoryAxisItemPlotBand[]; + reverse?: boolean; + roundToBaseUnit?: boolean; + select?: ChartCategoryAxisItemSelect; + startAngle?: number; + title?: ChartCategoryAxisItemTitle; + type?: string; + visible?: boolean; + weekStartDay?: number; + notes?: ChartCategoryAxisItemNotes; + } + + interface ChartChartAreaBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface ChartChartAreaMargin { + bottom?: number; + left?: number; + right?: number; + top?: number; + } + + interface ChartChartArea { + background?: string; + border?: ChartChartAreaBorder; + height?: number; + margin?: ChartChartAreaMargin; + opacity?: number; + width?: number; + } + + interface ChartLegendBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface ChartLegendInactiveItemsLabels { + color?: string; + font?: string; + template?: any; + } + + interface ChartLegendInactiveItems { + labels?: ChartLegendInactiveItemsLabels; + } + + interface ChartLegendItem { + visual?: Function; + } + + interface ChartLegendLabelsMargin { + bottom?: number; + left?: number; + right?: number; + top?: number; + } + + interface ChartLegendLabelsPadding { + bottom?: number; + left?: number; + right?: number; + top?: number; + } + + interface ChartLegendLabels { + color?: string; + font?: string; + margin?: ChartLegendLabelsMargin; + padding?: ChartLegendLabelsPadding; + template?: any; + } + + interface ChartLegendMargin { + bottom?: number; + left?: number; + right?: number; + top?: number; + } + + interface ChartLegendPadding { + bottom?: number; + left?: number; + right?: number; + top?: number; + } + + interface ChartLegend { + align?: string; + background?: string; + border?: ChartLegendBorder; + height?: number; + inactiveItems?: ChartLegendInactiveItems; + item?: ChartLegendItem; + labels?: ChartLegendLabels; + margin?: ChartLegendMargin; + offsetX?: number; + offsetY?: number; + orientation?: string; + padding?: ChartLegendPadding; + position?: string; + reverse?: boolean; + visible?: boolean; + width?: number; + } + + interface ChartPaneBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface ChartPaneMargin { + bottom?: number; + left?: number; + right?: number; + top?: number; + } + + interface ChartPanePadding { + bottom?: number; + left?: number; + right?: number; + top?: number; + } + + interface ChartPaneTitleBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface ChartPaneTitleMargin { + bottom?: number; + left?: number; + right?: number; + top?: number; + } + + interface ChartPaneTitle { + background?: string; + border?: ChartPaneTitleBorder; + color?: string; + font?: string; + margin?: ChartPaneTitleMargin; + position?: string; + text?: string; + visible?: boolean; + visual?: Function; + } + + interface ChartPane { + background?: string; + border?: ChartPaneBorder; + clip?: boolean; + height?: number; + margin?: ChartPaneMargin; + name?: string; + padding?: ChartPanePadding; + title?: ChartPaneTitle; + } + + interface ChartPdfMargin { + bottom?: any; + left?: any; + right?: any; + top?: any; + } + + interface ChartPdf { + author?: string; + creator?: string; + date?: Date; + forceProxy?: boolean; + fileName?: string; + keywords?: string; + landscape?: boolean; + margin?: ChartPdfMargin; + paperSize?: any; + proxyURL?: string; + proxyTarget?: string; + subject?: string; + title?: string; + } + + interface ChartPlotAreaBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface ChartPlotAreaMargin { + bottom?: number; + left?: number; + right?: number; + top?: number; + } + + interface ChartPlotAreaPadding { + bottom?: number; + left?: number; + right?: number; + top?: number; + } + + interface ChartPlotArea { + background?: string; + border?: ChartPlotAreaBorder; + margin?: ChartPlotAreaMargin; + opacity?: number; + padding?: ChartPlotAreaPadding; + } + + interface ChartSeriesItemBorder { + color?: any; + dashType?: any; + opacity?: any; + width?: any; + } + + interface ChartSeriesItemConnectors { + color?: string; + padding?: number; + width?: number; + } + + interface ChartSeriesItemErrorBarsLine { + width?: number; + dashType?: string; + } + + interface ChartSeriesItemErrorBars { + value?: any; + visual?: Function; + xValue?: any; + yValue?: any; + endCaps?: boolean; + color?: string; + line?: ChartSeriesItemErrorBarsLine; + } + + interface ChartSeriesItemExtremesBorder { + color?: any; + width?: any; + } + + interface ChartSeriesItemExtremes { + background?: any; + border?: ChartSeriesItemExtremesBorder; + size?: any; + type?: any; + rotation?: any; + } + + interface ChartSeriesItemHighlightBorder { + color?: string; + opacity?: number; + width?: number; + } + + interface ChartSeriesItemHighlightLine { + color?: string; + opacity?: number; + width?: number; + } + + interface ChartSeriesItemHighlight { + border?: ChartSeriesItemHighlightBorder; + color?: string; + line?: ChartSeriesItemHighlightLine; + opacity?: number; + toggle?: Function; + visible?: boolean; + visual?: Function; + } + + interface ChartSeriesItemLabelsBorder { + color?: any; + dashType?: any; + width?: any; + } + + interface ChartSeriesItemLabelsFromBorder { + color?: any; + dashType?: any; + width?: any; + } + + interface ChartSeriesItemLabelsFromMargin { + bottom?: number; + left?: number; + right?: number; + top?: number; + } + + interface ChartSeriesItemLabelsFromPadding { + bottom?: number; + left?: number; + right?: number; + top?: number; + } + + interface ChartSeriesItemLabelsFrom { + background?: any; + border?: ChartSeriesItemLabelsFromBorder; + color?: any; + font?: any; + format?: any; + margin?: ChartSeriesItemLabelsFromMargin; + padding?: ChartSeriesItemLabelsFromPadding; + position?: any; + template?: any; + visible?: any; + } + + interface ChartSeriesItemLabelsMargin { + bottom?: number; + left?: number; + right?: number; + top?: number; + } + + interface ChartSeriesItemLabelsPadding { + bottom?: number; + left?: number; + right?: number; + top?: number; + } + + interface ChartSeriesItemLabelsToBorder { + color?: any; + dashType?: any; + width?: any; + } + + interface ChartSeriesItemLabelsToMargin { + bottom?: number; + left?: number; + right?: number; + top?: number; + } + + interface ChartSeriesItemLabelsToPadding { + bottom?: number; + left?: number; + right?: number; + top?: number; + } + + interface ChartSeriesItemLabelsTo { + background?: any; + border?: ChartSeriesItemLabelsToBorder; + color?: any; + font?: any; + format?: any; + margin?: ChartSeriesItemLabelsToMargin; + padding?: ChartSeriesItemLabelsToPadding; + position?: any; + template?: any; + visible?: any; + } + + interface ChartSeriesItemLabels { + align?: string; + background?: any; + border?: ChartSeriesItemLabelsBorder; + color?: any; + distance?: number; + font?: any; + format?: any; + margin?: ChartSeriesItemLabelsMargin; + padding?: ChartSeriesItemLabelsPadding; + position?: any; + template?: any; + visible?: any; + visual?: Function; + from?: ChartSeriesItemLabelsFrom; + to?: ChartSeriesItemLabelsTo; + } + + interface ChartSeriesItemLine { + color?: string; + opacity?: number; + width?: string; + style?: string; + } + + interface ChartSeriesItemMargin { + bottom?: number; + left?: number; + right?: number; + top?: number; + } + + interface ChartSeriesItemMarkersBorder { + color?: any; + width?: any; + } + + interface ChartSeriesItemMarkers { + background?: any; + border?: ChartSeriesItemMarkersBorder; + size?: any; + type?: any; + visible?: any; + visual?: Function; + rotation?: any; + } + + interface ChartSeriesItemNegativeValues { + color?: string; + visible?: boolean; + } + + interface ChartSeriesItemNotesIconBorder { + color?: string; + width?: number; + } + + interface ChartSeriesItemNotesIcon { + background?: string; + border?: ChartSeriesItemNotesIconBorder; + size?: number; + type?: string; + visible?: boolean; + } + + interface ChartSeriesItemNotesLabelBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface ChartSeriesItemNotesLabel { + background?: string; + border?: ChartSeriesItemNotesLabelBorder; + color?: string; + font?: string; + template?: any; + visible?: boolean; + rotation?: number; + format?: string; + position?: string; + } + + interface ChartSeriesItemNotesLine { + width?: number; + color?: string; + length?: number; + } + + interface ChartSeriesItemNotes { + position?: string; + icon?: ChartSeriesItemNotesIcon; + label?: ChartSeriesItemNotesLabel; + line?: ChartSeriesItemNotesLine; + visual?: Function; + } + + interface ChartSeriesItemOutliersBorder { + color?: any; + width?: any; + } + + interface ChartSeriesItemOutliers { + background?: any; + border?: ChartSeriesItemOutliersBorder; + size?: any; + type?: any; + rotation?: any; + } + + interface ChartSeriesItemOverlay { + gradient?: string; + } + + interface ChartSeriesItemStack { + type?: string; + group?: string; + } + + interface ChartSeriesItemTargetBorder { + color?: any; + dashType?: any; + width?: any; + } + + interface ChartSeriesItemTargetLine { + width?: any; + } + + interface ChartSeriesItemTarget { + border?: ChartSeriesItemTargetBorder; + color?: any; + line?: ChartSeriesItemTargetLine; + } + + interface ChartSeriesItemTooltipBorder { + color?: string; + width?: number; + } + + interface ChartSeriesItemTooltipPadding { + bottom?: number; + left?: number; + right?: number; + top?: number; + } + + interface ChartSeriesItemTooltip { + background?: string; + border?: ChartSeriesItemTooltipBorder; + color?: string; + font?: string; + format?: string; + padding?: ChartSeriesItemTooltipPadding; + template?: any; + visible?: boolean; + } + + interface ChartSeriesItem { + aggregate?: any; + axis?: string; + border?: ChartSeriesItemBorder; + categoryField?: string; + closeField?: string; + color?: any; + colorField?: string; + connectors?: ChartSeriesItemConnectors; + currentField?: string; + dashType?: string; + data?: any; + downColor?: any; + downColorField?: string; + segmentSpacing?: number; + summaryField?: string; + neckRatio?: number; + dynamicSlope?: boolean; + dynamicHeight?: boolean; + errorBars?: ChartSeriesItemErrorBars; + errorLowField?: string; + errorHighField?: string; + xErrorLowField?: string; + xErrorHighField?: string; + yErrorLowField?: string; + yErrorHighField?: string; + explodeField?: string; + field?: string; + fromField?: string; + toField?: string; + noteTextField?: string; + lowerField?: string; + q1Field?: string; + medianField?: string; + q3Field?: string; + upperField?: string; + meanField?: string; + outliersField?: string; + gap?: number; + highField?: string; + highlight?: ChartSeriesItemHighlight; + holeSize?: number; + labels?: ChartSeriesItemLabels; + line?: ChartSeriesItemLine; + lowField?: string; + margin?: ChartSeriesItemMargin; + markers?: ChartSeriesItemMarkers; + outliers?: ChartSeriesItemOutliers; + extremes?: ChartSeriesItemExtremes; + maxSize?: number; + minSize?: number; + missingValues?: string; + style?: string; + name?: string; + negativeColor?: string; + negativeValues?: ChartSeriesItemNegativeValues; + opacity?: number; + openField?: string; + overlay?: ChartSeriesItemOverlay; + padding?: number; + size?: number; + sizeField?: string; + spacing?: number; + stack?: ChartSeriesItemStack; + startAngle?: number; + target?: ChartSeriesItemTarget; + targetField?: string; + tooltip?: ChartSeriesItemTooltip; + type?: string; + visible?: boolean; + visibleInLegend?: boolean; + visibleInLegendField?: string; + visual?: Function; + width?: number; + xAxis?: string; + xField?: string; + yAxis?: string; + yField?: string; + notes?: ChartSeriesItemNotes; + zIndex?: number; + } + + interface ChartSeriesDefaultsBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface ChartSeriesDefaultsLabelsBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface ChartSeriesDefaultsLabelsFromBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface ChartSeriesDefaultsLabelsFromMargin { + bottom?: number; + left?: number; + right?: number; + top?: number; + } + + interface ChartSeriesDefaultsLabelsFromPadding { + bottom?: number; + left?: number; + right?: number; + top?: number; + } + + interface ChartSeriesDefaultsLabelsFrom { + background?: string; + border?: ChartSeriesDefaultsLabelsFromBorder; + color?: string; + font?: string; + format?: string; + margin?: ChartSeriesDefaultsLabelsFromMargin; + padding?: ChartSeriesDefaultsLabelsFromPadding; + template?: any; + visible?: boolean; + } + + interface ChartSeriesDefaultsLabelsMargin { + bottom?: number; + left?: number; + right?: number; + top?: number; + } + + interface ChartSeriesDefaultsLabelsPadding { + bottom?: number; + left?: number; + right?: number; + top?: number; + } + + interface ChartSeriesDefaultsLabelsToBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface ChartSeriesDefaultsLabelsToMargin { + bottom?: number; + left?: number; + right?: number; + top?: number; + } + + interface ChartSeriesDefaultsLabelsToPadding { + bottom?: number; + left?: number; + right?: number; + top?: number; + } + + interface ChartSeriesDefaultsLabelsTo { + background?: string; + border?: ChartSeriesDefaultsLabelsToBorder; + color?: string; + font?: string; + format?: string; + margin?: ChartSeriesDefaultsLabelsToMargin; + padding?: ChartSeriesDefaultsLabelsToPadding; + template?: any; + visible?: boolean; + } + + interface ChartSeriesDefaultsLabels { + background?: string; + border?: ChartSeriesDefaultsLabelsBorder; + color?: string; + font?: string; + format?: string; + margin?: ChartSeriesDefaultsLabelsMargin; + padding?: ChartSeriesDefaultsLabelsPadding; + template?: any; + visible?: boolean; + visual?: Function; + from?: ChartSeriesDefaultsLabelsFrom; + to?: ChartSeriesDefaultsLabelsTo; + } + + interface ChartSeriesDefaultsNotesIconBorder { + color?: string; + width?: number; + } + + interface ChartSeriesDefaultsNotesIcon { + background?: string; + border?: ChartSeriesDefaultsNotesIconBorder; + size?: number; + type?: string; + visible?: boolean; + } + + interface ChartSeriesDefaultsNotesLabelBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface ChartSeriesDefaultsNotesLabel { + background?: string; + border?: ChartSeriesDefaultsNotesLabelBorder; + color?: string; + font?: string; + template?: any; + visible?: boolean; + rotation?: number; + format?: string; + position?: string; + } + + interface ChartSeriesDefaultsNotesLine { + width?: number; + color?: string; + length?: number; + } + + interface ChartSeriesDefaultsNotes { + icon?: ChartSeriesDefaultsNotesIcon; + label?: ChartSeriesDefaultsNotesLabel; + line?: ChartSeriesDefaultsNotesLine; + visual?: Function; + } + + interface ChartSeriesDefaultsOverlay { + gradient?: string; + } + + interface ChartSeriesDefaultsStack { + type?: string; + } + + interface ChartSeriesDefaultsTooltipBorder { + color?: string; + width?: number; + } + + interface ChartSeriesDefaultsTooltipPadding { + bottom?: number; + left?: number; + right?: number; + top?: number; + } + + interface ChartSeriesDefaultsTooltip { + background?: string; + border?: ChartSeriesDefaultsTooltipBorder; + color?: string; + font?: string; + format?: string; + padding?: ChartSeriesDefaultsTooltipPadding; + template?: any; + visible?: boolean; + } + + interface ChartSeriesDefaults { + area?: any; + bar?: any; + border?: ChartSeriesDefaultsBorder; + bubble?: any; + candlestick?: any; + column?: any; + donut?: any; + gap?: number; + labels?: ChartSeriesDefaultsLabels; + line?: any; + ohlc?: any; + overlay?: ChartSeriesDefaultsOverlay; + pie?: any; + scatter?: any; + scatterLine?: any; + spacing?: number; + stack?: ChartSeriesDefaultsStack; + type?: string; + tooltip?: ChartSeriesDefaultsTooltip; + verticalArea?: any; + verticalLine?: any; + visual?: Function; + notes?: ChartSeriesDefaultsNotes; + } + + interface ChartTitleBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface ChartTitleMargin { + bottom?: number; + left?: number; + right?: number; + top?: number; + } + + interface ChartTitlePadding { + bottom?: number; + left?: number; + right?: number; + top?: number; + } + + interface ChartTitle { + align?: string; + background?: string; + border?: ChartTitleBorder; + color?: string; + font?: string; + margin?: ChartTitleMargin; + padding?: ChartTitlePadding; + position?: string; + text?: string; + visible?: boolean; + } + + interface ChartTooltipBorder { + color?: string; + width?: number; + } + + interface ChartTooltipPadding { + bottom?: number; + left?: number; + right?: number; + top?: number; + } + + interface ChartTooltip { + background?: string; + border?: ChartTooltipBorder; + color?: string; + font?: string; + format?: string; + padding?: ChartTooltipPadding; + shared?: boolean; + sharedTemplate?: any; + template?: any; + visible?: boolean; + } + + interface ChartValueAxisItemCrosshairTooltipBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface ChartValueAxisItemCrosshairTooltipPadding { + bottom?: number; + left?: number; + right?: number; + top?: number; + } + + interface ChartValueAxisItemCrosshairTooltip { + background?: string; + border?: ChartValueAxisItemCrosshairTooltipBorder; + color?: string; + font?: string; + format?: string; + padding?: ChartValueAxisItemCrosshairTooltipPadding; + template?: any; + visible?: boolean; + } + + interface ChartValueAxisItemCrosshair { + color?: string; + opacity?: number; + tooltip?: ChartValueAxisItemCrosshairTooltip; + visible?: boolean; + width?: number; + } + + interface ChartValueAxisItemLabelsBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface ChartValueAxisItemLabelsMargin { + bottom?: number; + left?: number; + right?: number; + top?: number; + } + + interface ChartValueAxisItemLabelsPadding { + bottom?: number; + left?: number; + right?: number; + top?: number; + } + + interface ChartValueAxisItemLabels { + background?: string; + border?: ChartValueAxisItemLabelsBorder; + color?: string; + font?: string; + format?: string; + margin?: ChartValueAxisItemLabelsMargin; + mirror?: boolean; + padding?: ChartValueAxisItemLabelsPadding; + rotation?: number; + skip?: number; + step?: number; + template?: any; + visible?: boolean; + visual?: Function; + } + + interface ChartValueAxisItemLine { + color?: string; + dashType?: string; + visible?: boolean; + width?: number; + } + + interface ChartValueAxisItemMajorGridLines { + color?: string; + dashType?: string; + type?: string; + visible?: boolean; + width?: number; + step?: number; + skip?: number; + } + + interface ChartValueAxisItemMajorTicks { + color?: string; + size?: number; + visible?: boolean; + step?: number; + skip?: number; + } + + interface ChartValueAxisItemMinorGridLines { + color?: string; + dashType?: string; + type?: string; + visible?: boolean; + width?: number; + step?: number; + skip?: number; + } + + interface ChartValueAxisItemMinorTicks { + color?: string; + size?: number; + visible?: boolean; + width?: number; + step?: number; + skip?: number; + } + + interface ChartValueAxisItemNotesDataItemIconBorder { + color?: string; + width?: number; + } + + interface ChartValueAxisItemNotesDataItemIcon { + background?: string; + border?: ChartValueAxisItemNotesDataItemIconBorder; + size?: number; + type?: string; + visible?: boolean; + } + + interface ChartValueAxisItemNotesDataItemLabelBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface ChartValueAxisItemNotesDataItemLabel { + background?: string; + border?: ChartValueAxisItemNotesDataItemLabelBorder; + color?: string; + font?: string; + template?: any; + visible?: boolean; + rotation?: number; + format?: string; + text?: string; + position?: string; + } + + interface ChartValueAxisItemNotesDataItemLine { + width?: number; + color?: string; + length?: number; + } + + interface ChartValueAxisItemNotesDataItem { + value?: any; + position?: string; + icon?: ChartValueAxisItemNotesDataItemIcon; + label?: ChartValueAxisItemNotesDataItemLabel; + line?: ChartValueAxisItemNotesDataItemLine; + } + + interface ChartValueAxisItemNotesIconBorder { + color?: string; + width?: number; + } + + interface ChartValueAxisItemNotesIcon { + background?: string; + border?: ChartValueAxisItemNotesIconBorder; + size?: number; + type?: string; + visible?: boolean; + } + + interface ChartValueAxisItemNotesLabelBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface ChartValueAxisItemNotesLabel { + background?: string; + border?: ChartValueAxisItemNotesLabelBorder; + color?: string; + font?: string; + template?: any; + visible?: boolean; + rotation?: number; + format?: string; + position?: string; + } + + interface ChartValueAxisItemNotesLine { + width?: number; + color?: string; + length?: number; + } + + interface ChartValueAxisItemNotes { + position?: string; + icon?: ChartValueAxisItemNotesIcon; + label?: ChartValueAxisItemNotesLabel; + line?: ChartValueAxisItemNotesLine; + data?: ChartValueAxisItemNotesDataItem[]; + visual?: Function; + } + + interface ChartValueAxisItemPlotBand { + color?: string; + from?: number; + opacity?: number; + to?: number; + } + + interface ChartValueAxisItemTitleBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface ChartValueAxisItemTitleMargin { + bottom?: number; + left?: number; + right?: number; + top?: number; + } + + interface ChartValueAxisItemTitlePadding { + bottom?: number; + left?: number; + right?: number; + top?: number; + } + + interface ChartValueAxisItemTitle { + background?: string; + border?: ChartValueAxisItemTitleBorder; + color?: string; + font?: string; + margin?: ChartValueAxisItemTitleMargin; + padding?: ChartValueAxisItemTitlePadding; + position?: string; + rotation?: number; + text?: string; + visible?: boolean; + visual?: Function; + } + + interface ChartValueAxisItem { + axisCrossingValue?: any; + background?: string; + color?: string; + crosshair?: ChartValueAxisItemCrosshair; + labels?: ChartValueAxisItemLabels; + line?: ChartValueAxisItemLine; + majorGridLines?: ChartValueAxisItemMajorGridLines; + majorUnit?: number; + max?: number; + min?: number; + minorGridLines?: ChartValueAxisItemMinorGridLines; + majorTicks?: ChartValueAxisItemMajorTicks; + minorTicks?: ChartValueAxisItemMinorTicks; + minorUnit?: number; + name?: any; + narrowRange?: boolean; + pane?: string; + plotBands?: ChartValueAxisItemPlotBand[]; + reverse?: boolean; + title?: ChartValueAxisItemTitle; + type?: string; + visible?: boolean; + notes?: ChartValueAxisItemNotes; + } + + interface ChartXAxisItemCrosshairTooltipBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface ChartXAxisItemCrosshairTooltipPadding { + bottom?: number; + left?: number; + right?: number; + top?: number; + } + + interface ChartXAxisItemCrosshairTooltip { + background?: string; + border?: ChartXAxisItemCrosshairTooltipBorder; + color?: string; + font?: string; + format?: string; + padding?: ChartXAxisItemCrosshairTooltipPadding; + template?: any; + visible?: boolean; + } + + interface ChartXAxisItemCrosshair { + color?: string; + opacity?: number; + tooltip?: ChartXAxisItemCrosshairTooltip; + visible?: boolean; + width?: number; + } + + interface ChartXAxisItemLabelsBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface ChartXAxisItemLabelsDateFormats { + days?: string; + hours?: string; + months?: string; + weeks?: string; + years?: string; + } + + interface ChartXAxisItemLabelsMargin { + bottom?: number; + left?: number; + right?: number; + top?: number; + } + + interface ChartXAxisItemLabelsPadding { + bottom?: number; + left?: number; + right?: number; + top?: number; + } + + interface ChartXAxisItemLabels { + background?: string; + border?: ChartXAxisItemLabelsBorder; + color?: string; + culture?: string; + dateFormats?: ChartXAxisItemLabelsDateFormats; + font?: string; + format?: string; + margin?: ChartXAxisItemLabelsMargin; + mirror?: boolean; + padding?: ChartXAxisItemLabelsPadding; + rotation?: number; + skip?: number; + step?: number; + template?: any; + visible?: boolean; + visual?: Function; + } + + interface ChartXAxisItemLine { + color?: string; + dashType?: string; + visible?: boolean; + width?: number; + } + + interface ChartXAxisItemMajorGridLines { + color?: string; + dashType?: string; + visible?: boolean; + width?: number; + step?: number; + skip?: number; + } + + interface ChartXAxisItemMajorTicks { + color?: string; + size?: number; + visible?: boolean; + width?: number; + step?: number; + skip?: number; + } + + interface ChartXAxisItemMinorGridLines { + color?: string; + dashType?: string; + visible?: boolean; + width?: number; + step?: number; + skip?: number; + } + + interface ChartXAxisItemMinorTicks { + color?: string; + size?: number; + visible?: boolean; + width?: number; + step?: number; + skip?: number; + } + + interface ChartXAxisItemNotesDataItemIconBorder { + color?: string; + width?: number; + } + + interface ChartXAxisItemNotesDataItemIcon { + background?: string; + border?: ChartXAxisItemNotesDataItemIconBorder; + size?: number; + type?: string; + visible?: boolean; + } + + interface ChartXAxisItemNotesDataItemLabelBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface ChartXAxisItemNotesDataItemLabel { + background?: string; + border?: ChartXAxisItemNotesDataItemLabelBorder; + color?: string; + font?: string; + template?: any; + visible?: boolean; + rotation?: number; + format?: string; + text?: string; + position?: string; + } + + interface ChartXAxisItemNotesDataItemLine { + width?: number; + color?: string; + length?: number; + } + + interface ChartXAxisItemNotesDataItem { + value?: any; + position?: string; + icon?: ChartXAxisItemNotesDataItemIcon; + label?: ChartXAxisItemNotesDataItemLabel; + line?: ChartXAxisItemNotesDataItemLine; + } + + interface ChartXAxisItemNotesIconBorder { + color?: string; + width?: number; + } + + interface ChartXAxisItemNotesIcon { + background?: string; + border?: ChartXAxisItemNotesIconBorder; + size?: number; + type?: string; + visible?: boolean; + } + + interface ChartXAxisItemNotesLabelBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface ChartXAxisItemNotesLabel { + background?: string; + border?: ChartXAxisItemNotesLabelBorder; + color?: string; + font?: string; + template?: any; + visible?: boolean; + rotation?: number; + format?: string; + position?: string; + } + + interface ChartXAxisItemNotesLine { + width?: number; + color?: string; + length?: number; + } + + interface ChartXAxisItemNotes { + position?: string; + icon?: ChartXAxisItemNotesIcon; + label?: ChartXAxisItemNotesLabel; + line?: ChartXAxisItemNotesLine; + data?: ChartXAxisItemNotesDataItem[]; + visual?: Function; + } + + interface ChartXAxisItemPlotBand { + color?: string; + from?: number; + opacity?: number; + to?: number; + } + + interface ChartXAxisItemTitleBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface ChartXAxisItemTitleMargin { + bottom?: number; + left?: number; + right?: number; + top?: number; + } + + interface ChartXAxisItemTitlePadding { + bottom?: number; + left?: number; + right?: number; + top?: number; + } + + interface ChartXAxisItemTitle { + background?: string; + border?: ChartXAxisItemTitleBorder; + color?: string; + font?: string; + margin?: ChartXAxisItemTitleMargin; + padding?: ChartXAxisItemTitlePadding; + position?: string; + rotation?: number; + text?: string; + visible?: boolean; + visual?: Function; + } + + interface ChartXAxisItem { + axisCrossingValue?: any; + background?: string; + baseUnit?: string; + color?: string; + crosshair?: ChartXAxisItemCrosshair; + labels?: ChartXAxisItemLabels; + line?: ChartXAxisItemLine; + majorGridLines?: ChartXAxisItemMajorGridLines; + minorGridLines?: ChartXAxisItemMinorGridLines; + minorTicks?: ChartXAxisItemMinorTicks; + majorTicks?: ChartXAxisItemMajorTicks; + majorUnit?: number; + max?: any; + min?: any; + minorUnit?: number; + name?: any; + narrowRange?: boolean; + pane?: string; + plotBands?: ChartXAxisItemPlotBand[]; + reverse?: boolean; + startAngle?: number; + title?: ChartXAxisItemTitle; + type?: string; + visible?: boolean; + notes?: ChartXAxisItemNotes; + } + + interface ChartYAxisItemCrosshairTooltipBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface ChartYAxisItemCrosshairTooltipPadding { + bottom?: number; + left?: number; + right?: number; + top?: number; + } + + interface ChartYAxisItemCrosshairTooltip { + background?: string; + border?: ChartYAxisItemCrosshairTooltipBorder; + color?: string; + font?: string; + format?: string; + padding?: ChartYAxisItemCrosshairTooltipPadding; + template?: any; + visible?: boolean; + } + + interface ChartYAxisItemCrosshair { + color?: string; + opacity?: number; + tooltip?: ChartYAxisItemCrosshairTooltip; + visible?: boolean; + width?: number; + } + + interface ChartYAxisItemLabelsBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface ChartYAxisItemLabelsDateFormats { + days?: string; + hours?: string; + months?: string; + weeks?: string; + years?: string; + } + + interface ChartYAxisItemLabelsMargin { + bottom?: number; + left?: number; + right?: number; + top?: number; + } + + interface ChartYAxisItemLabelsPadding { + bottom?: number; + left?: number; + right?: number; + top?: number; + } + + interface ChartYAxisItemLabels { + background?: string; + border?: ChartYAxisItemLabelsBorder; + color?: string; + culture?: string; + dateFormats?: ChartYAxisItemLabelsDateFormats; + font?: string; + format?: string; + margin?: ChartYAxisItemLabelsMargin; + mirror?: boolean; + padding?: ChartYAxisItemLabelsPadding; + rotation?: number; + skip?: number; + step?: number; + template?: any; + visible?: boolean; + visual?: Function; + } + + interface ChartYAxisItemLine { + color?: string; + dashType?: string; + visible?: boolean; + width?: number; + } + + interface ChartYAxisItemMajorGridLines { + color?: string; + dashType?: string; + visible?: boolean; + width?: number; + step?: number; + skip?: number; + } + + interface ChartYAxisItemMajorTicks { + color?: string; + size?: number; + visible?: boolean; + width?: number; + step?: number; + skip?: number; + } + + interface ChartYAxisItemMinorGridLines { + color?: string; + dashType?: string; + visible?: boolean; + width?: number; + step?: number; + skip?: number; + } + + interface ChartYAxisItemMinorTicks { + color?: string; + size?: number; + visible?: boolean; + width?: number; + step?: number; + skip?: number; + } + + interface ChartYAxisItemNotesDataItemIconBorder { + color?: string; + width?: number; + } + + interface ChartYAxisItemNotesDataItemIcon { + background?: string; + border?: ChartYAxisItemNotesDataItemIconBorder; + size?: number; + type?: string; + visible?: boolean; + } + + interface ChartYAxisItemNotesDataItemLabelBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface ChartYAxisItemNotesDataItemLabel { + background?: string; + border?: ChartYAxisItemNotesDataItemLabelBorder; + color?: string; + font?: string; + template?: any; + visible?: boolean; + rotation?: number; + format?: string; + text?: string; + position?: string; + } + + interface ChartYAxisItemNotesDataItemLine { + width?: number; + color?: string; + length?: number; + } + + interface ChartYAxisItemNotesDataItem { + value?: any; + position?: string; + icon?: ChartYAxisItemNotesDataItemIcon; + label?: ChartYAxisItemNotesDataItemLabel; + line?: ChartYAxisItemNotesDataItemLine; + } + + interface ChartYAxisItemNotesIconBorder { + color?: string; + width?: number; + } + + interface ChartYAxisItemNotesIcon { + background?: string; + border?: ChartYAxisItemNotesIconBorder; + size?: number; + type?: string; + visible?: boolean; + } + + interface ChartYAxisItemNotesLabelBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface ChartYAxisItemNotesLabel { + background?: string; + border?: ChartYAxisItemNotesLabelBorder; + color?: string; + font?: string; + template?: any; + visible?: boolean; + rotation?: number; + format?: string; + position?: string; + } + + interface ChartYAxisItemNotesLine { + width?: number; + color?: string; + length?: number; + } + + interface ChartYAxisItemNotes { + position?: string; + icon?: ChartYAxisItemNotesIcon; + label?: ChartYAxisItemNotesLabel; + line?: ChartYAxisItemNotesLine; + data?: ChartYAxisItemNotesDataItem[]; + visual?: Function; + } + + interface ChartYAxisItemPlotBand { + color?: string; + from?: number; + opacity?: number; + to?: number; + } + + interface ChartYAxisItemTitleBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface ChartYAxisItemTitleMargin { + bottom?: number; + left?: number; + right?: number; + top?: number; + } + + interface ChartYAxisItemTitlePadding { + bottom?: number; + left?: number; + right?: number; + top?: number; + } + + interface ChartYAxisItemTitle { + background?: string; + border?: ChartYAxisItemTitleBorder; + color?: string; + font?: string; + margin?: ChartYAxisItemTitleMargin; + padding?: ChartYAxisItemTitlePadding; + position?: string; + rotation?: number; + text?: string; + visible?: boolean; + visual?: Function; + } + + interface ChartYAxisItem { + axisCrossingValue?: any; + background?: string; + baseUnit?: string; + color?: string; + crosshair?: ChartYAxisItemCrosshair; + labels?: ChartYAxisItemLabels; + line?: ChartYAxisItemLine; + majorGridLines?: ChartYAxisItemMajorGridLines; + minorGridLines?: ChartYAxisItemMinorGridLines; + minorTicks?: ChartYAxisItemMinorTicks; + majorTicks?: ChartYAxisItemMajorTicks; + majorUnit?: number; + max?: any; + min?: any; + minorUnit?: number; + name?: any; + narrowRange?: boolean; + pane?: string; + plotBands?: ChartYAxisItemPlotBand[]; + reverse?: boolean; + title?: ChartYAxisItemTitle; + type?: string; + visible?: boolean; + notes?: ChartYAxisItemNotes; + } + + interface ChartExportImageOptions { + width?: string; + height?: string; + } + + interface ChartExportSVGOptions { + raw?: boolean; + } + + interface ChartToggleHighlightOptions { + series?: string; + category?: string; + } + + interface ChartSeriesClickEventSeries { + type?: any; + name?: any; + data?: any; + } + + interface ChartSeriesHoverEventSeries { + type?: any; + name?: any; + data?: any; + } + + interface ChartOptions { + name?: string; + autoBind?: boolean; + axisDefaults?: any; + categoryAxis?: ChartCategoryAxisItem[]; + chartArea?: ChartChartArea; + dataSource?: any; + legend?: ChartLegend; + panes?: ChartPane[]; + pdf?: ChartPdf; + plotArea?: ChartPlotArea; + renderAs?: string; + series?: ChartSeriesItem[]; + seriesColors?: any; + seriesDefaults?: ChartSeriesDefaults; + theme?: string; + title?: ChartTitle; + tooltip?: ChartTooltip; + transitions?: boolean; + valueAxis?: ChartValueAxisItem[]; + xAxis?: ChartXAxisItem[]; + yAxis?: ChartYAxisItem[]; + axisLabelClick?(e: ChartAxisLabelClickEvent): void; + legendItemClick?(e: ChartLegendItemClickEvent): void; + legendItemHover?(e: ChartLegendItemHoverEvent): void; + dataBound?(e: ChartDataBoundEvent): void; + drag?(e: ChartDragEvent): void; + dragEnd?(e: ChartDragEndEvent): void; + dragStart?(e: ChartDragStartEvent): void; + noteClick?(e: ChartNoteClickEvent): void; + noteHover?(e: ChartNoteHoverEvent): void; + plotAreaClick?(e: ChartPlotAreaClickEvent): void; + render?(e: ChartEvent): void; + select?(e: ChartSelectEvent): void; + selectEnd?(e: ChartSelectEndEvent): void; + selectStart?(e: ChartSelectStartEvent): void; + seriesClick?(e: ChartSeriesClickEvent): void; + seriesHover?(e: ChartSeriesHoverEvent): void; + zoom?(e: ChartZoomEvent): void; + zoomEnd?(e: ChartZoomEndEvent): void; + zoomStart?(e: ChartZoomStartEvent): void; + } + interface ChartEvent { + sender: Chart; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + interface ChartAxisLabelClickEvent extends ChartEvent { + axis?: any; + dataItem?: any; + element?: any; + index?: any; + text?: string; + value?: any; + } + + interface ChartLegendItemClickEvent extends ChartEvent { + text?: string; + series?: any; + seriesIndex?: number; + pointIndex?: number; + element?: any; + } + + interface ChartLegendItemHoverEvent extends ChartEvent { + text?: string; + series?: any; + seriesIndex?: number; + pointIndex?: number; + element?: any; + } + + interface ChartDataBoundEvent extends ChartEvent { + } + + interface ChartDragEvent extends ChartEvent { + axisRanges?: any; + originalEvent?: any; + } + + interface ChartDragEndEvent extends ChartEvent { + axisRanges?: any; + originalEvent?: any; + } + + interface ChartDragStartEvent extends ChartEvent { + axisRanges?: any; + originalEvent?: any; + } + + interface ChartNoteClickEvent extends ChartEvent { + category?: any; + element?: any; + value?: any; + series?: any; + dataItem?: any; + } + + interface ChartNoteHoverEvent extends ChartEvent { + category?: any; + element?: any; + value?: any; + series?: any; + dataItem?: any; + } + + interface ChartPlotAreaClickEvent extends ChartEvent { + category?: any; + element?: any; + originalEvent?: any; + value?: any; + x?: any; + y?: any; + } + + interface ChartSelectEvent extends ChartEvent { + axis?: any; + from?: any; + to?: any; + } + + interface ChartSelectEndEvent extends ChartEvent { + axis?: any; + from?: any; + to?: any; + } + + interface ChartSelectStartEvent extends ChartEvent { + axis?: any; + from?: any; + to?: any; + } + + interface ChartSeriesClickEvent extends ChartEvent { + category?: any; + element?: any; + originalEvent?: any; + series?: ChartSeriesClickEventSeries; + dataItem?: any; + value?: any; + percentage?: any; + } + + interface ChartSeriesHoverEvent extends ChartEvent { + category?: any; + categoryPoints?: any; + element?: any; + originalEvent?: any; + series?: ChartSeriesHoverEventSeries; + dataItem?: any; + value?: any; + percentage?: any; + } + + interface ChartZoomEvent extends ChartEvent { + axisRanges?: any; + delta?: number; + originalEvent?: any; + } + + interface ChartZoomEndEvent extends ChartEvent { + axisRanges?: any; + originalEvent?: any; + } + + interface ChartZoomStartEvent extends ChartEvent { + axisRanges?: any; + originalEvent?: any; + } + + + class Diagram extends kendo.ui.Widget { + static fn: Diagram; + static extend(proto: Object): Diagram; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: DiagramOptions); + options: DiagramOptions; + dataSource: kendo.data.DataSource; + addConnection(connection: any, undoable: boolean): void; + addShape(obj: any, undoable: boolean): kendo.dataviz.diagram.Shape; + alignShapes(direction: string): void; + boundingBox(items: any): kendo.dataviz.diagram.Rect; + bringIntoView(obj: any, options: any): void; + cancelEdit(): void; + clear(): void; + connect(source: any, target: any, options: any): void; + connected(source: any, target: any): void; + copy(): void; + createConnection(item: any): void; + createShape(item: any): void; + cut(): void; + destroy(): void; + documentToModel(point: any): any; + documentToView(point: any): any; + edit(item: any): void; + exportImage(options: any): JQueryPromise; + exportPDF(options?: kendo.drawing.PDFOptions): JQueryPromise; + exportSVG(options: any): JQueryPromise; + focus(): void; + getShapeById(id: string): any; + layerToModel(point: any): any; + layout(options: any): void; + load(json: string): void; + modelToDocument(point: any): any; + modelToLayer(point: any): any; + modelToView(point: any): any; + pan(pan: any): void; + paste(): void; + redo(): void; + remove(items: any, undoable: boolean): void; + resize(): void; + save(): void; + saveEdit(): void; + select(): any; + select(elements: kendo.dataviz.diagram.Connection, options: any): void; + select(elements: kendo.dataviz.diagram.Shape, options: any): void; + select(elements: any, options: any): void; + selectAll(): void; + selectArea(rect: kendo.dataviz.diagram.Rect): void; + setConnectionsDataSource(dataSource: kendo.data.DataSource): void; + setDataSource(dataSource: kendo.data.DataSource): void; + toBack(items: any, undoable: boolean): void; + toFront(items: any, undoable: boolean): void; + transformPoint(p: any): void; + transformRect(r: any): void; + undo(): void; + viewToDocument(point: any): any; + viewToModel(point: any): any; + viewport(): void; + zoom(zoom: number, point: any): void; + } + + interface DiagramConnectionDefaultsContent { + template?: any; + text?: string; + } + + interface DiagramConnectionDefaultsEditableTool { + name?: string; + } + + interface DiagramConnectionDefaultsEditable { + tools?: DiagramConnectionDefaultsEditableTool[]; + } + + interface DiagramConnectionDefaultsEndCapFill { + color?: string; + } + + interface DiagramConnectionDefaultsEndCapStroke { + color?: string; + dashType?: string; + width?: number; + } + + interface DiagramConnectionDefaultsEndCap { + fill?: DiagramConnectionDefaultsEndCapFill; + stroke?: DiagramConnectionDefaultsEndCapStroke; + type?: string; + } + + interface DiagramConnectionDefaultsHoverStroke { + color?: string; + } + + interface DiagramConnectionDefaultsHover { + stroke?: DiagramConnectionDefaultsHoverStroke; + } + + interface DiagramConnectionDefaultsSelectionHandlesFill { + color?: string; + } + + interface DiagramConnectionDefaultsSelectionHandlesStroke { + color?: string; + } + + interface DiagramConnectionDefaultsSelectionHandles { + fill?: DiagramConnectionDefaultsSelectionHandlesFill; + stroke?: DiagramConnectionDefaultsSelectionHandlesStroke; + } + + interface DiagramConnectionDefaultsSelection { + handles?: DiagramConnectionDefaultsSelectionHandles; + } + + interface DiagramConnectionDefaultsStartCapFill { + color?: string; + } + + interface DiagramConnectionDefaultsStartCapStroke { + color?: string; + dashType?: string; + width?: number; + } + + interface DiagramConnectionDefaultsStartCap { + fill?: DiagramConnectionDefaultsStartCapFill; + stroke?: DiagramConnectionDefaultsStartCapStroke; + type?: string; + } + + interface DiagramConnectionDefaultsStroke { + color?: string; + width?: number; + } + + interface DiagramConnectionDefaults { + content?: DiagramConnectionDefaultsContent; + editable?: DiagramConnectionDefaultsEditable; + endCap?: DiagramConnectionDefaultsEndCap; + hover?: DiagramConnectionDefaultsHover; + selectable?: boolean; + selection?: DiagramConnectionDefaultsSelection; + startCap?: DiagramConnectionDefaultsStartCap; + stroke?: DiagramConnectionDefaultsStroke; + } + + interface DiagramConnectionContent { + template?: any; + text?: string; + } + + interface DiagramConnectionEditableTool { + name?: string; + } + + interface DiagramConnectionEditable { + tools?: DiagramConnectionEditableTool[]; + } + + interface DiagramConnectionEndCapFill { + color?: string; + } + + interface DiagramConnectionEndCapStroke { + color?: string; + dashType?: string; + width?: number; + } + + interface DiagramConnectionEndCap { + fill?: DiagramConnectionEndCapFill; + stroke?: DiagramConnectionEndCapStroke; + type?: string; + } + + interface DiagramConnectionFrom { + x?: number; + y?: number; + } + + interface DiagramConnectionHoverStroke { + color?: string; + } + + interface DiagramConnectionHover { + stroke?: DiagramConnectionHoverStroke; + } + + interface DiagramConnectionPoint { + x?: number; + y?: number; + } + + interface DiagramConnectionSelectionHandlesFill { + color?: string; + } + + interface DiagramConnectionSelectionHandlesStroke { + color?: string; + } + + interface DiagramConnectionSelectionHandles { + fill?: DiagramConnectionSelectionHandlesFill; + stroke?: DiagramConnectionSelectionHandlesStroke; + } + + interface DiagramConnectionSelection { + handles?: DiagramConnectionSelectionHandles; + } + + interface DiagramConnectionStartCapFill { + color?: string; + } + + interface DiagramConnectionStartCapStroke { + color?: string; + dashType?: string; + width?: number; + } + + interface DiagramConnectionStartCap { + fill?: DiagramConnectionStartCapFill; + stroke?: DiagramConnectionStartCapStroke; + type?: string; + } + + interface DiagramConnectionStroke { + color?: string; + width?: number; + } + + interface DiagramConnectionTo { + x?: number; + y?: number; + } + + interface DiagramConnection { + content?: DiagramConnectionContent; + editable?: DiagramConnectionEditable; + endCap?: DiagramConnectionEndCap; + from?: DiagramConnectionFrom; + hover?: DiagramConnectionHover; + points?: DiagramConnectionPoint[]; + selection?: DiagramConnectionSelection; + startCap?: DiagramConnectionStartCap; + stroke?: DiagramConnectionStroke; + to?: DiagramConnectionTo; + } + + interface DiagramEditableResizeHandlesFill { + color?: string; + opacity?: number; + } + + interface DiagramEditableResizeHandlesHoverFill { + color?: string; + opacity?: number; + } + + interface DiagramEditableResizeHandlesHoverStroke { + color?: string; + dashType?: string; + width?: number; + } + + interface DiagramEditableResizeHandlesHover { + fill?: DiagramEditableResizeHandlesHoverFill; + stroke?: DiagramEditableResizeHandlesHoverStroke; + } + + interface DiagramEditableResizeHandlesStroke { + color?: string; + dashType?: string; + width?: number; + } + + interface DiagramEditableResizeHandles { + fill?: DiagramEditableResizeHandlesFill; + height?: number; + hover?: DiagramEditableResizeHandlesHover; + stroke?: DiagramEditableResizeHandlesStroke; + width?: number; + } + + interface DiagramEditableResize { + handles?: DiagramEditableResizeHandles; + } + + interface DiagramEditableRotateFill { + color?: string; + opacity?: number; + } + + interface DiagramEditableRotateStroke { + color?: string; + width?: number; + } + + interface DiagramEditableRotate { + fill?: DiagramEditableRotateFill; + stroke?: DiagramEditableRotateStroke; + } + + interface DiagramEditableTool { + name?: string; + step?: number; + } + + interface DiagramEditable { + connectionTemplate?: any; + resize?: DiagramEditableResize; + rotate?: DiagramEditableRotate; + shapeTemplate?: any; + tools?: DiagramEditableTool[]; + } + + interface DiagramLayoutGrid { + componentSpacingX?: number; + componentSpacingY?: number; + offsetX?: number; + offsetY?: number; + width?: number; + } + + interface DiagramLayout { + endRadialAngle?: number; + grid?: DiagramLayoutGrid; + horizontalSeparation?: number; + iterations?: number; + layerSeparation?: number; + nodeDistance?: number; + radialFirstLevelSeparation?: number; + radialSeparation?: number; + startRadialAngle?: number; + subtype?: string; + type?: string; + underneathHorizontalOffset?: number; + underneathVerticalSeparation?: number; + underneathVerticalTopOffset?: number; + verticalSeparation?: number; + } + + interface DiagramPannable { + key?: string; + } + + interface DiagramPdfMargin { + bottom?: any; + left?: any; + right?: any; + top?: any; + } + + interface DiagramPdf { + author?: string; + creator?: string; + date?: Date; + fileName?: string; + forceProxy?: boolean; + keywords?: string; + landscape?: boolean; + margin?: DiagramPdfMargin; + paperSize?: any; + proxyURL?: string; + proxyTarget?: string; + subject?: string; + title?: string; + } + + interface DiagramSelectableStroke { + color?: string; + dashType?: string; + width?: number; + } + + interface DiagramSelectable { + key?: string; + stroke?: DiagramSelectableStroke; + } + + interface DiagramShapeDefaultsConnector { + name?: string; + position?: any; + } + + interface DiagramShapeDefaultsContent { + align?: string; + color?: string; + fontFamily?: string; + fontSize?: number; + template?: any; + text?: string; + } + + interface DiagramShapeDefaultsEditableTool { + name?: string; + step?: number; + } + + interface DiagramShapeDefaultsEditable { + connect?: boolean; + tools?: DiagramShapeDefaultsEditableTool[]; + } + + interface DiagramShapeDefaultsFill { + color?: string; + opacity?: number; + } + + interface DiagramShapeDefaultsHoverFill { + color?: string; + opacity?: number; + } + + interface DiagramShapeDefaultsHover { + fill?: DiagramShapeDefaultsHoverFill; + } + + interface DiagramShapeDefaultsRotation { + angle?: number; + } + + interface DiagramShapeDefaultsStroke { + color?: string; + dashType?: string; + width?: number; + } + + interface DiagramShapeDefaults { + connectors?: DiagramShapeDefaultsConnector[]; + content?: DiagramShapeDefaultsContent; + editable?: DiagramShapeDefaultsEditable; + fill?: DiagramShapeDefaultsFill; + height?: number; + hover?: DiagramShapeDefaultsHover; + minHeight?: number; + minWidth?: number; + path?: string; + rotation?: DiagramShapeDefaultsRotation; + selectable?: boolean; + source?: string; + stroke?: DiagramShapeDefaultsStroke; + type?: string; + visual?: Function; + width?: number; + x?: number; + y?: number; + } + + interface DiagramShapeConnector { + description?: string; + name?: string; + position?: any; + } + + interface DiagramShapeContent { + align?: string; + color?: string; + fontFamily?: string; + fontSize?: number; + template?: any; + text?: string; + } + + interface DiagramShapeEditableTool { + name?: string; + step?: number; + } + + interface DiagramShapeEditable { + connect?: boolean; + tools?: DiagramShapeEditableTool[]; + } + + interface DiagramShapeFill { + color?: string; + opacity?: number; + } + + interface DiagramShapeHoverFill { + color?: string; + opacity?: number; + } + + interface DiagramShapeHover { + fill?: DiagramShapeHoverFill; + } + + interface DiagramShapeRotation { + angle?: number; + } + + interface DiagramShapeStroke { + color?: string; + dashType?: string; + width?: number; + } + + interface DiagramShape { + connectors?: DiagramShapeConnector[]; + content?: DiagramShapeContent; + editable?: DiagramShapeEditable; + fill?: DiagramShapeFill; + height?: number; + hover?: DiagramShapeHover; + id?: string; + minHeight?: number; + minWidth?: number; + path?: string; + rotation?: DiagramShapeRotation; + source?: string; + stroke?: DiagramShapeStroke; + type?: string; + visual?: Function; + width?: number; + x?: number; + y?: number; + } + + interface DiagramExportImageOptions { + width?: string; + height?: string; + } + + interface DiagramExportSVGOptions { + raw?: boolean; + } + + interface DiagramSelectOptions { + addToSelection?: boolean; + } + + interface DiagramOptions { + name?: string; + autoBind?: boolean; + connectionDefaults?: DiagramConnectionDefaults; + connections?: DiagramConnection[]; + connectionsDataSource?: any; + dataSource?: any; + editable?: DiagramEditable; + layout?: DiagramLayout; + pannable?: DiagramPannable; + pdf?: DiagramPdf; + selectable?: DiagramSelectable; + shapeDefaults?: DiagramShapeDefaults; + shapes?: DiagramShape[]; + template?: any; + zoom?: number; + zoomMax?: number; + zoomMin?: number; + zoomRate?: number; + add?(e: DiagramAddEvent): void; + cancel?(e: DiagramCancelEvent): void; + change?(e: DiagramChangeEvent): void; + click?(e: DiagramClickEvent): void; + dataBound?(e: DiagramDataBoundEvent): void; + edit?(e: DiagramEditEvent): void; + itemBoundsChange?(e: DiagramItemBoundsChangeEvent): void; + itemRotate?(e: DiagramItemRotateEvent): void; + mouseEnter?(e: DiagramMouseEnterEvent): void; + mouseLeave?(e: DiagramMouseLeaveEvent): void; + pan?(e: DiagramPanEvent): void; + remove?(e: DiagramRemoveEvent): void; + save?(e: DiagramSaveEvent): void; + select?(e: DiagramSelectEvent): void; + zoomEnd?(e: DiagramZoomEndEvent): void; + zoomStart?(e: DiagramZoomStartEvent): void; + } + interface DiagramEvent { + sender: Diagram; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + interface DiagramAddEvent extends DiagramEvent { + connection?: kendo.dataviz.diagram.Connection; + shape?: kendo.dataviz.diagram.Shape; + } + + interface DiagramCancelEvent extends DiagramEvent { + container?: JQuery; + connection?: kendo.data.Model; + shape?: kendo.data.Model; + } + + interface DiagramChangeEvent extends DiagramEvent { + added?: any; + removed?: any; + } + + interface DiagramClickEvent extends DiagramEvent { + item?: any; + point?: kendo.dataviz.diagram.Point; + } + + interface DiagramDataBoundEvent extends DiagramEvent { + } + + interface DiagramEditEvent extends DiagramEvent { + container?: JQuery; + connection?: kendo.data.Model; + shape?: kendo.data.Model; + } + + interface DiagramItemBoundsChangeEvent extends DiagramEvent { + bounds?: kendo.dataviz.diagram.Rect; + item?: any; + } + + interface DiagramItemRotateEvent extends DiagramEvent { + item?: any; + } + + interface DiagramMouseEnterEvent extends DiagramEvent { + item?: any; + } + + interface DiagramMouseLeaveEvent extends DiagramEvent { + item?: any; + } + + interface DiagramPanEvent extends DiagramEvent { + } + + interface DiagramRemoveEvent extends DiagramEvent { + connection?: kendo.dataviz.diagram.Connection; + shape?: kendo.dataviz.diagram.Shape; + } + + interface DiagramSaveEvent extends DiagramEvent { + container?: JQuery; + connection?: kendo.data.Model; + shape?: kendo.data.Model; + } + + interface DiagramSelectEvent extends DiagramEvent { + selected?: any; + deselected?: any; + } + + interface DiagramZoomEndEvent extends DiagramEvent { + point?: kendo.dataviz.diagram.Point; + zoom?: number; + } + + interface DiagramZoomStartEvent extends DiagramEvent { + point?: kendo.dataviz.diagram.Point; + zoom?: number; + } + + + class LinearGauge extends kendo.ui.Widget { + static fn: LinearGauge; + static extend(proto: Object): LinearGauge; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: LinearGaugeOptions); + options: LinearGaugeOptions; + allValues(values: any): any; + destroy(): void; + exportImage(options: any): JQueryPromise; + exportPDF(options?: kendo.drawing.PDFOptions): JQueryPromise; + exportSVG(options: any): JQueryPromise; + redraw(): void; + resize(force?: boolean): void; + svg(): void; + imageDataURL(): string; + value(): void; + } + + interface LinearGaugeGaugeAreaBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface LinearGaugeGaugeArea { + background?: any; + border?: LinearGaugeGaugeAreaBorder; + height?: number; + margin?: any; + width?: number; + } + + interface LinearGaugePointerItemBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface LinearGaugePointerItemTrackBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface LinearGaugePointerItemTrack { + border?: LinearGaugePointerItemTrackBorder; + color?: string; + opacity?: number; + size?: number; + visible?: boolean; + } + + interface LinearGaugePointerItem { + border?: LinearGaugePointerItemBorder; + color?: string; + margin?: any; + opacity?: number; + shape?: string; + size?: number; + track?: LinearGaugePointerItemTrack; + value?: number; + } + + interface LinearGaugeScaleLabelsBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface LinearGaugeScaleLabels { + background?: string; + border?: LinearGaugeScaleLabelsBorder; + color?: string; + font?: string; + format?: string; + margin?: any; + padding?: any; + template?: any; + visible?: boolean; + } + + interface LinearGaugeScaleLine { + color?: string; + dashType?: string; + visible?: boolean; + width?: number; + } + + interface LinearGaugeScaleMajorTicks { + color?: string; + size?: number; + visible?: boolean; + width?: number; + } + + interface LinearGaugeScaleMinorTicks { + color?: string; + size?: number; + visible?: boolean; + width?: number; + } + + interface LinearGaugeScaleRange { + from?: number; + to?: number; + opacity?: number; + color?: string; + } + + interface LinearGaugeScale { + line?: LinearGaugeScaleLine; + labels?: LinearGaugeScaleLabels; + majorTicks?: LinearGaugeScaleMajorTicks; + majorUnit?: number; + max?: number; + min?: number; + minorTicks?: LinearGaugeScaleMinorTicks; + minorUnit?: number; + mirror?: boolean; + ranges?: LinearGaugeScaleRange[]; + rangePlaceholderColor?: string; + rangeSize?: number; + reverse?: boolean; + vertical?: boolean; + } + + interface LinearGaugeExportImageOptions { + width?: string; + height?: string; + } + + interface LinearGaugeExportSVGOptions { + raw?: boolean; + } + + interface LinearGaugeOptions { + name?: string; + gaugeArea?: LinearGaugeGaugeArea; + pointer?: LinearGaugePointerItem[]; + renderAs?: string; + scale?: LinearGaugeScale; + transitions?: boolean; + } + interface LinearGaugeEvent { + sender: LinearGauge; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + class Map extends kendo.ui.Widget { + static fn: Map; + static extend(proto: Object): Map; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: MapOptions); + options: MapOptions; + center(): kendo.dataviz.map.Location; + center(center: any): void; + center(center: kendo.dataviz.map.Location): void; + destroy(): void; + eventOffset(e: any): kendo.geometry.Point; + eventOffset(e: JQueryEventObject): kendo.geometry.Point; + eventToLayer(e: any): kendo.geometry.Point; + eventToLayer(e: JQueryEventObject): kendo.geometry.Point; + eventToLocation(e: any): kendo.geometry.Point; + eventToLocation(e: JQueryEventObject): kendo.geometry.Point; + eventToView(e: any): kendo.geometry.Point; + eventToView(e: JQueryEventObject): kendo.geometry.Point; + extent(): kendo.dataviz.map.Extent; + extent(extent: kendo.dataviz.map.Extent): void; + layerToLocation(point: any, zoom: number): kendo.dataviz.map.Location; + layerToLocation(point: kendo.geometry.Point, zoom: number): kendo.dataviz.map.Location; + locationToLayer(location: any, zoom: number): kendo.geometry.Point; + locationToLayer(location: kendo.dataviz.map.Location, zoom: number): kendo.geometry.Point; + locationToView(location: any): kendo.geometry.Point; + locationToView(location: kendo.dataviz.map.Location): kendo.geometry.Point; + resize(force?: boolean): void; + setOptions(options: any): void; + viewSize(): any; + viewToLocation(point: any, zoom: number): kendo.dataviz.map.Location; + viewToLocation(point: kendo.geometry.Point, zoom: number): kendo.dataviz.map.Location; + zoom(): number; + zoom(level: number): void; + layers: any; + } + + interface MapControlsAttribution { + position?: string; + } + + interface MapControlsNavigator { + position?: string; + } + + interface MapControlsZoom { + position?: string; + } + + interface MapControls { + attribution?: MapControlsAttribution; + navigator?: MapControlsNavigator; + zoom?: MapControlsZoom; + } + + interface MapLayerDefaultsBing { + attribution?: string; + opacity?: number; + key?: string; + imagerySet?: string; + } + + interface MapLayerDefaultsBubbleStyleFill { + color?: string; + opacity?: number; + } + + interface MapLayerDefaultsBubbleStyleStroke { + color?: string; + dashType?: string; + opacity?: number; + width?: number; + } + + interface MapLayerDefaultsBubbleStyle { + fill?: MapLayerDefaultsBubbleStyleFill; + stroke?: MapLayerDefaultsBubbleStyleStroke; + } + + interface MapLayerDefaultsBubble { + attribution?: string; + opacity?: number; + maxSize?: number; + minSize?: number; + style?: MapLayerDefaultsBubbleStyle; + symbol?: any; + } + + interface MapLayerDefaultsMarkerTooltipAnimationClose { + effects?: string; + duration?: number; + } + + interface MapLayerDefaultsMarkerTooltipAnimationOpen { + effects?: string; + duration?: number; + } + + interface MapLayerDefaultsMarkerTooltipAnimation { + close?: MapLayerDefaultsMarkerTooltipAnimationClose; + open?: MapLayerDefaultsMarkerTooltipAnimationOpen; + } + + interface MapLayerDefaultsMarkerTooltipContent { + url?: string; + } + + interface MapLayerDefaultsMarkerTooltip { + autoHide?: boolean; + animation?: MapLayerDefaultsMarkerTooltipAnimation; + content?: MapLayerDefaultsMarkerTooltipContent; + template?: string; + callout?: boolean; + iframe?: boolean; + height?: number; + width?: number; + position?: string; + showAfter?: number; + showOn?: string; + } + + interface MapLayerDefaultsMarker { + shape?: string; + tooltip?: MapLayerDefaultsMarkerTooltip; + opacity?: number; + } + + interface MapLayerDefaultsShapeStyleFill { + color?: string; + opacity?: number; + } + + interface MapLayerDefaultsShapeStyleStroke { + color?: string; + dashType?: string; + opacity?: number; + width?: number; + } + + interface MapLayerDefaultsShapeStyle { + fill?: MapLayerDefaultsShapeStyleFill; + stroke?: MapLayerDefaultsShapeStyleStroke; + } + + interface MapLayerDefaultsShape { + attribution?: string; + opacity?: number; + style?: MapLayerDefaultsShapeStyle; + } + + interface MapLayerDefaultsTile { + urlTemplate?: string; + attribution?: string; + subdomains?: any; + opacity?: number; + } + + interface MapLayerDefaults { + marker?: MapLayerDefaultsMarker; + shape?: MapLayerDefaultsShape; + bubble?: MapLayerDefaultsBubble; + tile?: MapLayerDefaultsTile; + bing?: MapLayerDefaultsBing; + } + + interface MapLayerStyleFill { + color?: string; + opacity?: number; + } + + interface MapLayerStyleStroke { + color?: string; + dashType?: number; + opacity?: number; + width?: number; + } + + interface MapLayerStyle { + fill?: MapLayerStyleFill; + stroke?: MapLayerStyleStroke; + } + + interface MapLayerTooltipAnimationClose { + effects?: string; + duration?: number; + } + + interface MapLayerTooltipAnimationOpen { + effects?: string; + duration?: number; + } + + interface MapLayerTooltipAnimation { + close?: MapLayerTooltipAnimationClose; + open?: MapLayerTooltipAnimationOpen; + } + + interface MapLayerTooltipContent { + url?: string; + } + + interface MapLayerTooltip { + autoHide?: boolean; + animation?: MapLayerTooltipAnimation; + content?: MapLayerTooltipContent; + template?: string; + callout?: boolean; + iframe?: boolean; + height?: number; + width?: number; + position?: string; + showAfter?: number; + showOn?: string; + } + + interface MapLayer { + attribution?: string; + autoBind?: boolean; + dataSource?: any; + extent?: any; + key?: string; + imagerySet?: string; + locationField?: string; + shape?: string; + titleField?: string; + tooltip?: MapLayerTooltip; + maxSize?: number; + minSize?: number; + opacity?: number; + subdomains?: any; + symbol?: any; + type?: string; + style?: MapLayerStyle; + urlTemplate?: string; + valueField?: string; + zIndex?: number; + } + + interface MapMarkerDefaultsTooltipAnimationClose { + effects?: string; + duration?: number; + } + + interface MapMarkerDefaultsTooltipAnimationOpen { + effects?: string; + duration?: number; + } + + interface MapMarkerDefaultsTooltipAnimation { + close?: MapMarkerDefaultsTooltipAnimationClose; + open?: MapMarkerDefaultsTooltipAnimationOpen; + } + + interface MapMarkerDefaultsTooltipContent { + url?: string; + } + + interface MapMarkerDefaultsTooltip { + autoHide?: boolean; + animation?: MapMarkerDefaultsTooltipAnimation; + content?: MapMarkerDefaultsTooltipContent; + template?: string; + callout?: boolean; + iframe?: boolean; + height?: number; + width?: number; + position?: string; + showAfter?: number; + showOn?: string; + } + + interface MapMarkerDefaults { + shape?: string; + tooltip?: MapMarkerDefaultsTooltip; + } + + interface MapMarkerTooltipAnimationClose { + effects?: string; + duration?: number; + } + + interface MapMarkerTooltipAnimationOpen { + effects?: string; + duration?: number; + } + + interface MapMarkerTooltipAnimation { + close?: MapMarkerTooltipAnimationClose; + open?: MapMarkerTooltipAnimationOpen; + } + + interface MapMarkerTooltipContent { + url?: string; + } + + interface MapMarkerTooltip { + autoHide?: boolean; + animation?: MapMarkerTooltipAnimation; + content?: MapMarkerTooltipContent; + template?: string; + callout?: boolean; + iframe?: boolean; + height?: number; + width?: number; + position?: string; + showAfter?: number; + showOn?: string; + } + + interface MapMarker { + location?: any; + shape?: string; + title?: string; + tooltip?: MapMarkerTooltip; + } + + interface MapOptions { + name?: string; + center?: any; + controls?: MapControls; + layerDefaults?: MapLayerDefaults; + layers?: MapLayer[]; + markerDefaults?: MapMarkerDefaults; + markers?: MapMarker[]; + minZoom?: number; + maxZoom?: number; + minSize?: number; + pannable?: boolean; + wraparound?: boolean; + zoom?: number; + zoomable?: boolean; + beforeReset?(e: MapBeforeResetEvent): void; + click?(e: MapClickEvent): void; + markerActivate?(e: MapMarkerActivateEvent): void; + markerCreated?(e: MapMarkerCreatedEvent): void; + markerClick?(e: MapMarkerClickEvent): void; + pan?(e: MapPanEvent): void; + panEnd?(e: MapPanEndEvent): void; + reset?(e: MapResetEvent): void; + shapeClick?(e: MapShapeClickEvent): void; + shapeCreated?(e: MapShapeCreatedEvent): void; + shapeMouseEnter?(e: MapShapeMouseEnterEvent): void; + shapeMouseLeave?(e: MapShapeMouseLeaveEvent): void; + zoomStart?(e: MapZoomStartEvent): void; + zoomEnd?(e: MapZoomEndEvent): void; + } + interface MapEvent { + sender: Map; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + interface MapBeforeResetEvent extends MapEvent { + } + + interface MapClickEvent extends MapEvent { + location?: kendo.dataviz.map.Location; + originalEvent?: any; + } + + interface MapMarkerActivateEvent extends MapEvent { + marker?: kendo.dataviz.map.Marker; + layer?: kendo.dataviz.map.Marker; + } + + interface MapMarkerCreatedEvent extends MapEvent { + marker?: kendo.dataviz.map.Marker; + layer?: kendo.dataviz.map.Marker; + } + + interface MapMarkerClickEvent extends MapEvent { + marker?: kendo.dataviz.map.Marker; + layer?: kendo.dataviz.map.Marker; + } + + interface MapPanEvent extends MapEvent { + origin?: kendo.dataviz.map.Location; + center?: kendo.dataviz.map.Location; + originalEvent?: any; + } + + interface MapPanEndEvent extends MapEvent { + origin?: kendo.dataviz.map.Location; + center?: kendo.dataviz.map.Location; + originalEvent?: any; + } + + interface MapResetEvent extends MapEvent { + } + + interface MapShapeClickEvent extends MapEvent { + layer?: kendo.dataviz.map.layer.Shape; + shape?: kendo.drawing.Element; + originalEvent?: any; + } + + interface MapShapeCreatedEvent extends MapEvent { + layer?: kendo.dataviz.map.layer.Shape; + shape?: kendo.drawing.Element; + originalEvent?: any; + } + + interface MapShapeMouseEnterEvent extends MapEvent { + layer?: kendo.dataviz.map.layer.Shape; + shape?: kendo.drawing.Element; + originalEvent?: any; + } + + interface MapShapeMouseLeaveEvent extends MapEvent { + layer?: kendo.dataviz.map.layer.Shape; + shape?: kendo.drawing.Element; + originalEvent?: any; + } + + interface MapZoomStartEvent extends MapEvent { + originalEvent?: any; + } + + interface MapZoomEndEvent extends MapEvent { + originalEvent?: any; + } + + + class QRCode extends kendo.ui.Widget { + static fn: QRCode; + static extend(proto: Object): QRCode; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: QRCodeOptions); + options: QRCodeOptions; + destroy(): void; + exportImage(options: any): JQueryPromise; + exportPDF(options?: kendo.drawing.PDFOptions): JQueryPromise; + exportSVG(options: any): JQueryPromise; + imageDataURL(): string; + redraw(): void; + resize(force?: boolean): void; + setOptions(options: any): void; + svg(): string; + value(options: string): void; + value(options: number): void; + } + + interface QRCodeBorder { + color?: string; + width?: number; + } + + interface QRCodeExportImageOptions { + width?: string; + height?: string; + } + + interface QRCodeExportSVGOptions { + raw?: boolean; + } + + interface QRCodeOptions { + name?: string; + background?: string; + border?: QRCodeBorder; + color?: string; + encoding?: string; + errorCorrection?: string; + padding?: number; + renderAs?: string; + size?: any; + value?: any; + } + interface QRCodeEvent { + sender: QRCode; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + class RadialGauge extends kendo.ui.Widget { + static fn: RadialGauge; + static extend(proto: Object): RadialGauge; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: RadialGaugeOptions); + options: RadialGaugeOptions; + allValues(values: any): any; + destroy(): void; + exportImage(options: any): JQueryPromise; + exportPDF(options?: kendo.drawing.PDFOptions): JQueryPromise; + exportSVG(options: any): JQueryPromise; + redraw(): void; + resize(force?: boolean): void; + svg(): void; + imageDataURL(): string; + value(): void; + } + + interface RadialGaugeGaugeAreaBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface RadialGaugeGaugeArea { + background?: any; + border?: RadialGaugeGaugeAreaBorder; + height?: number; + margin?: any; + width?: number; + } + + interface RadialGaugePointerItemCap { + color?: string; + size?: number; + } + + interface RadialGaugePointerItem { + cap?: RadialGaugePointerItemCap; + color?: string; + value?: number; + } + + interface RadialGaugeScaleLabelsBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface RadialGaugeScaleLabels { + background?: string; + border?: RadialGaugeScaleLabelsBorder; + color?: string; + font?: string; + format?: string; + margin?: any; + padding?: any; + position?: string; + template?: any; + visible?: boolean; + } + + interface RadialGaugeScaleMajorTicks { + color?: string; + size?: number; + visible?: boolean; + width?: number; + } + + interface RadialGaugeScaleMinorTicks { + color?: string; + size?: number; + visible?: boolean; + width?: number; + } + + interface RadialGaugeScaleRange { + from?: number; + to?: number; + opacity?: number; + color?: string; + } + + interface RadialGaugeScale { + endAngle?: number; + labels?: RadialGaugeScaleLabels; + majorTicks?: RadialGaugeScaleMajorTicks; + majorUnit?: number; + max?: number; + min?: number; + minorTicks?: RadialGaugeScaleMinorTicks; + minorUnit?: number; + ranges?: RadialGaugeScaleRange[]; + rangePlaceholderColor?: string; + rangeSize?: number; + rangeDistance?: number; + reverse?: boolean; + startAngle?: number; + } + + interface RadialGaugeExportImageOptions { + width?: string; + height?: string; + } + + interface RadialGaugeExportSVGOptions { + raw?: boolean; + } + + interface RadialGaugeOptions { + name?: string; + gaugeArea?: RadialGaugeGaugeArea; + pointer?: RadialGaugePointerItem[]; + renderAs?: string; + scale?: RadialGaugeScale; + transitions?: boolean; + } + interface RadialGaugeEvent { + sender: RadialGauge; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + class Sparkline extends kendo.ui.Widget { + static fn: Sparkline; + static extend(proto: Object): Sparkline; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: SparklineOptions); + options: SparklineOptions; + dataSource: kendo.data.DataSource; + destroy(): void; + exportImage(options: any): JQueryPromise; + exportPDF(options?: kendo.drawing.PDFOptions): JQueryPromise; + exportSVG(options: any): JQueryPromise; + refresh(): void; + setDataSource(dataSource: kendo.data.DataSource): void; + setOptions(options: any): void; + svg(): string; + imageDataURL(): string; + } + + interface SparklineCategoryAxisItemCrosshairTooltipBorder { + color?: string; + width?: number; + } + + interface SparklineCategoryAxisItemCrosshairTooltip { + background?: string; + border?: SparklineCategoryAxisItemCrosshairTooltipBorder; + color?: string; + font?: string; + format?: string; + padding?: any; + template?: any; + visible?: boolean; + } + + interface SparklineCategoryAxisItemCrosshair { + color?: string; + width?: number; + opacity?: number; + dashType?: number; + visible?: boolean; + tooltip?: SparklineCategoryAxisItemCrosshairTooltip; + } + + interface SparklineCategoryAxisItemLabelsBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface SparklineCategoryAxisItemLabels { + background?: string; + border?: SparklineCategoryAxisItemLabelsBorder; + color?: string; + font?: string; + format?: string; + margin?: any; + mirror?: boolean; + padding?: any; + rotation?: number; + skip?: number; + step?: number; + template?: any; + visible?: boolean; + culture?: string; + dateFormats?: any; + } + + interface SparklineCategoryAxisItemLine { + color?: string; + dashType?: string; + visible?: boolean; + width?: number; + } + + interface SparklineCategoryAxisItemMajorGridLines { + color?: string; + dashType?: string; + visible?: boolean; + width?: number; + step?: number; + skip?: number; + } + + interface SparklineCategoryAxisItemMajorTicks { + size?: number; + visible?: boolean; + color?: string; + width?: number; + step?: number; + skip?: number; + } + + interface SparklineCategoryAxisItemMinorGridLines { + color?: string; + dashType?: string; + visible?: boolean; + width?: number; + step?: number; + skip?: number; + } + + interface SparklineCategoryAxisItemMinorTicks { + size?: number; + visible?: boolean; + color?: string; + width?: number; + step?: number; + skip?: number; + } + + interface SparklineCategoryAxisItemNotesDataItemIconBorder { + color?: string; + width?: number; + } + + interface SparklineCategoryAxisItemNotesDataItemIcon { + background?: string; + border?: SparklineCategoryAxisItemNotesDataItemIconBorder; + size?: number; + type?: string; + visible?: boolean; + } + + interface SparklineCategoryAxisItemNotesDataItemLabelBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface SparklineCategoryAxisItemNotesDataItemLabel { + background?: string; + border?: SparklineCategoryAxisItemNotesDataItemLabelBorder; + color?: string; + font?: string; + template?: any; + visible?: boolean; + rotation?: number; + format?: string; + text?: string; + position?: string; + } + + interface SparklineCategoryAxisItemNotesDataItemLine { + width?: number; + color?: string; + length?: number; + } + + interface SparklineCategoryAxisItemNotesDataItem { + value?: any; + position?: string; + icon?: SparklineCategoryAxisItemNotesDataItemIcon; + label?: SparklineCategoryAxisItemNotesDataItemLabel; + line?: SparklineCategoryAxisItemNotesDataItemLine; + } + + interface SparklineCategoryAxisItemNotesIconBorder { + color?: string; + width?: number; + } + + interface SparklineCategoryAxisItemNotesIcon { + background?: string; + border?: SparklineCategoryAxisItemNotesIconBorder; + size?: number; + type?: string; + visible?: boolean; + } + + interface SparklineCategoryAxisItemNotesLabelBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface SparklineCategoryAxisItemNotesLabel { + background?: string; + border?: SparklineCategoryAxisItemNotesLabelBorder; + color?: string; + font?: string; + template?: any; + visible?: boolean; + rotation?: number; + format?: string; + position?: string; + } + + interface SparklineCategoryAxisItemNotesLine { + width?: number; + color?: string; + length?: number; + } + + interface SparklineCategoryAxisItemNotes { + position?: string; + icon?: SparklineCategoryAxisItemNotesIcon; + label?: SparklineCategoryAxisItemNotesLabel; + line?: SparklineCategoryAxisItemNotesLine; + data?: SparklineCategoryAxisItemNotesDataItem[]; + } + + interface SparklineCategoryAxisItemPlotBand { + from?: number; + to?: number; + color?: string; + opacity?: number; + } + + interface SparklineCategoryAxisItemTitleBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface SparklineCategoryAxisItemTitle { + background?: string; + border?: SparklineCategoryAxisItemTitleBorder; + color?: string; + font?: string; + margin?: any; + position?: string; + rotation?: number; + text?: string; + visible?: boolean; + } + + interface SparklineCategoryAxisItem { + axisCrossingValue?: any; + categories?: any; + color?: string; + field?: string; + justified?: boolean; + labels?: SparklineCategoryAxisItemLabels; + line?: SparklineCategoryAxisItemLine; + majorGridLines?: SparklineCategoryAxisItemMajorGridLines; + majorTicks?: SparklineCategoryAxisItemMajorTicks; + minorGridLines?: SparklineCategoryAxisItemMinorGridLines; + minorTicks?: SparklineCategoryAxisItemMinorTicks; + name?: string; + plotBands?: SparklineCategoryAxisItemPlotBand[]; + reverse?: boolean; + title?: SparklineCategoryAxisItemTitle; + type?: string; + autoBaseUnitSteps?: any; + baseUnit?: string; + baseUnitStep?: any; + max?: any; + min?: any; + roundToBaseUnit?: boolean; + weekStartDay?: number; + maxDateGroups?: number; + visible?: boolean; + crosshair?: SparklineCategoryAxisItemCrosshair; + notes?: SparklineCategoryAxisItemNotes; + } + + interface SparklineChartAreaBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface SparklineChartArea { + background?: string; + opacity?: number; + border?: SparklineChartAreaBorder; + height?: number; + margin?: any; + width?: number; + } + + interface SparklinePlotAreaBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface SparklinePlotArea { + background?: string; + opacity?: number; + border?: SparklinePlotAreaBorder; + margin?: any; + } + + interface SparklineSeriesItemBorder { + color?: any; + dashType?: any; + opacity?: any; + width?: any; + } + + interface SparklineSeriesItemConnectors { + color?: string; + padding?: number; + width?: number; + } + + interface SparklineSeriesItemHighlightBorder { + width?: number; + color?: string; + opacity?: number; + } + + interface SparklineSeriesItemHighlight { + border?: SparklineSeriesItemHighlightBorder; + color?: string; + opacity?: number; + visible?: boolean; + } + + interface SparklineSeriesItemLabelsBorder { + color?: any; + dashType?: any; + width?: any; + } + + interface SparklineSeriesItemLabels { + align?: string; + background?: any; + border?: SparklineSeriesItemLabelsBorder; + color?: any; + distance?: number; + font?: any; + format?: any; + margin?: any; + padding?: any; + position?: any; + template?: any; + visible?: any; + } + + interface SparklineSeriesItemLine { + color?: string; + opacity?: number; + width?: string; + style?: string; + } + + interface SparklineSeriesItemMarkersBorder { + color?: any; + width?: any; + } + + interface SparklineSeriesItemMarkers { + background?: any; + border?: SparklineSeriesItemMarkersBorder; + size?: any; + type?: any; + visible?: any; + rotation?: any; + } + + interface SparklineSeriesItemNotesIconBorder { + color?: string; + width?: number; + } + + interface SparklineSeriesItemNotesIcon { + background?: string; + border?: SparklineSeriesItemNotesIconBorder; + size?: number; + type?: string; + visible?: boolean; + } + + interface SparklineSeriesItemNotesLabelBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface SparklineSeriesItemNotesLabel { + background?: string; + border?: SparklineSeriesItemNotesLabelBorder; + color?: string; + font?: string; + template?: any; + visible?: boolean; + rotation?: number; + format?: string; + position?: string; + } + + interface SparklineSeriesItemNotesLine { + width?: number; + color?: string; + length?: number; + } + + interface SparklineSeriesItemNotes { + position?: string; + icon?: SparklineSeriesItemNotesIcon; + label?: SparklineSeriesItemNotesLabel; + line?: SparklineSeriesItemNotesLine; + } + + interface SparklineSeriesItemOverlay { + gradient?: string; + } + + interface SparklineSeriesItemStack { + type?: string; + group?: string; + } + + interface SparklineSeriesItemTargetBorder { + color?: any; + dashType?: any; + width?: number; + } + + interface SparklineSeriesItemTargetLine { + width?: any; + } + + interface SparklineSeriesItemTarget { + line?: SparklineSeriesItemTargetLine; + color?: any; + border?: SparklineSeriesItemTargetBorder; + } + + interface SparklineSeriesItemTooltipBorder { + color?: string; + width?: number; + } + + interface SparklineSeriesItemTooltip { + background?: string; + border?: SparklineSeriesItemTooltipBorder; + color?: string; + font?: string; + format?: string; + padding?: any; + template?: any; + visible?: boolean; + } + + interface SparklineSeriesItem { + type?: string; + dashType?: string; + data?: any; + explodeField?: string; + currentField?: string; + targetField?: string; + field?: string; + name?: string; + highlight?: SparklineSeriesItemHighlight; + aggregate?: any; + axis?: string; + border?: SparklineSeriesItemBorder; + categoryField?: string; + color?: any; + colorField?: string; + connectors?: SparklineSeriesItemConnectors; + gap?: number; + labels?: SparklineSeriesItemLabels; + line?: SparklineSeriesItemLine; + markers?: SparklineSeriesItemMarkers; + missingValues?: string; + style?: string; + negativeColor?: string; + opacity?: number; + overlay?: SparklineSeriesItemOverlay; + padding?: number; + size?: number; + startAngle?: number; + spacing?: number; + stack?: SparklineSeriesItemStack; + tooltip?: SparklineSeriesItemTooltip; + width?: number; + target?: SparklineSeriesItemTarget; + notes?: SparklineSeriesItemNotes; + zIndex?: number; + } + + interface SparklineSeriesDefaultsBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface SparklineSeriesDefaultsLabelsBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface SparklineSeriesDefaultsLabels { + background?: string; + border?: SparklineSeriesDefaultsLabelsBorder; + color?: string; + font?: string; + format?: string; + margin?: any; + padding?: any; + template?: any; + visible?: boolean; + } + + interface SparklineSeriesDefaultsStack { + type?: string; + } + + interface SparklineSeriesDefaultsTooltipBorder { + color?: string; + width?: number; + } + + interface SparklineSeriesDefaultsTooltip { + background?: string; + border?: SparklineSeriesDefaultsTooltipBorder; + color?: string; + font?: string; + format?: string; + padding?: any; + template?: any; + visible?: boolean; + } + + interface SparklineSeriesDefaults { + area?: any; + bar?: any; + border?: SparklineSeriesDefaultsBorder; + column?: any; + gap?: number; + labels?: SparklineSeriesDefaultsLabels; + line?: any; + overlay?: any; + pie?: any; + spacing?: number; + stack?: SparklineSeriesDefaultsStack; + type?: string; + tooltip?: SparklineSeriesDefaultsTooltip; + } + + interface SparklineTooltipBorder { + color?: string; + width?: number; + } + + interface SparklineTooltip { + background?: string; + border?: SparklineTooltipBorder; + color?: string; + font?: string; + format?: string; + padding?: any; + template?: any; + visible?: boolean; + shared?: boolean; + sharedTemplate?: string; + } + + interface SparklineValueAxisItemCrosshairTooltipBorder { + color?: string; + width?: number; + } + + interface SparklineValueAxisItemCrosshairTooltip { + background?: string; + border?: SparklineValueAxisItemCrosshairTooltipBorder; + color?: string; + font?: string; + format?: string; + padding?: any; + template?: any; + visible?: boolean; + } + + interface SparklineValueAxisItemCrosshair { + color?: string; + width?: number; + opacity?: number; + dashType?: number; + visible?: boolean; + tooltip?: SparklineValueAxisItemCrosshairTooltip; + } + + interface SparklineValueAxisItemLabelsBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface SparklineValueAxisItemLabels { + background?: string; + border?: SparklineValueAxisItemLabelsBorder; + color?: string; + font?: string; + format?: string; + margin?: any; + mirror?: boolean; + padding?: any; + rotation?: number; + skip?: number; + step?: number; + template?: any; + visible?: boolean; + } + + interface SparklineValueAxisItemLine { + color?: string; + dashType?: string; + visible?: boolean; + width?: number; + } + + interface SparklineValueAxisItemMajorGridLines { + color?: string; + visible?: boolean; + width?: number; + step?: number; + skip?: number; + } + + interface SparklineValueAxisItemMajorTicks { + size?: number; + visible?: boolean; + color?: string; + width?: number; + step?: number; + skip?: number; + } + + interface SparklineValueAxisItemMinorGridLines { + color?: string; + dashType?: string; + visible?: boolean; + width?: number; + step?: number; + skip?: number; + } + + interface SparklineValueAxisItemMinorTicks { + size?: number; + color?: string; + width?: number; + visible?: boolean; + step?: number; + skip?: number; + } + + interface SparklineValueAxisItemNotesDataItemIconBorder { + color?: string; + width?: number; + } + + interface SparklineValueAxisItemNotesDataItemIcon { + background?: string; + border?: SparklineValueAxisItemNotesDataItemIconBorder; + size?: number; + type?: string; + visible?: boolean; + } + + interface SparklineValueAxisItemNotesDataItemLabelBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface SparklineValueAxisItemNotesDataItemLabel { + background?: string; + border?: SparklineValueAxisItemNotesDataItemLabelBorder; + color?: string; + font?: string; + template?: any; + visible?: boolean; + rotation?: number; + format?: string; + text?: string; + position?: string; + } + + interface SparklineValueAxisItemNotesDataItemLine { + width?: number; + color?: string; + length?: number; + } + + interface SparklineValueAxisItemNotesDataItem { + value?: any; + position?: string; + icon?: SparklineValueAxisItemNotesDataItemIcon; + label?: SparklineValueAxisItemNotesDataItemLabel; + line?: SparklineValueAxisItemNotesDataItemLine; + } + + interface SparklineValueAxisItemNotesIconBorder { + color?: string; + width?: number; + } + + interface SparklineValueAxisItemNotesIcon { + background?: string; + border?: SparklineValueAxisItemNotesIconBorder; + size?: number; + type?: string; + visible?: boolean; + } + + interface SparklineValueAxisItemNotesLabelBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface SparklineValueAxisItemNotesLabel { + background?: string; + border?: SparklineValueAxisItemNotesLabelBorder; + color?: string; + font?: string; + template?: any; + visible?: boolean; + rotation?: number; + format?: string; + position?: string; + } + + interface SparklineValueAxisItemNotesLine { + width?: number; + color?: string; + length?: number; + } + + interface SparklineValueAxisItemNotes { + position?: string; + icon?: SparklineValueAxisItemNotesIcon; + label?: SparklineValueAxisItemNotesLabel; + line?: SparklineValueAxisItemNotesLine; + data?: SparklineValueAxisItemNotesDataItem[]; + } + + interface SparklineValueAxisItemPlotBand { + from?: number; + to?: number; + color?: string; + opacity?: number; + } + + interface SparklineValueAxisItemTitleBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface SparklineValueAxisItemTitle { + background?: string; + border?: SparklineValueAxisItemTitleBorder; + color?: string; + font?: string; + margin?: any; + padding?: any; + position?: string; + rotation?: number; + text?: string; + visible?: boolean; + } + + interface SparklineValueAxisItem { + axisCrossingValue?: any; + color?: string; + labels?: SparklineValueAxisItemLabels; + line?: SparklineValueAxisItemLine; + majorGridLines?: SparklineValueAxisItemMajorGridLines; + majorTicks?: SparklineValueAxisItemMajorTicks; + majorUnit?: number; + max?: number; + min?: number; + minorGridLines?: SparklineValueAxisItemMinorGridLines; + minorTicks?: SparklineValueAxisItemMinorTicks; + minorUnit?: number; + name?: any; + narrowRange?: boolean; + plotBands?: SparklineValueAxisItemPlotBand[]; + reverse?: boolean; + title?: SparklineValueAxisItemTitle; + visible?: boolean; + crosshair?: SparklineValueAxisItemCrosshair; + notes?: SparklineValueAxisItemNotes; + } + + interface SparklineExportImageOptions { + width?: string; + height?: string; + } + + interface SparklineExportSVGOptions { + raw?: boolean; + } + + interface SparklineSeriesClickEventSeries { + type?: any; + name?: any; + data?: any; + } + + interface SparklineSeriesHoverEventSeries { + type?: any; + name?: any; + data?: any; + } + + interface SparklineOptions { + name?: string; + axisDefaults?: any; + categoryAxis?: SparklineCategoryAxisItem[]; + chartArea?: SparklineChartArea; + data?: any; + dataSource?: any; + autoBind?: boolean; + plotArea?: SparklinePlotArea; + pointWidth?: number; + renderAs?: string; + series?: SparklineSeriesItem[]; + seriesColors?: any; + seriesDefaults?: SparklineSeriesDefaults; + theme?: string; + tooltip?: SparklineTooltip; + transitions?: boolean; + type?: string; + valueAxis?: SparklineValueAxisItem[]; + axisLabelClick?(e: SparklineAxisLabelClickEvent): void; + dataBound?(e: SparklineEvent): void; + dragStart?(e: SparklineDragStartEvent): void; + drag?(e: SparklineDragEvent): void; + dragEnd?(e: SparklineDragEndEvent): void; + plotAreaClick?(e: SparklinePlotAreaClickEvent): void; + seriesClick?(e: SparklineSeriesClickEvent): void; + seriesHover?(e: SparklineSeriesHoverEvent): void; + zoomStart?(e: SparklineZoomStartEvent): void; + zoom?(e: SparklineZoomEvent): void; + zoomEnd?(e: SparklineZoomEndEvent): void; + } + interface SparklineEvent { + sender: Sparkline; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + interface SparklineAxisLabelClickEvent extends SparklineEvent { + axis?: any; + value?: any; + text?: any; + index?: any; + dataItem?: any; + element?: any; + } + + interface SparklineDragStartEvent extends SparklineEvent { + axisRanges?: any; + originalEvent?: any; + } + + interface SparklineDragEvent extends SparklineEvent { + axisRanges?: any; + originalEvent?: any; + } + + interface SparklineDragEndEvent extends SparklineEvent { + axisRanges?: any; + originalEvent?: any; + } + + interface SparklinePlotAreaClickEvent extends SparklineEvent { + value?: any; + category?: any; + element?: any; + x?: any; + y?: any; + } + + interface SparklineSeriesClickEvent extends SparklineEvent { + value?: any; + category?: any; + series?: SparklineSeriesClickEventSeries; + dataItem?: any; + element?: any; + percentage?: any; + } + + interface SparklineSeriesHoverEvent extends SparklineEvent { + value?: any; + category?: any; + series?: SparklineSeriesHoverEventSeries; + dataItem?: any; + element?: any; + percentage?: any; + } + + interface SparklineZoomStartEvent extends SparklineEvent { + axisRanges?: any; + originalEvent?: any; + } + + interface SparklineZoomEvent extends SparklineEvent { + axisRanges?: any; + delta?: number; + originalEvent?: any; + } + + interface SparklineZoomEndEvent extends SparklineEvent { + axisRanges?: any; + originalEvent?: any; + } + + + class StockChart extends kendo.ui.Widget { + static fn: StockChart; + static extend(proto: Object): StockChart; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: StockChartOptions); + options: StockChartOptions; + dataSource: kendo.data.DataSource; + destroy(): void; + exportImage(options: any): JQueryPromise; + exportPDF(options?: kendo.drawing.PDFOptions): JQueryPromise; + exportSVG(options: any): JQueryPromise; + redraw(): void; + refresh(): void; + resize(force?: boolean): void; + setDataSource(dataSource: kendo.data.DataSource): void; + svg(): string; + imageDataURL(): string; + } + + interface StockChartCategoryAxisItemAutoBaseUnitSteps { + days?: any; + hours?: any; + minutes?: any; + months?: any; + weeks?: any; + years?: any; + } + + interface StockChartCategoryAxisItemCrosshairTooltipBorder { + color?: string; + width?: number; + } + + interface StockChartCategoryAxisItemCrosshairTooltip { + background?: string; + border?: StockChartCategoryAxisItemCrosshairTooltipBorder; + color?: string; + font?: string; + format?: string; + padding?: any; + template?: any; + visible?: boolean; + } + + interface StockChartCategoryAxisItemCrosshair { + color?: string; + width?: number; + opacity?: number; + dashType?: number; + visible?: boolean; + tooltip?: StockChartCategoryAxisItemCrosshairTooltip; + } + + interface StockChartCategoryAxisItemLabelsBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface StockChartCategoryAxisItemLabels { + background?: string; + border?: StockChartCategoryAxisItemLabelsBorder; + color?: string; + font?: string; + format?: string; + margin?: any; + mirror?: boolean; + padding?: any; + rotation?: number; + skip?: number; + step?: number; + template?: any; + visible?: boolean; + culture?: string; + dateFormats?: any; + } + + interface StockChartCategoryAxisItemLine { + color?: string; + dashType?: string; + visible?: boolean; + width?: number; + } + + interface StockChartCategoryAxisItemMajorGridLines { + color?: string; + dashType?: string; + visible?: boolean; + width?: number; + step?: number; + skip?: number; + } + + interface StockChartCategoryAxisItemMajorTicks { + color?: string; + size?: number; + width?: number; + visible?: boolean; + step?: number; + skip?: number; + } + + interface StockChartCategoryAxisItemMinorGridLines { + color?: string; + dashType?: string; + visible?: boolean; + width?: number; + step?: number; + skip?: number; + } + + interface StockChartCategoryAxisItemMinorTicks { + size?: number; + visible?: boolean; + color?: string; + width?: number; + step?: number; + skip?: number; + } + + interface StockChartCategoryAxisItemNotesDataItemIconBorder { + color?: string; + width?: number; + } + + interface StockChartCategoryAxisItemNotesDataItemIcon { + background?: string; + border?: StockChartCategoryAxisItemNotesDataItemIconBorder; + size?: number; + type?: string; + visible?: boolean; + } + + interface StockChartCategoryAxisItemNotesDataItemLabelBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface StockChartCategoryAxisItemNotesDataItemLabel { + background?: string; + border?: StockChartCategoryAxisItemNotesDataItemLabelBorder; + color?: string; + font?: string; + template?: any; + visible?: boolean; + rotation?: number; + format?: string; + text?: string; + position?: string; + } + + interface StockChartCategoryAxisItemNotesDataItemLine { + width?: number; + color?: string; + length?: number; + } + + interface StockChartCategoryAxisItemNotesDataItem { + value?: any; + position?: string; + icon?: StockChartCategoryAxisItemNotesDataItemIcon; + label?: StockChartCategoryAxisItemNotesDataItemLabel; + line?: StockChartCategoryAxisItemNotesDataItemLine; + } + + interface StockChartCategoryAxisItemNotesIconBorder { + color?: string; + width?: number; + } + + interface StockChartCategoryAxisItemNotesIcon { + background?: string; + border?: StockChartCategoryAxisItemNotesIconBorder; + size?: number; + type?: string; + visible?: boolean; + } + + interface StockChartCategoryAxisItemNotesLabelBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface StockChartCategoryAxisItemNotesLabel { + background?: string; + border?: StockChartCategoryAxisItemNotesLabelBorder; + color?: string; + font?: string; + template?: any; + visible?: boolean; + rotation?: number; + format?: string; + position?: string; + } + + interface StockChartCategoryAxisItemNotesLine { + width?: number; + color?: string; + length?: number; + } + + interface StockChartCategoryAxisItemNotes { + position?: string; + icon?: StockChartCategoryAxisItemNotesIcon; + label?: StockChartCategoryAxisItemNotesLabel; + line?: StockChartCategoryAxisItemNotesLine; + data?: StockChartCategoryAxisItemNotesDataItem[]; + } + + interface StockChartCategoryAxisItemPlotBand { + from?: number; + to?: number; + color?: string; + opacity?: number; + } + + interface StockChartCategoryAxisItemSelectMousewheel { + reverse?: boolean; + zoom?: string; + } + + interface StockChartCategoryAxisItemSelect { + from?: any; + to?: any; + min?: any; + max?: any; + mousewheel?: StockChartCategoryAxisItemSelectMousewheel; + } + + interface StockChartCategoryAxisItemTitleBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface StockChartCategoryAxisItemTitle { + background?: string; + border?: StockChartCategoryAxisItemTitleBorder; + color?: string; + font?: string; + margin?: any; + position?: string; + rotation?: number; + text?: string; + visible?: boolean; + } + + interface StockChartCategoryAxisItem { + axisCrossingValue?: any; + categories?: any; + color?: string; + field?: string; + justified?: boolean; + labels?: StockChartCategoryAxisItemLabels; + line?: StockChartCategoryAxisItemLine; + majorGridLines?: StockChartCategoryAxisItemMajorGridLines; + majorTicks?: StockChartCategoryAxisItemMajorTicks; + minorGridLines?: StockChartCategoryAxisItemMinorGridLines; + minorTicks?: StockChartCategoryAxisItemMinorTicks; + name?: string; + pane?: string; + plotBands?: StockChartCategoryAxisItemPlotBand[]; + reverse?: boolean; + select?: StockChartCategoryAxisItemSelect; + title?: StockChartCategoryAxisItemTitle; + type?: string; + autoBaseUnitSteps?: StockChartCategoryAxisItemAutoBaseUnitSteps; + background?: string; + baseUnit?: string; + baseUnitStep?: any; + max?: any; + min?: any; + roundToBaseUnit?: boolean; + weekStartDay?: number; + maxDateGroups?: number; + visible?: boolean; + crosshair?: StockChartCategoryAxisItemCrosshair; + notes?: StockChartCategoryAxisItemNotes; + } + + interface StockChartChartAreaBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface StockChartChartArea { + background?: string; + opacity?: number; + border?: StockChartChartAreaBorder; + height?: number; + margin?: any; + width?: number; + } + + interface StockChartLegendBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface StockChartLegendInactiveItemsLabels { + color?: string; + font?: string; + template?: string; + } + + interface StockChartLegendInactiveItemsMarkers { + color?: string; + } + + interface StockChartLegendInactiveItems { + labels?: StockChartLegendInactiveItemsLabels; + markers?: StockChartLegendInactiveItemsMarkers; + } + + interface StockChartLegendLabels { + color?: string; + font?: string; + template?: string; + } + + interface StockChartLegend { + background?: string; + border?: StockChartLegendBorder; + labels?: StockChartLegendLabels; + margin?: any; + offsetX?: number; + offsetY?: number; + padding?: any; + position?: string; + reverse?: boolean; + visible?: boolean; + inactiveItems?: StockChartLegendInactiveItems; + } + + interface StockChartNavigatorCategoryAxisItemAutoBaseUnitSteps { + seconds?: any; + minutes?: any; + hours?: any; + days?: any; + weeks?: any; + months?: any; + years?: any; + } + + interface StockChartNavigatorCategoryAxisItemCrosshairTooltipBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface StockChartNavigatorCategoryAxisItemCrosshairTooltipPadding { + bottom?: number; + left?: number; + right?: number; + top?: number; + } + + interface StockChartNavigatorCategoryAxisItemCrosshairTooltip { + background?: string; + border?: StockChartNavigatorCategoryAxisItemCrosshairTooltipBorder; + color?: string; + font?: string; + format?: string; + padding?: StockChartNavigatorCategoryAxisItemCrosshairTooltipPadding; + template?: any; + visible?: boolean; + } + + interface StockChartNavigatorCategoryAxisItemCrosshair { + color?: string; + opacity?: number; + tooltip?: StockChartNavigatorCategoryAxisItemCrosshairTooltip; + visible?: boolean; + width?: number; + } + + interface StockChartNavigatorCategoryAxisItemLabelsBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface StockChartNavigatorCategoryAxisItemLabelsDateFormats { + days?: string; + hours?: string; + months?: string; + weeks?: string; + years?: string; + } + + interface StockChartNavigatorCategoryAxisItemLabelsMargin { + bottom?: number; + left?: number; + right?: number; + top?: number; + } + + interface StockChartNavigatorCategoryAxisItemLabelsPadding { + bottom?: number; + left?: number; + right?: number; + top?: number; + } + + interface StockChartNavigatorCategoryAxisItemLabels { + background?: string; + border?: StockChartNavigatorCategoryAxisItemLabelsBorder; + color?: string; + culture?: string; + dateFormats?: StockChartNavigatorCategoryAxisItemLabelsDateFormats; + font?: string; + format?: string; + margin?: StockChartNavigatorCategoryAxisItemLabelsMargin; + mirror?: boolean; + padding?: StockChartNavigatorCategoryAxisItemLabelsPadding; + rotation?: number; + skip?: number; + step?: number; + template?: any; + visible?: boolean; + } + + interface StockChartNavigatorCategoryAxisItemLine { + color?: string; + dashType?: string; + visible?: boolean; + width?: number; + } + + interface StockChartNavigatorCategoryAxisItemMajorGridLines { + color?: string; + dashType?: string; + visible?: boolean; + width?: number; + step?: number; + skip?: number; + } + + interface StockChartNavigatorCategoryAxisItemMajorTicks { + color?: string; + size?: number; + visible?: boolean; + width?: number; + step?: number; + skip?: number; + } + + interface StockChartNavigatorCategoryAxisItemMinorGridLines { + color?: string; + dashType?: string; + visible?: boolean; + width?: number; + step?: number; + skip?: number; + } + + interface StockChartNavigatorCategoryAxisItemMinorTicks { + color?: string; + size?: number; + visible?: boolean; + width?: number; + step?: number; + skip?: number; + } + + interface StockChartNavigatorCategoryAxisItemNotesDataItemIconBorder { + color?: string; + width?: number; + } + + interface StockChartNavigatorCategoryAxisItemNotesDataItemIcon { + background?: string; + border?: StockChartNavigatorCategoryAxisItemNotesDataItemIconBorder; + size?: number; + type?: string; + visible?: boolean; + } + + interface StockChartNavigatorCategoryAxisItemNotesDataItemLabelBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface StockChartNavigatorCategoryAxisItemNotesDataItemLabel { + background?: string; + border?: StockChartNavigatorCategoryAxisItemNotesDataItemLabelBorder; + color?: string; + font?: string; + template?: any; + visible?: boolean; + rotation?: number; + format?: string; + text?: string; + position?: string; + } + + interface StockChartNavigatorCategoryAxisItemNotesDataItemLine { + width?: number; + color?: string; + length?: number; + } + + interface StockChartNavigatorCategoryAxisItemNotesDataItem { + value?: any; + position?: string; + icon?: StockChartNavigatorCategoryAxisItemNotesDataItemIcon; + label?: StockChartNavigatorCategoryAxisItemNotesDataItemLabel; + line?: StockChartNavigatorCategoryAxisItemNotesDataItemLine; + } + + interface StockChartNavigatorCategoryAxisItemNotesIconBorder { + color?: string; + width?: number; + } + + interface StockChartNavigatorCategoryAxisItemNotesIcon { + background?: string; + border?: StockChartNavigatorCategoryAxisItemNotesIconBorder; + size?: number; + type?: string; + visible?: boolean; + } + + interface StockChartNavigatorCategoryAxisItemNotesLabelBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface StockChartNavigatorCategoryAxisItemNotesLabel { + background?: string; + border?: StockChartNavigatorCategoryAxisItemNotesLabelBorder; + color?: string; + font?: string; + template?: any; + visible?: boolean; + rotation?: number; + format?: string; + position?: string; + } + + interface StockChartNavigatorCategoryAxisItemNotesLine { + width?: number; + color?: string; + length?: number; + } + + interface StockChartNavigatorCategoryAxisItemNotes { + position?: string; + icon?: StockChartNavigatorCategoryAxisItemNotesIcon; + label?: StockChartNavigatorCategoryAxisItemNotesLabel; + line?: StockChartNavigatorCategoryAxisItemNotesLine; + data?: StockChartNavigatorCategoryAxisItemNotesDataItem[]; + } + + interface StockChartNavigatorCategoryAxisItemPlotBand { + color?: string; + from?: number; + opacity?: number; + to?: number; + } + + interface StockChartNavigatorCategoryAxisItemTitleBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface StockChartNavigatorCategoryAxisItemTitleMargin { + bottom?: number; + left?: number; + right?: number; + top?: number; + } + + interface StockChartNavigatorCategoryAxisItemTitlePadding { + bottom?: number; + left?: number; + right?: number; + top?: number; + } + + interface StockChartNavigatorCategoryAxisItemTitle { + background?: string; + border?: StockChartNavigatorCategoryAxisItemTitleBorder; + color?: string; + font?: string; + margin?: StockChartNavigatorCategoryAxisItemTitleMargin; + padding?: StockChartNavigatorCategoryAxisItemTitlePadding; + position?: string; + rotation?: number; + text?: string; + visible?: boolean; + } + + interface StockChartNavigatorCategoryAxisItem { + autoBaseUnitSteps?: StockChartNavigatorCategoryAxisItemAutoBaseUnitSteps; + axisCrossingValue?: any; + background?: string; + baseUnit?: string; + baseUnitStep?: any; + categories?: any; + color?: string; + crosshair?: StockChartNavigatorCategoryAxisItemCrosshair; + field?: string; + justified?: boolean; + labels?: StockChartNavigatorCategoryAxisItemLabels; + line?: StockChartNavigatorCategoryAxisItemLine; + majorGridLines?: StockChartNavigatorCategoryAxisItemMajorGridLines; + majorTicks?: StockChartNavigatorCategoryAxisItemMajorTicks; + max?: any; + maxDateGroups?: number; + min?: any; + minorGridLines?: StockChartNavigatorCategoryAxisItemMinorGridLines; + minorTicks?: StockChartNavigatorCategoryAxisItemMinorTicks; + plotBands?: StockChartNavigatorCategoryAxisItemPlotBand[]; + reverse?: boolean; + roundToBaseUnit?: boolean; + title?: StockChartNavigatorCategoryAxisItemTitle; + visible?: boolean; + weekStartDay?: number; + notes?: StockChartNavigatorCategoryAxisItemNotes; + } + + interface StockChartNavigatorHint { + visible?: boolean; + template?: any; + format?: string; + } + + interface StockChartNavigatorPaneBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface StockChartNavigatorPaneMargin { + bottom?: number; + left?: number; + right?: number; + top?: number; + } + + interface StockChartNavigatorPanePadding { + bottom?: number; + left?: number; + right?: number; + top?: number; + } + + interface StockChartNavigatorPaneTitleBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface StockChartNavigatorPaneTitleMargin { + bottom?: number; + left?: number; + right?: number; + top?: number; + } + + interface StockChartNavigatorPaneTitle { + background?: string; + border?: StockChartNavigatorPaneTitleBorder; + color?: string; + font?: string; + margin?: StockChartNavigatorPaneTitleMargin; + position?: string; + text?: string; + visible?: boolean; + } + + interface StockChartNavigatorPane { + background?: string; + border?: StockChartNavigatorPaneBorder; + height?: number; + margin?: StockChartNavigatorPaneMargin; + name?: string; + padding?: StockChartNavigatorPanePadding; + title?: StockChartNavigatorPaneTitle; + } + + interface StockChartNavigatorSelect { + from?: Date; + to?: Date; + } + + interface StockChartNavigatorSeriesItemBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface StockChartNavigatorSeriesItemHighlightBorder { + width?: number; + color?: string; + opacity?: number; + } + + interface StockChartNavigatorSeriesItemHighlightLine { + width?: number; + color?: string; + opacity?: number; + } + + interface StockChartNavigatorSeriesItemHighlight { + border?: StockChartNavigatorSeriesItemHighlightBorder; + color?: string; + line?: StockChartNavigatorSeriesItemHighlightLine; + opacity?: number; + visible?: boolean; + } + + interface StockChartNavigatorSeriesItemLabelsBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface StockChartNavigatorSeriesItemLabels { + background?: string; + border?: StockChartNavigatorSeriesItemLabelsBorder; + color?: string; + font?: string; + format?: string; + margin?: any; + padding?: any; + position?: string; + template?: any; + visible?: boolean; + } + + interface StockChartNavigatorSeriesItemLine { + color?: string; + opacity?: number; + width?: string; + } + + interface StockChartNavigatorSeriesItemMarkersBorder { + color?: string; + width?: number; + } + + interface StockChartNavigatorSeriesItemMarkers { + background?: string; + border?: StockChartNavigatorSeriesItemMarkersBorder; + rotation?: any; + size?: number; + type?: string; + visible?: boolean; + } + + interface StockChartNavigatorSeriesItemOverlay { + gradient?: string; + } + + interface StockChartNavigatorSeriesItemStack { + type?: string; + group?: string; + } + + interface StockChartNavigatorSeriesItemTooltipBorder { + color?: string; + width?: number; + } + + interface StockChartNavigatorSeriesItemTooltip { + background?: string; + border?: StockChartNavigatorSeriesItemTooltipBorder; + color?: string; + font?: string; + format?: string; + padding?: any; + template?: any; + visible?: boolean; + } + + interface StockChartNavigatorSeriesItem { + type?: string; + dashType?: string; + data?: any; + highField?: string; + field?: string; + categoryField?: string; + name?: string; + highlight?: StockChartNavigatorSeriesItemHighlight; + aggregate?: any; + axis?: string; + border?: StockChartNavigatorSeriesItemBorder; + closeField?: string; + color?: string; + colorField?: string; + downColor?: string; + downColorField?: string; + gap?: number; + labels?: StockChartNavigatorSeriesItemLabels; + line?: StockChartNavigatorSeriesItemLine; + lowField?: string; + markers?: StockChartNavigatorSeriesItemMarkers; + missingValues?: string; + style?: string; + opacity?: number; + openField?: string; + overlay?: StockChartNavigatorSeriesItemOverlay; + spacing?: number; + stack?: StockChartNavigatorSeriesItemStack; + tooltip?: StockChartNavigatorSeriesItemTooltip; + width?: number; + } + + interface StockChartNavigator { + categoryAxis?: StockChartNavigatorCategoryAxisItem[]; + dataSource?: any; + autoBind?: boolean; + dateField?: string; + pane?: StockChartNavigatorPane; + visible?: boolean; + series?: StockChartNavigatorSeriesItem[]; + select?: StockChartNavigatorSelect; + hint?: StockChartNavigatorHint; + } + + interface StockChartPaneBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface StockChartPaneTitleBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface StockChartPaneTitle { + background?: string; + border?: StockChartPaneTitleBorder; + color?: string; + font?: string; + margin?: any; + position?: string; + text?: string; + visible?: boolean; + } + + interface StockChartPane { + name?: string; + margin?: any; + padding?: any; + background?: string; + border?: StockChartPaneBorder; + clip?: boolean; + height?: number; + title?: StockChartPaneTitle; + } + + interface StockChartPdfMargin { + bottom?: any; + left?: any; + right?: any; + top?: any; + } + + interface StockChartPdf { + author?: string; + creator?: string; + date?: Date; + forceProxy?: boolean; + fileName?: string; + keywords?: string; + landscape?: boolean; + margin?: StockChartPdfMargin; + paperSize?: any; + proxyURL?: string; + proxyTarget?: string; + subject?: string; + title?: string; + } + + interface StockChartPlotAreaBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface StockChartPlotArea { + background?: string; + opacity?: number; + border?: StockChartPlotAreaBorder; + margin?: any; + } + + interface StockChartSeriesItemBorder { + color?: any; + dashType?: any; + opacity?: any; + width?: any; + } + + interface StockChartSeriesItemHighlightBorder { + width?: number; + color?: string; + opacity?: number; + } + + interface StockChartSeriesItemHighlightLine { + width?: number; + color?: string; + opacity?: number; + } + + interface StockChartSeriesItemHighlight { + visible?: boolean; + border?: StockChartSeriesItemHighlightBorder; + color?: string; + line?: StockChartSeriesItemHighlightLine; + opacity?: number; + } + + interface StockChartSeriesItemLabelsBorder { + color?: any; + dashType?: any; + width?: any; + } + + interface StockChartSeriesItemLabels { + background?: any; + border?: StockChartSeriesItemLabelsBorder; + color?: any; + font?: any; + format?: any; + margin?: any; + padding?: any; + position?: any; + template?: any; + visible?: any; + } + + interface StockChartSeriesItemLine { + color?: string; + opacity?: number; + width?: string; + style?: string; + } + + interface StockChartSeriesItemMarkersBorder { + color?: any; + width?: any; + } + + interface StockChartSeriesItemMarkers { + background?: any; + border?: StockChartSeriesItemMarkersBorder; + size?: any; + rotation?: any; + type?: any; + visible?: any; + } + + interface StockChartSeriesItemNotesIconBorder { + color?: string; + width?: number; + } + + interface StockChartSeriesItemNotesIcon { + background?: string; + border?: StockChartSeriesItemNotesIconBorder; + size?: number; + type?: string; + visible?: boolean; + } + + interface StockChartSeriesItemNotesLabelBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface StockChartSeriesItemNotesLabel { + background?: string; + border?: StockChartSeriesItemNotesLabelBorder; + color?: string; + font?: string; + template?: any; + visible?: boolean; + rotation?: number; + format?: string; + position?: string; + } + + interface StockChartSeriesItemNotesLine { + width?: number; + color?: string; + length?: number; + } + + interface StockChartSeriesItemNotes { + position?: string; + icon?: StockChartSeriesItemNotesIcon; + label?: StockChartSeriesItemNotesLabel; + line?: StockChartSeriesItemNotesLine; + } + + interface StockChartSeriesItemOverlay { + gradient?: string; + } + + interface StockChartSeriesItemStack { + type?: string; + group?: string; + } + + interface StockChartSeriesItemTargetBorder { + color?: any; + dashType?: any; + width?: any; + } + + interface StockChartSeriesItemTargetLine { + width?: any; + } + + interface StockChartSeriesItemTarget { + line?: StockChartSeriesItemTargetLine; + color?: any; + border?: StockChartSeriesItemTargetBorder; + } + + interface StockChartSeriesItemTooltipBorder { + color?: string; + width?: number; + } + + interface StockChartSeriesItemTooltip { + background?: string; + border?: StockChartSeriesItemTooltipBorder; + color?: string; + font?: string; + format?: string; + padding?: any; + template?: any; + visible?: boolean; + } + + interface StockChartSeriesItem { + type?: string; + dashType?: string; + data?: any; + highField?: string; + field?: string; + categoryField?: string; + currentField?: string; + targetField?: string; + name?: string; + highlight?: StockChartSeriesItemHighlight; + aggregate?: any; + axis?: string; + border?: StockChartSeriesItemBorder; + closeField?: string; + color?: any; + colorField?: string; + downColor?: any; + downColorField?: string; + gap?: number; + labels?: StockChartSeriesItemLabels; + line?: StockChartSeriesItemLine; + lowField?: string; + markers?: StockChartSeriesItemMarkers; + missingValues?: string; + style?: string; + negativeColor?: string; + opacity?: number; + openField?: string; + overlay?: StockChartSeriesItemOverlay; + spacing?: number; + stack?: StockChartSeriesItemStack; + tooltip?: StockChartSeriesItemTooltip; + visibleInLegend?: boolean; + width?: number; + target?: StockChartSeriesItemTarget; + notes?: StockChartSeriesItemNotes; + zIndex?: number; + } + + interface StockChartSeriesDefaultsBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface StockChartSeriesDefaultsLabelsBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface StockChartSeriesDefaultsLabels { + background?: string; + border?: StockChartSeriesDefaultsLabelsBorder; + color?: string; + font?: string; + format?: string; + margin?: any; + padding?: any; + template?: any; + visible?: boolean; + } + + interface StockChartSeriesDefaultsStack { + type?: string; + } + + interface StockChartSeriesDefaultsTooltipBorder { + color?: string; + width?: number; + } + + interface StockChartSeriesDefaultsTooltip { + background?: string; + border?: StockChartSeriesDefaultsTooltipBorder; + color?: string; + font?: string; + format?: string; + padding?: any; + template?: any; + visible?: boolean; + } + + interface StockChartSeriesDefaults { + area?: any; + candlestick?: any; + ohlc?: any; + border?: StockChartSeriesDefaultsBorder; + column?: any; + gap?: number; + labels?: StockChartSeriesDefaultsLabels; + line?: any; + overlay?: any; + pie?: any; + spacing?: number; + stack?: StockChartSeriesDefaultsStack; + type?: string; + tooltip?: StockChartSeriesDefaultsTooltip; + } + + interface StockChartTitleBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface StockChartTitle { + align?: string; + background?: string; + border?: StockChartTitleBorder; + font?: string; + color?: string; + margin?: any; + padding?: any; + position?: string; + text?: string; + visible?: boolean; + } + + interface StockChartTooltipBorder { + color?: string; + width?: number; + } + + interface StockChartTooltip { + background?: string; + border?: StockChartTooltipBorder; + color?: string; + font?: string; + format?: string; + padding?: any; + template?: any; + visible?: boolean; + shared?: boolean; + sharedTemplate?: string; + } + + interface StockChartValueAxisItemCrosshairTooltipBorder { + color?: string; + width?: number; + } + + interface StockChartValueAxisItemCrosshairTooltip { + background?: string; + border?: StockChartValueAxisItemCrosshairTooltipBorder; + color?: string; + font?: string; + format?: string; + padding?: any; + template?: any; + visible?: boolean; + } + + interface StockChartValueAxisItemCrosshair { + color?: string; + width?: number; + opacity?: number; + dashType?: number; + visible?: boolean; + tooltip?: StockChartValueAxisItemCrosshairTooltip; + } + + interface StockChartValueAxisItemLabelsBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface StockChartValueAxisItemLabels { + background?: string; + border?: StockChartValueAxisItemLabelsBorder; + color?: string; + font?: string; + format?: string; + margin?: any; + mirror?: boolean; + padding?: any; + rotation?: number; + skip?: number; + step?: number; + template?: any; + visible?: boolean; + } + + interface StockChartValueAxisItemLine { + color?: string; + dashType?: string; + visible?: boolean; + width?: number; + } + + interface StockChartValueAxisItemMajorGridLines { + color?: string; + visible?: boolean; + width?: number; + step?: number; + skip?: number; + } + + interface StockChartValueAxisItemMajorTicks { + size?: number; + visible?: boolean; + color?: string; + width?: number; + step?: number; + skip?: number; + } + + interface StockChartValueAxisItemMinorGridLines { + color?: string; + dashType?: string; + visible?: boolean; + width?: number; + step?: number; + skip?: number; + } + + interface StockChartValueAxisItemMinorTicks { + size?: number; + color?: string; + width?: number; + visible?: boolean; + step?: number; + skip?: number; + } + + interface StockChartValueAxisItemNotesDataItemIconBorder { + color?: string; + width?: number; + } + + interface StockChartValueAxisItemNotesDataItemIcon { + background?: string; + border?: StockChartValueAxisItemNotesDataItemIconBorder; + size?: number; + type?: string; + visible?: boolean; + } + + interface StockChartValueAxisItemNotesDataItemLabelBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface StockChartValueAxisItemNotesDataItemLabel { + background?: string; + border?: StockChartValueAxisItemNotesDataItemLabelBorder; + color?: string; + font?: string; + template?: any; + visible?: boolean; + rotation?: number; + format?: string; + text?: string; + position?: string; + } + + interface StockChartValueAxisItemNotesDataItemLine { + width?: number; + color?: string; + length?: number; + } + + interface StockChartValueAxisItemNotesDataItem { + value?: any; + position?: string; + icon?: StockChartValueAxisItemNotesDataItemIcon; + label?: StockChartValueAxisItemNotesDataItemLabel; + line?: StockChartValueAxisItemNotesDataItemLine; + } + + interface StockChartValueAxisItemNotesIconBorder { + color?: string; + width?: number; + } + + interface StockChartValueAxisItemNotesIcon { + background?: string; + border?: StockChartValueAxisItemNotesIconBorder; + size?: number; + type?: string; + visible?: boolean; + } + + interface StockChartValueAxisItemNotesLabelBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface StockChartValueAxisItemNotesLabel { + background?: string; + border?: StockChartValueAxisItemNotesLabelBorder; + color?: string; + font?: string; + template?: any; + visible?: boolean; + rotation?: number; + format?: string; + position?: string; + } + + interface StockChartValueAxisItemNotesLine { + width?: number; + color?: string; + length?: number; + } + + interface StockChartValueAxisItemNotes { + position?: string; + icon?: StockChartValueAxisItemNotesIcon; + label?: StockChartValueAxisItemNotesLabel; + line?: StockChartValueAxisItemNotesLine; + data?: StockChartValueAxisItemNotesDataItem[]; + } + + interface StockChartValueAxisItemPlotBand { + from?: number; + to?: number; + color?: string; + opacity?: number; + } + + interface StockChartValueAxisItemTitleBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface StockChartValueAxisItemTitle { + background?: string; + border?: StockChartValueAxisItemTitleBorder; + color?: string; + font?: string; + margin?: any; + padding?: any; + position?: string; + rotation?: number; + text?: string; + visible?: boolean; + } + + interface StockChartValueAxisItem { + axisCrossingValue?: any; + background?: string; + color?: string; + labels?: StockChartValueAxisItemLabels; + line?: StockChartValueAxisItemLine; + majorGridLines?: StockChartValueAxisItemMajorGridLines; + majorTicks?: StockChartValueAxisItemMajorTicks; + majorUnit?: number; + max?: number; + min?: number; + minorGridLines?: StockChartValueAxisItemMinorGridLines; + minorTicks?: StockChartValueAxisItemMinorTicks; + minorUnit?: number; + name?: any; + narrowRange?: boolean; + pane?: string; + plotBands?: StockChartValueAxisItemPlotBand[]; + reverse?: boolean; + title?: StockChartValueAxisItemTitle; + visible?: boolean; + crosshair?: StockChartValueAxisItemCrosshair; + notes?: StockChartValueAxisItemNotes; + } + + interface StockChartExportImageOptions { + width?: string; + height?: string; + } + + interface StockChartExportSVGOptions { + raw?: boolean; + } + + interface StockChartSeriesClickEventSeries { + type?: any; + name?: any; + data?: any; + } + + interface StockChartSeriesHoverEventSeries { + type?: any; + name?: any; + data?: any; + } + + interface StockChartOptions { + name?: string; + dateField?: string; + navigator?: StockChartNavigator; + axisDefaults?: any; + categoryAxis?: StockChartCategoryAxisItem[]; + chartArea?: StockChartChartArea; + dataSource?: any; + autoBind?: boolean; + legend?: StockChartLegend; + panes?: StockChartPane[]; + pdf?: StockChartPdf; + plotArea?: StockChartPlotArea; + renderAs?: string; + series?: StockChartSeriesItem[]; + seriesColors?: any; + seriesDefaults?: StockChartSeriesDefaults; + theme?: string; + title?: StockChartTitle; + tooltip?: StockChartTooltip; + transitions?: boolean; + valueAxis?: StockChartValueAxisItem[]; + axisLabelClick?(e: StockChartAxisLabelClickEvent): void; + legendItemClick?(e: StockChartLegendItemClickEvent): void; + legendItemHover?(e: StockChartLegendItemHoverEvent): void; + dataBound?(e: StockChartEvent): void; + dragStart?(e: StockChartDragStartEvent): void; + drag?(e: StockChartDragEvent): void; + dragEnd?(e: StockChartDragEndEvent): void; + noteClick?(e: StockChartNoteClickEvent): void; + noteHover?(e: StockChartNoteHoverEvent): void; + plotAreaClick?(e: StockChartPlotAreaClickEvent): void; + render?(e: StockChartEvent): void; + seriesClick?(e: StockChartSeriesClickEvent): void; + seriesHover?(e: StockChartSeriesHoverEvent): void; + zoomStart?(e: StockChartZoomStartEvent): void; + zoom?(e: StockChartZoomEvent): void; + zoomEnd?(e: StockChartZoomEndEvent): void; + selectStart?(e: StockChartSelectStartEvent): void; + select?(e: StockChartSelectEvent): void; + selectEnd?(e: StockChartSelectEndEvent): void; + } + interface StockChartEvent { + sender: StockChart; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + interface StockChartAxisLabelClickEvent extends StockChartEvent { + axis?: any; + value?: any; + text?: any; + index?: any; + dataItem?: any; + element?: any; + } + + interface StockChartLegendItemClickEvent extends StockChartEvent { + text?: string; + series?: any; + seriesIndex?: number; + pointIndex?: number; + element?: any; + } + + interface StockChartLegendItemHoverEvent extends StockChartEvent { + text?: string; + series?: any; + seriesIndex?: number; + pointIndex?: number; + element?: any; + } + + interface StockChartDragStartEvent extends StockChartEvent { + axisRanges?: any; + originalEvent?: any; + } + + interface StockChartDragEvent extends StockChartEvent { + axisRanges?: any; + originalEvent?: any; + } + + interface StockChartDragEndEvent extends StockChartEvent { + axisRanges?: any; + originalEvent?: any; + } + + interface StockChartNoteClickEvent extends StockChartEvent { + category?: any; + element?: any; + value?: any; + series?: any; + dataItem?: any; + } + + interface StockChartNoteHoverEvent extends StockChartEvent { + category?: any; + element?: any; + value?: any; + series?: any; + dataItem?: any; + } + + interface StockChartPlotAreaClickEvent extends StockChartEvent { + value?: any; + category?: any; + element?: any; + x?: any; + y?: any; + } + + interface StockChartSeriesClickEvent extends StockChartEvent { + value?: any; + category?: any; + series?: StockChartSeriesClickEventSeries; + dataItem?: any; + element?: any; + percentage?: any; + } + + interface StockChartSeriesHoverEvent extends StockChartEvent { + value?: any; + category?: any; + series?: StockChartSeriesHoverEventSeries; + dataItem?: any; + element?: any; + percentage?: any; + } + + interface StockChartZoomStartEvent extends StockChartEvent { + axisRanges?: any; + originalEvent?: any; + } + + interface StockChartZoomEvent extends StockChartEvent { + axisRanges?: any; + delta?: number; + originalEvent?: any; + } + + interface StockChartZoomEndEvent extends StockChartEvent { + axisRanges?: any; + originalEvent?: any; + } + + interface StockChartSelectStartEvent extends StockChartEvent { + axis?: any; + from?: any; + to?: any; + } + + interface StockChartSelectEvent extends StockChartEvent { + axis?: any; + from?: any; + to?: any; + } + + interface StockChartSelectEndEvent extends StockChartEvent { + axis?: any; + from?: any; + to?: any; + } + + + class TreeMap extends kendo.ui.Widget { + static fn: TreeMap; + static extend(proto: Object): TreeMap; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: TreeMapOptions); + options: TreeMapOptions; + dataSource: kendo.data.DataSource; + } + + interface TreeMapOptions { + name?: string; + dataSource?: any; + autoBind?: boolean; + type?: string; + theme?: string; + valueField?: string; + colorField?: string; + textField?: string; + template?: any; + colors?: any; + itemCreated?(e: TreeMapItemCreatedEvent): void; + dataBound?(e: TreeMapDataBoundEvent): void; + } + interface TreeMapEvent { + sender: TreeMap; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + interface TreeMapItemCreatedEvent extends TreeMapEvent { + element?: any; + } + + interface TreeMapDataBoundEvent extends TreeMapEvent { + } + + +} +declare module kendo.dataviz { + class ChartAxis extends Observable { + options: ChartAxisOptions; + range(): any; + slot(from: string, to?: string): kendo.geometry.Rect; + slot(from: string, to?: number): kendo.geometry.Rect; + slot(from: string, to?: Date): kendo.geometry.Rect; + slot(from: number, to?: string): kendo.geometry.Rect; + slot(from: number, to?: number): kendo.geometry.Rect; + slot(from: number, to?: Date): kendo.geometry.Rect; + slot(from: Date, to?: string): kendo.geometry.Rect; + slot(from: Date, to?: number): kendo.geometry.Rect; + slot(from: Date, to?: Date): kendo.geometry.Rect; + } + + interface ChartAxisOptions { + name?: string; + } + interface ChartAxisEvent { + sender: ChartAxis; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + +} +declare module kendo.dataviz.diagram { + class Circle extends Observable { + constructor(options?: CircleOptions); + options: CircleOptions; + visible(): boolean; + visible(visible: boolean): void; + } + + interface CircleFill { + color?: string; + opacity?: number; + } + + interface CircleStroke { + color?: string; + width?: number; + } + + interface CircleOptions { + name?: string; + fill?: CircleFill; + stroke?: CircleStroke; + center?: any; + radius?: number; + } + interface CircleEvent { + sender: Circle; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + class Connection extends Observable { + constructor(options?: ConnectionOptions); + options: ConnectionOptions; + source(): any; + source(source: kendo.dataviz.diagram.Shape): void; + source(source: kendo.dataviz.diagram.Point): void; + source(source: kendo.dataviz.diagram.Connector): void; + sourcePoint(): kendo.dataviz.diagram.Point; + target(): any; + target(target: kendo.dataviz.diagram.Shape): void; + target(target: kendo.dataviz.diagram.Point): void; + target(target: kendo.dataviz.diagram.Connector): void; + targetPoint(): kendo.dataviz.diagram.Point; + select(value: boolean): void; + type(): void; + type(value: string): void; + points(): any; + allPoints(): any; + redraw(): void; + } + + interface ConnectionEndCapFill { + color?: string; + } + + interface ConnectionEndCapStroke { + color?: string; + dashType?: string; + width?: number; + } + + interface ConnectionEndCap { + fill?: ConnectionEndCapFill; + stroke?: ConnectionEndCapStroke; + type?: string; + } + + interface ConnectionHoverStroke { + color?: string; + } + + interface ConnectionHover { + stroke?: ConnectionHoverStroke; + } + + interface ConnectionPoint { + x?: number; + y?: number; + } + + interface ConnectionStartCapFill { + color?: string; + } + + interface ConnectionStartCapStroke { + color?: string; + dashType?: string; + width?: number; + } + + interface ConnectionStartCap { + fill?: ConnectionStartCapFill; + stroke?: ConnectionStartCapStroke; + type?: string; + } + + interface ConnectionStroke { + color?: string; + } + + interface ConnectionOptions { + name?: string; + stroke?: ConnectionStroke; + hover?: ConnectionHover; + startCap?: ConnectionStartCap; + endCap?: ConnectionEndCap; + points?: ConnectionPoint[]; + selectable?: boolean; + } + interface ConnectionEvent { + sender: Connection; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + class Connector extends Observable { + constructor(options?: ConnectorOptions); + options: ConnectorOptions; + position(): kendo.dataviz.diagram.Point; + position(position: kendo.dataviz.diagram.Point): void; + } + + interface ConnectorFill { + color?: string; + opacity?: number; + } + + interface ConnectorOptions { + name?: string; + width?: number; + height?: number; + fill?: ConnectorFill; + } + interface ConnectorEvent { + sender: Connector; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + class Group extends Observable { + constructor(options?: GroupOptions); + options: GroupOptions; + append(element: any): void; + clear(): void; + remove(element: any): void; + visible(): boolean; + visible(visible: boolean): void; + } + + interface GroupOptions { + name?: string; + x?: number; + y?: number; + } + interface GroupEvent { + sender: Group; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + class Image extends Observable { + constructor(options?: ImageOptions); + options: ImageOptions; + visible(): boolean; + visible(visible: boolean): void; + } + + interface ImageOptions { + name?: string; + height?: number; + width?: number; + x?: number; + y?: number; + source?: string; + } + interface ImageEvent { + sender: Image; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + class Line extends Observable { + constructor(options?: LineOptions); + options: LineOptions; + visible(): boolean; + visible(visible: boolean): void; + } + + interface LineStroke { + color?: string; + width?: number; + } + + interface LineOptions { + name?: string; + stroke?: LineStroke; + from?: any; + to?: any; + } + interface LineEvent { + sender: Line; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + class Point extends Observable { + constructor(options?: PointOptions); + options: PointOptions; + } + + interface PointOptions { + name?: string; + x?: number; + y?: number; + } + interface PointEvent { + sender: Point; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + class Rect extends Observable { + constructor(options?: RectOptions); + options: RectOptions; + } + + interface RectOptions { + name?: string; + height?: number; + width?: number; + x?: number; + y?: number; + } + interface RectEvent { + sender: Rect; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + class Rectangle extends Observable { + constructor(options?: RectangleOptions); + options: RectangleOptions; + visible(): boolean; + visible(visible: boolean): void; + } + + interface RectangleFill { + color?: string; + opacity?: number; + } + + interface RectangleStroke { + color?: string; + width?: number; + } + + interface RectangleOptions { + name?: string; + fill?: RectangleFill; + height?: number; + stroke?: RectangleStroke; + width?: number; + x?: number; + y?: number; + } + interface RectangleEvent { + sender: Rectangle; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + class Shape extends Observable { + constructor(options?: ShapeOptions); + options: ShapeOptions; + position(): void; + position(point: kendo.dataviz.diagram.Point): void; + clone(): kendo.dataviz.diagram.Shape; + select(value: boolean): void; + connections(type: string): void; + getConnector(): void; + getPosition(side: string): void; + redraw(): void; + } + + interface ShapeConnector { + name?: string; + description?: string; + position?: Function; + } + + interface ShapeContent { + text?: string; + align?: string; + } + + interface ShapeEditable { + connect?: boolean; + } + + interface ShapeFill { + color?: string; + opacity?: number; + } + + interface ShapeHoverFill { + color?: string; + opacity?: number; + } + + interface ShapeHover { + fill?: ShapeHoverFill; + } + + interface ShapeRotation { + angle?: number; + } + + interface ShapeStroke { + color?: string; + width?: number; + dashType?: string; + } + + interface ShapeOptions { + name?: string; + id?: string; + editable?: ShapeEditable; + path?: string; + stroke?: ShapeStroke; + type?: string; + x?: number; + y?: number; + minWidth?: number; + minHeight?: number; + width?: number; + height?: number; + fill?: ShapeFill; + hover?: ShapeHover; + connectors?: ShapeConnector[]; + rotation?: ShapeRotation; + content?: ShapeContent; + selectable?: boolean; + visual?: Function; + } + interface ShapeEvent { + sender: Shape; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + class TextBlock extends Observable { + constructor(options?: TextBlockOptions); + options: TextBlockOptions; + content(): string; + content(content: string): void; + visible(): boolean; + visible(visible: boolean): void; + } + + interface TextBlockOptions { + name?: string; + color?: string; + fontFamily?: string; + fontSize?: number; + height?: number; + text?: string; + width?: number; + x?: number; + y?: number; + } + interface TextBlockEvent { + sender: TextBlock; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + +} +declare module kendo { + class Color extends Observable { + options: ColorOptions; + diff(): number; + equals(): boolean; + } + + interface ColorOptions { + name?: string; + } + interface ColorEvent { + sender: Color; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + module drawing { + function align(elements: any, rect: kendo.geometry.Rect, alignment: string): void; + function drawDOM(element: HTMLElement): JQueryPromise; + function exportImage(group: kendo.drawing.Group, options: any): JQueryPromise; + function exportPDF(group: kendo.drawing.Group, options: kendo.drawing.PDFOptions): JQueryPromise; + function exportSVG(group: kendo.drawing.Group, options: any): JQueryPromise; + function fit(element: kendo.drawing.Element, rect: kendo.geometry.Rect): void; + function stack(elements: any): void; + function vAlign(elements: any, rect: kendo.geometry.Rect, alignment: string): void; + function vStack(elements: any): void; + function vWrap(elements: any, rect: kendo.geometry.Rect): any; + function wrap(elements: any, rect: kendo.geometry.Rect): any; + } + + module effects { + function box(element: HTMLElement): any; + function fillScale(firstElement: HTMLElement, secondElement: HTMLElement): number; + function fitScale(firstElement: HTMLElement, secondElement: HTMLElement): number; + function transformOrigin(firstElement: HTMLElement, secondElement: HTMLElement): any; + } + + function bind(element: string, viewModel: any, namespace?: any): void; + function bind(element: string, viewModel: kendo.data.ObservableObject, namespace?: any): void; + function bind(element: JQuery, viewModel: any, namespace?: any): void; + function bind(element: JQuery, viewModel: kendo.data.ObservableObject, namespace?: any): void; + function bind(element: Element, viewModel: any, namespace?: any): void; + function bind(element: Element, viewModel: kendo.data.ObservableObject, namespace?: any): void; + function observableHierarchy(array: any): void; + function culture(culture: string): void; + function destroy(element: string): void; + function destroy(element: JQuery): void; + function destroy(element: Element): void; + function htmlEncode(value: string): string; + function parseDate(value: string, formats?: string, culture?: string): Date; + function parseDate(value: string, formats?: any, culture?: string): Date; + function parseFloat(value: string, culture?: string): number; + function parseInt(value: string, culture?: string): number; + function parseColor(color: string, noerror: boolean): kendo.Color; + function resize(element: string, force: boolean): void; + function resize(element: JQuery, force: boolean): void; + function resize(element: Element, force: boolean): void; + function saveAs(options: any): void; + function stringify(value: any): string; + function throttle(fn: Function, timeout: number): void; + function touchScroller(element: string): void; + function touchScroller(element: JQuery): void; + function touchScroller(element: Element): void; + function toString(value: Date, format: string, culture?: string): string; + function toString(value: number, format: string, culture?: string): string; + function unbind(element: string): void; + function unbind(element: JQuery): void; + function unbind(element: Element): void; + +} +declare module kendo.dataviz.map { + class Extent extends kendo.Class { + options: ExtentOptions; + contains(location: kendo.dataviz.map.Location): boolean; + containsAny(locations: any): boolean; + center(): kendo.dataviz.map.Location; + include(location: kendo.dataviz.map.Location): void; + includeAll(locations: any): void; + edges(): any; + toArray(): any; + overlaps(extent: kendo.dataviz.map.Extent): boolean; + static create(a: kendo.dataviz.map.Location, b?: kendo.dataviz.map.Location): kendo.dataviz.map.Extent; + static create(a: kendo.dataviz.map.Location, b?: any): kendo.dataviz.map.Extent; + static create(a: any, b?: kendo.dataviz.map.Location): kendo.dataviz.map.Extent; + static create(a: any, b?: any): kendo.dataviz.map.Extent; + nw: kendo.dataviz.map.Location; + se: kendo.dataviz.map.Location; + } + + interface ExtentOptions { + name?: string; + } + interface ExtentEvent { + sender: Extent; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + class Layer extends kendo.Class { + options: LayerOptions; + show(): void; + hide(): void; + map: kendo.dataviz.ui.Map; + } + + interface LayerOptions { + name?: string; + } + interface LayerEvent { + sender: Layer; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + class Location extends kendo.Class { + options: LocationOptions; + clone(): kendo.dataviz.map.Location; + destination(destination: kendo.dataviz.map.Location): number; + distanceTo(distance: number, bearing: number): kendo.dataviz.map.Location; + equals(location: kendo.dataviz.map.Location): boolean; + round(digits: number): kendo.dataviz.map.Location; + toArray(): any; + toString(): string; + wrap(): kendo.dataviz.map.Location; + static create(lat: number, lng?: number): kendo.dataviz.map.Location; + static create(lat: any, lng?: number): kendo.dataviz.map.Location; + static create(lat: kendo.dataviz.map.Location, lng?: number): kendo.dataviz.map.Location; + static fromLngLat(lnglat: any): kendo.dataviz.map.Location; + static fromLatLng(lnglat: any): kendo.dataviz.map.Location; + lat: number; + lng: number; + } + + interface LocationOptions { + name?: string; + } + interface LocationEvent { + sender: Location; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + +} +declare module kendo.mobile.ui { + class ActionSheet extends kendo.mobile.ui.Widget { + static fn: ActionSheet; + static extend(proto: Object): ActionSheet; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: ActionSheetOptions); + options: ActionSheetOptions; + close(): void; + destroy(): void; + open(target: JQuery, context: any): void; + } + + interface ActionSheetPopup { + direction?: any; + height?: any; + width?: any; + } + + interface ActionSheetOptions { + name?: string; + cancel?: string; + popup?: ActionSheetPopup; + type?: string; + close?(e: ActionSheetEvent): void; + open?(e: ActionSheetOpenEvent): void; + } + interface ActionSheetEvent { + sender: ActionSheet; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + interface ActionSheetOpenEvent extends ActionSheetEvent { + target?: JQuery; + context?: JQuery; + } + + + class BackButton extends kendo.mobile.ui.Widget { + static fn: BackButton; + static extend(proto: Object): BackButton; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: BackButtonOptions); + options: BackButtonOptions; + destroy(): void; + } + + interface BackButtonOptions { + name?: string; + click?(e: BackButtonClickEvent): void; + } + interface BackButtonEvent { + sender: BackButton; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + interface BackButtonClickEvent extends BackButtonEvent { + target?: JQuery; + button?: JQuery; + } + + + class Button extends kendo.mobile.ui.Widget { + static fn: Button; + static extend(proto: Object): Button; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: ButtonOptions); + options: ButtonOptions; + badge(value: string): string; + badge(value: boolean): string; + destroy(): void; + enable(enable: boolean): void; + } + + interface ButtonOptions { + name?: string; + badge?: string; + clickOn?: string; + enable?: boolean; + icon?: string; + click?(e: ButtonClickEvent): void; + } + interface ButtonEvent { + sender: Button; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + interface ButtonClickEvent extends ButtonEvent { + target?: JQuery; + button?: JQuery; + } + + + class ButtonGroup extends kendo.mobile.ui.Widget { + static fn: ButtonGroup; + static extend(proto: Object): ButtonGroup; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: ButtonGroupOptions); + options: ButtonGroupOptions; + badge(button: string, value: string): string; + badge(button: string, value: boolean): string; + badge(button: number, value: string): string; + badge(button: number, value: boolean): string; + current(): JQuery; + destroy(): void; + enable(enable: boolean): void; + select(li: JQuery): void; + select(li: number): void; + } + + interface ButtonGroupOptions { + name?: string; + enable?: boolean; + index?: number; + selectOn?: string; + select?(e: ButtonGroupSelectEvent): void; + } + interface ButtonGroupEvent { + sender: ButtonGroup; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + interface ButtonGroupSelectEvent extends ButtonGroupEvent { + index?: number; + } + + + class Collapsible extends kendo.mobile.ui.Widget { + static fn: Collapsible; + static extend(proto: Object): Collapsible; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: CollapsibleOptions); + options: CollapsibleOptions; + collapse(instant: boolean): void; + destroy(): void; + expand(instant?: boolean): void; + resize(): void; + toggle(instant?: boolean): void; + } + + interface CollapsibleOptions { + name?: string; + animation?: boolean; + collapsed?: boolean; + expandIcon?: string; + iconPosition?: string; + inset?: boolean; + collapse?(e: CollapsibleEvent): void; + expand?(e: CollapsibleEvent): void; + } + interface CollapsibleEvent { + sender: Collapsible; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + class DetailButton extends kendo.mobile.ui.Widget { + static fn: DetailButton; + static extend(proto: Object): DetailButton; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: DetailButtonOptions); + options: DetailButtonOptions; + destroy(): void; + } + + interface DetailButtonOptions { + name?: string; + click?(e: DetailButtonClickEvent): void; + } + interface DetailButtonEvent { + sender: DetailButton; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + interface DetailButtonClickEvent extends DetailButtonEvent { + target?: JQuery; + button?: JQuery; + } + + + class Drawer extends kendo.mobile.ui.Widget { + static fn: Drawer; + static extend(proto: Object): Drawer; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: DrawerOptions); + options: DrawerOptions; + destroy(): void; + hide(): void; + show(): void; + } + + interface DrawerOptions { + name?: string; + container?: JQuery; + position?: string; + swipeToOpen?: boolean; + swipeToOpenViews?: any; + title?: string; + views?: any; + afterHide?(e: DrawerAfterHideEvent): void; + beforeShow?(e: DrawerEvent): void; + hide?(e: DrawerHideEvent): void; + init?(e: DrawerInitEvent): void; + show?(e: DrawerShowEvent): void; + } + interface DrawerEvent { + sender: Drawer; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + interface DrawerAfterHideEvent extends DrawerEvent { + } + + interface DrawerHideEvent extends DrawerEvent { + } + + interface DrawerInitEvent extends DrawerEvent { + } + + interface DrawerShowEvent extends DrawerEvent { + } + + + class Layout extends kendo.mobile.ui.Widget { + static fn: Layout; + static extend(proto: Object): Layout; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: LayoutOptions); + options: LayoutOptions; + } + + interface LayoutOptions { + name?: string; + id?: string; + platform?: string; + hide?(e: LayoutHideEvent): void; + init?(e: LayoutInitEvent): void; + show?(e: LayoutShowEvent): void; + } + interface LayoutEvent { + sender: Layout; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + interface LayoutHideEvent extends LayoutEvent { + layout?: JQuery; + view?: JQuery; + } + + interface LayoutInitEvent extends LayoutEvent { + layout?: JQuery; + } + + interface LayoutShowEvent extends LayoutEvent { + layout?: JQuery; + view?: JQuery; + } + + + class ListView extends kendo.mobile.ui.Widget { + static fn: ListView; + static extend(proto: Object): ListView; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: ListViewOptions); + options: ListViewOptions; + dataSource: kendo.data.DataSource; + append(dataItems: any): void; + prepend(dataItems: any): void; + replace(dataItems: any): void; + remove(dataItems: any): void; + setDataItem(item: JQuery, dataItem: kendo.data.Model): void; + destroy(): void; + items(): JQuery; + refresh(): void; + setDataSource(dataSource: kendo.data.DataSource): void; + } + + interface ListViewFilterable { + placeholder?: string; + autoFilter?: boolean; + field?: string; + ignoreCase?: boolean; + operator?: string; + } + + interface ListViewMessages { + loadMoreText?: string; + pullTemplate?: string; + refreshTemplate?: string; + releaseTemplate?: string; + } + + interface ListViewOptions { + name?: string; + appendOnRefresh?: boolean; + autoBind?: boolean; + dataSource?: any; + endlessScroll?: boolean; + fixedHeaders?: boolean; + headerTemplate?: any; + loadMore?: boolean; + messages?: ListViewMessages; + pullToRefresh?: boolean; + pullParameters?: Function; + style?: string; + template?: any; + type?: string; + filterable?: ListViewFilterable; + virtualViewSize?: number; + click?(e: ListViewClickEvent): void; + dataBound?(e: ListViewEvent): void; + dataBinding?(e: ListViewEvent): void; + itemChange?(e: ListViewEvent): void; + } + interface ListViewEvent { + sender: ListView; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + interface ListViewClickEvent extends ListViewEvent { + item?: JQuery; + target?: JQuery; + dataItem?: any; + button?: kendo.mobile.ui.Button; + } + + + class Loader extends kendo.mobile.ui.Widget { + static fn: Loader; + static extend(proto: Object): Loader; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: LoaderOptions); + options: LoaderOptions; + hide(): void; + show(): void; + } + + interface LoaderOptions { + name?: string; + } + interface LoaderEvent { + sender: Loader; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + class ModalView extends kendo.mobile.ui.Widget { + static fn: ModalView; + static extend(proto: Object): ModalView; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: ModalViewOptions); + options: ModalViewOptions; + close(): void; + destroy(): void; + open(target: JQuery): void; + } + + interface ModalViewOptions { + name?: string; + height?: number; + modal?: boolean; + width?: number; + beforeOpen?(e: ModalViewBeforeOpenEvent): void; + close?(e: ModalViewCloseEvent): void; + init?(e: ModalViewInitEvent): void; + open?(e: ModalViewOpenEvent): void; + } + interface ModalViewEvent { + sender: ModalView; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + interface ModalViewBeforeOpenEvent extends ModalViewEvent { + target?: JQuery; + } + + interface ModalViewCloseEvent extends ModalViewEvent { + } + + interface ModalViewInitEvent extends ModalViewEvent { + } + + interface ModalViewOpenEvent extends ModalViewEvent { + target?: JQuery; + } + + + class NavBar extends kendo.mobile.ui.Widget { + static fn: NavBar; + static extend(proto: Object): NavBar; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: NavBarOptions); + options: NavBarOptions; + destroy(): void; + title(value: string): void; + } + + interface NavBarOptions { + name?: string; + } + interface NavBarEvent { + sender: NavBar; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + class Pane extends kendo.mobile.ui.Widget { + static fn: Pane; + static extend(proto: Object): Pane; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: PaneOptions); + options: PaneOptions; + destroy(): void; + hideLoading(): void; + navigate(url: string, transition: string): void; + replace(url: string, transition: string): void; + Example(): void; + showLoading(): void; + view(): kendo.mobile.ui.View; + } + + interface PaneOptions { + name?: string; + collapsible?: boolean; + initial?: string; + layout?: string; + loading?: string; + portraitWidth?: number; + transition?: string; + navigate?(e: PaneNavigateEvent): void; + viewShow?(e: PaneViewShowEvent): void; + } + interface PaneEvent { + sender: Pane; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + interface PaneNavigateEvent extends PaneEvent { + url?: JQuery; + } + + interface PaneViewShowEvent extends PaneEvent { + view?: kendo.mobile.ui.View; + } + + + class PopOver extends kendo.mobile.ui.Widget { + static fn: PopOver; + static extend(proto: Object): PopOver; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: PopOverOptions); + options: PopOverOptions; + close(): void; + destroy(): void; + open(target: JQuery): void; + } + + interface PopOverPane { + initial?: string; + layout?: string; + loading?: string; + transition?: string; + } + + interface PopOverPopup { + height?: any; + width?: any; + } + + interface PopOverOptions { + name?: string; + pane?: PopOverPane; + popup?: PopOverPopup; + close?(e: PopOverCloseEvent): void; + open?(e: PopOverOpenEvent): void; + } + interface PopOverEvent { + sender: PopOver; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + interface PopOverCloseEvent extends PopOverEvent { + } + + interface PopOverOpenEvent extends PopOverEvent { + target?: JQuery; + } + + + class ScrollView extends kendo.mobile.ui.Widget { + static fn: ScrollView; + static extend(proto: Object): ScrollView; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: ScrollViewOptions); + options: ScrollViewOptions; + dataSource: kendo.data.DataSource; + content(content: string): void; + content(content: JQuery): void; + destroy(): void; + next(): void; + prev(): void; + refresh(): void; + scrollTo(page: number, instant: boolean): void; + setDataSource(dataSource: kendo.data.DataSource): void; + value(dataItem: any): any; + } + + interface ScrollViewOptions { + name?: string; + autoBind?: boolean; + bounceVelocityThreshold?: number; + contentHeight?: any; + dataSource?: any; + duration?: number; + emptyTemplate?: string; + enablePager?: boolean; + itemsPerPage?: number; + page?: number; + pageSize?: number; + template?: string; + velocityThreshold?: number; + changing?(e: ScrollViewChangingEvent): void; + change?(e: ScrollViewChangeEvent): void; + refresh?(e: ScrollViewRefreshEvent): void; + } + interface ScrollViewEvent { + sender: ScrollView; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + interface ScrollViewChangingEvent extends ScrollViewEvent { + currentPage?: number; + nextPage?: number; + } + + interface ScrollViewChangeEvent extends ScrollViewEvent { + page?: number; + element?: JQuery; + data?: any; + } + + interface ScrollViewRefreshEvent extends ScrollViewEvent { + pageCount?: number; + page?: number; + } + + + class Scroller extends kendo.mobile.ui.Widget { + static fn: Scroller; + static extend(proto: Object): Scroller; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: ScrollerOptions); + options: ScrollerOptions; + animatedScrollTo(x: number, y: number): void; + destroy(): void; + disable(): void; + enable(): void; + height(): number; + pullHandled(): void; + reset(): void; + scrollHeight(): void; + scrollTo(x: number, y: number): void; + scrollWidth(): void; + zoomOut(): void; + } + + interface ScrollerMessages { + pullTemplate?: string; + refreshTemplate?: string; + releaseTemplate?: string; + } + + interface ScrollerOptions { + name?: string; + elastic?: boolean; + messages?: ScrollerMessages; + pullOffset?: number; + pullToRefresh?: boolean; + useNative?: boolean; + visibleScrollHints?: boolean; + zoom?: boolean; + pull?(e: ScrollerEvent): void; + resize?(e: ScrollerEvent): void; + scroll?(e: ScrollerScrollEvent): void; + } + interface ScrollerEvent { + sender: Scroller; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + interface ScrollerScrollEvent extends ScrollerEvent { + scrollTop?: number; + scrollLeft?: number; + } + + + class SplitView extends kendo.mobile.ui.Widget { + static fn: SplitView; + static extend(proto: Object): SplitView; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: SplitViewOptions); + options: SplitViewOptions; + destroy(): void; + expandPanes(): void; + collapsePanes(): void; + } + + interface SplitViewOptions { + name?: string; + style?: string; + init?(e: SplitViewInitEvent): void; + show?(e: SplitViewShowEvent): void; + } + interface SplitViewEvent { + sender: SplitView; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + interface SplitViewInitEvent extends SplitViewEvent { + view?: JQuery; + } + + interface SplitViewShowEvent extends SplitViewEvent { + view?: JQuery; + } + + + class Switch extends kendo.mobile.ui.Widget { + static fn: Switch; + static extend(proto: Object): Switch; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: SwitchOptions); + options: SwitchOptions; + check(): boolean; + check(check: boolean): void; + destroy(): void; + enable(enable: boolean): void; + refresh(): void; + toggle(): void; + } + + interface SwitchOptions { + name?: string; + checked?: boolean; + enable?: boolean; + offLabel?: string; + onLabel?: string; + change?(e: SwitchChangeEvent): void; + } + interface SwitchEvent { + sender: Switch; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + interface SwitchChangeEvent extends SwitchEvent { + checked?: any; + } + + + class TabStrip extends kendo.mobile.ui.Widget { + static fn: TabStrip; + static extend(proto: Object): TabStrip; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: TabStripOptions); + options: TabStripOptions; + badge(tab: string, value: string): string; + badge(tab: string, value: boolean): string; + badge(tab: number, value: string): string; + badge(tab: number, value: boolean): string; + currentItem(): JQuery; + destroy(): void; + switchTo(url: string): void; + switchTo(url: number): void; + switchByFullUrl(url: string): void; + clear(): void; + } + + interface TabStripOptions { + name?: string; + selectedIndex?: number; + select?(e: TabStripSelectEvent): void; + } + interface TabStripEvent { + sender: TabStrip; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + interface TabStripSelectEvent extends TabStripEvent { + item?: JQuery; + } + + + class View extends kendo.mobile.ui.Widget { + static fn: View; + static extend(proto: Object): View; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: ViewOptions); + options: ViewOptions; + contentElement(): void; + destroy(): void; + enable(enable: boolean): void; + } + + interface ViewOptions { + name?: string; + model?: string; + reload?: boolean; + scroller?: any; + stretch?: boolean; + title?: string; + useNativeScrolling?: boolean; + zoom?: boolean; + afterShow?(e: ViewAfterShowEvent): void; + beforeHide?(e: ViewBeforeHideEvent): void; + beforeShow?(e: ViewBeforeShowEvent): void; + hide?(e: ViewHideEvent): void; + init?(e: ViewInitEvent): void; + show?(e: ViewShowEvent): void; + transitionStart?(e: ViewTransitionStartEvent): void; + transitionEnd?(e: ViewTransitionEndEvent): void; + } + interface ViewEvent { + sender: View; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + interface ViewAfterShowEvent extends ViewEvent { + view?: kendo.mobile.ui.View; + } + + interface ViewBeforeHideEvent extends ViewEvent { + view?: kendo.mobile.ui.View; + } + + interface ViewBeforeShowEvent extends ViewEvent { + view?: kendo.mobile.ui.View; + } + + interface ViewHideEvent extends ViewEvent { + view?: kendo.mobile.ui.View; + } + + interface ViewInitEvent extends ViewEvent { + view?: kendo.mobile.ui.View; + } + + interface ViewShowEvent extends ViewEvent { + view?: kendo.mobile.ui.View; + } + + interface ViewTransitionStartEvent extends ViewEvent { + type?: string; + } + + interface ViewTransitionEndEvent extends ViewEvent { + type?: string; + } + + +} +declare module kendo.ooxml { + class Workbook extends Observable { + constructor(options?: WorkbookOptions); + options: WorkbookOptions; + toDataURL(): string; + sheets: WorkbookSheet[]; + } + + interface WorkbookSheetColumn { + autoWidth?: boolean; + width?: number; + } + + interface WorkbookSheetFilter { + from?: number; + to?: number; + } + + interface WorkbookSheetFreezePane { + colSplit?: number; + rowSplit?: number; + } + + interface WorkbookSheetRowCell { + background?: string; + bold?: boolean; + color?: string; + colSpan?: number; + fontName?: string; + fontSize?: number; + format?: string; + hAlign?: string; + italic?: boolean; + rowSpan?: number; + underline?: boolean; + wrap?: boolean; + vAlign?: string; + value?: any; + } + + interface WorkbookSheetRow { + cells?: WorkbookSheetRowCell[]; + } + + interface WorkbookSheet { + columns?: WorkbookSheetColumn[]; + freezePane?: WorkbookSheetFreezePane; + filter?: WorkbookSheetFilter; + rows?: WorkbookSheetRow[]; + title?: string; + } + + interface WorkbookOptions { + name?: string; + creator?: string; + date?: Date; + sheets?: WorkbookSheet[]; + } + interface WorkbookEvent { + sender: Workbook; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + +} + +declare module kendo.dataviz.drawing { + class Arc extends kendo.drawing.Element { + constructor(options?: ArcOptions); + options: ArcOptions; + bbox(): kendo.geometry.Rect; + clip(): kendo.drawing.Path; + clip(clip: kendo.drawing.Path): void; + clippedBBox(): kendo.geometry.Rect; + geometry(): kendo.geometry.Arc; + geometry(value: kendo.geometry.Arc): void; + fill(color: string, opacity?: number): kendo.drawing.Arc; + opacity(): number; + opacity(opacity: number): void; + stroke(color: string, width?: number, opacity?: number): kendo.drawing.Arc; + transform(): kendo.geometry.Transformation; + transform(transform: kendo.geometry.Transformation): void; + visible(): boolean; + visible(visible: boolean): void; + } + + interface ArcOptions { + name?: string; + clip?: kendo.drawing.Path; + fill?: kendo.drawing.FillOptions; + opacity?: number; + stroke?: kendo.drawing.StrokeOptions; + transform?: kendo.geometry.Transformation; + visible?: boolean; + } + interface ArcEvent { + sender: Arc; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + class Circle extends kendo.drawing.Element { + constructor(options?: CircleOptions); + options: CircleOptions; + bbox(): kendo.geometry.Rect; + clip(): kendo.drawing.Path; + clip(clip: kendo.drawing.Path): void; + clippedBBox(): kendo.geometry.Rect; + geometry(): kendo.geometry.Circle; + geometry(value: kendo.geometry.Circle): void; + fill(color: string, opacity?: number): kendo.drawing.Circle; + opacity(): number; + opacity(opacity: number): void; + stroke(color: string, width?: number, opacity?: number): kendo.drawing.Circle; + transform(): kendo.geometry.Transformation; + transform(transform: kendo.geometry.Transformation): void; + visible(): boolean; + visible(visible: boolean): void; + } + + interface CircleOptions { + name?: string; + clip?: kendo.drawing.Path; + fill?: kendo.drawing.FillOptions; + opacity?: number; + stroke?: kendo.drawing.StrokeOptions; + transform?: kendo.geometry.Transformation; + visible?: boolean; + } + interface CircleEvent { + sender: Circle; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + class Element extends kendo.Class { + constructor(options?: ElementOptions); + options: ElementOptions; + bbox(): kendo.geometry.Rect; + clip(): kendo.drawing.Path; + clip(clip: kendo.drawing.Path): void; + clippedBBox(): kendo.geometry.Rect; + opacity(): number; + opacity(opacity: number): void; + transform(): kendo.geometry.Transformation; + transform(transform: kendo.geometry.Transformation): void; + visible(): boolean; + visible(visible: boolean): void; + } + + interface ElementOptions { + name?: string; + clip?: kendo.drawing.Path; + opacity?: number; + transform?: kendo.geometry.Transformation; + visible?: boolean; + } + interface ElementEvent { + sender: Element; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + interface FillOptions { + color: string; + opacity: number; + } + + + + class Gradient extends kendo.Class { + constructor(options?: GradientOptions); + options: GradientOptions; + addStop(offset: number, color: string, opacity: number): kendo.drawing.GradientStop; + removeStop(stop: kendo.drawing.GradientStop): void; + stops: any; + } + + interface GradientOptions { + name?: string; + stops?: any; + } + interface GradientEvent { + sender: Gradient; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + class GradientStop extends kendo.Class { + constructor(options?: GradientStopOptions); + options: GradientStopOptions; + } + + interface GradientStopOptions { + name?: string; + offset?: number; + color?: string; + opacity?: number; + } + interface GradientStopEvent { + sender: GradientStop; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + class Group extends kendo.drawing.Element { + constructor(options?: GroupOptions); + options: GroupOptions; + append(element: kendo.drawing.Element): void; + clear(): void; + clip(): kendo.drawing.Path; + clip(clip: kendo.drawing.Path): void; + clippedBBox(): kendo.geometry.Rect; + opacity(): number; + opacity(opacity: number): void; + remove(element: kendo.drawing.Element): void; + removeAt(index: number): void; + visible(): boolean; + visible(visible: boolean): void; + children: any; + } + + interface GroupOptions { + name?: string; + clip?: kendo.drawing.Path; + opacity?: number; + pdf?: kendo.drawing.PDFOptions; + transform?: kendo.geometry.Transformation; + visible?: boolean; + } + interface GroupEvent { + sender: Group; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + class Image extends kendo.drawing.Element { + constructor(options?: ImageOptions); + options: ImageOptions; + bbox(): kendo.geometry.Rect; + clip(): kendo.drawing.Path; + clip(clip: kendo.drawing.Path): void; + clippedBBox(): kendo.geometry.Rect; + opacity(): number; + opacity(opacity: number): void; + src(): string; + src(value: string): void; + rect(): kendo.geometry.Rect; + rect(value: kendo.geometry.Rect): void; + transform(): kendo.geometry.Transformation; + transform(transform: kendo.geometry.Transformation): void; + visible(): boolean; + visible(visible: boolean): void; + } + + interface ImageOptions { + name?: string; + clip?: kendo.drawing.Path; + opacity?: number; + transform?: kendo.geometry.Transformation; + visible?: boolean; + } + interface ImageEvent { + sender: Image; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + class Layout extends kendo.drawing.Group { + constructor(options?: LayoutOptions); + options: LayoutOptions; + rect(): kendo.geometry.Rect; + rect(rect: kendo.geometry.Rect): void; + reflow(): void; + } + + interface LayoutOptions { + name?: string; + alignContent?: string; + alignItems?: string; + justifyContent?: string; + lineSpacing?: number; + spacing?: number; + orientation?: string; + wrap?: boolean; + } + interface LayoutEvent { + sender: Layout; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + class LinearGradient extends kendo.drawing.Gradient { + constructor(options?: LinearGradientOptions); + options: LinearGradientOptions; + addStop(offset: number, color: string, opacity: number): kendo.drawing.GradientStop; + end(): kendo.geometry.Point; + end(end: any): void; + end(end: kendo.geometry.Point): void; + start(): kendo.geometry.Point; + start(start: any): void; + start(start: kendo.geometry.Point): void; + removeStop(stop: kendo.drawing.GradientStop): void; + stops: any; + } + + interface LinearGradientOptions { + name?: string; + stops?: any; + } + interface LinearGradientEvent { + sender: LinearGradient; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + class MultiPath extends kendo.drawing.Element { + constructor(options?: MultiPathOptions); + options: MultiPathOptions; + bbox(): kendo.geometry.Rect; + clip(): kendo.drawing.Path; + clip(clip: kendo.drawing.Path): void; + clippedBBox(): kendo.geometry.Rect; + close(): kendo.drawing.MultiPath; + curveTo(controlOut: any, controlIn: any): kendo.drawing.MultiPath; + curveTo(controlOut: any, controlIn: kendo.geometry.Point): kendo.drawing.MultiPath; + curveTo(controlOut: kendo.geometry.Point, controlIn: any): kendo.drawing.MultiPath; + curveTo(controlOut: kendo.geometry.Point, controlIn: kendo.geometry.Point): kendo.drawing.MultiPath; + fill(color: string, opacity?: number): kendo.drawing.MultiPath; + lineTo(x: number, y?: number): kendo.drawing.MultiPath; + lineTo(x: any, y?: number): kendo.drawing.MultiPath; + lineTo(x: kendo.geometry.Point, y?: number): kendo.drawing.MultiPath; + moveTo(x: number, y?: number): kendo.drawing.MultiPath; + moveTo(x: any, y?: number): kendo.drawing.MultiPath; + moveTo(x: kendo.geometry.Point, y?: number): kendo.drawing.MultiPath; + opacity(): number; + opacity(opacity: number): void; + stroke(color: string, width?: number, opacity?: number): kendo.drawing.MultiPath; + transform(): kendo.geometry.Transformation; + transform(transform: kendo.geometry.Transformation): void; + visible(): boolean; + visible(visible: boolean): void; + paths: any; + } + + interface MultiPathOptions { + name?: string; + clip?: kendo.drawing.Path; + fill?: kendo.drawing.FillOptions; + opacity?: number; + stroke?: kendo.drawing.StrokeOptions; + transform?: kendo.geometry.Transformation; + visible?: boolean; + } + interface MultiPathEvent { + sender: MultiPath; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + class OptionsStore extends kendo.Class { + options: OptionsStoreOptions; + get(field: string): any; + set(field: string, value: any): void; + observer: any; + } + + interface OptionsStoreOptions { + name?: string; + } + interface OptionsStoreEvent { + sender: OptionsStore; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + interface PDFOptions { + creator: string; + date: Date; + keywords: string; + landscape: boolean; + margin: any; + paperSize: any; + subject: string; + title: string; + } + + + + class Path extends kendo.drawing.Element { + constructor(options?: PathOptions); + options: PathOptions; + bbox(): kendo.geometry.Rect; + clip(): kendo.drawing.Path; + clip(clip: kendo.drawing.Path): void; + clippedBBox(): kendo.geometry.Rect; + close(): kendo.drawing.Path; + curveTo(controlOut: any, controlIn: any): kendo.drawing.Path; + curveTo(controlOut: any, controlIn: kendo.geometry.Point): kendo.drawing.Path; + curveTo(controlOut: kendo.geometry.Point, controlIn: any): kendo.drawing.Path; + curveTo(controlOut: kendo.geometry.Point, controlIn: kendo.geometry.Point): kendo.drawing.Path; + fill(color: string, opacity?: number): kendo.drawing.Path; + lineTo(x: number, y?: number): kendo.drawing.Path; + lineTo(x: any, y?: number): kendo.drawing.Path; + lineTo(x: kendo.geometry.Point, y?: number): kendo.drawing.Path; + moveTo(x: number, y?: number): kendo.drawing.Path; + moveTo(x: any, y?: number): kendo.drawing.Path; + moveTo(x: kendo.geometry.Point, y?: number): kendo.drawing.Path; + opacity(): number; + opacity(opacity: number): void; + stroke(color: string, width?: number, opacity?: number): kendo.drawing.Path; + transform(): kendo.geometry.Transformation; + transform(transform: kendo.geometry.Transformation): void; + visible(): boolean; + visible(visible: boolean): void; + static fromPoints(points: any): kendo.drawing.Path; + static fromRect(rect: kendo.geometry.Rect): kendo.drawing.Path; + static parse(svgPath: string, options?: any): kendo.drawing.Path; + segments: any; + } + + interface PathOptions { + name?: string; + clip?: kendo.drawing.Path; + fill?: kendo.drawing.FillOptions; + opacity?: number; + stroke?: kendo.drawing.StrokeOptions; + transform?: kendo.geometry.Transformation; + visible?: boolean; + } + interface PathEvent { + sender: Path; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + class RadialGradient extends kendo.drawing.Gradient { + constructor(options?: RadialGradientOptions); + options: RadialGradientOptions; + addStop(offset: number, color: string, opacity: number): kendo.drawing.GradientStop; + center(): kendo.geometry.Point; + center(center: any): void; + center(center: kendo.geometry.Point): void; + radius(): number; + radius(value: number): void; + removeStop(stop: kendo.drawing.GradientStop): void; + stops: any; + } + + interface RadialGradientOptions { + name?: string; + center?: any; + radius?: number; + stops?: any; + } + interface RadialGradientEvent { + sender: RadialGradient; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + class Segment extends kendo.Class { + options: SegmentOptions; + anchor(): kendo.geometry.Point; + anchor(value: kendo.geometry.Point): void; + controlIn(): kendo.geometry.Point; + controlIn(value: kendo.geometry.Point): void; + controlOut(): kendo.geometry.Point; + controlOut(value: kendo.geometry.Point): void; + } + + interface SegmentOptions { + name?: string; + } + interface SegmentEvent { + sender: Segment; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + interface StrokeOptions { + color: string; + dashType: string; + lineCap: string; + lineJoin: string; + opacity: number; + width: number; + } + + + + class Surface extends kendo.Observable { + constructor(options?: SurfaceOptions); + options: SurfaceOptions; + clear(): void; + draw(element: kendo.drawing.Element): void; + eventTarget(e: any): kendo.drawing.Element; + resize(force?: boolean): void; + static create(element: JQuery, options?: any): kendo.drawing.Surface; + static create(element: Element, options?: any): kendo.drawing.Surface; + } + + interface SurfaceOptions { + name?: string; + type?: string; + height?: string; + width?: string; + click?(e: SurfaceClickEvent): void; + mouseenter?(e: SurfaceMouseenterEvent): void; + mouseleave?(e: SurfaceMouseleaveEvent): void; + } + interface SurfaceEvent { + sender: Surface; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + interface SurfaceClickEvent extends SurfaceEvent { + element?: kendo.drawing.Element; + originalEvent?: any; + } + + interface SurfaceMouseenterEvent extends SurfaceEvent { + element?: kendo.drawing.Element; + originalEvent?: any; + } + + interface SurfaceMouseleaveEvent extends SurfaceEvent { + element?: kendo.drawing.Element; + originalEvent?: any; + } + + + class Text extends kendo.drawing.Element { + constructor(options?: TextOptions); + options: TextOptions; + bbox(): kendo.geometry.Rect; + clip(): kendo.drawing.Path; + clip(clip: kendo.drawing.Path): void; + clippedBBox(): kendo.geometry.Rect; + content(): string; + content(value: string): void; + fill(color: string, opacity?: number): kendo.drawing.Text; + opacity(): number; + opacity(opacity: number): void; + position(): kendo.geometry.Point; + position(value: kendo.geometry.Point): void; + stroke(color: string, width?: number, opacity?: number): kendo.drawing.Text; + transform(): kendo.geometry.Transformation; + transform(transform: kendo.geometry.Transformation): void; + visible(): boolean; + visible(visible: boolean): void; + } + + interface TextOptions { + name?: string; + clip?: kendo.drawing.Path; + fill?: kendo.drawing.FillOptions; + font?: string; + opacity?: number; + stroke?: kendo.drawing.StrokeOptions; + transform?: kendo.geometry.Transformation; + visible?: boolean; + } + interface TextEvent { + sender: Text; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + +} +declare module kendo.dataviz.geometry { + class Arc extends Observable { + options: ArcOptions; + bbox(matrix: kendo.geometry.Matrix): kendo.geometry.Rect; + getAnticlockwise(): boolean; + getCenter(): kendo.geometry.Point; + getEndAngle(): number; + getRadiusX(): number; + getRadiusY(): number; + getStartAngle(): number; + pointAt(angle: number): kendo.geometry.Point; + setAnticlockwise(value: boolean): kendo.geometry.Arc; + setCenter(value: kendo.geometry.Point): kendo.geometry.Arc; + setEndAngle(value: number): kendo.geometry.Arc; + setRadiusX(value: number): kendo.geometry.Arc; + setRadiusY(value: number): kendo.geometry.Arc; + setStartAngle(value: number): kendo.geometry.Arc; + anticlockwise: boolean; + center: kendo.geometry.Point; + endAngle: number; + radiusX: number; + radiusY: number; + startAngle: number; + } + + interface ArcOptions { + name?: string; + } + interface ArcEvent { + sender: Arc; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + class Circle extends Observable { + options: CircleOptions; + bbox(matrix: kendo.geometry.Matrix): kendo.geometry.Rect; + clone(): kendo.geometry.Circle; + equals(other: kendo.geometry.Circle): boolean; + getCenter(): kendo.geometry.Point; + getRadius(): number; + pointAt(angle: number): kendo.geometry.Point; + setCenter(value: kendo.geometry.Point): kendo.geometry.Point; + setCenter(value: any): kendo.geometry.Point; + setRadius(value: number): kendo.geometry.Circle; + center: kendo.geometry.Point; + radius: number; + } + + interface CircleOptions { + name?: string; + } + interface CircleEvent { + sender: Circle; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + class Matrix extends Observable { + options: MatrixOptions; + clone(): kendo.geometry.Matrix; + equals(other: kendo.geometry.Matrix): boolean; + round(digits: number): kendo.geometry.Matrix; + multiplyCopy(matrix: kendo.geometry.Matrix): kendo.geometry.Matrix; + toArray(digits: number): any; + toString(digits: number, separator: string): string; + static rotate(angle: number, x: number, y: number): kendo.geometry.Matrix; + static scale(scaleX: number, scaleY: number): kendo.geometry.Matrix; + static translate(x: number, y: number): kendo.geometry.Matrix; + static unit(): kendo.geometry.Matrix; + a: number; + b: number; + c: number; + d: number; + e: number; + f: number; + } + + interface MatrixOptions { + name?: string; + } + interface MatrixEvent { + sender: Matrix; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + class Point extends Observable { + options: PointOptions; + clone(): kendo.geometry.Point; + distanceTo(point: kendo.geometry.Point): number; + equals(other: kendo.geometry.Point): boolean; + getX(): number; + getY(): number; + move(x: number, y: number): kendo.geometry.Point; + rotate(angle: number, center: kendo.geometry.Point): kendo.geometry.Point; + rotate(angle: number, center: any): kendo.geometry.Point; + round(digits: number): kendo.geometry.Point; + scale(scaleX: number, scaleY: number): kendo.geometry.Point; + scaleCopy(scaleX: number, scaleY: number): kendo.geometry.Point; + setX(value: number): kendo.geometry.Point; + setY(value: number): kendo.geometry.Point; + toArray(digits: number): any; + toString(digits: number, separator: string): string; + transform(tansformation: kendo.geometry.Transformation): kendo.geometry.Point; + transformCopy(tansformation: kendo.geometry.Transformation): kendo.geometry.Point; + translate(dx: number, dy: number): kendo.geometry.Point; + translateWith(vector: kendo.geometry.Point): kendo.geometry.Point; + translateWith(vector: any): kendo.geometry.Point; + static create(x: number, y: number): kendo.geometry.Point; + static create(x: any, y: number): kendo.geometry.Point; + static create(x: kendo.geometry.Point, y: number): kendo.geometry.Point; + static min(): kendo.geometry.Point; + static max(): kendo.geometry.Point; + static minPoint(): kendo.geometry.Point; + static maxPoint(): kendo.geometry.Point; + x: number; + y: number; + } + + interface PointOptions { + name?: string; + } + interface PointEvent { + sender: Point; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + class Rect extends Observable { + options: RectOptions; + bbox(matrix: kendo.geometry.Matrix): kendo.geometry.Rect; + bottomLeft(): kendo.geometry.Point; + bottomRight(): kendo.geometry.Point; + center(): kendo.geometry.Point; + clone(): kendo.geometry.Rect; + equals(other: kendo.geometry.Rect): boolean; + getOrigin(): kendo.geometry.Point; + getSize(): kendo.geometry.Size; + height(): number; + setOrigin(value: kendo.geometry.Point): kendo.geometry.Rect; + setOrigin(value: any): kendo.geometry.Rect; + setSize(value: kendo.geometry.Size): kendo.geometry.Rect; + setSize(value: any): kendo.geometry.Rect; + topLeft(): kendo.geometry.Point; + topRight(): kendo.geometry.Point; + width(): number; + static fromPoints(pointA: kendo.geometry.Point, pointB: kendo.geometry.Point): kendo.geometry.Rect; + static union(rectA: kendo.geometry.Rect, rectB: kendo.geometry.Rect): kendo.geometry.Rect; + origin: kendo.geometry.Point; + size: kendo.geometry.Size; + } + + interface RectOptions { + name?: string; + } + interface RectEvent { + sender: Rect; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + class Size extends Observable { + options: SizeOptions; + clone(): kendo.geometry.Size; + equals(other: kendo.geometry.Size): boolean; + getWidth(): number; + getHeight(): number; + setWidth(value: number): kendo.geometry.Size; + setHeight(value: number): kendo.geometry.Size; + static create(width: number, height: number): kendo.geometry.Size; + static create(width: any, height: number): kendo.geometry.Size; + static create(width: kendo.geometry.Size, height: number): kendo.geometry.Size; + width: number; + height: number; + } + + interface SizeOptions { + name?: string; + } + interface SizeEvent { + sender: Size; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + class Transformation extends Observable { + options: TransformationOptions; + clone(): kendo.geometry.Transformation; + equals(other: kendo.geometry.Transformation): boolean; + matrix(): kendo.geometry.Matrix; + multiply(transformation: kendo.geometry.Transformation): kendo.geometry.Transformation; + rotate(angle: number, center: any): kendo.geometry.Transformation; + rotate(angle: number, center: kendo.geometry.Point): kendo.geometry.Transformation; + scale(scaleX: number, scaleY: number): kendo.geometry.Transformation; + translate(x: number, y: number): kendo.geometry.Transformation; + } + + interface TransformationOptions { + name?: string; + } + interface TransformationEvent { + sender: Transformation; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + +} + +interface HTMLElement { + kendoBindingTarget: kendo.data.BindingTarget; +} + +interface JQueryXHR { +} + +interface JQueryEventObject { +} + +interface JQueryPromise { + pipe(doneFilter?: (x: any) => any, failFilter?: (x: any) => any, progressFilter?: (x: any) => any): JQueryPromise; + then(doneCallbacks: any, failCallbacks: any, progressCallbacks?: any): JQueryPromise; +} + +interface JQuery { + + kendoDraggable(): JQuery; + kendoDraggable(options: kendo.ui.DraggableOptions): JQuery; + + kendoDropTarget(): JQuery; + kendoDropTarget(options: kendo.ui.DropTargetOptions): JQuery; + + kendoDropTargetArea(): JQuery; + kendoDropTargetArea(options: kendo.ui.DropTargetAreaOptions): JQuery; + + data(key: any): any; + + kendoAutoComplete(): JQuery; + kendoAutoComplete(options: kendo.ui.AutoCompleteOptions): JQuery; + data(key: "kendoAutoComplete") : kendo.ui.AutoComplete; + + kendoBarcode(): JQuery; + kendoBarcode(options: kendo.dataviz.ui.BarcodeOptions): JQuery; + data(key: "kendoBarcode") : kendo.dataviz.ui.Barcode; + + kendoButton(): JQuery; + kendoButton(options: kendo.ui.ButtonOptions): JQuery; + data(key: "kendoButton") : kendo.ui.Button; + + kendoCalendar(): JQuery; + kendoCalendar(options: kendo.ui.CalendarOptions): JQuery; + data(key: "kendoCalendar") : kendo.ui.Calendar; + + kendoChart(): JQuery; + kendoChart(options: kendo.dataviz.ui.ChartOptions): JQuery; + data(key: "kendoChart") : kendo.dataviz.ui.Chart; + + kendoColorPalette(): JQuery; + kendoColorPalette(options: kendo.ui.ColorPaletteOptions): JQuery; + data(key: "kendoColorPalette") : kendo.ui.ColorPalette; + + kendoColorPicker(): JQuery; + kendoColorPicker(options: kendo.ui.ColorPickerOptions): JQuery; + data(key: "kendoColorPicker") : kendo.ui.ColorPicker; + + kendoComboBox(): JQuery; + kendoComboBox(options: kendo.ui.ComboBoxOptions): JQuery; + data(key: "kendoComboBox") : kendo.ui.ComboBox; + + kendoContextMenu(): JQuery; + kendoContextMenu(options: kendo.ui.ContextMenuOptions): JQuery; + data(key: "kendoContextMenu") : kendo.ui.ContextMenu; + + kendoDatePicker(): JQuery; + kendoDatePicker(options: kendo.ui.DatePickerOptions): JQuery; + data(key: "kendoDatePicker") : kendo.ui.DatePicker; + + kendoDateTimePicker(): JQuery; + kendoDateTimePicker(options: kendo.ui.DateTimePickerOptions): JQuery; + data(key: "kendoDateTimePicker") : kendo.ui.DateTimePicker; + + kendoDiagram(): JQuery; + kendoDiagram(options: kendo.dataviz.ui.DiagramOptions): JQuery; + data(key: "kendoDiagram") : kendo.dataviz.ui.Diagram; + + kendoDropDownList(): JQuery; + kendoDropDownList(options: kendo.ui.DropDownListOptions): JQuery; + data(key: "kendoDropDownList") : kendo.ui.DropDownList; + + kendoEditor(): JQuery; + kendoEditor(options: kendo.ui.EditorOptions): JQuery; + data(key: "kendoEditor") : kendo.ui.Editor; + + kendoFlatColorPicker(): JQuery; + kendoFlatColorPicker(options: kendo.ui.FlatColorPickerOptions): JQuery; + data(key: "kendoFlatColorPicker") : kendo.ui.FlatColorPicker; + + kendoGantt(): JQuery; + kendoGantt(options: kendo.ui.GanttOptions): JQuery; + data(key: "kendoGantt") : kendo.ui.Gantt; + + kendoGrid(): JQuery; + kendoGrid(options: kendo.ui.GridOptions): JQuery; + data(key: "kendoGrid") : kendo.ui.Grid; + + kendoLinearGauge(): JQuery; + kendoLinearGauge(options: kendo.dataviz.ui.LinearGaugeOptions): JQuery; + data(key: "kendoLinearGauge") : kendo.dataviz.ui.LinearGauge; + + kendoListView(): JQuery; + kendoListView(options: kendo.ui.ListViewOptions): JQuery; + data(key: "kendoListView") : kendo.ui.ListView; + + kendoMap(): JQuery; + kendoMap(options: kendo.dataviz.ui.MapOptions): JQuery; + data(key: "kendoMap") : kendo.dataviz.ui.Map; + + kendoMaskedTextBox(): JQuery; + kendoMaskedTextBox(options: kendo.ui.MaskedTextBoxOptions): JQuery; + data(key: "kendoMaskedTextBox") : kendo.ui.MaskedTextBox; + + kendoMenu(): JQuery; + kendoMenu(options: kendo.ui.MenuOptions): JQuery; + data(key: "kendoMenu") : kendo.ui.Menu; + + kendoMobileActionSheet(): JQuery; + kendoMobileActionSheet(options: kendo.mobile.ui.ActionSheetOptions): JQuery; + data(key: "kendoMobileActionSheet") : kendo.mobile.ui.ActionSheet; + + kendoMobileBackButton(): JQuery; + kendoMobileBackButton(options: kendo.mobile.ui.BackButtonOptions): JQuery; + data(key: "kendoMobileBackButton") : kendo.mobile.ui.BackButton; + + kendoMobileButton(): JQuery; + kendoMobileButton(options: kendo.mobile.ui.ButtonOptions): JQuery; + data(key: "kendoMobileButton") : kendo.mobile.ui.Button; + + kendoMobileButtonGroup(): JQuery; + kendoMobileButtonGroup(options: kendo.mobile.ui.ButtonGroupOptions): JQuery; + data(key: "kendoMobileButtonGroup") : kendo.mobile.ui.ButtonGroup; + + kendoMobileCollapsible(): JQuery; + kendoMobileCollapsible(options: kendo.mobile.ui.CollapsibleOptions): JQuery; + data(key: "kendoMobileCollapsible") : kendo.mobile.ui.Collapsible; + + kendoMobileDetailButton(): JQuery; + kendoMobileDetailButton(options: kendo.mobile.ui.DetailButtonOptions): JQuery; + data(key: "kendoMobileDetailButton") : kendo.mobile.ui.DetailButton; + + kendoMobileDrawer(): JQuery; + kendoMobileDrawer(options: kendo.mobile.ui.DrawerOptions): JQuery; + data(key: "kendoMobileDrawer") : kendo.mobile.ui.Drawer; + + kendoMobileLayout(): JQuery; + kendoMobileLayout(options: kendo.mobile.ui.LayoutOptions): JQuery; + data(key: "kendoMobileLayout") : kendo.mobile.ui.Layout; + + kendoMobileListView(): JQuery; + kendoMobileListView(options: kendo.mobile.ui.ListViewOptions): JQuery; + data(key: "kendoMobileListView") : kendo.mobile.ui.ListView; + + kendoMobileLoader(): JQuery; + kendoMobileLoader(options: kendo.mobile.ui.LoaderOptions): JQuery; + data(key: "kendoMobileLoader") : kendo.mobile.ui.Loader; + + kendoMobileModalView(): JQuery; + kendoMobileModalView(options: kendo.mobile.ui.ModalViewOptions): JQuery; + data(key: "kendoMobileModalView") : kendo.mobile.ui.ModalView; + + kendoMobileNavBar(): JQuery; + kendoMobileNavBar(options: kendo.mobile.ui.NavBarOptions): JQuery; + data(key: "kendoMobileNavBar") : kendo.mobile.ui.NavBar; + + kendoMobilePane(): JQuery; + kendoMobilePane(options: kendo.mobile.ui.PaneOptions): JQuery; + data(key: "kendoMobilePane") : kendo.mobile.ui.Pane; + + kendoMobilePopOver(): JQuery; + kendoMobilePopOver(options: kendo.mobile.ui.PopOverOptions): JQuery; + data(key: "kendoMobilePopOver") : kendo.mobile.ui.PopOver; + + kendoMobileScrollView(): JQuery; + kendoMobileScrollView(options: kendo.mobile.ui.ScrollViewOptions): JQuery; + data(key: "kendoMobileScrollView") : kendo.mobile.ui.ScrollView; + + kendoMobileScroller(): JQuery; + kendoMobileScroller(options: kendo.mobile.ui.ScrollerOptions): JQuery; + data(key: "kendoMobileScroller") : kendo.mobile.ui.Scroller; + + kendoMobileSplitView(): JQuery; + kendoMobileSplitView(options: kendo.mobile.ui.SplitViewOptions): JQuery; + data(key: "kendoMobileSplitView") : kendo.mobile.ui.SplitView; + + kendoMobileSwitch(): JQuery; + kendoMobileSwitch(options: kendo.mobile.ui.SwitchOptions): JQuery; + data(key: "kendoMobileSwitch") : kendo.mobile.ui.Switch; + + kendoMobileTabStrip(): JQuery; + kendoMobileTabStrip(options: kendo.mobile.ui.TabStripOptions): JQuery; + data(key: "kendoMobileTabStrip") : kendo.mobile.ui.TabStrip; + + kendoMobileView(): JQuery; + kendoMobileView(options: kendo.mobile.ui.ViewOptions): JQuery; + data(key: "kendoMobileView") : kendo.mobile.ui.View; + + kendoMultiSelect(): JQuery; + kendoMultiSelect(options: kendo.ui.MultiSelectOptions): JQuery; + data(key: "kendoMultiSelect") : kendo.ui.MultiSelect; + + kendoNotification(): JQuery; + kendoNotification(options: kendo.ui.NotificationOptions): JQuery; + data(key: "kendoNotification") : kendo.ui.Notification; + + kendoNumericTextBox(): JQuery; + kendoNumericTextBox(options: kendo.ui.NumericTextBoxOptions): JQuery; + data(key: "kendoNumericTextBox") : kendo.ui.NumericTextBox; + + kendoPager(): JQuery; + kendoPager(options: kendo.ui.PagerOptions): JQuery; + data(key: "kendoPager") : kendo.ui.Pager; + + kendoPanelBar(): JQuery; + kendoPanelBar(options: kendo.ui.PanelBarOptions): JQuery; + data(key: "kendoPanelBar") : kendo.ui.PanelBar; + + kendoPivotConfigurator(): JQuery; + kendoPivotConfigurator(options: kendo.ui.PivotConfiguratorOptions): JQuery; + data(key: "kendoPivotConfigurator") : kendo.ui.PivotConfigurator; + + kendoPivotGrid(): JQuery; + kendoPivotGrid(options: kendo.ui.PivotGridOptions): JQuery; + data(key: "kendoPivotGrid") : kendo.ui.PivotGrid; + + kendoProgressBar(): JQuery; + kendoProgressBar(options: kendo.ui.ProgressBarOptions): JQuery; + data(key: "kendoProgressBar") : kendo.ui.ProgressBar; + + kendoQRCode(): JQuery; + kendoQRCode(options: kendo.dataviz.ui.QRCodeOptions): JQuery; + data(key: "kendoQRCode") : kendo.dataviz.ui.QRCode; + + kendoRadialGauge(): JQuery; + kendoRadialGauge(options: kendo.dataviz.ui.RadialGaugeOptions): JQuery; + data(key: "kendoRadialGauge") : kendo.dataviz.ui.RadialGauge; + + kendoRangeSlider(): JQuery; + kendoRangeSlider(options: kendo.ui.RangeSliderOptions): JQuery; + data(key: "kendoRangeSlider") : kendo.ui.RangeSlider; + + kendoResponsivePanel(): JQuery; + kendoResponsivePanel(options: kendo.ui.ResponsivePanelOptions): JQuery; + data(key: "kendoResponsivePanel") : kendo.ui.ResponsivePanel; + + kendoScheduler(): JQuery; + kendoScheduler(options: kendo.ui.SchedulerOptions): JQuery; + data(key: "kendoScheduler") : kendo.ui.Scheduler; + + kendoSlider(): JQuery; + kendoSlider(options: kendo.ui.SliderOptions): JQuery; + data(key: "kendoSlider") : kendo.ui.Slider; + + kendoSortable(): JQuery; + kendoSortable(options: kendo.ui.SortableOptions): JQuery; + data(key: "kendoSortable") : kendo.ui.Sortable; + + kendoSparkline(): JQuery; + kendoSparkline(options: kendo.dataviz.ui.SparklineOptions): JQuery; + data(key: "kendoSparkline") : kendo.dataviz.ui.Sparkline; + + kendoSplitter(): JQuery; + kendoSplitter(options: kendo.ui.SplitterOptions): JQuery; + data(key: "kendoSplitter") : kendo.ui.Splitter; + + kendoStockChart(): JQuery; + kendoStockChart(options: kendo.dataviz.ui.StockChartOptions): JQuery; + data(key: "kendoStockChart") : kendo.dataviz.ui.StockChart; + + kendoTabStrip(): JQuery; + kendoTabStrip(options: kendo.ui.TabStripOptions): JQuery; + data(key: "kendoTabStrip") : kendo.ui.TabStrip; + + kendoTimePicker(): JQuery; + kendoTimePicker(options: kendo.ui.TimePickerOptions): JQuery; + data(key: "kendoTimePicker") : kendo.ui.TimePicker; + + kendoToolBar(): JQuery; + kendoToolBar(options: kendo.ui.ToolBarOptions): JQuery; + data(key: "kendoToolBar") : kendo.ui.ToolBar; + + kendoTooltip(): JQuery; + kendoTooltip(options: kendo.ui.TooltipOptions): JQuery; + data(key: "kendoTooltip") : kendo.ui.Tooltip; + + kendoTouch(): JQuery; + kendoTouch(options: kendo.ui.TouchOptions): JQuery; + data(key: "kendoTouch") : kendo.ui.Touch; + + kendoTreeList(): JQuery; + kendoTreeList(options: kendo.ui.TreeListOptions): JQuery; + data(key: "kendoTreeList") : kendo.ui.TreeList; + + kendoTreeMap(): JQuery; + kendoTreeMap(options: kendo.dataviz.ui.TreeMapOptions): JQuery; + data(key: "kendoTreeMap") : kendo.dataviz.ui.TreeMap; + + kendoTreeView(): JQuery; + kendoTreeView(options: kendo.ui.TreeViewOptions): JQuery; + data(key: "kendoTreeView") : kendo.ui.TreeView; + + kendoUpload(): JQuery; + kendoUpload(options: kendo.ui.UploadOptions): JQuery; + data(key: "kendoUpload") : kendo.ui.Upload; + + kendoValidator(): JQuery; + kendoValidator(options: kendo.ui.ValidatorOptions): JQuery; + data(key: "kendoValidator") : kendo.ui.Validator; + + kendoWindow(): JQuery; + kendoWindow(options: kendo.ui.WindowOptions): JQuery; + data(key: "kendoWindow") : kendo.ui.Window; + +} diff --git a/knockout-paging/knockout-paging-tests.ts b/knockout-paging/knockout-paging-tests.ts new file mode 100644 index 000000000..eae5490bb --- /dev/null +++ b/knockout-paging/knockout-paging-tests.ts @@ -0,0 +1,90 @@ +/// + +// Different option formats +var emptyOptions = {}; +var pageNumberOptions = { pageNumber: 2 }; +var pageSizeOptions = { pageSize: 10 }; +var generatorOptions = { pageGenerator: 'sliding' }; +var allOptions = { pageNumber: 2, pageSize: 10, pageGenerator: 'sliding' }; + +function defaults() { + ko.paging.defaults.pageNumber = 1; + ko.paging.defaults.pageSize = 50; +} + +function pageGenerators() { + + // Allow to set the windowSize on sliding page generator + ko.paging.generators['sliding'].windowSize(5); + + // Add custom page generator + ko.paging.generators['custom'] = { + generate: function(pagedObservable: KnockoutObservable) { + return [0, 1]; + } + } +} + +function usingPagedObservableArrayFunctionOnKnockoutStatic() { + var simplePaged = ko.pagedObservableArray(); + var initializedPaged = ko.pagedObservableArray([1, 2, 3]); + var emptyOptionsPaged = ko.pagedObservableArray([1, 2, 3], emptyOptions); + var pageNumberOptionsPaged = ko.pagedObservableArray([1, 2, 3], pageNumberOptions); + var pageSizeOptionsPaged = ko.pagedObservableArray([1, 2, 3], pageSizeOptions); + var generatorOptionsPaged = ko.pagedObservableArray([1, 2, 3], generatorOptions); + var allOptionsPaged = ko.pagedObservableArray([1, 2, 3], allOptions); + + // Here we verify that the returned type is the paged observable array + simplePaged.pageSize(); + initializedPaged.pageSize(); + emptyOptionsPaged.pageSize(); + pageNumberOptionsPaged.pageSize(); + pageSizeOptionsPaged.pageSize(); + generatorOptionsPaged.pageSize(); + allOptionsPaged.pageSize(); +} + +function usingExtend() { + var emptyOptionsPaged = ko.observableArray([]).extend({ paged: emptyOptions }); + var pageNumberOptionsPaged = ko.observableArray([]).extend({ paged: pageNumberOptions }); + var pageSizeOptionsPaged = ko.observableArray([]).extend({ paged: pageSizeOptions }); + var generatorOptionsPaged = ko.observableArray([]).extend({ paged: generatorOptions }); + var allOptionsPaged = ko.observableArray([]).extend({ paged: allOptions }); + var withInitialArrayValue = ko.observableArray([1, 2, 3]).extend({ paged: emptyOptions }); + + // Here we verify that the returned type is the paged observable array + emptyOptionsPaged.pageSize(); + pageNumberOptionsPaged.pageSize(); + pageSizeOptionsPaged.pageSize(); + generatorOptionsPaged.pageSize(); + allOptionsPaged.pageSize(); +} + +function observables() { + var paged = ko.pagedObservableArray([]); + var pageSize = paged.pageSize(); + var pageNumber = paged.pageNumber(); +} + +function computed() { + var paged = ko.pagedObservableArray([]); + var pageItems = paged.pageItems(); + var pageCount = paged.pageCount(); + var itemCount = paged.itemCount(); + var firstItemOnPage = paged.firstItemOnPage(); + var lastItemOnPage = paged.lastItemOnPage(); + var hasPreviousPage = paged.hasPreviousPage(); + var hasNextPage = paged.hasNextPage(); + var isFirstPage = paged.isFirstPage(); + var isLastPage = paged.isLastPage(); + var pages = paged.pages(); +} + +function functions() { + var paged = ko.pagedObservableArray([]); + paged.toNextPage(); + paged.toLastPage(); + paged.toNextPage(); + paged.toPreviousPage(); + paged.toFirstPage(); +} \ No newline at end of file diff --git a/knockout-paging/knockout-paging.d.ts b/knockout-paging/knockout-paging.d.ts new file mode 100644 index 000000000..b5f7627a6 --- /dev/null +++ b/knockout-paging/knockout-paging.d.ts @@ -0,0 +1,67 @@ +// Type definitions for knockout-paging +// Project: https://github.com/ErikSchierboom/knockout-paging +// Definitions by: Erik Schierboom +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +interface KnockoutStatic { + paging: KnockoutPagingOptions; + pagedObservableArray(initialValue?: T[], options?: KnockoutPagedOptions): KnockoutPagedObservableArray; +} + +interface KnockoutPagingOptions { + defaults: KnockoutPagingDefaultOptions; + generators: { + [name: string]: KnockoutPageGenerator; + 'sliding': KnockoutSlidingPageGenerator + } +} + +interface KnockoutPagingDefaultOptions { + pageNumber: number; + pageSize: number; +} + +interface KnockoutPagedObservableArray extends KnockoutObservableArray { + pageSize: KnockoutObservable; + pageNumber: KnockoutObservable; + + pageItems: KnockoutComputed; + pageCount: KnockoutComputed; + itemCount: KnockoutComputed; + firstItemOnPage: KnockoutComputed; + lastItemOnPage: KnockoutComputed; + hasPreviousPage: KnockoutComputed; + hasNextPage: KnockoutComputed; + isFirstPage: KnockoutComputed; + isLastPage: KnockoutComputed; + pages: KnockoutComputed; + + toNextPage(): void; + toPreviousPage(): void; + toLastPage(): void; + toFirstPage(): void; +} + +interface KnockoutPagedOptions { + pageSize?: number; + pageNumber?: number; + pageGenerator?: string; +} + +interface KnockoutObservableArray { + extend(requestedExtenders: { 'paged': any; }): KnockoutPagedObservableArray; +} + +interface KnockoutPageGenerator { + generate(pagedObservable: KnockoutPagedObservableArray): number[]; +} + +interface KnockoutSlidingPageGenerator extends KnockoutPageGenerator { + windowSize: KnockoutObservable; +} + +interface KnockoutExtenders { + paged(target: KnockoutObservableArray, options: KnockoutPagedOptions): KnockoutObservableArray; +} \ No newline at end of file diff --git a/knockout-pre-rendered/knockout-pre-rendered-tests.ts b/knockout-pre-rendered/knockout-pre-rendered-tests.ts new file mode 100644 index 000000000..f3a011e95 --- /dev/null +++ b/knockout-pre-rendered/knockout-pre-rendered-tests.ts @@ -0,0 +1,15 @@ +/// + +function initBindingHandler() { + ko.bindingHandlers.init = { + init: (element: any, valueAccessor: () => any, allBindingsAccessor: KnockoutAllBindingsAccessor, viewModel: any, bindingContext: KnockoutBindingContext) => {}, + update: (element: any, valueAccessor: () => any, allBindingsAccessor: KnockoutAllBindingsAccessor, viewModel: any, bindingContext: KnockoutBindingContext) => {} + }; +} + +function foreachInitBindingHandler() { + ko.bindingHandlers.foreachInit = { + init: (element: any, valueAccessor: () => any, allBindingsAccessor: KnockoutAllBindingsAccessor, viewModel: any, bindingContext: KnockoutBindingContext) => { }, + update: (element: any, valueAccessor: () => any, allBindingsAccessor: KnockoutAllBindingsAccessor, viewModel: any, bindingContext: KnockoutBindingContext) => { } + }; +} \ No newline at end of file diff --git a/knockout-pre-rendered/knockout-pre-rendered.d.ts b/knockout-pre-rendered/knockout-pre-rendered.d.ts new file mode 100644 index 000000000..8c3641aa9 --- /dev/null +++ b/knockout-pre-rendered/knockout-pre-rendered.d.ts @@ -0,0 +1,11 @@ +// Type definitions for knockout-pre-rendered +// Project: https://github.com/ErikSchierboom/knockout-pre-rendered +// Definitions by: Erik Schierboom +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +interface KnockoutBindingHandlers { + init: KnockoutBindingHandler; + foreachInit: KnockoutBindingHandler; +} \ No newline at end of file diff --git a/knockout.postbox/knockout-postbox.d.ts b/knockout.postbox/knockout-postbox.d.ts index 1dfda1a25..edddd02a1 100644 --- a/knockout.postbox/knockout-postbox.d.ts +++ b/knockout.postbox/knockout-postbox.d.ts @@ -10,6 +10,7 @@ interface KnockoutPostBox { publish(topic: string, value?: T): void; defaultComparer(newValue: T, oldValue: T): boolean; serializer: (object: any) => string; + reset(): void; } interface KnockoutObservable { diff --git a/knockout.punches/knockout.punches-tests.ts b/knockout.punches/knockout.punches-tests.ts new file mode 100644 index 000000000..bd5d53a5c --- /dev/null +++ b/knockout.punches/knockout.punches-tests.ts @@ -0,0 +1,8 @@ +/// + + +function test_enable() { + + ko.punches.enableAll(); + +} \ No newline at end of file diff --git a/knockout.punches/knockout.punches.d.ts b/knockout.punches/knockout.punches.d.ts new file mode 100644 index 000000000..d219d61f1 --- /dev/null +++ b/knockout.punches/knockout.punches.d.ts @@ -0,0 +1,20 @@ +// Type definitions for knockout.punches 0.5.1 +// Project: https://github.com/mbest/knockout.punches +// Definitions by: Stephen Lautier +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +interface KnockoutPunchesStatic { + enableAll(): void; +} + +interface KnockoutStatic { + punches: KnockoutPunchesStatic; +} + +declare module "knockout.punches" { + export = punches; +} + +declare var punches: KnockoutPunchesStatic; \ No newline at end of file diff --git a/knockout/knockout.d.ts b/knockout/knockout.d.ts index a906348a6..94964950c 100644 --- a/knockout/knockout.d.ts +++ b/knockout/knockout.d.ts @@ -248,9 +248,9 @@ interface KnockoutUtils { removeDisposeCallback(node: Element, callback: Function): void; - cleanNode(node: Element): Element; + cleanNode(node: Node): Element; - removeNode(node: Element): void; + removeNode(node: Node): void; }; ////////////////////////////////// @@ -281,8 +281,6 @@ interface KnockoutUtils { extend(target: Object, source: Object): Object; - emptyDomNode(domNode: HTMLElement): void; - moveCleanedNodesToContainerElement(nodes: any[]): HTMLElement; cloneNodes(nodesArray: any[], shouldCleanNodes: boolean): any[]; @@ -576,6 +574,7 @@ declare module KnockoutComponentTypes { interface Config { viewModel?: ViewModelFunction | ViewModelSharedInstance | ViewModelFactoryFunction | AMDModule; template: string | Node[]| DocumentFragment | TemplateElement | AMDModule; + synchronous?: boolean; } interface ComponentConfig { diff --git a/leaflet/leaflet-tests.ts b/leaflet/leaflet-tests.ts old mode 100644 new mode 100755 index 184724f4c..4c8fd4d73 --- a/leaflet/leaflet-tests.ts +++ b/leaflet/leaflet-tests.ts @@ -325,3 +325,92 @@ CustomControl = L.Control.extend({ this.title = title; }, }); + +// Different latLng and latLngBounds expressions +var latLngLiteral = [10, 20]; +var latLngObjectLiteral = { lat: 10, lng: 10 }; +var boundsLiteral = [[10, 20], [20, 20]]; +var boundLiteralOfLatLngObjects = [latLngObjectLiteral, latLngObjectLiteral]; + +var circle: L.Circle = L.circle(latLngLiteral, 4); +circle = new L.Circle(latLngLiteral, 4); +circle.setLatLng(latLngLiteral); + +circle = L.circle(latLngObjectLiteral, 4); +circle = new L.Circle(latLngObjectLiteral, 4); +circle.setLatLng(latLngObjectLiteral); + +var circleMarker: L.CircleMarker = L.circleMarker(latLngLiteral); +circleMarker = new L.CircleMarker(latLngLiteral); +circleMarker.setLatLng(latLngLiteral); + +circleMarker = L.circleMarker(latLngObjectLiteral); +circleMarker = new L.CircleMarker(latLngObjectLiteral); +circleMarker.setLatLng(latLngObjectLiteral); + +var latLng: L.LatLng = L.latLng(latLngLiteral); +latLng = new L.LatLng(latLngLiteral); +latLng.distanceTo(latLngLiteral); +latLng.equals(latLngLiteral); + +latLng = L.latLng(latLngObjectLiteral); +latLng = new L.LatLng(latLngObjectLiteral); +latLng.distanceTo(latLngObjectLiteral); +latLng.equals(latLngObjectLiteral); + +var bounds: L.LatLngBounds = L.latLngBounds(boundsLiteral); +bounds = L.latLngBounds(boundLiteralOfLatLngObjects); +bounds = new L.LatLngBounds(boundsLiteral); +bounds = new L.LatLngBounds(boundLiteralOfLatLngObjects); +bounds = new L.LatLngBounds(latLngLiteral, latLngLiteral); + +bounds.extend(latLngLiteral); +bounds.extend(latLngObjectLiteral); +bounds.extend(boundsLiteral); +bounds.extend(boundLiteralOfLatLngObjects); + +bounds.contains(latLngLiteral); +bounds.contains(boundLiteralOfLatLngObjects); +bounds.contains(boundsLiteral); + +bounds.intersects(boundsLiteral); +bounds.intersects(boundLiteralOfLatLngObjects); + +bounds.equals(boundsLiteral); +bounds.equals(boundLiteralOfLatLngObjects); + +map.setView(latLngLiteral); +map.setView(latLngObjectLiteral); +map.setZoomAround(latLngLiteral, 15); +map.setZoomAround(latLngObjectLiteral, 15); +map.panTo(latLngLiteral); +map.panTo(latLngObjectLiteral); +map.openPopup('test', latLngLiteral); +map.openPopup('test', latLngObjectLiteral); +map.latLngToLayerPoint(latLngLiteral); +map.latLngToLayerPoint(latLngObjectLiteral); +map.latLngToContainerPoint(latLngLiteral); +map.latLngToContainerPoint(latLngObjectLiteral); +map.project(latLngLiteral); +map.project(latLngObjectLiteral); + +marker.setLatLng(latLngLiteral); +marker.setLatLng(latLngObjectLiteral); + +var polygon: L.Polygon = L.polygon(boundsLiteral); +polygon = L.polygon(boundLiteralOfLatLngObjects); +polygon = new L.Polygon(boundsLiteral); +polygon = new L.Polygon(boundLiteralOfLatLngObjects); + +var polyline: L.Polyline = L.polyline(boundsLiteral); +polyline = L.polyline(boundLiteralOfLatLngObjects); +polyline = new L.Polyline(boundsLiteral); +polyline = new L.Polyline(boundLiteralOfLatLngObjects); +polyline.setLatLngs(boundsLiteral); +polyline.setLatLngs(boundLiteralOfLatLngObjects); +polyline.addLatLng(latLngLiteral); +polyline.addLatLng(latLngObjectLiteral); + +var popup: L.Popup = L.popup(); +popup.setLatLng(latLngLiteral); +popup.setLatLng(latLngObjectLiteral); diff --git a/leaflet/leaflet.d.ts b/leaflet/leaflet.d.ts old mode 100644 new mode 100755 index 1708a9d10..2bd6a5118 --- a/leaflet/leaflet.d.ts +++ b/leaflet/leaflet.d.ts @@ -3,6 +3,10 @@ // Definitions by: Vladimir Zotov // Definitions: https://github.com/borisyankov/DefinitelyTyped +declare module L { + type LatLngExpression = LatLng | number[] | ({ lat: number; lng: number }) + type LatLngBoundsExpression = LatLngBounds | LatLngExpression[]; +} declare module L { @@ -180,14 +184,14 @@ declare module L { * Instantiates a circle object given a geographical point, a radius in meters * and optionally an options object. */ - function circle(latlng: LatLng, radius: number, options?: PathOptions): Circle; + function circle(latlng: LatLngExpression, radius: number, options?: PathOptions): Circle; export interface CircleStatic extends ClassStatic { /** * Instantiates a circle object given a geographical point, a radius in meters * and optionally an options object. */ - new(latlng: LatLng, radius: number, options?: PathOptions): Circle; + new(latlng: LatLngExpression, radius: number, options?: PathOptions): Circle; } export var Circle: CircleStatic; @@ -205,7 +209,7 @@ declare module L { /** * Sets the position of a circle to a new location. */ - setLatLng(latlng: LatLng): Circle; + setLatLng(latlng: LatLngExpression): Circle; /** * Sets the radius of a circle. Units are in meters. @@ -227,7 +231,7 @@ declare module L { * an options object. The default radius is 10 and can be altered by passing a * "radius" member in the path options object. */ - function circleMarker(latlng: LatLng, options?: PathOptions): CircleMarker; + function circleMarker(latlng: LatLngExpression, options?: PathOptions): CircleMarker; export interface CircleMarkerStatic extends ClassStatic { @@ -236,7 +240,7 @@ declare module L { * an options object. The default radius is 10 and can be altered by passing a * "radius" member in the path options object. */ - new(latlng: LatLng, options?: PathOptions): CircleMarker; + new(latlng: LatLngExpression, options?: PathOptions): CircleMarker; } export var CircleMarker: CircleMarkerStatic; @@ -244,7 +248,7 @@ declare module L { /** * Sets the position of a circle marker to a new location. */ - setLatLng(latlng: LatLng): CircleMarker; + setLatLng(latlng: LatLngExpression): CircleMarker; /** * Sets the radius of a circle marker. Units are in pixels. @@ -1439,7 +1443,7 @@ declare module L { * Creates an object representing a geographical point with the given latitude * and longitude. */ - function latLng(coords: number[]): LatLng; + function latLng(coords: LatLngExpression): LatLng; export interface LatLngStatic extends ClassStatic { /** @@ -1452,7 +1456,7 @@ declare module L { * Creates an object representing a geographical point with the given latitude * and longitude. */ - new(coords: number[]): LatLng; + new(coords: LatLngExpression): LatLng; /** * A multiplier for converting degrees into radians. @@ -1482,13 +1486,13 @@ declare module L { * Returns the distance (in meters) to the given LatLng calculated using the * Haversine formula. See description on wikipedia */ - distanceTo(otherLatlng: LatLng): number; + distanceTo(otherLatlng: LatLngExpression): number; /** * Returns true if the given LatLng point is at the same position (within a small * margin of error). */ - equals(otherLatlng: LatLng): boolean; + equals(otherLatlng: LatLngExpression): boolean; /** * Returns a string representation of the point (for debugging purposes). @@ -1519,26 +1523,26 @@ declare module L { * Creates a LatLngBounds object by defining south-west and north-east corners * of the rectangle. */ - function latLngBounds(southWest: LatLng, northEast: LatLng): LatLngBounds; + function latLngBounds(southWest: LatLngExpression, northEast: LatLngExpression): LatLngBounds; /** * Creates a LatLngBounds object defined by the geographical points it contains. * Very useful for zooming the map to fit a particular set of locations with fitBounds. */ - function latLngBounds(latlngs: LatLng[]): LatLngBounds; + function latLngBounds(latlngs: LatLngBoundsExpression): LatLngBounds; export interface LatLngBoundsStatic extends ClassStatic { /** * Creates a LatLngBounds object by defining south-west and north-east corners * of the rectangle. */ - new(southWest: LatLng, northEast: LatLng): LatLngBounds; + new(southWest: LatLngExpression, northEast: LatLngExpression): LatLngBounds; /** * Creates a LatLngBounds object defined by the geographical points it contains. * Very useful for zooming the map to fit a particular set of locations with fitBounds. */ - new(latlngs: LatLng[]): LatLngBounds; + new(latlngs: LatLngBoundsExpression): LatLngBounds; } export var LatLngBounds: LatLngBoundsStatic; @@ -1546,12 +1550,12 @@ declare module L { /** * Extends the bounds to contain the given point. */ - extend(latlng: LatLng): LatLngBounds; + extend(latlng: LatLngExpression): LatLngBounds; /** * Extends the bounds to contain the given bounds. */ - extend(latlng: LatLngBounds): LatLngBounds; + extend(latlng: LatLngBoundsExpression): LatLngBounds; /** * Returns the south-west point of the bounds. @@ -1573,6 +1577,26 @@ declare module L { */ getSouthEast(): LatLng; + /** + * Returns the west longitude in degrees of the bounds. + */ + getWest(): number; + + /** + * Returns the east longitude in degrees of the bounds. + */ + getEast(): number; + + /** + * Returns the north latitude in degrees of the bounds. + */ + getNorth(): number; + + /** + * Returns the south latitude in degrees of the bounds. + */ + getSouth(): number; + /** * Returns the center point of the bounds. */ @@ -1581,23 +1605,23 @@ declare module L { /** * Returns true if the rectangle contains the given one. */ - contains(otherBounds: LatLngBounds): boolean; + contains(otherBounds: LatLngBoundsExpression): boolean; /** * Returns true if the rectangle contains the given point. */ - contains(latlng: LatLng): boolean; + contains(latlng: LatLngExpression): boolean; /** * Returns true if the rectangle intersects the given bounds. */ - intersects(otherBounds: LatLngBounds): boolean; + intersects(otherBounds: LatLngBoundsExpression): boolean; /** * Returns true if the rectangle is equivalent (within a small margin of error) * to the given bounds. */ - equals(otherBounds: LatLngBounds): boolean; + equals(otherBounds: LatLngBoundsExpression): boolean; /** * Returns a string with bounding box coordinates in a 'southwest_lng,southwest_lat,northeast_lng,northeast_lat' @@ -2062,7 +2086,7 @@ declare module L { * Sets the view of the map (geographical center and zoom) with the given * animation options. */ - setView(center: LatLng, zoom?: number, options?: ZoomPanOptions): Map; + setView(center: LatLngExpression, zoom?: number, options?: ZoomPanOptions): Map; /** * Sets the zoom of the map. @@ -2083,7 +2107,7 @@ declare module L { * Zooms the map while keeping a specified point on the map stationary * (e.g. used internally for scroll zoom and double-click zoom). */ - setZoomAround(latlng: LatLng, zoom: number, options?: ZoomOptions): Map; + setZoomAround(latlng: LatLngExpression, zoom: number, options?: ZoomOptions): Map; /** * Sets a map view that contains the given geographical bounds with the maximum @@ -2101,7 +2125,7 @@ declare module L { * 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; + panTo(latlng: LatLngExpression, options?: PanOptions): Map; /** * Pans the map to the closest view that would lie inside the given bounds (if @@ -2233,13 +2257,13 @@ declare module L { * 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; + openPopup(html: string, latlng: LatLngExpression, options?: PopupOptions): Map; /** * 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; + openPopup(el: HTMLElement, latlng: LatLngExpression, options?: PopupOptions): Map; /** * Closes the popup previously opened with openPopup (or the given one). @@ -2262,7 +2286,7 @@ declare module L { * Returns the map layer point that corresponds to the given geographical coordinates * (useful for placing overlays on the map). */ - latLngToLayerPoint(latlng: LatLng): Point; + latLngToLayerPoint(latlng: LatLngExpression): Point; /** * Returns the geographical coordinates of a given map layer point. @@ -2285,7 +2309,7 @@ declare module L { * Returns the map container point that corresponds to the given geographical * coordinates. */ - latLngToContainerPoint(latlng: LatLng): Point; + latLngToContainerPoint(latlng: LatLngExpression): Point; /** * Returns the geographical coordinates of a given map container point. @@ -2296,7 +2320,7 @@ declare module L { * 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; + project(latlng: LatLngExpression, zoom?: number): Point; /** * Projects the given absolute pixel coordinates to geographical coordinates @@ -2698,14 +2722,14 @@ declare module L { * Instantiates a Marker object given a geographical point and optionally * an options object. */ - function marker(latlng: LatLng, options?: MarkerOptions): Marker; + function marker(latlng: LatLngExpression, options?: MarkerOptions): Marker; var Marker: { /** * Instantiates a Marker object given a geographical point and optionally * an options object. */ - new(latlng: LatLng, options?: MarkerOptions): Marker; + new(latlng: LatLngExpression, options?: MarkerOptions): Marker; }; export interface Marker extends ILayer, IEventPowered { @@ -2722,7 +2746,7 @@ declare module L { /** * Changes the marker position to the given point. */ - setLatLng(latlng: LatLng): Marker; + setLatLng(latlng: LatLngExpression): Marker; /** * Changes the marker icon. @@ -3075,7 +3099,7 @@ declare module L { * 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; + openPopup(latlng?: LatLngExpression): Path; /** * Closes the path's bound popup if it is opened. @@ -3351,7 +3375,7 @@ declare module L { * latlngs array representing the exterior ring while the remaining represent * the holes inside. */ - function polygon(latlngs: LatLng[], options?: PolylineOptions): Polygon; + function polygon(latlngs: LatLngBoundsExpression, options?: PolylineOptions): Polygon; export interface PolygonStatic extends ClassStatic { @@ -3362,7 +3386,7 @@ declare module L { * latlngs array representing the exterior ring while the remaining represent * the holes inside. */ - new(latlngs: LatLng[], options?: PolylineOptions): Polygon; + new(latlngs: LatLngBoundsExpression, options?: PolylineOptions): Polygon; } export var Polygon: PolygonStatic; @@ -3376,14 +3400,14 @@ declare module L { * Instantiates a polyline object given an array of geographical points and * optionally an options object. */ - function polyline(latlngs: LatLng[], options?: PolylineOptions): Polyline; + function polyline(latlngs: LatLngBoundsExpression, options?: PolylineOptions): Polyline; export interface PolylineStatic extends ClassStatic { /** * Instantiates a polyline object given an array of geographical points and * optionally an options object. */ - new(latlngs: LatLng[], options?: PolylineOptions): Polyline; + new(latlngs: LatLngBoundsExpression, options?: PolylineOptions): Polyline; } export var Polyline: PolylineStatic; @@ -3391,13 +3415,13 @@ declare module L { /** * Adds a given point to the polyline. */ - addLatLng(latlng: LatLng): Polyline; + addLatLng(latlng: LatLngExpression): Polyline; /** * Replaces all the points in the polyline with the given array of geographical * points. */ - setLatLngs(latlngs: LatLng[]): Polyline; + setLatLngs(latlngs: LatLngBoundsExpression): Polyline; /** * Returns an array of the points in the path. @@ -3490,7 +3514,7 @@ declare module L { /** * Sets the geographical point where the popup will open. */ - setLatLng(latlng: LatLng): Popup; + setLatLng(latlng: LatLngExpression): Popup; /** * Returns the geographical point of popup. diff --git a/less/less-tests.ts b/less/less-tests.ts index 71dfbae76..589250d0b 100644 --- a/less/less-tests.ts +++ b/less/less-tests.ts @@ -8,6 +8,6 @@ less.render(".class { width: (1 + 1) }").then((output) => { less.render("fail").then((output) => { throw new Error("promise should have been rejected"); -}, () => { - console.log("rejected as expected"); +}, (error: Less.RenderError) => { + console.log("rejected as expected on line number " + error.line); }); diff --git a/less/less.d.ts b/less/less.d.ts index 2c10ce50e..f329dd48e 100644 --- a/less/less.d.ts +++ b/less/less.d.ts @@ -51,6 +51,16 @@ declare module Less { rootFileInfo?: RootFileInfo; } + interface RenderError { + column: number; + extract: string[]; + filename: string; + index: number; + line: number; + message: string; + type: string; + } + interface RenderOutput { css: string; map: string; @@ -59,8 +69,8 @@ declare module Less { } interface LessStatic { - render(input: string, callback: (output: Less.RenderOutput) => void): void; - render(input: string, options: Less.Options, callback: (output: Less.RenderOutput) => void): void; + render(input: string, callback: (error: Less.RenderError, output: Less.RenderOutput) => void): void; + render(input: string, options: Less.Options, callback: (error: Less.RenderError, output: Less.RenderOutput) => void): void; render(input: string): Less.Promise; render(input: string, options: Less.Options): Less.Promise; diff --git a/localForage/localForage-tests.ts b/localForage/localForage-tests.ts index f1a416dcf..15638c1cb 100644 --- a/localForage/localForage-tests.ts +++ b/localForage/localForage-tests.ts @@ -1,34 +1,68 @@ -/// +/// -declare var localForage: lf.ILocalForage -declare var callback: lf.ICallback -declare var promise: lf.IPromise +declare var localForage: lf.ILocalForage; +declare var callback: lf.ICallback; +declare var iterateCallback: lf.IIterateCallback; +declare var errorCallback: lf.IErrorCallback; +declare var keyCallback: lf.IKeyCallback; +declare var keysCallback: lf.IKeysCallback; +declare var numberCallback: lf.INumberCallback; +declare var promise: lf.IPromise; () => { - localForage.clear() - localForage.length - localForage.key(0) + localForage.clear((err: any) => { + var newError: any = err; + }); + + localForage.iterate((str: string, key: string, num: number) => { + var newStr: string = str; + var newKey: string = key; + var newNum: number = num; + }); + + localForage.length((err: any, num: number) => { + var newError: any = err; + var newNumber: number = num; + }); + + localForage.key(0,(err: any, value: string) => { + var newError: any = err; + var newValue: string = value; + }); + + localForage.keys((err: any, keys: Array) => { + var newError: any = err; + var newArray: Array = keys; + }); + + localForage.getItem("key",(err: any, str: string) => { + var newError: any = err; + var newStr: string = str + }); + + localForage.getItem("key").then((err: any, str: string) => { + var newError: any = err; + var newStr: string = str + }); - localForage.getItem("key", (str: string) => { - var newStr: string = str - }) - localForage.getItem("key").then((str: string) => { - var newStr: string = str - }) + localForage.setItem("key", "value",(err: any, str: string) => { + var newError: any = err; + var newStr: string = str + }); + + localForage.setItem("key", "value").then((err: any, str: string) => { + var newError: any = err; + var newStr: string = str; + }); - localForage.setItem("key", "value", (str: string) => { - var newStr: string = str - }) - localForage.setItem("key", "value").then((str: string) => { - var newStr: string = str - }) + localForage.removeItem("key",(err: any) => { + var newError: any = err; + }); + + localForage.removeItem("key").then((err: any, str: string) => { + var newError: any = err; + var newStr: string = str + }); - localForage.removeItem("key", (str: string) => { - var newStr: string = str - }) - localForage.removeItem("key").then((str: string) => { - var newStr: string = str - }) - - promise.then(callback) + promise.then(callback); } diff --git a/localForage/localForage.d.ts b/localForage/localForage.d.ts index c3d0371d0..b5c40dd61 100644 --- a/localForage/localForage.d.ts +++ b/localForage/localForage.d.ts @@ -1,23 +1,70 @@ -// Type definitions for Mozilla's localForage +// Type definitions for Mozilla's localForage // Project: https://github.com/mozilla/localforage -// Definitions by: david pichsenmeister +// Definitions by: yuichi david pichsenmeister // Definitions: https://github.com/borisyankov/DefinitelyTyped declare module lf { interface ILocalForage { - clear(): void - key(index: number): T - length: number + /** + * Removes every key from the database, returning it to a blank slate. + */ + clear(callback: IErrorCallback): void + /** + * Iterate over all value/key pairs in datastore. + */ + iterate(iterateCallback: IIterateCallback): void + /** + * Get the name of a key based on its ID. + */ + key(keyIndex: number, callback: IKeyCallback): void + /** + * Get the list of all keys in the datastore. + */ + keys(callback: IKeysCallback): void; + /** + * Gets the number of keys in the offline store (i.e. its “length”). + */ + length(callback: INumberCallback): void + /** + * Gets an item from the storage library and supplies the result to a callback. + * If the key does not exist, getItem() will return null. + */ getItem(key: string, callback: ICallback): void getItem(key: string): IPromise + /** + * Saves data to an offline store. + */ setItem(key: string, value: T, callback: ICallback): void setItem(key: string, value: T): IPromise - removeItem(key: string, callback: ICallback): void + /** + * Removes the value of a key from the offline store. + */ + removeItem(key: string, callback: IErrorCallback): void removeItem(key: string): IPromise } interface ICallback { - (data: T): void + (err: any, value: T): void + } + + interface IIterateCallback { + (value: T, key: string, iterationNumber: number): void + } + + interface IErrorCallback { + (err: any): void + } + + interface IKeyCallback { + (err: any, keyName: string): void + } + + interface IKeysCallback { + (err: any, keys: Array): void + } + + interface INumberCallback { + (err: any, numberOfKeys: number): void } interface IPromise { diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 46c11ebf6..6a48e20c1 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -39,6 +39,10 @@ interface IKey { code: number; } +interface IDictionary { + [index: string]: T; +} + var foodsOrganic: IFoodOrganic[] = [ { name: 'banana', organic: true }, { name: 'beet', organic: false }, @@ -61,7 +65,10 @@ var stoogesAges: IStoogesAge[] = [ { 'name': 'moe', 'age': 40 }, { 'name': 'larry', 'age': 50 } ]; - +var stoogesAgesDict: IDictionary = { + first: { 'name': 'moe', 'age': 40 }, + second: { 'name': 'larry', 'age': 50 } +}; var stoogesCombined: IStoogesCombined[] = [ { 'name': 'curly', 'age': 30, 'quotes': ['Oh, a wise guy, eh?', 'Poifect!'] }, { 'name': 'moe', 'age': 40, 'quotes': ['Spread out!', 'You knucklehead!'] } @@ -139,6 +146,15 @@ result = <_.Dictionary>_(<{ [index: string]: string; }>{ 'key1': 'test1' // /************* // * Arrays * // *************/ +result = _.chunk([1, '2', '3', false]); +result = <_.LoDashArrayWrapper>_([1, '2', '3', false]).chunk(); +result = _.chunk([1, '2', '3', false], 2); +result = <_.LoDashArrayWrapper>_([1, '2', '3', false]).chunk(2); +result = _.chunk([1, 2, 3, 4]); +result = <_.LoDashArrayWrapper>_([1, 2, 3, 4]).chunk(); +result = _.chunk([1, 2, 3, 4], 2); +result = <_.LoDashArrayWrapper>_([1, 2, 3, 4]).chunk(2); + result = _.compact([0, 1, false, 2, '', 3]); result = <_.LoDashArrayWrapper>_([0, 1, false, 2, '', 3]).compact(); @@ -255,8 +271,14 @@ result = _.last(foodsType, { 'type': 'vegetable' }); result = _.lastIndexOf([1, 2, 3, 1, 2, 3], 2); result = _.lastIndexOf([1, 2, 3, 1, 2, 3], 2, 3); -result = <{ [key: string]: any }>_.zipObject(['moe', 'larry'], [30, 40]); -result = <{ [key: string]: any }>_.object(['moe', 'larry'], [30, 40]); +result = <_.Dictionary>_.zipObject(['moe', 'larry'], [30, 40]); +result = <_.LoDashObjectWrapper<_.Dictionary>>_(['moe', 'larry']).zipObject([30, 40]); +result = <_.Dictionary>_.object(['moe', 'larry'], [30, 40]); +result = <_.LoDashObjectWrapper<_.Dictionary>>_(['moe', 'larry']).object([30, 40]); +result = <_.Dictionary>_.zipObject([['moe', 30], ['larry', 40]]); +result = <_.LoDashObjectWrapper<_.Dictionary>>_([['moe', 30], ['larry', 40]]).zipObject(); +result = <_.Dictionary>_.object([['moe', 30], ['larry', 40]]); +result = <_.LoDashObjectWrapper<_.Dictionary>>_([['moe', 30], ['larry', 40]]).object(); result = _.pull([1, 2, 3, 1, 2, 3], 2, 3); @@ -492,6 +514,23 @@ result = <_.LoDashWrapper>_([4, 2, 8, 6]).min(); result = <_.LoDashWrapper>_(stoogesAges).min(function (stooge) { return stooge.age; }); result = <_.LoDashWrapper>_(stoogesAges).min('age'); +result = _.sum([4, 2, 8, 6]); +result = _.sum([4, 2, 8, 6], function(v) { return v; }); +result = _.sum({a: 2, b: 4}); +result = _.sum({a: 2, b: 4}, function(v) { return v; }); +result = _.sum(stoogesAges, function (stooge) { return stooge.age; }); +result = _.sum(stoogesAges, 'age'); +result = _.sum(stoogesAgesDict, function(stooge) { return stooge.age; }); +result = _.sum(stoogesAgesDict, 'age'); +result = _([4, 2, 8, 6]).sum(); +result = _([4, 2, 8, 6]).sum(function(v) { return v; }); +result = _({a: 2, b: 4}).sum(); +result = _({a: 2, b: 4}).sum(function(v) { return v; }); +result = _(stoogesAges).sum(function (stooge) { return stooge.age; }); +result = _(stoogesAges).sum('age'); +result = _(stoogesAgesDict).sum(function (stooge) { return stooge.age; }); +result = _(stoogesAgesDict).sum('age'); + result = _.pluck(stoogesAges, 'name'); result = _(stoogesAges).pluck('name').value(); @@ -602,6 +641,12 @@ result = _.where(stoogesCombined, { 'quotes': ['Poifect!'] } result = _(stoogesCombined).where({ 'age': 40 }).value(); result = _(stoogesCombined).where({ 'quotes': ['Poifect!'] }).value(); +/******** + * Date * + ********/ + +result = _.now(); + /************* * Functions * *************/ @@ -625,12 +670,16 @@ _.forEach(saves, function (type) { asyncSave({ 'type': type, 'complete': done }); }); -var funcBind = function (greeting: string) { return greeting + ' ' + this.name }; -var funcBind2: () => any = _.bind(funcBind, { 'name': 'moe' }, 'hi'); -funcBind2(); +var funcBind = function(greeting: string, punctuation: string) { return greeting + ' ' + this.user + punctuation; }; +var funcBound1: (punctuation: string) => any = _.bind(funcBind, { 'name': 'moe' }, 'hi'); +funcBound1('!'); -var funcBind3: () => any = _(funcBind).bind({ 'name': 'moe' }, 'hi').value(); -funcBind3(); +var funcBound2: (punctuation: string) => any = _(funcBind).bind({ 'name': 'moe' }, 'hi').value(); +funcBound2('!'); + +var addTwoNumbers = function (x: number, y: number) { return x + y }; +var plusTwo = _.bind(addTwoNumbers, null, 2); +plusTwo(100); var view = { 'label': 'docs', diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 55d35707f..602b05d31 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -17,7 +17,7 @@ declare module _ { * explicitly included in the build. * * The chainable wrapper functions are: - * after, assign, bind, bindAll, bindKey, chain, compact, compose, concat, countBy, + * after, assign, bind, bindAll, bindKey, chain, chunk, compact, compose, concat, countBy, * createCallback, curry, debounce, defaults, defer, delay, difference, filter, flatten, * forEach, forEachRight, forIn, forInRight, forOwn, forOwnRight, functions, groupBy, * indexBy, initial, intersection, invert, invoke, keys, map, max, memoize, merge, min, @@ -41,6 +41,7 @@ declare module _ { (value: number): LoDashWrapper; (value: string): LoDashWrapper; (value: boolean): LoDashWrapper; + (value: Array): LoDashNumberArrayWrapper; (value: Array): LoDashArrayWrapper; (value: T): LoDashObjectWrapper; (value: any): LoDashWrapper; @@ -98,7 +99,7 @@ declare module _ { **/ interface Support { /** - * Detect if an arguments object’s [[Class]] is resolvable (all but Firefox < 4, IE < 9). + * Detect if an arguments object's [[Class]] is resolvable (all but Firefox < 4, IE < 9). **/ argsClass: boolean; @@ -205,6 +206,8 @@ declare module _ { unshift(...items: any[]): LoDashWrapper; } + interface LoDashNumberArrayWrapper extends LoDashArrayWrapper { } + //_.chain interface LoDashStatic { /** @@ -254,6 +257,30 @@ declare module _ { /********* * Arrays * **********/ + + //_.chunk + interface LoDashStatic { + /** + * Creates an array of elements split into groups the length of size. If collection can't be + * split evenly, the final chunk will be the remaining elements. + * @param array The array to process. + * @param size The length of each chunk. + * @return Returns the new array containing chunks. + **/ + chunk(array: Array, size?: number): T[][]; + + /** + * @see _.chunk + **/ + chunk(array: List, size?: number): T[][]; + } + + interface LoDashArrayWrapper { + /** + * @see _.chunk + **/ + chunk(size?: number): LoDashArrayWrapper; + } //_.compact interface LoDashStatic { @@ -263,12 +290,12 @@ declare module _ { * @param array Array to compact. * @return (Array) Returns a new array of filtered values. **/ - compact(array: Array): T[]; + compact(array?: Array): T[]; /** * @see _.compact **/ - compact(array: List): T[]; + compact(array?: List): T[]; } interface LoDashArrayWrapper { @@ -288,13 +315,13 @@ declare module _ { * @return Returns a new array of filtered values. **/ difference( - array: Array, + array?: Array, ...others: Array[]): T[]; /** * @see _.difference **/ difference( - array: List, + array?: List, ...others: List[]): T[]; } @@ -432,12 +459,12 @@ declare module _ { * @param array Retrieves the first element of this array. * @return Returns the first element of `array`. **/ - first(array: Array): T; + first(array?: Array): T; /** * @see _.first **/ - first(array: List): T; + first(array?: List): T; /** * @see _.first @@ -2042,25 +2069,47 @@ declare module _ { //_.zipObject interface LoDashStatic { /** - * Creates an object composed from arrays of keys and values. Provide either a single - * two dimensional array, i.e. [[key1, value1], [key2, value2]] or two arrays, one of - * keys and one of corresponding values. - * @param keys The array of keys. - * @param values The array of values. - * @return An object composed of the given keys and corresponding values. + * The inverse of _.pairs; this method returns an object composed from arrays of property + * names and values. Provide either a single two dimensional array, e.g. [[key1, value1], + * [key2, value2]] or two arrays, one of property names and one of corresponding values. + * @param props The property names. + * @param values The property values. + * @return Returns the new object. **/ zipObject( - keys: List, - values: List): TResult; + props: List, + values?: List): TResult; /** - * @see _.object + * @see _.zipObject + **/ + zipObject(props: List>): Dictionary; + + /** + * @see _.zipObject **/ object( - keys: List, - values: List): TResult; - } + props: List, + values?: List): TResult; + /** + * @see _.zipObject + **/ + object(props: List>): Dictionary; + } + + interface LoDashArrayWrapper { + /** + * @see _.zipObject + **/ + zipObject(values?: List): _.LoDashObjectWrapper>; + + /** + * @see _.zipObject + **/ + object(values?: List): _.LoDashObjectWrapper>; + } + /* ************* * Collections * ************* */ @@ -2229,7 +2278,7 @@ declare module _ { **/ countBy( collection: Dictionary, - callback?: ListIterator, + callback?: DictionaryIterator, thisArg?: any): Dictionary; /** @@ -2314,7 +2363,7 @@ declare module _ { **/ every( collection: Dictionary, - callback?: ListIterator, + callback?: DictionaryIterator, thisArg?: any): boolean; /** @@ -2386,7 +2435,7 @@ declare module _ { **/ all( collection: Dictionary, - callback?: ListIterator, + callback?: DictionaryIterator, thisArg?: any): boolean; /** @@ -2473,7 +2522,7 @@ declare module _ { **/ filter( collection: Dictionary, - callback: ListIterator, + callback: DictionaryIterator, thisArg?: any): T[]; /** @@ -2545,7 +2594,7 @@ declare module _ { **/ select( collection: Dictionary, - callback: ListIterator, + callback: DictionaryIterator, thisArg?: any): T[]; /** @@ -2685,7 +2734,7 @@ declare module _ { **/ find( collection: Dictionary, - callback: ListIterator, + callback: DictionaryIterator, thisArg?: any): T; /** @@ -2757,7 +2806,7 @@ declare module _ { **/ detect( collection: Dictionary, - callback: ListIterator, + callback: DictionaryIterator, thisArg?: any): T; /** @@ -2829,7 +2878,7 @@ declare module _ { **/ findWhere( collection: Dictionary, - callback: ListIterator, + callback: DictionaryIterator, thisArg?: any): T; /** @@ -2931,7 +2980,7 @@ declare module _ { **/ findLast( collection: Dictionary, - callback: ListIterator, + callback: DictionaryIterator, thisArg?: any): T; /** @@ -3033,7 +3082,7 @@ declare module _ { **/ forEach( object: Dictionary, - callback: ObjectIterator, + callback: DictionaryIterator, thisArg?: any): Dictionary; /** @@ -3068,7 +3117,7 @@ declare module _ { **/ each( object: Dictionary, - callback: ObjectIterator, + callback: DictionaryIterator, thisArg?: any): Dictionary; /** @@ -3139,7 +3188,7 @@ declare module _ { **/ forEachRight( object: Dictionary, - callback: ObjectIterator, + callback: DictionaryIterator, thisArg?: any): Dictionary; /** @@ -3166,7 +3215,7 @@ declare module _ { **/ eachRight( object: Dictionary, - callback: ObjectIterator, + callback: DictionaryIterator, thisArg?: any): Dictionary; } @@ -3272,7 +3321,7 @@ declare module _ { **/ groupBy( collection: Dictionary, - callback?: ListIterator, + callback?: DictionaryIterator, thisArg?: any): Dictionary; /** @@ -3494,7 +3543,7 @@ declare module _ { **/ map( object: Dictionary, - callback: ObjectIterator, + callback: DictionaryIterator, thisArg?: any): TResult[]; /** @@ -3534,7 +3583,7 @@ declare module _ { **/ collect( object: Dictionary, - callback: ObjectIterator, + callback: DictionaryIterator, thisArg?: any): TResult[]; /** @@ -3633,7 +3682,7 @@ declare module _ { **/ max( collection: Dictionary, - callback?: ListIterator, + callback?: DictionaryIterator, thisArg?: any): T; /** @@ -3818,6 +3867,131 @@ declare module _ { min( whereValue: W): LoDashWrapper; } + + //_.sum + interface LoDashStatic { + /** + * Gets the sum of the values in collection. + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the sum. + **/ + sum( + collection: Array): number; + + /** + * @see _.sum + **/ + sum( + collection: List): number; + + /** + * @see _.sum + **/ + sum( + collection: Dictionary): number; + + /** + * @see _.sum + **/ + sum( + collection: Array, + iteratee: ListIterator, + thisArg?: any): number; + + /** + * @see _.sum + **/ + sum( + collection: List, + iteratee: ListIterator, + thisArg?: any): number; + + /** + * @see _.sum + **/ + sum( + collection: Dictionary, + iteratee: ObjectIterator, + thisArg?: any): number; + + /** + * @see _.sum + * @param property _.property callback shorthand. + **/ + sum( + collection: Array, + property: string): number; + + /** + * @see _.sum + * @param property _.property callback shorthand. + **/ + sum( + collection: List, + property: string): number; + + /** + * @see _.sum + * @param property _.property callback shorthand. + **/ + sum( + collection: Dictionary, + property: string): number; + } + + interface LoDashNumberArrayWrapper { + /** + * @see _.sum + **/ + sum(): number + + /** + * @see _.sum + **/ + sum( + iteratee: ListIterator, + thisArg?: any): number; + } + + interface LoDashArrayWrapper { + /** + * @see _.sum + **/ + sum( + iteratee: ListIterator, + thisArg?: any): number; + + /** + * @see _.sum + * @param property _.property callback shorthand. + **/ + sum( + property: string): number; + } + + interface LoDashObjectWrapper { + /** + * @see _.sum + **/ + sum(): number + + /** + * @see _.sum + **/ + sum( + iteratee: ObjectIterator, + thisArg?: any): number; + + /** + * @see _.sum + * @param property _.property callback shorthand. + **/ + sum( + property: string): number; + } //_.pluck interface LoDashStatic { @@ -4266,7 +4440,7 @@ declare module _ { **/ reject( collection: Dictionary, - callback: ListIterator, + callback: DictionaryIterator, thisArg?: any): T[]; /** @@ -4477,7 +4651,7 @@ declare module _ { **/ some( collection: Dictionary, - callback?: ListIterator, + callback?: DictionaryIterator, thisArg?: any): boolean; /** @@ -4557,7 +4731,7 @@ declare module _ { **/ any( collection: Dictionary, - callback?: ListIterator, + callback?: DictionaryIterator, thisArg?: any): boolean; /** @@ -4771,6 +4945,20 @@ declare module _ { where(properties: U): LoDashArrayWrapper; } + /******** + * Date * + ********/ + + //_.now + interface LoDashStatic { + /** + * Gets the number of milliseconds that have elapsed since the Unix epoch + * (1 January 1970 00:00:00 UTC). + * @return The number of milliseconds. + **/ + now(): number; + } + /************* * Functions * *************/ @@ -4809,7 +4997,7 @@ declare module _ { bind( func: Function, thisArg: any, - ...args: any[]): () => any; + ...args: any[]): (...args: any[]) => any; } interface LoDashObjectWrapper { @@ -4818,7 +5006,7 @@ declare module _ { **/ bind( thisArg: any, - ...args: any[]): LoDashObjectWrapper<() => any>; + ...args: any[]): LoDashObjectWrapper<(...args: any[]) => any>; } //_.bindAll @@ -4973,7 +5161,7 @@ declare module _ { * @param wait The number of milliseconds to delay. * @param options The options object. * @param options.leading Specify execution on the leading edge of the timeout. - * @param options.maxWait The maximum time func is allowed to be delayed before it’s called. + * @param options.maxWait The maximum time func is allowed to be delayed before it's called. * @param options.trailing Specify execution on the trailing edge of the timeout. * @return The new debounced function. **/ @@ -4999,7 +5187,7 @@ declare module _ { leading?: boolean; /** - * The maximum time func is allowed to be delayed before it’s called. + * The maximum time func is allowed to be delayed before it's called. **/ maxWait?: number; @@ -5500,7 +5688,7 @@ declare module _ { **/ forIn( object: Dictionary, - callback?: ObjectIterator, + callback?: DictionaryIterator, thisArg?: any): Dictionary; /** @@ -5533,7 +5721,7 @@ declare module _ { **/ forInRight( object: Dictionary, - callback?: ObjectIterator, + callback?: DictionaryIterator, thisArg?: any): Dictionary; /** @@ -5567,7 +5755,7 @@ declare module _ { **/ forOwn( object: Dictionary, - callback?: ObjectIterator, + callback?: DictionaryIterator, thisArg?: any): Dictionary; /** @@ -5600,7 +5788,7 @@ declare module _ { **/ forOwnRight( object: Dictionary, - callback?: ObjectIterator, + callback?: DictionaryIterator, thisArg?: any): Dictionary; /** * @see _.forOwnRight @@ -5677,7 +5865,7 @@ declare module _ { * @param value The value to check. * @return True if the value is an arguments object, else false. **/ - isArguments(value: any): boolean; + isArguments(value?: any): boolean; } //_.isArray @@ -5687,7 +5875,7 @@ declare module _ { * @param value The value to check. * @return True if the value is an array, else false. **/ - isArray(value: any): boolean; + isArray(value?: any): boolean; } //_.isBoolean @@ -5697,7 +5885,7 @@ declare module _ { * @param value The value to check. * @return True if the value is a boolean value, else false. **/ - isBoolean(value: any): boolean; + isBoolean(value?: any): boolean; } //_.isDate @@ -5707,7 +5895,7 @@ declare module _ { * @param value The value to check. * @return True if the value is a date, else false. **/ - isDate(value: any): boolean; + isDate(value?: any): boolean; } //_.isElement @@ -5717,7 +5905,7 @@ declare module _ { * @param value The value to check. * @return True if the value is a DOM element, else false. **/ - isElement(value: any): boolean; + isElement(value?: any): boolean; } //_.isEmpty @@ -5728,22 +5916,7 @@ declare module _ { * @param value The value to inspect. * @return True if the value is empty, else false. **/ - isEmpty(value: any[]): boolean; - - /** - * @see _.isEmpty - **/ - isEmpty(value: Dictionary): boolean; - - /** - * @see _.isEmpty - **/ - isEmpty(value: string): boolean; - - /** - * @see _.isEmpty - **/ - isEmpty(value: any): boolean; + isEmpty(value?: any[]|Dictionary|string|any): boolean; } //_.isError @@ -5772,8 +5945,8 @@ declare module _ { * @return True if the values are equivalent, else false. **/ isEqual( - a: any, - b: any, + a?: any, + b?: any, callback?: (a: any, b: any) => boolean, thisArg?: any): boolean; } @@ -5788,7 +5961,7 @@ declare module _ { * @param value The value to check. * @return True if the value is finite, else false. **/ - isFinite(value: any): boolean; + isFinite(value?: any): boolean; } //_.isFunction @@ -5798,7 +5971,7 @@ declare module _ { * @param value The value to check. * @return True if the value is a function, else false. **/ - isFunction(value: any): boolean; + isFunction(value?: any): boolean; } //_.isNaN @@ -5811,7 +5984,7 @@ declare module _ { * @param value The value to check. * @return True if the value is NaN, else false. **/ - isNaN(value: any): boolean; + isNaN(value?: any): boolean; } //_.isNull @@ -5821,7 +5994,7 @@ declare module _ { * @param value The value to check. * @return True if the value is null, else false. **/ - isNull(value: any): boolean; + isNull(value?: any): boolean; } //_.isNumber @@ -5833,7 +6006,7 @@ declare module _ { * @param value The value to check. * @return True if the value is a number, else false. **/ - isNumber(value: any): boolean; + isNumber(value?: any): boolean; } //_.isObject @@ -5844,7 +6017,7 @@ declare module _ { * @param value The value to check. * @return True if the value is an object, else false. **/ - isObject(value: any): boolean; + isObject(value?: any): boolean; } //_.isPlainObject @@ -5854,7 +6027,7 @@ declare module _ { * @param value The value to check. * @return True if value is a plain object, else false. **/ - isPlainObject(value: any): boolean; + isPlainObject(value?: any): boolean; } //_.isRegExp @@ -5864,7 +6037,7 @@ declare module _ { * @param value The value to check. * @return True if the value is a regular expression, else false. **/ - isRegExp(value: any): boolean; + isRegExp(value?: any): boolean; } //_.isString @@ -5874,7 +6047,7 @@ declare module _ { * @param value The value to check. * @return True if the value is a string, else false. **/ - isString(value: any): boolean; + isString(value?: any): boolean; } //_.isUndefined @@ -5884,7 +6057,7 @@ declare module _ { * @param value The value to check. * @return True if the value is undefined, else false. **/ - isUndefined(value: any): boolean; + isUndefined(value?: any): boolean; } //_.keys @@ -5894,7 +6067,7 @@ declare module _ { * @param object The object to inspect. * @return An array of property names. **/ - keys(object: any): string[]; + keys(object?: any): string[]; } interface LoDashObjectWrapper { @@ -6039,12 +6212,12 @@ declare module _ { //_.pairs interface LoDashStatic { /** - * Creates a two dimensional array of an object’s key-value pairs, + * Creates a two dimensional array of an object's key-value pairs, * i.e. [[key1, value1], [key2, value2]]. * @param object The object to inspect. * @return Aew array of key-value pairs. **/ - pairs(object: any): any[][]; + pairs(object?: any): any[][]; } interface LoDashObjectWrapper { @@ -6156,7 +6329,7 @@ declare module _ { * @param object The object to inspect. * @return Returns an array of property values. **/ - values(object: any): any[]; + values(object?: any): any[]; } /********** @@ -6182,10 +6355,8 @@ declare module _ { trimLeft(str?: string, chars?: string): string; trimRight(str?: string, chars?: string): string; trunc(str?: string, len?: number): string; - trunc(str?: string, options?: { length?: number; omission?: string; separator?: string }): string; - trunc(str?: string, options?: { length?: number; omission?: string; separator?: RegExp }): string; - words(str?: string, pattern?: string): string[]; - words(str?: string, pattern?: RegExp): string[]; + trunc(str?: string, options?: { length?: number; omission?: string; separator?: string|RegExp }): string; + words(str?: string, pattern?: string|RegExp): string[]; } //_.parseInt @@ -6200,7 +6371,7 @@ declare module _ { * @param radix The radix used to interpret the value to parse. * @return The new integer value. **/ - parseInt(value: string, radix?: number): number; + parseInt(value?: string, radix?: number): number; } /************* @@ -6213,7 +6384,7 @@ declare module _ { * @param string The string to escape. * @return The escaped string. **/ - escape(str: string): string; + escape(str?: string): string; } //_.identity @@ -6223,7 +6394,7 @@ declare module _ { * @param value Any value. * @return value. **/ - identity(value: T): T; + identity(value?: T): T; } //_.mixin @@ -6232,7 +6403,7 @@ declare module _ { * Adds function properties of a source object to the lodash function and chainable wrapper. * @param object The object of function properties to add to lodash. **/ - mixin(object: Dictionary<(value: any) => any>): void; + mixin(object?: Dictionary<(value: any) => any>): void; } //_.noConflict @@ -6247,7 +6418,7 @@ declare module _ { //_.property interface LoDashStatic { /** - * # Ⓢ + * # S * Creates a "_.pluck" style function, which returns the key value of a given object. * @param key (string) * @return the value of that key on the object @@ -6319,7 +6490,7 @@ declare module _ { * @param options.evaluate The "evaluate" delimiter. * @param options.import An object to import into the template as local variables. * @param options.interpolate The "interpolate" delimiter. - * @param sourceURL The sourceURL of the template’s compiled source. + * @param sourceURL The sourceURL of the template's compiled source. * @param variable The data object variable name. * @return Returns the compiled Lo-Dash HTML template or a TemplateExecutor if no data is passed. **/ @@ -6406,11 +6577,15 @@ declare module _ { } interface ListIterator { - (value: T, index: number, list: T[]): TResult; + (value: T, index: number, collection: T[]): TResult; + } + + interface DictionaryIterator { + (value: T, key: string, collection: Dictionary): TResult; } interface ObjectIterator { - (element: T, key: string, list: any): TResult; + (element: T, key: string, collection: any): TResult; } interface MemoVoidIterator { diff --git a/lory.js/lory.js-tests.ts b/lory.js/lory.js-tests.ts new file mode 100644 index 000000000..4247dceca --- /dev/null +++ b/lory.js/lory.js-tests.ts @@ -0,0 +1,62 @@ +/// + +(function() { + var elm = document.querySelector('.js-foo'); + var elm2 = document.querySelector('.js-bar'); + var elm3 = document.querySelector('.js-baz'); + var elm4 = document.querySelector('.js-foobar'); + + ////////////////////////////////////////////////// + // Init + ////////////////////////////////////////////////// + + lory(elm); + + // with options + lory(elm2, { + slidesToScroll: 1, + slideSpeed: 300, + rewindSpeed: 600, + snapBackSpeed: 200, + ease: 'ease', + rewind: true, + infinite: false + }); + + // with callbacks + lory(elm3, { + beforeInit: () => { }, + afterInit: () => { }, + beforePrev: () => { return 1; }, + beforeNext: () => { return false; }, + beforeTouch: () => { return ''; }, + beforeResize: () => { } + }); + + // with options & callbacks + lory(elm4, { + slidesToScroll: 1, + slideSpeed: 300, + rewindSpeed: 600, + snapBackSpeed: 200, + ease: 'ease', + rewind: true, + infinite: 4, + beforeInit: () => { return function() { console.log('foo') }; }, + afterInit: () => { return [0, 1]; }, + beforePrev: () => { }, + beforeNext: () => { }, + beforeTouch: () => { }, + beforeResize: () => { return {}; } + }); + + ////////////////////////////////////////////////// + // Public API + ////////////////////////////////////////////////// + + lory.setup(); + lory.prev(); + lory.next(); + lory.reset(); + lory.slideTo(1); +}()); diff --git a/lory.js/lory.js.d.ts b/lory.js/lory.js.d.ts new file mode 100644 index 000000000..4dc7860d8 --- /dev/null +++ b/lory.js/lory.js.d.ts @@ -0,0 +1,110 @@ +// Type definitions for lory 0.4.3 +// Project: https://github.com/meandmax/lory/ +// Definitions by: kubosho +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare var lory: LoryStatic; + +interface LoryStatic { + (element: Element, options?: LoryOptions): LoryStatic; + + /** + * slides to the previous slide. + */ + prev(): void; + + /** + * slides to the next slide. + */ + next(): void; + + /** + * slides to the index given as an argument. + */ + slideTo(index: number): void; + + /** + * binds eventlisteners, merging default and user options, setup the slides based on DOM (called once during initialisation). Call setup if DOM or user options have changed or eventlisteners needs to be rebinded. + */ + setup(): void; + + /** + * sets the slider back to the starting position and resets the current index (called on resize event). + */ + reset(): void; +} + +interface LoryOptions { + ////////////////////////////////////////////////// + // Options + ////////////////////////////////////////////////// + + /** + * slides scrolled at once (default: 1). + */ + slidesToScroll?: number; + + /** + * time in milliseconds for the animation of a valid slide attempt (default: 300). + */ + slideSpeed?: number; + + /** + * time in milliseconds for the animation of the rewind after the last slide (default: 600). + */ + rewindSpeed?: number; + + /** + * time for the snapBack of the slider if the slide attempt was not valid (default: 200). + */ + snapBackSpeed?: number; + + /** + * cubic bezier easing functions: http://easings.net/de (default: 'cubic-bezier(0.455, 0.03, 0.515, 0.955)'). + */ + ease?: string; + + /** + * if slider reached the last slide, with next click the slider goes back to the startindex (default: false). + */ + rewind?: boolean; + + /** + * like carousel, works with multiple slides (default: false). (do not combine with rewind) + */ + infinite?: boolean | number; + + ////////////////////////////////////////////////// + // Callbacks + ////////////////////////////////////////////////// + + /** + * executed before initialisation (first in setup function) + */ + beforeInit?: () => T; + + /** + * executed after initialisation (end of setup function) + */ + afterInit?: () => T; + + /** + * executed on click of prev controls (prev function) + */ + beforePrev?: () => T; + + /** + * executed on click of next controls (next function) + */ + beforeNext?: () => T; + + /** + * executed on touch attempt (touchstart) + */ + beforeTouch?: () => T; + + /** + * executed on every resize event + */ + beforeResize?: () => T; +} diff --git a/magicsuggest/magicsuggest-tests.ts b/magicsuggest/magicsuggest-tests.ts new file mode 100644 index 000000000..b41cf9f71 --- /dev/null +++ b/magicsuggest/magicsuggest-tests.ts @@ -0,0 +1,26 @@ +/// +/// + +function basicTest() { + $('#magicSuggest').magicSuggest(); +} + +function testWithConfigurationOptions() { + $('#magicSuggest').magicSuggest({ + data: [ + { id: 1, name: "Buenos Aires" }, + { id: 2, name: "New York" }, + { id: 3, name: "Madrid" }, + ], + maxDropHeight: 500, + maxSelection: 2, + expandOnFocus: true, + }); +} + +function testSomeMethods() { + var ms = $('#magicSuggest').magicSuggest(); + ms.addToSelection([{ id: 1, name: "Mexico" }]); + console.info(ms.getSelection()); + ms.disable() +} \ No newline at end of file diff --git a/magicsuggest/magicsuggest.d.ts b/magicsuggest/magicsuggest.d.ts new file mode 100644 index 000000000..660a58c5c --- /dev/null +++ b/magicsuggest/magicsuggest.d.ts @@ -0,0 +1,467 @@ +// Type definitions for MagicSuggest 2.1.4 +// Project: http://nicolasbize.com/magicsuggest +// Definitions by: Leonardo Chaia +// Definitions: http://github.com/leonardochaia/DefinitelyTyped + +/// +interface JQuery { + /** + * Initialize MagicSuggest on this selector + */ + magicSuggest(configurationObject?: MagicSuggest.Configuration): MagicSuggest.Instance; +} + +declare module MagicSuggest { + interface Configuration { + /********** CONFIGURATION PROPERTIES ************/ + /** + * Restricts or allows the user to validate typed entries. + * Defaults to true. + */ + allowFreeEntries?: boolean; + + /** + * Restricts or allows the user to add the same entry more than once + * Defaults to false. + */ + allowDuplicates?: boolean; + + /** + * Additional config object passed to each $.ajax call + */ + ajaxConfig?: JQueryAjaxSettings; + + /** + * If a single suggestion comes out, it is preselected. + */ + autoSelect?: boolean; + + /** + * Auto select the first matching item with multiple items shown + */ + selectFirst?: boolean; + + /** + * Allow customization of query parameter + */ + queryParam?: string; + + /** + * A function triggered just before the ajax request is sent, similar to jQuery + */ + beforeSend?: () => void; + + /** + * A custom CSS class to apply to the field's underlying element. + */ + cls?: string; + + /** + * JSON Data source used to populate the combo box. 3 options are available here: + * No Data Source (default) + * When left null, the combo box will not suggest anything. It can still enable the user to enter + * multiple entries if allowFreeEntries is * set to true (default). + * Static Source + * You can pass an array of JSON objects, an array of strings or even a single CSV string as the + * data source.For ex. data: [* {id:0,name:"Paris"}, {id: 1, name: "New York"}] + * You can also pass any json object with the results property containing the json array. + * Url + * You can pass the url from which the component will fetch its JSON data.Data will be fetched + * using a POST ajax request that will * include the entered text as 'query' parameter. The results + * fetched from the server can be: + * - an array of JSON objects (ex: [{id:...,name:...},{...}]) + * - a string containing an array of JSON objects ready to be parsed (ex: "[{id:...,name:...},{...}]") + * - a JSON object whose data will be contained in the results property + * (ex: {results: [{id:...,name:...},{...}] + * Function + * You can pass a function which returns an array of JSON objects (ex: [{id:...,name:...},{...}]) + * The function can return the JSON data or it can use the first argument as function to handle the data. + * Only one (callback function or return value) is needed for the function to succeed. + * See the following example: + * function (response) { var myjson = [{name: 'test', id: 1}]; response(myjson); return myjson; } + */ + data?: any; + + /** + * Additional parameters to the ajax call + */ + dataUrlParams?: Object; + + /** + * Start the component in a disabled state. + */ + disabled?: boolean; + + /** + * Name of JSON object property that defines the disabled behaviour + */ + disabledField?: string; + + /** + * Name of JSON object property displayed in the combo list + */ + displayField?: string; + + /** + * Set to false if you only want mouse interaction. In that case the combo will + * automatically expand on focus. + */ + editable?: boolean; + + /** + * Set starting state for combo. + */ + expanded?: boolean; + + /** + * Automatically expands combo on focus. + */ + expandOnFocus?: boolean; + + /** + * JSON property by which the list should be grouped + */ + groupBy?: string; + + /** + * Set to true to hide the trigger on the right + */ + hideTrigger?: boolean; + + /** + * Set to true to highlight search input within displayed suggestions + */ + highlight?: boolean; + + /** + * A custom ID for this component + */ + id?: string; + + /** + * A class that is added to the info message appearing on the top-right part of the component + */ + infoMsgCls?: string; + + /** + * Additional parameters passed out to the INPUT tag. Enables usage of AngularJS's custom tags for ex. + */ + inputCfg?: any; + + /** + * The class that is applied to show that the field is invalid + */ + invalidCls?: string; + + /** + * Set to true to filter data results according to case. Useless if the data is fetched remotely + */ + matchCase?: boolean; + + /** + * Once expanded, the combo's height will take as much room as the # of available results. + * In case there are too many results displayed, this will fix the drop down height. + */ + maxDropHeight?: number; + + /** + * Defines how long the user free entry can be. Set to null for no limit. + */ + maxEntryLength?: number; + + /** + * A function that defines the helper text when the max entry length has been surpassed. + */ + maxEntryRenderer?: (v?: number) => void; + + /** + * The maximum number of results displayed in the combo drop down at once. + */ + maxSuggestions?: number; + + /** + * The maximum number of items the user can select if multiple selection is allowed. + * Set to null to remove the limit. + */ + maxSelection?: number; + + /** + * A function that defines the helper text when the max selection amount has been reached. The function has a single + * parameter which is the number of selected elements. + */ + maxSelectionRenderer?: (v: number) => void; + + /** + * The method used by the ajax request. + */ + method?: string; + + /** + * The minimum number of characters the user must type before the combo expands and offers suggestions. + */ + minChars?: number; + + /** + * A function that defines the helper text when not enough letters are set. The function has a single + * parameter which is the difference between the required amount of letters and the current one. + */ + minCharsRenderer?: (v: number) => void; + + /** + * Whether or not sorting / filtering should be done remotely or locally. + * Use either 'local' or 'remote' + */ + mode?: string; + + /** + * The name used as a form element. + */ + name?: string; + + /** + * The text displayed when there are no suggestions. + */ + noSuggestionText?: string; + + /** + * The default placeholder text when nothing has been entered + */ + placeholder?: string; + + /** + * A function used to define how the items will be presented in the combo + */ + renderer?: (item: any) => void; + + /** + * Whether or not this field should be required + */ + required?: boolean; + + /** + * Set to true to render selection as a delimited string + */ + resultAsString?: boolean; + + /** + * Text delimiter to use in a delimited string. + */ + resultAsStringDelimiter?: string; + + /** + * Name of JSON object property that represents the list of suggested objects + */ + resultsField?: string; + + /** + * A custom CSS class to add to a selected item + */ + selectionCls?: string; + + /** + * An optional element replacement in which the selection is rendered + */ + selectionContainer?: JQuery; + + /** + * Where the selected items will be displayed. Only 'right', 'bottom' and 'inner' are valid values + */ + selectionPosition?: string; + + /** + * A function used to define how the items will be presented in the tag list + */ + selectionRenderer?: (item: any) => void; + + /** + * Set to true to stack the selectioned items when positioned on the bottom + * Requires the selectionPosition to be set to 'bottom' + */ + selectionStacked?: boolean; + + /** + * Direction used for sorting. Only 'asc' and 'desc' are valid values + */ + sortDir?: string; + + /** + * name of JSON object property for local result sorting. + * Leave null if you do not wish the results to be ordered or if they are already ordered remotely. + */ + sortOrder?: string; + + /** + * If set to boolean; suggestions will have to start by user input (and not simply contain it as a substring) + */ + strictSuggest?: boolean; + + /** + * Custom style added to the component container. + */ + style?: string; + + /** + * If set to boolean; the combo will expand / collapse when clicked upon + */ + toggleOnClick?: boolean; + + + /** + * Amount (in ms) between keyboard registers. + */ + typeDelay?: number; + + /** + * If set to boolean; tab won't blur the component but will be registered as the ENTER key + */ + useTabKey?: boolean; + + /** + * If set to boolean; using comma will validate the user's choice + */ + useCommaKey?: boolean; + + + /** + * Determines whether or not the results will be displayed with a zebra table style + */ + useZebraStyle?: boolean; + + /** + * initial value for the field + */ + value?: any; + + /** + * name of JSON object property that represents its underlying value + */ + valueField?: string; + + /** + * regular expression to validate the values against + */ + vregex?: any; + + /** + * type to validate against + */ + vtype?: any; + } + + interface Instance { + /** + * Add one or multiple json items to the current selection + * @param items - json object or array of json objects + * @param isSilent - (optional) set to true to suppress 'selectionchange' event from being triggered + */ + addToSelection(objs: Array, isSilent?: boolean): void; + + /** + * Clears the current selection + * @param isSilent - (optional) set to true to suppress 'selectionchange' event from being triggered + */ + clear(isSilent?: boolean): void; + + /** + * Collapse the drop down part of the combo + */ + collapse(): void; + + /** + * Set the component in a disabled state. + */ + disable(): void; + + /** + * Empties out the combo user text + */ + empty(): void; + + /** + * Set the component in a enable state. + */ + enable(): void; + + /** + * Retrieve component enabled status + * @return {boolean} + */ + isDisabled(): boolean; + + /** + * Checks whether the field is valid or not + * @return {boolean} + */ + isValid(): boolean; + + /** + * Gets the data params for current ajax request + */ + getDataUrlParams(): Object; + + /** + * Gets the name given to the form input + */ + getName(): string; + + /** + * Retrieve an array of selected json objects + * @return {Array} + */ + getSelection(): Array; + + /** + * Retrieve the current text entered by the user + */ + getRawValue(): string; + + /** + * Retrieve an array of selected values + */ + getValue(): Array; + + /** + * Remove one or multiples json items from the current selection + * @param items - json object or array of json objects + * @param isSilent - (optional) set to true to suppress 'selectionchange' event from being triggered + */ + removeFromSelection(items: any, isSilent: boolean): void; + + /** + * Set up some combo data after it has been rendered + * @param data + */ + setData(data: any): void; + + /** + * Get current data + */ + getData(): any; + + /** + * Sets the name for the input field so it can be fetched in the form + * @param name + */ + setName(name: string): void; + + /** + * Sets the current selection with the JSON items provided + * @param items + * @param isSilent - (optional) + */ + setSelection(items: Array, isSilet?: boolean): void; + + /** + * Sets a value for the combo box. Value must be an array of values with data type matching valueField one. + * @param data + */ + setValue(values: Array): void; + + /** + * Sets data params for subsequent ajax requests + * @param params + */ + setDataUrlParams(params: any): void; + + } +} \ No newline at end of file diff --git a/mailcheck/mailcheck-tests.ts b/mailcheck/mailcheck-tests.ts new file mode 100644 index 000000000..4a5caa12a --- /dev/null +++ b/mailcheck/mailcheck-tests.ts @@ -0,0 +1,55 @@ +/// +/// + +import MC = require('mailcheck'); + +var domains = ['gmail.com', 'aol.com']; +var secondLevelDomains = ['hotmail'] +var topLevelDomains = ["com", "net", "org"]; + +var superStringDistance = function(string1: string, string2: string): number { + // a string distance algorithm of your choosing + return 0; +}; + +$('#email').on('blur', function() { + $(this).mailcheck({ + domains: domains, // optional + secondLevelDomains: secondLevelDomains, // optional + topLevelDomains: topLevelDomains, // optional + distanceFunction: superStringDistance, // optional + suggested: function(element: JQuery, suggestion: MailcheckModule.ISuggestion) { + // callback code + }, + empty: function(element: JQuery) { + // callback code + } + }); +}); + +Mailcheck.run({ + domains: domains, // optional + secondLevelDomains: secondLevelDomains, // optional + topLevelDomains: topLevelDomains, // optional + distanceFunction: superStringDistance, // optional + suggested: function(suggestion: MailcheckModule.ISuggestion) { + // callback code + }, + empty: function() { + // callback code + } +}); + +MC.run({ + domains: domains, // optional + secondLevelDomains: secondLevelDomains, // optional + topLevelDomains: topLevelDomains, // optional + distanceFunction: superStringDistance, // optional + suggested: function(suggested: MailcheckModule.ISuggestion) { + // callback code + suggested.address === '' && suggested.full === '' && suggested.domain === ''; + }, + empty: function() { + // callback code + } +}); \ No newline at end of file diff --git a/mailcheck/mailcheck.d.ts b/mailcheck/mailcheck.d.ts new file mode 100644 index 000000000..c6f28d0db --- /dev/null +++ b/mailcheck/mailcheck.d.ts @@ -0,0 +1,78 @@ +// Type definitions for Mailcheck 1.1+ +// Project: https://github.com/mailcheck/mailcheck +// Definitions by: Paulo Cesar +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare var Mailcheck: MailcheckModule.Static; + +declare module MailcheckModule { + + export interface IDistanceFunction { + (s1: string, s2: string): number; + } + + export interface ISuggestFunction { + (email: string, domains?: string[], topLevelDomains?: string[], distanceFunction?: IDistanceFunction):void; + } + + export interface IJQuerySuggested { + (element: JQuery, suggested: ISuggestion): void; + } + + export interface IJQueryEmpty { + (element: JQuery): void; + } + + export interface IEmpty { + (): void; + } + + export interface ISuggested { + (suggested: ISuggestion): void; + } + + export interface ISplitEmail { + topLevelDomain?: string; + domain?: string; + address?: string; + } + + export interface ISuggestion { + address: string; + domain: string; + full: string; + } + + export interface IOptions { + domains?: string[]; + topLevelDomains?: string[]; + distanceFunction?: IDistanceFunction; + suggested?: ISuggested | IJQuerySuggested; + empty?: IEmpty | IJQueryEmpty; + } + + export interface Static { + defaultDomains: string[]; + defaultSecondLevelDomains: string[]; + defaultTopLevelDomains: string[]; + domainThreshold: number; + topLevelThreshold: number; + run(opts: IOptions):void; + suggest: ISuggestFunction; + encodeEmail(email: string): string; + splitEmail(email: string): ISplitEmail; + sift3Distance(s1: string, s2: string): number; + findClosestDomain(domain: string, domains: string[], distanceFunction?: IDistanceFunction, threshold?: number): boolean|string; + } + +} + +interface JQuery { + mailcheck(opts: MailcheckModule.IOptions): void; +} + +declare module 'mailcheck' { + export = Mailcheck; +} \ No newline at end of file diff --git a/mandrill-api/mandrill-api.d.ts b/mandrill-api/mandrill-api.d.ts new file mode 100644 index 000000000..54a9a73a4 --- /dev/null +++ b/mandrill-api/mandrill-api.d.ts @@ -0,0 +1,1182 @@ +// Type definitions for Mandrill API 1.x +// Project: http://mandrill.com/ +// Definitions by: Paulo Cesar +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/* =================== USAGE =================== + + import mandrill from 'mandrill-api'; + + =============================================== */ + +/// + +declare module 'mandrill-api' { + + export interface ICallback { + (json: Object): void; + } + + export interface IErrorCallback { + (err: Error): void; + } + + export class Mandrill { + apikey: string; + debug: boolean; + templates: Templates; + exports: Exports; + users: Users; + rejects: Rejects; + inbound: Inbound; + tags: Tags; + messages: Messages; + whitelists: Whitelists; + ips: Ips; + internal: Internal; + subaccounts: Subaccounts; + urls: Urls; + webhooks: Webhooks; + senders: Senders; + metadata: Metadata; + onerror: IErrorCallback; + constructor(apikey: string, debug?: boolean); + call(uri: string, params: any, onresult?: ICallback, onerror?: ICallback): void; + } + + export class Templates { + constructor(master: Mandrill); + + /** + * Add a new template + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} name the name for the new template - must be unique + * @option params {String} from_email a default sending address for emails sent using this template + * @option params {String} from_name a default from name to be used + * @option params {String} subject a default subject line to be used + * @option params {String} code the HTML code for the template with mc:edit attributes for the editable elements + * @option params {String} text a default text part to be used when sending with this template + * @option params {Boolean} publish set to false to add a draft template without publishing + * @option params {Array} labels an optional array of up to 10 labels to use for filtering templates + * - labels[] {String} a single label + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + add(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + /** + * Get the information for an existing template + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} name the immutable name of an existing template + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + info(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + /** + * Update the code for an existing template. If null is provided for any fields, the values will remain unchanged. + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} name the immutable name of an existing template + * @option params {String} from_email the new default sending address + * @option params {String} from_name the new default from name + * @option params {String} subject the new default subject line + * @option params {String} code the new code for the template + * @option params {String} text the new default text part to be used + * @option params {Boolean} publish set to false to update the draft version of the template without publishing + * @option params {Array} labels an optional array of up to 10 labels to use for filtering templates + * - labels[] {String} a single label + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + update(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + /** + * Publish the content for the template. Any new messages sent using this template will start using the content that was previously in draft. + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} name the immutable name of an existing template + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + publish(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + /** + * Delete a template + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} name the immutable name of an existing template + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + delete(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + /** + * Return a list of all the templates available to this user + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} label an optional label to filter the templates + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + list(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + /** + * Return the recent history (hourly stats for the last 30 days) for a template + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} name the name of an existing template + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + timeSeries(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + /** + * Inject content and optionally merge fields into a template, returning the HTML that results + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} template_name the immutable name of a template that exists in the user's account + * @option params {Array} template_content an array of template content to render. Each item in the array should be a struct with two keys - name: the name of the content block to set the content for, and content: the actual content to put into the block + * - template_content[] {Object} the injection of a single piece of content into a single editable region + * - name {String} the name of the mc:edit editable region to inject into + * - content {String} the content to inject + * @option params {Array} merge_vars optional merge variables to use for injecting merge field content. If this is not provided, no merge fields will be replaced. + * - merge_vars[] {Object} a single merge variable + * - name {String} the merge variable's name. Merge variable names are case-insensitive and may not start with _ + * - content {String} the merge variable's content + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + render(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + } + + export class Exports { + constructor(master: Mandrill); + + /** + * Returns information about an export job. If the export job's state is 'complete', + * the returned data will include a URL you can use to fetch the results. Every export + * job produces a zip archive, but the format of the archive is distinct for each job + * type. The api calls that initiate exports include more details about the output format + * for that job type. + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} id an export job identifier + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + info(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + + /** + * Returns a list of your exports. + * @param {Object} params the hash of the parameters to pass to the request + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + list(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + /** + * Begins an export of your rejection blacklist. The blacklist will be exported to a zip archive + * containing a single file named rejects.csv that includes the following fields: email, + * reason, detail, created_at, expires_at, last_event_at, expires_at. + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} notify_email an optional email address to notify when the export job has finished. + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + rejects(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + /** + * Begins an export of your rejection whitelist. The whitelist will be exported to a zip archive + * containing a single file named whitelist.csv that includes the following fields: + * email, detail, created_at. + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} notify_email an optional email address to notify when the export job has finished. + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + whitelist(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + /** + * Begins an export of your activity history. The activity will be exported to a zip archive + * containing a single file named activity.csv in the same format as you would be able to export + * from your account's activity view. It includes the following fields: Date, Email Address, + * Sender, Subject, Status, Tags, Opens, Clicks, Bounce Detail. If you have configured any custom + * metadata fields, they will be included in the exported data. + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} notify_email an optional email address to notify when the export job has finished + * @option params {String} date_from start date as a UTC string in YYYY-MM-DD HH:MM:SS format + * @option params {String} date_to end date as a UTC string in YYYY-MM-DD HH:MM:SS format + * @option params {Array} tags an array of tag names to narrow the export to; will match messages that contain ANY of the tags + * - tags[] {String} a tag name + * @option params {Array} senders an array of senders to narrow the export to + * - senders[] {String} a sender address + * @option params {Array} states an array of states to narrow the export to; messages with ANY of the states will be included + * - states[] {String} a message state + * @option params {Array} api_keys an array of api keys to narrow the export to; messsagse sent with ANY of the keys will be included + * - api_keys[] {String} an API key associated with your account + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + activity(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + } + + export class Users { + constructor(master: Mandrill); + + /** + * Return the information about the API-connected user + * @param {Object} params the hash of the parameters to pass to the request + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + info(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + + /** + * Validate an API key and respond to a ping + * @param {Object} params the hash of the parameters to pass to the request + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + ping(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + + /** + * Validate an API key and respond to a ping (anal JSON parser version) + * @param {Object} params the hash of the parameters to pass to the request + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + ping2(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + /** + * Return the senders that have tried to use this account, both verified and unverified + * @param {Object} params the hash of the parameters to pass to the request + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + senders(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + } + + export class Rejects { + constructor(master: Mandrill); + + /** + * Adds an email to your email rejection blacklist. Addresses that you + * add manually will never expire and there is no reputation penalty + * for removing them from your blacklist. Attempting to blacklist an + * address that has been whitelisted will have no effect. + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} email an email address to block + * @option params {String} comment an optional comment describing the rejection + * @option params {String} subaccount an optional unique identifier for the subaccount to limit the blacklist entry + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + add(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + /** + * Retrieves your email rejection blacklist. You can provide an email + * address to limit the results. Returns up to 1000 results. By default, + * entries that have expired are excluded from the results; set + * include_expired to true to include them. + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} email an optional email address to search by + * @option params {Boolean} include_expired whether to include rejections that have already expired. + * @option params {String} subaccount an optional unique identifier for the subaccount to limit the blacklist + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + list(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + + /** + * Deletes an email rejection. There is no limit to how many rejections + * you can remove from your blacklist, but keep in mind that each deletion + * has an affect on your reputation. + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} email an email address + * @option params {String} subaccount an optional unique identifier for the subaccount to limit the blacklist deletion + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + delete(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + } + + export class Inbound { + constructor(master: Mandrill); + + /** + * List the domains that have been configured for inbound delivery + * @param {Object} params the hash of the parameters to pass to the request + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + domains(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + + /** + * Add an inbound domain to your account + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} domain a domain name + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + addDomain(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + + /** + * Check the MX settings for an inbound domain. The domain must have already been added with the add-domain call + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} domain an existing inbound domain + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + checkDomain(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + + /** + * Delete an inbound domain from the account. All mail will stop routing for this domain immediately. + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} domain an existing inbound domain + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + deleteDomain(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + + /** + * List the mailbox routes defined for an inbound domain + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} domain the domain to check + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + routes(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + + /** + * Add a new mailbox route to an inbound domain + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} domain an existing inbound domain + * @option params {String} pattern the search pattern that the mailbox name should match + * @option params {String} url the webhook URL where the inbound messages will be published + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + addRoute(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + + /** + * Update the pattern or webhook of an existing inbound mailbox route. If null is provided for any fields, the values will remain unchanged. + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} id the unique identifier of an existing mailbox route + * @option params {String} pattern the search pattern that the mailbox name should match + * @option params {String} url the webhook URL where the inbound messages will be published + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + updateRoute(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + + /** + * Delete an existing inbound mailbox route + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} id the unique identifier of an existing route + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + deleteRoute(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + + /** + * Take a raw MIME document destined for a domain with inbound domains set up, and send it to the inbound hook exactly as if it had been sent over SMTP + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} raw_message the full MIME document of an email message + * @option params {Array|null} to optionally define the recipients to receive the message - otherwise we'll use the To, Cc, and Bcc headers provided in the document + * - to[] {String} the email address of the recipient + * @option params {String} mail_from the address specified in the MAIL FROM stage of the SMTP conversation. Required for the SPF check. + * @option params {String} helo the identification provided by the client mta in the MTA state of the SMTP conversation. Required for the SPF check. + * @option params {String} client_address the remote MTA's ip address. Optional; required for the SPF check. + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + sendRaw(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + } + + export class Tags { + constructor(master: Mandrill); + + /** + * Return all of the user-defined tag information + * @param {Object} params the hash of the parameters to pass to the request + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + list(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + + /** + * Deletes a tag permanently. Deleting a tag removes the tag from any messages + * that have been sent, and also deletes the tag's stats. There is no way to + * undo this operation, so use it carefully. + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} tag a tag name + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + delete(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + + /** + * Return more detailed information about a single tag, including aggregates of recent stats + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} tag an existing tag name + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + info(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + /** + * Return the recent history (hourly stats for the last 30 days) for a tag + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} tag an existing tag name + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + timeSeries(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + /** + * Return the recent history (hourly stats for the last 30 days) for all tags + * @param {Object} params the hash of the parameters to pass to the request + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + allTimeSeries(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + } + + export class Messages { + constructor(master: Mandrill); + + /** + * Send a new transactional message through Mandrill + * @param {Object} params the hash of the parameters to pass to the request + * @option params {Struct} message the information on the message to send + * -html {String} the full HTML content to be sent + * -text {String} optional full text content to be sent + * -subject {String} the message subject + * -from_email {String} the sender email address. + * -from_name {String} optional from name to be used + * -to {Array} an array of recipient information. + * -to[] {Object} a single recipient's information. + * -email {String} the email address of the recipient + * -name {String} the optional display name to use for the recipient + * -type {String} the header type to use for the recipient, defaults to "to" if not provided + * -headers {Object} optional extra headers to add to the message (most headers are allowed) + * -important {Boolean} whether or not this message is important, and should be delivered ahead of non-important messages + * -track_opens {Boolean} whether or not to turn on open tracking for the message + * -track_clicks {Boolean} whether or not to turn on click tracking for the message + * -auto_text {Boolean} whether or not to automatically generate a text part for messages that are not given text + * -auto_html {Boolean} whether or not to automatically generate an HTML part for messages that are not given HTML + * -inline_css {Boolean} whether or not to automatically inline all CSS styles provided in the message HTML - only for HTML documents less than 256KB in size + * -url_strip_qs {Boolean} whether or not to strip the query string from URLs when aggregating tracked URL data + * -preserve_recipients {Boolean} whether or not to expose all recipients in to "To" header for each email + * -view_content_link {Boolean} set to false to remove content logging for sensitive emails + * -bcc_address {String} an optional address to receive an exact copy of each recipient's email + * -tracking_domain {String} a custom domain to use for tracking opens and clicks instead of mandrillapp.com + * -signing_domain {String} a custom domain to use for SPF/DKIM signing instead of mandrill (for "via" or "on behalf of" in email clients) + * -return_path_domain {String} a custom domain to use for the messages's return-path + * -merge {Boolean} whether to evaluate merge tags in the message. Will automatically be set to true if either merge_vars or global_merge_vars are provided. + * -merge_language {String} the merge tag language to use when evaluating merge tags, either mailchimp or handlebars + * -global_merge_vars {Array} global merge variables to use for all recipients. You can override these per recipient. + * -global_merge_vars[] {Object} a single global merge variable + * -name {String} the global merge variable's name. Merge variable names are case-insensitive and may not start with _ + * -content {Mixed} the global merge variable's content + * -merge_vars {Array} per-recipient merge variables, which override global merge variables with the same name. + * -merge_vars[] {Object} per-recipient merge variables + * -rcpt {String} the email address of the recipient that the merge variables should apply to + * -vars {Array} the recipient's merge variables + * -vars[] {Object} a single merge variable + * -name {String} the merge variable's name. Merge variable names are case-insensitive and may not start with _ + * -content {Mixed} the merge variable's content + * -tags {Array} an array of string to tag the message with. Stats are accumulated using tags, though we only store the first 100 we see, so this should not be unique or change frequently. Tags should be 50 characters or less. Any tags starting with an underscore are reserved for internal use and will cause errors. + * -tags[] {String} a single tag - must not start with an underscore + * -subaccount {String} the unique id of a subaccount for this message - must already exist or will fail with an error + * -google_analytics_domains {Array} an array of strings indicating for which any matching URLs will automatically have Google Analytics parameters appended to their query string automatically. + * -google_analytics_campaign {Array|string} optional string indicating the value to set for the utm_campaign tracking parameter. If this isn't provided the email's from address will be used instead. + * -metadata {Array} metadata an associative array of user metadata. Mandrill will store this metadata and make it available for retrieval. In addition, you can select up to 10 metadata fields to index and make searchable using the Mandrill search api. + * -recipient_metadata {Array} Per-recipient metadata that will override the global values specified in the metadata parameter. + * -recipient_metadata[] {Object} metadata for a single recipient + * -rcpt {String} the email address of the recipient that the metadata is associated with + * -values {Array} an associated array containing the recipient's unique metadata. If a key exists in both the per-recipient metadata and the global metadata, the per-recipient metadata will be used. + * -attachments {Array} an array of supported attachments to add to the message + * -attachments[] {Object} a single supported attachment + * -type {String} the MIME type of the attachment + * -name {String} the file name of the attachment + * -content {String} the content of the attachment as a base64-encoded string + * -images {Array} an array of embedded images to add to the message + * -images[] {Object} a single embedded image + * -type {String} the MIME type of the image - must start with "image/" + * -name {String} the Content ID of the image - use to reference the image in your HTML content + * -content {String} the content of the image as a base64-encoded string + * @option params {Boolean} async enable a background sending mode that is optimized for bulk sending. In async mode, messages/send will immediately return a status of "queued" for every recipient. To handle rejections when sending in async mode, set up a webhook for the 'reject' event. Defaults to false for messages with no more than 10 recipients; messages with more than 10 recipients are always sent asynchronously, regardless of the value of async. + * @option params {String} ip_pool the name of the dedicated ip pool that should be used to send the message. If you do not have any dedicated IPs, this parameter has no effect. If you specify a pool that does not exist, your default pool will be used instead. + * @option params {String} send_at when this message should be sent as a UTC timestamp in YYYY-MM-DD HH:MM:SS format. If you specify a time in the past, the message will be sent immediately. An additional fee applies for scheduled email, and this feature is only available to accounts with a positive balance. + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + send(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + /** + * Send a new transactional message through Mandrill using a template + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} template_name the immutable name or slug of a template that exists in the user's account. For backwards-compatibility, the template name may also be used but the immutable slug is preferred. + * @option params {Array} template_content an array of template content to send. Each item in the array should be a struct with two keys - name: the name of the content block to set the content for, and content: the actual content to put into the block + * -template_content[] {Object} the injection of a single piece of content into a single editable region + * -name {String} the name of the mc:edit editable region to inject into + * -content {String} the content to inject + * @option params {Struct} message the other information on the message to send - same as /messages/send, but without the html content + * -html {String} optional full HTML content to be sent if not in template + * -text {String} optional full text content to be sent + * -subject {String} the message subject + * -from_email {String} the sender email address. + * -from_name {String} optional from name to be used + * -to {Array} an array of recipient information. + * -to[] {Object} a single recipient's information. + * -email {String} the email address of the recipient + * -name {String} the optional display name to use for the recipient + * -type {String} the header type to use for the recipient, defaults to "to" if not provided + * -headers {Object} optional extra headers to add to the message (most headers are allowed) + * -important {Boolean} whether or not this message is important, and should be delivered ahead of non-important messages + * -track_opens {Boolean} whether or not to turn on open tracking for the message + * -track_clicks {Boolean} whether or not to turn on click tracking for the message + * -auto_text {Boolean} whether or not to automatically generate a text part for messages that are not given text + * -auto_html {Boolean} whether or not to automatically generate an HTML part for messages that are not given HTML + * -inline_css {Boolean} whether or not to automatically inline all CSS styles provided in the message HTML - only for HTML documents less than 256KB in size + * -url_strip_qs {Boolean} whether or not to strip the query string from URLs when aggregating tracked URL data + * -preserve_recipients {Boolean} whether or not to expose all recipients in to "To" header for each email + * -view_content_link {Boolean} set to false to remove content logging for sensitive emails + * -bcc_address {String} an optional address to receive an exact copy of each recipient's email + * -tracking_domain {String} a custom domain to use for tracking opens and clicks instead of mandrillapp.com + * -signing_domain {String} a custom domain to use for SPF/DKIM signing instead of mandrill (for "via" or "on behalf of" in email clients) + * -return_path_domain {String} a custom domain to use for the messages's return-path + * -merge {Boolean} whether to evaluate merge tags in the message. Will automatically be set to true if either merge_vars or global_merge_vars are provided. + * -merge_language {String} the merge tag language to use when evaluating merge tags, either mailchimp or handlebars + * -global_merge_vars {Array} global merge variables to use for all recipients. You can override these per recipient. + * -global_merge_vars[] {Object} a single global merge variable + * -name {String} the global merge variable's name. Merge variable names are case-insensitive and may not start with _ + * -content {Mixed} the global merge variable's content + * -merge_vars {Array} per-recipient merge variables, which override global merge variables with the same name. + * -merge_vars[] {Object} per-recipient merge variables + * -rcpt {String} the email address of the recipient that the merge variables should apply to + * -vars {Array} the recipient's merge variables + * -vars[] {Object} a single merge variable + * -name {String} the merge variable's name. Merge variable names are case-insensitive and may not start with _ + * -content {Mixed} the merge variable's content + * -tags {Array} an array of string to tag the message with. Stats are accumulated using tags, though we only store the first 100 we see, so this should not be unique or change frequently. Tags should be 50 characters or less. Any tags starting with an underscore are reserved for internal use and will cause errors. + * -tags[] {String} a single tag - must not start with an underscore + * -subaccount {String} the unique id of a subaccount for this message - must already exist or will fail with an error + * -google_analytics_domains {Array} an array of strings indicating for which any matching URLs will automatically have Google Analytics parameters appended to their query string automatically. + * -google_analytics_campaign {Array|string} optional string indicating the value to set for the utm_campaign tracking parameter. If this isn't provided the email's from address will be used instead. + * -metadata {Array} metadata an associative array of user metadata. Mandrill will store this metadata and make it available for retrieval. In addition, you can select up to 10 metadata fields to index and make searchable using the Mandrill search api. + * -recipient_metadata {Array} Per-recipient metadata that will override the global values specified in the metadata parameter. + * -recipient_metadata[] {Object} metadata for a single recipient + * -rcpt {String} the email address of the recipient that the metadata is associated with + * -values {Array} an associated array containing the recipient's unique metadata. If a key exists in both the per-recipient metadata and the global metadata, the per-recipient metadata will be used. + * -attachments {Array} an array of supported attachments to add to the message + * -attachments[] {Object} a single supported attachment + * -type {String} the MIME type of the attachment + * -name {String} the file name of the attachment + * -content {String} the content of the attachment as a base64-encoded string + * -images {Array} an array of embedded images to add to the message + * -images[] {Object} a single embedded image + * -type {String} the MIME type of the image - must start with "image/" + * -name {String} the Content ID of the image - use to reference the image in your HTML content + * -content {String} the content of the image as a base64-encoded string + * @option params {Boolean} async enable a background sending mode that is optimized for bulk sending. In async mode, messages/send will immediately return a status of "queued" for every recipient. To handle rejections when sending in async mode, set up a webhook for the 'reject' event. Defaults to false for messages with no more than 10 recipients; messages with more than 10 recipients are always sent asynchronously, regardless of the value of async. + * @option params {String} ip_pool the name of the dedicated ip pool that should be used to send the message. If you do not have any dedicated IPs, this parameter has no effect. If you specify a pool that does not exist, your default pool will be used instead. + * @option params {String} send_at when this message should be sent as a UTC timestamp in YYYY-MM-DD HH:MM:SS format. If you specify a time in the past, the message will be sent immediately. An additional fee applies for scheduled email, and this feature is only available to accounts with a positive balance. + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + sendTemplate(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + /** + * Search recently sent messages and optionally narrow by date range, tags, senders, and API keys. If no date range is specified, results within the last 7 days are returned. This method may be called up to 20 times per minute. If you need the data more often, you can use /messages/info.json to get the information for a single message, or webhooks to push activity to your own application for querying. + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} query search terms to find matching messages + * @option params {String} date_from start date + * @option params {String} date_to end date + * @option params {Array} tags an array of tag names to narrow the search to, will return messages that contain ANY of the tags + * @option params {Array} senders an array of sender addresses to narrow the search to, will return messages sent by ANY of the senders + * @option params {Array} api_keys an array of API keys to narrow the search to, will return messages sent by ANY of the keys + * @option params {Integer} limit the maximum number of results to return, defaults to 100, 1000 is the maximum + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + search(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + /** + * Search the content of recently sent messages and return the aggregated hourly stats for matching messages + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} query the search terms to find matching messages for + * @option params {String} date_from start date + * @option params {String} date_to end date + * @option params {Array} tags an array of tag names to narrow the search to, will return messages that contain ANY of the tags + * @option params {Array} senders an array of sender addresses to narrow the search to, will return messages sent by ANY of the senders + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + searchTimeSeries(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + /** + * Get the information for a single recently sent message + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} id the unique id of the message to get - passed as the "_id" field in webhooks, send calls, or search calls + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + info(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + + /** + * Get the full content of a recently sent message + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} id the unique id of the message to get - passed as the "_id" field in webhooks, send calls, or search calls + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + content(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + + /** + * Parse the full MIME document for an email message, returning the content of the message broken into its constituent pieces + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} raw_message the full MIME document of an email message + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + parse(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + /** + * Take a raw MIME document for a message, and send it exactly as if it were sent through Mandrill's SMTP servers + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} raw_message the full MIME document of an email message + * @option params {String|null} from_email optionally define the sender address - otherwise we'll use the address found in the provided headers + * @option params {String|null} from_name optionally define the sender alias + * @option params {Array|null} to optionally define the recipients to receive the message - otherwise we'll use the To, Cc, and Bcc headers provided in the document + * -to[] {String} the email address of the recipient + * @option params {Boolean} async enable a background sending mode that is optimized for bulk sending. In async mode, messages/sendRaw will immediately return a status of "queued" for every recipient. To handle rejections when sending in async mode, set up a webhook for the 'reject' event. Defaults to false for messages with no more than 10 recipients; messages with more than 10 recipients are always sent asynchronously, regardless of the value of async. + * @option params {String} ip_pool the name of the dedicated ip pool that should be used to send the message. If you do not have any dedicated IPs, this parameter has no effect. If you specify a pool that does not exist, your default pool will be used instead. + * @option params {String} send_at when this message should be sent as a UTC timestamp in YYYY-MM-DD HH:MM:SS format. If you specify a time in the past, the message will be sent immediately. + * @option params {String} return_path_domain a custom domain to use for the messages's return-path + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + sendRaw(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + + /** + * Queries your scheduled emails by sender or recipient, or both. + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} to an optional recipient address to restrict results to + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + listScheduled(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + /** + * Cancels a scheduled email. + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} id a scheduled email id, as returned by any of the messages/send calls or messages/list-scheduled + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + cancelScheduled(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + + /** + * Reschedules a scheduled email. + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} id a scheduled email id, as returned by any of the messages/send calls or messages/list-scheduled + * @option params {String} send_at the new UTC timestamp when the message should sent. Mandrill can't time travel, so if you specify a time in past the message will be sent immediately + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + reschedule(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + } + + export class Whitelists { + constructor(master: Mandrill); + + /** + * Adds an email to your email rejection whitelist. If the address is + * currently on your blacklist, that blacklist entry will be removed + * automatically. + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} email an email address to add to the whitelist + * @option params {String} comment an optional description of why the email was whitelisted + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + add(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + /** + * Retrieves your email rejection whitelist. You can provide an email + * address or search prefix to limit the results. Returns up to 1000 results. + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} email an optional email address or prefix to search by + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + list(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + /** + * Removes an email address from the whitelist. + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} email the email address to remove from the whitelist + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + delete(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + } + + export class Ips { + constructor(master: Mandrill); + + /** + * Lists your dedicated IPs. + * @param {Object} params the hash of the parameters to pass to the request + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + list(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + + /** + * Retrieves information about a single dedicated ip. + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} ip a dedicated IP address + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + info(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + + /** + * Requests an additional dedicated IP for your account. Accounts may + * have one outstanding request at any time, and provisioning requests + * are processed within 24 hours. + * @param {Object} params the hash of the parameters to pass to the request + * @option params {Boolean} warmup whether to enable warmup mode for the ip + * @option params {String} pool the id of the pool to add the dedicated ip to, or null to use your account's default pool + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + provision(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + + /** + * Begins the warmup process for a dedicated IP. During the warmup process, + * Mandrill will gradually increase the percentage of your mail that is sent over + * the warming-up IP, over a period of roughly 30 days. The rest of your mail + * will be sent over shared IPs or other dedicated IPs in the same pool. + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} ip a dedicated ip address + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + startWarmup(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + /** + * Cancels the warmup process for a dedicated IP. + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} ip a dedicated ip address + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + cancelWarmup(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + + /** + * Moves a dedicated IP to a different pool. + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} ip a dedicated ip address + * @option params {String} pool the name of the new pool to add the dedicated ip to + * @option params {Boolean} create_pool whether to create the pool if it does not exist; if false and the pool does not exist, an Unknown_Pool will be thrown. + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + setPool(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + + /** + * Deletes a dedicated IP. This is permanent and cannot be undone. + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} ip the dedicated ip to remove from your account + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + delete(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + /** + * Lists your dedicated IP pools. + * @param {Object} params the hash of the parameters to pass to the request + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + listPools(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + + /** + * Describes a single dedicated IP pool. + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} pool a pool name + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + poolInfo(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + + /** + * Creates a pool and returns it. If a pool already exists with this + * name, no action will be performed. + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} pool the name of a pool to create + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + createPool(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + + /** + * Deletes a pool. A pool must be empty before you can delete it, and you cannot delete your default pool. + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} pool the name of the pool to delete + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + deletePool(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + /** + * Tests whether a domain name is valid for use as the custom reverse + * DNS for a dedicated IP. + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} ip a dedicated ip address + * @option params {String} domain the domain name to test + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + checkCustomDns(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + /** + * Configures the custom DNS name for a dedicated IP. + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} ip a dedicated ip address + * @option params {String} domain a domain name to set as the dedicated IP's custom dns name. + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + setCustomDns(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + } + + export class Internal { + constructor(master: Mandrill); + } + + export class Subaccounts { + constructor(master: Mandrill); + + /** + * Get the list of subaccounts defined for the account, optionally filtered by a prefix + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} q an optional prefix to filter the subaccounts' ids and names + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + list(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + /** + * Add a new subaccount + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} id a unique identifier for the subaccount to be used in sending calls + * @option params {String} name an optional display name to further identify the subaccount + * @option params {String} notes optional extra text to associate with the subaccount + * @option params {Integer} custom_quota an optional manual hourly quota for the subaccount. If not specified, Mandrill will manage this based on reputation + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + add(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + + /** + * Given the ID of an existing subaccount, return the data about it + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} id the unique identifier of the subaccount to query + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + info(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + /** + * Update an existing subaccount + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} id the unique identifier of the subaccount to update + * @option params {String} name an optional display name to further identify the subaccount + * @option params {String} notes optional extra text to associate with the subaccount + * @option params {Integer} custom_quota an optional manual hourly quota for the subaccount. If not specified, Mandrill will manage this based on reputation + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + update(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + /** + * Delete an existing subaccount. Any email related to the subaccount will be saved, but stats will be removed and any future sending calls to this subaccount will fail. + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} id the unique identifier of the subaccount to delete + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + delete(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + + /** + * Pause a subaccount's sending. Any future emails delivered to this subaccount will be queued for a maximum of 3 days until the subaccount is resumed. + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} id the unique identifier of the subaccount to pause + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + pause(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + /** + * Resume a paused subaccount's sending + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} id the unique identifier of the subaccount to resume + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + resume(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + } + + export class Urls { + constructor(master: Mandrill); + + /** + * Get the 100 most clicked URLs + * @param {Object} params the hash of the parameters to pass to the request + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + list(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + /** + * Return the 100 most clicked URLs that match the search query given + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} q a search query + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + search(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + /** + * Return the recent history (hourly stats for the last 30 days) for a url + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} url an existing URL + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + timeSeries(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + /** + * Get the list of tracking domains set up for this account + * @param {Object} params the hash of the parameters to pass to the request + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + trackingDomains(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + /** + * Add a tracking domain to your account + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} domain a domain name + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + addTrackingDomain(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + /** + * Checks the CNAME settings for a tracking domain. The domain must have been added already with the add-tracking-domain call + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} domain an existing tracking domain name + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + checkTrackingDomain(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + } + + export class Webhooks { + constructor(master: Mandrill); + + /** + * Get the list of all webhooks defined on the account + * @param {Object} params the hash of the parameters to pass to the request + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + list(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + /** + * Add a new webhook + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} url the URL to POST batches of events + * @option params {String} description an optional description of the webhook + * @option params {Array} events an optional list of events that will be posted to the webhook + * - events[] {String} the individual event to listen for + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + add(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + /** + * Given the ID of an existing webhook, return the data about it + * @param {Object} params the hash of the parameters to pass to the request + * @option params {Integer} id the unique identifier of a webhook belonging to this account + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + info(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + /** + * Update an existing webhook + * @param {Object} params the hash of the parameters to pass to the request + * @option params {Integer} id the unique identifier of a webhook belonging to this account + * @option params {String} url the URL to POST batches of events + * @option params {String} description an optional description of the webhook + * @option params {Array} events an optional list of events that will be posted to the webhook + * - events[] {String} the individual event to listen for + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + update(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + /** + * Delete an existing webhook + * @param {Object} params the hash of the parameters to pass to the request + * @option params {Integer} id the unique identifier of a webhook belonging to this account + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + delete(params: {id: number}, onsuccess?: ICallback, onerror?: ICallback): void; + + } + + export class Senders { + constructor(master: Mandrill); + + /** + * Return the senders that have tried to use this account. + * @param {Object} params the hash of the parameters to pass to the request + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + list(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + /** + * Returns the sender domains that have been added to this account. + * @param {Object} params the hash of the parameters to pass to the request + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + domains(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + /** + * Adds a sender domain to your account. Sender domains are added automatically as you + * send, but you can use this call to add them ahead of time. + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} domain a domain name + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + addDomain(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + /** + * Checks the SPF and DKIM settings for a domain. If you haven't already added this domain to your + * account, it will be added automatically. + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} domain a domain name + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + checkDomain(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + /** + * Sends a verification email in order to verify ownership of a domain. + * Domain verification is an optional step to confirm ownership of a domain. Once a + * domain has been verified in a Mandrill account, other accounts may not have their + * messages signed by that domain unless they also verify the domain. This prevents + * other Mandrill accounts from sending mail signed by your domain. + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} domain a domain name at which you can receive email + * @option params {String} mailbox a mailbox at the domain where the verification email should be sent + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + verifyDomain(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + /** + * Return more detailed information about a single sender, including aggregates of recent stats + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} address the email address of the sender + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + info(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + /** + * Return the recent history (hourly stats for the last 30 days) for a sender + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} address the email address of the sender + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + timeSeries(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + } + + export class Metadata { + constructor(master: Mandrill); + /** + * Get the list of custom metadata fields indexed for the account. + * @param {Object} params the hash of the parameters to pass to the request + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + list(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + /** + * Add a new custom metadata field to be indexed for the account. + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} name a unique identifier for the metadata field + * @option params {String} view_template optional Mustache template to control how the metadata is rendered in your activity log + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + add(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + /** + * Update an existing custom metadata field. + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} name the unique identifier of the metadata field to update + * @option params {String} view_template optional Mustache template to control how the metadata is rendered in your activity log + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + update(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + /** + * Delete an existing custom metadata field. Deletion isn't instataneous, and /metadata/list will continue to return the field until the asynchronous deletion process is complete. + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} name the unique identifier of the metadata field to update + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + delete(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + } +} \ No newline at end of file diff --git a/mandrill-api/mandrill-tests.ts b/mandrill-api/mandrill-tests.ts new file mode 100644 index 000000000..bbdaeb71f --- /dev/null +++ b/mandrill-api/mandrill-tests.ts @@ -0,0 +1,14 @@ +/// + +import mandrill = require('mandrill-api'); + +var + M = new mandrill.Mandrill('key', false), + cb: mandrill.ICallback = function(asd){ + + }; + + +M.templates.add({}); +M.webhooks.delete({id: 1}); +M.call('url', {}, cb, cb); \ No newline at end of file diff --git a/marionette/marionette.d.ts b/marionette/marionette.d.ts index 2b9b25635..4a2bfac10 100644 --- a/marionette/marionette.d.ts +++ b/marionette/marionette.d.ts @@ -1291,6 +1291,15 @@ declare module Marionette { options: any; + /** + * Behaviors can have their own ui hash, which will be mixed into the ui + * hash of its associated View instance. ui elements defined on either the + * Behavior or the View will be made available within events and triggers. + * They also are attached directly to the Behavior and can be accessed within + * Behavior methods as this.ui. + */ + ui: any; + /** * Any triggers you define on the Behavior will be triggered in response to the appropriate event on the view. */ diff --git a/markerclustererplus/markerclustererplus-tests.ts b/markerclustererplus/markerclustererplus-tests.ts new file mode 100644 index 000000000..c710727aa --- /dev/null +++ b/markerclustererplus/markerclustererplus-tests.ts @@ -0,0 +1,2217 @@ +/// +/// + +module MarkerClusterApp { + export function simple_test() { + var center = new google.maps.LatLng(37.4419, -122.1419); + var map = new google.maps.Map(document.getElementById('map'), { + zoom: 3, + center: center, + mapTypeId: google.maps.MapTypeId.ROADMAP + }); + + var markers: google.maps.Marker[] = []; + for (var i = 0; i < 100; i++) { + var dataPhoto = data.photos[i]; + var latLng = new google.maps.LatLng(dataPhoto.latitude, dataPhoto.longitude); + var marker = new google.maps.Marker({ position: latLng }); + markers.push(marker); + } + var markerCluster = new MarkerClusterer(map, markers); + } + + export function init() { + google.maps.event.addDomListener(window, 'load', simple_test); + } + + // Dummy data from http://cdn.rawgit.com/mahnunchik/markerclustererplus/master/src/data.json + var data = { + "count": 10785236, + "photos": [{"photo_id": 27932, "photo_title": "Atardecer en Embalse", "photo_url": "http://www.panoramio.com/photo/27932", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/27932.jpg", "longitude": -64.404945, "latitude": -32.202924, "width": 500, "height": 375, "upload_date": "25 June 2006", "owner_id": 4483, "owner_name": "Miguel Coranti", "owner_url": "http://www.panoramio.com/user/4483"} + , + {"photo_id": 522084, "photo_title": "In Memoriam Antoine de Saint Exupéry", "photo_url": "http://www.panoramio.com/photo/522084", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/522084.jpg", "longitude": 17.470493, "latitude": 47.867077, "width": 500, "height": 350, "upload_date": "21 January 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 1578881, "photo_title": "Rosina Lamberti,Sunset,Templestowe , Victoria, Australia", "photo_url": "http://www.panoramio.com/photo/1578881", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1578881.jpg", "longitude": 145.141754, "latitude": -37.766372, "width": 500, "height": 474, "upload_date": "01 April 2007", "owner_id": 140796, "owner_name": "rosina lamberti", "owner_url": "http://www.panoramio.com/user/140796"} + , + {"photo_id": 97671, "photo_title": "kin-dza-dza", "photo_url": "http://www.panoramio.com/photo/97671", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/97671.jpg", "longitude": 30.785408, "latitude": 46.639301, "width": 500, "height": 375, "upload_date": "09 December 2006", "owner_id": 13058, "owner_name": "Kyryl", "owner_url": "http://www.panoramio.com/user/13058"} + , + {"photo_id": 25514, "photo_title": "Arenal", "photo_url": "http://www.panoramio.com/photo/25514", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/25514.jpg", "longitude": -84.693432, "latitude": 10.479372, "width": 500, "height": 375, "upload_date": "17 June 2006", "owner_id": 4112, "owner_name": "Roberto Garcia", "owner_url": "http://www.panoramio.com/user/4112"} + , + {"photo_id": 57823, "photo_title": "Maria Alm", "photo_url": "http://www.panoramio.com/photo/57823", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/57823.jpg", "longitude": 12.900009, "latitude": 47.409968, "width": 500, "height": 333, "upload_date": "05 October 2006", "owner_id": 8060, "owner_name": "Norbert MAIER", "owner_url": "http://www.panoramio.com/user/8060"} + , + {"photo_id": 532693, "photo_title": "Wheatfield in afternoon light", "photo_url": "http://www.panoramio.com/photo/532693", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/532693.jpg", "longitude": 11.272659, "latitude": 59.637472, "width": 500, "height": 333, "upload_date": "22 January 2007", "owner_id": 39160, "owner_name": "Snemann", "owner_url": "http://www.panoramio.com/user/39160"} + , + {"photo_id": 57819, "photo_title": "Burg Hohenwerfen", "photo_url": "http://www.panoramio.com/photo/57819", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/57819.jpg", "longitude": 13.189259, "latitude": 47.483221, "width": 500, "height": 333, "upload_date": "05 October 2006", "owner_id": 8060, "owner_name": "Norbert MAIER", "owner_url": "http://www.panoramio.com/user/8060"} + , + {"photo_id": 1282387, "photo_title": "Thunderstorm in Martinique", "photo_url": "http://www.panoramio.com/photo/1282387", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1282387.jpg", "longitude": -61.013432, "latitude": 14.493688, "width": 500, "height": 400, "upload_date": "12 March 2007", "owner_id": 49870, "owner_name": "Jean-Michel Raggioli", "owner_url": "http://www.panoramio.com/user/49870"} + , + {"photo_id": 945976, "photo_title": "Al tard", "photo_url": "http://www.panoramio.com/photo/945976", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/945976.jpg", "longitude": 0.490866, "latitude": 40.903783, "width": 335, "height": 500, "upload_date": "21 February 2007", "owner_id": 3022, "owner_name": "Arcadi", "owner_url": "http://www.panoramio.com/user/3022"} + , + {"photo_id": 73514, "photo_title": "Hintersee bei Ramsau", "photo_url": "http://www.panoramio.com/photo/73514", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/73514.jpg", "longitude": 12.852459, "latitude": 47.609519, "width": 500, "height": 333, "upload_date": "30 October 2006", "owner_id": 8060, "owner_name": "Norbert MAIER", "owner_url": "http://www.panoramio.com/user/8060"} + , + {"photo_id": 298967, "photo_title": "Antelope Canyon, Ray of Light", "photo_url": "http://www.panoramio.com/photo/298967", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/298967.jpg", "longitude": -111.407890, "latitude": 36.894037, "width": 500, "height": 375, "upload_date": "04 January 2007", "owner_id": 64388, "owner_name": "Artusi", "owner_url": "http://www.panoramio.com/user/64388"} + , + {"photo_id": 88151, "photo_title": "Val Verzasca - Switzerland", "photo_url": "http://www.panoramio.com/photo/88151", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/88151.jpg", "longitude": 8.838158, "latitude": 46.257746, "width": 500, "height": 375, "upload_date": "28 November 2006", "owner_id": 11098, "owner_name": "Michele Masnata", "owner_url": "http://www.panoramio.com/user/11098"} + , + {"photo_id": 6463, "photo_title": "Guggenheim and spider", "photo_url": "http://www.panoramio.com/photo/6463", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6463.jpg", "longitude": -2.933736, "latitude": 43.269159, "width": 500, "height": 375, "upload_date": "09 January 2006", "owner_id": 414, "owner_name": "Sonia Villegas", "owner_url": "http://www.panoramio.com/user/414"} + , + {"photo_id": 107980, "photo_title": "Mostar", "photo_url": "http://www.panoramio.com/photo/107980", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/107980.jpg", "longitude": 17.815200, "latitude": 43.337255, "width": 369, "height": 500, "upload_date": "10 December 2006", "owner_id": 12954, "owner_name": "Ziębol", "owner_url": "http://www.panoramio.com/user/12954"} + , + {"photo_id": 9439, "photo_title": "Bora Bora", "photo_url": "http://www.panoramio.com/photo/9439", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/9439.jpg", "longitude": -151.750000, "latitude": -16.500000, "width": 500, "height": 375, "upload_date": "02 February 2006", "owner_id": 1600, "owner_name": "heavenearth", "owner_url": "http://www.panoramio.com/user/1600"} + , + {"photo_id": 673131, "photo_title": "Nivane in Ørsta", "photo_url": "http://www.panoramio.com/photo/673131", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/673131.jpg", "longitude": 6.108742, "latitude": 62.226676, "width": 500, "height": 334, "upload_date": "03 February 2007", "owner_id": 56091, "owner_name": "Kjetil Vaage Øie", "owner_url": "http://www.panoramio.com/user/56091"} + , + {"photo_id": 346269, "photo_title": "italy-toscany", "photo_url": "http://www.panoramio.com/photo/346269", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/346269.jpg", "longitude": 11.616282, "latitude": 43.064389, "width": 500, "height": 334, "upload_date": "08 January 2007", "owner_id": 69671, "owner_name": "illusandpics.com", "owner_url": "http://www.panoramio.com/user/69671"} + , + {"photo_id": 290039, "photo_title": "Gentoo Penguins at Sunrise", "photo_url": "http://www.panoramio.com/photo/290039", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/290039.jpg", "longitude": -59.070311, "latitude": -52.430295, "width": 500, "height": 284, "upload_date": "03 January 2007", "owner_id": 61890, "owner_name": "enriquevidalphoto.com", "owner_url": "http://www.panoramio.com/user/61890"} + , + {"photo_id": 1870141, "photo_title": "Les Mines", "photo_url": "http://www.panoramio.com/photo/1870141", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1870141.jpg", "longitude": 1.314712, "latitude": 45.922199, "width": 500, "height": 379, "upload_date": "21 April 2007", "owner_id": 372189, "owner_name": "Phil©", "owner_url": "http://www.panoramio.com/user/372189"} + , + {"photo_id": 516809, "photo_title": "Az őrszem", "photo_url": "http://www.panoramio.com/photo/516809", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/516809.jpg", "longitude": 18.239279, "latitude": 47.535341, "width": 500, "height": 286, "upload_date": "21 January 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 67347, "photo_title": "Amanecer en el Salar de Uyuni", "photo_url": "http://www.panoramio.com/photo/67347", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/67347.jpg", "longitude": -67.549438, "latitude": -20.552438, "width": 500, "height": 375, "upload_date": "20 October 2006", "owner_id": 9080, "owner_name": "Marco Teodonio", "owner_url": "http://www.panoramio.com/user/9080"} + , + {"photo_id": 405822, "photo_title": "tulip", "photo_url": "http://www.panoramio.com/photo/405822", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/405822.jpg", "longitude": 139.011619, "latitude": 37.871500, "width": 500, "height": 386, "upload_date": "13 January 2007", "owner_id": 86411, "owner_name": "中村脩-Osamu nakamura", "owner_url": "http://www.panoramio.com/user/86411"} + , + {"photo_id": 233619, "photo_title": "Warsaw Bridge 01 [www.wierzchon.com]", "photo_url": "http://www.panoramio.com/photo/233619", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/233619.jpg", "longitude": 21.035728, "latitude": 52.242353, "width": 500, "height": 500, "upload_date": "25 December 2006", "owner_id": 47836, "owner_name": "Andrzej Wierzchon", "owner_url": "http://www.panoramio.com/user/47836"} + , + {"photo_id": 1516726, "photo_title": "Облако над вулканом Камень. www.photo-sturm.ru", "photo_url": "http://www.panoramio.com/photo/1516726", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1516726.jpg", "longitude": 160.587502, "latitude": 56.081999, "width": 414, "height": 500, "upload_date": "27 March 2007", "owner_id": 268724, "owner_name": "Korotnev AV", "owner_url": "http://www.panoramio.com/user/268724"} + , + {"photo_id": 70975, "photo_title": "Hospiz", "photo_url": "http://www.panoramio.com/photo/70975", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/70975.jpg", "longitude": 8.024461, "latitude": 46.245801, "width": 500, "height": 500, "upload_date": "26 October 2006", "owner_id": 9379, "owner_name": "Davide Bernacchi", "owner_url": "http://www.panoramio.com/user/9379"} + , + {"photo_id": 882660, "photo_title": "icy_chains_1_hdr_web", "photo_url": "http://www.panoramio.com/photo/882660", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/882660.jpg", "longitude": -79.798197, "latitude": 43.321353, "width": 500, "height": 333, "upload_date": "18 February 2007", "owner_id": 17488, "owner_name": "John Gillett", "owner_url": "http://www.panoramio.com/user/17488"} + , + {"photo_id": 9363990, "photo_title": "Marble Cave", "photo_url": "http://www.panoramio.com/photo/9363990", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/9363990.jpg", "longitude": -72.607527, "latitude": -46.647138, "width": 500, "height": 375, "upload_date": "14 April 2008", "owner_id": 947917, "owner_name": "Dejah", "owner_url": "http://www.panoramio.com/user/947917"} + , + {"photo_id": 1884507, "photo_title": "fukushimagata", "photo_url": "http://www.panoramio.com/photo/1884507", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1884507.jpg", "longitude": 139.243813, "latitude": 37.909669, "width": 500, "height": 384, "upload_date": "22 April 2007", "owner_id": 86411, "owner_name": "中村脩-Osamu nakamura", "owner_url": "http://www.panoramio.com/user/86411"} + , + {"photo_id": 1343502, "photo_title": "вулкан Карымский", "photo_url": "http://www.panoramio.com/photo/1343502", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1343502.jpg", "longitude": 159.480114, "latitude": 54.025419, "width": 500, "height": 334, "upload_date": "16 March 2007", "owner_id": 268724, "owner_name": "Korotnev AV", "owner_url": "http://www.panoramio.com/user/268724"} + , + {"photo_id": 97723, "photo_title": "Torrent de pareis", "photo_url": "http://www.panoramio.com/photo/97723", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/97723.jpg", "longitude": 2.805762, "latitude": 39.852352, "width": 401, "height": 500, "upload_date": "09 December 2006", "owner_id": 13121, "owner_name": "Andreas G.M.", "owner_url": "http://www.panoramio.com/user/13121"} + , + {"photo_id": 537672, "photo_title": "Sr. da Pedra", "photo_url": "http://www.panoramio.com/photo/537672", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/537672.jpg", "longitude": -8.659008, "latitude": 41.068821, "width": 500, "height": 366, "upload_date": "23 January 2007", "owner_id": 115618, "owner_name": "Paulo J Moreira", "owner_url": "http://www.panoramio.com/user/115618"} + , + {"photo_id": 204924, "photo_title": "zaldiak", "photo_url": "http://www.panoramio.com/photo/204924", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/204924.jpg", "longitude": -1.806951, "latitude": 43.245140, "width": 500, "height": 346, "upload_date": "21 December 2006", "owner_id": 2575, "owner_name": "mikel ortega", "owner_url": "http://www.panoramio.com/user/2575"} + , + {"photo_id": 114795, "photo_title": "TIBAUM-BIZZAR", "photo_url": "http://www.panoramio.com/photo/114795", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/114795.jpg", "longitude": 7.706180, "latitude": 51.665741, "width": 334, "height": 500, "upload_date": "11 December 2006", "owner_id": 13121, "owner_name": "Andreas G.M.", "owner_url": "http://www.panoramio.com/user/13121"} + , + {"photo_id": 1287881, "photo_title": "Aurora borealis", "photo_url": "http://www.panoramio.com/photo/1287881", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1287881.jpg", "longitude": 44.215508, "latitude": 65.829148, "width": 500, "height": 205, "upload_date": "12 March 2007", "owner_id": 75359, "owner_name": "Andrey Larin", "owner_url": "http://www.panoramio.com/user/75359"} + , + {"photo_id": 1781717, "photo_title": "Water Cuts Rock", "photo_url": "http://www.panoramio.com/photo/1781717", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1781717.jpg", "longitude": -113.047771, "latitude": 37.312154, "width": 333, "height": 500, "upload_date": "15 April 2007", "owner_id": 376395, "owner_name": "JeffSullivan (www.MyPhotoGuides.com)", "owner_url": "http://www.panoramio.com/user/376395"} + , + {"photo_id": 196103, "photo_title": "albufera", "photo_url": "http://www.panoramio.com/photo/196103", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/196103.jpg", "longitude": -0.323882, "latitude": 39.349166, "width": 332, "height": 500, "upload_date": "20 December 2006", "owner_id": 38804, "owner_name": "www.oscarsanchez.net", "owner_url": "http://www.panoramio.com/user/38804"} + , + {"photo_id": 266224, "photo_title": "Boulzojavri", "photo_url": "http://www.panoramio.com/photo/266224", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/266224.jpg", "longitude": 24.373169, "latitude": 68.908534, "width": 500, "height": 334, "upload_date": "30 December 2006", "owner_id": 56091, "owner_name": "Kjetil Vaage Øie", "owner_url": "http://www.panoramio.com/user/56091"} + , + {"photo_id": 6126294, "photo_title": "Richmond Deer", "photo_url": "http://www.panoramio.com/photo/6126294", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6126294.jpg", "longitude": -0.275195, "latitude": 51.445890, "width": 489, "height": 500, "upload_date": "25 November 2007", "owner_id": 1130880, "owner_name": "marksimms", "owner_url": "http://www.panoramio.com/user/1130880"} + , + {"photo_id": 168032, "photo_title": "Buci Seine - Looking Up", "photo_url": "http://www.panoramio.com/photo/168032", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/168032.jpg", "longitude": 2.336990, "latitude": 48.853891, "width": 500, "height": 357, "upload_date": "16 December 2006", "owner_id": 5684, "owner_name": "Brent Townshend", "owner_url": "http://www.panoramio.com/user/5684"} + , + {"photo_id": 1370932, "photo_title": "Mercury Bay Sunrise", "photo_url": "http://www.panoramio.com/photo/1370932", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1370932.jpg", "longitude": 175.699196, "latitude": -36.817685, "width": 500, "height": 470, "upload_date": "17 March 2007", "owner_id": 286729, "owner_name": "jimwitkowski", "owner_url": "http://www.panoramio.com/user/286729"} + , + {"photo_id": 120844, "photo_title": "Adelie-Prat- Kratzmaier", "photo_url": "http://www.panoramio.com/photo/120844", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/120844.jpg", "longitude": -59.683228, "latitude": -62.485684, "width": 500, "height": 351, "upload_date": "12 December 2006", "owner_id": 19856, "owner_name": "Juan Kratzmaier", "owner_url": "http://www.panoramio.com/user/19856"} + , + {"photo_id": 940294, "photo_title": "Infrared Mediterranean Heat", "photo_url": "http://www.panoramio.com/photo/940294", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/940294.jpg", "longitude": 25.376015, "latitude": 36.461537, "width": 500, "height": 332, "upload_date": "21 February 2007", "owner_id": 66847, "owner_name": "Lukas Novak", "owner_url": "http://www.panoramio.com/user/66847"} + , + {"photo_id": 4446084, "photo_title": "Vizivarázs", "photo_url": "http://www.panoramio.com/photo/4446084", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4446084.jpg", "longitude": 17.504482, "latitude": 47.842773, "width": 367, "height": 500, "upload_date": "06 September 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 498352, "photo_title": "Wave", "photo_url": "http://www.panoramio.com/photo/498352", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/498352.jpg", "longitude": -112.005315, "latitude": 36.995972, "width": 500, "height": 333, "upload_date": "20 January 2007", "owner_id": 40260, "owner_name": "Don Albonico", "owner_url": "http://www.panoramio.com/user/40260"} + , + {"photo_id": 775893, "photo_title": "Leoparden", "photo_url": "http://www.panoramio.com/photo/775893", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/775893.jpg", "longitude": 36.046829, "latitude": -3.818353, "width": 500, "height": 336, "upload_date": "11 February 2007", "owner_id": 164434, "owner_name": "Achim Mittler", "owner_url": "http://www.panoramio.com/user/164434"} + , + {"photo_id": 665502, "photo_title": "Sunset Beach Walker", "photo_url": "http://www.panoramio.com/photo/665502", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/665502.jpg", "longitude": -124.077530, "latitude": 44.519888, "width": 500, "height": 340, "upload_date": "03 February 2007", "owner_id": 107359, "owner_name": "Ron Cooper", "owner_url": "http://www.panoramio.com/user/107359"} + , + {"photo_id": 9021415, "photo_title": "Wat Suwan Kuha or Wat Tham, Phang Nga, Winner Unusual Location April 2008", "photo_url": "http://www.panoramio.com/photo/9021415", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/9021415.jpg", "longitude": 98.471628, "latitude": 8.428840, "width": 500, "height": 334, "upload_date": "31 March 2008", "owner_id": 1077251, "owner_name": "picsonthemove", "owner_url": "http://www.panoramio.com/user/1077251"} + , + {"photo_id": 287244, "photo_title": "Landwasser-Viadukt - This is an unofficial photo point. Just follow the footpath up from the official one, until the clearing.", "photo_url": "http://www.panoramio.com/photo/287244", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/287244.jpg", "longitude": 9.675007, "latitude": 46.681229, "width": 337, "height": 500, "upload_date": "03 January 2007", "owner_id": 57869, "owner_name": "NAGY Albert", "owner_url": "http://www.panoramio.com/user/57869"} + , + {"photo_id": 677366, "photo_title": "Oak tree in winter", "photo_url": "http://www.panoramio.com/photo/677366", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/677366.jpg", "longitude": 10.771065, "latitude": 59.663926, "width": 358, "height": 500, "upload_date": "03 February 2007", "owner_id": 39160, "owner_name": "Snemann", "owner_url": "http://www.panoramio.com/user/39160"} + , + {"photo_id": 196086, "photo_title": "albufera", "photo_url": "http://www.panoramio.com/photo/196086", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/196086.jpg", "longitude": -0.323882, "latitude": 39.349166, "width": 500, "height": 332, "upload_date": "20 December 2006", "owner_id": 38804, "owner_name": "www.oscarsanchez.net", "owner_url": "http://www.panoramio.com/user/38804"} + , + {"photo_id": 4340931, "photo_title": "Cold morning", "photo_url": "http://www.panoramio.com/photo/4340931", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4340931.jpg", "longitude": 12.113349, "latitude": 49.342559, "width": 500, "height": 333, "upload_date": "31 August 2007", "owner_id": 696605, "owner_name": "© alfredschaffer", "owner_url": "http://www.panoramio.com/user/696605"} + , + {"photo_id": 488, "photo_title": "Lagos de Montebello, México", "photo_url": "http://www.panoramio.com/photo/488", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/488.jpg", "longitude": -91.677904, "latitude": 16.111297, "width": 500, "height": 345, "upload_date": "31 August 2005", "owner_id": 7, "owner_name": "Eduardo Manchón", "owner_url": "http://www.panoramio.com/user/7"} + , + {"photo_id": 723666, "photo_title": "Majestically Still", "photo_url": "http://www.panoramio.com/photo/723666", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/723666.jpg", "longitude": -116.175613, "latitude": 51.327608, "width": 500, "height": 332, "upload_date": "07 February 2007", "owner_id": 66847, "owner_name": "Lukas Novak", "owner_url": "http://www.panoramio.com/user/66847"} + , + {"photo_id": 1081710, "photo_title": "Gjevilvatnet lake in Oppdal", "photo_url": "http://www.panoramio.com/photo/1081710", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1081710.jpg", "longitude": 9.412537, "latitude": 62.686749, "width": 500, "height": 333, "upload_date": "28 February 2007", "owner_id": 223406, "owner_name": "Sigmund Rise", "owner_url": "http://www.panoramio.com/user/223406"} + , + {"photo_id": 22575, "photo_title": "Lijiang River, near Yangshuo, China", "photo_url": "http://www.panoramio.com/photo/22575", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/22575.jpg", "longitude": 110.454826, "latitude": 24.962716, "width": 500, "height": 333, "upload_date": "05 June 2006", "owner_id": 3557, "owner_name": "Placebo", "owner_url": "http://www.panoramio.com/user/3557"} + , + {"photo_id": 2735754, "photo_title": "Después de la lluvia", "photo_url": "http://www.panoramio.com/photo/2735754", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2735754.jpg", "longitude": -73.241998, "latitude": -39.809583, "width": 360, "height": 500, "upload_date": "13 June 2007", "owner_id": 327310, "owner_name": "Erwin Woenckhaus", "owner_url": "http://www.panoramio.com/user/327310"} + , + {"photo_id": 73515, "photo_title": "Kloster Höglwörth", "photo_url": "http://www.panoramio.com/photo/73515", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/73515.jpg", "longitude": 12.850227, "latitude": 47.815575, "width": 500, "height": 333, "upload_date": "30 October 2006", "owner_id": 8060, "owner_name": "Norbert MAIER", "owner_url": "http://www.panoramio.com/user/8060"} + , + {"photo_id": 723015, "photo_title": "Cape Flattery (infrared)", "photo_url": "http://www.panoramio.com/photo/723015", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/723015.jpg", "longitude": -124.726700, "latitude": 48.385898, "width": 500, "height": 332, "upload_date": "07 February 2007", "owner_id": 66847, "owner_name": "Lukas Novak", "owner_url": "http://www.panoramio.com/user/66847"} + , + {"photo_id": 1288595, "photo_title": "O'Keeffe ?", "photo_url": "http://www.panoramio.com/photo/1288595", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1288595.jpg", "longitude": 72.920637, "latitude": 4.038162, "width": 332, "height": 500, "upload_date": "12 March 2007", "owner_id": 232099, "owner_name": "mabut", "owner_url": "http://www.panoramio.com/user/232099"} + , + {"photo_id": 1008304, "photo_title": "nyhavn", "photo_url": "http://www.panoramio.com/photo/1008304", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1008304.jpg", "longitude": 12.591190, "latitude": 55.679762, "width": 500, "height": 333, "upload_date": "24 February 2007", "owner_id": 2659, "owner_name": "ozalph", "owner_url": "http://www.panoramio.com/user/2659"} + , + {"photo_id": 19547, "photo_title": "Embarcador 1", "photo_url": "http://www.panoramio.com/photo/19547", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/19547.jpg", "longitude": 0.493140, "latitude": 40.904172, "width": 500, "height": 335, "upload_date": "07 May 2006", "owner_id": 3022, "owner_name": "Arcadi", "owner_url": "http://www.panoramio.com/user/3022"} + , + {"photo_id": 98115, "photo_title": "FREE-SPIRIT", "photo_url": "http://www.panoramio.com/photo/98115", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/98115.jpg", "longitude": 9.908917, "latitude": 50.487112, "width": 500, "height": 304, "upload_date": "10 December 2006", "owner_id": 13121, "owner_name": "Andreas G.M.", "owner_url": "http://www.panoramio.com/user/13121"} + , + {"photo_id": 9822056, "photo_title": "Reflection under the Bridge", "photo_url": "http://www.panoramio.com/photo/9822056", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/9822056.jpg", "longitude": 103.853851, "latitude": 1.286973, "width": 333, "height": 500, "upload_date": "01 May 2008", "owner_id": 1465912, "owner_name": "funtor", "owner_url": "http://www.panoramio.com/user/1465912"} + , + {"photo_id": 9117094, "photo_title": "Baron's Haugh, Scotland", "photo_url": "http://www.panoramio.com/photo/9117094", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/9117094.jpg", "longitude": -3.986835, "latitude": 55.773532, "width": 500, "height": 337, "upload_date": "05 April 2008", "owner_id": 165346, "owner_name": "Alan Knox", "owner_url": "http://www.panoramio.com/user/165346"} + , + {"photo_id": 5342534, "photo_title": "Őszi pompa", "photo_url": "http://www.panoramio.com/photo/5342534", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5342534.jpg", "longitude": 15.964594, "latitude": 47.875426, "width": 500, "height": 334, "upload_date": "16 October 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 2346129, "photo_title": "Pipacsálom", "photo_url": "http://www.panoramio.com/photo/2346129", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2346129.jpg", "longitude": 17.521820, "latitude": 47.748558, "width": 500, "height": 378, "upload_date": "22 May 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 3749005, "photo_title": "Once in a Blue Moon....", "photo_url": "http://www.panoramio.com/photo/3749005", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3749005.jpg", "longitude": -105.654080, "latitude": 40.294560, "width": 374, "height": 500, "upload_date": "05 August 2007", "owner_id": 87752, "owner_name": "Richard Ryer", "owner_url": "http://www.panoramio.com/user/87752"} + , + {"photo_id": 1360629, "photo_title": "Frente a la Cascada de Gujuli -103 m.-", "photo_url": "http://www.panoramio.com/photo/1360629", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1360629.jpg", "longitude": -2.909800, "latitude": 42.976199, "width": 333, "height": 500, "upload_date": "17 March 2007", "owner_id": 129297, "owner_name": "Enrique Ortiz de Zárate", "owner_url": "http://www.panoramio.com/user/129297"} + , + {"photo_id": 6129915, "photo_title": "A vadon szava", "photo_url": "http://www.panoramio.com/photo/6129915", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6129915.jpg", "longitude": 17.521133, "latitude": 47.854408, "width": 500, "height": 325, "upload_date": "25 November 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 67183, "photo_title": "Laguna verde e Vulcano Licancabur", "photo_url": "http://www.panoramio.com/photo/67183", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/67183.jpg", "longitude": -67.819161, "latitude": -22.787696, "width": 500, "height": 370, "upload_date": "20 October 2006", "owner_id": 9080, "owner_name": "Marco Teodonio", "owner_url": "http://www.panoramio.com/user/9080"} + , + {"photo_id": 507571, "photo_title": "Mikor a harangszó is szebben hallik", "photo_url": "http://www.panoramio.com/photo/507571", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/507571.jpg", "longitude": 17.684383, "latitude": 47.587873, "width": 396, "height": 500, "upload_date": "20 January 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 6685422, "photo_title": "Dawn at Bagan, Myanmar (Burma)", "photo_url": "http://www.panoramio.com/photo/6685422", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6685422.jpg", "longitude": 94.860935, "latitude": 21.169045, "width": 500, "height": 333, "upload_date": "25 December 2007", "owner_id": 1221287, "owner_name": "TS Jeung", "owner_url": "http://www.panoramio.com/user/1221287"} + , + {"photo_id": 3513121, "photo_title": "Báláim", "photo_url": "http://www.panoramio.com/photo/3513121", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3513121.jpg", "longitude": 17.481651, "latitude": 47.457576, "width": 419, "height": 500, "upload_date": "24 July 2007", "owner_id": 689769, "owner_name": "Ponty István", "owner_url": "http://www.panoramio.com/user/689769"} + , + {"photo_id": 10574161, "photo_title": "Silhouette", "photo_url": "http://www.panoramio.com/photo/10574161", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/10574161.jpg", "longitude": 148.662905, "latitude": -35.304724, "width": 500, "height": 346, "upload_date": "25 May 2008", "owner_id": 766550, "owner_name": "VFedele", "owner_url": "http://www.panoramio.com/user/766550"} + , + {"photo_id": 89190, "photo_title": "Mount Ararat, Yerevan, Armenia", "photo_url": "http://www.panoramio.com/photo/89190", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/89190.jpg", "longitude": 44.483900, "latitude": 40.195299, "width": 500, "height": 375, "upload_date": "30 November 2006", "owner_id": 11226, "owner_name": "Ardani", "owner_url": "http://www.panoramio.com/user/11226"} + , + {"photo_id": 1182305, "photo_title": "Dobel, Albrecht-Hütte", "photo_url": "http://www.panoramio.com/photo/1182305", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1182305.jpg", "longitude": 8.500500, "latitude": 48.793465, "width": 500, "height": 375, "upload_date": "05 March 2007", "owner_id": 66229, "owner_name": "Mast", "owner_url": "http://www.panoramio.com/user/66229"} + , + {"photo_id": 4258015, "photo_title": "Fényözön", "photo_url": "http://www.panoramio.com/photo/4258015", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4258015.jpg", "longitude": 16.391602, "latitude": 46.851269, "width": 333, "height": 500, "upload_date": "28 August 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 1413, "photo_title": "Champlain Lookout", "photo_url": "http://www.panoramio.com/photo/1413", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1413.jpg", "longitude": -75.912872, "latitude": 45.507640, "width": 500, "height": 375, "upload_date": "06 October 2005", "owner_id": 273, "owner_name": "JC", "owner_url": "http://www.panoramio.com/user/273"} + , + {"photo_id": 1526763, "photo_title": "Gizeh Pyramids, Cairo", "photo_url": "http://www.panoramio.com/photo/1526763", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1526763.jpg", "longitude": 31.133537, "latitude": 29.966721, "width": 500, "height": 333, "upload_date": "27 March 2007", "owner_id": 59919, "owner_name": "xflo:w (http://www.xflo.net)", "owner_url": "http://www.panoramio.com/user/59919"} + , + {"photo_id": 8802900, "photo_title": "Martigues, miroir aux oiseaux", "photo_url": "http://www.panoramio.com/photo/8802900", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/8802900.jpg", "longitude": 5.054559, "latitude": 43.405079, "width": 387, "height": 500, "upload_date": "24 March 2008", "owner_id": 629243, "owner_name": "Olivier Faugeras", "owner_url": "http://www.panoramio.com/user/629243"} + , + {"photo_id": 459515, "photo_title": "fire works", "photo_url": "http://www.panoramio.com/photo/459515", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/459515.jpg", "longitude": 138.423271, "latitude": 38.069312, "width": 500, "height": 385, "upload_date": "16 January 2007", "owner_id": 86411, "owner_name": "中村脩-Osamu nakamura", "owner_url": "http://www.panoramio.com/user/86411"} + , + {"photo_id": 749464, "photo_title": "Gondola", "photo_url": "http://www.panoramio.com/photo/749464", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/749464.jpg", "longitude": 12.336917, "latitude": 45.434053, "width": 500, "height": 332, "upload_date": "09 February 2007", "owner_id": 159455, "owner_name": "©Franco Truscello", "owner_url": "http://www.panoramio.com/user/159455"} + , + {"photo_id": 422608, "photo_title": "tanada", "photo_url": "http://www.panoramio.com/photo/422608", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/422608.jpg", "longitude": 139.047089, "latitude": 37.449787, "width": 383, "height": 500, "upload_date": "14 January 2007", "owner_id": 86411, "owner_name": "中村脩-Osamu nakamura", "owner_url": "http://www.panoramio.com/user/86411"} + , + {"photo_id": 85617, "photo_title": "Parque Natural de Calblanque", "photo_url": "http://www.panoramio.com/photo/85617", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/85617.jpg", "longitude": -0.739861, "latitude": 37.594104, "width": 332, "height": 500, "upload_date": "24 November 2006", "owner_id": 10969, "owner_name": "Juanra", "owner_url": "http://www.panoramio.com/user/10969"} + , + {"photo_id": 1089235, "photo_title": "Nyáridéző", "photo_url": "http://www.panoramio.com/photo/1089235", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1089235.jpg", "longitude": 18.207092, "latitude": 47.318578, "width": 500, "height": 282, "upload_date": "28 February 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 505229, "photo_title": "Etangs près de Dijon", "photo_url": "http://www.panoramio.com/photo/505229", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/505229.jpg", "longitude": 5.168552, "latitude": 47.312642, "width": 350, "height": 500, "upload_date": "20 January 2007", "owner_id": 78506, "owner_name": "Philippe Stoop", "owner_url": "http://www.panoramio.com/user/78506"} + , + {"photo_id": 679343, "photo_title": "melbourne sunset over the yarra river", "photo_url": "http://www.panoramio.com/photo/679343", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/679343.jpg", "longitude": 144.968119, "latitude": -37.819616, "width": 500, "height": 500, "upload_date": "04 February 2007", "owner_id": 146092, "owner_name": "sid1662", "owner_url": "http://www.panoramio.com/user/146092"} + , + {"photo_id": 436336, "photo_title": "myoujyousan", "photo_url": "http://www.panoramio.com/photo/436336", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/436336.jpg", "longitude": 137.831554, "latitude": 36.911608, "width": 500, "height": 362, "upload_date": "15 January 2007", "owner_id": 86411, "owner_name": "中村脩-Osamu nakamura", "owner_url": "http://www.panoramio.com/user/86411"} + , + {"photo_id": 9733680, "photo_title": "Sydney", "photo_url": "http://www.panoramio.com/photo/9733680", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/9733680.jpg", "longitude": 151.209834, "latitude": -33.848588, "width": 333, "height": 500, "upload_date": "28 April 2008", "owner_id": 1465912, "owner_name": "funtor", "owner_url": "http://www.panoramio.com/user/1465912"} + , + {"photo_id": 7415625, "photo_title": "Në fushë të Pallaticesë", "photo_url": "http://www.panoramio.com/photo/7415625", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/7415625.jpg", "longitude": 21.077271, "latitude": 42.011550, "width": 437, "height": 500, "upload_date": "28 January 2008", "owner_id": 695042, "owner_name": "Neim Sejfuli ♦", "owner_url": "http://www.panoramio.com/user/695042"} + , + {"photo_id": 5358174, "photo_title": "Morning Glory", "photo_url": "http://www.panoramio.com/photo/5358174", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5358174.jpg", "longitude": -110.843537, "latitude": 44.475020, "width": 500, "height": 348, "upload_date": "16 October 2007", "owner_id": 66847, "owner_name": "Lukas Novak", "owner_url": "http://www.panoramio.com/user/66847"} + , + {"photo_id": 316199, "photo_title": "A lake on Gasherbrum glacier", "photo_url": "http://www.panoramio.com/photo/316199", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/316199.jpg", "longitude": 76.732550, "latitude": 35.877298, "width": 500, "height": 375, "upload_date": "06 January 2007", "owner_id": 65672, "owner_name": "www.turclubmai.ru", "owner_url": "http://www.panoramio.com/user/65672"} + , + {"photo_id": 400536, "photo_title": "Half Dome Mtn, Yosemite Nat Park, CA", "photo_url": "http://www.panoramio.com/photo/400536", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/400536.jpg", "longitude": -119.495888, "latitude": 37.811411, "width": 500, "height": 333, "upload_date": "12 January 2007", "owner_id": 85489, "owner_name": "Bruce MacIver", "owner_url": "http://www.panoramio.com/user/85489"} + , + {"photo_id": 2942693, "photo_title": "Tulips and Windmills", "photo_url": "http://www.panoramio.com/photo/2942693", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2942693.jpg", "longitude": 4.864798, "latitude": 52.594393, "width": 500, "height": 500, "upload_date": "25 June 2007", "owner_id": 588149, "owner_name": "Adam Salwanowicz", "owner_url": "http://www.panoramio.com/user/588149"} + , + {"photo_id": 9733633, "photo_title": "Oper-Sydney", "photo_url": "http://www.panoramio.com/photo/9733633", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/9733633.jpg", "longitude": 151.216968, "latitude": -33.851702, "width": 500, "height": 333, "upload_date": "28 April 2008", "owner_id": 1465912, "owner_name": "funtor", "owner_url": "http://www.panoramio.com/user/1465912"} + , + {"photo_id": 1800454, "photo_title": "Bombay Beach, Salton Sea, CA", "photo_url": "http://www.panoramio.com/photo/1800454", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1800454.jpg", "longitude": -115.729235, "latitude": 33.347316, "width": 500, "height": 407, "upload_date": "16 April 2007", "owner_id": 107613, "owner_name": "Tom Grubbe", "owner_url": "http://www.panoramio.com/user/107613"} + , + {"photo_id": 2558057, "photo_title": "Kin-dza-dza 2", "photo_url": "http://www.panoramio.com/photo/2558057", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2558057.jpg", "longitude": 30.785751, "latitude": 46.639301, "width": 500, "height": 375, "upload_date": "03 June 2007", "owner_id": 13058, "owner_name": "Kyryl", "owner_url": "http://www.panoramio.com/user/13058"} + , + {"photo_id": 7768089, "photo_title": "Isteni színjáték", "photo_url": "http://www.panoramio.com/photo/7768089", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/7768089.jpg", "longitude": 17.507057, "latitude": 47.776425, "width": 500, "height": 334, "upload_date": "12 February 2008", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 1213006, "photo_title": "Twilight Drive", "photo_url": "http://www.panoramio.com/photo/1213006", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1213006.jpg", "longitude": -114.481916, "latitude": 51.095841, "width": 500, "height": 335, "upload_date": "07 March 2007", "owner_id": 66847, "owner_name": "Lukas Novak", "owner_url": "http://www.panoramio.com/user/66847"} + , + {"photo_id": 395800, "photo_title": "Pic de Bure depuis le Pic de Gleize", "photo_url": "http://www.panoramio.com/photo/395800", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/395800.jpg", "longitude": 6.055870, "latitude": 44.610146, "width": 500, "height": 350, "upload_date": "12 January 2007", "owner_id": 78506, "owner_name": "Philippe Stoop", "owner_url": "http://www.panoramio.com/user/78506"} + , + {"photo_id": 11073609, "photo_title": "Sunrise in Koroni, by Kostas Andreopoulos", "photo_url": "http://www.panoramio.com/photo/11073609", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/11073609.jpg", "longitude": 21.952747, "latitude": 36.797775, "width": 500, "height": 375, "upload_date": "09 June 2008", "owner_id": 1690483, "owner_name": "k.andre", "owner_url": "http://www.panoramio.com/user/1690483"} + , + {"photo_id": 6564418, "photo_title": "Baron's Haugh, Scotland", "photo_url": "http://www.panoramio.com/photo/6564418", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6564418.jpg", "longitude": -3.989239, "latitude": 55.772808, "width": 500, "height": 337, "upload_date": "19 December 2007", "owner_id": 165346, "owner_name": "Alan Knox", "owner_url": "http://www.panoramio.com/user/165346"} + , + {"photo_id": 10158925, "photo_title": "Lluvia púrpura ( Purple rain )", "photo_url": "http://www.panoramio.com/photo/10158925", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/10158925.jpg", "longitude": -0.476360, "latitude": 39.612565, "width": 500, "height": 333, "upload_date": "12 May 2008", "owner_id": 787217, "owner_name": "♣ Víctor S de Lara ♣", "owner_url": "http://www.panoramio.com/user/787217"} + , + {"photo_id": 121574, "photo_title": "Moscú/Moscow - Catedral de San Basilio", "photo_url": "http://www.panoramio.com/photo/121574", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/121574.jpg", "longitude": 37.621951, "latitude": 55.753033, "width": 500, "height": 375, "upload_date": "12 December 2006", "owner_id": 17212, "owner_name": "javier herranz", "owner_url": "http://www.panoramio.com/user/17212"} + , + {"photo_id": 6012915, "photo_title": "Erleuchtung in Venedig", "photo_url": "http://www.panoramio.com/photo/6012915", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6012915.jpg", "longitude": 12.340747, "latitude": 45.433364, "width": 500, "height": 333, "upload_date": "19 November 2007", "owner_id": 8060, "owner_name": "Norbert MAIER", "owner_url": "http://www.panoramio.com/user/8060"} + , + {"photo_id": 346687, "photo_title": "namibia desert", "photo_url": "http://www.panoramio.com/photo/346687", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/346687.jpg", "longitude": 15.408325, "latitude": -24.729370, "width": 500, "height": 334, "upload_date": "08 January 2007", "owner_id": 69671, "owner_name": "illusandpics.com", "owner_url": "http://www.panoramio.com/user/69671"} + , + {"photo_id": 1913758, "photo_title": "Cortona - Via Gino Severini", "photo_url": "http://www.panoramio.com/photo/1913758", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1913758.jpg", "longitude": 11.988916, "latitude": 43.273659, "width": 500, "height": 498, "upload_date": "24 April 2007", "owner_id": 193913, "owner_name": "Klesitz Piroska", "owner_url": "http://www.panoramio.com/user/193913"} + , + {"photo_id": 405843, "photo_title": "siroiwa", "photo_url": "http://www.panoramio.com/photo/405843", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/405843.jpg", "longitude": 138.789682, "latitude": 37.726398, "width": 500, "height": 338, "upload_date": "13 January 2007", "owner_id": 86411, "owner_name": "中村脩-Osamu nakamura", "owner_url": "http://www.panoramio.com/user/86411"} + , + {"photo_id": 91375, "photo_title": "Burj Al Arab At Night", "photo_url": "http://www.panoramio.com/photo/91375", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/91375.jpg", "longitude": 55.187416, "latitude": 25.140312, "width": 255, "height": 500, "upload_date": "03 December 2006", "owner_id": 1295, "owner_name": "Matthew Walters", "owner_url": "http://www.panoramio.com/user/1295"} + , + {"photo_id": 940792, "photo_title": "Moraine Branch", "photo_url": "http://www.panoramio.com/photo/940792", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/940792.jpg", "longitude": -116.177502, "latitude": 51.325946, "width": 500, "height": 332, "upload_date": "21 February 2007", "owner_id": 66847, "owner_name": "Lukas Novak", "owner_url": "http://www.panoramio.com/user/66847"} + , + {"photo_id": 58287, "photo_title": "Schloß Anif", "photo_url": "http://www.panoramio.com/photo/58287", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/58287.jpg", "longitude": 13.068817, "latitude": 47.744540, "width": 500, "height": 333, "upload_date": "07 October 2006", "owner_id": 8060, "owner_name": "Norbert MAIER", "owner_url": "http://www.panoramio.com/user/8060"} + , + {"photo_id": 194118, "photo_title": "Mount Fuji: Fuji-San", "photo_url": "http://www.panoramio.com/photo/194118", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/194118.jpg", "longitude": 138.727455, "latitude": 35.377294, "width": 500, "height": 332, "upload_date": "20 December 2006", "owner_id": 27882, "owner_name": "taoy", "owner_url": "http://www.panoramio.com/user/27882"} + , + {"photo_id": 5158892, "photo_title": "prati di Tires Alto Adige Südtirol south tyrol", "photo_url": "http://www.panoramio.com/photo/5158892", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5158892.jpg", "longitude": 11.557188, "latitude": 46.471044, "width": 500, "height": 429, "upload_date": "08 October 2007", "owner_id": 578163, "owner_name": "Margherita-Italy", "owner_url": "http://www.panoramio.com/user/578163"} + , + {"photo_id": 280123, "photo_title": "kaouki05", "photo_url": "http://www.panoramio.com/photo/280123", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/280123.jpg", "longitude": -9.799418, "latitude": 31.355662, "width": 328, "height": 500, "upload_date": "01 January 2007", "owner_id": 58867, "owner_name": "Lachaud Franck", "owner_url": "http://www.panoramio.com/user/58867"} + , + {"photo_id": 6789223, "photo_title": "Exploding sky", "photo_url": "http://www.panoramio.com/photo/6789223", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6789223.jpg", "longitude": -69.930505, "latitude": 12.522579, "width": 500, "height": 333, "upload_date": "30 December 2007", "owner_id": 89499, "owner_name": "Michael Braxenthaler", "owner_url": "http://www.panoramio.com/user/89499"} + , + {"photo_id": 3722547, "photo_title": "Morning fog in the Alps", "photo_url": "http://www.panoramio.com/photo/3722547", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3722547.jpg", "longitude": 10.591164, "latitude": 47.521142, "width": 500, "height": 333, "upload_date": "04 August 2007", "owner_id": 89499, "owner_name": "Michael Braxenthaler", "owner_url": "http://www.panoramio.com/user/89499"} + , + {"photo_id": 9530458, "photo_title": "Castillian cereal fields from Atienza walls", "photo_url": "http://www.panoramio.com/photo/9530458", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/9530458.jpg", "longitude": -2.874470, "latitude": 41.198451, "width": 500, "height": 470, "upload_date": "20 April 2008", "owner_id": 134279, "owner_name": "4ullas", "owner_url": "http://www.panoramio.com/user/134279"} + , + {"photo_id": 2935974, "photo_title": "Atardecer tras el Anboto desde el Aitzgorri", "photo_url": "http://www.panoramio.com/photo/2935974", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2935974.jpg", "longitude": -2.324982, "latitude": 42.951240, "width": 500, "height": 331, "upload_date": "25 June 2007", "owner_id": 129297, "owner_name": "Enrique Ortiz de Zárate", "owner_url": "http://www.panoramio.com/user/129297"} + , + {"photo_id": 38587, "photo_title": "Blitz", "photo_url": "http://www.panoramio.com/photo/38587", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/38587.jpg", "longitude": 7.949853, "latitude": 48.489947, "width": 500, "height": 375, "upload_date": "13 August 2006", "owner_id": 6002, "owner_name": "Paul Feiler", "owner_url": "http://www.panoramio.com/user/6002"} + , + {"photo_id": 9312247, "photo_title": "Idrija - High water after rain", "photo_url": "http://www.panoramio.com/photo/9312247", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/9312247.jpg", "longitude": 13.965683, "latitude": 45.955625, "width": 500, "height": 375, "upload_date": "12 April 2008", "owner_id": 763995, "owner_name": "Samo T.", "owner_url": "http://www.panoramio.com/user/763995"} + , + {"photo_id": 110409, "photo_title": "Laguna de Yanganuco", "photo_url": "http://www.panoramio.com/photo/110409", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/110409.jpg", "longitude": -77.640553, "latitude": -9.071585, "width": 330, "height": 500, "upload_date": "11 December 2006", "owner_id": 16323, "owner_name": "Luis Torres", "owner_url": "http://www.panoramio.com/user/16323"} + , + {"photo_id": 7609439, "photo_title": "Fényfürdő", "photo_url": "http://www.panoramio.com/photo/7609439", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/7609439.jpg", "longitude": 15.965366, "latitude": 47.877556, "width": 500, "height": 312, "upload_date": "05 February 2008", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 8599453, "photo_title": "Realidad comprimida", "photo_url": "http://www.panoramio.com/photo/8599453", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/8599453.jpg", "longitude": -2.780957, "latitude": 43.033953, "width": 500, "height": 387, "upload_date": "17 March 2008", "owner_id": 129297, "owner_name": "Enrique Ortiz de Zárate", "owner_url": "http://www.panoramio.com/user/129297"} + , + {"photo_id": 233921, "photo_title": "Mount Titlis, Engelberg, Switzerland www.titlis.ch / www.engelberg.ch/ www.berghuette.ch /www.brunnihuette.ch", "photo_url": "http://www.panoramio.com/photo/233921", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/233921.jpg", "longitude": 8.410742, "latitude": 46.841583, "width": 500, "height": 375, "upload_date": "25 December 2006", "owner_id": 47930, "owner_name": "werni", "owner_url": "http://www.panoramio.com/user/47930"} + , + {"photo_id": 561386, "photo_title": "the country", "photo_url": "http://www.panoramio.com/photo/561386", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/561386.jpg", "longitude": 138.871393, "latitude": 37.602196, "width": 500, "height": 383, "upload_date": "24 January 2007", "owner_id": 86411, "owner_name": "中村脩-Osamu nakamura", "owner_url": "http://www.panoramio.com/user/86411"} + , + {"photo_id": 1195112, "photo_title": "Tolar Grande", "photo_url": "http://www.panoramio.com/photo/1195112", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1195112.jpg", "longitude": -67.361984, "latitude": -24.545249, "width": 500, "height": 342, "upload_date": "06 March 2007", "owner_id": 232099, "owner_name": "mabut", "owner_url": "http://www.panoramio.com/user/232099"} + , + {"photo_id": 5466129, "photo_title": "\"Lasciate ogne speranza, voi ch’intrate\". (\"Abandon all hope, ye who enter here\" ; \"Toi qui entre ici, abandonne toute espérance\".) Dante e il primo girone dell'Inferno (o Virgilio nella selva oscura, accanto all'ingresso dell'Inferno) (ou encore, plus prosaïquement, pêche dans le Jaunay en Vendée, le 21 octobre 2007 à l'aube d'un très froid matin d'automne). #129", "photo_url": "http://www.panoramio.com/photo/5466129", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5466129.jpg", "longitude": -1.901300, "latitude": 46.663398, "width": 500, "height": 281, "upload_date": "22 October 2007", "owner_id": 666755, "owner_name": "Armagnac", "owner_url": "http://www.panoramio.com/user/666755"} + , + {"photo_id": 57820, "photo_title": "Hallstatt 2", "photo_url": "http://www.panoramio.com/photo/57820", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/57820.jpg", "longitude": 13.649054, "latitude": 47.555040, "width": 500, "height": 333, "upload_date": "05 October 2006", "owner_id": 8060, "owner_name": "Norbert MAIER", "owner_url": "http://www.panoramio.com/user/8060"} + , + {"photo_id": 798312, "photo_title": "Riflettendo...", "photo_url": "http://www.panoramio.com/photo/798312", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/798312.jpg", "longitude": 7.677534, "latitude": 45.069925, "width": 500, "height": 332, "upload_date": "12 February 2007", "owner_id": 159455, "owner_name": "©Franco Truscello", "owner_url": "http://www.panoramio.com/user/159455"} + , + {"photo_id": 7401432, "photo_title": "07-12-18_\"Arterias del Bosque\" PIXELECTA", "photo_url": "http://www.panoramio.com/photo/7401432", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/7401432.jpg", "longitude": -2.775679, "latitude": 43.005338, "width": 500, "height": 333, "upload_date": "27 January 2008", "owner_id": 163655, "owner_name": "[[[ PIXELECTA ]]]", "owner_url": "http://www.panoramio.com/user/163655"} + , + {"photo_id": 2584132, "photo_title": "Farm Tomita", "photo_url": "http://www.panoramio.com/photo/2584132", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2584132.jpg", "longitude": 142.426586, "latitude": 43.418889, "width": 500, "height": 375, "upload_date": "05 June 2007", "owner_id": 532882, "owner_name": "wisdomcomplex", "owner_url": "http://www.panoramio.com/user/532882"} + , + {"photo_id": 4670499, "photo_title": "El despertar de la naturaleza", "photo_url": "http://www.panoramio.com/photo/4670499", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4670499.jpg", "longitude": -73.227739, "latitude": -39.821285, "width": 500, "height": 371, "upload_date": "15 September 2007", "owner_id": 327310, "owner_name": "Erwin Woenckhaus", "owner_url": "http://www.panoramio.com/user/327310"} + , + {"photo_id": 5133875, "photo_title": "Lumi Vardar", "photo_url": "http://www.panoramio.com/photo/5133875", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5133875.jpg", "longitude": 21.075597, "latitude": 42.006671, "width": 500, "height": 375, "upload_date": "06 October 2007", "owner_id": 695042, "owner_name": "Neim Sejfuli ♦", "owner_url": "http://www.panoramio.com/user/695042"} + , + {"photo_id": 8309167, "photo_title": "Cueva de los Verdes", "photo_url": "http://www.panoramio.com/photo/8309167", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/8309167.jpg", "longitude": -13.439734, "latitude": 29.161137, "width": 333, "height": 500, "upload_date": "05 March 2008", "owner_id": 1465912, "owner_name": "funtor", "owner_url": "http://www.panoramio.com/user/1465912"} + , + {"photo_id": 1756166, "photo_title": "The Pantheon, Rome, Italy", "photo_url": "http://www.panoramio.com/photo/1756166", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1756166.jpg", "longitude": 12.476842, "latitude": 41.898540, "width": 376, "height": 500, "upload_date": "13 April 2007", "owner_id": 140796, "owner_name": "rosina lamberti", "owner_url": "http://www.panoramio.com/user/140796"} + , + {"photo_id": 1831309, "photo_title": "Oak in blue - last one", "photo_url": "http://www.panoramio.com/photo/1831309", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1831309.jpg", "longitude": 10.771322, "latitude": 59.664143, "width": 326, "height": 500, "upload_date": "18 April 2007", "owner_id": 39160, "owner_name": "Snemann", "owner_url": "http://www.panoramio.com/user/39160"} + , + {"photo_id": 626487, "photo_title": "A harag napja", "photo_url": "http://www.panoramio.com/photo/626487", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/626487.jpg", "longitude": 15.919275, "latitude": 43.589468, "width": 500, "height": 333, "upload_date": "30 January 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 202162, "photo_title": "Monument Valley", "photo_url": "http://www.panoramio.com/photo/202162", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/202162.jpg", "longitude": -110.094552, "latitude": 36.976810, "width": 500, "height": 333, "upload_date": "21 December 2006", "owner_id": 40260, "owner_name": "Don Albonico", "owner_url": "http://www.panoramio.com/user/40260"} + , + {"photo_id": 791016, "photo_title": "Sossusvlei", "photo_url": "http://www.panoramio.com/photo/791016", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/791016.jpg", "longitude": 15.289364, "latitude": -24.730656, "width": 500, "height": 333, "upload_date": "12 February 2007", "owner_id": 12736, "owner_name": "www.sliwi.de", "owner_url": "http://www.panoramio.com/user/12736"} + , + {"photo_id": 9760518, "photo_title": "Eglise Notre-Dame de la Couture", "photo_url": "http://www.panoramio.com/photo/9760518", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/9760518.jpg", "longitude": 0.596437, "latitude": 49.082510, "width": 375, "height": 500, "upload_date": "29 April 2008", "owner_id": 1275480, "owner_name": "Nicolas Aubé", "owner_url": "http://www.panoramio.com/user/1275480"} + , + {"photo_id": 2097684, "photo_title": "", "photo_url": "http://www.panoramio.com/photo/2097684", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2097684.jpg", "longitude": -79.793916, "latitude": 43.299447, "width": 500, "height": 333, "upload_date": "06 May 2007", "owner_id": 17488, "owner_name": "John Gillett", "owner_url": "http://www.panoramio.com/user/17488"} + , + {"photo_id": 6851021, "photo_title": "Lumi Vardar-Sunset", "photo_url": "http://www.panoramio.com/photo/6851021", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6851021.jpg", "longitude": 21.077871, "latitude": 42.007532, "width": 458, "height": 500, "upload_date": "02 January 2008", "owner_id": 695042, "owner_name": "Neim Sejfuli ♦", "owner_url": "http://www.panoramio.com/user/695042"} + , + {"photo_id": 8137868, "photo_title": "Sunset Trace at Kotchi, Korea", "photo_url": "http://www.panoramio.com/photo/8137868", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/8137868.jpg", "longitude": 126.333847, "latitude": 36.498597, "width": 500, "height": 500, "upload_date": "27 February 2008", "owner_id": 1221287, "owner_name": "TS Jeung", "owner_url": "http://www.panoramio.com/user/1221287"} + , + {"photo_id": 382104, "photo_title": "Meteora", "photo_url": "http://www.panoramio.com/photo/382104", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/382104.jpg", "longitude": 21.616974, "latitude": 39.743626, "width": 500, "height": 500, "upload_date": "11 January 2007", "owner_id": 16880, "owner_name": "evgenidinev.com", "owner_url": "http://www.panoramio.com/user/16880"} + , + {"photo_id": 3399014, "photo_title": "Vue du Schneibstein vers l'Est", "photo_url": "http://www.panoramio.com/photo/3399014", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3399014.jpg", "longitude": 13.055191, "latitude": 47.562396, "width": 500, "height": 328, "upload_date": "19 July 2007", "owner_id": 78506, "owner_name": "Philippe Stoop", "owner_url": "http://www.panoramio.com/user/78506"} + , + {"photo_id": 29596, "photo_title": "Ciudad de Los Cielos", "photo_url": "http://www.panoramio.com/photo/29596", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/29596.jpg", "longitude": -72.545900, "latitude": -13.165304, "width": 500, "height": 375, "upload_date": "01 July 2006", "owner_id": 4483, "owner_name": "Miguel Coranti", "owner_url": "http://www.panoramio.com/user/4483"} + , + {"photo_id": 1269713, "photo_title": "Rainbow over Olskårdvatnet near Kiberg, Finnmark, Norway", "photo_url": "http://www.panoramio.com/photo/1269713", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1269713.jpg", "longitude": 30.906601, "latitude": 70.295137, "width": 361, "height": 500, "upload_date": "11 March 2007", "owner_id": 66734, "owner_name": "Svein Solhaug", "owner_url": "http://www.panoramio.com/user/66734"} + , + {"photo_id": 507631, "photo_title": "Egy ábrándos reggelen", "photo_url": "http://www.panoramio.com/photo/507631", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/507631.jpg", "longitude": 17.466667, "latitude": 47.866667, "width": 500, "height": 334, "upload_date": "20 January 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 722974, "photo_title": "Airdrie Vortex", "photo_url": "http://www.panoramio.com/photo/722974", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/722974.jpg", "longitude": -114.087481, "latitude": 51.048544, "width": 500, "height": 323, "upload_date": "07 February 2007", "owner_id": 66847, "owner_name": "Lukas Novak", "owner_url": "http://www.panoramio.com/user/66847"} + , + {"photo_id": 1118007, "photo_title": "Moraine Lake, Banff NP (Canada)", "photo_url": "http://www.panoramio.com/photo/1118007", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1118007.jpg", "longitude": -116.177673, "latitude": 51.328091, "width": 500, "height": 326, "upload_date": "02 March 2007", "owner_id": 229005, "owner_name": "mypictures4u.com", "owner_url": "http://www.panoramio.com/user/229005"} + , + {"photo_id": 1343943, "photo_title": "Andes Mountains.Patagonia.Argentina", "photo_url": "http://www.panoramio.com/photo/1343943", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1343943.jpg", "longitude": -72.422905, "latitude": -49.381814, "width": 500, "height": 375, "upload_date": "16 March 2007", "owner_id": 281428, "owner_name": "avni_", "owner_url": "http://www.panoramio.com/user/281428"} + , + {"photo_id": 5637365, "photo_title": "Northen lights", "photo_url": "http://www.panoramio.com/photo/5637365", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5637365.jpg", "longitude": 28.599129, "latitude": 66.247365, "width": 500, "height": 333, "upload_date": "30 October 2007", "owner_id": 897591, "owner_name": "markku pirttimaa www.karhukuusamo.com", "owner_url": "http://www.panoramio.com/user/897591"} + , + {"photo_id": 241562, "photo_title": "Süd-Ostisland", "photo_url": "http://www.panoramio.com/photo/241562", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/241562.jpg", "longitude": -17.512207, "latitude": 63.954261, "width": 500, "height": 326, "upload_date": "26 December 2006", "owner_id": 14774, "owner_name": "Frank Block", "owner_url": "http://www.panoramio.com/user/14774"} + , + {"photo_id": 48899, "photo_title": "Bellagio Fountain", "photo_url": "http://www.panoramio.com/photo/48899", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/48899.jpg", "longitude": -115.174227, "latitude": 36.112778, "width": 500, "height": 375, "upload_date": "16 September 2006", "owner_id": 7190, "owner_name": "Perry Tang", "owner_url": "http://www.panoramio.com/user/7190"} + , + {"photo_id": 49822, "photo_title": "Baños termales en Alhama de Granada", "photo_url": "http://www.panoramio.com/photo/49822", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/49822.jpg", "longitude": -3.983274, "latitude": 37.018248, "width": 374, "height": 500, "upload_date": "19 September 2006", "owner_id": 5477, "owner_name": "errece", "owner_url": "http://www.panoramio.com/user/5477"} + , + {"photo_id": 8248490, "photo_title": "Emmerald river", "photo_url": "http://www.panoramio.com/photo/8248490", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/8248490.jpg", "longitude": 13.650362, "latitude": 46.340336, "width": 375, "height": 500, "upload_date": "02 March 2008", "owner_id": 763995, "owner_name": "Samo T.", "owner_url": "http://www.panoramio.com/user/763995"} + , + {"photo_id": 459528, "photo_title": "gassan", "photo_url": "http://www.panoramio.com/photo/459528", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/459528.jpg", "longitude": 139.895782, "latitude": 38.282391, "width": 500, "height": 379, "upload_date": "16 January 2007", "owner_id": 86411, "owner_name": "中村脩-Osamu nakamura", "owner_url": "http://www.panoramio.com/user/86411"} + , + {"photo_id": 50203, "photo_title": "Die Hütte in Nyidalur an einem Septembermorgen ....", "photo_url": "http://www.panoramio.com/photo/50203", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/50203.jpg", "longitude": -18.132935, "latitude": 64.762124, "width": 500, "height": 299, "upload_date": "20 September 2006", "owner_id": 7434, "owner_name": "baldinger reisen ag, waedenswil/switzerland", "owner_url": "http://www.panoramio.com/user/7434"} + , + {"photo_id": 51502, "photo_title": "eclipse", "photo_url": "http://www.panoramio.com/photo/51502", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/51502.jpg", "longitude": -0.121665, "latitude": 51.500969, "width": 500, "height": 375, "upload_date": "24 September 2006", "owner_id": 6645, "owner_name": "JesusVillalba", "owner_url": "http://www.panoramio.com/user/6645"} + , + {"photo_id": 3671663, "photo_title": "Urbia traspuesta de sol, desde Aizkorri", "photo_url": "http://www.panoramio.com/photo/3671663", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3671663.jpg", "longitude": -2.324831, "latitude": 42.951271, "width": 500, "height": 298, "upload_date": "02 August 2007", "owner_id": 129297, "owner_name": "Enrique Ortiz de Zárate", "owner_url": "http://www.panoramio.com/user/129297"} + , + {"photo_id": 1928780, "photo_title": "God is looking", "photo_url": "http://www.panoramio.com/photo/1928780", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1928780.jpg", "longitude": 19.952137, "latitude": 50.106075, "width": 500, "height": 379, "upload_date": "25 April 2007", "owner_id": 12954, "owner_name": "Ziębol", "owner_url": "http://www.panoramio.com/user/12954"} + , + {"photo_id": 10068109, "photo_title": "#2 Steinerne Brücke über Lendkanal, Stone Bridge over Lendkanal, Klagenfurt, Austria", "photo_url": "http://www.panoramio.com/photo/10068109", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/10068109.jpg", "longitude": 14.284313, "latitude": 46.620436, "width": 376, "height": 500, "upload_date": "09 May 2008", "owner_id": 1077251, "owner_name": "picsonthemove", "owner_url": "http://www.panoramio.com/user/1077251"} + , + {"photo_id": 8730264, "photo_title": "Large wave hits the North Pier, Tynemouth - Easter 2008", "photo_url": "http://www.panoramio.com/photo/8730264", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/8730264.jpg", "longitude": -1.420702, "latitude": 55.020727, "width": 434, "height": 500, "upload_date": "22 March 2008", "owner_id": 1107262, "owner_name": "bobpercy", "owner_url": "http://www.panoramio.com/user/1107262"} + , + {"photo_id": 330436, "photo_title": "bolivia salar-de-uyuni", "photo_url": "http://www.panoramio.com/photo/330436", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/330436.jpg", "longitude": -67.876625, "latitude": -20.180046, "width": 500, "height": 334, "upload_date": "07 January 2007", "owner_id": 69671, "owner_name": "illusandpics.com", "owner_url": "http://www.panoramio.com/user/69671"} + , + {"photo_id": 10287647, "photo_title": "A moment of silence * Honorable mention may contest*", "photo_url": "http://www.panoramio.com/photo/10287647", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/10287647.jpg", "longitude": 6.177192, "latitude": 52.218099, "width": 500, "height": 413, "upload_date": "16 May 2008", "owner_id": 523564, "owner_name": "Luud Riphagen", "owner_url": "http://www.panoramio.com/user/523564"} + , + {"photo_id": 436323, "photo_title": "zeikan", "photo_url": "http://www.panoramio.com/photo/436323", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/436323.jpg", "longitude": 139.057925, "latitude": 37.930016, "width": 500, "height": 381, "upload_date": "15 January 2007", "owner_id": 86411, "owner_name": "中村脩-Osamu nakamura", "owner_url": "http://www.panoramio.com/user/86411"} + , + {"photo_id": 298350, "photo_title": "What are you looking at ?", "photo_url": "http://www.panoramio.com/photo/298350", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/298350.jpg", "longitude": -109.276510, "latitude": -27.125567, "width": 500, "height": 332, "upload_date": "04 January 2007", "owner_id": 57893, "owner_name": "ThoiryK", "owner_url": "http://www.panoramio.com/user/57893"} + , + {"photo_id": 85618, "photo_title": "Minas de Mazarrón", "photo_url": "http://www.panoramio.com/photo/85618", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/85618.jpg", "longitude": -1.331406, "latitude": 37.599544, "width": 500, "height": 334, "upload_date": "24 November 2006", "owner_id": 10969, "owner_name": "Juanra", "owner_url": "http://www.panoramio.com/user/10969"} + , + {"photo_id": 3804107, "photo_title": "_Feloeka on the Nile_ (Aswan - Egypt)", "photo_url": "http://www.panoramio.com/photo/3804107", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3804107.jpg", "longitude": 32.887723, "latitude": 24.095443, "width": 500, "height": 350, "upload_date": "08 August 2007", "owner_id": 366746, "owner_name": "T NL", "owner_url": "http://www.panoramio.com/user/366746"} + , + {"photo_id": 369885, "photo_title": "Monarque on the beach", "photo_url": "http://www.panoramio.com/photo/369885", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/369885.jpg", "longitude": -70.563126, "latitude": 43.308816, "width": 500, "height": 371, "upload_date": "10 January 2007", "owner_id": 78738, "owner_name": "Nicola Vachon", "owner_url": "http://www.panoramio.com/user/78738"} + , + {"photo_id": 4819425, "photo_title": "Zeeland Magic, 1", "photo_url": "http://www.panoramio.com/photo/4819425", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4819425.jpg", "longitude": 3.479254, "latitude": 51.501169, "width": 492, "height": 500, "upload_date": "22 September 2007", "owner_id": 213866, "owner_name": "Nicolas Mertens", "owner_url": "http://www.panoramio.com/user/213866"} + , + {"photo_id": 88122, "photo_title": "Arpy Lake - Aosta Valley - Italy", "photo_url": "http://www.panoramio.com/photo/88122", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/88122.jpg", "longitude": 6.999636, "latitude": 45.723008, "width": 375, "height": 500, "upload_date": "28 November 2006", "owner_id": 11098, "owner_name": "Michele Masnata", "owner_url": "http://www.panoramio.com/user/11098"} + , + {"photo_id": 10219582, "photo_title": "MITTENS ALONG THE ROAD", "photo_url": "http://www.panoramio.com/photo/10219582", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/10219582.jpg", "longitude": -110.091248, "latitude": 36.970810, "width": 500, "height": 462, "upload_date": "14 May 2008", "owner_id": 864987, "owner_name": "antorenz", "owner_url": "http://www.panoramio.com/user/864987"} + , + {"photo_id": 558167, "photo_title": "Táltostánc", "photo_url": "http://www.panoramio.com/photo/558167", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/558167.jpg", "longitude": 18.001614, "latitude": 47.409038, "width": 417, "height": 500, "upload_date": "24 January 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 7113068, "photo_title": "Bálavár", "photo_url": "http://www.panoramio.com/photo/7113068", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/7113068.jpg", "longitude": 17.522507, "latitude": 47.775560, "width": 500, "height": 336, "upload_date": "14 January 2008", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 2920885, "photo_title": "Rainbow", "photo_url": "http://www.panoramio.com/photo/2920885", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2920885.jpg", "longitude": 10.620818, "latitude": 47.770960, "width": 375, "height": 500, "upload_date": "24 June 2007", "owner_id": 123698, "owner_name": "© Kojak", "owner_url": "http://www.panoramio.com/user/123698"} + , + {"photo_id": 2499825, "photo_title": "Rosina lamberti,sunset, templestowe", "photo_url": "http://www.panoramio.com/photo/2499825", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2499825.jpg", "longitude": 145.143299, "latitude": -37.770104, "width": 500, "height": 359, "upload_date": "01 June 2007", "owner_id": 140796, "owner_name": "rosina lamberti", "owner_url": "http://www.panoramio.com/user/140796"} + , + {"photo_id": 4536639, "photo_title": "Lago di Carezza", "photo_url": "http://www.panoramio.com/photo/4536639", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4536639.jpg", "longitude": 11.575298, "latitude": 46.410227, "width": 500, "height": 393, "upload_date": "09 September 2007", "owner_id": 578163, "owner_name": "Margherita-Italy", "owner_url": "http://www.panoramio.com/user/578163"} + , + {"photo_id": 314957, "photo_title": "\"He it is, who coming after me...\" - St. John Baptist on the Charles Bridge ", "photo_url": "http://www.panoramio.com/photo/314957", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/314957.jpg", "longitude": 14.410307, "latitude": 50.086597, "width": 335, "height": 500, "upload_date": "06 January 2007", "owner_id": 57869, "owner_name": "NAGY Albert", "owner_url": "http://www.panoramio.com/user/57869"} + , + {"photo_id": 507214, "photo_title": "A változás ideje", "photo_url": "http://www.panoramio.com/photo/507214", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/507214.jpg", "longitude": 17.980499, "latitude": 47.390912, "width": 500, "height": 335, "upload_date": "20 January 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 5551561, "photo_title": "New light old trees26-10-2007", "photo_url": "http://www.panoramio.com/photo/5551561", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5551561.jpg", "longitude": -5.663366, "latitude": 55.390130, "width": 338, "height": 500, "upload_date": "26 October 2007", "owner_id": 599676, "owner_name": "mossip", "owner_url": "http://www.panoramio.com/user/599676"} + , + {"photo_id": 67338, "photo_title": "Salar de Uyuni", "photo_url": "http://www.panoramio.com/photo/67338", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/67338.jpg", "longitude": -67.539825, "latitude": -20.439882, "width": 375, "height": 500, "upload_date": "20 October 2006", "owner_id": 9080, "owner_name": "Marco Teodonio", "owner_url": "http://www.panoramio.com/user/9080"} + , + {"photo_id": 436354, "photo_title": "oonogame", "photo_url": "http://www.panoramio.com/photo/436354", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/436354.jpg", "longitude": 138.461380, "latitude": 38.311760, "width": 387, "height": 500, "upload_date": "15 January 2007", "owner_id": 86411, "owner_name": "中村脩-Osamu nakamura", "owner_url": "http://www.panoramio.com/user/86411"} + , + {"photo_id": 10068358, "photo_title": "#08 Reflections in Lendkanal, Klagenfurt, Scenery June 2008", "photo_url": "http://www.panoramio.com/photo/10068358", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/10068358.jpg", "longitude": 14.294415, "latitude": 46.622326, "width": 375, "height": 500, "upload_date": "09 May 2008", "owner_id": 1077251, "owner_name": "picsonthemove", "owner_url": "http://www.panoramio.com/user/1077251"} + , + {"photo_id": 1440137, "photo_title": "Horseshoe Bend", "photo_url": "http://www.panoramio.com/photo/1440137", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1440137.jpg", "longitude": -111.510887, "latitude": 36.882641, "width": 500, "height": 391, "upload_date": "22 March 2007", "owner_id": 286729, "owner_name": "jimwitkowski", "owner_url": "http://www.panoramio.com/user/286729"} + , + {"photo_id": 4809439, "photo_title": "Going Nowhere Fast", "photo_url": "http://www.panoramio.com/photo/4809439", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4809439.jpg", "longitude": -119.013970, "latitude": 38.211420, "width": 375, "height": 500, "upload_date": "21 September 2007", "owner_id": 376395, "owner_name": "JeffSullivan (www.MyPhotoGuides.com)", "owner_url": "http://www.panoramio.com/user/376395"} + , + {"photo_id": 7806281, "photo_title": "Moon&Mosque", "photo_url": "http://www.panoramio.com/photo/7806281", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/7806281.jpg", "longitude": 21.138296, "latitude": 41.960958, "width": 500, "height": 344, "upload_date": "13 February 2008", "owner_id": 695042, "owner_name": "Neim Sejfuli ♦", "owner_url": "http://www.panoramio.com/user/695042"} + , + {"photo_id": 821388, "photo_title": "Aurora Borealis with frosty fog from the sea in front", "photo_url": "http://www.panoramio.com/photo/821388", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/821388.jpg", "longitude": 23.229733, "latitude": 69.962616, "width": 500, "height": 256, "upload_date": "14 February 2007", "owner_id": 56091, "owner_name": "Kjetil Vaage Øie", "owner_url": "http://www.panoramio.com/user/56091"} + , + {"photo_id": 946841, "photo_title": "Maroon Bells", "photo_url": "http://www.panoramio.com/photo/946841", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/946841.jpg", "longitude": -106.948385, "latitude": 39.095030, "width": 500, "height": 375, "upload_date": "21 February 2007", "owner_id": 163881, "owner_name": "faisasy", "owner_url": "http://www.panoramio.com/user/163881"} + , + {"photo_id": 3719882, "photo_title": "Puesta de Sol(Oest.Portugal)", "photo_url": "http://www.panoramio.com/photo/3719882", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3719882.jpg", "longitude": -9.286709, "latitude": 39.392428, "width": 375, "height": 500, "upload_date": "04 August 2007", "owner_id": 83865, "owner_name": "Epi F.Villanueva", "owner_url": "http://www.panoramio.com/user/83865"} + , + {"photo_id": 3418114, "photo_title": "Fény-Kép", "photo_url": "http://www.panoramio.com/photo/3418114", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3418114.jpg", "longitude": 17.511692, "latitude": 47.837127, "width": 500, "height": 333, "upload_date": "20 July 2007", "owner_id": 689769, "owner_name": "Ponty István", "owner_url": "http://www.panoramio.com/user/689769"} + , + {"photo_id": 255257, "photo_title": "Croatia, Brela - Sunset on the Beach - near \"Kamen Brela\" rock, symbol of this adriatic town", "photo_url": "http://www.panoramio.com/photo/255257", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/255257.jpg", "longitude": 16.922604, "latitude": 43.372309, "width": 500, "height": 332, "upload_date": "28 December 2006", "owner_id": 52119, "owner_name": "RomanV", "owner_url": "http://www.panoramio.com/user/52119"} + , + {"photo_id": 2346040, "photo_title": "Huncut fények", "photo_url": "http://www.panoramio.com/photo/2346040", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2346040.jpg", "longitude": 15.539217, "latitude": 47.670589, "width": 500, "height": 334, "upload_date": "22 May 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 1235900, "photo_title": "Fog, Hemlocks and Cedars ", "photo_url": "http://www.panoramio.com/photo/1235900", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1235900.jpg", "longitude": -131.682816, "latitude": 52.885706, "width": 500, "height": 352, "upload_date": "09 March 2007", "owner_id": 232099, "owner_name": "mabut", "owner_url": "http://www.panoramio.com/user/232099"} + , + {"photo_id": 111554, "photo_title": "Lahna", "photo_url": "http://www.panoramio.com/photo/111554", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/111554.jpg", "longitude": 27.557831, "latitude": 42.550551, "width": 500, "height": 357, "upload_date": "11 December 2006", "owner_id": 16880, "owner_name": "evgenidinev.com", "owner_url": "http://www.panoramio.com/user/16880"} + , + {"photo_id": 280112, "photo_title": "dune02", "photo_url": "http://www.panoramio.com/photo/280112", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/280112.jpg", "longitude": -3.985291, "latitude": 31.156408, "width": 500, "height": 338, "upload_date": "01 January 2007", "owner_id": 58867, "owner_name": "Lachaud Franck", "owner_url": "http://www.panoramio.com/user/58867"} + , + {"photo_id": 5984, "photo_title": "Chott El Jerid", "photo_url": "http://www.panoramio.com/photo/5984", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5984.jpg", "longitude": 8.358536, "latitude": 33.715202, "width": 347, "height": 500, "upload_date": "17 December 2005", "owner_id": 989, "owner_name": "Mrgud", "owner_url": "http://www.panoramio.com/user/989"} + , + {"photo_id": 25513, "photo_title": "Catarata Rio Celeste", "photo_url": "http://www.panoramio.com/photo/25513", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/25513.jpg", "longitude": -85.046539, "latitude": 10.643400, "width": 375, "height": 500, "upload_date": "17 June 2006", "owner_id": 4112, "owner_name": "Roberto Garcia", "owner_url": "http://www.panoramio.com/user/4112"} + , + {"photo_id": 35502, "photo_title": "roques", "photo_url": "http://www.panoramio.com/photo/35502", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/35502.jpg", "longitude": -66.774902, "latitude": 11.802834, "width": 500, "height": 375, "upload_date": "29 July 2006", "owner_id": 3360, "owner_name": "ozzy", "owner_url": "http://www.panoramio.com/user/3360"} + , + {"photo_id": 1656020, "photo_title": "Palmeras", "photo_url": "http://www.panoramio.com/photo/1656020", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1656020.jpg", "longitude": -1.211929, "latitude": 37.935804, "width": 500, "height": 333, "upload_date": "06 April 2007", "owner_id": 10969, "owner_name": "Juanra", "owner_url": "http://www.panoramio.com/user/10969"} + , + {"photo_id": 58341, "photo_title": "Lio Piccolo - Palazzetto Boldú", "photo_url": "http://www.panoramio.com/photo/58341", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/58341.jpg", "longitude": 12.489095, "latitude": 45.490615, "width": 500, "height": 333, "upload_date": "07 October 2006", "owner_id": 8060, "owner_name": "Norbert MAIER", "owner_url": "http://www.panoramio.com/user/8060"} + , + {"photo_id": 416310, "photo_title": "Lake of Glass Falls", "photo_url": "http://www.panoramio.com/photo/416310", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/416310.jpg", "longitude": -105.664272, "latitude": 40.283192, "width": 500, "height": 374, "upload_date": "13 January 2007", "owner_id": 87752, "owner_name": "Richard Ryer", "owner_url": "http://www.panoramio.com/user/87752"} + , + {"photo_id": 8148031, "photo_title": "Der Morgen in der Camargue .....", "photo_url": "http://www.panoramio.com/photo/8148031", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/8148031.jpg", "longitude": 4.451180, "latitude": 43.507102, "width": 500, "height": 351, "upload_date": "27 February 2008", "owner_id": 7434, "owner_name": "baldinger reisen ag, waedenswil/switzerland", "owner_url": "http://www.panoramio.com/user/7434"} + , + {"photo_id": 1088575, "photo_title": "Lampion", "photo_url": "http://www.panoramio.com/photo/1088575", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1088575.jpg", "longitude": 17.698631, "latitude": 47.521374, "width": 500, "height": 397, "upload_date": "28 February 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 771169, "photo_title": "Bloodred evening sky, near Zutphen", "photo_url": "http://www.panoramio.com/photo/771169", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/771169.jpg", "longitude": 6.110770, "latitude": 52.113681, "width": 500, "height": 500, "upload_date": "11 February 2007", "owner_id": 161254, "owner_name": "fotoartistry", "owner_url": "http://www.panoramio.com/user/161254"} + , + {"photo_id": 2334149, "photo_title": "", "photo_url": "http://www.panoramio.com/photo/2334149", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2334149.jpg", "longitude": 0.493269, "latitude": 40.904204, "width": 500, "height": 304, "upload_date": "21 May 2007", "owner_id": 3022, "owner_name": "Arcadi", "owner_url": "http://www.panoramio.com/user/3022"} + , + {"photo_id": 41688, "photo_title": "Unbelieveable sunrise colors at Lofoten", "photo_url": "http://www.panoramio.com/photo/41688", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/41688.jpg", "longitude": 14.256134, "latitude": 68.239368, "width": 500, "height": 375, "upload_date": "26 August 2006", "owner_id": 3404, "owner_name": "Csongor Böröczky", "owner_url": "http://www.panoramio.com/user/3404"} + , + {"photo_id": 6953, "photo_title": "Last moment of the day", "photo_url": "http://www.panoramio.com/photo/6953", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6953.jpg", "longitude": 2.191944, "latitude": 41.578599, "width": 500, "height": 320, "upload_date": "16 January 2006", "owner_id": 414, "owner_name": "Sonia Villegas", "owner_url": "http://www.panoramio.com/user/414"} + , + {"photo_id": 10895432, "photo_title": "Карагайская сосна", "photo_url": "http://www.panoramio.com/photo/10895432", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/10895432.jpg", "longitude": 57.886791, "latitude": 51.644708, "width": 333, "height": 500, "upload_date": "04 June 2008", "owner_id": 904057, "owner_name": "Б.Ярцев", "owner_url": "http://www.panoramio.com/user/904057"} + , + {"photo_id": 1446812, "photo_title": "Elfland", "photo_url": "http://www.panoramio.com/photo/1446812", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1446812.jpg", "longitude": 17.808323, "latitude": 47.349408, "width": 345, "height": 500, "upload_date": "22 March 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 4898495, "photo_title": "Elfendel", "photo_url": "http://www.panoramio.com/photo/4898495", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4898495.jpg", "longitude": 17.724380, "latitude": 47.261058, "width": 500, "height": 325, "upload_date": "25 September 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 911298, "photo_title": "View from Nordenskiöldtoppen, Svalbard", "photo_url": "http://www.panoramio.com/photo/911298", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/911298.jpg", "longitude": 15.314941, "latitude": 78.179588, "width": 500, "height": 287, "upload_date": "20 February 2007", "owner_id": 66734, "owner_name": "Svein Solhaug", "owner_url": "http://www.panoramio.com/user/66734"} + , + {"photo_id": 2169236, "photo_title": "sunset", "photo_url": "http://www.panoramio.com/photo/2169236", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2169236.jpg", "longitude": 145.128708, "latitude": -37.759859, "width": 333, "height": 500, "upload_date": "11 May 2007", "owner_id": 140796, "owner_name": "rosina lamberti", "owner_url": "http://www.panoramio.com/user/140796"} + , + {"photo_id": 237466, "photo_title": "wierzchon.com warsaw podzamcze", "photo_url": "http://www.panoramio.com/photo/237466", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/237466.jpg", "longitude": 21.011347, "latitude": 52.253852, "width": 335, "height": 500, "upload_date": "26 December 2006", "owner_id": 47836, "owner_name": "Andrzej Wierzchon", "owner_url": "http://www.panoramio.com/user/47836"} + , + {"photo_id": 355519, "photo_title": "chile laguna miscanti", "photo_url": "http://www.panoramio.com/photo/355519", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/355519.jpg", "longitude": -67.798347, "latitude": -23.758010, "width": 500, "height": 334, "upload_date": "09 January 2007", "owner_id": 69671, "owner_name": "illusandpics.com", "owner_url": "http://www.panoramio.com/user/69671"} + , + {"photo_id": 58360, "photo_title": "Castello di Toblino", "photo_url": "http://www.panoramio.com/photo/58360", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/58360.jpg", "longitude": 10.966415, "latitude": 46.054173, "width": 500, "height": 333, "upload_date": "07 October 2006", "owner_id": 8060, "owner_name": "Norbert MAIER", "owner_url": "http://www.panoramio.com/user/8060"} + , + {"photo_id": 10511168, "photo_title": "Në Fush të Pallaticës", "photo_url": "http://www.panoramio.com/photo/10511168", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/10511168.jpg", "longitude": 21.075296, "latitude": 42.007692, "width": 500, "height": 413, "upload_date": "23 May 2008", "owner_id": 695042, "owner_name": "Neim Sejfuli ♦", "owner_url": "http://www.panoramio.com/user/695042"} + , + {"photo_id": 572526, "photo_title": "Farm by Osafjorden in the first sun of the day", "photo_url": "http://www.panoramio.com/photo/572526", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/572526.jpg", "longitude": 6.998119, "latitude": 60.563101, "width": 500, "height": 353, "upload_date": "25 January 2007", "owner_id": 39160, "owner_name": "Snemann", "owner_url": "http://www.panoramio.com/user/39160"} + , + {"photo_id": 5303687, "photo_title": "Fátyoltánc", "photo_url": "http://www.panoramio.com/photo/5303687", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5303687.jpg", "longitude": 15.934725, "latitude": 47.915997, "width": 500, "height": 334, "upload_date": "14 October 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 370324, "photo_title": "Rainbow_by_bkm", "photo_url": "http://www.panoramio.com/photo/370324", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/370324.jpg", "longitude": 6.453094, "latitude": 62.636926, "width": 500, "height": 344, "upload_date": "10 January 2007", "owner_id": 78923, "owner_name": "bj00rn", "owner_url": "http://www.panoramio.com/user/78923"} + , + {"photo_id": 7996369, "photo_title": "Bled - Church on the island", "photo_url": "http://www.panoramio.com/photo/7996369", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/7996369.jpg", "longitude": 14.084473, "latitude": 46.360671, "width": 375, "height": 500, "upload_date": "21 February 2008", "owner_id": 763995, "owner_name": "Samo T.", "owner_url": "http://www.panoramio.com/user/763995"} + , + {"photo_id": 498385, "photo_title": "Rainbow Falls in Sun", "photo_url": "http://www.panoramio.com/photo/498385", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/498385.jpg", "longitude": -119.084823, "latitude": 37.601771, "width": 407, "height": 500, "upload_date": "20 January 2007", "owner_id": 107613, "owner_name": "Tom Grubbe", "owner_url": "http://www.panoramio.com/user/107613"} + , + {"photo_id": 571110, "photo_title": "Nordlys - Aurora Borealis - over Vadsø", "photo_url": "http://www.panoramio.com/photo/571110", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/571110.jpg", "longitude": 29.815350, "latitude": 70.075649, "width": 500, "height": 332, "upload_date": "25 January 2007", "owner_id": 121482, "owner_name": "Jens Gressmyr", "owner_url": "http://www.panoramio.com/user/121482"} + , + {"photo_id": 3904502, "photo_title": "Una notte di fuoco - a night of fire ", "photo_url": "http://www.panoramio.com/photo/3904502", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3904502.jpg", "longitude": 11.337290, "latitude": 46.461257, "width": 500, "height": 360, "upload_date": "13 August 2007", "owner_id": 578163, "owner_name": "Margherita-Italy", "owner_url": "http://www.panoramio.com/user/578163"} + , + {"photo_id": 1835001, "photo_title": "Вулкан Жупановский. Рассвет", "photo_url": "http://www.panoramio.com/photo/1835001", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1835001.jpg", "longitude": 158.595543, "latitude": 53.496828, "width": 500, "height": 341, "upload_date": "19 April 2007", "owner_id": 268724, "owner_name": "Korotnev AV", "owner_url": "http://www.panoramio.com/user/268724"} + , + {"photo_id": 91931, "photo_title": "Plitvice (Croacia)", "photo_url": "http://www.panoramio.com/photo/91931", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/91931.jpg", "longitude": 15.599556, "latitude": 44.851975, "width": 500, "height": 375, "upload_date": "04 December 2006", "owner_id": 11403, "owner_name": "Arnáiz", "owner_url": "http://www.panoramio.com/user/11403"} + , + {"photo_id": 515905, "photo_title": "A figyelő", "photo_url": "http://www.panoramio.com/photo/515905", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/515905.jpg", "longitude": 17.625675, "latitude": 47.565060, "width": 500, "height": 345, "upload_date": "21 January 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 7444056, "photo_title": "Ragyogás II.", "photo_url": "http://www.panoramio.com/photo/7444056", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/7444056.jpg", "longitude": 16.385422, "latitude": 46.850095, "width": 333, "height": 500, "upload_date": "29 January 2008", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 1674082, "photo_title": "STATUA LIBERTA'", "photo_url": "http://www.panoramio.com/photo/1674082", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1674082.jpg", "longitude": -74.042444, "latitude": 40.689229, "width": 500, "height": 375, "upload_date": "07 April 2007", "owner_id": 135078, "owner_name": "Fabio Belli FABIOSO", "owner_url": "http://www.panoramio.com/user/135078"} + , + {"photo_id": 798846, "photo_title": "Panther Rock, Antelope Canyon, AZ", "photo_url": "http://www.panoramio.com/photo/798846", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/798846.jpg", "longitude": -111.391668, "latitude": 36.878728, "width": 376, "height": 500, "upload_date": "12 February 2007", "owner_id": 52440, "owner_name": "Hank Waxman", "owner_url": "http://www.panoramio.com/user/52440"} + , + {"photo_id": 21458, "photo_title": "The way of dreams (Aletschgletsher)", "photo_url": "http://www.panoramio.com/photo/21458", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/21458.jpg", "longitude": 7.976074, "latitude": 46.544694, "width": 500, "height": 375, "upload_date": "29 May 2006", "owner_id": 3404, "owner_name": "Csongor Böröczky", "owner_url": "http://www.panoramio.com/user/3404"} + , + {"photo_id": 691681, "photo_title": "PANORAMIO - Ilha das Cabras - by Wolfgang Wodeck", "photo_url": "http://www.panoramio.com/photo/691681", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/691681.jpg", "longitude": -48.628750, "latitude": -26.989624, "width": 500, "height": 333, "upload_date": "04 February 2007", "owner_id": 103166, "owner_name": "Wolfgang Wodeck", "owner_url": "http://www.panoramio.com/user/103166"} + , + {"photo_id": 564451, "photo_title": "Gewitter über Schutterwald", "photo_url": "http://www.panoramio.com/photo/564451", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/564451.jpg", "longitude": 7.887470, "latitude": 48.453409, "width": 500, "height": 333, "upload_date": "25 January 2007", "owner_id": 121083, "owner_name": "Alexandra Buss", "owner_url": "http://www.panoramio.com/user/121083"} + , + {"photo_id": 1430151, "photo_title": "Burano", "photo_url": "http://www.panoramio.com/photo/1430151", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1430151.jpg", "longitude": 12.416686, "latitude": 45.485966, "width": 500, "height": 365, "upload_date": "21 March 2007", "owner_id": 193913, "owner_name": "Klesitz Piroska", "owner_url": "http://www.panoramio.com/user/193913"} + , + {"photo_id": 3156915, "photo_title": "Brussels - Grand Place", "photo_url": "http://www.panoramio.com/photo/3156915", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3156915.jpg", "longitude": 4.352152, "latitude": 50.846658, "width": 500, "height": 375, "upload_date": "07 July 2007", "owner_id": 138691, "owner_name": "Josep Maria Alegre", "owner_url": "http://www.panoramio.com/user/138691"} + , + {"photo_id": 6126516, "photo_title": "Richmond Deer", "photo_url": "http://www.panoramio.com/photo/6126516", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6126516.jpg", "longitude": -0.279776, "latitude": 51.448565, "width": 500, "height": 294, "upload_date": "25 November 2007", "owner_id": 1130880, "owner_name": "marksimms", "owner_url": "http://www.panoramio.com/user/1130880"} + , + {"photo_id": 679356, "photo_title": "sulphur crested cockatoos", "photo_url": "http://www.panoramio.com/photo/679356", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/679356.jpg", "longitude": 150.363181, "latitude": -33.718234, "width": 500, "height": 500, "upload_date": "04 February 2007", "owner_id": 146092, "owner_name": "sid1662", "owner_url": "http://www.panoramio.com/user/146092"} + , + {"photo_id": 462324, "photo_title": "Yucca", "photo_url": "http://www.panoramio.com/photo/462324", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/462324.jpg", "longitude": -106.259680, "latitude": 32.797448, "width": 500, "height": 500, "upload_date": "17 January 2007", "owner_id": 93560, "owner_name": "Alex Petrov", "owner_url": "http://www.panoramio.com/user/93560"} + , + {"photo_id": 9528831, "photo_title": "maldives", "photo_url": "http://www.panoramio.com/photo/9528831", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/9528831.jpg", "longitude": 73.454686, "latitude": 3.845837, "width": 500, "height": 335, "upload_date": "20 April 2008", "owner_id": 647076, "owner_name": "garethohara", "owner_url": "http://www.panoramio.com/user/647076"} + , + {"photo_id": 11825351, "photo_title": " ARC Buque Escuela Gloria. ARC School Ship Gloria. by (((Jose Daniel))) ", "photo_url": "http://www.panoramio.com/photo/11825351", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/11825351.jpg", "longitude": -75.539761, "latitude": 10.410917, "width": 500, "height": 392, "upload_date": "05 July 2008", "owner_id": 1611883, "owner_name": "(((Jose Daniel)))", "owner_url": "http://www.panoramio.com/user/1611883"} + , + {"photo_id": 459614, "photo_title": "seaside line", "photo_url": "http://www.panoramio.com/photo/459614", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/459614.jpg", "longitude": 138.801785, "latitude": 37.756669, "width": 500, "height": 383, "upload_date": "16 January 2007", "owner_id": 86411, "owner_name": "中村脩-Osamu nakamura", "owner_url": "http://www.panoramio.com/user/86411"} + , + {"photo_id": 771974, "photo_title": "Retired Boat", "photo_url": "http://www.panoramio.com/photo/771974", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/771974.jpg", "longitude": 25.427610, "latitude": 36.427576, "width": 500, "height": 332, "upload_date": "11 February 2007", "owner_id": 66847, "owner_name": "Lukas Novak", "owner_url": "http://www.panoramio.com/user/66847"} + , + {"photo_id": 1781649, "photo_title": "Fall in Yosemite Valley", "photo_url": "http://www.panoramio.com/photo/1781649", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1781649.jpg", "longitude": -119.609270, "latitude": 37.735290, "width": 500, "height": 400, "upload_date": "15 April 2007", "owner_id": 376395, "owner_name": "JeffSullivan (www.MyPhotoGuides.com)", "owner_url": "http://www.panoramio.com/user/376395"} + , + {"photo_id": 8491500, "photo_title": "Horsetail Falls at Sunset", "photo_url": "http://www.panoramio.com/photo/8491500", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/8491500.jpg", "longitude": -119.623947, "latitude": 37.723512, "width": 333, "height": 500, "upload_date": "12 March 2008", "owner_id": 376395, "owner_name": "JeffSullivan (www.MyPhotoGuides.com)", "owner_url": "http://www.panoramio.com/user/376395"} + , + {"photo_id": 9505599, "photo_title": "#9 Penguins at Boulders Beach, Simon’s Town, Scenery May08", "photo_url": "http://www.panoramio.com/photo/9505599", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/9505599.jpg", "longitude": 18.450642, "latitude": -34.196443, "width": 500, "height": 489, "upload_date": "19 April 2008", "owner_id": 1077251, "owner_name": "picsonthemove", "owner_url": "http://www.panoramio.com/user/1077251"} + , + {"photo_id": 1320563, "photo_title": "Pirates on anchor", "photo_url": "http://www.panoramio.com/photo/1320563", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1320563.jpg", "longitude": 39.311485, "latitude": -5.724799, "width": 316, "height": 500, "upload_date": "14 March 2007", "owner_id": 232099, "owner_name": "mabut", "owner_url": "http://www.panoramio.com/user/232099"} + , + {"photo_id": 2381962, "photo_title": "Uluru,Northern Territory,Australia-Rosina lamberti", "photo_url": "http://www.panoramio.com/photo/2381962", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2381962.jpg", "longitude": 131.054878, "latitude": -25.326959, "width": 500, "height": 274, "upload_date": "25 May 2007", "owner_id": 140796, "owner_name": "rosina lamberti", "owner_url": "http://www.panoramio.com/user/140796"} + , + {"photo_id": 92102, "photo_title": "Briksdalsbreen (Norway)", "photo_url": "http://www.panoramio.com/photo/92102", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/92102.jpg", "longitude": 6.887054, "latitude": 61.664788, "width": 500, "height": 375, "upload_date": "05 December 2006", "owner_id": 11403, "owner_name": "Arnáiz", "owner_url": "http://www.panoramio.com/user/11403"} + , + {"photo_id": 7012377, "photo_title": "Kanyarfények", "photo_url": "http://www.panoramio.com/photo/7012377", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/7012377.jpg", "longitude": 17.517700, "latitude": 47.760445, "width": 500, "height": 334, "upload_date": "09 January 2008", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 422769, "photo_title": "hazaki2", "photo_url": "http://www.panoramio.com/photo/422769", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/422769.jpg", "longitude": 138.862553, "latitude": 37.711410, "width": 500, "height": 333, "upload_date": "14 January 2007", "owner_id": 86411, "owner_name": "中村脩-Osamu nakamura", "owner_url": "http://www.panoramio.com/user/86411"} + , + {"photo_id": 4558763, "photo_title": "Corsica - West Coast", "photo_url": "http://www.panoramio.com/photo/4558763", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4558763.jpg", "longitude": 8.640404, "latitude": 42.255205, "width": 500, "height": 342, "upload_date": "10 September 2007", "owner_id": 49870, "owner_name": "Jean-Michel Raggioli", "owner_url": "http://www.panoramio.com/user/49870"} + , + {"photo_id": 374479, "photo_title": "Corinthos", "photo_url": "http://www.panoramio.com/photo/374479", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/374479.jpg", "longitude": 22.997131, "latitude": 37.925514, "width": 375, "height": 500, "upload_date": "10 January 2007", "owner_id": 74407, "owner_name": "Yeoman", "owner_url": "http://www.panoramio.com/user/74407"} + , + {"photo_id": 2421991, "photo_title": "\"Different\" Arch", "photo_url": "http://www.panoramio.com/photo/2421991", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2421991.jpg", "longitude": -109.499032, "latitude": 38.744118, "width": 500, "height": 333, "upload_date": "27 May 2007", "owner_id": 66847, "owner_name": "Lukas Novak", "owner_url": "http://www.panoramio.com/user/66847"} + , + {"photo_id": 945978, "photo_title": "L'Ebre", "photo_url": "http://www.panoramio.com/photo/945978", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/945978.jpg", "longitude": 0.495501, "latitude": 40.905015, "width": 500, "height": 377, "upload_date": "21 February 2007", "owner_id": 3022, "owner_name": "Arcadi", "owner_url": "http://www.panoramio.com/user/3022"} + , + {"photo_id": 48449, "photo_title": "Montserrat", "photo_url": "http://www.panoramio.com/photo/48449", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/48449.jpg", "longitude": 1.840060, "latitude": 41.593702, "width": 500, "height": 337, "upload_date": "15 September 2006", "owner_id": 5477, "owner_name": "errece", "owner_url": "http://www.panoramio.com/user/5477"} + , + {"photo_id": 572483, "photo_title": "wheatfield in autumn", "photo_url": "http://www.panoramio.com/photo/572483", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/572483.jpg", "longitude": 11.278152, "latitude": 59.644760, "width": 500, "height": 351, "upload_date": "25 January 2007", "owner_id": 39160, "owner_name": "Snemann", "owner_url": "http://www.panoramio.com/user/39160"} + , + {"photo_id": 2060897, "photo_title": "Mid Coolum", "photo_url": "http://www.panoramio.com/photo/2060897", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2060897.jpg", "longitude": 153.097685, "latitude": -26.540052, "width": 500, "height": 336, "upload_date": "04 May 2007", "owner_id": 411736, "owner_name": "Nixpix", "owner_url": "http://www.panoramio.com/user/411736"} + , + {"photo_id": 6327146, "photo_title": "Winterwald beim \"Widi\" - a thin sheet of ice (messi 06)", "photo_url": "http://www.panoramio.com/photo/6327146", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6327146.jpg", "longitude": 7.381070, "latitude": 47.015670, "width": 500, "height": 363, "upload_date": "06 December 2007", "owner_id": 162722, "owner_name": "©polytropos", "owner_url": "http://www.panoramio.com/user/162722"} + , + {"photo_id": 36476, "photo_title": "Bergbach", "photo_url": "http://www.panoramio.com/photo/36476", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/36476.jpg", "longitude": 13.911953, "latitude": 47.634164, "width": 375, "height": 500, "upload_date": "02 August 2006", "owner_id": 5703, "owner_name": "dancer", "owner_url": "http://www.panoramio.com/user/5703"} + , + {"photo_id": 436366, "photo_title": "sunset", "photo_url": "http://www.panoramio.com/photo/436366", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/436366.jpg", "longitude": 138.857231, "latitude": 37.828497, "width": 500, "height": 351, "upload_date": "15 January 2007", "owner_id": 86411, "owner_name": "中村脩-Osamu nakamura", "owner_url": "http://www.panoramio.com/user/86411"} + , + {"photo_id": 701842, "photo_title": "Singapore Skyline @ Night", "photo_url": "http://www.panoramio.com/photo/701842", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/701842.jpg", "longitude": 103.855486, "latitude": 1.288897, "width": 500, "height": 324, "upload_date": "05 February 2007", "owner_id": 20398, "owner_name": "boerx", "owner_url": "http://www.panoramio.com/user/20398"} + , + {"photo_id": 6086623, "photo_title": "Lángoló repce", "photo_url": "http://www.panoramio.com/photo/6086623", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6086623.jpg", "longitude": 17.784977, "latitude": 47.660994, "width": 500, "height": 334, "upload_date": "23 November 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 1595617, "photo_title": "Rosina lamberti,Templestowe,Victoria,Australia", "photo_url": "http://www.panoramio.com/photo/1595617", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1595617.jpg", "longitude": 145.137978, "latitude": -37.774785, "width": 500, "height": 354, "upload_date": "02 April 2007", "owner_id": 140796, "owner_name": "rosina lamberti", "owner_url": "http://www.panoramio.com/user/140796"} + , + {"photo_id": 74727, "photo_title": "ama dablam in background", "photo_url": "http://www.panoramio.com/photo/74727", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/74727.jpg", "longitude": 86.826496, "latitude": 27.904631, "width": 500, "height": 334, "upload_date": "02 November 2006", "owner_id": 9812, "owner_name": "wsm earp", "owner_url": "http://www.panoramio.com/user/9812"} + , + {"photo_id": 36086, "photo_title": "Рим. двор Ватикана", "photo_url": "http://www.panoramio.com/photo/36086", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/36086.jpg", "longitude": 12.454505, "latitude": 41.905695, "width": 500, "height": 444, "upload_date": "31 July 2006", "owner_id": 5641, "owner_name": "sergey duhanin", "owner_url": "http://www.panoramio.com/user/5641"} + , + {"photo_id": 2066940, "photo_title": "Unbelievable ice sculptures", "photo_url": "http://www.panoramio.com/photo/2066940", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2066940.jpg", "longitude": -73.264389, "latitude": -50.009063, "width": 500, "height": 333, "upload_date": "04 May 2007", "owner_id": 3316, "owner_name": "kristine hannon (www.traveltheglobe.be)", "owner_url": "http://www.panoramio.com/user/3316"} + , + {"photo_id": 1759754, "photo_title": "On the way for the heat wave", "photo_url": "http://www.panoramio.com/photo/1759754", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1759754.jpg", "longitude": -12.734528, "latitude": 20.208079, "width": 500, "height": 331, "upload_date": "13 April 2007", "owner_id": 121377, "owner_name": "Philippe Buffard", "owner_url": "http://www.panoramio.com/user/121377"} + , + {"photo_id": 5717808, "photo_title": "Moonlight @ Eglisau", "photo_url": "http://www.panoramio.com/photo/5717808", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5717808.jpg", "longitude": 8.521459, "latitude": 47.575035, "width": 500, "height": 331, "upload_date": "05 November 2007", "owner_id": 436351, "owner_name": "Sunpixx", "owner_url": "http://www.panoramio.com/user/436351"} + , + {"photo_id": 44853, "photo_title": "Airfocus20050501DSC_3416l", "photo_url": "http://www.panoramio.com/photo/44853", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/44853.jpg", "longitude": 7.663361, "latitude": 50.287009, "width": 500, "height": 332, "upload_date": "02 September 2006", "owner_id": 6703, "owner_name": "Peter Jansen", "owner_url": "http://www.panoramio.com/user/6703"} + , + {"photo_id": 57403, "photo_title": "Burano 2", "photo_url": "http://www.panoramio.com/photo/57403", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/57403.jpg", "longitude": 12.420173, "latitude": 45.485365, "width": 500, "height": 331, "upload_date": "04 October 2006", "owner_id": 8060, "owner_name": "Norbert MAIER", "owner_url": "http://www.panoramio.com/user/8060"} + , + {"photo_id": 13130, "photo_title": "Agde - Painted wall", "photo_url": "http://www.panoramio.com/photo/13130", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/13130.jpg", "longitude": 3.471251, "latitude": 43.312314, "width": 500, "height": 375, "upload_date": "25 February 2006", "owner_id": 1981, "owner_name": "Eric Medvet", "owner_url": "http://www.panoramio.com/user/1981"} + , + {"photo_id": 7375236, "photo_title": "le Loir en crue à Briollay, janvier 2008. #276", "photo_url": "http://www.panoramio.com/photo/7375236", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/7375236.jpg", "longitude": -0.500618, "latitude": 47.557827, "width": 500, "height": 338, "upload_date": "26 January 2008", "owner_id": 666755, "owner_name": "Armagnac", "owner_url": "http://www.panoramio.com/user/666755"} + , + {"photo_id": 3851701, "photo_title": "Mailbox", "photo_url": "http://www.panoramio.com/photo/3851701", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3851701.jpg", "longitude": -73.475790, "latitude": 44.528271, "width": 500, "height": 333, "upload_date": "10 August 2007", "owner_id": 17488, "owner_name": "John Gillett", "owner_url": "http://www.panoramio.com/user/17488"} + , + {"photo_id": 1235904, "photo_title": "Ripples", "photo_url": "http://www.panoramio.com/photo/1235904", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1235904.jpg", "longitude": -131.616211, "latitude": 52.834299, "width": 330, "height": 500, "upload_date": "09 March 2007", "owner_id": 232099, "owner_name": "mabut", "owner_url": "http://www.panoramio.com/user/232099"} + , + {"photo_id": 50646, "photo_title": "Ice Cave", "photo_url": "http://www.panoramio.com/photo/50646", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/50646.jpg", "longitude": -118.052559, "latitude": 52.678620, "width": 500, "height": 375, "upload_date": "21 September 2006", "owner_id": 7190, "owner_name": "Perry Tang", "owner_url": "http://www.panoramio.com/user/7190"} + , + {"photo_id": 617458, "photo_title": "Pescador", "photo_url": "http://www.panoramio.com/photo/617458", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/617458.jpg", "longitude": 0.492368, "latitude": 40.904091, "width": 500, "height": 334, "upload_date": "29 January 2007", "owner_id": 3022, "owner_name": "Arcadi", "owner_url": "http://www.panoramio.com/user/3022"} + , + {"photo_id": 52724, "photo_title": "Sunrise Gythio", "photo_url": "http://www.panoramio.com/photo/52724", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/52724.jpg", "longitude": 22.574501, "latitude": 36.755665, "width": 500, "height": 333, "upload_date": "26 September 2006", "owner_id": 7464, "owner_name": "Pieter", "owner_url": "http://www.panoramio.com/user/7464"} + , + {"photo_id": 289855, "photo_title": "Coronation Island Colours", "photo_url": "http://www.panoramio.com/photo/289855", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/289855.jpg", "longitude": -45.703125, "latitude": -60.705448, "width": 500, "height": 335, "upload_date": "03 January 2007", "owner_id": 61890, "owner_name": "enriquevidalphoto.com", "owner_url": "http://www.panoramio.com/user/61890"} + , + {"photo_id": 5649263, "photo_title": "Naab im Herbst", "photo_url": "http://www.panoramio.com/photo/5649263", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5649263.jpg", "longitude": 12.070885, "latitude": 49.298711, "width": 500, "height": 329, "upload_date": "31 October 2007", "owner_id": 696605, "owner_name": "© alfredschaffer", "owner_url": "http://www.panoramio.com/user/696605"} + , + {"photo_id": 110750, "photo_title": "The Peter and Paul Fortress. Panoramic view (180°) from The Palace Quay. — Большая (180°) панорама Петропавловской крепости с Дворцовой набережной.", "photo_url": "http://www.panoramio.com/photo/110750", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/110750.jpg", "longitude": 30.317802, "latitude": 59.946930, "width": 500, "height": 31, "upload_date": "11 December 2006", "owner_id": 12103, "owner_name": "Roman Sobolenko", "owner_url": "http://www.panoramio.com/user/12103"} + , + {"photo_id": 1870028, "photo_title": "Tour Moretti", "photo_url": "http://www.panoramio.com/photo/1870028", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1870028.jpg", "longitude": 2.247775, "latitude": 48.889175, "width": 500, "height": 395, "upload_date": "21 April 2007", "owner_id": 372189, "owner_name": "Phil©", "owner_url": "http://www.panoramio.com/user/372189"} + , + {"photo_id": 52752, "photo_title": "Sun and Clouds in Naphlion", "photo_url": "http://www.panoramio.com/photo/52752", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/52752.jpg", "longitude": 22.792425, "latitude": 37.562405, "width": 333, "height": 500, "upload_date": "26 September 2006", "owner_id": 7464, "owner_name": "Pieter", "owner_url": "http://www.panoramio.com/user/7464"} + , + {"photo_id": 2256672, "photo_title": "En algún punto", "photo_url": "http://www.panoramio.com/photo/2256672", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2256672.jpg", "longitude": -2.579153, "latitude": 42.493436, "width": 500, "height": 331, "upload_date": "17 May 2007", "owner_id": 129297, "owner_name": "Enrique Ortiz de Zárate", "owner_url": "http://www.panoramio.com/user/129297"} + , + {"photo_id": 519209, "photo_title": "Armageddon", "photo_url": "http://www.panoramio.com/photo/519209", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/519209.jpg", "longitude": 17.627563, "latitude": 47.664809, "width": 500, "height": 334, "upload_date": "21 January 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 10175554, "photo_title": "Vessel to eternity", "photo_url": "http://www.panoramio.com/photo/10175554", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/10175554.jpg", "longitude": 119.670467, "latitude": 11.089976, "width": 500, "height": 363, "upload_date": "13 May 2008", "owner_id": 232099, "owner_name": "mabut", "owner_url": "http://www.panoramio.com/user/232099"} + , + {"photo_id": 11138384, "photo_title": "Lac des Joncs, reflets", "photo_url": "http://www.panoramio.com/photo/11138384", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/11138384.jpg", "longitude": 6.946986, "latitude": 46.513176, "width": 500, "height": 375, "upload_date": "12 June 2008", "owner_id": 1430484, "owner_name": "tiopepe8", "owner_url": "http://www.panoramio.com/user/1430484"} + , + {"photo_id": 204255, "photo_title": "Old farm by Osafjorden", "photo_url": "http://www.panoramio.com/photo/204255", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/204255.jpg", "longitude": 6.998978, "latitude": 60.564197, "width": 500, "height": 368, "upload_date": "21 December 2006", "owner_id": 39160, "owner_name": "Snemann", "owner_url": "http://www.panoramio.com/user/39160"} + , + {"photo_id": 3871571, "photo_title": "St. Bartholomä am Königssee", "photo_url": "http://www.panoramio.com/photo/3871571", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3871571.jpg", "longitude": 12.973351, "latitude": 47.545220, "width": 500, "height": 375, "upload_date": "11 August 2007", "owner_id": 424589, "owner_name": "PeSchn", "owner_url": "http://www.panoramio.com/user/424589"} + , + {"photo_id": 5358166, "photo_title": "Mooney Falls", "photo_url": "http://www.panoramio.com/photo/5358166", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5358166.jpg", "longitude": -112.709148, "latitude": 36.262849, "width": 500, "height": 335, "upload_date": "16 October 2007", "owner_id": 66847, "owner_name": "Lukas Novak", "owner_url": "http://www.panoramio.com/user/66847"} + , + {"photo_id": 600797, "photo_title": "Living (?) in Hong Kong", "photo_url": "http://www.panoramio.com/photo/600797", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/600797.jpg", "longitude": 113.935831, "latitude": 22.279794, "width": 500, "height": 334, "upload_date": "28 January 2007", "owner_id": 20398, "owner_name": "boerx", "owner_url": "http://www.panoramio.com/user/20398"} + , + {"photo_id": 6459385, "photo_title": "Alternativ Future", "photo_url": "http://www.panoramio.com/photo/6459385", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6459385.jpg", "longitude": 17.598467, "latitude": 47.645846, "width": 500, "height": 325, "upload_date": "13 December 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 522010, "photo_title": "Hyperion", "photo_url": "http://www.panoramio.com/photo/522010", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/522010.jpg", "longitude": 17.562933, "latitude": 47.632545, "width": 500, "height": 353, "upload_date": "21 January 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 4942642, "photo_title": "Förgeteg elött", "photo_url": "http://www.panoramio.com/photo/4942642", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4942642.jpg", "longitude": 17.807121, "latitude": 47.646887, "width": 500, "height": 334, "upload_date": "27 September 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 223798, "photo_title": "Kachemak Bay Moonrise", "photo_url": "http://www.panoramio.com/photo/223798", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/223798.jpg", "longitude": -151.426835, "latitude": 59.680146, "width": 500, "height": 333, "upload_date": "24 December 2006", "owner_id": 45308, "owner_name": "Mike Cavaroc", "owner_url": "http://www.panoramio.com/user/45308"} + , + {"photo_id": 1946961, "photo_title": "Három \"Grácia\"", "photo_url": "http://www.panoramio.com/photo/1946961", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1946961.jpg", "longitude": 18.273354, "latitude": 47.577684, "width": 500, "height": 290, "upload_date": "27 April 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 821342, "photo_title": "Northern Lights seen from Alta", "photo_url": "http://www.panoramio.com/photo/821342", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/821342.jpg", "longitude": 23.234882, "latitude": 69.962969, "width": 500, "height": 346, "upload_date": "14 February 2007", "owner_id": 56091, "owner_name": "Kjetil Vaage Øie", "owner_url": "http://www.panoramio.com/user/56091"} + , + {"photo_id": 9831100, "photo_title": "Repcepásztor", "photo_url": "http://www.panoramio.com/photo/9831100", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/9831100.jpg", "longitude": 18.213100, "latitude": 47.567956, "width": 500, "height": 334, "upload_date": "01 May 2008", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 8294907, "photo_title": "Winds of Change", "photo_url": "http://www.panoramio.com/photo/8294907", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/8294907.jpg", "longitude": -112.007847, "latitude": 36.993299, "width": 333, "height": 500, "upload_date": "04 March 2008", "owner_id": 107292, "owner_name": "Kevin Mikkelsen", "owner_url": "http://www.panoramio.com/user/107292"} + , + {"photo_id": 7388668, "photo_title": "jak dobrze wstać ...", "photo_url": "http://www.panoramio.com/photo/7388668", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/7388668.jpg", "longitude": 15.746498, "latitude": 51.848929, "width": 500, "height": 353, "upload_date": "27 January 2008", "owner_id": 889535, "owner_name": "yossarian01", "owner_url": "http://www.panoramio.com/user/889535"} + , + {"photo_id": 617471, "photo_title": "Rio", "photo_url": "http://www.panoramio.com/photo/617471", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/617471.jpg", "longitude": 0.493505, "latitude": 40.904318, "width": 500, "height": 335, "upload_date": "29 January 2007", "owner_id": 3022, "owner_name": "Arcadi", "owner_url": "http://www.panoramio.com/user/3022"} + , + {"photo_id": 259612, "photo_title": "Miss Liberty, NY/NJ Harbor", "photo_url": "http://www.panoramio.com/photo/259612", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/259612.jpg", "longitude": -74.039698, "latitude": 40.687472, "width": 357, "height": 500, "upload_date": "29 December 2006", "owner_id": 52440, "owner_name": "Hank Waxman", "owner_url": "http://www.panoramio.com/user/52440"} + , + {"photo_id": 2282545, "photo_title": "San Remo Scorcio di San Siro", "photo_url": "http://www.panoramio.com/photo/2282545", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2282545.jpg", "longitude": 7.773911, "latitude": 43.818234, "width": 500, "height": 459, "upload_date": "18 May 2007", "owner_id": 60898, "owner_name": "esseil", "owner_url": "http://www.panoramio.com/user/60898"} + , + {"photo_id": 84795, "photo_title": "0032", "photo_url": "http://www.panoramio.com/photo/84795", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/84795.jpg", "longitude": 25.830574, "latitude": -20.889688, "width": 500, "height": 334, "upload_date": "22 November 2006", "owner_id": 10637, "owner_name": "Carles Campsolinas Dresaire", "owner_url": "http://www.panoramio.com/user/10637"} + , + {"photo_id": 6205, "photo_title": "Valencia III", "photo_url": "http://www.panoramio.com/photo/6205", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6205.jpg", "longitude": -0.352764, "latitude": 39.456143, "width": 500, "height": 375, "upload_date": "28 December 2005", "owner_id": 414, "owner_name": "Sonia Villegas", "owner_url": "http://www.panoramio.com/user/414"} + , + {"photo_id": 5255997, "photo_title": "Az alkonyvigyázó", "photo_url": "http://www.panoramio.com/photo/5255997", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5255997.jpg", "longitude": 17.417107, "latitude": 46.942762, "width": 500, "height": 334, "upload_date": "12 October 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 4214336, "photo_title": "船家 ship On Li river", "photo_url": "http://www.panoramio.com/photo/4214336", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4214336.jpg", "longitude": 110.342388, "latitude": 25.215347, "width": 500, "height": 313, "upload_date": "26 August 2007", "owner_id": 161470, "owner_name": "John Su", "owner_url": "http://www.panoramio.com/user/161470"} + , + {"photo_id": 611660, "photo_title": "Tikehau Ile aux oiseaux JC", "photo_url": "http://www.panoramio.com/photo/611660", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/611660.jpg", "longitude": -148.098224, "latitude": -14.974528, "width": 375, "height": 500, "upload_date": "29 January 2007", "owner_id": 131113, "owner_name": "Lair Jean Claude", "owner_url": "http://www.panoramio.com/user/131113"} + , + {"photo_id": 9822041, "photo_title": "Singapore", "photo_url": "http://www.panoramio.com/photo/9822041", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/9822041.jpg", "longitude": 103.855219, "latitude": 1.288907, "width": 500, "height": 333, "upload_date": "01 May 2008", "owner_id": 1465912, "owner_name": "funtor", "owner_url": "http://www.panoramio.com/user/1465912"} + , + {"photo_id": 126820, "photo_title": "Taj Mahal - colores", "photo_url": "http://www.panoramio.com/photo/126820", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/126820.jpg", "longitude": 78.042165, "latitude": 27.172871, "width": 500, "height": 385, "upload_date": "12 December 2006", "owner_id": 10456, "owner_name": "eulogio", "owner_url": "http://www.panoramio.com/user/10456"} + , + {"photo_id": 112504, "photo_title": "V-01009", "photo_url": "http://www.panoramio.com/photo/112504", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/112504.jpg", "longitude": 12.335946, "latitude": 45.438213, "width": 500, "height": 500, "upload_date": "11 December 2006", "owner_id": 17599, "owner_name": "Dmitry Andreev", "owner_url": "http://www.panoramio.com/user/17599"} + , + {"photo_id": 1898139, "photo_title": "Ein sehr menschenähnlicher Baum (http://www.redbubble.com/products/configure/1935618)", "photo_url": "http://www.panoramio.com/photo/1898139", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1898139.jpg", "longitude": 13.158177, "latitude": 52.456836, "width": 375, "height": 500, "upload_date": "23 April 2007", "owner_id": 311327, "owner_name": "www.einkauf.tk", "owner_url": "http://www.panoramio.com/user/311327"} + , + {"photo_id": 57813, "photo_title": "Hallstatt 1", "photo_url": "http://www.panoramio.com/photo/57813", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/57813.jpg", "longitude": 13.652229, "latitude": 47.551274, "width": 500, "height": 333, "upload_date": "05 October 2006", "owner_id": 8060, "owner_name": "Norbert MAIER", "owner_url": "http://www.panoramio.com/user/8060"} + , + {"photo_id": 533476, "photo_title": "Comet McNaught 220107 02", "photo_url": "http://www.panoramio.com/photo/533476", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/533476.jpg", "longitude": 18.371286, "latitude": -33.964363, "width": 328, "height": 500, "upload_date": "22 January 2007", "owner_id": 2748, "owner_name": "WirelessMonkey", "owner_url": "http://www.panoramio.com/user/2748"} + , + {"photo_id": 507370, "photo_title": "The Silence", "photo_url": "http://www.panoramio.com/photo/507370", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/507370.jpg", "longitude": 17.497959, "latitude": 47.781328, "width": 465, "height": 500, "upload_date": "20 January 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 2422269, "photo_title": "Grand Trees", "photo_url": "http://www.panoramio.com/photo/2422269", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2422269.jpg", "longitude": -112.124019, "latitude": 36.062942, "width": 500, "height": 333, "upload_date": "27 May 2007", "owner_id": 66847, "owner_name": "Lukas Novak", "owner_url": "http://www.panoramio.com/user/66847"} + , + {"photo_id": 2808348, "photo_title": "Blind River reflection", "photo_url": "http://www.panoramio.com/photo/2808348", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2808348.jpg", "longitude": -82.973557, "latitude": 46.193141, "width": 500, "height": 305, "upload_date": "18 June 2007", "owner_id": 555551, "owner_name": "Marilyn Whiteley", "owner_url": "http://www.panoramio.com/user/555551"} + , + {"photo_id": 2534183, "photo_title": "", "photo_url": "http://www.panoramio.com/photo/2534183", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2534183.jpg", "longitude": -69.934587, "latitude": -37.382844, "width": 500, "height": 335, "upload_date": "02 June 2007", "owner_id": 527160, "owner_name": "legui83", "owner_url": "http://www.panoramio.com/user/527160"} + , + {"photo_id": 1008446, "photo_title": "budamist", "photo_url": "http://www.panoramio.com/photo/1008446", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1008446.jpg", "longitude": 19.078649, "latitude": 47.516737, "width": 500, "height": 341, "upload_date": "24 February 2007", "owner_id": 2659, "owner_name": "ozalph", "owner_url": "http://www.panoramio.com/user/2659"} + , + {"photo_id": 2935385, "photo_title": "temporale sul mare di riccione", "photo_url": "http://www.panoramio.com/photo/2935385", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2935385.jpg", "longitude": 12.644491, "latitude": 43.964836, "width": 333, "height": 500, "upload_date": "25 June 2007", "owner_id": 267377, "owner_name": "Valter Galvani", "owner_url": "http://www.panoramio.com/user/267377"} + , + {"photo_id": 7586398, "photo_title": "Al vuelo", "photo_url": "http://www.panoramio.com/photo/7586398", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/7586398.jpg", "longitude": -73.152337, "latitude": -37.114747, "width": 375, "height": 500, "upload_date": "04 February 2008", "owner_id": 327310, "owner_name": "Erwin Woenckhaus", "owner_url": "http://www.panoramio.com/user/327310"} + , + {"photo_id": 7624042, "photo_title": "Fairyland 11", "photo_url": "http://www.panoramio.com/photo/7624042", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/7624042.jpg", "longitude": 6.067650, "latitude": 52.224684, "width": 352, "height": 500, "upload_date": "06 February 2008", "owner_id": 523564, "owner_name": "Luud Riphagen", "owner_url": "http://www.panoramio.com/user/523564"} + , + {"photo_id": 1186930, "photo_title": "Вид с горы Демерджи - Demergi mountain view", "photo_url": "http://www.panoramio.com/photo/1186930", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1186930.jpg", "longitude": 34.413729, "latitude": 44.749903, "width": 500, "height": 338, "upload_date": "05 March 2007", "owner_id": 244932, "owner_name": "Andrey Jitkov", "owner_url": "http://www.panoramio.com/user/244932"} + , + {"photo_id": 565512, "photo_title": "The staircase star", "photo_url": "http://www.panoramio.com/photo/565512", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/565512.jpg", "longitude": 5.646222, "latitude": 46.261262, "width": 500, "height": 331, "upload_date": "25 January 2007", "owner_id": 121377, "owner_name": "Philippe Buffard", "owner_url": "http://www.panoramio.com/user/121377"} + , + {"photo_id": 3566705, "photo_title": "Pattaya - Big Buddha and seven headed Naga", "photo_url": "http://www.panoramio.com/photo/3566705", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3566705.jpg", "longitude": 100.868155, "latitude": 12.915027, "width": 500, "height": 375, "upload_date": "28 July 2007", "owner_id": 716245, "owner_name": "—Dragon-64— ✈", "owner_url": "http://www.panoramio.com/user/716245"} + , + {"photo_id": 50113, "photo_title": "New York Skyline Panorama", "photo_url": "http://www.panoramio.com/photo/50113", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/50113.jpg", "longitude": -73.997775, "latitude": 40.696581, "width": 500, "height": 55, "upload_date": "20 September 2006", "owner_id": 4957, "owner_name": "Ken Gibson", "owner_url": "http://www.panoramio.com/user/4957"} + , + {"photo_id": 74726, "photo_title": "nuptse 1 sunset", "photo_url": "http://www.panoramio.com/photo/74726", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/74726.jpg", "longitude": 86.865978, "latitude": 27.979243, "width": 500, "height": 334, "upload_date": "02 November 2006", "owner_id": 9812, "owner_name": "wsm earp", "owner_url": "http://www.panoramio.com/user/9812"} + , + {"photo_id": 10552400, "photo_title": "Second Prize \"Travel\" May Contest, HDR, May 2008", "photo_url": "http://www.panoramio.com/photo/10552400", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/10552400.jpg", "longitude": -3.705075, "latitude": 47.787960, "width": 500, "height": 333, "upload_date": "24 May 2008", "owner_id": 979901, "owner_name": "DiggaTwigga", "owner_url": "http://www.panoramio.com/user/979901"} + , + {"photo_id": 1605229, "photo_title": "Holdfényáhítat", "photo_url": "http://www.panoramio.com/photo/1605229", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1605229.jpg", "longitude": 17.748413, "latitude": 47.555214, "width": 400, "height": 500, "upload_date": "02 April 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 34669, "photo_title": "Paisaje otoñal - La Rioja - España", "photo_url": "http://www.panoramio.com/photo/34669", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/34669.jpg", "longitude": -2.864685, "latitude": 42.328664, "width": 500, "height": 326, "upload_date": "26 July 2006", "owner_id": 5487, "owner_name": "Joaquín Ramirez", "owner_url": "http://www.panoramio.com/user/5487"} + , + {"photo_id": 4596134, "photo_title": "Le vieux Nice, mars 2007", "photo_url": "http://www.panoramio.com/photo/4596134", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4596134.jpg", "longitude": 7.277198, "latitude": 43.696704, "width": 368, "height": 500, "upload_date": "12 September 2007", "owner_id": 629243, "owner_name": "Olivier Faugeras", "owner_url": "http://www.panoramio.com/user/629243"} + , + {"photo_id": 10576294, "photo_title": "Plaza de Bolívar, Bogotá. 1st. prize Panoramio Contest, May 08.(((Jose Daniel)))", "photo_url": "http://www.panoramio.com/photo/10576294", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/10576294.jpg", "longitude": -74.075629, "latitude": 4.597867, "width": 500, "height": 338, "upload_date": "25 May 2008", "owner_id": 1611883, "owner_name": "(((Jose Daniel)))", "owner_url": "http://www.panoramio.com/user/1611883"} + , + {"photo_id": 522151, "photo_title": "Jó volt ott", "photo_url": "http://www.panoramio.com/photo/522151", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/522151.jpg", "longitude": 17.611084, "latitude": 47.602401, "width": 500, "height": 354, "upload_date": "21 January 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 4247476, "photo_title": "Blick vom Zuckerhut", "photo_url": "http://www.panoramio.com/photo/4247476", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4247476.jpg", "longitude": -43.156872, "latitude": -22.948909, "width": 500, "height": 375, "upload_date": "28 August 2007", "owner_id": 496676, "owner_name": "Quasebart", "owner_url": "http://www.panoramio.com/user/496676"} + , + {"photo_id": 5472461, "photo_title": "Lapland", "photo_url": "http://www.panoramio.com/photo/5472461", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5472461.jpg", "longitude": 29.187653, "latitude": 66.189241, "width": 500, "height": 327, "upload_date": "22 October 2007", "owner_id": 912031, "owner_name": "Kimmo Lyytikäinen", "owner_url": "http://www.panoramio.com/user/912031"} + , + {"photo_id": 472802, "photo_title": "Golden Gate Bridge", "photo_url": "http://www.panoramio.com/photo/472802", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/472802.jpg", "longitude": -122.481366, "latitude": 37.827644, "width": 500, "height": 305, "upload_date": "18 January 2007", "owner_id": 100907, "owner_name": "Julia Wahl", "owner_url": "http://www.panoramio.com/user/100907"} + , + {"photo_id": 506118, "photo_title": "Overcast Pier, Hearst State Beach", "photo_url": "http://www.panoramio.com/photo/506118", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/506118.jpg", "longitude": -121.187868, "latitude": 35.643016, "width": 500, "height": 343, "upload_date": "20 January 2007", "owner_id": 107613, "owner_name": "Tom Grubbe", "owner_url": "http://www.panoramio.com/user/107613"} + , + {"photo_id": 1420841, "photo_title": "Poland ", "photo_url": "http://www.panoramio.com/photo/1420841", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1420841.jpg", "longitude": 20.630060, "latitude": 52.073123, "width": 500, "height": 377, "upload_date": "20 March 2007", "owner_id": 234038, "owner_name": "Jacek M.", "owner_url": "http://www.panoramio.com/user/234038"} + , + {"photo_id": 4088401, "photo_title": "Bird at Hogsback - 198812", "photo_url": "http://www.panoramio.com/photo/4088401", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4088401.jpg", "longitude": -124.339828, "latitude": 47.440860, "width": 500, "height": 355, "upload_date": "21 August 2007", "owner_id": 765658, "owner_name": "Larry Workman QIN", "owner_url": "http://www.panoramio.com/user/765658"} + , + {"photo_id": 8049018, "photo_title": "Eastern Sierra Sunset", "photo_url": "http://www.panoramio.com/photo/8049018", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/8049018.jpg", "longitude": -119.220543, "latitude": 38.031698, "width": 500, "height": 333, "upload_date": "23 February 2008", "owner_id": 376395, "owner_name": "JeffSullivan (www.MyPhotoGuides.com)", "owner_url": "http://www.panoramio.com/user/376395"} + , + {"photo_id": 103324, "photo_title": "Lua em São Paulo", "photo_url": "http://www.panoramio.com/photo/103324", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/103324.jpg", "longitude": -46.652606, "latitude": -23.545394, "width": 500, "height": 333, "upload_date": "10 December 2006", "owner_id": 14733, "owner_name": "Luiz Henrique Assunção", "owner_url": "http://www.panoramio.com/user/14733"} + , + {"photo_id": 5694626, "photo_title": "Lake of Varese - Moon and Venus before dawn", "photo_url": "http://www.panoramio.com/photo/5694626", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5694626.jpg", "longitude": 8.717716, "latitude": 45.839025, "width": 339, "height": 500, "upload_date": "02 November 2007", "owner_id": 933456, "owner_name": "© Marco De Candido", "owner_url": "http://www.panoramio.com/user/933456"} + , + {"photo_id": 1235876, "photo_title": "Logs on Lake Moraine", "photo_url": "http://www.panoramio.com/photo/1235876", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1235876.jpg", "longitude": -116.180420, "latitude": 51.326321, "width": 330, "height": 500, "upload_date": "09 March 2007", "owner_id": 232099, "owner_name": "mabut", "owner_url": "http://www.panoramio.com/user/232099"} + , + {"photo_id": 6999770, "photo_title": "Mountain range of Pindos", "photo_url": "http://www.panoramio.com/photo/6999770", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6999770.jpg", "longitude": 21.553481, "latitude": 39.498345, "width": 500, "height": 333, "upload_date": "09 January 2008", "owner_id": 242446, "owner_name": "Ntinos Lagos", "owner_url": "http://www.panoramio.com/user/242446"} + , + {"photo_id": 405727, "photo_title": "awagatake", "photo_url": "http://www.panoramio.com/photo/405727", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/405727.jpg", "longitude": 139.042454, "latitude": 37.563222, "width": 500, "height": 380, "upload_date": "13 January 2007", "owner_id": 86411, "owner_name": "中村脩-Osamu nakamura", "owner_url": "http://www.panoramio.com/user/86411"} + , + {"photo_id": 1488363, "photo_title": "", "photo_url": "http://www.panoramio.com/photo/1488363", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1488363.jpg", "longitude": 138.454514, "latitude": 38.308932, "width": 500, "height": 384, "upload_date": "25 March 2007", "owner_id": 86411, "owner_name": "中村脩-Osamu nakamura", "owner_url": "http://www.panoramio.com/user/86411"} + , + {"photo_id": 841001, "photo_title": "Central Balkan", "photo_url": "http://www.panoramio.com/photo/841001", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/841001.jpg", "longitude": 24.963917, "latitude": 42.679306, "width": 500, "height": 357, "upload_date": "16 February 2007", "owner_id": 16880, "owner_name": "evgenidinev.com", "owner_url": "http://www.panoramio.com/user/16880"} + , + {"photo_id": 57406, "photo_title": "Burano 4", "photo_url": "http://www.panoramio.com/photo/57406", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/57406.jpg", "longitude": 12.419465, "latitude": 45.484567, "width": 500, "height": 333, "upload_date": "04 October 2006", "owner_id": 8060, "owner_name": "Norbert MAIER", "owner_url": "http://www.panoramio.com/user/8060"} + , + {"photo_id": 1900891, "photo_title": "Peggys Cove, Nova Scotia La barca ...", "photo_url": "http://www.panoramio.com/photo/1900891", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1900891.jpg", "longitude": -63.918285, "latitude": 44.490873, "width": 375, "height": 500, "upload_date": "24 April 2007", "owner_id": 401966, "owner_name": "Syl de Canada", "owner_url": "http://www.panoramio.com/user/401966"} + , + {"photo_id": 2135721, "photo_title": " Coteau Landing (près de Valleyfield 3)", "photo_url": "http://www.panoramio.com/photo/2135721", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2135721.jpg", "longitude": -74.211960, "latitude": 45.253622, "width": 500, "height": 375, "upload_date": "08 May 2007", "owner_id": 401966, "owner_name": "Syl de Canada", "owner_url": "http://www.panoramio.com/user/401966"} + , + {"photo_id": 426155, "photo_title": "2007'01'14-Aucanada-0233", "photo_url": "http://www.panoramio.com/photo/426155", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/426155.jpg", "longitude": 3.169695, "latitude": 39.837627, "width": 500, "height": 335, "upload_date": "14 January 2007", "owner_id": 61890, "owner_name": "enriquevidalphoto.com", "owner_url": "http://www.panoramio.com/user/61890"} + , + {"photo_id": 4868548, "photo_title": "Goodbye my dear", "photo_url": "http://www.panoramio.com/photo/4868548", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4868548.jpg", "longitude": 16.693211, "latitude": 43.183025, "width": 500, "height": 500, "upload_date": "24 September 2007", "owner_id": 989, "owner_name": "Mrgud", "owner_url": "http://www.panoramio.com/user/989"} + , + {"photo_id": 47069, "photo_title": "Laguna del Inca", "photo_url": "http://www.panoramio.com/photo/47069", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/47069.jpg", "longitude": -70.130786, "latitude": -32.834759, "width": 500, "height": 333, "upload_date": "11 September 2006", "owner_id": 6961, "owner_name": "Santiago Rios", "owner_url": "http://www.panoramio.com/user/6961"} + , + {"photo_id": 1781731, "photo_title": "The Subway", "photo_url": "http://www.panoramio.com/photo/1781731", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1781731.jpg", "longitude": -113.052578, "latitude": 37.310448, "width": 500, "height": 333, "upload_date": "15 April 2007", "owner_id": 376395, "owner_name": "JeffSullivan (www.MyPhotoGuides.com)", "owner_url": "http://www.panoramio.com/user/376395"} + , + {"photo_id": 2279, "photo_title": "Empire State Building", "photo_url": "http://www.panoramio.com/photo/2279", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2279.jpg", "longitude": -73.987073, "latitude": 40.744924, "width": 378, "height": 500, "upload_date": "08 October 2005", "owner_id": 220, "owner_name": "Jeff T. Alu", "owner_url": "http://www.panoramio.com/user/220"} + , + {"photo_id": 1277992, "photo_title": "Cologne-Köln - Dom im Hintergrund der Hohenzollernbrücke bei Nacht (by night)", "photo_url": "http://www.panoramio.com/photo/1277992", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1277992.jpg", "longitude": 6.967220, "latitude": 50.940826, "width": 500, "height": 375, "upload_date": "11 March 2007", "owner_id": 113678, "owner_name": "Canada-Fan", "owner_url": "http://www.panoramio.com/user/113678"} + , + {"photo_id": 207638, "photo_title": "Sunrise at Mont Saint Michel (1 of 2), august 2001", "photo_url": "http://www.panoramio.com/photo/207638", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/207638.jpg", "longitude": -1.509504, "latitude": 48.633547, "width": 331, "height": 500, "upload_date": "21 December 2006", "owner_id": 18925, "owner_name": "Marco Ferrari", "owner_url": "http://www.panoramio.com/user/18925"} + , + {"photo_id": 1452569, "photo_title": "Desierto de La Tatacoa (zona roja)", "photo_url": "http://www.panoramio.com/photo/1452569", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1452569.jpg", "longitude": -75.166667, "latitude": 3.333333, "width": 500, "height": 333, "upload_date": "22 March 2007", "owner_id": 5487, "owner_name": "Joaquín Ramirez", "owner_url": "http://www.panoramio.com/user/5487"} + , + {"photo_id": 3502890, "photo_title": "Monasteries in Meteora", "photo_url": "http://www.panoramio.com/photo/3502890", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3502890.jpg", "longitude": 21.627445, "latitude": 39.712601, "width": 480, "height": 500, "upload_date": "24 July 2007", "owner_id": 686703, "owner_name": "Thodoris Kliafas", "owner_url": "http://www.panoramio.com/user/686703"} + , + {"photo_id": 595505, "photo_title": "Burlington_Village_Square", "photo_url": "http://www.panoramio.com/photo/595505", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/595505.jpg", "longitude": -79.796180, "latitude": 43.326192, "width": 500, "height": 333, "upload_date": "27 January 2007", "owner_id": 17488, "owner_name": "John Gillett", "owner_url": "http://www.panoramio.com/user/17488"} + , + {"photo_id": 60984, "photo_title": "Ventisquero P. Moreno", "photo_url": "http://www.panoramio.com/photo/60984", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/60984.jpg", "longitude": -73.051872, "latitude": -50.488641, "width": 500, "height": 328, "upload_date": "13 October 2006", "owner_id": 8409, "owner_name": "Hector Fabian Garrido", "owner_url": "http://www.panoramio.com/user/8409"} + , + {"photo_id": 6654030, "photo_title": "Va por un incomprendido Vincent Willem van Gogh", "photo_url": "http://www.panoramio.com/photo/6654030", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6654030.jpg", "longitude": 4.776306, "latitude": 51.477962, "width": 500, "height": 375, "upload_date": "24 December 2007", "owner_id": 804986, "owner_name": "VERJAGA", "owner_url": "http://www.panoramio.com/user/804986"} + , + {"photo_id": 3018575, "photo_title": "Abrasado", "photo_url": "http://www.panoramio.com/photo/3018575", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3018575.jpg", "longitude": -73.279324, "latitude": -39.838002, "width": 500, "height": 375, "upload_date": "29 June 2007", "owner_id": 327310, "owner_name": "Erwin Woenckhaus", "owner_url": "http://www.panoramio.com/user/327310"} + , + {"photo_id": 521039, "photo_title": "Fátyolos narancslátomás", "photo_url": "http://www.panoramio.com/photo/521039", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/521039.jpg", "longitude": 17.463455, "latitude": 47.850146, "width": 500, "height": 291, "upload_date": "21 January 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 208239, "photo_title": "Nuvola danzante, Svizzera 2002", "photo_url": "http://www.panoramio.com/photo/208239", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/208239.jpg", "longitude": 7.321701, "latitude": 46.219515, "width": 334, "height": 500, "upload_date": "22 December 2006", "owner_id": 18925, "owner_name": "Marco Ferrari", "owner_url": "http://www.panoramio.com/user/18925"} + , + {"photo_id": 6443936, "photo_title": "Pajkos vizek", "photo_url": "http://www.panoramio.com/photo/6443936", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6443936.jpg", "longitude": 15.934124, "latitude": 47.915019, "width": 500, "height": 334, "upload_date": "12 December 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 7467941, "photo_title": "A day off for the soul...", "photo_url": "http://www.panoramio.com/photo/7467941", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/7467941.jpg", "longitude": -75.126133, "latitude": 40.970106, "width": 500, "height": 375, "upload_date": "30 January 2008", "owner_id": 89499, "owner_name": "Michael Braxenthaler", "owner_url": "http://www.panoramio.com/user/89499"} + , + {"photo_id": 800436, "photo_title": "Eiffel Tower", "photo_url": "http://www.panoramio.com/photo/800436", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/800436.jpg", "longitude": 2.294576, "latitude": 48.858249, "width": 500, "height": 386, "upload_date": "13 February 2007", "owner_id": 165346, "owner_name": "Alan Knox", "owner_url": "http://www.panoramio.com/user/165346"} + , + {"photo_id": 479673, "photo_title": "Summit of Gogsøyra", "photo_url": "http://www.panoramio.com/photo/479673", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/479673.jpg", "longitude": 8.147736, "latitude": 62.642606, "width": 500, "height": 333, "upload_date": "18 January 2007", "owner_id": 39160, "owner_name": "Snemann", "owner_url": "http://www.panoramio.com/user/39160"} + , + {"photo_id": 5378753, "photo_title": "Alps", "photo_url": "http://www.panoramio.com/photo/5378753", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5378753.jpg", "longitude": 6.847916, "latitude": 45.913840, "width": 500, "height": 500, "upload_date": "17 October 2007", "owner_id": 588149, "owner_name": "Adam Salwanowicz", "owner_url": "http://www.panoramio.com/user/588149"} + , + {"photo_id": 382413, "photo_title": "kilimanjaro sunset", "photo_url": "http://www.panoramio.com/photo/382413", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/382413.jpg", "longitude": 37.382355, "latitude": -3.046583, "width": 500, "height": 375, "upload_date": "11 January 2007", "owner_id": 6105, "owner_name": "hackltom", "owner_url": "http://www.panoramio.com/user/6105"} + , + {"photo_id": 290784, "photo_title": "Tormenta Bahía de Pollensa", "photo_url": "http://www.panoramio.com/photo/290784", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/290784.jpg", "longitude": 3.116437, "latitude": 39.928440, "width": 500, "height": 285, "upload_date": "03 January 2007", "owner_id": 61890, "owner_name": "enriquevidalphoto.com", "owner_url": "http://www.panoramio.com/user/61890"} + , + {"photo_id": 519904, "photo_title": "Dombok között felhők alatt", "photo_url": "http://www.panoramio.com/photo/519904", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/519904.jpg", "longitude": 18.680878, "latitude": 47.631851, "width": 500, "height": 314, "upload_date": "21 January 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 181264, "photo_title": "deer cave", "photo_url": "http://www.panoramio.com/photo/181264", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/181264.jpg", "longitude": 114.824553, "latitude": 4.024121, "width": 428, "height": 500, "upload_date": "18 December 2006", "owner_id": 9198, "owner_name": "Caveranger", "owner_url": "http://www.panoramio.com/user/9198"} + , + {"photo_id": 323533, "photo_title": "Elevador e Mercado Modelo Ssa Ba Br", "photo_url": "http://www.panoramio.com/photo/323533", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/323533.jpg", "longitude": -38.512552, "latitude": -12.974261, "width": 500, "height": 333, "upload_date": "06 January 2007", "owner_id": 63291, "owner_name": "Gastón Dapik", "owner_url": "http://www.panoramio.com/user/63291"} + , + {"photo_id": 512513, "photo_title": "Égi tűz", "photo_url": "http://www.panoramio.com/photo/512513", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/512513.jpg", "longitude": 17.481308, "latitude": 47.796148, "width": 500, "height": 334, "upload_date": "21 January 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 10237287, "photo_title": "Kentriki's Woods, by Kostas Andreopoulos", "photo_url": "http://www.panoramio.com/photo/10237287", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/10237287.jpg", "longitude": 21.916909, "latitude": 38.569223, "width": 500, "height": 375, "upload_date": "14 May 2008", "owner_id": 1690483, "owner_name": "k.andre", "owner_url": "http://www.panoramio.com/user/1690483"} + , + {"photo_id": 52847, "photo_title": "153 The Forth Bridge (Railway) over the Firth of Forth", "photo_url": "http://www.panoramio.com/photo/52847", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/52847.jpg", "longitude": -3.392672, "latitude": 56.007656, "width": 375, "height": 500, "upload_date": "26 September 2006", "owner_id": 7633, "owner_name": "Daniel Meyer", "owner_url": "http://www.panoramio.com/user/7633"} + , + {"photo_id": 11105192, "photo_title": "A bird is free", "photo_url": "http://www.panoramio.com/photo/11105192", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/11105192.jpg", "longitude": -6.953058, "latitude": 52.773901, "width": 375, "height": 500, "upload_date": "11 June 2008", "owner_id": 1867220, "owner_name": "Aubrey :)", "owner_url": "http://www.panoramio.com/user/1867220"} + , + {"photo_id": 196039, "photo_title": "espigón", "photo_url": "http://www.panoramio.com/photo/196039", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/196039.jpg", "longitude": -3.801688, "latitude": 43.461606, "width": 332, "height": 500, "upload_date": "20 December 2006", "owner_id": 38804, "owner_name": "www.oscarsanchez.net", "owner_url": "http://www.panoramio.com/user/38804"} + , + {"photo_id": 70865, "photo_title": "Cataratas de Iguazu", "photo_url": "http://www.panoramio.com/photo/70865", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/70865.jpg", "longitude": -54.440818, "latitude": -25.688447, "width": 374, "height": 500, "upload_date": "26 October 2006", "owner_id": 9080, "owner_name": "Marco Teodonio", "owner_url": "http://www.panoramio.com/user/9080"} + , + {"photo_id": 6188760, "photo_title": "Vihar elött", "photo_url": "http://www.panoramio.com/photo/6188760", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6188760.jpg", "longitude": 17.462082, "latitude": 47.843579, "width": 500, "height": 330, "upload_date": "28 November 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 286439, "photo_title": "Rusted Car Along Route 66", "photo_url": "http://www.panoramio.com/photo/286439", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/286439.jpg", "longitude": -109.804788, "latitude": 35.050024, "width": 500, "height": 333, "upload_date": "03 January 2007", "owner_id": 45308, "owner_name": "Mike Cavaroc", "owner_url": "http://www.panoramio.com/user/45308"} + , + {"photo_id": 1283563, "photo_title": "Kalalau beach", "photo_url": "http://www.panoramio.com/photo/1283563", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1283563.jpg", "longitude": -159.667397, "latitude": 22.164196, "width": 330, "height": 500, "upload_date": "12 March 2007", "owner_id": 232099, "owner_name": "mabut", "owner_url": "http://www.panoramio.com/user/232099"} + , + {"photo_id": 1336919, "photo_title": "Neuschwanstein", "photo_url": "http://www.panoramio.com/photo/1336919", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1336919.jpg", "longitude": 10.750465, "latitude": 47.553128, "width": 500, "height": 371, "upload_date": "15 March 2007", "owner_id": 123698, "owner_name": "© Kojak", "owner_url": "http://www.panoramio.com/user/123698"} + , + {"photo_id": 1343841, "photo_title": "Turning Torsoe in the fog", "photo_url": "http://www.panoramio.com/photo/1343841", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1343841.jpg", "longitude": 12.968073, "latitude": 55.613165, "width": 332, "height": 500, "upload_date": "16 March 2007", "owner_id": 278074, "owner_name": "H. C. Steensen", "owner_url": "http://www.panoramio.com/user/278074"} + , + {"photo_id": 4976484, "photo_title": "Le Bout du Monde avant l'orage", "photo_url": "http://www.panoramio.com/photo/4976484", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4976484.jpg", "longitude": 6.867528, "latitude": 46.108618, "width": 500, "height": 375, "upload_date": "29 September 2007", "owner_id": 359127, "owner_name": "wx", "owner_url": "http://www.panoramio.com/user/359127"} + , + {"photo_id": 1195113, "photo_title": "Берег Сетуни 2 - Setun riverbank 2", "photo_url": "http://www.panoramio.com/photo/1195113", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1195113.jpg", "longitude": 37.486424, "latitude": 55.719367, "width": 332, "height": 500, "upload_date": "06 March 2007", "owner_id": 244932, "owner_name": "Andrey Jitkov", "owner_url": "http://www.panoramio.com/user/244932"} + , + {"photo_id": 1549176, "photo_title": "Erdőtűz", "photo_url": "http://www.panoramio.com/photo/1549176", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1549176.jpg", "longitude": 17.767639, "latitude": 47.582084, "width": 500, "height": 268, "upload_date": "29 March 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 2127008, "photo_title": "Thunderstorm over Thunderbolt", "photo_url": "http://www.panoramio.com/photo/2127008", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2127008.jpg", "longitude": -111.586761, "latitude": 41.605303, "width": 500, "height": 329, "upload_date": "08 May 2007", "owner_id": 395804, "owner_name": "Ralph Maughan", "owner_url": "http://www.panoramio.com/user/395804"} + , + {"photo_id": 2421940, "photo_title": "Twisted Ideas", "photo_url": "http://www.panoramio.com/photo/2421940", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2421940.jpg", "longitude": -112.105286, "latitude": 36.059681, "width": 500, "height": 333, "upload_date": "27 May 2007", "owner_id": 66847, "owner_name": "Lukas Novak", "owner_url": "http://www.panoramio.com/user/66847"} + , + {"photo_id": 8197305, "photo_title": "Mar Fantasma", "photo_url": "http://www.panoramio.com/photo/8197305", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/8197305.jpg", "longitude": -71.699395, "latitude": -33.407478, "width": 500, "height": 346, "upload_date": "29 February 2008", "owner_id": 730217, "owner_name": "C.e.C.v", "owner_url": "http://www.panoramio.com/user/730217"} + , + {"photo_id": 6126299, "photo_title": "Richmond Squirrel", "photo_url": "http://www.panoramio.com/photo/6126299", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6126299.jpg", "longitude": -0.277609, "latitude": 51.448003, "width": 500, "height": 500, "upload_date": "25 November 2007", "owner_id": 1130880, "owner_name": "marksimms", "owner_url": "http://www.panoramio.com/user/1130880"} + , + {"photo_id": 55016, "photo_title": "Jacaré-do-pantanal. Vazante do Capivari (Caiman crocodilus yacare)", "photo_url": "http://www.panoramio.com/photo/55016", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/55016.jpg", "longitude": -56.258326, "latitude": -18.771278, "width": 500, "height": 333, "upload_date": "30 September 2006", "owner_id": 7562, "owner_name": "Marcelo E. Salgado", "owner_url": "http://www.panoramio.com/user/7562"} + , + {"photo_id": 1640188, "photo_title": "Diagonal", "photo_url": "http://www.panoramio.com/photo/1640188", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1640188.jpg", "longitude": 20.428219, "latitude": 48.953621, "width": 408, "height": 500, "upload_date": "05 April 2007", "owner_id": 346103, "owner_name": "lacitot", "owner_url": "http://www.panoramio.com/user/346103"} + , + {"photo_id": 2935837, "photo_title": "Aitzgorri. Atardecer mirando al sureste", "photo_url": "http://www.panoramio.com/photo/2935837", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2935837.jpg", "longitude": -2.324939, "latitude": 42.951271, "width": 500, "height": 323, "upload_date": "25 June 2007", "owner_id": 129297, "owner_name": "Enrique Ortiz de Zárate", "owner_url": "http://www.panoramio.com/user/129297"} + , + {"photo_id": 355622, "photo_title": "newfoundland iceberg", "photo_url": "http://www.panoramio.com/photo/355622", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/355622.jpg", "longitude": -54.733200, "latitude": 49.710939, "width": 500, "height": 334, "upload_date": "09 January 2007", "owner_id": 69671, "owner_name": "illusandpics.com", "owner_url": "http://www.panoramio.com/user/69671"} + , + {"photo_id": 202578, "photo_title": "Abant Lake (1), Bolu", "photo_url": "http://www.panoramio.com/photo/202578", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/202578.jpg", "longitude": 31.286316, "latitude": 40.612128, "width": 500, "height": 317, "upload_date": "21 December 2006", "owner_id": 2351, "owner_name": "Serdar Bilecen", "owner_url": "http://www.panoramio.com/user/2351"} + , + {"photo_id": 9653590, "photo_title": "Secret Gate, Kentriki - [ PANORAMIO APRIL 08 WINNERS]...by Fotinos", "photo_url": "http://www.panoramio.com/photo/9653590", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/9653590.jpg", "longitude": 21.914872, "latitude": 38.571189, "width": 375, "height": 500, "upload_date": "24 April 2008", "owner_id": 1640258, "owner_name": "fotinos andreopoulos", "owner_url": "http://www.panoramio.com/user/1640258"} + , + {"photo_id": 2371950, "photo_title": "Dietro l'Isola dei Conigli", "photo_url": "http://www.panoramio.com/photo/2371950", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2371950.jpg", "longitude": 12.552137, "latitude": 35.514553, "width": 500, "height": 375, "upload_date": "24 May 2007", "owner_id": 476623, "owner_name": "Giulio Botticelli", "owner_url": "http://www.panoramio.com/user/476623"} + , + {"photo_id": 1340803, "photo_title": "Huge oak in monochrome", "photo_url": "http://www.panoramio.com/photo/1340803", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1340803.jpg", "longitude": 11.187515, "latitude": 59.548763, "width": 500, "height": 493, "upload_date": "15 March 2007", "owner_id": 39160, "owner_name": "Snemann", "owner_url": "http://www.panoramio.com/user/39160"} + , + {"photo_id": 520878, "photo_title": "Farewell", "photo_url": "http://www.panoramio.com/photo/520878", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/520878.jpg", "longitude": 17.466202, "latitude": 47.870186, "width": 415, "height": 500, "upload_date": "21 January 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 4738479, "photo_title": "\"Sovány szárcsavágta\"", "photo_url": "http://www.panoramio.com/photo/4738479", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4738479.jpg", "longitude": 17.571602, "latitude": 47.633354, "width": 500, "height": 347, "upload_date": "18 September 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 2395577, "photo_title": "", "photo_url": "http://www.panoramio.com/photo/2395577", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2395577.jpg", "longitude": -79.844792, "latitude": 43.300310, "width": 500, "height": 333, "upload_date": "25 May 2007", "owner_id": 17488, "owner_name": "John Gillett", "owner_url": "http://www.panoramio.com/user/17488"} + , + {"photo_id": 2470351, "photo_title": "Swans", "photo_url": "http://www.panoramio.com/photo/2470351", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2470351.jpg", "longitude": 23.713217, "latitude": 56.965614, "width": 500, "height": 332, "upload_date": "30 May 2007", "owner_id": 116556, "owner_name": "Pavels Dunaicevs", "owner_url": "http://www.panoramio.com/user/116556"} + , + {"photo_id": 6348257, "photo_title": "Sunset-pallatic", "photo_url": "http://www.panoramio.com/photo/6348257", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6348257.jpg", "longitude": 21.060791, "latitude": 42.004790, "width": 500, "height": 424, "upload_date": "07 December 2007", "owner_id": 695042, "owner_name": "Neim Sejfuli ♦", "owner_url": "http://www.panoramio.com/user/695042"} + , + {"photo_id": 10248178, "photo_title": "LA LUZ DE LA MAÑANA", "photo_url": "http://www.panoramio.com/photo/10248178", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/10248178.jpg", "longitude": -2.554321, "latitude": 43.209805, "width": 465, "height": 500, "upload_date": "15 May 2008", "owner_id": 1487989, "owner_name": "mesias", "owner_url": "http://www.panoramio.com/user/1487989"} + , + {"photo_id": 1177785, "photo_title": "Angkor Tom Dawn", "photo_url": "http://www.panoramio.com/photo/1177785", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1177785.jpg", "longitude": 103.858910, "latitude": 13.441383, "width": 401, "height": 500, "upload_date": "05 March 2007", "owner_id": 243825, "owner_name": "DarrinJ", "owner_url": "http://www.panoramio.com/user/243825"} + , + {"photo_id": 4785924, "photo_title": "Antelope Canyon", "photo_url": "http://www.panoramio.com/photo/4785924", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4785924.jpg", "longitude": -111.369422, "latitude": 36.853678, "width": 500, "height": 335, "upload_date": "20 September 2007", "owner_id": 464343, "owner_name": "yves floret", "owner_url": "http://www.panoramio.com/user/464343"} + , + {"photo_id": 459592, "photo_title": "nojiriko", "photo_url": "http://www.panoramio.com/photo/459592", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/459592.jpg", "longitude": 138.140202, "latitude": 36.857510, "width": 500, "height": 383, "upload_date": "16 January 2007", "owner_id": 86411, "owner_name": "中村脩-Osamu nakamura", "owner_url": "http://www.panoramio.com/user/86411"} + , + {"photo_id": 377931, "photo_title": "Baobab Avenue after sunset", "photo_url": "http://www.panoramio.com/photo/377931", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/377931.jpg", "longitude": 44.418486, "latitude": -20.250874, "width": 500, "height": 333, "upload_date": "11 January 2007", "owner_id": 70471, "owner_name": "David Thyberg", "owner_url": "http://www.panoramio.com/user/70471"} + , + {"photo_id": 170330, "photo_title": "Petit Palais - Looking Up", "photo_url": "http://www.panoramio.com/photo/170330", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/170330.jpg", "longitude": 2.315115, "latitude": 48.866011, "width": 500, "height": 355, "upload_date": "17 December 2006", "owner_id": 5684, "owner_name": "Brent Townshend", "owner_url": "http://www.panoramio.com/user/5684"} + , + {"photo_id": 5628541, "photo_title": "Pittsburgh", "photo_url": "http://www.panoramio.com/photo/5628541", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5628541.jpg", "longitude": -80.018985, "latitude": 40.438406, "width": 500, "height": 325, "upload_date": "30 October 2007", "owner_id": 31761, "owner_name": "Buck Cash", "owner_url": "http://www.panoramio.com/user/31761"} + , + {"photo_id": 51101, "photo_title": "Morgenstimmung zwischen Bru und Bordeyri ...", "photo_url": "http://www.panoramio.com/photo/51101", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/51101.jpg", "longitude": -21.099930, "latitude": 65.205068, "width": 500, "height": 272, "upload_date": "23 September 2006", "owner_id": 7434, "owner_name": "baldinger reisen ag, waedenswil/switzerland", "owner_url": "http://www.panoramio.com/user/7434"} + , + {"photo_id": 4352968, "photo_title": "Coucher du soleil sur le lac du Môle", "photo_url": "http://www.panoramio.com/photo/4352968", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4352968.jpg", "longitude": 6.426079, "latitude": 46.137084, "width": 500, "height": 374, "upload_date": "03 September 2007", "owner_id": 359127, "owner_name": "wx", "owner_url": "http://www.panoramio.com/user/359127"} + , + {"photo_id": 2345674, "photo_title": "Álomvölgy", "photo_url": "http://www.panoramio.com/photo/2345674", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2345674.jpg", "longitude": 17.791328, "latitude": 47.343243, "width": 500, "height": 334, "upload_date": "22 May 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 3521484, "photo_title": "Ki korán kel...", "photo_url": "http://www.panoramio.com/photo/3521484", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3521484.jpg", "longitude": 17.514782, "latitude": 47.744980, "width": 500, "height": 334, "upload_date": "25 July 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 8868820, "photo_title": "Burime ne malin Shar-Winner March contest -2008 \"Scenery\" Categorie", "photo_url": "http://www.panoramio.com/photo/8868820", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/8868820.jpg", "longitude": 20.884666, "latitude": 42.060318, "width": 375, "height": 500, "upload_date": "26 March 2008", "owner_id": 695042, "owner_name": "Neim Sejfuli ♦", "owner_url": "http://www.panoramio.com/user/695042"} + , + {"photo_id": 206560, "photo_title": "Sumela Monastery", "photo_url": "http://www.panoramio.com/photo/206560", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/206560.jpg", "longitude": 39.608116, "latitude": 40.770012, "width": 500, "height": 375, "upload_date": "21 December 2006", "owner_id": 2351, "owner_name": "Serdar Bilecen", "owner_url": "http://www.panoramio.com/user/2351"} + , + {"photo_id": 1488354, "photo_title": "", "photo_url": "http://www.panoramio.com/photo/1488354", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1488354.jpg", "longitude": 138.213072, "latitude": 37.829921, "width": 500, "height": 336, "upload_date": "25 March 2007", "owner_id": 86411, "owner_name": "中村脩-Osamu nakamura", "owner_url": "http://www.panoramio.com/user/86411"} + , + {"photo_id": 3334377, "photo_title": "ROSENGARTEN", "photo_url": "http://www.panoramio.com/photo/3334377", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3334377.jpg", "longitude": 11.591349, "latitude": 46.411603, "width": 500, "height": 375, "upload_date": "15 July 2007", "owner_id": 584241, "owner_name": "irene.italy", "owner_url": "http://www.panoramio.com/user/584241"} + , + {"photo_id": 12668091, "photo_title": "lago di Fedaia - 2008 August NPC subject Reflecting on reflection", "photo_url": "http://www.panoramio.com/photo/12668091", "photo_file_url": "http://static4.bareka.com/photos/medium/12668091.jpg", "longitude": 11.864547, "latitude": 46.460164, "width": 385, "height": 500, "upload_date": "31 July 2008", "owner_id": 6033, "owner_name": "► Marco Vanzo", "owner_url": "http://www.panoramio.com/user/6033"} + , + {"photo_id": 11177556, "photo_title": "Early morning ... :)", "photo_url": "http://www.panoramio.com/photo/11177556", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/11177556.jpg", "longitude": 168.307543, "latitude": -46.578215, "width": 500, "height": 340, "upload_date": "13 June 2008", "owner_id": 1256771, "owner_name": "Zsuzsanna W", "owner_url": "http://www.panoramio.com/user/1256771"} + , + {"photo_id": 67333, "photo_title": "Laguna Colorada", "photo_url": "http://www.panoramio.com/photo/67333", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/67333.jpg", "longitude": -67.798176, "latitude": -22.217285, "width": 375, "height": 500, "upload_date": "20 October 2006", "owner_id": 9080, "owner_name": "Marco Teodonio", "owner_url": "http://www.panoramio.com/user/9080"} + , + {"photo_id": 2850309, "photo_title": "Single tree...", "photo_url": "http://www.panoramio.com/photo/2850309", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2850309.jpg", "longitude": 33.571987, "latitude": 27.130876, "width": 500, "height": 375, "upload_date": "20 June 2007", "owner_id": 399963, "owner_name": "Victor Galanin", "owner_url": "http://www.panoramio.com/user/399963"} + , + {"photo_id": 1286406, "photo_title": "Creation", "photo_url": "http://www.panoramio.com/photo/1286406", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1286406.jpg", "longitude": 35.109558, "latitude": -1.460337, "width": 500, "height": 456, "upload_date": "12 March 2007", "owner_id": 232099, "owner_name": "mabut", "owner_url": "http://www.panoramio.com/user/232099"} + , + {"photo_id": 4136208, "photo_title": "Mesél az erdő", "photo_url": "http://www.panoramio.com/photo/4136208", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4136208.jpg", "longitude": 18.062897, "latitude": 47.274105, "width": 500, "height": 334, "upload_date": "23 August 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 8476696, "photo_title": "Coucher de soleil sur Silhouette, Seychelles. Panoramio and ATP first CONTEST, March 2008, category Travel : awarded \"Runner Up\" (second Prize). Many thanks to all voters. #434", "photo_url": "http://www.panoramio.com/photo/8476696", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/8476696.jpg", "longitude": 55.493660, "latitude": -4.563249, "width": 500, "height": 339, "upload_date": "12 March 2008", "owner_id": 666755, "owner_name": "Armagnac", "owner_url": "http://www.panoramio.com/user/666755"} + , + {"photo_id": 6189344, "photo_title": "Retenue Courchevel", "photo_url": "http://www.panoramio.com/photo/6189344", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6189344.jpg", "longitude": 6.654494, "latitude": 45.385908, "width": 500, "height": 335, "upload_date": "28 November 2007", "owner_id": 464343, "owner_name": "yves floret", "owner_url": "http://www.panoramio.com/user/464343"} + , + {"photo_id": 6934835, "photo_title": "I feel shivers down my spine... (Coucher de soleil hivernal au cimetière du Père Lachaise)", "photo_url": "http://www.panoramio.com/photo/6934835", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6934835.jpg", "longitude": 2.389634, "latitude": 48.862132, "width": 500, "height": 384, "upload_date": "06 January 2008", "owner_id": 629243, "owner_name": "Olivier Faugeras", "owner_url": "http://www.panoramio.com/user/629243"} + , + {"photo_id": 4214329, "photo_title": "Sunrise of Huangshan", "photo_url": "http://www.panoramio.com/photo/4214329", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4214329.jpg", "longitude": 118.282928, "latitude": 30.139189, "width": 500, "height": 313, "upload_date": "26 August 2007", "owner_id": 161470, "owner_name": "John Su", "owner_url": "http://www.panoramio.com/user/161470"} + , + {"photo_id": 8846650, "photo_title": "Vette Tempestose - Winner of Panoramio Contest of March 2008 - Travel category", "photo_url": "http://www.panoramio.com/photo/8846650", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/8846650.jpg", "longitude": 8.456469, "latitude": 45.886752, "width": 500, "height": 215, "upload_date": "25 March 2008", "owner_id": 634000, "owner_name": "© Massimo De Candido", "owner_url": "http://www.panoramio.com/user/634000"} + , + {"photo_id": 945986, "photo_title": "Xerta taronja", "photo_url": "http://www.panoramio.com/photo/945986", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/945986.jpg", "longitude": 0.483055, "latitude": 40.909102, "width": 500, "height": 377, "upload_date": "21 February 2007", "owner_id": 3022, "owner_name": "Arcadi", "owner_url": "http://www.panoramio.com/user/3022"} + , + {"photo_id": 5108615, "photo_title": "El Vado Lake, 1", "photo_url": "http://www.panoramio.com/photo/5108615", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5108615.jpg", "longitude": -106.755394, "latitude": 36.594858, "width": 500, "height": 490, "upload_date": "05 October 2007", "owner_id": 213866, "owner_name": "Nicolas Mertens", "owner_url": "http://www.panoramio.com/user/213866"} + , + {"photo_id": 6095512, "photo_title": "before the snow came - Thunersee - in bad weather", "photo_url": "http://www.panoramio.com/photo/6095512", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6095512.jpg", "longitude": 7.641592, "latitude": 46.744566, "width": 500, "height": 374, "upload_date": "24 November 2007", "owner_id": 635422, "owner_name": "♫ Swissmay", "owner_url": "http://www.panoramio.com/user/635422"} + , + {"photo_id": 1541286, "photo_title": "Wave3", "photo_url": "http://www.panoramio.com/photo/1541286", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1541286.jpg", "longitude": -112.007471, "latitude": 36.994755, "width": 333, "height": 500, "upload_date": "29 March 2007", "owner_id": 40260, "owner_name": "Don Albonico", "owner_url": "http://www.panoramio.com/user/40260"} + , + {"photo_id": 11309226, "photo_title": "Sunset on Portsea", "photo_url": "http://www.panoramio.com/photo/11309226", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/11309226.jpg", "longitude": 144.695692, "latitude": -38.330766, "width": 500, "height": 357, "upload_date": "18 June 2008", "owner_id": 140796, "owner_name": "rosina lamberti", "owner_url": "http://www.panoramio.com/user/140796"} + , + {"photo_id": 76734, "photo_title": "Buitre leonado", "photo_url": "http://www.panoramio.com/photo/76734", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/76734.jpg", "longitude": -5.662347, "latitude": 36.522413, "width": 500, "height": 375, "upload_date": "05 November 2006", "owner_id": 473, "owner_name": "Juanlu", "owner_url": "http://www.panoramio.com/user/473"} + , + {"photo_id": 196037, "photo_title": "camello", "photo_url": "http://www.panoramio.com/photo/196037", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/196037.jpg", "longitude": -3.776196, "latitude": 43.470686, "width": 500, "height": 332, "upload_date": "20 December 2006", "owner_id": 38804, "owner_name": "www.oscarsanchez.net", "owner_url": "http://www.panoramio.com/user/38804"} + , + {"photo_id": 1338852, "photo_title": "Stairs down to Praia dé Paraiso", "photo_url": "http://www.panoramio.com/photo/1338852", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1338852.jpg", "longitude": -8.475040, "latitude": 37.096924, "width": 332, "height": 500, "upload_date": "15 March 2007", "owner_id": 278074, "owner_name": "H. C. Steensen", "owner_url": "http://www.panoramio.com/user/278074"} + , + {"photo_id": 1269734, "photo_title": "Frosty fishermans boat, Nesseby, Finnmark, Norway", "photo_url": "http://www.panoramio.com/photo/1269734", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1269734.jpg", "longitude": 28.851471, "latitude": 70.144796, "width": 500, "height": 323, "upload_date": "11 March 2007", "owner_id": 66734, "owner_name": "Svein Solhaug", "owner_url": "http://www.panoramio.com/user/66734"} + , + {"photo_id": 1075687, "photo_title": "Lake Como sunset", "photo_url": "http://www.panoramio.com/photo/1075687", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1075687.jpg", "longitude": 9.285164, "latitude": 46.009839, "width": 500, "height": 332, "upload_date": "28 February 2007", "owner_id": 107359, "owner_name": "Ron Cooper", "owner_url": "http://www.panoramio.com/user/107359"} + , + {"photo_id": 58363, "photo_title": "Sonnenuntergang bei Bardolino", "photo_url": "http://www.panoramio.com/photo/58363", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/58363.jpg", "longitude": 10.714073, "latitude": 45.556372, "width": 500, "height": 333, "upload_date": "07 October 2006", "owner_id": 8060, "owner_name": "Norbert MAIER", "owner_url": "http://www.panoramio.com/user/8060"} + , + {"photo_id": 890788, "photo_title": "Kaplička", "photo_url": "http://www.panoramio.com/photo/890788", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/890788.jpg", "longitude": 18.222713, "latitude": 49.491950, "width": 500, "height": 333, "upload_date": "19 February 2007", "owner_id": 187280, "owner_name": "Radek Čampa", "owner_url": "http://www.panoramio.com/user/187280"} + , + {"photo_id": 8730610, "photo_title": "Antelope Canyon", "photo_url": "http://www.panoramio.com/photo/8730610", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/8730610.jpg", "longitude": -111.415787, "latitude": 36.918058, "width": 375, "height": 500, "upload_date": "22 March 2008", "owner_id": 1465912, "owner_name": "funtor", "owner_url": "http://www.panoramio.com/user/1465912"} + , + {"photo_id": 3008013, "photo_title": "Infrared Mood of Peyto Lake", "photo_url": "http://www.panoramio.com/photo/3008013", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3008013.jpg", "longitude": -116.509409, "latitude": 51.717989, "width": 500, "height": 334, "upload_date": "29 June 2007", "owner_id": 66847, "owner_name": "Lukas Novak", "owner_url": "http://www.panoramio.com/user/66847"} + , + {"photo_id": 565018, "photo_title": "Another one sunset in dubulti", "photo_url": "http://www.panoramio.com/photo/565018", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/565018.jpg", "longitude": 23.765488, "latitude": 56.971626, "width": 500, "height": 333, "upload_date": "25 January 2007", "owner_id": 116556, "owner_name": "Pavels Dunaicevs", "owner_url": "http://www.panoramio.com/user/116556"} + , + {"photo_id": 2217257, "photo_title": "Csermely", "photo_url": "http://www.panoramio.com/photo/2217257", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2217257.jpg", "longitude": 17.986851, "latitude": 47.273755, "width": 500, "height": 334, "upload_date": "14 May 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 3008041, "photo_title": "Lake Louise", "photo_url": "http://www.panoramio.com/photo/3008041", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3008041.jpg", "longitude": -116.219387, "latitude": 51.417409, "width": 500, "height": 335, "upload_date": "29 June 2007", "owner_id": 66847, "owner_name": "Lukas Novak", "owner_url": "http://www.panoramio.com/user/66847"} + , + {"photo_id": 636724, "photo_title": "Bora Bora JC", "photo_url": "http://www.panoramio.com/photo/636724", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/636724.jpg", "longitude": -151.714239, "latitude": -16.475926, "width": 500, "height": 375, "upload_date": "31 January 2007", "owner_id": 131113, "owner_name": "Lair Jean Claude", "owner_url": "http://www.panoramio.com/user/131113"} + , + {"photo_id": 511806, "photo_title": "Ezüsterdő", "photo_url": "http://www.panoramio.com/photo/511806", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/511806.jpg", "longitude": 17.748070, "latitude": 47.273056, "width": 366, "height": 500, "upload_date": "21 January 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 727360, "photo_title": "Hot croissant for breakfast - Crescent sunrise", "photo_url": "http://www.panoramio.com/photo/727360", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/727360.jpg", "longitude": 19.053833, "latitude": 47.605512, "width": 500, "height": 311, "upload_date": "07 February 2007", "owner_id": 57869, "owner_name": "NAGY Albert", "owner_url": "http://www.panoramio.com/user/57869"} + , + {"photo_id": 5148235, "photo_title": "shinagawa", "photo_url": "http://www.panoramio.com/photo/5148235", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5148235.jpg", "longitude": 139.741459, "latitude": 35.627460, "width": 500, "height": 500, "upload_date": "07 October 2007", "owner_id": 128403, "owner_name": "mechanics", "owner_url": "http://www.panoramio.com/user/128403"} + , + {"photo_id": 2082127, "photo_title": "Rejtelmes Szigetköz", "photo_url": "http://www.panoramio.com/photo/2082127", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2082127.jpg", "longitude": 17.508516, "latitude": 47.850088, "width": 500, "height": 316, "upload_date": "05 May 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 1589607, "photo_title": "Baalbek - Temple of Bacchus - Giant Columns", "photo_url": "http://www.panoramio.com/photo/1589607", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1589607.jpg", "longitude": 36.204404, "latitude": 34.006228, "width": 500, "height": 283, "upload_date": "01 April 2007", "owner_id": 73104, "owner_name": "zerega", "owner_url": "http://www.panoramio.com/user/73104"} + , + {"photo_id": 410991, "photo_title": "Burj al Arab", "photo_url": "http://www.panoramio.com/photo/410991", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/410991.jpg", "longitude": 55.187352, "latitude": 25.139282, "width": 500, "height": 342, "upload_date": "13 January 2007", "owner_id": 82662, "owner_name": "Sven Goelles", "owner_url": "http://www.panoramio.com/user/82662"} + , + {"photo_id": 6012, "photo_title": "Rastoke", "photo_url": "http://www.panoramio.com/photo/6012", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6012.jpg", "longitude": 15.584493, "latitude": 45.119144, "width": 343, "height": 500, "upload_date": "18 December 2005", "owner_id": 989, "owner_name": "Mrgud", "owner_url": "http://www.panoramio.com/user/989"} + , + {"photo_id": 4989314, "photo_title": "Range of Light", "photo_url": "http://www.panoramio.com/photo/4989314", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4989314.jpg", "longitude": -118.597283, "latitude": 37.234360, "width": 500, "height": 357, "upload_date": "29 September 2007", "owner_id": 376395, "owner_name": "JeffSullivan (www.MyPhotoGuides.com)", "owner_url": "http://www.panoramio.com/user/376395"} + , + {"photo_id": 2115987, "photo_title": "La Croix de Brume", "photo_url": "http://www.panoramio.com/photo/2115987", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2115987.jpg", "longitude": 0.341520, "latitude": 44.859519, "width": 409, "height": 500, "upload_date": "07 May 2007", "owner_id": 372189, "owner_name": "Phil©", "owner_url": "http://www.panoramio.com/user/372189"} + , + {"photo_id": 229544, "photo_title": "VRT RTBf Toren", "photo_url": "http://www.panoramio.com/photo/229544", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/229544.jpg", "longitude": 4.401634, "latitude": 50.852972, "width": 333, "height": 500, "upload_date": "24 December 2006", "owner_id": 7464, "owner_name": "Pieter", "owner_url": "http://www.panoramio.com/user/7464"} + , + {"photo_id": 58283, "photo_title": "Weg", "photo_url": "http://www.panoramio.com/photo/58283", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/58283.jpg", "longitude": 12.898464, "latitude": 48.059496, "width": 500, "height": 333, "upload_date": "07 October 2006", "owner_id": 8060, "owner_name": "Norbert MAIER", "owner_url": "http://www.panoramio.com/user/8060"} + , + {"photo_id": 112110, "photo_title": "Toronto_CN-Tower", "photo_url": "http://www.panoramio.com/photo/112110", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/112110.jpg", "longitude": -79.386907, "latitude": 43.641805, "width": 500, "height": 375, "upload_date": "11 December 2006", "owner_id": 17488, "owner_name": "John Gillett", "owner_url": "http://www.panoramio.com/user/17488"} + , + {"photo_id": 4446966, "photo_title": "Álmodó folyó", "photo_url": "http://www.panoramio.com/photo/4446966", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4446966.jpg", "longitude": 17.454357, "latitude": 47.881470, "width": 500, "height": 375, "upload_date": "06 September 2007", "owner_id": 182660, "owner_name": "Bálint Tünde", "owner_url": "http://www.panoramio.com/user/182660"} + , + {"photo_id": 91966, "photo_title": "Bled (Slovenia)", "photo_url": "http://www.panoramio.com/photo/91966", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/91966.jpg", "longitude": 14.087219, "latitude": 46.358184, "width": 500, "height": 375, "upload_date": "04 December 2006", "owner_id": 11403, "owner_name": "Arnáiz", "owner_url": "http://www.panoramio.com/user/11403"} + , + {"photo_id": 6013503, "photo_title": "Kapelle bei Böhmenkirch", "photo_url": "http://www.panoramio.com/photo/6013503", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6013503.jpg", "longitude": 9.943142, "latitude": 48.694756, "width": 500, "height": 375, "upload_date": "19 November 2007", "owner_id": 424589, "owner_name": "PeSchn", "owner_url": "http://www.panoramio.com/user/424589"} + , + {"photo_id": 1781593, "photo_title": "Medusa's Sandbox", "photo_url": "http://www.panoramio.com/photo/1781593", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1781593.jpg", "longitude": -112.006624, "latitude": 36.995852, "width": 375, "height": 500, "upload_date": "15 April 2007", "owner_id": 376395, "owner_name": "JeffSullivan (www.MyPhotoGuides.com)", "owner_url": "http://www.panoramio.com/user/376395"} + , + {"photo_id": 704119, "photo_title": "Izzó Adria", "photo_url": "http://www.panoramio.com/photo/704119", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/704119.jpg", "longitude": 17.056789, "latitude": 43.272206, "width": 500, "height": 285, "upload_date": "05 February 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 85624, "photo_title": "Isla del Fraile Águilas", "photo_url": "http://www.panoramio.com/photo/85624", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/85624.jpg", "longitude": -0.722609, "latitude": 37.924329, "width": 500, "height": 298, "upload_date": "24 November 2006", "owner_id": 10969, "owner_name": "Juanra", "owner_url": "http://www.panoramio.com/user/10969"} + , + {"photo_id": 52350, "photo_title": "Cataratas del Iguazú. Brasil", "photo_url": "http://www.panoramio.com/photo/52350", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/52350.jpg", "longitude": -54.439831, "latitude": -25.687422, "width": 500, "height": 333, "upload_date": "25 September 2006", "owner_id": 6961, "owner_name": "Santiago Rios", "owner_url": "http://www.panoramio.com/user/6961"} + , + {"photo_id": 36482, "photo_title": "Rovinj Harbour", "photo_url": "http://www.panoramio.com/photo/36482", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/36482.jpg", "longitude": 13.632714, "latitude": 45.083938, "width": 500, "height": 332, "upload_date": "02 August 2006", "owner_id": 5703, "owner_name": "dancer", "owner_url": "http://www.panoramio.com/user/5703"} + , + {"photo_id": 7251846, "photo_title": "Azért a víz az úr", "photo_url": "http://www.panoramio.com/photo/7251846", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/7251846.jpg", "longitude": 17.629623, "latitude": 47.687334, "width": 500, "height": 329, "upload_date": "20 January 2008", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 1551756, "photo_title": "Templestowe", "photo_url": "http://www.panoramio.com/photo/1551756", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1551756.jpg", "longitude": 145.116667, "latitude": -37.750000, "width": 500, "height": 298, "upload_date": "30 March 2007", "owner_id": 140796, "owner_name": "rosina lamberti", "owner_url": "http://www.panoramio.com/user/140796"} + , + {"photo_id": 2397841, "photo_title": "Storm Season II", "photo_url": "http://www.panoramio.com/photo/2397841", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2397841.jpg", "longitude": -122.439870, "latitude": 37.427928, "width": 407, "height": 500, "upload_date": "26 May 2007", "owner_id": 107613, "owner_name": "Tom Grubbe", "owner_url": "http://www.panoramio.com/user/107613"} + , + {"photo_id": 1237915, "photo_title": "Chlum u Trebone", "photo_url": "http://www.panoramio.com/photo/1237915", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1237915.jpg", "longitude": 14.923811, "latitude": 48.960159, "width": 500, "height": 429, "upload_date": "09 March 2007", "owner_id": 235166, "owner_name": "jirivrobel", "owner_url": "http://www.panoramio.com/user/235166"} + , + {"photo_id": 359324, "photo_title": "Abstraktion in der Kirche von Mogno, Tessin .......", "photo_url": "http://www.panoramio.com/photo/359324", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/359324.jpg", "longitude": 8.663492, "latitude": 46.430966, "width": 500, "height": 380, "upload_date": "09 January 2007", "owner_id": 7434, "owner_name": "baldinger reisen ag, waedenswil/switzerland", "owner_url": "http://www.panoramio.com/user/7434"} + , + {"photo_id": 483742, "photo_title": "Venus at Haleakala", "photo_url": "http://www.panoramio.com/photo/483742", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/483742.jpg", "longitude": -156.239491, "latitude": 20.707468, "width": 500, "height": 375, "upload_date": "18 January 2007", "owner_id": 100907, "owner_name": "Julia Wahl", "owner_url": "http://www.panoramio.com/user/100907"} + , + {"photo_id": 1087397, "photo_title": "Fjellbjerk (Betula) Snøhetta mountain in the background", "photo_url": "http://www.panoramio.com/photo/1087397", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1087397.jpg", "longitude": 9.555531, "latitude": 62.240111, "width": 500, "height": 333, "upload_date": "28 February 2007", "owner_id": 223406, "owner_name": "Sigmund Rise", "owner_url": "http://www.panoramio.com/user/223406"} + , + {"photo_id": 2846123, "photo_title": "新潟 小千谷 風船一揆 2003 niigata ojiya balloon riot Fireworks", "photo_url": "http://www.panoramio.com/photo/2846123", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2846123.jpg", "longitude": 138.791313, "latitude": 37.289350, "width": 500, "height": 497, "upload_date": "20 June 2007", "owner_id": 446937, "owner_name": "y_komatsu", "owner_url": "http://www.panoramio.com/user/446937"} + , + {"photo_id": 2533559, "photo_title": "Great Idea ! Don´t do it !!!", "photo_url": "http://www.panoramio.com/photo/2533559", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2533559.jpg", "longitude": -35.036988, "latitude": -6.241628, "width": 500, "height": 308, "upload_date": "02 June 2007", "owner_id": 1908, "owner_name": "Cleber Lima", "owner_url": "http://www.panoramio.com/user/1908"} + , + {"photo_id": 86246, "photo_title": "Salinas de Santa Pola", "photo_url": "http://www.panoramio.com/photo/86246", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/86246.jpg", "longitude": -0.528374, "latitude": 38.230090, "width": 500, "height": 333, "upload_date": "25 November 2006", "owner_id": 10969, "owner_name": "Juanra", "owner_url": "http://www.panoramio.com/user/10969"} + , + {"photo_id": 405740, "photo_title": "fudoutaki", "photo_url": "http://www.panoramio.com/photo/405740", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/405740.jpg", "longitude": 139.502249, "latitude": 37.580909, "width": 500, "height": 394, "upload_date": "13 January 2007", "owner_id": 86411, "owner_name": "中村脩-Osamu nakamura", "owner_url": "http://www.panoramio.com/user/86411"} + , + {"photo_id": 12848417, "photo_title": "Niedrigwasser an der Elbe-Dresden", "photo_url": "http://www.panoramio.com/photo/12848417", "photo_file_url": "http://static2.bareka.com/photos/medium/12848417.jpg", "longitude": 13.745323, "latitude": 51.055093, "width": 500, "height": 268, "upload_date": "05 August 2008", "owner_id": 1465912, "owner_name": "funtor", "owner_url": "http://www.panoramio.com/user/1465912"} + , + {"photo_id": 291091, "photo_title": "Imperia Porto Maurizio Puesta del Sol al Prino", "photo_url": "http://www.panoramio.com/photo/291091", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/291091.jpg", "longitude": 8.006684, "latitude": 43.869312, "width": 500, "height": 465, "upload_date": "03 January 2007", "owner_id": 60898, "owner_name": "esseil", "owner_url": "http://www.panoramio.com/user/60898"} + , + {"photo_id": 1183261, "photo_title": "Az óperencián innen", "photo_url": "http://www.panoramio.com/photo/1183261", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1183261.jpg", "longitude": 15.823574, "latitude": 43.708462, "width": 500, "height": 312, "upload_date": "05 March 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 1637150, "photo_title": "Vista del Misti por encima de las nubes", "photo_url": "http://www.panoramio.com/photo/1637150", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1637150.jpg", "longitude": -71.414566, "latitude": -16.300040, "width": 500, "height": 333, "upload_date": "05 April 2007", "owner_id": 328178, "owner_name": "Mariví Jiménez", "owner_url": "http://www.panoramio.com/user/328178"} + , + {"photo_id": 507703, "photo_title": "Csendes vizek", "photo_url": "http://www.panoramio.com/photo/507703", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/507703.jpg", "longitude": 17.568769, "latitude": 47.633586, "width": 500, "height": 349, "upload_date": "20 January 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 55100, "photo_title": "Ballesvikskardet", "photo_url": "http://www.panoramio.com/photo/55100", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/55100.jpg", "longitude": 17.122707, "latitude": 69.352910, "width": 500, "height": 375, "upload_date": "30 September 2006", "owner_id": 3574, "owner_name": "blackone", "owner_url": "http://www.panoramio.com/user/3574"} + , + {"photo_id": 291648, "photo_title": "Galway Cathedral", "photo_url": "http://www.panoramio.com/photo/291648", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/291648.jpg", "longitude": -9.057664, "latitude": 53.275627, "width": 500, "height": 336, "upload_date": "03 January 2007", "owner_id": 61285, "owner_name": "kamil krawczak", "owner_url": "http://www.panoramio.com/user/61285"} + , + {"photo_id": 5285701, "photo_title": "Another South Sister reflecting in Sparks Lake", "photo_url": "http://www.panoramio.com/photo/5285701", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5285701.jpg", "longitude": -121.737549, "latitude": 44.014176, "width": 500, "height": 334, "upload_date": "13 October 2007", "owner_id": 128746, "owner_name": "© Michael Hatten", "owner_url": "http://www.panoramio.com/user/128746"} + , + {"photo_id": 761958, "photo_title": "Lake Oulujärvi", "photo_url": "http://www.panoramio.com/photo/761958", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/761958.jpg", "longitude": 27.339649, "latitude": 64.231986, "width": 375, "height": 500, "upload_date": "10 February 2007", "owner_id": 151444, "owner_name": "Timo Rossi", "owner_url": "http://www.panoramio.com/user/151444"} + , + {"photo_id": 3853459, "photo_title": "Its great to be a swan on Hawn Pawn!", "photo_url": "http://www.panoramio.com/photo/3853459", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3853459.jpg", "longitude": -71.154628, "latitude": 42.470625, "width": 389, "height": 500, "upload_date": "10 August 2007", "owner_id": 286174, "owner_name": "kamaly", "owner_url": "http://www.panoramio.com/user/286174"} + , + {"photo_id": 4610197, "photo_title": "Yosemite Valley with Fallen Redwood from V11", "photo_url": "http://www.panoramio.com/photo/4610197", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4610197.jpg", "longitude": -119.661703, "latitude": 37.717214, "width": 500, "height": 281, "upload_date": "12 September 2007", "owner_id": 339677, "owner_name": "Chip Stephan", "owner_url": "http://www.panoramio.com/user/339677"} + , + {"photo_id": 5700759, "photo_title": "Crete senesi", "photo_url": "http://www.panoramio.com/photo/5700759", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5700759.jpg", "longitude": 11.448483, "latitude": 43.280205, "width": 500, "height": 304, "upload_date": "02 November 2007", "owner_id": 158718, "owner_name": "giulio colla", "owner_url": "http://www.panoramio.com/user/158718"} + , + {"photo_id": 1391775, "photo_title": "Arboles al atardecer en Chapala - Trees at sunset in Chapala Lake", "photo_url": "http://www.panoramio.com/photo/1391775", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1391775.jpg", "longitude": -102.775211, "latitude": 20.308730, "width": 500, "height": 341, "upload_date": "19 March 2007", "owner_id": 291650, "owner_name": "J.Ernesto Ortiz Razo", "owner_url": "http://www.panoramio.com/user/291650"} + , + {"photo_id": 57514, "photo_title": "Limone 1", "photo_url": "http://www.panoramio.com/photo/57514", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/57514.jpg", "longitude": 10.792179, "latitude": 45.816298, "width": 500, "height": 333, "upload_date": "04 October 2006", "owner_id": 8060, "owner_name": "Norbert MAIER", "owner_url": "http://www.panoramio.com/user/8060"} + , + {"photo_id": 2602937, "photo_title": "Alone", "photo_url": "http://www.panoramio.com/photo/2602937", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2602937.jpg", "longitude": -4.001770, "latitude": 31.174035, "width": 500, "height": 320, "upload_date": "06 June 2007", "owner_id": 232099, "owner_name": "mabut", "owner_url": "http://www.panoramio.com/user/232099"} + , + {"photo_id": 117465, "photo_title": "New York in the Afternoon...from Soho.. by Jeremiah Christopher", "photo_url": "http://www.panoramio.com/photo/117465", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/117465.jpg", "longitude": -74.003212, "latitude": 40.724059, "width": 500, "height": 375, "upload_date": "11 December 2006", "owner_id": 16869, "owner_name": "Jeremiah Christopher", "owner_url": "http://www.panoramio.com/user/16869"} + , + {"photo_id": 1331707, "photo_title": "Kastellet (Copenhagen fortress), Aerial", "photo_url": "http://www.panoramio.com/photo/1331707", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1331707.jpg", "longitude": 12.594967, "latitude": 55.691230, "width": 500, "height": 332, "upload_date": "15 March 2007", "owner_id": 278074, "owner_name": "H. C. Steensen", "owner_url": "http://www.panoramio.com/user/278074"} + , + {"photo_id": 11853382, "photo_title": "Railroads by Sunset/ Schienen bei Sonnenuntergang", "photo_url": "http://www.panoramio.com/photo/11853382", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/11853382.jpg", "longitude": 8.283455, "latitude": 51.692644, "width": 500, "height": 332, "upload_date": "06 July 2008", "owner_id": 564436, "owner_name": "Thomas Splietker", "owner_url": "http://www.panoramio.com/user/564436"} + , + {"photo_id": 1558288, "photo_title": "Notre-Dame et Tour Saint Jacques", "photo_url": "http://www.panoramio.com/photo/1558288", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1558288.jpg", "longitude": 2.354808, "latitude": 48.850399, "width": 500, "height": 333, "upload_date": "30 March 2007", "owner_id": 78506, "owner_name": "Philippe Stoop", "owner_url": "http://www.panoramio.com/user/78506"} + , + {"photo_id": 7601425, "photo_title": "Venezianische Impressionen", "photo_url": "http://www.panoramio.com/photo/7601425", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/7601425.jpg", "longitude": 12.337024, "latitude": 45.432280, "width": 500, "height": 385, "upload_date": "05 February 2008", "owner_id": 696605, "owner_name": "© alfredschaffer", "owner_url": "http://www.panoramio.com/user/696605"} + , + {"photo_id": 36386, "photo_title": "Half Dome Cables", "photo_url": "http://www.panoramio.com/photo/36386", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/36386.jpg", "longitude": -119.530735, "latitude": 37.746710, "width": 333, "height": 500, "upload_date": "02 August 2006", "owner_id": 5684, "owner_name": "Brent Townshend", "owner_url": "http://www.panoramio.com/user/5684"} + , + {"photo_id": 1089570, "photo_title": "Titokzatos reggel", "photo_url": "http://www.panoramio.com/photo/1089570", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1089570.jpg", "longitude": 17.467575, "latitude": 47.870532, "width": 500, "height": 331, "upload_date": "28 February 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 575276, "photo_title": "Sunrise", "photo_url": "http://www.panoramio.com/photo/575276", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/575276.jpg", "longitude": 2.288809, "latitude": 48.861892, "width": 500, "height": 349, "upload_date": "26 January 2007", "owner_id": 123518, "owner_name": "ERic Pouhier ericpouhier.com", "owner_url": "http://www.panoramio.com/user/123518"} + , + {"photo_id": 486480, "photo_title": "Monte Generoso", "photo_url": "http://www.panoramio.com/photo/486480", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/486480.jpg", "longitude": 9.015055, "latitude": 45.924826, "width": 428, "height": 500, "upload_date": "19 January 2007", "owner_id": 24068, "owner_name": "Daniele Nasi", "owner_url": "http://www.panoramio.com/user/24068"} + , + {"photo_id": 1100378, "photo_title": "Rensbekksetra (summer pasture)", "photo_url": "http://www.panoramio.com/photo/1100378", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1100378.jpg", "longitude": 9.293404, "latitude": 62.712731, "width": 500, "height": 255, "upload_date": "01 March 2007", "owner_id": 223406, "owner_name": "Sigmund Rise", "owner_url": "http://www.panoramio.com/user/223406"} + , + {"photo_id": 5844316, "photo_title": "Hikarigaoka IMA", "photo_url": "http://www.panoramio.com/photo/5844316", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5844316.jpg", "longitude": 139.630048, "latitude": 35.758154, "width": 500, "height": 326, "upload_date": "11 November 2007", "owner_id": 558055, "owner_name": "www.tokyoform.com", "owner_url": "http://www.panoramio.com/user/558055"} + , + {"photo_id": 1345372, "photo_title": "Sunset, Foeniculum vulgare (fennel, is one likely candidate)", "photo_url": "http://www.panoramio.com/photo/1345372", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1345372.jpg", "longitude": 10.727119, "latitude": 55.205080, "width": 332, "height": 500, "upload_date": "16 March 2007", "owner_id": 278074, "owner_name": "H. C. Steensen", "owner_url": "http://www.panoramio.com/user/278074"} + , + {"photo_id": 1317735, "photo_title": "Motu of Bora Bora", "photo_url": "http://www.panoramio.com/photo/1317735", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1317735.jpg", "longitude": -151.698360, "latitude": -16.495843, "width": 500, "height": 355, "upload_date": "14 March 2007", "owner_id": 232099, "owner_name": "mabut", "owner_url": "http://www.panoramio.com/user/232099"} + , + {"photo_id": 1012093, "photo_title": "Sunrise from the east side of Longs Peak", "photo_url": "http://www.panoramio.com/photo/1012093", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1012093.jpg", "longitude": -105.542564, "latitude": 40.274549, "width": 374, "height": 500, "upload_date": "25 February 2007", "owner_id": 87752, "owner_name": "Richard Ryer", "owner_url": "http://www.panoramio.com/user/87752"} + , + {"photo_id": 5035419, "photo_title": "Basilica de San Basilio (Moscow)", "photo_url": "http://www.panoramio.com/photo/5035419", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5035419.jpg", "longitude": 37.622852, "latitude": 55.752622, "width": 398, "height": 500, "upload_date": "01 October 2007", "owner_id": 83865, "owner_name": "Epi F.Villanueva", "owner_url": "http://www.panoramio.com/user/83865"} + , + {"photo_id": 799910, "photo_title": "A Dramatic Turn of the Yangtze River", "photo_url": "http://www.panoramio.com/photo/799910", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/799910.jpg", "longitude": 99.272633, "latitude": 28.255552, "width": 500, "height": 226, "upload_date": "13 February 2007", "owner_id": 164125, "owner_name": "DannyXu", "owner_url": "http://www.panoramio.com/user/164125"} + , + {"photo_id": 765388, "photo_title": "Leh", "photo_url": "http://www.panoramio.com/photo/765388", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/765388.jpg", "longitude": 77.587509, "latitude": 34.164943, "width": 500, "height": 333, "upload_date": "10 February 2007", "owner_id": 78506, "owner_name": "Philippe Stoop", "owner_url": "http://www.panoramio.com/user/78506"} + , + {"photo_id": 2875857, "photo_title": "Elgol, Isle of Skye", "photo_url": "http://www.panoramio.com/photo/2875857", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2875857.jpg", "longitude": -6.107025, "latitude": 57.150023, "width": 500, "height": 500, "upload_date": "22 June 2007", "owner_id": 588149, "owner_name": "Adam Salwanowicz", "owner_url": "http://www.panoramio.com/user/588149"} + , + {"photo_id": 840915, "photo_title": "Island of The Day Before", "photo_url": "http://www.panoramio.com/photo/840915", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/840915.jpg", "longitude": 27.436638, "latitude": 42.441448, "width": 500, "height": 333, "upload_date": "16 February 2007", "owner_id": 16880, "owner_name": "evgenidinev.com", "owner_url": "http://www.panoramio.com/user/16880"} + , + {"photo_id": 1459925, "photo_title": "The last ray", "photo_url": "http://www.panoramio.com/photo/1459925", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1459925.jpg", "longitude": -110.134850, "latitude": 36.955379, "width": 500, "height": 290, "upload_date": "23 March 2007", "owner_id": 232099, "owner_name": "mabut", "owner_url": "http://www.panoramio.com/user/232099"} + , + {"photo_id": 872177, "photo_title": "Sahara Desert sunrise, Chott el Jerid, near Kebili, Tunisia, 1/2007", "photo_url": "http://www.panoramio.com/photo/872177", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/872177.jpg", "longitude": 8.475866, "latitude": 33.930898, "width": 500, "height": 375, "upload_date": "18 February 2007", "owner_id": 183521, "owner_name": "SteveT", "owner_url": "http://www.panoramio.com/user/183521"} + , + {"photo_id": 405753, "photo_title": "sinanogawa", "photo_url": "http://www.panoramio.com/photo/405753", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/405753.jpg", "longitude": 138.822384, "latitude": 37.268589, "width": 500, "height": 386, "upload_date": "13 January 2007", "owner_id": 86411, "owner_name": "中村脩-Osamu nakamura", "owner_url": "http://www.panoramio.com/user/86411"} + , + {"photo_id": 548240, "photo_title": "Old Bagan 2002", "photo_url": "http://www.panoramio.com/photo/548240", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/548240.jpg", "longitude": 94.825230, "latitude": 21.137026, "width": 500, "height": 375, "upload_date": "23 January 2007", "owner_id": 64758, "owner_name": "Joly David", "owner_url": "http://www.panoramio.com/user/64758"} + , + {"photo_id": 4868105, "photo_title": "Bled lake", "photo_url": "http://www.panoramio.com/photo/4868105", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4868105.jpg", "longitude": 14.104900, "latitude": 46.369793, "width": 500, "height": 333, "upload_date": "24 September 2007", "owner_id": 989, "owner_name": "Mrgud", "owner_url": "http://www.panoramio.com/user/989"} + , + {"photo_id": 549396, "photo_title": "Råkneset on Storfjellet island, Røst", "photo_url": "http://www.panoramio.com/photo/549396", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/549396.jpg", "longitude": 11.932955, "latitude": 67.457456, "width": 500, "height": 375, "upload_date": "23 January 2007", "owner_id": 95799, "owner_name": "Owen Morgan", "owner_url": "http://www.panoramio.com/user/95799"} + , + {"photo_id": 196121, "photo_title": "canallave", "photo_url": "http://www.panoramio.com/photo/196121", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/196121.jpg", "longitude": -3.960571, "latitude": 43.452358, "width": 500, "height": 332, "upload_date": "20 December 2006", "owner_id": 38804, "owner_name": "www.oscarsanchez.net", "owner_url": "http://www.panoramio.com/user/38804"} + , + {"photo_id": 2422299, "photo_title": "Pacific Weather", "photo_url": "http://www.panoramio.com/photo/2422299", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2422299.jpg", "longitude": -124.097099, "latitude": 44.345704, "width": 500, "height": 333, "upload_date": "27 May 2007", "owner_id": 66847, "owner_name": "Lukas Novak", "owner_url": "http://www.panoramio.com/user/66847"} + , + {"photo_id": 821291, "photo_title": "Храм Василия Блаженного (Москва, ноябрь 2006 года)", "photo_url": "http://www.panoramio.com/photo/821291", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/821291.jpg", "longitude": 37.622954, "latitude": 55.752613, "width": 500, "height": 375, "upload_date": "14 February 2007", "owner_id": 55593, "owner_name": "pokatut.photosight.ru", "owner_url": "http://www.panoramio.com/user/55593"} + , + {"photo_id": 3545143, "photo_title": "Rainbow (Regnbue)", "photo_url": "http://www.panoramio.com/photo/3545143", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3545143.jpg", "longitude": 8.598175, "latitude": 62.904445, "width": 500, "height": 223, "upload_date": "26 July 2007", "owner_id": 343934, "owner_name": "Asbjørn999", "owner_url": "http://www.panoramio.com/user/343934"} + , + {"photo_id": 1794618, "photo_title": "Túlélők", "photo_url": "http://www.panoramio.com/photo/1794618", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1794618.jpg", "longitude": 20.803127, "latitude": 48.014157, "width": 399, "height": 500, "upload_date": "15 April 2007", "owner_id": 346103, "owner_name": "lacitot", "owner_url": "http://www.panoramio.com/user/346103"} + , + {"photo_id": 3904091, "photo_title": "Hajnali utakon", "photo_url": "http://www.panoramio.com/photo/3904091", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3904091.jpg", "longitude": 17.512014, "latitude": 47.850319, "width": 500, "height": 334, "upload_date": "13 August 2007", "owner_id": 689769, "owner_name": "Ponty István", "owner_url": "http://www.panoramio.com/user/689769"} + , + {"photo_id": 5649508, "photo_title": "Quiet morning", "photo_url": "http://www.panoramio.com/photo/5649508", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5649508.jpg", "longitude": 12.190876, "latitude": 49.357446, "width": 500, "height": 333, "upload_date": "31 October 2007", "owner_id": 696605, "owner_name": "© alfredschaffer", "owner_url": "http://www.panoramio.com/user/696605"} + , + {"photo_id": 7938965, "photo_title": "Pattaya - Big Buddha - Big Buddha Hill", "photo_url": "http://www.panoramio.com/photo/7938965", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/7938965.jpg", "longitude": 100.868343, "latitude": 12.914107, "width": 500, "height": 375, "upload_date": "19 February 2008", "owner_id": 716245, "owner_name": "—Dragon-64— ✈", "owner_url": "http://www.panoramio.com/user/716245"} + , + {"photo_id": 497056, "photo_title": "Japanese Garden maple", "photo_url": "http://www.panoramio.com/photo/497056", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/497056.jpg", "longitude": -122.707999, "latitude": 45.518810, "width": 500, "height": 300, "upload_date": "20 January 2007", "owner_id": 107359, "owner_name": "Ron Cooper", "owner_url": "http://www.panoramio.com/user/107359"} + , + {"photo_id": 438699, "photo_title": "White Sand Dunes", "photo_url": "http://www.panoramio.com/photo/438699", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/438699.jpg", "longitude": -106.262083, "latitude": 32.799324, "width": 371, "height": 500, "upload_date": "15 January 2007", "owner_id": 93560, "owner_name": "Alex Petrov", "owner_url": "http://www.panoramio.com/user/93560"} + , + {"photo_id": 2082221, "photo_title": "\"Bekötött szemmel\"", "photo_url": "http://www.panoramio.com/photo/2082221", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2082221.jpg", "longitude": 17.660522, "latitude": 47.604543, "width": 500, "height": 334, "upload_date": "05 May 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 5836484, "photo_title": "An Autumn's golden dawn on the Lake of Varese", "photo_url": "http://www.panoramio.com/photo/5836484", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5836484.jpg", "longitude": 8.718081, "latitude": 45.838966, "width": 500, "height": 312, "upload_date": "11 November 2007", "owner_id": 933456, "owner_name": "© Marco De Candido", "owner_url": "http://www.panoramio.com/user/933456"} + , + {"photo_id": 5204696, "photo_title": "Scotland", "photo_url": "http://www.panoramio.com/photo/5204696", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5204696.jpg", "longitude": -5.078773, "latitude": 56.558726, "width": 500, "height": 254, "upload_date": "09 October 2007", "owner_id": 588149, "owner_name": "Adam Salwanowicz", "owner_url": "http://www.panoramio.com/user/588149"} + , + {"photo_id": 1343454, "photo_title": "Вулкан Карымский", "photo_url": "http://www.panoramio.com/photo/1343454", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1343454.jpg", "longitude": 159.480286, "latitude": 54.025470, "width": 364, "height": 500, "upload_date": "16 March 2007", "owner_id": 268724, "owner_name": "Korotnev AV", "owner_url": "http://www.panoramio.com/user/268724"} + , + {"photo_id": 507424, "photo_title": "Lankák, ívek, felhőárnyak", "photo_url": "http://www.panoramio.com/photo/507424", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/507424.jpg", "longitude": 17.967281, "latitude": 47.318112, "width": 500, "height": 291, "upload_date": "20 January 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 5893176, "photo_title": "07-06-11_Camino de Santiago, Castrojeriz_PIXELECTA", "photo_url": "http://www.panoramio.com/photo/5893176", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5893176.jpg", "longitude": -4.182916, "latitude": 42.285723, "width": 500, "height": 333, "upload_date": "13 November 2007", "owner_id": 163655, "owner_name": "[[[ PIXELECTA ]]]", "owner_url": "http://www.panoramio.com/user/163655"} + , + {"photo_id": 186685, "photo_title": "People of Petra, the boy and his job", "photo_url": "http://www.panoramio.com/photo/186685", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/186685.jpg", "longitude": 35.437002, "latitude": 30.322285, "width": 500, "height": 375, "upload_date": "19 December 2006", "owner_id": 24068, "owner_name": "Daniele Nasi", "owner_url": "http://www.panoramio.com/user/24068"} + , + {"photo_id": 355648, "photo_title": "puerto-rico el-yunque", "photo_url": "http://www.panoramio.com/photo/355648", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/355648.jpg", "longitude": -65.788536, "latitude": 18.298795, "width": 500, "height": 334, "upload_date": "09 January 2007", "owner_id": 69671, "owner_name": "illusandpics.com", "owner_url": "http://www.panoramio.com/user/69671"} + , + {"photo_id": 46913, "photo_title": "beachy head", "photo_url": "http://www.panoramio.com/photo/46913", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/46913.jpg", "longitude": 0.216272, "latitude": 50.737969, "width": 500, "height": 291, "upload_date": "11 September 2006", "owner_id": 2575, "owner_name": "mikel ortega", "owner_url": "http://www.panoramio.com/user/2575"} + , + {"photo_id": 6012999, "photo_title": "Wetterumschwung in Murano", "photo_url": "http://www.panoramio.com/photo/6012999", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6012999.jpg", "longitude": 12.357838, "latitude": 45.457557, "width": 500, "height": 336, "upload_date": "19 November 2007", "owner_id": 8060, "owner_name": "Norbert MAIER", "owner_url": "http://www.panoramio.com/user/8060"} + , + {"photo_id": 590422, "photo_title": "Gyilkos-tó (Killer Lake) - Remains of the forest, which grew here until 1837, conserved by the water", "photo_url": "http://www.panoramio.com/photo/590422", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/590422.jpg", "longitude": 25.785170, "latitude": 46.792597, "width": 500, "height": 352, "upload_date": "27 January 2007", "owner_id": 57869, "owner_name": "NAGY Albert", "owner_url": "http://www.panoramio.com/user/57869"} + , + {"photo_id": 5119067, "photo_title": "Fog In The Forest", "photo_url": "http://www.panoramio.com/photo/5119067", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5119067.jpg", "longitude": 7.667191, "latitude": 49.174283, "width": 500, "height": 375, "upload_date": "05 October 2007", "owner_id": 528834, "owner_name": "©junebug", "owner_url": "http://www.panoramio.com/user/528834"} + , + {"photo_id": 4702558, "photo_title": "Sunset ( Isla de Antigua-Caribe)", "photo_url": "http://www.panoramio.com/photo/4702558", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4702558.jpg", "longitude": -61.833801, "latitude": 17.171627, "width": 500, "height": 375, "upload_date": "16 September 2007", "owner_id": 83865, "owner_name": "Epi F.Villanueva", "owner_url": "http://www.panoramio.com/user/83865"} + , + {"photo_id": 717413, "photo_title": "Singapore Skyline with Esplanade at night", "photo_url": "http://www.panoramio.com/photo/717413", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/717413.jpg", "longitude": 103.856664, "latitude": 1.291589, "width": 391, "height": 500, "upload_date": "06 February 2007", "owner_id": 20398, "owner_name": "boerx", "owner_url": "http://www.panoramio.com/user/20398"} + , + {"photo_id": 6281064, "photo_title": "Latemar Carezza", "photo_url": "http://www.panoramio.com/photo/6281064", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6281064.jpg", "longitude": 11.595447, "latitude": 46.412476, "width": 500, "height": 332, "upload_date": "03 December 2007", "owner_id": 578163, "owner_name": "Margherita-Italy", "owner_url": "http://www.panoramio.com/user/578163"} + , + {"photo_id": 327016, "photo_title": "bryce canyon", "photo_url": "http://www.panoramio.com/photo/327016", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/327016.jpg", "longitude": -112.210836, "latitude": 37.586146, "width": 500, "height": 375, "upload_date": "07 January 2007", "owner_id": 63705, "owner_name": "Karl Wiktorin", "owner_url": "http://www.panoramio.com/user/63705"} + , + {"photo_id": 301678, "photo_title": "Akashi Kaikyo Bridge (Pearl Bridge)", "photo_url": "http://www.panoramio.com/photo/301678", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/301678.jpg", "longitude": 135.028882, "latitude": 34.623002, "width": 443, "height": 500, "upload_date": "04 January 2007", "owner_id": 30202, "owner_name": "S_Mori", "owner_url": "http://www.panoramio.com/user/30202"} + , + {"photo_id": 6055804, "photo_title": "2007 Balsa de SALBURUA_VITORIA (Alava) PIXELECTA", "photo_url": "http://www.panoramio.com/photo/6055804", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6055804.jpg", "longitude": -2.650537, "latitude": 42.859907, "width": 500, "height": 333, "upload_date": "21 November 2007", "owner_id": 163655, "owner_name": "[[[ PIXELECTA ]]]", "owner_url": "http://www.panoramio.com/user/163655"} + , + {"photo_id": 5946759, "photo_title": "Snow Pond", "photo_url": "http://www.panoramio.com/photo/5946759", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5946759.jpg", "longitude": 10.899510, "latitude": 49.694507, "width": 500, "height": 375, "upload_date": "16 November 2007", "owner_id": 884621, "owner_name": "Florian Eichhorn", "owner_url": "http://www.panoramio.com/user/884621"} + , + {"photo_id": 231305, "photo_title": "Cathedral Rock in Sedona, AZ at Sunset", "photo_url": "http://www.panoramio.com/photo/231305", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/231305.jpg", "longitude": -111.792294, "latitude": 34.818657, "width": 500, "height": 327, "upload_date": "25 December 2006", "owner_id": 45308, "owner_name": "Mike Cavaroc", "owner_url": "http://www.panoramio.com/user/45308"} + , + {"photo_id": 582047, "photo_title": "Old Vineyard with the sun trying to break through the fog: Oakley, CA", "photo_url": "http://www.panoramio.com/photo/582047", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/582047.jpg", "longitude": -121.753750, "latitude": 38.001658, "width": 500, "height": 316, "upload_date": "26 January 2007", "owner_id": 99249, "owner_name": "shaunika", "owner_url": "http://www.panoramio.com/user/99249"} + , + {"photo_id": 679332, "photo_title": "forbidden city", "photo_url": "http://www.panoramio.com/photo/679332", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/679332.jpg", "longitude": 116.396177, "latitude": 39.921734, "width": 500, "height": 248, "upload_date": "04 February 2007", "owner_id": 146092, "owner_name": "sid1662", "owner_url": "http://www.panoramio.com/user/146092"} + , + {"photo_id": 3904189, "photo_title": "Hajnal", "photo_url": "http://www.panoramio.com/photo/3904189", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3904189.jpg", "longitude": 17.361488, "latitude": 47.875138, "width": 500, "height": 333, "upload_date": "13 August 2007", "owner_id": 689769, "owner_name": "Ponty István", "owner_url": "http://www.panoramio.com/user/689769"} + , + {"photo_id": 11059137, "photo_title": "Sunset at Kythira Greece by Nikos Demiris", "photo_url": "http://www.panoramio.com/photo/11059137", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/11059137.jpg", "longitude": 23.003998, "latitude": 36.142034, "width": 500, "height": 346, "upload_date": "09 June 2008", "owner_id": 1629713, "owner_name": "demirisn", "owner_url": "http://www.panoramio.com/user/1629713"} + , + {"photo_id": 2334150, "photo_title": "", "photo_url": "http://www.panoramio.com/photo/2334150", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2334150.jpg", "longitude": 0.491531, "latitude": 40.903993, "width": 500, "height": 373, "upload_date": "21 May 2007", "owner_id": 3022, "owner_name": "Arcadi", "owner_url": "http://www.panoramio.com/user/3022"} + , + {"photo_id": 5709301, "photo_title": "Ködvarázs II", "photo_url": "http://www.panoramio.com/photo/5709301", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5709301.jpg", "longitude": 17.998352, "latitude": 47.252903, "width": 333, "height": 500, "upload_date": "05 November 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 55029, "photo_title": "Solar Eclipce, Mt.Elbrus, Refuge of 11", "photo_url": "http://www.panoramio.com/photo/55029", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/55029.jpg", "longitude": 42.451859, "latitude": 43.316186, "width": 448, "height": 500, "upload_date": "30 September 2006", "owner_id": 7707, "owner_name": "Yorix", "owner_url": "http://www.panoramio.com/user/7707"} + , + {"photo_id": 702974, "photo_title": "Hundertwasserhaus", "photo_url": "http://www.panoramio.com/photo/702974", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/702974.jpg", "longitude": 16.393780, "latitude": 48.207594, "width": 375, "height": 500, "upload_date": "05 February 2007", "owner_id": 123698, "owner_name": "© Kojak", "owner_url": "http://www.panoramio.com/user/123698"} + , + {"photo_id": 8811826, "photo_title": "Der Baum im Wasser", "photo_url": "http://www.panoramio.com/photo/8811826", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/8811826.jpg", "longitude": 9.293532, "latitude": 52.869078, "width": 375, "height": 500, "upload_date": "24 March 2008", "owner_id": 1431077, "owner_name": "Heiner F.", "owner_url": "http://www.panoramio.com/user/1431077"} + , + {"photo_id": 67843, "photo_title": "Torre Eiffel", "photo_url": "http://www.panoramio.com/photo/67843", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/67843.jpg", "longitude": 2.294587, "latitude": 48.858468, "width": 500, "height": 375, "upload_date": "21 October 2006", "owner_id": 9163, "owner_name": "marathoniano", "owner_url": "http://www.panoramio.com/user/9163"} + , + {"photo_id": 1183509, "photo_title": "Viharpart", "photo_url": "http://www.panoramio.com/photo/1183509", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1183509.jpg", "longitude": 15.917473, "latitude": 43.590587, "width": 500, "height": 334, "upload_date": "05 March 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 449049, "photo_title": "Encantos de Santos", "photo_url": "http://www.panoramio.com/photo/449049", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/449049.jpg", "longitude": -46.307716, "latitude": -23.988605, "width": 500, "height": 342, "upload_date": "16 January 2007", "owner_id": 81574, "owner_name": "Criss RB", "owner_url": "http://www.panoramio.com/user/81574"} + , + {"photo_id": 4669228, "photo_title": "Reif an der naab", "photo_url": "http://www.panoramio.com/photo/4669228", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4669228.jpg", "longitude": 12.113457, "latitude": 49.339105, "width": 500, "height": 333, "upload_date": "15 September 2007", "owner_id": 696605, "owner_name": "© alfredschaffer", "owner_url": "http://www.panoramio.com/user/696605"} + , + {"photo_id": 516653, "photo_title": "Alkonyvarázs", "photo_url": "http://www.panoramio.com/photo/516653", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/516653.jpg", "longitude": 17.451611, "latitude": 47.782424, "width": 404, "height": 500, "upload_date": "21 January 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 4214320, "photo_title": "暮色", "photo_url": "http://www.panoramio.com/photo/4214320", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4214320.jpg", "longitude": 110.364532, "latitude": 25.201524, "width": 500, "height": 313, "upload_date": "26 August 2007", "owner_id": 161470, "owner_name": "John Su", "owner_url": "http://www.panoramio.com/user/161470"} + , + {"photo_id": 9419312, "photo_title": "Skeleton", "photo_url": "http://www.panoramio.com/photo/9419312", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/9419312.jpg", "longitude": -147.929063, "latitude": -15.091723, "width": 500, "height": 326, "upload_date": "16 April 2008", "owner_id": 232099, "owner_name": "mabut", "owner_url": "http://www.panoramio.com/user/232099"} + , + {"photo_id": 642609, "photo_title": "Oia, Santorini, Cyclades, Hellas, Greece", "photo_url": "http://www.panoramio.com/photo/642609", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/642609.jpg", "longitude": 25.377388, "latitude": 36.460778, "width": 500, "height": 333, "upload_date": "01 February 2007", "owner_id": 131038, "owner_name": "wolffystyle", "owner_url": "http://www.panoramio.com/user/131038"} + , + {"photo_id": 354614, "photo_title": "Dresden_Centrum_01", "photo_url": "http://www.panoramio.com/photo/354614", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/354614.jpg", "longitude": 13.740206, "latitude": 51.056934, "width": 500, "height": 332, "upload_date": "09 January 2007", "owner_id": 71628, "owner_name": "Ulrich Hässler, Dresden", "owner_url": "http://www.panoramio.com/user/71628"} + , + {"photo_id": 678200, "photo_title": "Geometria de terrazas", "photo_url": "http://www.panoramio.com/photo/678200", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/678200.jpg", "longitude": -16.841269, "latitude": 28.235525, "width": 500, "height": 333, "upload_date": "03 February 2007", "owner_id": 92750, "owner_name": "Pablo López Ramos", "owner_url": "http://www.panoramio.com/user/92750"} + , + {"photo_id": 436284, "photo_title": "bandaibasi2", "photo_url": "http://www.panoramio.com/photo/436284", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/436284.jpg", "longitude": 139.051423, "latitude": 37.920063, "width": 500, "height": 393, "upload_date": "15 January 2007", "owner_id": 86411, "owner_name": "中村脩-Osamu nakamura", "owner_url": "http://www.panoramio.com/user/86411"} + , + {"photo_id": 2235454, "photo_title": "La bonde et la brume", "photo_url": "http://www.panoramio.com/photo/2235454", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2235454.jpg", "longitude": 1.595249, "latitude": 47.313181, "width": 500, "height": 500, "upload_date": "15 May 2007", "owner_id": 372189, "owner_name": "Phil©", "owner_url": "http://www.panoramio.com/user/372189"} + , + {"photo_id": 5983, "photo_title": "Waiting", "photo_url": "http://www.panoramio.com/photo/5983", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5983.jpg", "longitude": 7.796173, "latitude": 33.954752, "width": 344, "height": 500, "upload_date": "17 December 2005", "owner_id": 989, "owner_name": "Mrgud", "owner_url": "http://www.panoramio.com/user/989"} + , + {"photo_id": 97402, "photo_title": "Mostar", "photo_url": "http://www.panoramio.com/photo/97402", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/97402.jpg", "longitude": 17.814803, "latitude": 43.337102, "width": 500, "height": 375, "upload_date": "09 December 2006", "owner_id": 12954, "owner_name": "Ziębol", "owner_url": "http://www.panoramio.com/user/12954"} + , + {"photo_id": 5159548, "photo_title": "Autumn - Herbstfarben - Fall", "photo_url": "http://www.panoramio.com/photo/5159548", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5159548.jpg", "longitude": 7.541599, "latitude": 46.834772, "width": 500, "height": 374, "upload_date": "08 October 2007", "owner_id": 635422, "owner_name": "♫ Swissmay", "owner_url": "http://www.panoramio.com/user/635422"} + , + {"photo_id": 1779072, "photo_title": "Égi érintés", "photo_url": "http://www.panoramio.com/photo/1779072", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1779072.jpg", "longitude": 17.747383, "latitude": 47.556835, "width": 462, "height": 500, "upload_date": "14 April 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 5795973, "photo_title": "Emmental mit 7 Hengsten Hohgant und Berneralpen - Emmental, 7 Stallions and Bernese Alpine Snow Mountains", "photo_url": "http://www.panoramio.com/photo/5795973", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5795973.jpg", "longitude": 7.730427, "latitude": 47.033280, "width": 500, "height": 374, "upload_date": "08 November 2007", "owner_id": 635422, "owner_name": "♫ Swissmay", "owner_url": "http://www.panoramio.com/user/635422"} + , + {"photo_id": 6850694, "photo_title": "2007-VITORIA Alava PIXELECTA", "photo_url": "http://www.panoramio.com/photo/6850694", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6850694.jpg", "longitude": -2.649336, "latitude": 42.861260, "width": 500, "height": 116, "upload_date": "02 January 2008", "owner_id": 163655, "owner_name": "[[[ PIXELECTA ]]]", "owner_url": "http://www.panoramio.com/user/163655"} + , + {"photo_id": 11738506, "photo_title": "Galeria de Itálica", "photo_url": "http://www.panoramio.com/photo/11738506", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/11738506.jpg", "longitude": -6.046858, "latitude": 37.444199, "width": 378, "height": 500, "upload_date": "03 July 2008", "owner_id": 1038666, "owner_name": "Doenjo", "owner_url": "http://www.panoramio.com/user/1038666"} + , + {"photo_id": 4013965, "photo_title": "Pedaleando en la costanera", "photo_url": "http://www.panoramio.com/photo/4013965", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4013965.jpg", "longitude": -73.231012, "latitude": -39.817655, "width": 500, "height": 366, "upload_date": "18 August 2007", "owner_id": 327310, "owner_name": "Erwin Woenckhaus", "owner_url": "http://www.panoramio.com/user/327310"} + , + {"photo_id": 611985, "photo_title": "Toda Temple", "photo_url": "http://www.panoramio.com/photo/611985", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/611985.jpg", "longitude": 76.715459, "latitude": 11.420014, "width": 500, "height": 375, "upload_date": "29 January 2007", "owner_id": 130990, "owner_name": "Eye for India. blogspot .com", "owner_url": "http://www.panoramio.com/user/130990"} + , + {"photo_id": 2689441, "photo_title": "Terepszemle", "photo_url": "http://www.panoramio.com/photo/2689441", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2689441.jpg", "longitude": 17.674255, "latitude": 47.601533, "width": 500, "height": 347, "upload_date": "11 June 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 6599853, "photo_title": "FlowerSun", "photo_url": "http://www.panoramio.com/photo/6599853", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6599853.jpg", "longitude": 21.042938, "latitude": 41.988333, "width": 480, "height": 500, "upload_date": "21 December 2007", "owner_id": 695042, "owner_name": "Neim Sejfuli ♦", "owner_url": "http://www.panoramio.com/user/695042"} + , + {"photo_id": 71855, "photo_title": "British Museum", "photo_url": "http://www.panoramio.com/photo/71855", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/71855.jpg", "longitude": -0.127373, "latitude": 51.519265, "width": 500, "height": 333, "upload_date": "28 October 2006", "owner_id": 1295, "owner_name": "Matthew Walters", "owner_url": "http://www.panoramio.com/user/1295"} + , + {"photo_id": 58291, "photo_title": "Gollinger Wasserfall", "photo_url": "http://www.panoramio.com/photo/58291", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/58291.jpg", "longitude": 13.138103, "latitude": 47.601244, "width": 330, "height": 500, "upload_date": "07 October 2006", "owner_id": 8060, "owner_name": "Norbert MAIER", "owner_url": "http://www.panoramio.com/user/8060"} + , + {"photo_id": 3903941, "photo_title": "Viharos Pipacsos", "photo_url": "http://www.panoramio.com/photo/3903941", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3903941.jpg", "longitude": 16.638451, "latitude": 47.732396, "width": 500, "height": 331, "upload_date": "13 August 2007", "owner_id": 689769, "owner_name": "Ponty István", "owner_url": "http://www.panoramio.com/user/689769"} + , + {"photo_id": 5363928, "photo_title": "Antelope Slot Canyon", "photo_url": "http://www.panoramio.com/photo/5363928", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5363928.jpg", "longitude": -111.370811, "latitude": 36.856755, "width": 500, "height": 326, "upload_date": "17 October 2007", "owner_id": 358485, "owner_name": "Francesco Villa", "owner_url": "http://www.panoramio.com/user/358485"} + , + {"photo_id": 2688750, "photo_title": "Playa de Strenc,Mallorca", "photo_url": "http://www.panoramio.com/photo/2688750", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2688750.jpg", "longitude": 2.980042, "latitude": 39.348702, "width": 500, "height": 427, "upload_date": "11 June 2007", "owner_id": 83865, "owner_name": "Epi F.Villanueva", "owner_url": "http://www.panoramio.com/user/83865"} + , + {"photo_id": 3148025, "photo_title": "Zuidlede", "photo_url": "http://www.panoramio.com/photo/3148025", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3148025.jpg", "longitude": 3.906112, "latitude": 51.147667, "width": 496, "height": 500, "upload_date": "06 July 2007", "owner_id": 635244, "owner_name": "A.Lebacq", "owner_url": "http://www.panoramio.com/user/635244"} + , + {"photo_id": 809727, "photo_title": "Túl az óperencián", "photo_url": "http://www.panoramio.com/photo/809727", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/809727.jpg", "longitude": 17.062283, "latitude": 43.277580, "width": 500, "height": 334, "upload_date": "13 February 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 11560716, "photo_title": "China's Great Wall, 09 may 2008", "photo_url": "http://www.panoramio.com/photo/11560716", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/11560716.jpg", "longitude": 116.064860, "latitude": 40.287162, "width": 500, "height": 331, "upload_date": "27 June 2008", "owner_id": 1931067, "owner_name": "EugeneTrambo", "owner_url": "http://www.panoramio.com/user/1931067"} + , + {"photo_id": 10484028, "photo_title": "Tuscanny in lower bavaria? Toskana in Niederbayern? near Pfeffenhausen", "photo_url": "http://www.panoramio.com/photo/10484028", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/10484028.jpg", "longitude": 11.982479, "latitude": 48.628768, "width": 500, "height": 411, "upload_date": "22 May 2008", "owner_id": 1077251, "owner_name": "picsonthemove", "owner_url": "http://www.panoramio.com/user/1077251"} + , + {"photo_id": 10321724, "photo_title": "Kingston Lacy beech avenue from the middle of the road (don't try this at home...)", "photo_url": "http://www.panoramio.com/photo/10321724", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/10321724.jpg", "longitude": -2.051697, "latitude": 50.820469, "width": 500, "height": 473, "upload_date": "17 May 2008", "owner_id": 450216, "owner_name": "Graham Hobbs", "owner_url": "http://www.panoramio.com/user/450216"} + , + {"photo_id": 11847917, "photo_title": "Neda.... The end of an unusual trip! First Prize \"Travel\" Panoramio JULY 2008, a shot by kostas andreopoulos", "photo_url": "http://www.panoramio.com/photo/11847917", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/11847917.jpg", "longitude": 21.776275, "latitude": 37.394711, "width": 500, "height": 484, "upload_date": "06 July 2008", "owner_id": 1690483, "owner_name": "k.andre", "owner_url": "http://www.panoramio.com/user/1690483"} + , + {"photo_id": 723285, "photo_title": "Stonehenge Fisheye View June 2000", "photo_url": "http://www.panoramio.com/photo/723285", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/723285.jpg", "longitude": -1.826195, "latitude": 51.178849, "width": 500, "height": 500, "upload_date": "07 February 2007", "owner_id": 154364, "owner_name": "Edgy01", "owner_url": "http://www.panoramio.com/user/154364"} + , + {"photo_id": 9831198, "photo_title": "Verőfényes hangulat", "photo_url": "http://www.panoramio.com/photo/9831198", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/9831198.jpg", "longitude": 18.331053, "latitude": 47.650689, "width": 333, "height": 500, "upload_date": "01 May 2008", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 4670496, "photo_title": "Vuelo rasante entre la niebla", "photo_url": "http://www.panoramio.com/photo/4670496", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4670496.jpg", "longitude": -73.243092, "latitude": -39.809134, "width": 500, "height": 371, "upload_date": "15 September 2007", "owner_id": 327310, "owner_name": "Erwin Woenckhaus", "owner_url": "http://www.panoramio.com/user/327310"} + , + {"photo_id": 2414624, "photo_title": "Triumvirátus", "photo_url": "http://www.panoramio.com/photo/2414624", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2414624.jpg", "longitude": 17.768154, "latitude": 47.510940, "width": 500, "height": 309, "upload_date": "27 May 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 196129, "photo_title": "usgo", "photo_url": "http://www.panoramio.com/photo/196129", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/196129.jpg", "longitude": -3.999882, "latitude": 43.439397, "width": 500, "height": 316, "upload_date": "20 December 2006", "owner_id": 38804, "owner_name": "www.oscarsanchez.net", "owner_url": "http://www.panoramio.com/user/38804"} + , + {"photo_id": 304677, "photo_title": "Allee bei Wilhelmsthal", "photo_url": "http://www.panoramio.com/photo/304677", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/304677.jpg", "longitude": 9.409919, "latitude": 51.392686, "width": 500, "height": 409, "upload_date": "05 January 2007", "owner_id": 63703, "owner_name": "Rainer Kaufhold", "owner_url": "http://www.panoramio.com/user/63703"} + , + {"photo_id": 4924213, "photo_title": "Egy varázslatos estén", "photo_url": "http://www.panoramio.com/photo/4924213", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4924213.jpg", "longitude": 2.151239, "latitude": 41.371278, "width": 500, "height": 335, "upload_date": "26 September 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 189243, "photo_title": "coming in for a landing", "photo_url": "http://www.panoramio.com/photo/189243", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/189243.jpg", "longitude": -123.147984, "latitude": 49.198812, "width": 500, "height": 333, "upload_date": "19 December 2006", "owner_id": 29932, "owner_name": "Rom@nce", "owner_url": "http://www.panoramio.com/user/29932"} + , + {"photo_id": 3121730, "photo_title": "Mers-les-Bains dark clouds looming", "photo_url": "http://www.panoramio.com/photo/3121730", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3121730.jpg", "longitude": 1.383655, "latitude": 50.066878, "width": 500, "height": 375, "upload_date": "04 July 2007", "owner_id": 633531, "owner_name": "ianwstokes", "owner_url": "http://www.panoramio.com/user/633531"} + , + {"photo_id": 5358146, "photo_title": "Lone Rock Rainbows", "photo_url": "http://www.panoramio.com/photo/5358146", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5358146.jpg", "longitude": -111.537795, "latitude": 37.020475, "width": 500, "height": 335, "upload_date": "16 October 2007", "owner_id": 66847, "owner_name": "Lukas Novak", "owner_url": "http://www.panoramio.com/user/66847"} + , + {"photo_id": 9633346, "photo_title": "Altstadt von Spello--Winner Contest of April 2008 First Prize of Travel Category", "photo_url": "http://www.panoramio.com/photo/9633346", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/9633346.jpg", "longitude": 12.672386, "latitude": 42.989236, "width": 347, "height": 500, "upload_date": "23 April 2008", "owner_id": 1400529, "owner_name": "marita1004", "owner_url": "http://www.panoramio.com/user/1400529"} + , + {"photo_id": 611425, "photo_title": "The Dome of Cologne", "photo_url": "http://www.panoramio.com/photo/611425", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/611425.jpg", "longitude": 6.968604, "latitude": 50.941157, "width": 500, "height": 357, "upload_date": "29 January 2007", "owner_id": 8058, "owner_name": "Ermanec", "owner_url": "http://www.panoramio.com/user/8058"} + , + {"photo_id": 6850661, "photo_title": "Në Fush të Pallaticës", "photo_url": "http://www.panoramio.com/photo/6850661", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6850661.jpg", "longitude": 21.075768, "latitude": 42.007915, "width": 488, "height": 500, "upload_date": "02 January 2008", "owner_id": 695042, "owner_name": "Neim Sejfuli ♦", "owner_url": "http://www.panoramio.com/user/695042"} + , + {"photo_id": 5617509, "photo_title": "Cölöp kiadó", "photo_url": "http://www.panoramio.com/photo/5617509", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5617509.jpg", "longitude": 12.333934, "latitude": 45.425368, "width": 500, "height": 334, "upload_date": "29 October 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 2083687, "photo_title": "Sunrise at Abu Simbel", "photo_url": "http://www.panoramio.com/photo/2083687", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2083687.jpg", "longitude": 31.630840, "latitude": 22.363729, "width": 500, "height": 335, "upload_date": "05 May 2007", "owner_id": 3316, "owner_name": "kristine hannon (www.traveltheglobe.be)", "owner_url": "http://www.panoramio.com/user/3316"} + , + {"photo_id": 7284083, "photo_title": "Japanese garden", "photo_url": "http://www.panoramio.com/photo/7284083", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/7284083.jpg", "longitude": -13.673172, "latitude": 21.259301, "width": 335, "height": 500, "upload_date": "22 January 2008", "owner_id": 232099, "owner_name": "mabut", "owner_url": "http://www.panoramio.com/user/232099"} + , + {"photo_id": 5750152, "photo_title": "Earth, Moon and Sky", "photo_url": "http://www.panoramio.com/photo/5750152", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5750152.jpg", "longitude": -117.560234, "latitude": 36.678057, "width": 333, "height": 500, "upload_date": "06 November 2007", "owner_id": 376395, "owner_name": "JeffSullivan (www.MyPhotoGuides.com)", "owner_url": "http://www.panoramio.com/user/376395"} + , + {"photo_id": 5633673, "photo_title": "Ridgely Farm Lane", "photo_url": "http://www.panoramio.com/photo/5633673", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5633673.jpg", "longitude": -78.775320, "latitude": 38.031867, "width": 500, "height": 378, "upload_date": "30 October 2007", "owner_id": 523038, "owner_name": "Yank in Dixie", "owner_url": "http://www.panoramio.com/user/523038"} + , + {"photo_id": 723090, "photo_title": "Grand Canyon (Havasupai)", "photo_url": "http://www.panoramio.com/photo/723090", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/723090.jpg", "longitude": -112.716293, "latitude": 36.270989, "width": 500, "height": 332, "upload_date": "07 February 2007", "owner_id": 66847, "owner_name": "Lukas Novak", "owner_url": "http://www.panoramio.com/user/66847"} + , + {"photo_id": 1226915, "photo_title": "Flamants roses sur l'Etang de Vaccarès", "photo_url": "http://www.panoramio.com/photo/1226915", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1226915.jpg", "longitude": 4.627304, "latitude": 43.551285, "width": 500, "height": 333, "upload_date": "08 March 2007", "owner_id": 78506, "owner_name": "Philippe Stoop", "owner_url": "http://www.panoramio.com/user/78506"} + , + {"photo_id": 2738883, "photo_title": "Tormenta", "photo_url": "http://www.panoramio.com/photo/2738883", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2738883.jpg", "longitude": -71.616096, "latitude": -33.042558, "width": 333, "height": 500, "upload_date": "14 June 2007", "owner_id": 477365, "owner_name": "✔chilefoto", "owner_url": "http://www.panoramio.com/user/477365"} + , + {"photo_id": 2875846, "photo_title": "Rannoch Moor, Scotland", "photo_url": "http://www.panoramio.com/photo/2875846", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2875846.jpg", "longitude": -4.745750, "latitude": 56.594467, "width": 500, "height": 462, "upload_date": "22 June 2007", "owner_id": 588149, "owner_name": "Adam Salwanowicz", "owner_url": "http://www.panoramio.com/user/588149"} + , + {"photo_id": 533456, "photo_title": "Zöld symphonia", "photo_url": "http://www.panoramio.com/photo/533456", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/533456.jpg", "longitude": 17.500362, "latitude": 47.843579, "width": 500, "height": 333, "upload_date": "22 January 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 3078609, "photo_title": "Pagan - Sunset Vista", "photo_url": "http://www.panoramio.com/photo/3078609", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3078609.jpg", "longitude": 94.884624, "latitude": 21.166644, "width": 500, "height": 329, "upload_date": "02 July 2007", "owner_id": 73104, "owner_name": "zerega", "owner_url": "http://www.panoramio.com/user/73104"} + , + {"photo_id": 1599459, "photo_title": "Rosina Lamberti - Templestowe Sunset", "photo_url": "http://www.panoramio.com/photo/1599459", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1599459.jpg", "longitude": 145.145187, "latitude": -37.773700, "width": 500, "height": 332, "upload_date": "02 April 2007", "owner_id": 140796, "owner_name": "rosina lamberti", "owner_url": "http://www.panoramio.com/user/140796"} + , + {"photo_id": 37097, "photo_title": "Burj Al Arab at Night", "photo_url": "http://www.panoramio.com/photo/37097", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/37097.jpg", "longitude": 55.190012, "latitude": 25.144411, "width": 333, "height": 500, "upload_date": "05 August 2006", "owner_id": 1295, "owner_name": "Matthew Walters", "owner_url": "http://www.panoramio.com/user/1295"} + , + {"photo_id": 42988, "photo_title": "Mekhong at Nakhon Phanom, Thailand", "photo_url": "http://www.panoramio.com/photo/42988", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/42988.jpg", "longitude": 104.780045, "latitude": 17.415348, "width": 500, "height": 375, "upload_date": "29 August 2006", "owner_id": 6386, "owner_name": "Uwe Werner", "owner_url": "http://www.panoramio.com/user/6386"} + , + {"photo_id": 4738551, "photo_title": "Aquakatedral", "photo_url": "http://www.panoramio.com/photo/4738551", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4738551.jpg", "longitude": 18.026505, "latitude": 47.279462, "width": 500, "height": 334, "upload_date": "18 September 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 6126327, "photo_title": "Autumnal Morning", "photo_url": "http://www.panoramio.com/photo/6126327", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6126327.jpg", "longitude": 0.209620, "latitude": 51.658827, "width": 500, "height": 500, "upload_date": "25 November 2007", "owner_id": 1130880, "owner_name": "marksimms", "owner_url": "http://www.panoramio.com/user/1130880"} + , + {"photo_id": 1390072, "photo_title": "Winter Wonder Woods", "photo_url": "http://www.panoramio.com/photo/1390072", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1390072.jpg", "longitude": -123.184891, "latitude": 49.400027, "width": 500, "height": 343, "upload_date": "19 March 2007", "owner_id": 164125, "owner_name": "DannyXu", "owner_url": "http://www.panoramio.com/user/164125"} + , + {"photo_id": 8600061, "photo_title": "Templio", "photo_url": "http://www.panoramio.com/photo/8600061", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/8600061.jpg", "longitude": 13.600258, "latitude": 37.288703, "width": 500, "height": 375, "upload_date": "17 March 2008", "owner_id": 325031, "owner_name": "Gibrail", "owner_url": "http://www.panoramio.com/user/325031"} + , + {"photo_id": 1232144, "photo_title": "the Wave", "photo_url": "http://www.panoramio.com/photo/1232144", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1232144.jpg", "longitude": -112.006313, "latitude": 36.995921, "width": 497, "height": 500, "upload_date": "08 March 2007", "owner_id": 256348, "owner_name": "DIEZ Jean-Paul", "owner_url": "http://www.panoramio.com/user/256348"} + , + {"photo_id": 12825028, "photo_title": "American Star shipwreck", "photo_url": "http://www.panoramio.com/photo/12825028", "photo_file_url": "http://static1.bareka.com/photos/medium/12825028.jpg", "longitude": -14.178050, "latitude": 28.345596, "width": 500, "height": 375, "upload_date": "05 August 2008", "owner_id": 1465912, "owner_name": "funtor", "owner_url": "http://www.panoramio.com/user/1465912"} + , + {"photo_id": 9705164, "photo_title": "Die blaue Stunde-Dresden", "photo_url": "http://www.panoramio.com/photo/9705164", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/9705164.jpg", "longitude": 13.732374, "latitude": 51.061020, "width": 500, "height": 333, "upload_date": "26 April 2008", "owner_id": 1465912, "owner_name": "funtor", "owner_url": "http://www.panoramio.com/user/1465912"} + , + {"photo_id": 9701147, "photo_title": "After the thunderstorm II (Calella de Palafrugell)", "photo_url": "http://www.panoramio.com/photo/9701147", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/9701147.jpg", "longitude": 3.185166, "latitude": 41.888413, "width": 500, "height": 347, "upload_date": "26 April 2008", "owner_id": 629243, "owner_name": "Olivier Faugeras", "owner_url": "http://www.panoramio.com/user/629243"} + , + {"photo_id": 3414277, "photo_title": "Morning at Vlixos_Lefkada", "photo_url": "http://www.panoramio.com/photo/3414277", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3414277.jpg", "longitude": 20.698693, "latitude": 38.689111, "width": 500, "height": 333, "upload_date": "20 July 2007", "owner_id": 242446, "owner_name": "Ntinos Lagos", "owner_url": "http://www.panoramio.com/user/242446"} + , + {"photo_id": 1205806, "photo_title": "A tavasz aranya", "photo_url": "http://www.panoramio.com/photo/1205806", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1205806.jpg", "longitude": 17.634773, "latitude": 47.557299, "width": 500, "height": 302, "upload_date": "07 March 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 6430261, "photo_title": "The wet side of winter", "photo_url": "http://www.panoramio.com/photo/6430261", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6430261.jpg", "longitude": 9.531434, "latitude": 48.559611, "width": 500, "height": 375, "upload_date": "11 December 2007", "owner_id": 424589, "owner_name": "PeSchn", "owner_url": "http://www.panoramio.com/user/424589"} + , + {"photo_id": 8116025, "photo_title": "Sale el Sol, Cae la Luna", "photo_url": "http://www.panoramio.com/photo/8116025", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/8116025.jpg", "longitude": -71.875992, "latitude": -41.170126, "width": 500, "height": 333, "upload_date": "26 February 2008", "owner_id": 4483, "owner_name": "Miguel Coranti", "owner_url": "http://www.panoramio.com/user/4483"} + , + {"photo_id": 1235514, "photo_title": "Pulau Menjangan", "photo_url": "http://www.panoramio.com/photo/1235514", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1235514.jpg", "longitude": 114.502687, "latitude": -8.095941, "width": 500, "height": 341, "upload_date": "09 March 2007", "owner_id": 232099, "owner_name": "mabut", "owner_url": "http://www.panoramio.com/user/232099"} + , + {"photo_id": 32827, "photo_title": "Xi'an Bell Tower", "photo_url": "http://www.panoramio.com/photo/32827", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/32827.jpg", "longitude": 108.943026, "latitude": 34.260759, "width": 500, "height": 375, "upload_date": "17 July 2006", "owner_id": 5168, "owner_name": "Markus Källander", "owner_url": "http://www.panoramio.com/user/5168"} + , + {"photo_id": 798014, "photo_title": "Porto Canale", "photo_url": "http://www.panoramio.com/photo/798014", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/798014.jpg", "longitude": 12.399648, "latitude": 44.203343, "width": 500, "height": 332, "upload_date": "12 February 2007", "owner_id": 159455, "owner_name": "©Franco Truscello", "owner_url": "http://www.panoramio.com/user/159455"} + , + {"photo_id": 10517317, "photo_title": "Route 66", "photo_url": "http://www.panoramio.com/photo/10517317", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/10517317.jpg", "longitude": 18.027492, "latitude": 46.268071, "width": 500, "height": 375, "upload_date": "23 May 2008", "owner_id": 328249, "owner_name": "v.zsoloo", "owner_url": "http://www.panoramio.com/user/328249"} + , + {"photo_id": 416838, "photo_title": "Old Faithful on New Year's Morning", "photo_url": "http://www.panoramio.com/photo/416838", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/416838.jpg", "longitude": -110.827900, "latitude": 44.459354, "width": 500, "height": 375, "upload_date": "13 January 2007", "owner_id": 71099, "owner_name": "Eve in Montana", "owner_url": "http://www.panoramio.com/user/71099"} + , + {"photo_id": 5964, "photo_title": "Skradin bridge", "photo_url": "http://www.panoramio.com/photo/5964", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5964.jpg", "longitude": 15.908031, "latitude": 43.806040, "width": 500, "height": 333, "upload_date": "17 December 2005", "owner_id": 989, "owner_name": "Mrgud", "owner_url": "http://www.panoramio.com/user/989"} + , + {"photo_id": 419923, "photo_title": "bandaibashi2", "photo_url": "http://www.panoramio.com/photo/419923", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/419923.jpg", "longitude": 139.055500, "latitude": 37.920029, "width": 334, "height": 500, "upload_date": "14 January 2007", "owner_id": 86411, "owner_name": "中村脩-Osamu nakamura", "owner_url": "http://www.panoramio.com/user/86411"} + , + {"photo_id": 26985, "photo_title": "Cementerio General", "photo_url": "http://www.panoramio.com/photo/26985", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/26985.jpg", "longitude": -84.091458, "latitude": 9.930174, "width": 393, "height": 500, "upload_date": "23 June 2006", "owner_id": 4112, "owner_name": "Roberto Garcia", "owner_url": "http://www.panoramio.com/user/4112"} + , + {"photo_id": 405866, "photo_title": "awasima", "photo_url": "http://www.panoramio.com/photo/405866", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/405866.jpg", "longitude": 139.229908, "latitude": 38.463267, "width": 396, "height": 500, "upload_date": "13 January 2007", "owner_id": 86411, "owner_name": "中村脩-Osamu nakamura", "owner_url": "http://www.panoramio.com/user/86411"} + , + {"photo_id": 1319538, "photo_title": "What a place !", "photo_url": "http://www.panoramio.com/photo/1319538", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1319538.jpg", "longitude": -62.542677, "latitude": 6.022092, "width": 329, "height": 500, "upload_date": "14 March 2007", "owner_id": 232099, "owner_name": "mabut", "owner_url": "http://www.panoramio.com/user/232099"} + , + {"photo_id": 444280, "photo_title": "Cigars are for ladies", "photo_url": "http://www.panoramio.com/photo/444280", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/444280.jpg", "longitude": -82.351027, "latitude": 23.139117, "width": 500, "height": 375, "upload_date": "15 January 2007", "owner_id": 57893, "owner_name": "ThoiryK", "owner_url": "http://www.panoramio.com/user/57893"} + , + {"photo_id": 6016, "photo_title": "Šibenik - tiramol", "photo_url": "http://www.panoramio.com/photo/6016", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6016.jpg", "longitude": 15.890865, "latitude": 43.735693, "width": 473, "height": 500, "upload_date": "18 December 2005", "owner_id": 991, "owner_name": "Mario Marotti", "owner_url": "http://www.panoramio.com/user/991"} + , + {"photo_id": 3531661, "photo_title": "Zúzmara", "photo_url": "http://www.panoramio.com/photo/3531661", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3531661.jpg", "longitude": 17.498131, "latitude": 47.847727, "width": 500, "height": 346, "upload_date": "25 July 2007", "owner_id": 689769, "owner_name": "Ponty István", "owner_url": "http://www.panoramio.com/user/689769"} + , + {"photo_id": 723088, "photo_title": "Friendly Evening Haze", "photo_url": "http://www.panoramio.com/photo/723088", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/723088.jpg", "longitude": 25.428715, "latitude": 36.421282, "width": 333, "height": 500, "upload_date": "07 February 2007", "owner_id": 66847, "owner_name": "Lukas Novak", "owner_url": "http://www.panoramio.com/user/66847"} + , + {"photo_id": 422813, "photo_title": "tanokami", "photo_url": "http://www.panoramio.com/photo/422813", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/422813.jpg", "longitude": 138.777237, "latitude": 37.581453, "width": 500, "height": 379, "upload_date": "14 January 2007", "owner_id": 86411, "owner_name": "中村脩-Osamu nakamura", "owner_url": "http://www.panoramio.com/user/86411"} + , + {"photo_id": 516256, "photo_title": "A hitehagyott", "photo_url": "http://www.panoramio.com/photo/516256", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/516256.jpg", "longitude": 17.533493, "latitude": 47.842139, "width": 500, "height": 291, "upload_date": "21 January 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 706978, "photo_title": "Snow at full moon", "photo_url": "http://www.panoramio.com/photo/706978", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/706978.jpg", "longitude": 23.878784, "latitude": 69.829207, "width": 500, "height": 334, "upload_date": "05 February 2007", "owner_id": 56091, "owner_name": "Kjetil Vaage Øie", "owner_url": "http://www.panoramio.com/user/56091"} + , + {"photo_id": 4994983, "photo_title": "Camogli - Castello della \"Dragonara\" (north-west looking photograph)", "photo_url": "http://www.panoramio.com/photo/4994983", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4994983.jpg", "longitude": 9.151220, "latitude": 44.350207, "width": 325, "height": 500, "upload_date": "30 September 2007", "owner_id": 180947, "owner_name": "gilberto silvestri", "owner_url": "http://www.panoramio.com/user/180947"} + , + {"photo_id": 1315255, "photo_title": "Tulpen in Holland", "photo_url": "http://www.panoramio.com/photo/1315255", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1315255.jpg", "longitude": 4.556494, "latitude": 52.278451, "width": 500, "height": 321, "upload_date": "14 March 2007", "owner_id": 193467, "owner_name": "Jörg Behmann", "owner_url": "http://www.panoramio.com/user/193467"} + , + {"photo_id": 5204412, "photo_title": "Alaska Range", "photo_url": "http://www.panoramio.com/photo/5204412", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5204412.jpg", "longitude": -150.150146, "latitude": 62.734601, "width": 500, "height": 375, "upload_date": "09 October 2007", "owner_id": 71099, "owner_name": "Eve in Montana", "owner_url": "http://www.panoramio.com/user/71099"} + , + {"photo_id": 5204668, "photo_title": "Scotland", "photo_url": "http://www.panoramio.com/photo/5204668", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5204668.jpg", "longitude": -4.821882, "latitude": 56.634188, "width": 500, "height": 500, "upload_date": "09 October 2007", "owner_id": 588149, "owner_name": "Adam Salwanowicz", "owner_url": "http://www.panoramio.com/user/588149"} + , + {"photo_id": 1706188, "photo_title": "Night", "photo_url": "http://www.panoramio.com/photo/1706188", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1706188.jpg", "longitude": 21.440957, "latitude": 48.427236, "width": 390, "height": 500, "upload_date": "09 April 2007", "owner_id": 346103, "owner_name": "lacitot", "owner_url": "http://www.panoramio.com/user/346103"} + , + {"photo_id": 6366165, "photo_title": "Il Latemar", "photo_url": "http://www.panoramio.com/photo/6366165", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6366165.jpg", "longitude": 11.575856, "latitude": 46.410138, "width": 500, "height": 375, "upload_date": "08 December 2007", "owner_id": 933456, "owner_name": "© Marco De Candido", "owner_url": "http://www.panoramio.com/user/933456"} + , + {"photo_id": 5433048, "photo_title": "moon photoshop", "photo_url": "http://www.panoramio.com/photo/5433048", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5433048.jpg", "longitude": 11.337848, "latitude": 46.460602, "width": 500, "height": 335, "upload_date": "20 October 2007", "owner_id": 578163, "owner_name": "Margherita-Italy", "owner_url": "http://www.panoramio.com/user/578163"} + , + {"photo_id": 611035, "photo_title": "Ice berg", "photo_url": "http://www.panoramio.com/photo/611035", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/611035.jpg", "longitude": -58.886719, "latitude": -63.470145, "width": 333, "height": 500, "upload_date": "29 January 2007", "owner_id": 14940, "owner_name": "elmtree", "owner_url": "http://www.panoramio.com/user/14940"} + , + {"photo_id": 4258269, "photo_title": "Új nap kelte", "photo_url": "http://www.panoramio.com/photo/4258269", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4258269.jpg", "longitude": 17.474785, "latitude": 47.832057, "width": 500, "height": 327, "upload_date": "28 August 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 37088, "photo_title": "Komandoo From The Air", "photo_url": "http://www.panoramio.com/photo/37088", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/37088.jpg", "longitude": 73.422661, "latitude": 5.496900, "width": 500, "height": 278, "upload_date": "05 August 2006", "owner_id": 1295, "owner_name": "Matthew Walters", "owner_url": "http://www.panoramio.com/user/1295"} + , + {"photo_id": 71667, "photo_title": "2006년06월11일(일) 장전계곡 및 단임골 046_resize", "photo_url": "http://www.panoramio.com/photo/71667", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/71667.jpg", "longitude": 128.533516, "latitude": 37.435340, "width": 500, "height": 333, "upload_date": "28 October 2006", "owner_id": 9424, "owner_name": "박범호", "owner_url": "http://www.panoramio.com/user/9424"} + , + {"photo_id": 5300468, "photo_title": "Lac du Vieux Emosson", "photo_url": "http://www.panoramio.com/photo/5300468", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5300468.jpg", "longitude": 6.883256, "latitude": 46.055744, "width": 500, "height": 500, "upload_date": "14 October 2007", "owner_id": 588149, "owner_name": "Adam Salwanowicz", "owner_url": "http://www.panoramio.com/user/588149"} + , + {"photo_id": 591351, "photo_title": "smokestack_8739", "photo_url": "http://www.panoramio.com/photo/591351", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/591351.jpg", "longitude": -79.386027, "latitude": 43.648168, "width": 500, "height": 392, "upload_date": "27 January 2007", "owner_id": 17488, "owner_name": "John Gillett", "owner_url": "http://www.panoramio.com/user/17488"} + , + {"photo_id": 11224316, "photo_title": "Remindful winter season-Vardar river", "photo_url": "http://www.panoramio.com/photo/11224316", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/11224316.jpg", "longitude": 21.084051, "latitude": 42.013782, "width": 214, "height": 500, "upload_date": "15 June 2008", "owner_id": 695042, "owner_name": "Neim Sejfuli ♦", "owner_url": "http://www.panoramio.com/user/695042"} + , + {"photo_id": 5968187, "photo_title": "2007 VITORIA Alava PIXELECTA", "photo_url": "http://www.panoramio.com/photo/5968187", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5968187.jpg", "longitude": -2.650087, "latitude": 42.860206, "width": 500, "height": 333, "upload_date": "17 November 2007", "owner_id": 163655, "owner_name": "[[[ PIXELECTA ]]]", "owner_url": "http://www.panoramio.com/user/163655"} + , + {"photo_id": 1781517, "photo_title": "Yosemite Falls in Winter", "photo_url": "http://www.panoramio.com/photo/1781517", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1781517.jpg", "longitude": -119.590130, "latitude": 37.744318, "width": 500, "height": 400, "upload_date": "15 April 2007", "owner_id": 376395, "owner_name": "JeffSullivan (www.MyPhotoGuides.com)", "owner_url": "http://www.panoramio.com/user/376395"} + , + {"photo_id": 5796376, "photo_title": "Shuto Expressway Loop Line in Nihombashi", "photo_url": "http://www.panoramio.com/photo/5796376", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5796376.jpg", "longitude": 139.776344, "latitude": 35.684536, "width": 327, "height": 500, "upload_date": "08 November 2007", "owner_id": 558055, "owner_name": "www.tokyoform.com", "owner_url": "http://www.panoramio.com/user/558055"} + , + {"photo_id": 5523741, "photo_title": "Saskatchewan Sunset October 24/07 (and there is the flat land of the prairies at the bottom of this pic ;)", "photo_url": "http://www.panoramio.com/photo/5523741", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5523741.jpg", "longitude": -105.535011, "latitude": 50.502073, "width": 375, "height": 500, "upload_date": "24 October 2007", "owner_id": 133037, "owner_name": "Lilypon", "owner_url": "http://www.panoramio.com/user/133037"} + , + {"photo_id": 196125, "photo_title": "arnía y covachos", "photo_url": "http://www.panoramio.com/photo/196125", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/196125.jpg", "longitude": -3.914223, "latitude": 43.474349, "width": 500, "height": 337, "upload_date": "20 December 2006", "owner_id": 38804, "owner_name": "www.oscarsanchez.net", "owner_url": "http://www.panoramio.com/user/38804"} + , + {"photo_id": 349726, "photo_title": "thailand ko-samui sunset", "photo_url": "http://www.panoramio.com/photo/349726", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/349726.jpg", "longitude": 99.930954, "latitude": 9.472344, "width": 500, "height": 334, "upload_date": "08 January 2007", "owner_id": 69671, "owner_name": "illusandpics.com", "owner_url": "http://www.panoramio.com/user/69671"} + , + {"photo_id": 280106, "photo_title": "dune01", "photo_url": "http://www.panoramio.com/photo/280106", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/280106.jpg", "longitude": -5.089073, "latitude": 30.229408, "width": 500, "height": 345, "upload_date": "01 January 2007", "owner_id": 58867, "owner_name": "Lachaud Franck", "owner_url": "http://www.panoramio.com/user/58867"} + , + {"photo_id": 4446015, "photo_title": "Mennyei fényjáték", "photo_url": "http://www.panoramio.com/photo/4446015", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4446015.jpg", "longitude": 17.818108, "latitude": 47.525084, "width": 500, "height": 333, "upload_date": "06 September 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 4644180, "photo_title": "Bridalveil Falls from Valley View", "photo_url": "http://www.panoramio.com/photo/4644180", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4644180.jpg", "longitude": -119.661723, "latitude": 37.717419, "width": 500, "height": 357, "upload_date": "14 September 2007", "owner_id": 376395, "owner_name": "JeffSullivan (www.MyPhotoGuides.com)", "owner_url": "http://www.panoramio.com/user/376395"} + , + {"photo_id": 457302, "photo_title": "Matterhorn Zermatt", "photo_url": "http://www.panoramio.com/photo/457302", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/457302.jpg", "longitude": 7.746391, "latitude": 46.016992, "width": 500, "height": 375, "upload_date": "16 January 2007", "owner_id": 47930, "owner_name": "werni", "owner_url": "http://www.panoramio.com/user/47930"} + , + {"photo_id": 4258138, "photo_title": "Szentkút", "photo_url": "http://www.panoramio.com/photo/4258138", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4258138.jpg", "longitude": 17.731848, "latitude": 47.243755, "width": 500, "height": 334, "upload_date": "28 August 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 26986, "photo_title": "Cementerio General", "photo_url": "http://www.panoramio.com/photo/26986", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/26986.jpg", "longitude": -84.091158, "latitude": 9.930047, "width": 500, "height": 373, "upload_date": "23 June 2006", "owner_id": 4112, "owner_name": "Roberto Garcia", "owner_url": "http://www.panoramio.com/user/4112"} + , + {"photo_id": 1269869, "photo_title": "Barents Sea at night, Finnmark, Norway", "photo_url": "http://www.panoramio.com/photo/1269869", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1269869.jpg", "longitude": 30.868149, "latitude": 70.438638, "width": 500, "height": 324, "upload_date": "11 March 2007", "owner_id": 66734, "owner_name": "Svein Solhaug", "owner_url": "http://www.panoramio.com/user/66734"} + , + {"photo_id": 515971, "photo_title": "A hosszútávfutó magányossága", "photo_url": "http://www.panoramio.com/photo/515971", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/515971.jpg", "longitude": 17.870121, "latitude": 47.373012, "width": 500, "height": 276, "upload_date": "21 January 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 36486, "photo_title": "Sunrise on Trondheimsfjord", "photo_url": "http://www.panoramio.com/photo/36486", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/36486.jpg", "longitude": 10.333843, "latitude": 63.456186, "width": 500, "height": 332, "upload_date": "02 August 2006", "owner_id": 5703, "owner_name": "dancer", "owner_url": "http://www.panoramio.com/user/5703"} + , + {"photo_id": 4950702, "photo_title": "Abandoned Gas Stand, Hachimantai, Iwate, Japan", "photo_url": "http://www.panoramio.com/photo/4950702", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4950702.jpg", "longitude": 141.062308, "latitude": 39.955547, "width": 500, "height": 335, "upload_date": "28 September 2007", "owner_id": 699984, "owner_name": "Fried Toast", "owner_url": "http://www.panoramio.com/user/699984"} + , + {"photo_id": 2345653, "photo_title": "planet mars", "photo_url": "http://www.panoramio.com/photo/2345653", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2345653.jpg", "longitude": 33.631908, "latitude": 27.380118, "width": 500, "height": 322, "upload_date": "22 May 2007", "owner_id": 223374, "owner_name": "voutsen", "owner_url": "http://www.panoramio.com/user/223374"} + , + {"photo_id": 4612307, "photo_title": "Sitges - Spinaker", "photo_url": "http://www.panoramio.com/photo/4612307", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4612307.jpg", "longitude": 1.859436, "latitude": 41.211722, "width": 500, "height": 371, "upload_date": "13 September 2007", "owner_id": 138691, "owner_name": "Josep Maria Alegre", "owner_url": "http://www.panoramio.com/user/138691"} + , + {"photo_id": 4644311, "photo_title": "Through the Looking Glass", "photo_url": "http://www.panoramio.com/photo/4644311", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4644311.jpg", "longitude": -119.649745, "latitude": 37.722019, "width": 333, "height": 500, "upload_date": "14 September 2007", "owner_id": 376395, "owner_name": "JeffSullivan (www.MyPhotoGuides.com)", "owner_url": "http://www.panoramio.com/user/376395"} + , + {"photo_id": 1480664, "photo_title": "Királyi szurkolótábor", "photo_url": "http://www.panoramio.com/photo/1480664", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1480664.jpg", "longitude": 17.300034, "latitude": 47.190646, "width": 500, "height": 269, "upload_date": "24 March 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 8492774, "photo_title": "Lago Fedaia in estate Panoramio and ATP first CONTEST, March 2008, category Scenery : awarded \" Honorable Mention\". Many thanks to all voters", "photo_url": "http://www.panoramio.com/photo/8492774", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/8492774.jpg", "longitude": 11.867519, "latitude": 46.463128, "width": 500, "height": 375, "upload_date": "12 March 2008", "owner_id": 6033, "owner_name": "► Marco Vanzo", "owner_url": "http://www.panoramio.com/user/6033"} + , + {"photo_id": 57835, "photo_title": "Seewaldsee 2 - St.Koloman", "photo_url": "http://www.panoramio.com/photo/57835", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/57835.jpg", "longitude": 13.274918, "latitude": 47.630115, "width": 500, "height": 333, "upload_date": "05 October 2006", "owner_id": 8060, "owner_name": "Norbert MAIER", "owner_url": "http://www.panoramio.com/user/8060"} + , + {"photo_id": 57837, "photo_title": "Der Hraunfossar an einem kalten Wintertag .....(MS)", "photo_url": "http://www.panoramio.com/photo/57837", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/57837.jpg", "longitude": -20.939941, "latitude": 64.698078, "width": 500, "height": 264, "upload_date": "05 October 2006", "owner_id": 7434, "owner_name": "baldinger reisen ag, waedenswil/switzerland", "owner_url": "http://www.panoramio.com/user/7434"} + , + {"photo_id": 70641, "photo_title": "Lake Nakuru (Kenya)", "photo_url": "http://www.panoramio.com/photo/70641", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/70641.jpg", "longitude": 36.114979, "latitude": -0.324782, "width": 500, "height": 333, "upload_date": "25 October 2006", "owner_id": 8975, "owner_name": "Laura Sayalero", "owner_url": "http://www.panoramio.com/user/8975"} + , + {"photo_id": 766205, "photo_title": "posta sol porto colom", "photo_url": "http://www.panoramio.com/photo/766205", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/766205.jpg", "longitude": 3.264495, "latitude": 39.425093, "width": 500, "height": 335, "upload_date": "10 February 2007", "owner_id": 134682, "owner_name": "------ Cafate ------", "owner_url": "http://www.panoramio.com/user/134682"} + , + {"photo_id": 10662910, "photo_title": "Megvilágosodván", "photo_url": "http://www.panoramio.com/photo/10662910", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/10662910.jpg", "longitude": 17.718544, "latitude": 47.460130, "width": 500, "height": 334, "upload_date": "27 May 2008", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 8703547, "photo_title": "Lonely bike-rider", "photo_url": "http://www.panoramio.com/photo/8703547", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/8703547.jpg", "longitude": 6.039004, "latitude": 52.208974, "width": 500, "height": 467, "upload_date": "21 March 2008", "owner_id": 523564, "owner_name": "Luud Riphagen", "owner_url": "http://www.panoramio.com/user/523564"} + , + {"photo_id": 11669907, "photo_title": "Alba sulle pale di San Martino", "photo_url": "http://www.panoramio.com/photo/11669907", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/11669907.jpg", "longitude": 11.568518, "latitude": 46.345269, "width": 500, "height": 361, "upload_date": "30 June 2008", "owner_id": 6033, "owner_name": "► Marco Vanzo", "owner_url": "http://www.panoramio.com/user/6033"} + , + {"photo_id": 11403916, "photo_title": "Lonely", "photo_url": "http://www.panoramio.com/photo/11403916", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/11403916.jpg", "longitude": 18.164520, "latitude": 46.345269, "width": 500, "height": 375, "upload_date": "21 June 2008", "owner_id": 328249, "owner_name": "v.zsoloo", "owner_url": "http://www.panoramio.com/user/328249"} + , + {"photo_id": 289803, "photo_title": "Rain Clouds", "photo_url": "http://www.panoramio.com/photo/289803", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/289803.jpg", "longitude": -57.733154, "latitude": -51.661908, "width": 500, "height": 335, "upload_date": "03 January 2007", "owner_id": 61890, "owner_name": "enriquevidalphoto.com", "owner_url": "http://www.panoramio.com/user/61890"} + , + {"photo_id": 123413, "photo_title": "Paisaje cromático de Landmanalaugar", "photo_url": "http://www.panoramio.com/photo/123413", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/123413.jpg", "longitude": -19.085140, "latitude": 63.918285, "width": 500, "height": 332, "upload_date": "12 December 2006", "owner_id": 20549, "owner_name": "oscarvg", "owner_url": "http://www.panoramio.com/user/20549"} + , + {"photo_id": 595734, "photo_title": "Sphinx profile", "photo_url": "http://www.panoramio.com/photo/595734", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/595734.jpg", "longitude": 31.137791, "latitude": 29.975034, "width": 500, "height": 330, "upload_date": "27 January 2007", "owner_id": 124418, "owner_name": "Pierre-Jean Durieu", "owner_url": "http://www.panoramio.com/user/124418"} + , + {"photo_id": 3282726, "photo_title": "Shanghai - Inside the Jinmao Tower", "photo_url": "http://www.panoramio.com/photo/3282726", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3282726.jpg", "longitude": 121.501153, "latitude": 31.237519, "width": 500, "height": 335, "upload_date": "13 July 2007", "owner_id": 578163, "owner_name": "Margherita-Italy", "owner_url": "http://www.panoramio.com/user/578163"} + , + {"photo_id": 1346342, "photo_title": "nemrut", "photo_url": "http://www.panoramio.com/photo/1346342", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1346342.jpg", "longitude": 38.761826, "latitude": 38.042413, "width": 340, "height": 500, "upload_date": "16 March 2007", "owner_id": 2659, "owner_name": "ozalph", "owner_url": "http://www.panoramio.com/user/2659"} + , + {"photo_id": 151849, "photo_title": "panoramas photo @ the cross at Xin-Yi and Kee-Lung road ( my 2nd try )", "photo_url": "http://www.panoramio.com/photo/151849", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/151849.jpg", "longitude": 121.559209, "latitude": 25.033073, "width": 500, "height": 348, "upload_date": "15 December 2006", "owner_id": 27791, "owner_name": "Jerome Chen", "owner_url": "http://www.panoramio.com/user/27791"} + , + {"photo_id": 1212973, "photo_title": "Perhaps Neruda's View", "photo_url": "http://www.panoramio.com/photo/1212973", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1212973.jpg", "longitude": 14.398935, "latitude": 50.084752, "width": 500, "height": 333, "upload_date": "07 March 2007", "owner_id": 66847, "owner_name": "Lukas Novak", "owner_url": "http://www.panoramio.com/user/66847"} + , + {"photo_id": 809789, "photo_title": "Pihike", "photo_url": "http://www.panoramio.com/photo/809789", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/809789.jpg", "longitude": 17.457018, "latitude": 47.881010, "width": 500, "height": 387, "upload_date": "13 February 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 88150, "photo_title": "Marmore Falls - Umbria - Italy", "photo_url": "http://www.panoramio.com/photo/88150", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/88150.jpg", "longitude": 12.716667, "latitude": 42.550000, "width": 375, "height": 500, "upload_date": "28 November 2006", "owner_id": 11098, "owner_name": "Michele Masnata", "owner_url": "http://www.panoramio.com/user/11098"} + , + {"photo_id": 624990, "photo_title": "Mélyrepülés", "photo_url": "http://www.panoramio.com/photo/624990", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/624990.jpg", "longitude": 17.455988, "latitude": 47.881931, "width": 500, "height": 288, "upload_date": "30 January 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 612449, "photo_title": "Rio de Janeiro - Vista do Corcovado ©G.Schüür", "photo_url": "http://www.panoramio.com/photo/612449", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/612449.jpg", "longitude": -43.210323, "latitude": -22.951463, "width": 500, "height": 400, "upload_date": "29 January 2007", "owner_id": 120756, "owner_name": "Germano Schüür", "owner_url": "http://www.panoramio.com/user/120756"} + , + {"photo_id": 1545313, "photo_title": "Tempestade", "photo_url": "http://www.panoramio.com/photo/1545313", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1545313.jpg", "longitude": -48.678703, "latitude": -26.643470, "width": 500, "height": 341, "upload_date": "29 March 2007", "owner_id": 160342, "owner_name": "Jakson Santos", "owner_url": "http://www.panoramio.com/user/160342"} + , + {"photo_id": 1595492, "photo_title": "Explosión Rosa", "photo_url": "http://www.panoramio.com/photo/1595492", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1595492.jpg", "longitude": -73.250393, "latitude": -39.813481, "width": 500, "height": 375, "upload_date": "02 April 2007", "owner_id": 327310, "owner_name": "Erwin Woenckhaus", "owner_url": "http://www.panoramio.com/user/327310"} + , + {"photo_id": 5501284, "photo_title": "Da qui passano i sogni...", "photo_url": "http://www.panoramio.com/photo/5501284", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5501284.jpg", "longitude": 12.335930, "latitude": 45.435563, "width": 375, "height": 500, "upload_date": "23 October 2007", "owner_id": 325031, "owner_name": "Gibrail", "owner_url": "http://www.panoramio.com/user/325031"} + , + {"photo_id": 444265, "photo_title": "Cafe, Calle and Capitol of Cuba", "photo_url": "http://www.panoramio.com/photo/444265", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/444265.jpg", "longitude": -82.350453, "latitude": 23.136354, "width": 500, "height": 375, "upload_date": "15 January 2007", "owner_id": 57893, "owner_name": "ThoiryK", "owner_url": "http://www.panoramio.com/user/57893"} + , + {"photo_id": 9590, "photo_title": "South Street Seaport and Financial Center Skyline [007783]", "photo_url": "http://www.panoramio.com/photo/9590", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/9590.jpg", "longitude": -74.001760, "latitude": 40.704937, "width": 500, "height": 375, "upload_date": "04 February 2006", "owner_id": 1489, "owner_name": "Thorsten", "owner_url": "http://www.panoramio.com/user/1489"} + , + {"photo_id": 204153, "photo_title": "Stormheimfjell and Hamperokken mountains near Brevikeidet ", "photo_url": "http://www.panoramio.com/photo/204153", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/204153.jpg", "longitude": 19.650421, "latitude": 69.668899, "width": 500, "height": 375, "upload_date": "21 December 2006", "owner_id": 39160, "owner_name": "Snemann", "owner_url": "http://www.panoramio.com/user/39160"} + , + {"photo_id": 916095, "photo_title": "Before daybreak on Mount Etna (as seen from Piano Provenzana)", "photo_url": "http://www.panoramio.com/photo/916095", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/916095.jpg", "longitude": 15.038610, "latitude": 37.793881, "width": 500, "height": 375, "upload_date": "20 February 2007", "owner_id": 67714, "owner_name": "Robert Gulyas", "owner_url": "http://www.panoramio.com/user/67714"} + , + {"photo_id": 680320, "photo_title": "A severe storm approaches Nyngan, NSW www.ozthunder.com", "photo_url": "http://www.panoramio.com/photo/680320", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/680320.jpg", "longitude": 147.154312, "latitude": -31.563910, "width": 500, "height": 378, "upload_date": "04 February 2007", "owner_id": 67208, "owner_name": "Michael Thompson", "owner_url": "http://www.panoramio.com/user/67208"} + , + {"photo_id": 6018, "photo_title": "Jadrija - barke", "photo_url": "http://www.panoramio.com/photo/6018", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6018.jpg", "longitude": 15.841599, "latitude": 43.725026, "width": 500, "height": 176, "upload_date": "18 December 2005", "owner_id": 991, "owner_name": "Mario Marotti", "owner_url": "http://www.panoramio.com/user/991"} + , + {"photo_id": 36485, "photo_title": "Great Belt Bridge", "photo_url": "http://www.panoramio.com/photo/36485", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/36485.jpg", "longitude": 11.029501, "latitude": 55.342130, "width": 500, "height": 332, "upload_date": "02 August 2006", "owner_id": 5703, "owner_name": "dancer", "owner_url": "http://www.panoramio.com/user/5703"} + , + {"photo_id": 19098, "photo_title": "Jökulsárlón", "photo_url": "http://www.panoramio.com/photo/19098", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/19098.jpg", "longitude": -16.355896, "latitude": 64.037351, "width": 500, "height": 333, "upload_date": "02 May 2006", "owner_id": 2885, "owner_name": "Luis Rodríguez Baena", "owner_url": "http://www.panoramio.com/user/2885"} + , + {"photo_id": 55458, "photo_title": "034 Troianisches Pferd", "photo_url": "http://www.panoramio.com/photo/55458", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/55458.jpg", "longitude": 26.240464, "latitude": 39.957188, "width": 375, "height": 500, "upload_date": "01 October 2006", "owner_id": 7633, "owner_name": "Daniel Meyer", "owner_url": "http://www.panoramio.com/user/7633"} + , + {"photo_id": 1800357, "photo_title": "Beach & Evening Light - Garrapata State Park Big Sur, CA", "photo_url": "http://www.panoramio.com/photo/1800357", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1800357.jpg", "longitude": -121.925915, "latitude": 36.455437, "width": 500, "height": 345, "upload_date": "16 April 2007", "owner_id": 107613, "owner_name": "Tom Grubbe", "owner_url": "http://www.panoramio.com/user/107613"} + , + {"photo_id": 1447086, "photo_title": "Odyssey", "photo_url": "http://www.panoramio.com/photo/1447086", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1447086.jpg", "longitude": 15.923395, "latitude": 43.589530, "width": 500, "height": 323, "upload_date": "22 March 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 10378421, "photo_title": "Red Bus", "photo_url": "http://www.panoramio.com/photo/10378421", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/10378421.jpg", "longitude": -0.124497, "latitude": 51.500809, "width": 414, "height": 500, "upload_date": "19 May 2008", "owner_id": 325031, "owner_name": "Gibrail", "owner_url": "http://www.panoramio.com/user/325031"} + , + {"photo_id": 1087672, "photo_title": "És azután menydörgést hallottunk...", "photo_url": "http://www.panoramio.com/photo/1087672", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1087672.jpg", "longitude": 15.917473, "latitude": 43.590836, "width": 500, "height": 299, "upload_date": "28 February 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 74950, "photo_title": "高千穂", "photo_url": "http://www.panoramio.com/photo/74950", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/74950.jpg", "longitude": 131.019516, "latitude": 32.320504, "width": 500, "height": 375, "upload_date": "03 November 2006", "owner_id": 9556, "owner_name": "shigesato", "owner_url": "http://www.panoramio.com/user/9556"} + , + {"photo_id": 1749978, "photo_title": "Campos de Criptana", "photo_url": "http://www.panoramio.com/photo/1749978", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1749978.jpg", "longitude": -3.123207, "latitude": 39.409805, "width": 500, "height": 334, "upload_date": "12 April 2007", "owner_id": 10969, "owner_name": "Juanra", "owner_url": "http://www.panoramio.com/user/10969"} + , + {"photo_id": 94171, "photo_title": "Matsumoto Castle", "photo_url": "http://www.panoramio.com/photo/94171", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/94171.jpg", "longitude": 137.967778, "latitude": 36.239194, "width": 408, "height": 500, "upload_date": "09 December 2006", "owner_id": 11781, "owner_name": "ANDRE GARDELLA", "owner_url": "http://www.panoramio.com/user/11781"} + , + {"photo_id": 2053084, "photo_title": "Blue lagoon, Melchior islands", "photo_url": "http://www.panoramio.com/photo/2053084", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2053084.jpg", "longitude": -62.830811, "latitude": -64.415921, "width": 500, "height": 336, "upload_date": "03 May 2007", "owner_id": 3316, "owner_name": "kristine hannon (www.traveltheglobe.be)", "owner_url": "http://www.panoramio.com/user/3316"} + , + {"photo_id": 86244, "photo_title": "Palmeras", "photo_url": "http://www.panoramio.com/photo/86244", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/86244.jpg", "longitude": -1.116829, "latitude": 37.930930, "width": 333, "height": 500, "upload_date": "25 November 2006", "owner_id": 10969, "owner_name": "Juanra", "owner_url": "http://www.panoramio.com/user/10969"} + , + {"photo_id": 629489, "photo_title": "Hare in winter fur...beast of the Cave of Caerbannog.", "photo_url": "http://www.panoramio.com/photo/629489", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/629489.jpg", "longitude": -105.645390, "latitude": 40.296593, "width": 500, "height": 376, "upload_date": "31 January 2007", "owner_id": 87752, "owner_name": "Richard Ryer", "owner_url": "http://www.panoramio.com/user/87752"} + , + {"photo_id": 8459506, "photo_title": "Baltic sunrise in Kiel", "photo_url": "http://www.panoramio.com/photo/8459506", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/8459506.jpg", "longitude": 10.169671, "latitude": 54.430970, "width": 500, "height": 375, "upload_date": "11 March 2008", "owner_id": 73946, "owner_name": "pembo", "owner_url": "http://www.panoramio.com/user/73946"} + , + {"photo_id": 36599, "photo_title": "ц Зачатия Анны на Углу", "photo_url": "http://www.panoramio.com/photo/36599", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/36599.jpg", "longitude": 37.630963, "latitude": 55.750159, "width": 500, "height": 375, "upload_date": "03 August 2006", "owner_id": 5641, "owner_name": "sergey duhanin", "owner_url": "http://www.panoramio.com/user/5641"} + , + {"photo_id": 62716, "photo_title": "Amanecer en la Sauceda", "photo_url": "http://www.panoramio.com/photo/62716", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/62716.jpg", "longitude": -5.591730, "latitude": 36.521630, "width": 500, "height": 330, "upload_date": "15 October 2006", "owner_id": 473, "owner_name": "Juanlu", "owner_url": "http://www.panoramio.com/user/473"} + , + {"photo_id": 4709631, "photo_title": "The sun sets in the East....", "photo_url": "http://www.panoramio.com/photo/4709631", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4709631.jpg", "longitude": -112.624583, "latitude": 45.211038, "width": 500, "height": 375, "upload_date": "17 September 2007", "owner_id": 71099, "owner_name": "Eve in Montana", "owner_url": "http://www.panoramio.com/user/71099"} + , + {"photo_id": 11408203, "photo_title": "05-08-31_Paramo de MASA_PIXELECTA", "photo_url": "http://www.panoramio.com/photo/11408203", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/11408203.jpg", "longitude": -3.536568, "latitude": 42.669357, "width": 500, "height": 375, "upload_date": "21 June 2008", "owner_id": 163655, "owner_name": "[[[ PIXELECTA ]]]", "owner_url": "http://www.panoramio.com/user/163655"} + , + {"photo_id": 416263, "photo_title": "Mt. Meeker at Dawn", "photo_url": "http://www.panoramio.com/photo/416263", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/416263.jpg", "longitude": -105.579643, "latitude": 40.270472, "width": 500, "height": 374, "upload_date": "13 January 2007", "owner_id": 87752, "owner_name": "Richard Ryer", "owner_url": "http://www.panoramio.com/user/87752"} + , + {"photo_id": 1289233, "photo_title": " High Dades", "photo_url": "http://www.panoramio.com/photo/1289233", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1289233.jpg", "longitude": -5.838375, "latitude": 31.652066, "width": 500, "height": 329, "upload_date": "12 March 2007", "owner_id": 232099, "owner_name": "mabut", "owner_url": "http://www.panoramio.com/user/232099"} + , + {"photo_id": 1567767, "photo_title": "Rosina Lamberti - Sunset Templestowe, 31 March 2007", "photo_url": "http://www.panoramio.com/photo/1567767", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1567767.jpg", "longitude": 145.133858, "latitude": -37.765015, "width": 500, "height": 237, "upload_date": "31 March 2007", "owner_id": 140796, "owner_name": "rosina lamberti", "owner_url": "http://www.panoramio.com/user/140796"} + , + {"photo_id": 4130842, "photo_title": "Árvore Solar", "photo_url": "http://www.panoramio.com/photo/4130842", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4130842.jpg", "longitude": -51.830320, "latitude": -22.939424, "width": 427, "height": 500, "upload_date": "23 August 2007", "owner_id": 465654, "owner_name": "Carlos Sica", "owner_url": "http://www.panoramio.com/user/465654"} + , + {"photo_id": 340508, "photo_title": "Sunset from Camelback Mountain Echo Trail", "photo_url": "http://www.panoramio.com/photo/340508", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/340508.jpg", "longitude": -111.969969, "latitude": 33.520820, "width": 333, "height": 500, "upload_date": "08 January 2007", "owner_id": 45308, "owner_name": "Mike Cavaroc", "owner_url": "http://www.panoramio.com/user/45308"} + , + {"photo_id": 74792, "photo_title": "annapurna south", "photo_url": "http://www.panoramio.com/photo/74792", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/74792.jpg", "longitude": 83.804398, "latitude": 28.524813, "width": 500, "height": 334, "upload_date": "03 November 2006", "owner_id": 9812, "owner_name": "wsm earp", "owner_url": "http://www.panoramio.com/user/9812"} + , + {"photo_id": 4445995, "photo_title": "Ködvarázs", "photo_url": "http://www.panoramio.com/photo/4445995", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4445995.jpg", "longitude": 18.053970, "latitude": 47.276783, "width": 500, "height": 334, "upload_date": "06 September 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 3032620, "photo_title": "Mira sin bueyes", "photo_url": "http://www.panoramio.com/photo/3032620", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3032620.jpg", "longitude": -8.802710, "latitude": 40.459324, "width": 500, "height": 327, "upload_date": "30 June 2007", "owner_id": 129297, "owner_name": "Enrique Ortiz de Zárate", "owner_url": "http://www.panoramio.com/user/129297"} + , + {"photo_id": 415533, "photo_title": "Manila Sunset", "photo_url": "http://www.panoramio.com/photo/415533", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/415533.jpg", "longitude": 120.984208, "latitude": 14.572339, "width": 333, "height": 500, "upload_date": "13 January 2007", "owner_id": 20398, "owner_name": "boerx", "owner_url": "http://www.panoramio.com/user/20398"} + , + {"photo_id": 723004, "photo_title": "Bouncing Light", "photo_url": "http://www.panoramio.com/photo/723004", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/723004.jpg", "longitude": 25.379276, "latitude": 36.461468, "width": 500, "height": 332, "upload_date": "07 February 2007", "owner_id": 66847, "owner_name": "Lukas Novak", "owner_url": "http://www.panoramio.com/user/66847"} + , + {"photo_id": 2514494, "photo_title": "klatschmohn bis zum Horizont", "photo_url": "http://www.panoramio.com/photo/2514494", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2514494.jpg", "longitude": 12.025051, "latitude": 54.145244, "width": 500, "height": 334, "upload_date": "01 June 2007", "owner_id": 82603, "owner_name": "HelgeNug", "owner_url": "http://www.panoramio.com/user/82603"} + , + {"photo_id": 436289, "photo_title": "koaganogawa", "photo_url": "http://www.panoramio.com/photo/436289", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/436289.jpg", "longitude": 139.065456, "latitude": 37.831548, "width": 500, "height": 341, "upload_date": "15 January 2007", "owner_id": 86411, "owner_name": "中村脩-Osamu nakamura", "owner_url": "http://www.panoramio.com/user/86411"} + , + {"photo_id": 73027, "photo_title": "Concourse, British Museum", "photo_url": "http://www.panoramio.com/photo/73027", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/73027.jpg", "longitude": -0.127201, "latitude": 51.519532, "width": 500, "height": 326, "upload_date": "29 October 2006", "owner_id": 1295, "owner_name": "Matthew Walters", "owner_url": "http://www.panoramio.com/user/1295"} + , + {"photo_id": 9766996, "photo_title": "Racetrack Playa", "photo_url": "http://www.panoramio.com/photo/9766996", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/9766996.jpg", "longitude": -117.558091, "latitude": 36.664815, "width": 388, "height": 500, "upload_date": "29 April 2008", "owner_id": 308300, "owner_name": "Tony R Immoos", "owner_url": "http://www.panoramio.com/user/308300"} + , + {"photo_id": 1455193, "photo_title": "Вулкан Карымский, со склона вулкана Малый Семячик", "photo_url": "http://www.panoramio.com/photo/1455193", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1455193.jpg", "longitude": 159.626970, "latitude": 54.133227, "width": 500, "height": 345, "upload_date": "23 March 2007", "owner_id": 268724, "owner_name": "Korotnev AV", "owner_url": "http://www.panoramio.com/user/268724"} + , + {"photo_id": 1234797, "photo_title": "Sahalie Falls, Mckenzie River", "photo_url": "http://www.panoramio.com/photo/1234797", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1234797.jpg", "longitude": -121.997187, "latitude": 44.348769, "width": 500, "height": 420, "upload_date": "09 March 2007", "owner_id": 128746, "owner_name": "© Michael Hatten", "owner_url": "http://www.panoramio.com/user/128746"} + , + {"photo_id": 3989102, "photo_title": "El Gran Miércoles", "photo_url": "http://www.panoramio.com/photo/3989102", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3989102.jpg", "longitude": -17.991056, "latitude": 27.797638, "width": 500, "height": 375, "upload_date": "17 August 2007", "owner_id": 787217, "owner_name": "♣ Víctor S de Lara ♣", "owner_url": "http://www.panoramio.com/user/787217"} + , + {"photo_id": 85625, "photo_title": "Cañón de Valdeinfiernos", "photo_url": "http://www.panoramio.com/photo/85625", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/85625.jpg", "longitude": -1.961060, "latitude": 37.801511, "width": 333, "height": 500, "upload_date": "24 November 2006", "owner_id": 10969, "owner_name": "Juanra", "owner_url": "http://www.panoramio.com/user/10969"} + , + {"photo_id": 4558716, "photo_title": "Corsica - West Coast", "photo_url": "http://www.panoramio.com/photo/4558716", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4558716.jpg", "longitude": 8.655338, "latitude": 42.253108, "width": 500, "height": 341, "upload_date": "10 September 2007", "owner_id": 49870, "owner_name": "Jean-Michel Raggioli", "owner_url": "http://www.panoramio.com/user/49870"} + , + {"photo_id": 3201916, "photo_title": "Mönch", "photo_url": "http://www.panoramio.com/photo/3201916", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3201916.jpg", "longitude": 7.640026, "latitude": 46.745537, "width": 500, "height": 374, "upload_date": "09 July 2007", "owner_id": 635422, "owner_name": "♫ Swissmay", "owner_url": "http://www.panoramio.com/user/635422"} + , + {"photo_id": 4365440, "photo_title": "a piece of wood", "photo_url": "http://www.panoramio.com/photo/4365440", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4365440.jpg", "longitude": -1.254158, "latitude": 44.480463, "width": 221, "height": 500, "upload_date": "03 September 2007", "owner_id": 521836, "owner_name": "KLEFER", "owner_url": "http://www.panoramio.com/user/521836"} + , + {"photo_id": 124545, "photo_title": "66_St-Cyp_vagues_01", "photo_url": "http://www.panoramio.com/photo/124545", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/124545.jpg", "longitude": 3.037736, "latitude": 42.623436, "width": 500, "height": 333, "upload_date": "12 December 2006", "owner_id": 18696, "owner_name": "Besnard", "owner_url": "http://www.panoramio.com/user/18696"} + , + {"photo_id": 65666, "photo_title": "Barco fantasma", "photo_url": "http://www.panoramio.com/photo/65666", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/65666.jpg", "longitude": -14.179380, "latitude": 28.344878, "width": 500, "height": 375, "upload_date": "18 October 2006", "owner_id": 8658, "owner_name": "Canarina", "owner_url": "http://www.panoramio.com/user/8658"} + , + {"photo_id": 573064, "photo_title": "Looking west across Isfjorden", "photo_url": "http://www.panoramio.com/photo/573064", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/573064.jpg", "longitude": 7.681332, "latitude": 62.558395, "width": 500, "height": 332, "upload_date": "26 January 2007", "owner_id": 39160, "owner_name": "Snemann", "owner_url": "http://www.panoramio.com/user/39160"} + , + {"photo_id": 859786, "photo_title": "Aurora Borealis, Andøya, Vesterålen, Norway", "photo_url": "http://www.panoramio.com/photo/859786", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/859786.jpg", "longitude": 15.605392, "latitude": 69.118548, "width": 500, "height": 377, "upload_date": "17 February 2007", "owner_id": 66734, "owner_name": "Svein Solhaug", "owner_url": "http://www.panoramio.com/user/66734"} + , + {"photo_id": 507024, "photo_title": "Agrárcolorgeometria", "photo_url": "http://www.panoramio.com/photo/507024", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/507024.jpg", "longitude": 18.014488, "latitude": 47.316017, "width": 500, "height": 300, "upload_date": "20 January 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 6665111, "photo_title": "Coucher du soleil depuis les Crêts", "photo_url": "http://www.panoramio.com/photo/6665111", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6665111.jpg", "longitude": 6.172214, "latitude": 46.129129, "width": 500, "height": 375, "upload_date": "24 December 2007", "owner_id": 359127, "owner_name": "wx", "owner_url": "http://www.panoramio.com/user/359127"} + , + {"photo_id": 679331, "photo_title": "wentworth falls", "photo_url": "http://www.panoramio.com/photo/679331", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/679331.jpg", "longitude": 150.371124, "latitude": -33.727111, "width": 498, "height": 500, "upload_date": "04 February 2007", "owner_id": 146092, "owner_name": "sid1662", "owner_url": "http://www.panoramio.com/user/146092"} + , + {"photo_id": 459436, "photo_title": "aikawa", "photo_url": "http://www.panoramio.com/photo/459436", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/459436.jpg", "longitude": 138.234701, "latitude": 37.998936, "width": 500, "height": 341, "upload_date": "16 January 2007", "owner_id": 86411, "owner_name": "中村脩-Osamu nakamura", "owner_url": "http://www.panoramio.com/user/86411"} + , + {"photo_id": 31662, "photo_title": "NY_7_GE", "photo_url": "http://www.panoramio.com/photo/31662", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/31662.jpg", "longitude": -73.977041, "latitude": 40.761528, "width": 452, "height": 500, "upload_date": "11 July 2006", "owner_id": 4657, "owner_name": "Giuseppe Grande", "owner_url": "http://www.panoramio.com/user/4657"} + , + {"photo_id": 1488304, "photo_title": "", "photo_url": "http://www.panoramio.com/photo/1488304", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1488304.jpg", "longitude": 138.135223, "latitude": 36.848719, "width": 383, "height": 500, "upload_date": "25 March 2007", "owner_id": 86411, "owner_name": "中村脩-Osamu nakamura", "owner_url": "http://www.panoramio.com/user/86411"} + , + {"photo_id": 181939, "photo_title": "The Eiffel Tower, Paris", "photo_url": "http://www.panoramio.com/photo/181939", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/181939.jpg", "longitude": 2.288718, "latitude": 48.861920, "width": 384, "height": 500, "upload_date": "18 December 2006", "owner_id": 12954, "owner_name": "Ziębol", "owner_url": "http://www.panoramio.com/user/12954"} + , + {"photo_id": 2422198, "photo_title": "In the Pine's Shade", "photo_url": "http://www.panoramio.com/photo/2422198", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2422198.jpg", "longitude": -112.393484, "latitude": 44.580075, "width": 500, "height": 333, "upload_date": "27 May 2007", "owner_id": 66847, "owner_name": "Lukas Novak", "owner_url": "http://www.panoramio.com/user/66847"} + , + {"photo_id": 2363576, "photo_title": "Cienfuegos Yacht Club", "photo_url": "http://www.panoramio.com/photo/2363576", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2363576.jpg", "longitude": -80.450901, "latitude": 22.126499, "width": 500, "height": 306, "upload_date": "23 May 2007", "owner_id": 2575, "owner_name": "mikel ortega", "owner_url": "http://www.panoramio.com/user/2575"} + , + {"photo_id": 58296, "photo_title": "Liechtensteinklamm 2", "photo_url": "http://www.panoramio.com/photo/58296", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/58296.jpg", "longitude": 13.190546, "latitude": 47.310140, "width": 333, "height": 500, "upload_date": "07 October 2006", "owner_id": 8060, "owner_name": "Norbert MAIER", "owner_url": "http://www.panoramio.com/user/8060"} + , + {"photo_id": 507328, "photo_title": "Pillantás a hídról", "photo_url": "http://www.panoramio.com/photo/507328", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/507328.jpg", "longitude": 17.629859, "latitude": 47.687102, "width": 500, "height": 334, "upload_date": "20 January 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 468161, "photo_title": "Honfleur", "photo_url": "http://www.panoramio.com/photo/468161", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/468161.jpg", "longitude": 0.234833, "latitude": 49.421806, "width": 500, "height": 350, "upload_date": "17 January 2007", "owner_id": 78506, "owner_name": "Philippe Stoop", "owner_url": "http://www.panoramio.com/user/78506"} + , + {"photo_id": 2521031, "photo_title": "Derűs délután", "photo_url": "http://www.panoramio.com/photo/2521031", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2521031.jpg", "longitude": 17.523537, "latitude": 47.751790, "width": 380, "height": 500, "upload_date": "02 June 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 934105, "photo_title": "Times Square", "photo_url": "http://www.panoramio.com/photo/934105", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/934105.jpg", "longitude": -73.986762, "latitude": 40.756652, "width": 375, "height": 500, "upload_date": "21 February 2007", "owner_id": 123698, "owner_name": "© Kojak", "owner_url": "http://www.panoramio.com/user/123698"} + , + {"photo_id": 57824, "photo_title": "Hallstatt 3", "photo_url": "http://www.panoramio.com/photo/57824", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/57824.jpg", "longitude": 13.642616, "latitude": 47.556372, "width": 500, "height": 333, "upload_date": "05 October 2006", "owner_id": 8060, "owner_name": "Norbert MAIER", "owner_url": "http://www.panoramio.com/user/8060"} + , + {"photo_id": 1370861, "photo_title": "Wanganui Sunrise", "photo_url": "http://www.panoramio.com/photo/1370861", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1370861.jpg", "longitude": 175.053218, "latitude": -39.927193, "width": 500, "height": 400, "upload_date": "17 March 2007", "owner_id": 286729, "owner_name": "jimwitkowski", "owner_url": "http://www.panoramio.com/user/286729"} + , + {"photo_id": 4823023, "photo_title": "Cielo en llamas ( Sky on fire )", "photo_url": "http://www.panoramio.com/photo/4823023", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4823023.jpg", "longitude": -0.471725, "latitude": 39.601588, "width": 500, "height": 375, "upload_date": "22 September 2007", "owner_id": 787217, "owner_name": "♣ Víctor S de Lara ♣", "owner_url": "http://www.panoramio.com/user/787217"} + , + {"photo_id": 520945, "photo_title": "Estvarázs", "photo_url": "http://www.panoramio.com/photo/520945", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/520945.jpg", "longitude": 17.627692, "latitude": 47.665156, "width": 500, "height": 334, "upload_date": "21 January 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 818423, "photo_title": "Karst Countryside in Guangxi, China", "photo_url": "http://www.panoramio.com/photo/818423", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/818423.jpg", "longitude": 106.953964, "latitude": 22.716023, "width": 500, "height": 206, "upload_date": "14 February 2007", "owner_id": 164125, "owner_name": "DannyXu", "owner_url": "http://www.panoramio.com/user/164125"} + , + {"photo_id": 532730, "photo_title": "Nightfall and fog at lake Helgeren", "photo_url": "http://www.panoramio.com/photo/532730", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/532730.jpg", "longitude": 10.708923, "latitude": 60.074348, "width": 419, "height": 500, "upload_date": "22 January 2007", "owner_id": 39160, "owner_name": "Snemann", "owner_url": "http://www.panoramio.com/user/39160"} + , + {"photo_id": 650237, "photo_title": "Aruba, Eagle Beach, Divi Divi Tree", "photo_url": "http://www.panoramio.com/photo/650237", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/650237.jpg", "longitude": -70.055099, "latitude": 12.555003, "width": 500, "height": 375, "upload_date": "01 February 2007", "owner_id": 136446, "owner_name": "© Wim", "owner_url": "http://www.panoramio.com/user/136446"} + , + {"photo_id": 2414590, "photo_title": "Egy csendes estén", "photo_url": "http://www.panoramio.com/photo/2414590", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2414590.jpg", "longitude": 17.626448, "latitude": 47.662613, "width": 500, "height": 334, "upload_date": "27 May 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 10544520, "photo_title": "Plansee", "photo_url": "http://www.panoramio.com/photo/10544520", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/10544520.jpg", "longitude": 10.799389, "latitude": 47.473011, "width": 500, "height": 242, "upload_date": "24 May 2008", "owner_id": 634000, "owner_name": "© Massimo De Candido", "owner_url": "http://www.panoramio.com/user/634000"} + , + {"photo_id": 11341211, "photo_title": "AMAPOLAS AL SOL", "photo_url": "http://www.panoramio.com/photo/11341211", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/11341211.jpg", "longitude": -1.995735, "latitude": 42.471844, "width": 500, "height": 374, "upload_date": "19 June 2008", "owner_id": 1487989, "owner_name": "mesias", "owner_url": "http://www.panoramio.com/user/1487989"} + , + {"photo_id": 134748, "photo_title": "20060813_9795_raw", "photo_url": "http://www.panoramio.com/photo/134748", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/134748.jpg", "longitude": 30.452921, "latitude": 50.358700, "width": 500, "height": 333, "upload_date": "13 December 2006", "owner_id": 17090, "owner_name": "Pavel Danko", "owner_url": "http://www.panoramio.com/user/17090"} + , + {"photo_id": 66816, "photo_title": "desierto cerca de Tolar Grande", "photo_url": "http://www.panoramio.com/photo/66816", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/66816.jpg", "longitude": -67.394257, "latitude": -24.584593, "width": 374, "height": 500, "upload_date": "19 October 2006", "owner_id": 9080, "owner_name": "Marco Teodonio", "owner_url": "http://www.panoramio.com/user/9080"} + , + {"photo_id": 70148, "photo_title": "Grotto Azure, Capris: The cave is lit by light refracting through the water.", "photo_url": "http://www.panoramio.com/photo/70148", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/70148.jpg", "longitude": 14.203262, "latitude": 40.560895, "width": 500, "height": 375, "upload_date": "25 October 2006", "owner_id": 1634, "owner_name": "Rick Guthrie", "owner_url": "http://www.panoramio.com/user/1634"} + , + {"photo_id": 1409801, "photo_title": "Hedges, Aerial", "photo_url": "http://www.panoramio.com/photo/1409801", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1409801.jpg", "longitude": 9.027843, "latitude": 56.130772, "width": 332, "height": 500, "upload_date": "20 March 2007", "owner_id": 278074, "owner_name": "H. C. Steensen", "owner_url": "http://www.panoramio.com/user/278074"} + , + {"photo_id": 840971, "photo_title": "Upper Thracian Lowlands", "photo_url": "http://www.panoramio.com/photo/840971", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/840971.jpg", "longitude": 26.364269, "latitude": 42.717759, "width": 500, "height": 400, "upload_date": "16 February 2007", "owner_id": 16880, "owner_name": "evgenidinev.com", "owner_url": "http://www.panoramio.com/user/16880"} + , + {"photo_id": 9557772, "photo_title": "Le Shan Giant Buddha Statue - Geotagged April 08 Photo Contest Heritage Category Honorable Mentions", "photo_url": "http://www.panoramio.com/photo/9557772", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/9557772.jpg", "longitude": 103.769115, "latitude": 29.547084, "width": 375, "height": 500, "upload_date": "20 April 2008", "owner_id": 964751, "owner_name": "jymsn123", "owner_url": "http://www.panoramio.com/user/964751"} + , + {"photo_id": 4716049, "photo_title": "Sol-edad", "photo_url": "http://www.panoramio.com/photo/4716049", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4716049.jpg", "longitude": -73.228008, "latitude": -39.820720, "width": 366, "height": 500, "upload_date": "17 September 2007", "owner_id": 327310, "owner_name": "Erwin Woenckhaus", "owner_url": "http://www.panoramio.com/user/327310"} + , + {"photo_id": 1419283, "photo_title": "Sunset in Boka", "photo_url": "http://www.panoramio.com/photo/1419283", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1419283.jpg", "longitude": 18.703022, "latitude": 42.479883, "width": 500, "height": 375, "upload_date": "20 March 2007", "owner_id": 239453, "owner_name": "Šovran Nikša", "owner_url": "http://www.panoramio.com/user/239453"} + , + {"photo_id": 3507222, "photo_title": "The sheperd of the Glen", "photo_url": "http://www.panoramio.com/photo/3507222", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3507222.jpg", "longitude": -4.840164, "latitude": 56.641504, "width": 500, "height": 334, "upload_date": "24 July 2007", "owner_id": 599676, "owner_name": "mossip", "owner_url": "http://www.panoramio.com/user/599676"} + , + {"photo_id": 3521820, "photo_title": "Utolsó pillantás", "photo_url": "http://www.panoramio.com/photo/3521820", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3521820.jpg", "longitude": 17.809353, "latitude": 47.528097, "width": 500, "height": 334, "upload_date": "25 July 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 521264, "photo_title": "Felhőátvonulás", "photo_url": "http://www.panoramio.com/photo/521264", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/521264.jpg", "longitude": 17.760429, "latitude": 47.555329, "width": 500, "height": 280, "upload_date": "21 January 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 636723, "photo_title": "ASZFALTOZÓK", "photo_url": "http://www.panoramio.com/photo/636723", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/636723.jpg", "longitude": 19.038105, "latitude": 47.520041, "width": 500, "height": 318, "upload_date": "31 January 2007", "owner_id": 137538, "owner_name": "BALÁS ISTVÁN", "owner_url": "http://www.panoramio.com/user/137538"} + , + {"photo_id": 153144, "photo_title": "cierny_vah01", "photo_url": "http://www.panoramio.com/photo/153144", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/153144.jpg", "longitude": 19.907227, "latitude": 49.020084, "width": 500, "height": 332, "upload_date": "15 December 2006", "owner_id": 28092, "owner_name": "Design d15", "owner_url": "http://www.panoramio.com/user/28092"} + , + {"photo_id": 7485246, "photo_title": "Túl mindenen", "photo_url": "http://www.panoramio.com/photo/7485246", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/7485246.jpg", "longitude": 17.624259, "latitude": 47.662092, "width": 500, "height": 334, "upload_date": "31 January 2008", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 4884030, "photo_title": "A Cloud is Born", "photo_url": "http://www.panoramio.com/photo/4884030", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4884030.jpg", "longitude": -119.631693, "latitude": 37.724208, "width": 333, "height": 500, "upload_date": "24 September 2007", "owner_id": 376395, "owner_name": "JeffSullivan (www.MyPhotoGuides.com)", "owner_url": "http://www.panoramio.com/user/376395"} + , + {"photo_id": 6126146, "photo_title": "North Weald Park", "photo_url": "http://www.panoramio.com/photo/6126146", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6126146.jpg", "longitude": 0.264530, "latitude": 51.624631, "width": 500, "height": 333, "upload_date": "25 November 2007", "owner_id": 1130880, "owner_name": "marksimms", "owner_url": "http://www.panoramio.com/user/1130880"} + , + {"photo_id": 438342, "photo_title": "Sunrise in Sierra Nevada", "photo_url": "http://www.panoramio.com/photo/438342", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/438342.jpg", "longitude": -119.225607, "latitude": 37.945213, "width": 500, "height": 318, "upload_date": "15 January 2007", "owner_id": 93560, "owner_name": "Alex Petrov", "owner_url": "http://www.panoramio.com/user/93560"} + , + {"photo_id": 91978, "photo_title": "Dubrovnik (Croatia)", "photo_url": "http://www.panoramio.com/photo/91978", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/91978.jpg", "longitude": 18.108457, "latitude": 42.642909, "width": 500, "height": 375, "upload_date": "04 December 2006", "owner_id": 11403, "owner_name": "Arnáiz", "owner_url": "http://www.panoramio.com/user/11403"} + , + {"photo_id": 10816587, "photo_title": "Cementiri de Carcassonne", "photo_url": "http://www.panoramio.com/photo/10816587", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/10816587.jpg", "longitude": 2.365751, "latitude": 43.205551, "width": 500, "height": 333, "upload_date": "01 June 2008", "owner_id": 599233, "owner_name": "SílviaPrats", "owner_url": "http://www.panoramio.com/user/599233"} + , + {"photo_id": 292943, "photo_title": "Aekingerzand", "photo_url": "http://www.panoramio.com/photo/292943", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/292943.jpg", "longitude": 6.296024, "latitude": 52.935293, "width": 500, "height": 333, "upload_date": "03 January 2007", "owner_id": 62613, "owner_name": "erik van den Ham", "owner_url": "http://www.panoramio.com/user/62613"} + , + {"photo_id": 4696655, "photo_title": "Old boat", "photo_url": "http://www.panoramio.com/photo/4696655", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4696655.jpg", "longitude": 27.399902, "latitude": 42.414079, "width": 500, "height": 357, "upload_date": "16 September 2007", "owner_id": 16880, "owner_name": "evgenidinev.com", "owner_url": "http://www.panoramio.com/user/16880"} + , + {"photo_id": 348752, "photo_title": "_Cariniana legalis_ (Lecythidaceae), Santa Rita do Passa Quatro, SP,Brasil", "photo_url": "http://www.panoramio.com/photo/348752", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/348752.jpg", "longitude": -47.618523, "latitude": -21.691885, "width": 500, "height": 375, "upload_date": "08 January 2007", "owner_id": 56214, "owner_name": "Vinícius Antonio de Oliveira Dittrich", "owner_url": "http://www.panoramio.com/user/56214"} + , + {"photo_id": 3724631, "photo_title": "Abbazia di Chiaravalle in un'alba nebbiosa", "photo_url": "http://www.panoramio.com/photo/3724631", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3724631.jpg", "longitude": 9.201404, "latitude": 45.424284, "width": 500, "height": 375, "upload_date": "04 August 2007", "owner_id": 732643, "owner_name": "La Mugna", "owner_url": "http://www.panoramio.com/user/732643"} + , + {"photo_id": 405853, "photo_title": "oyasirazu", "photo_url": "http://www.panoramio.com/photo/405853", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/405853.jpg", "longitude": 137.747955, "latitude": 37.009133, "width": 500, "height": 384, "upload_date": "13 January 2007", "owner_id": 86411, "owner_name": "中村脩-Osamu nakamura", "owner_url": "http://www.panoramio.com/user/86411"} + , + {"photo_id": 1192286, "photo_title": "Ojos del mar - 1", "photo_url": "http://www.panoramio.com/photo/1192286", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1192286.jpg", "longitude": -67.369022, "latitude": -24.630634, "width": 500, "height": 337, "upload_date": "06 March 2007", "owner_id": 232099, "owner_name": "mabut", "owner_url": "http://www.panoramio.com/user/232099"} + , + {"photo_id": 589411, "photo_title": "Sunset, London, UK.", "photo_url": "http://www.panoramio.com/photo/589411", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/589411.jpg", "longitude": -0.123596, "latitude": 51.500942, "width": 500, "height": 346, "upload_date": "27 January 2007", "owner_id": 44319, "owner_name": "André Bonacin", "owner_url": "http://www.panoramio.com/user/44319"} + , + {"photo_id": 7586406, "photo_title": "Sol naciente en Villarrica", "photo_url": "http://www.panoramio.com/photo/7586406", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/7586406.jpg", "longitude": -72.219400, "latitude": -39.289273, "width": 500, "height": 375, "upload_date": "04 February 2008", "owner_id": 327310, "owner_name": "Erwin Woenckhaus", "owner_url": "http://www.panoramio.com/user/327310"} + , + {"photo_id": 621, "photo_title": "Cape Drastis / Corfu", "photo_url": "http://www.panoramio.com/photo/621", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/621.jpg", "longitude": 19.701061, "latitude": 39.795744, "width": 500, "height": 375, "upload_date": "27 September 2005", "owner_id": 30, "owner_name": "eSHa", "owner_url": "http://www.panoramio.com/user/30"} + , + {"photo_id": 2379636, "photo_title": "Detail from the valley below Holmbukttind", "photo_url": "http://www.panoramio.com/photo/2379636", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2379636.jpg", "longitude": 19.781570, "latitude": 69.476339, "width": 500, "height": 375, "upload_date": "24 May 2007", "owner_id": 39160, "owner_name": "Snemann", "owner_url": "http://www.panoramio.com/user/39160"} + , + {"photo_id": 5725557, "photo_title": "Kardzhali lake - Panorama", "photo_url": "http://www.panoramio.com/photo/5725557", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5725557.jpg", "longitude": 25.242250, "latitude": 41.668667, "width": 500, "height": 187, "upload_date": "05 November 2007", "owner_id": 16880, "owner_name": "evgenidinev.com", "owner_url": "http://www.panoramio.com/user/16880"} + , + {"photo_id": 22393, "photo_title": "View from Bosphorus Bridge", "photo_url": "http://www.panoramio.com/photo/22393", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/22393.jpg", "longitude": 28.999443, "latitude": 41.027053, "width": 500, "height": 355, "upload_date": "04 June 2006", "owner_id": 3504, "owner_name": "zeytinbass", "owner_url": "http://www.panoramio.com/user/3504"} + , + {"photo_id": 5611129, "photo_title": "Torrent de Pareis - Sa Calobra (Mallorca)", "photo_url": "http://www.panoramio.com/photo/5611129", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5611129.jpg", "longitude": 2.807093, "latitude": 39.851709, "width": 500, "height": 373, "upload_date": "29 October 2007", "owner_id": 83865, "owner_name": "Epi F.Villanueva", "owner_url": "http://www.panoramio.com/user/83865"} + , + {"photo_id": 3457918, "photo_title": "Walk of Venus", "photo_url": "http://www.panoramio.com/photo/3457918", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3457918.jpg", "longitude": 14.721851, "latitude": 44.838891, "width": 500, "height": 367, "upload_date": "22 July 2007", "owner_id": 346103, "owner_name": "lacitot", "owner_url": "http://www.panoramio.com/user/346103"} + , + {"photo_id": 21135, "photo_title": "icebergs in the Channel", "photo_url": "http://www.panoramio.com/photo/21135", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/21135.jpg", "longitude": -63.017578, "latitude": -64.774125, "width": 500, "height": 338, "upload_date": "24 May 2006", "owner_id": 3316, "owner_name": "kristine hannon (www.traveltheglobe.be)", "owner_url": "http://www.panoramio.com/user/3316"} + , + {"photo_id": 1288597, "photo_title": "Gift", "photo_url": "http://www.panoramio.com/photo/1288597", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1288597.jpg", "longitude": 72.920036, "latitude": 4.038077, "width": 337, "height": 500, "upload_date": "12 March 2007", "owner_id": 232099, "owner_name": "mabut", "owner_url": "http://www.panoramio.com/user/232099"} + , + {"photo_id": 708502, "photo_title": "A single skier from Gogsøyra tw Litjskjorta mountain", "photo_url": "http://www.panoramio.com/photo/708502", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/708502.jpg", "longitude": 8.160782, "latitude": 62.645604, "width": 424, "height": 500, "upload_date": "05 February 2007", "owner_id": 39160, "owner_name": "Snemann", "owner_url": "http://www.panoramio.com/user/39160"} + , + {"photo_id": 4386456, "photo_title": "good bye", "photo_url": "http://www.panoramio.com/photo/4386456", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4386456.jpg", "longitude": -1.254845, "latitude": 44.463191, "width": 500, "height": 405, "upload_date": "04 September 2007", "owner_id": 521836, "owner_name": "KLEFER", "owner_url": "http://www.panoramio.com/user/521836"} + , + {"photo_id": 902303, "photo_title": "Kék", "photo_url": "http://www.panoramio.com/photo/902303", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/902303.jpg", "longitude": 17.941017, "latitude": 47.650703, "width": 334, "height": 500, "upload_date": "19 February 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 3660960, "photo_title": "Angkor - Ta Prohm IV", "photo_url": "http://www.panoramio.com/photo/3660960", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3660960.jpg", "longitude": 103.890334, "latitude": 13.435028, "width": 338, "height": 500, "upload_date": "01 August 2007", "owner_id": 73104, "owner_name": "zerega", "owner_url": "http://www.panoramio.com/user/73104"} + , + {"photo_id": 902570, "photo_title": "Tavitündér", "photo_url": "http://www.panoramio.com/photo/902570", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/902570.jpg", "longitude": 17.468948, "latitude": 47.871914, "width": 500, "height": 345, "upload_date": "19 February 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 2521005, "photo_title": "Megvilágosodás elött", "photo_url": "http://www.panoramio.com/photo/2521005", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2521005.jpg", "longitude": 17.515984, "latitude": 47.743825, "width": 500, "height": 286, "upload_date": "02 June 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 586159, "photo_title": "Central Park", "photo_url": "http://www.panoramio.com/photo/586159", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/586159.jpg", "longitude": -73.971816, "latitude": 40.775789, "width": 500, "height": 375, "upload_date": "27 January 2007", "owner_id": 123698, "owner_name": "© Kojak", "owner_url": "http://www.panoramio.com/user/123698"} + , + {"photo_id": 23475, "photo_title": "Good Morning", "photo_url": "http://www.panoramio.com/photo/23475", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/23475.jpg", "longitude": -28.210895, "latitude": 38.680351, "width": 500, "height": 375, "upload_date": "11 June 2006", "owner_id": 3760, "owner_name": "Frank Pustlauck", "owner_url": "http://www.panoramio.com/user/3760"} + , + {"photo_id": 1006005, "photo_title": "04-09-07_\"La Nube Sangrante\"_017_PIXELECTA", "photo_url": "http://www.panoramio.com/photo/1006005", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1006005.jpg", "longitude": -0.896330, "latitude": 41.738016, "width": 500, "height": 375, "upload_date": "24 February 2007", "owner_id": 163655, "owner_name": "[[[ PIXELECTA ]]]", "owner_url": "http://www.panoramio.com/user/163655"} + , + {"photo_id": 3473597, "photo_title": "Sails in the sunset", "photo_url": "http://www.panoramio.com/photo/3473597", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3473597.jpg", "longitude": -87.173424, "latitude": 45.158317, "width": 500, "height": 375, "upload_date": "22 July 2007", "owner_id": 555551, "owner_name": "Marilyn Whiteley", "owner_url": "http://www.panoramio.com/user/555551"} + , + {"photo_id": 3809992, "photo_title": "Długie Pobrzeże latem/ Las casas narcisistas que se pasan el día mirándose en el espejo del agua - gracias Arturo García!", "photo_url": "http://www.panoramio.com/photo/3809992", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3809992.jpg", "longitude": 18.658776, "latitude": 54.350679, "width": 500, "height": 375, "upload_date": "08 August 2007", "owner_id": 277750, "owner_name": "Karolina P.", "owner_url": "http://www.panoramio.com/user/277750"} + , + {"photo_id": 2280401, "photo_title": "Hetyke-egyke", "photo_url": "http://www.panoramio.com/photo/2280401", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2280401.jpg", "longitude": 17.829094, "latitude": 47.206508, "width": 500, "height": 308, "upload_date": "18 May 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 290772, "photo_title": "Tormenta Bahía de Pollensa", "photo_url": "http://www.panoramio.com/photo/290772", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/290772.jpg", "longitude": 3.116437, "latitude": 39.928440, "width": 500, "height": 335, "upload_date": "03 January 2007", "owner_id": 61890, "owner_name": "enriquevidalphoto.com", "owner_url": "http://www.panoramio.com/user/61890"} + , + {"photo_id": 57822, "photo_title": "Maria Alm - Pfarrkirche", "photo_url": "http://www.panoramio.com/photo/57822", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/57822.jpg", "longitude": 12.903442, "latitude": 47.407877, "width": 346, "height": 500, "upload_date": "05 October 2006", "owner_id": 8060, "owner_name": "Norbert MAIER", "owner_url": "http://www.panoramio.com/user/8060"} + , + {"photo_id": 516322, "photo_title": "A völgy", "photo_url": "http://www.panoramio.com/photo/516322", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/516322.jpg", "longitude": 17.774162, "latitude": 47.292504, "width": 338, "height": 500, "upload_date": "21 January 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 12271085, "photo_title": "Ein Bild für meine Freunde", "photo_url": "http://www.panoramio.com/photo/12271085", "photo_file_url": "http://static2.bareka.com/photos/medium/12271085.jpg", "longitude": 9.284134, "latitude": 51.510933, "width": 500, "height": 333, "upload_date": "19 July 2008", "owner_id": 497213, "owner_name": "UlrichSchnuerer", "owner_url": "http://www.panoramio.com/user/497213"} + , + {"photo_id": 5050864, "photo_title": "Álmok útján", "photo_url": "http://www.panoramio.com/photo/5050864", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5050864.jpg", "longitude": 12.333773, "latitude": 45.436466, "width": 500, "height": 354, "upload_date": "02 October 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 617461, "photo_title": "Miravet", "photo_url": "http://www.panoramio.com/photo/617461", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/617461.jpg", "longitude": 0.593348, "latitude": 41.035568, "width": 500, "height": 334, "upload_date": "29 January 2007", "owner_id": 3022, "owner_name": "Arcadi", "owner_url": "http://www.panoramio.com/user/3022"} + , + {"photo_id": 2689526, "photo_title": "Égszakadás", "photo_url": "http://www.panoramio.com/photo/2689526", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2689526.jpg", "longitude": 17.503624, "latitude": 47.749481, "width": 500, "height": 325, "upload_date": "11 June 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 38135, "photo_title": "Amanecer en el sur", "photo_url": "http://www.panoramio.com/photo/38135", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/38135.jpg", "longitude": -64.983333, "latitude": -31.900000, "width": 500, "height": 375, "upload_date": "11 August 2006", "owner_id": 4483, "owner_name": "Miguel Coranti", "owner_url": "http://www.panoramio.com/user/4483"} + , + {"photo_id": 1087737, "photo_title": "Szeles nyárelő", "photo_url": "http://www.panoramio.com/photo/1087737", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1087737.jpg", "longitude": 17.605934, "latitude": 47.603154, "width": 500, "height": 333, "upload_date": "28 February 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 8411394, "photo_title": "Dead Vlei", "photo_url": "http://www.panoramio.com/photo/8411394", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/8411394.jpg", "longitude": 15.295715, "latitude": -24.764914, "width": 500, "height": 341, "upload_date": "09 March 2008", "owner_id": 1204358, "owner_name": "aldenc", "owner_url": "http://www.panoramio.com/user/1204358"} + , + {"photo_id": 8491464, "photo_title": "Horsetail Falls on El Capitan", "photo_url": "http://www.panoramio.com/photo/8491464", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/8491464.jpg", "longitude": -119.623947, "latitude": 37.723512, "width": 357, "height": 500, "upload_date": "12 March 2008", "owner_id": 376395, "owner_name": "JeffSullivan (www.MyPhotoGuides.com)", "owner_url": "http://www.panoramio.com/user/376395"} + , + {"photo_id": 58134, "photo_title": "Chateaux Lake Louise from the head of the lake", "photo_url": "http://www.panoramio.com/photo/58134", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/58134.jpg", "longitude": -116.239901, "latitude": 51.407291, "width": 500, "height": 375, "upload_date": "06 October 2006", "owner_id": 8118, "owner_name": "Michael Gerstmann", "owner_url": "http://www.panoramio.com/user/8118"} + , + {"photo_id": 11237087, "photo_title": " Ein Strand zum träumen", "photo_url": "http://www.panoramio.com/photo/11237087", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/11237087.jpg", "longitude": 15.914984, "latitude": 38.683366, "width": 500, "height": 294, "upload_date": "15 June 2008", "owner_id": 1400529, "owner_name": "marita1004", "owner_url": "http://www.panoramio.com/user/1400529"} + , + {"photo_id": 8384850, "photo_title": "Winter has gone", "photo_url": "http://www.panoramio.com/photo/8384850", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/8384850.jpg", "longitude": 12.428112, "latitude": 49.084351, "width": 500, "height": 333, "upload_date": "08 March 2008", "owner_id": 696605, "owner_name": "© alfredschaffer", "owner_url": "http://www.panoramio.com/user/696605"} + , + {"photo_id": 3947779, "photo_title": "Mont-Saint-Michel floating in water", "photo_url": "http://www.panoramio.com/photo/3947779", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3947779.jpg", "longitude": -1.508625, "latitude": 48.634561, "width": 500, "height": 335, "upload_date": "15 August 2007", "owner_id": 57893, "owner_name": "ThoiryK", "owner_url": "http://www.panoramio.com/user/57893"} + , + {"photo_id": 1069321, "photo_title": "The old Temple N2", "photo_url": "http://www.panoramio.com/photo/1069321", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1069321.jpg", "longitude": 37.426300, "latitude": 56.370622, "width": 500, "height": 333, "upload_date": "27 February 2007", "owner_id": 212477, "owner_name": "Cherepanov Timofey", "owner_url": "http://www.panoramio.com/user/212477"} + , + {"photo_id": 5756689, "photo_title": "Tokyo Metropolitan Government", "photo_url": "http://www.panoramio.com/photo/5756689", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5756689.jpg", "longitude": 139.690722, "latitude": 35.689906, "width": 500, "height": 339, "upload_date": "06 November 2007", "owner_id": 558055, "owner_name": "www.tokyoform.com", "owner_url": "http://www.panoramio.com/user/558055"} + , + {"photo_id": 1599763, "photo_title": "Atomium", "photo_url": "http://www.panoramio.com/photo/1599763", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1599763.jpg", "longitude": 4.341531, "latitude": 50.894805, "width": 500, "height": 375, "upload_date": "02 April 2007", "owner_id": 18137, "owner_name": "digitaler lumpensammler", "owner_url": "http://www.panoramio.com/user/18137"} + , + {"photo_id": 516375, "photo_title": "A zöld folyó", "photo_url": "http://www.panoramio.com/photo/516375", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/516375.jpg", "longitude": 17.724895, "latitude": 46.297137, "width": 369, "height": 500, "upload_date": "21 January 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 1538329, "photo_title": "View east from Empire State Building by night", "photo_url": "http://www.panoramio.com/photo/1538329", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1538329.jpg", "longitude": -73.986332, "latitude": 40.748346, "width": 500, "height": 332, "upload_date": "28 March 2007", "owner_id": 278074, "owner_name": "H. C. Steensen", "owner_url": "http://www.panoramio.com/user/278074"} + , + {"photo_id": 1838875, "photo_title": "Modern art in Mainz", "photo_url": "http://www.panoramio.com/photo/1838875", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1838875.jpg", "longitude": 8.276659, "latitude": 50.001071, "width": 500, "height": 393, "upload_date": "19 April 2007", "owner_id": 12954, "owner_name": "Ziębol", "owner_url": "http://www.panoramio.com/user/12954"} + , + {"photo_id": 4740891, "photo_title": "The golden path - Az aranyozott ösvény", "photo_url": "http://www.panoramio.com/photo/4740891", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4740891.jpg", "longitude": 17.599239, "latitude": 47.639948, "width": 500, "height": 334, "upload_date": "18 September 2007", "owner_id": 217370, "owner_name": "Borbély Márk", "owner_url": "http://www.panoramio.com/user/217370"} + , + {"photo_id": 441376, "photo_title": "Bolungarvik", "photo_url": "http://www.panoramio.com/photo/441376", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/441376.jpg", "longitude": -23.197975, "latitude": 66.151698, "width": 500, "height": 333, "upload_date": "15 January 2007", "owner_id": 78506, "owner_name": "Philippe Stoop", "owner_url": "http://www.panoramio.com/user/78506"} + , + {"photo_id": 3354401, "photo_title": "Alkonyi színjáték", "photo_url": "http://www.panoramio.com/photo/3354401", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3354401.jpg", "longitude": 17.504225, "latitude": 47.745730, "width": 500, "height": 334, "upload_date": "16 July 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 809506, "photo_title": "Szivárványhorizont", "photo_url": "http://www.panoramio.com/photo/809506", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/809506.jpg", "longitude": 15.969830, "latitude": 43.626632, "width": 500, "height": 334, "upload_date": "13 February 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 36387, "photo_title": "Adobe Headquarters - Looking Up", "photo_url": "http://www.panoramio.com/photo/36387", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/36387.jpg", "longitude": -121.893804, "latitude": 37.330959, "width": 351, "height": 500, "upload_date": "02 August 2006", "owner_id": 5684, "owner_name": "Brent Townshend", "owner_url": "http://www.panoramio.com/user/5684"} + , + {"photo_id": 722982, "photo_title": "Antelope-Light", "photo_url": "http://www.panoramio.com/photo/722982", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/722982.jpg", "longitude": -111.371326, "latitude": 36.857236, "width": 333, "height": 500, "upload_date": "07 February 2007", "owner_id": 66847, "owner_name": "Lukas Novak", "owner_url": "http://www.panoramio.com/user/66847"} + , + {"photo_id": 138030, "photo_title": "Kinderdijk", "photo_url": "http://www.panoramio.com/photo/138030", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/138030.jpg", "longitude": 4.645500, "latitude": 51.879458, "width": 500, "height": 335, "upload_date": "13 December 2006", "owner_id": 18131, "owner_name": "ron zoeteweij", "owner_url": "http://www.panoramio.com/user/18131"} + , + {"photo_id": 9725235, "photo_title": "railway / Małopolska / województwo małopolskie", "photo_url": "http://www.panoramio.com/photo/9725235", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/9725235.jpg", "longitude": 20.363159, "latitude": 49.748443, "width": 321, "height": 500, "upload_date": "28 April 2008", "owner_id": 454219, "owner_name": "Rafal Ociepka", "owner_url": "http://www.panoramio.com/user/454219"} + , + {"photo_id": 945984, "photo_title": "El canal", "photo_url": "http://www.panoramio.com/photo/945984", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/945984.jpg", "longitude": 0.484858, "latitude": 40.901901, "width": 378, "height": 500, "upload_date": "21 February 2007", "owner_id": 3022, "owner_name": "Arcadi", "owner_url": "http://www.panoramio.com/user/3022"} + , + {"photo_id": 677953, "photo_title": "Shuto Expressway over the Sumida River", "photo_url": "http://www.panoramio.com/photo/677953", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/677953.jpg", "longitude": 139.788644, "latitude": 35.690411, "width": 500, "height": 364, "upload_date": "03 February 2007", "owner_id": 78856, "owner_name": "chrisjongkind • archive", "owner_url": "http://www.panoramio.com/user/78856"} + , + {"photo_id": 2723655, "photo_title": "Orciano Pisano", "photo_url": "http://www.panoramio.com/photo/2723655", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2723655.jpg", "longitude": 10.505505, "latitude": 43.491911, "width": 366, "height": 500, "upload_date": "13 June 2007", "owner_id": 65478, "owner_name": "Gabriele Marabotti", "owner_url": "http://www.panoramio.com/user/65478"} + , + {"photo_id": 444745, "photo_title": "Pres de Nefta", "photo_url": "http://www.panoramio.com/photo/444745", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/444745.jpg", "longitude": 7.904320, "latitude": 33.766590, "width": 500, "height": 333, "upload_date": "15 January 2007", "owner_id": 78506, "owner_name": "Philippe Stoop", "owner_url": "http://www.panoramio.com/user/78506"} + , + {"photo_id": 1388623, "photo_title": "El Aviario (Parque Ecológico, Puebla, México)", "photo_url": "http://www.panoramio.com/photo/1388623", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1388623.jpg", "longitude": -98.187540, "latitude": 19.025552, "width": 500, "height": 488, "upload_date": "18 March 2007", "owner_id": 274633, "owner_name": "D4v17 ]7. G.", "owner_url": "http://www.panoramio.com/user/274633"} + , + {"photo_id": 792658, "photo_title": "Reichtag in the dome, Berlin HDR", "photo_url": "http://www.panoramio.com/photo/792658", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/792658.jpg", "longitude": 13.376133, "latitude": 52.518610, "width": 376, "height": 500, "upload_date": "12 February 2007", "owner_id": 161254, "owner_name": "fotoartistry", "owner_url": "http://www.panoramio.com/user/161254"} + , + {"photo_id": 324694, "photo_title": "Thachted houses", "photo_url": "http://www.panoramio.com/photo/324694", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/324694.jpg", "longitude": 137.235117, "latitude": 36.132095, "width": 500, "height": 265, "upload_date": "06 January 2007", "owner_id": 11781, "owner_name": "ANDRE GARDELLA", "owner_url": "http://www.panoramio.com/user/11781"} + , + {"photo_id": 2353496, "photo_title": "рассвет над вулканом Жупановский", "photo_url": "http://www.panoramio.com/photo/2353496", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2353496.jpg", "longitude": 158.591080, "latitude": 53.497850, "width": 500, "height": 337, "upload_date": "23 May 2007", "owner_id": 268724, "owner_name": "Korotnev AV", "owner_url": "http://www.panoramio.com/user/268724"} + , + {"photo_id": 7251801, "photo_title": "Fellegek közt", "photo_url": "http://www.panoramio.com/photo/7251801", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/7251801.jpg", "longitude": 18.314981, "latitude": 47.638820, "width": 500, "height": 329, "upload_date": "20 January 2008", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 35422, "photo_title": "caracas", "photo_url": "http://www.panoramio.com/photo/35422", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/35422.jpg", "longitude": -66.904507, "latitude": 10.498193, "width": 500, "height": 375, "upload_date": "29 July 2006", "owner_id": 3360, "owner_name": "ozzy", "owner_url": "http://www.panoramio.com/user/3360"} + , + {"photo_id": 405861, "photo_title": "myoukou", "photo_url": "http://www.panoramio.com/photo/405861", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/405861.jpg", "longitude": 138.295898, "latitude": 37.099003, "width": 500, "height": 383, "upload_date": "13 January 2007", "owner_id": 86411, "owner_name": "中村脩-Osamu nakamura", "owner_url": "http://www.panoramio.com/user/86411"} + , + {"photo_id": 2719848, "photo_title": "Idaho relic", "photo_url": "http://www.panoramio.com/photo/2719848", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2719848.jpg", "longitude": -111.398749, "latitude": 42.286707, "width": 500, "height": 375, "upload_date": "13 June 2007", "owner_id": 555551, "owner_name": "Marilyn Whiteley", "owner_url": "http://www.panoramio.com/user/555551"} + , + {"photo_id": 599401, "photo_title": "Hozenji", "photo_url": "http://www.panoramio.com/photo/599401", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/599401.jpg", "longitude": 135.502450, "latitude": 34.668002, "width": 500, "height": 500, "upload_date": "28 January 2007", "owner_id": 128403, "owner_name": "mechanics", "owner_url": "http://www.panoramio.com/user/128403"} + , + {"photo_id": 53101, "photo_title": "Night Auadkhara", "photo_url": "http://www.panoramio.com/photo/53101", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/53101.jpg", "longitude": 40.631331, "latitude": 43.525806, "width": 500, "height": 323, "upload_date": "27 September 2006", "owner_id": 7707, "owner_name": "Yorix", "owner_url": "http://www.panoramio.com/user/7707"} + , + {"photo_id": 112752, "photo_title": "V-35-003b", "photo_url": "http://www.panoramio.com/photo/112752", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/112752.jpg", "longitude": 12.339267, "latitude": 45.433696, "width": 500, "height": 338, "upload_date": "11 December 2006", "owner_id": 17599, "owner_name": "Dmitry Andreev", "owner_url": "http://www.panoramio.com/user/17599"} + , + {"photo_id": 1946749, "photo_title": "Mt Hood and a John Deer Tractor over the Wooden Shoe Tulip Fields Monitor Oregon", "photo_url": "http://www.panoramio.com/photo/1946749", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1946749.jpg", "longitude": -122.740974, "latitude": 45.119326, "width": 500, "height": 351, "upload_date": "27 April 2007", "owner_id": 128746, "owner_name": "© Michael Hatten", "owner_url": "http://www.panoramio.com/user/128746"} + , + {"photo_id": 723074, "photo_title": "September Twilight in Thira", "photo_url": "http://www.panoramio.com/photo/723074", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/723074.jpg", "longitude": 25.430603, "latitude": 36.416862, "width": 500, "height": 223, "upload_date": "07 February 2007", "owner_id": 66847, "owner_name": "Lukas Novak", "owner_url": "http://www.panoramio.com/user/66847"} + , + {"photo_id": 1658251, "photo_title": "Behold the moon", "photo_url": "http://www.panoramio.com/photo/1658251", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1658251.jpg", "longitude": 15.589085, "latitude": 78.170125, "width": 333, "height": 500, "upload_date": "06 April 2007", "owner_id": 3574, "owner_name": "blackone", "owner_url": "http://www.panoramio.com/user/3574"} + , + {"photo_id": 2225571, "photo_title": "Landscape (Via Di Porta Castello Street) ~ Tarquinia, Italy", "photo_url": "http://www.panoramio.com/photo/2225571", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2225571.jpg", "longitude": 11.751836, "latitude": 42.255808, "width": 500, "height": 335, "upload_date": "15 May 2007", "owner_id": 395380, "owner_name": "Rafael (Retrocool)", "owner_url": "http://www.panoramio.com/user/395380"} + , + {"photo_id": 348071, "photo_title": "Perfect ice for skating, Svartlögafjärden", "photo_url": "http://www.panoramio.com/photo/348071", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/348071.jpg", "longitude": 19.021196, "latitude": 59.558766, "width": 500, "height": 375, "upload_date": "08 January 2007", "owner_id": 70471, "owner_name": "David Thyberg", "owner_url": "http://www.panoramio.com/user/70471"} + , + {"photo_id": 1408683, "photo_title": "Dragon", "photo_url": "http://www.panoramio.com/photo/1408683", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1408683.jpg", "longitude": 11.099625, "latitude": 24.203758, "width": 334, "height": 500, "upload_date": "20 March 2007", "owner_id": 232099, "owner_name": "mabut", "owner_url": "http://www.panoramio.com/user/232099"} + , + {"photo_id": 58293, "photo_title": "Hundeschlittenrennen in Werfenweng", "photo_url": "http://www.panoramio.com/photo/58293", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/58293.jpg", "longitude": 13.263245, "latitude": 47.465062, "width": 500, "height": 377, "upload_date": "07 October 2006", "owner_id": 8060, "owner_name": "Norbert MAIER", "owner_url": "http://www.panoramio.com/user/8060"} + , + {"photo_id": 1488328, "photo_title": "", "photo_url": "http://www.panoramio.com/photo/1488328", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1488328.jpg", "longitude": 139.290161, "latitude": 37.860218, "width": 500, "height": 383, "upload_date": "25 March 2007", "owner_id": 86411, "owner_name": "中村脩-Osamu nakamura", "owner_url": "http://www.panoramio.com/user/86411"} + , + {"photo_id": 5439200, "photo_title": "shinjuku", "photo_url": "http://www.panoramio.com/photo/5439200", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5439200.jpg", "longitude": 139.693281, "latitude": 35.690921, "width": 500, "height": 500, "upload_date": "20 October 2007", "owner_id": 128403, "owner_name": "mechanics", "owner_url": "http://www.panoramio.com/user/128403"} + , + {"photo_id": 86241, "photo_title": "camino", "photo_url": "http://www.panoramio.com/photo/86241", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/86241.jpg", "longitude": -1.145668, "latitude": 38.170464, "width": 333, "height": 500, "upload_date": "25 November 2006", "owner_id": 10969, "owner_name": "Juanra", "owner_url": "http://www.panoramio.com/user/10969"} + , + {"photo_id": 4757733, "photo_title": "MASSIVE WAVE", "photo_url": "http://www.panoramio.com/photo/4757733", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4757733.jpg", "longitude": -1.262569, "latitude": 44.426793, "width": 259, "height": 500, "upload_date": "19 September 2007", "owner_id": 521836, "owner_name": "KLEFER", "owner_url": "http://www.panoramio.com/user/521836"} + , + {"photo_id": 941286, "photo_title": "Mesa Arch (3x1 pano)", "photo_url": "http://www.panoramio.com/photo/941286", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/941286.jpg", "longitude": -109.863667, "latitude": 38.388159, "width": 500, "height": 181, "upload_date": "21 February 2007", "owner_id": 66847, "owner_name": "Lukas Novak", "owner_url": "http://www.panoramio.com/user/66847"} + , + {"photo_id": 1284843, "photo_title": "Озеро Хангар в кратере вулкана", "photo_url": "http://www.panoramio.com/photo/1284843", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1284843.jpg", "longitude": 157.393055, "latitude": 54.764255, "width": 500, "height": 197, "upload_date": "12 March 2007", "owner_id": 268724, "owner_name": "Korotnev AV", "owner_url": "http://www.panoramio.com/user/268724"} + , + {"photo_id": 2602988, "photo_title": "The best beach of Manihi", "photo_url": "http://www.panoramio.com/photo/2602988", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2602988.jpg", "longitude": -145.847282, "latitude": -14.348134, "width": 500, "height": 333, "upload_date": "06 June 2007", "owner_id": 232099, "owner_name": "mabut", "owner_url": "http://www.panoramio.com/user/232099"} + , + {"photo_id": 2273013, "photo_title": "Another View of Vedra Island", "photo_url": "http://www.panoramio.com/photo/2273013", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2273013.jpg", "longitude": 1.247164, "latitude": 38.859406, "width": 500, "height": 465, "upload_date": "18 May 2007", "owner_id": 213866, "owner_name": "Nicolas Mertens", "owner_url": "http://www.panoramio.com/user/213866"} + , + {"photo_id": 8857011, "photo_title": "The Subway,Zion NP", "photo_url": "http://www.panoramio.com/photo/8857011", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/8857011.jpg", "longitude": -113.055840, "latitude": 37.308741, "width": 500, "height": 375, "upload_date": "26 March 2008", "owner_id": 1465912, "owner_name": "funtor", "owner_url": "http://www.panoramio.com/user/1465912"} + , + {"photo_id": 167606, "photo_title": "Rainy Causeway Bay", "photo_url": "http://www.panoramio.com/photo/167606", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/167606.jpg", "longitude": 114.169595, "latitude": 22.293028, "width": 500, "height": 238, "upload_date": "16 December 2006", "owner_id": 31693, "owner_name": "Huw Thomas", "owner_url": "http://www.panoramio.com/user/31693"} + , + {"photo_id": 11077834, "photo_title": "In sunset", "photo_url": "http://www.panoramio.com/photo/11077834", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/11077834.jpg", "longitude": 174.865694, "latitude": -41.330162, "width": 500, "height": 357, "upload_date": "10 June 2008", "owner_id": 1248894, "owner_name": "Eva Kaprinay", "owner_url": "http://www.panoramio.com/user/1248894"} + , + {"photo_id": 10919439, "photo_title": "Majestic Møøse", "photo_url": "http://www.panoramio.com/photo/10919439", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/10919439.jpg", "longitude": -110.549712, "latitude": 43.866322, "width": 500, "height": 400, "upload_date": "04 June 2008", "owner_id": 376395, "owner_name": "JeffSullivan (www.MyPhotoGuides.com)", "owner_url": "http://www.panoramio.com/user/376395"} + , + {"photo_id": 4892928, "photo_title": "tsukudajima", "photo_url": "http://www.panoramio.com/photo/4892928", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4892928.jpg", "longitude": 139.788172, "latitude": 35.672141, "width": 430, "height": 500, "upload_date": "25 September 2007", "owner_id": 128403, "owner_name": "mechanics", "owner_url": "http://www.panoramio.com/user/128403"} + , + {"photo_id": 5798660, "photo_title": "Guiding Light", "photo_url": "http://www.panoramio.com/photo/5798660", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5798660.jpg", "longitude": -111.374674, "latitude": 36.861974, "width": 333, "height": 500, "upload_date": "08 November 2007", "owner_id": 376395, "owner_name": "JeffSullivan (www.MyPhotoGuides.com)", "owner_url": "http://www.panoramio.com/user/376395"} + , + {"photo_id": 94219, "photo_title": "Bridge of Manganji", "photo_url": "http://www.panoramio.com/photo/94219", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/94219.jpg", "longitude": 137.821137, "latitude": 36.329284, "width": 500, "height": 375, "upload_date": "09 December 2006", "owner_id": 11781, "owner_name": "ANDRE GARDELLA", "owner_url": "http://www.panoramio.com/user/11781"} + , + {"photo_id": 3772695, "photo_title": "Fotomontaggio di Arquata & Andromeda", "photo_url": "http://www.panoramio.com/photo/3772695", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3772695.jpg", "longitude": 13.304100, "latitude": 42.773731, "width": 500, "height": 375, "upload_date": "07 August 2007", "owner_id": 646873, "owner_name": "Fabio Roman", "owner_url": "http://www.panoramio.com/user/646873"} + , + {"photo_id": 1314842, "photo_title": "Река Сим с моста (1729 км)", "photo_url": "http://www.panoramio.com/photo/1314842", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1314842.jpg", "longitude": 57.309623, "latitude": 55.013544, "width": 500, "height": 335, "upload_date": "14 March 2007", "owner_id": 268724, "owner_name": "Korotnev AV", "owner_url": "http://www.panoramio.com/user/268724"} + , + {"photo_id": 5333278, "photo_title": "hong kong, early evening", "photo_url": "http://www.panoramio.com/photo/5333278", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5333278.jpg", "longitude": 114.151651, "latitude": 22.280112, "width": 375, "height": 500, "upload_date": "15 October 2007", "owner_id": 90373, "owner_name": "michael habla", "owner_url": "http://www.panoramio.com/user/90373"} + , + {"photo_id": 2574624, "photo_title": "Mount Everest", "photo_url": "http://www.panoramio.com/photo/2574624", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2574624.jpg", "longitude": 86.933270, "latitude": 27.979546, "width": 500, "height": 375, "upload_date": "04 June 2007", "owner_id": 534045, "owner_name": "Lucjon", "owner_url": "http://www.panoramio.com/user/534045"} + , + {"photo_id": 160808, "photo_title": "Luquillo Beach", "photo_url": "http://www.panoramio.com/photo/160808", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/160808.jpg", "longitude": -65.677128, "latitude": 18.364871, "width": 500, "height": 375, "upload_date": "16 December 2006", "owner_id": 28766, "owner_name": "Tim Jansa", "owner_url": "http://www.panoramio.com/user/28766"} + , + {"photo_id": 2883625, "photo_title": "Sokorói impresszió", "photo_url": "http://www.panoramio.com/photo/2883625", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2883625.jpg", "longitude": 17.678204, "latitude": 47.533661, "width": 500, "height": 332, "upload_date": "22 June 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 287785, "photo_title": "Cascada Fuente del Algar © (Foto_Seb)", "photo_url": "http://www.panoramio.com/photo/287785", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/287785.jpg", "longitude": -0.095959, "latitude": 38.659359, "width": 500, "height": 332, "upload_date": "03 January 2007", "owner_id": 55833, "owner_name": "Sebastien Pigneur Jans (Outdoor Photographer) seolta@terra.es", "owner_url": "http://www.panoramio.com/user/55833"} + , + {"photo_id": 354350, "photo_title": "Bondhus icefall up close", "photo_url": "http://www.panoramio.com/photo/354350", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/354350.jpg", "longitude": 6.296539, "latitude": 60.071436, "width": 500, "height": 332, "upload_date": "09 January 2007", "owner_id": 39160, "owner_name": "Snemann", "owner_url": "http://www.panoramio.com/user/39160"} + , + {"photo_id": 3625784, "photo_title": "P.N.P.J.(Croacia)", "photo_url": "http://www.panoramio.com/photo/3625784", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3625784.jpg", "longitude": 15.612602, "latitude": 44.883911, "width": 500, "height": 375, "upload_date": "30 July 2007", "owner_id": 83865, "owner_name": "Epi F.Villanueva", "owner_url": "http://www.panoramio.com/user/83865"} + , + {"photo_id": 4866107, "photo_title": "Milkdrop sunset", "photo_url": "http://www.panoramio.com/photo/4866107", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4866107.jpg", "longitude": 16.693897, "latitude": 43.183338, "width": 334, "height": 500, "upload_date": "24 September 2007", "owner_id": 989, "owner_name": "Mrgud", "owner_url": "http://www.panoramio.com/user/989"} + , + {"photo_id": 5217595, "photo_title": "kolory...", "photo_url": "http://www.panoramio.com/photo/5217595", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5217595.jpg", "longitude": 17.990541, "latitude": 54.253292, "width": 375, "height": 500, "upload_date": "10 October 2007", "owner_id": 277750, "owner_name": "Karolina P.", "owner_url": "http://www.panoramio.com/user/277750"} + , + {"photo_id": 1235515, "photo_title": "Gangga sunset", "photo_url": "http://www.panoramio.com/photo/1235515", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1235515.jpg", "longitude": 115.063634, "latitude": -8.586962, "width": 332, "height": 500, "upload_date": "09 March 2007", "owner_id": 232099, "owner_name": "mabut", "owner_url": "http://www.panoramio.com/user/232099"} + , + {"photo_id": 88143, "photo_title": "Anse Cocos - La Digue - Seychelles", "photo_url": "http://www.panoramio.com/photo/88143", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/88143.jpg", "longitude": 55.850029, "latitude": -4.365924, "width": 500, "height": 375, "upload_date": "28 November 2006", "owner_id": 11098, "owner_name": "Michele Masnata", "owner_url": "http://www.panoramio.com/user/11098"} + , + {"photo_id": 993105, "photo_title": "Dinos", "photo_url": "http://www.panoramio.com/photo/993105", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/993105.jpg", "longitude": 47.267990, "latitude": 34.392321, "width": 432, "height": 500, "upload_date": "24 February 2007", "owner_id": 83972, "owner_name": "Maxim Popov (http://www.popovm.ru)", "owner_url": "http://www.panoramio.com/user/83972"} + , + {"photo_id": 3382098, "photo_title": "Golden sunset", "photo_url": "http://www.panoramio.com/photo/3382098", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3382098.jpg", "longitude": -9.231960, "latitude": 38.652899, "width": 500, "height": 375, "upload_date": "18 July 2007", "owner_id": 465080, "owner_name": "Vasco Pires", "owner_url": "http://www.panoramio.com/user/465080"} + , + {"photo_id": 4689747, "photo_title": "La disipación de un ensueño", "photo_url": "http://www.panoramio.com/photo/4689747", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4689747.jpg", "longitude": -73.231199, "latitude": -39.817288, "width": 500, "height": 375, "upload_date": "16 September 2007", "owner_id": 327310, "owner_name": "Erwin Woenckhaus", "owner_url": "http://www.panoramio.com/user/327310"} + , + {"photo_id": 2520917, "photo_title": "Két vihar közt alkonyatkor", "photo_url": "http://www.panoramio.com/photo/2520917", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2520917.jpg", "longitude": 17.514782, "latitude": 47.747057, "width": 500, "height": 334, "upload_date": "02 June 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 419927, "photo_title": "echigoheiya", "photo_url": "http://www.panoramio.com/photo/419927", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/419927.jpg", "longitude": 138.885427, "latitude": 37.568562, "width": 500, "height": 334, "upload_date": "14 January 2007", "owner_id": 86411, "owner_name": "中村脩-Osamu nakamura", "owner_url": "http://www.panoramio.com/user/86411"} + , + {"photo_id": 1977433, "photo_title": "Victoria Falls, devils cauldron natural hot tub at lip of falls", "photo_url": "http://www.panoramio.com/photo/1977433", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1977433.jpg", "longitude": 25.853426, "latitude": -17.923924, "width": 500, "height": 375, "upload_date": "29 April 2007", "owner_id": 165455, "owner_name": "snorth", "owner_url": "http://www.panoramio.com/user/165455"} + , + {"photo_id": 3417691, "photo_title": "Völgy-Zugoly", "photo_url": "http://www.panoramio.com/photo/3417691", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3417691.jpg", "longitude": 17.826734, "latitude": 47.359293, "width": 500, "height": 346, "upload_date": "20 July 2007", "owner_id": 689769, "owner_name": "Ponty István", "owner_url": "http://www.panoramio.com/user/689769"} + , + {"photo_id": 4166241, "photo_title": "Egy másik világ", "photo_url": "http://www.panoramio.com/photo/4166241", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4166241.jpg", "longitude": 18.056545, "latitude": 47.276667, "width": 333, "height": 500, "upload_date": "25 August 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 3976033, "photo_title": "Sunrise Blüemlisalp Switzerland", "photo_url": "http://www.panoramio.com/photo/3976033", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3976033.jpg", "longitude": 7.779844, "latitude": 46.528974, "width": 500, "height": 333, "upload_date": "16 August 2007", "owner_id": 47930, "owner_name": "werni", "owner_url": "http://www.panoramio.com/user/47930"} + , + {"photo_id": 1449570, "photo_title": "Akabat", "photo_url": "http://www.panoramio.com/photo/1449570", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1449570.jpg", "longitude": 28.286717, "latitude": 27.484675, "width": 500, "height": 304, "upload_date": "22 March 2007", "owner_id": 304324, "owner_name": "OxyPhoto.ru - O x y", "owner_url": "http://www.panoramio.com/user/304324"} + , + {"photo_id": 8802, "photo_title": "Statue of Liberty [003393]", "photo_url": "http://www.panoramio.com/photo/8802", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/8802.jpg", "longitude": -74.044375, "latitude": 40.688871, "width": 500, "height": 375, "upload_date": "27 January 2006", "owner_id": 1489, "owner_name": "Thorsten", "owner_url": "http://www.panoramio.com/user/1489"} + , + {"photo_id": 6015859, "photo_title": "Amazing place to drink ouzo", "photo_url": "http://www.panoramio.com/photo/6015859", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6015859.jpg", "longitude": 23.057030, "latitude": 36.687990, "width": 500, "height": 333, "upload_date": "19 November 2007", "owner_id": 242446, "owner_name": "Ntinos Lagos", "owner_url": "http://www.panoramio.com/user/242446"} + , + {"photo_id": 653941, "photo_title": "Mt. Moran across Jackson Lake", "photo_url": "http://www.panoramio.com/photo/653941", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/653941.jpg", "longitude": -110.656099, "latitude": 43.897336, "width": 500, "height": 374, "upload_date": "02 February 2007", "owner_id": 87752, "owner_name": "Richard Ryer", "owner_url": "http://www.panoramio.com/user/87752"} + , + {"photo_id": 354695, "photo_title": "Dresden_Zwinger_01", "photo_url": "http://www.panoramio.com/photo/354695", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/354695.jpg", "longitude": 13.734369, "latitude": 51.053481, "width": 399, "height": 500, "upload_date": "09 January 2007", "owner_id": 71628, "owner_name": "Ulrich Hässler, Dresden", "owner_url": "http://www.panoramio.com/user/71628"} + , + {"photo_id": 8327051, "photo_title": "Anelito di .... luce", "photo_url": "http://www.panoramio.com/photo/8327051", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/8327051.jpg", "longitude": 13.717203, "latitude": 45.699706, "width": 500, "height": 375, "upload_date": "06 March 2008", "owner_id": 1121720, "owner_name": "▬ Mauro Antonini ▬", "owner_url": "http://www.panoramio.com/user/1121720"} + , + {"photo_id": 522126, "photo_title": "Íme a ludas hogy Márton lemaradt", "photo_url": "http://www.panoramio.com/photo/522126", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/522126.jpg", "longitude": 16.855431, "latitude": 47.653594, "width": 500, "height": 319, "upload_date": "21 January 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 3948179, "photo_title": " petit matin en Vendée, sur la rive droite du Jaunay, 11 août 2007. #921, 933", "photo_url": "http://www.panoramio.com/photo/3948179", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3948179.jpg", "longitude": -1.901278, "latitude": 46.663487, "width": 500, "height": 343, "upload_date": "15 August 2007", "owner_id": 666755, "owner_name": "Armagnac", "owner_url": "http://www.panoramio.com/user/666755"} + , + {"photo_id": 1781399, "photo_title": "Dawn in Yosemite Valley", "photo_url": "http://www.panoramio.com/photo/1781399", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1781399.jpg", "longitude": -119.590645, "latitude": 37.743775, "width": 333, "height": 500, "upload_date": "15 April 2007", "owner_id": 376395, "owner_name": "JeffSullivan (www.MyPhotoGuides.com)", "owner_url": "http://www.panoramio.com/user/376395"} + , + {"photo_id": 905112, "photo_title": "Searea buildings in Odaiba", "photo_url": "http://www.panoramio.com/photo/905112", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/905112.jpg", "longitude": 139.773039, "latitude": 35.635670, "width": 500, "height": 372, "upload_date": "19 February 2007", "owner_id": 78856, "owner_name": "chrisjongkind • archive", "owner_url": "http://www.panoramio.com/user/78856"} + , + {"photo_id": 6935706, "photo_title": "poranek w ogniu - morning on fire", "photo_url": "http://www.panoramio.com/photo/6935706", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6935706.jpg", "longitude": 20.319901, "latitude": 49.730028, "width": 500, "height": 332, "upload_date": "06 January 2008", "owner_id": 454219, "owner_name": "Rafal Ociepka", "owner_url": "http://www.panoramio.com/user/454219"} + , + {"photo_id": 29606, "photo_title": "Romance entre el Agua y la Roca", "photo_url": "http://www.panoramio.com/photo/29606", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/29606.jpg", "longitude": -64.859161, "latitude": -31.991480, "width": 500, "height": 375, "upload_date": "01 July 2006", "owner_id": 4483, "owner_name": "Miguel Coranti", "owner_url": "http://www.panoramio.com/user/4483"} + , + {"photo_id": 58290, "photo_title": "Taurachbahn", "photo_url": "http://www.panoramio.com/photo/58290", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/58290.jpg", "longitude": 13.688021, "latitude": 47.130418, "width": 500, "height": 369, "upload_date": "07 October 2006", "owner_id": 8060, "owner_name": "Norbert MAIER", "owner_url": "http://www.panoramio.com/user/8060"} + , + {"photo_id": 44982, "photo_title": "Paris200412PJDSC_9304l", "photo_url": "http://www.panoramio.com/photo/44982", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/44982.jpg", "longitude": 2.301636, "latitude": 48.853760, "width": 500, "height": 332, "upload_date": "02 September 2006", "owner_id": 6703, "owner_name": "Peter Jansen", "owner_url": "http://www.panoramio.com/user/6703"} + , + {"photo_id": 532669, "photo_title": "Closeup of wheatfield in november", "photo_url": "http://www.panoramio.com/photo/532669", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/532669.jpg", "longitude": 11.276093, "latitude": 59.644239, "width": 375, "height": 500, "upload_date": "22 January 2007", "owner_id": 39160, "owner_name": "Snemann", "owner_url": "http://www.panoramio.com/user/39160"} + , + {"photo_id": 723648, "photo_title": "Elk near Jasper", "photo_url": "http://www.panoramio.com/photo/723648", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/723648.jpg", "longitude": -118.046207, "latitude": 52.923290, "width": 500, "height": 332, "upload_date": "07 February 2007", "owner_id": 66847, "owner_name": "Lukas Novak", "owner_url": "http://www.panoramio.com/user/66847"} + , + {"photo_id": 535234, "photo_title": "Cathedral Cove near Hahei, New Zealand", "photo_url": "http://www.panoramio.com/photo/535234", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/535234.jpg", "longitude": 175.790222, "latitude": -36.828611, "width": 500, "height": 375, "upload_date": "22 January 2007", "owner_id": 101257, "owner_name": "Denis Campbell", "owner_url": "http://www.panoramio.com/user/101257"} + , + {"photo_id": 15299, "photo_title": "Bodrum Sunset", "photo_url": "http://www.panoramio.com/photo/15299", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/15299.jpg", "longitude": 27.425308, "latitude": 37.028595, "width": 500, "height": 375, "upload_date": "19 March 2006", "owner_id": 2351, "owner_name": "Serdar Bilecen", "owner_url": "http://www.panoramio.com/user/2351"} + , + {"photo_id": 1932227, "photo_title": "Mono Lake 3", "photo_url": "http://www.panoramio.com/photo/1932227", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1932227.jpg", "longitude": -119.023819, "latitude": 37.940068, "width": 333, "height": 500, "upload_date": "26 April 2007", "owner_id": 40260, "owner_name": "Don Albonico", "owner_url": "http://www.panoramio.com/user/40260"} + , + {"photo_id": 744906, "photo_title": "Tsukahara Highland", "photo_url": "http://www.panoramio.com/photo/744906", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/744906.jpg", "longitude": 131.403952, "latitude": 33.320201, "width": 500, "height": 375, "upload_date": "08 February 2007", "owner_id": 11781, "owner_name": "ANDRE GARDELLA", "owner_url": "http://www.panoramio.com/user/11781"} + , + {"photo_id": 490198, "photo_title": "Jal Mahal, Jaipur", "photo_url": "http://www.panoramio.com/photo/490198", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/490198.jpg", "longitude": 75.842797, "latitude": 26.954571, "width": 500, "height": 403, "upload_date": "19 January 2007", "owner_id": 10456, "owner_name": "eulogio", "owner_url": "http://www.panoramio.com/user/10456"} + , + {"photo_id": 451032, "photo_title": "Mono Lake", "photo_url": "http://www.panoramio.com/photo/451032", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/451032.jpg", "longitude": -119.017537, "latitude": 37.941803, "width": 363, "height": 500, "upload_date": "16 January 2007", "owner_id": 93560, "owner_name": "Alex Petrov", "owner_url": "http://www.panoramio.com/user/93560"} + , + {"photo_id": 5808345, "photo_title": "Majesty in the snow", "photo_url": "http://www.panoramio.com/photo/5808345", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5808345.jpg", "longitude": 9.944987, "latitude": 48.684866, "width": 367, "height": 500, "upload_date": "09 November 2007", "owner_id": 424589, "owner_name": "PeSchn", "owner_url": "http://www.panoramio.com/user/424589"} + , + {"photo_id": 2718436, "photo_title": "BKCC view northwest", "photo_url": "http://www.panoramio.com/photo/2718436", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2718436.jpg", "longitude": 139.752048, "latitude": 35.708102, "width": 500, "height": 365, "upload_date": "12 June 2007", "owner_id": 558055, "owner_name": "www.tokyoform.com", "owner_url": "http://www.panoramio.com/user/558055"} + , + {"photo_id": 5446639, "photo_title": "Осень", "photo_url": "http://www.panoramio.com/photo/5446639", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5446639.jpg", "longitude": 23.824694, "latitude": 53.680547, "width": 500, "height": 375, "upload_date": "21 October 2007", "owner_id": 937915, "owner_name": "HiV", "owner_url": "http://www.panoramio.com/user/937915"} + , + {"photo_id": 3393267, "photo_title": "Barco hundido (pecio) /Shipwreck /épave ", "photo_url": "http://www.panoramio.com/photo/3393267", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3393267.jpg", "longitude": -81.680587, "latitude": 45.255181, "width": 329, "height": 500, "upload_date": "18 July 2007", "owner_id": 401966, "owner_name": "Syl de Canada", "owner_url": "http://www.panoramio.com/user/401966"} + , + {"photo_id": 4369140, "photo_title": "Beach on Håja", "photo_url": "http://www.panoramio.com/photo/4369140", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4369140.jpg", "longitude": 18.096886, "latitude": 69.740825, "width": 500, "height": 375, "upload_date": "03 September 2007", "owner_id": 39160, "owner_name": "Snemann", "owner_url": "http://www.panoramio.com/user/39160"} + , + {"photo_id": 3711738, "photo_title": "Safe", "photo_url": "http://www.panoramio.com/photo/3711738", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3711738.jpg", "longitude": 1.787220, "latitude": 41.224610, "width": 500, "height": 375, "upload_date": "04 August 2007", "owner_id": 138691, "owner_name": "Josep Maria Alegre", "owner_url": "http://www.panoramio.com/user/138691"} + , + {"photo_id": 7415554, "photo_title": "Sunrise at Hae-keum-gang, Korea", "photo_url": "http://www.panoramio.com/photo/7415554", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/7415554.jpg", "longitude": 128.605957, "latitude": 34.698719, "width": 500, "height": 500, "upload_date": "28 January 2008", "owner_id": 1221287, "owner_name": "TS Jeung", "owner_url": "http://www.panoramio.com/user/1221287"} + , + {"photo_id": 10129080, "photo_title": "Polish Silesia sunset.", "photo_url": "http://www.panoramio.com/photo/10129080", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/10129080.jpg", "longitude": 18.819752, "latitude": 49.789798, "width": 500, "height": 335, "upload_date": "11 May 2008", "owner_id": 548131, "owner_name": "murart", "owner_url": "http://www.panoramio.com/user/548131"} + , + {"photo_id": 11827263, "photo_title": ": Casa Rustica", "photo_url": "http://www.panoramio.com/photo/11827263", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/11827263.jpg", "longitude": -8.644395, "latitude": 42.795039, "width": 500, "height": 375, "upload_date": "05 July 2008", "owner_id": 546858, "owner_name": "Lazariparcero", "owner_url": "http://www.panoramio.com/user/546858"} + , + {"photo_id": 9185096, "photo_title": "E per cambiare... oggi è nevicato ! 07.04.2008", "photo_url": "http://www.panoramio.com/photo/9185096", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/9185096.jpg", "longitude": 11.469633, "latitude": 46.304547, "width": 500, "height": 375, "upload_date": "07 April 2008", "owner_id": 6033, "owner_name": "► Marco Vanzo", "owner_url": "http://www.panoramio.com/user/6033"} + , + {"photo_id": 691, "photo_title": "Monasterio de Santa Catalina. Arequipa, Perú", "photo_url": "http://www.panoramio.com/photo/691", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/691.jpg", "longitude": -71.536671, "latitude": -16.395835, "width": 500, "height": 375, "upload_date": "05 October 2005", "owner_id": 7, "owner_name": "Eduardo Manchón", "owner_url": "http://www.panoramio.com/user/7"} + , + {"photo_id": 672525, "photo_title": "Pyramid", "photo_url": "http://www.panoramio.com/photo/672525", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/672525.jpg", "longitude": 31.132421, "latitude": 29.978283, "width": 500, "height": 474, "upload_date": "03 February 2007", "owner_id": 123698, "owner_name": "© Kojak", "owner_url": "http://www.panoramio.com/user/123698"} + , + {"photo_id": 275730, "photo_title": "Oberalp - 2033 m", "photo_url": "http://www.panoramio.com/photo/275730", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/275730.jpg", "longitude": 8.668191, "latitude": 46.661528, "width": 500, "height": 333, "upload_date": "01 January 2007", "owner_id": 57869, "owner_name": "NAGY Albert", "owner_url": "http://www.panoramio.com/user/57869"} + , + {"photo_id": 3661332, "photo_title": "Angkor - Temple vs Trees", "photo_url": "http://www.panoramio.com/photo/3661332", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3661332.jpg", "longitude": 103.855079, "latitude": 13.449099, "width": 500, "height": 461, "upload_date": "01 August 2007", "owner_id": 73104, "owner_name": "zerega", "owner_url": "http://www.panoramio.com/user/73104"} + , + {"photo_id": 336151, "photo_title": "Lake north of Tupaassat", "photo_url": "http://www.panoramio.com/photo/336151", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/336151.jpg", "longitude": -44.307861, "latitude": 60.376030, "width": 500, "height": 333, "upload_date": "07 January 2007", "owner_id": 62557, "owner_name": "Dirk Jenrich", "owner_url": "http://www.panoramio.com/user/62557"} + , + {"photo_id": 423705, "photo_title": "Bouche du Pu`u `Ō`ō", "photo_url": "http://www.panoramio.com/photo/423705", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/423705.jpg", "longitude": -155.106182, "latitude": 19.390101, "width": 500, "height": 349, "upload_date": "14 January 2007", "owner_id": 75602, "owner_name": "Lloulhy", "owner_url": "http://www.panoramio.com/user/75602"} + , + {"photo_id": 1344795, "photo_title": "Tree in a field, Aerial", "photo_url": "http://www.panoramio.com/photo/1344795", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1344795.jpg", "longitude": 12.058611, "latitude": 55.471581, "width": 500, "height": 332, "upload_date": "16 March 2007", "owner_id": 278074, "owner_name": "H. C. Steensen", "owner_url": "http://www.panoramio.com/user/278074"} + , + {"photo_id": 5591839, "photo_title": "Can I touch the clouds?", "photo_url": "http://www.panoramio.com/photo/5591839", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5591839.jpg", "longitude": 130.689411, "latitude": 33.305569, "width": 333, "height": 500, "upload_date": "28 October 2007", "owner_id": 775356, "owner_name": "ascesis.image", "owner_url": "http://www.panoramio.com/user/775356"} + , + {"photo_id": 5476386, "photo_title": "Nuages crépusculaires sur le Lauterbrunnental", "photo_url": "http://www.panoramio.com/photo/5476386", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5476386.jpg", "longitude": 7.908010, "latitude": 46.592490, "width": 500, "height": 375, "upload_date": "22 October 2007", "owner_id": 359127, "owner_name": "wx", "owner_url": "http://www.panoramio.com/user/359127"} + , + {"photo_id": 459556, "photo_title": "minatopia", "photo_url": "http://www.panoramio.com/photo/459556", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/459556.jpg", "longitude": 139.058182, "latitude": 37.930041, "width": 381, "height": 500, "upload_date": "16 January 2007", "owner_id": 86411, "owner_name": "中村脩-Osamu nakamura", "owner_url": "http://www.panoramio.com/user/86411"} + , + {"photo_id": 1407525, "photo_title": "Mackinac Bridge, Michigan", "photo_url": "http://www.panoramio.com/photo/1407525", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1407525.jpg", "longitude": -84.729652, "latitude": 45.788250, "width": 500, "height": 313, "upload_date": "20 March 2007", "owner_id": 60173, "owner_name": "Lars Jensen", "owner_url": "http://www.panoramio.com/user/60173"} + , + {"photo_id": 74790, "photo_title": "kang taiga with moon in sunset", "photo_url": "http://www.panoramio.com/photo/74790", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/74790.jpg", "longitude": 86.830101, "latitude": 27.811750, "width": 500, "height": 334, "upload_date": "03 November 2006", "owner_id": 9812, "owner_name": "wsm earp", "owner_url": "http://www.panoramio.com/user/9812"} + , + {"photo_id": 4025902, "photo_title": "Coloured Poznań ", "photo_url": "http://www.panoramio.com/photo/4025902", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4025902.jpg", "longitude": 16.934255, "latitude": 52.407878, "width": 500, "height": 316, "upload_date": "19 August 2007", "owner_id": 369127, "owner_name": "♥ Caterpillar", "owner_url": "http://www.panoramio.com/user/369127"} + , + {"photo_id": 88121, "photo_title": "View from Punta Martin - Liguria - Italy", "photo_url": "http://www.panoramio.com/photo/88121", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/88121.jpg", "longitude": 8.795028, "latitude": 44.468489, "width": 500, "height": 375, "upload_date": "28 November 2006", "owner_id": 11098, "owner_name": "Michele Masnata", "owner_url": "http://www.panoramio.com/user/11098"} + , + {"photo_id": 8214845, "photo_title": "Molino Albolafia,cauce del Guadalquivir(Córdoba)", "photo_url": "http://www.panoramio.com/photo/8214845", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/8214845.jpg", "longitude": -4.780898, "latitude": 37.876242, "width": 500, "height": 375, "upload_date": "01 March 2008", "owner_id": 83865, "owner_name": "Epi F.Villanueva", "owner_url": "http://www.panoramio.com/user/83865"} + , + {"photo_id": 23364, "photo_title": "Alanya, Taurus-Mountains of Kemer", "photo_url": "http://www.panoramio.com/photo/23364", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/23364.jpg", "longitude": 31.979656, "latitude": 36.548466, "width": 500, "height": 375, "upload_date": "10 June 2006", "owner_id": 3760, "owner_name": "Frank Pustlauck", "owner_url": "http://www.panoramio.com/user/3760"} + , + {"photo_id": 6128452, "photo_title": "В осеннем парке - In autumn park", "photo_url": "http://www.panoramio.com/photo/6128452", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6128452.jpg", "longitude": 37.458926, "latitude": 55.737422, "width": 500, "height": 500, "upload_date": "25 November 2007", "owner_id": 244932, "owner_name": "Andrey Jitkov", "owner_url": "http://www.panoramio.com/user/244932"} + , + {"photo_id": 4356679, "photo_title": "Old Santa Fe Caboose", "photo_url": "http://www.panoramio.com/photo/4356679", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4356679.jpg", "longitude": -119.699687, "latitude": 36.707083, "width": 500, "height": 335, "upload_date": "03 September 2007", "owner_id": 339677, "owner_name": "Chip Stephan", "owner_url": "http://www.panoramio.com/user/339677"} + , + {"photo_id": 436312, "photo_title": "tokimesse", "photo_url": "http://www.panoramio.com/photo/436312", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/436312.jpg", "longitude": 139.059105, "latitude": 37.932013, "width": 396, "height": 500, "upload_date": "15 January 2007", "owner_id": 86411, "owner_name": "中村脩-Osamu nakamura", "owner_url": "http://www.panoramio.com/user/86411"} + , + {"photo_id": 1089381, "photo_title": "Szabadon szélben", "photo_url": "http://www.panoramio.com/photo/1089381", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1089381.jpg", "longitude": 17.604561, "latitude": 47.588799, "width": 332, "height": 500, "upload_date": "28 February 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 5667175, "photo_title": "Northen Lights", "photo_url": "http://www.panoramio.com/photo/5667175", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5667175.jpg", "longitude": 28.482399, "latitude": 66.227860, "width": 500, "height": 333, "upload_date": "01 November 2007", "owner_id": 897591, "owner_name": "markku pirttimaa www.karhukuusamo.com", "owner_url": "http://www.panoramio.com/user/897591"} + , + {"photo_id": 1317737, "photo_title": "Bora Bora", "photo_url": "http://www.panoramio.com/photo/1317737", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1317737.jpg", "longitude": -151.739988, "latitude": -16.538715, "width": 500, "height": 351, "upload_date": "14 March 2007", "owner_id": 232099, "owner_name": "mabut", "owner_url": "http://www.panoramio.com/user/232099"} + , + {"photo_id": 993129, "photo_title": "Würzburg", "photo_url": "http://www.panoramio.com/photo/993129", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/993129.jpg", "longitude": 9.931523, "latitude": 49.793310, "width": 500, "height": 395, "upload_date": "24 February 2007", "owner_id": 83972, "owner_name": "Maxim Popov (http://www.popovm.ru)", "owner_url": "http://www.panoramio.com/user/83972"} + , + {"photo_id": 1836922, "photo_title": "Fountain Place / Dallas / Texas", "photo_url": "http://www.panoramio.com/photo/1836922", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1836922.jpg", "longitude": -96.802940, "latitude": 32.785236, "width": 500, "height": 405, "upload_date": "19 April 2007", "owner_id": 57778, "owner_name": "William Lile", "owner_url": "http://www.panoramio.com/user/57778"} + , + {"photo_id": 3409786, "photo_title": "Molinos de Elguea con Gorbea al fondo", "photo_url": "http://www.panoramio.com/photo/3409786", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3409786.jpg", "longitude": -2.325025, "latitude": 42.951271, "width": 500, "height": 303, "upload_date": "19 July 2007", "owner_id": 129297, "owner_name": "Enrique Ortiz de Zárate", "owner_url": "http://www.panoramio.com/user/129297"} + , + {"photo_id": 476284, "photo_title": "Place \"Poda\"", "photo_url": "http://www.panoramio.com/photo/476284", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/476284.jpg", "longitude": 27.471657, "latitude": 42.447655, "width": 500, "height": 357, "upload_date": "18 January 2007", "owner_id": 16880, "owner_name": "evgenidinev.com", "owner_url": "http://www.panoramio.com/user/16880"} + , + {"photo_id": 3499645, "photo_title": "Tükör-kép", "photo_url": "http://www.panoramio.com/photo/3499645", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3499645.jpg", "longitude": 17.503667, "latitude": 47.843522, "width": 500, "height": 333, "upload_date": "24 July 2007", "owner_id": 689769, "owner_name": "Ponty István", "owner_url": "http://www.panoramio.com/user/689769"} + , + {"photo_id": 1419901, "photo_title": "Øresundsbroen seen from Sweden (The Dragon Tail), Aerial", "photo_url": "http://www.panoramio.com/photo/1419901", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1419901.jpg", "longitude": 12.885418, "latitude": 55.566213, "width": 332, "height": 500, "upload_date": "20 March 2007", "owner_id": 278074, "owner_name": "H. C. Steensen", "owner_url": "http://www.panoramio.com/user/278074"} + , + {"photo_id": 441727, "photo_title": "Фортеця у Кам'янці-Подільському", "photo_url": "http://www.panoramio.com/photo/441727", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/441727.jpg", "longitude": 26.563311, "latitude": 48.672486, "width": 375, "height": 500, "upload_date": "15 January 2007", "owner_id": 13058, "owner_name": "Kyryl", "owner_url": "http://www.panoramio.com/user/13058"} + , + {"photo_id": 309122, "photo_title": "Standing Stone, Spittal of Glenshee", "photo_url": "http://www.panoramio.com/photo/309122", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/309122.jpg", "longitude": -3.461593, "latitude": 56.814745, "width": 500, "height": 332, "upload_date": "05 January 2007", "owner_id": 64815, "owner_name": "PigleT", "owner_url": "http://www.panoramio.com/user/64815"} + , + {"photo_id": 2599560, "photo_title": "Isigaki Island Hirakubosaki lighthouse 石垣島 平久保崎灯台", "photo_url": "http://www.panoramio.com/photo/2599560", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2599560.jpg", "longitude": 124.315994, "latitude": 24.610064, "width": 500, "height": 328, "upload_date": "06 June 2007", "owner_id": 446937, "owner_name": "y_komatsu", "owner_url": "http://www.panoramio.com/user/446937"} + , + {"photo_id": 6545801, "photo_title": "Front Range of the Canadian Rocky Mountains", "photo_url": "http://www.panoramio.com/photo/6545801", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6545801.jpg", "longitude": -115.248213, "latitude": 51.026389, "width": 500, "height": 338, "upload_date": "18 December 2007", "owner_id": 85489, "owner_name": "Bruce MacIver", "owner_url": "http://www.panoramio.com/user/85489"} + , + {"photo_id": 1254026, "photo_title": "Hagia Sophia (inside)", "photo_url": "http://www.panoramio.com/photo/1254026", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1254026.jpg", "longitude": 28.979831, "latitude": 41.008548, "width": 500, "height": 408, "upload_date": "10 March 2007", "owner_id": 258322, "owner_name": "www.tatjana.ingold.ch", "owner_url": "http://www.panoramio.com/user/258322"} + , + {"photo_id": 911501, "photo_title": "View from Nordenskiöldtoppen, Svalbard", "photo_url": "http://www.panoramio.com/photo/911501", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/911501.jpg", "longitude": 15.402832, "latitude": 78.184088, "width": 500, "height": 308, "upload_date": "20 February 2007", "owner_id": 66734, "owner_name": "Svein Solhaug", "owner_url": "http://www.panoramio.com/user/66734"} + , + {"photo_id": 3797140, "photo_title": "Mas Francesc", "photo_url": "http://www.panoramio.com/photo/3797140", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3797140.jpg", "longitude": 2.408388, "latitude": 41.962346, "width": 500, "height": 332, "upload_date": "08 August 2007", "owner_id": 756267, "owner_name": "Albert Codina", "owner_url": "http://www.panoramio.com/user/756267"} + , + {"photo_id": 150165, "photo_title": "Aso crater from the air", "photo_url": "http://www.panoramio.com/photo/150165", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/150165.jpg", "longitude": 131.083159, "latitude": 32.885390, "width": 500, "height": 375, "upload_date": "14 December 2006", "owner_id": 11781, "owner_name": "ANDRE GARDELLA", "owner_url": "http://www.panoramio.com/user/11781"} + , + {"photo_id": 532631, "photo_title": "Last bath in Oslofjorden - self portrait", "photo_url": "http://www.panoramio.com/photo/532631", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/532631.jpg", "longitude": 10.782223, "latitude": 59.854773, "width": 500, "height": 205, "upload_date": "22 January 2007", "owner_id": 39160, "owner_name": "Snemann", "owner_url": "http://www.panoramio.com/user/39160"} + , + {"photo_id": 3978149, "photo_title": "Les Mines 3", "photo_url": "http://www.panoramio.com/photo/3978149", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3978149.jpg", "longitude": 1.315312, "latitude": 45.921961, "width": 500, "height": 500, "upload_date": "16 August 2007", "owner_id": 372189, "owner_name": "Phil©", "owner_url": "http://www.panoramio.com/user/372189"} + , + {"photo_id": 848807, "photo_title": "mystic morning", "photo_url": "http://www.panoramio.com/photo/848807", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/848807.jpg", "longitude": 10.144372, "latitude": 54.323031, "width": 375, "height": 500, "upload_date": "17 February 2007", "owner_id": 73946, "owner_name": "pembo", "owner_url": "http://www.panoramio.com/user/73946"} + , + {"photo_id": 4097972, "photo_title": "Dry Land", "photo_url": "http://www.panoramio.com/photo/4097972", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4097972.jpg", "longitude": 25.936694, "latitude": 41.660906, "width": 500, "height": 333, "upload_date": "22 August 2007", "owner_id": 16880, "owner_name": "evgenidinev.com", "owner_url": "http://www.panoramio.com/user/16880"} + , + {"photo_id": 479927, "photo_title": "Monterosso at night", "photo_url": "http://www.panoramio.com/photo/479927", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/479927.jpg", "longitude": 9.655094, "latitude": 44.144461, "width": 500, "height": 357, "upload_date": "18 January 2007", "owner_id": 100907, "owner_name": "Julia Wahl", "owner_url": "http://www.panoramio.com/user/100907"} + , + {"photo_id": 50872, "photo_title": "Düne 40 auf dem Weg nach Sossusvlei ...", "photo_url": "http://www.panoramio.com/photo/50872", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/50872.jpg", "longitude": 15.593033, "latitude": -24.720950, "width": 500, "height": 192, "upload_date": "22 September 2006", "owner_id": 7434, "owner_name": "baldinger reisen ag, waedenswil/switzerland", "owner_url": "http://www.panoramio.com/user/7434"} + , + {"photo_id": 2903483, "photo_title": "Reggeli", "photo_url": "http://www.panoramio.com/photo/2903483", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2903483.jpg", "longitude": 17.469549, "latitude": 47.868977, "width": 410, "height": 500, "upload_date": "23 June 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 4226249, "photo_title": "Rainbow", "photo_url": "http://www.panoramio.com/photo/4226249", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4226249.jpg", "longitude": 9.615569, "latitude": 62.529150, "width": 500, "height": 230, "upload_date": "27 August 2007", "owner_id": 223406, "owner_name": "Sigmund Rise", "owner_url": "http://www.panoramio.com/user/223406"} + , + {"photo_id": 2267849, "photo_title": "Rayos vistos desde mi ventana", "photo_url": "http://www.panoramio.com/photo/2267849", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2267849.jpg", "longitude": -89.203963, "latitude": 13.728734, "width": 500, "height": 375, "upload_date": "17 May 2007", "owner_id": 170919, "owner_name": "Wilber Calderón - El Salvador", "owner_url": "http://www.panoramio.com/user/170919"} + , + {"photo_id": 459470, "photo_title": "bandaibashi4", "photo_url": "http://www.panoramio.com/photo/459470", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/459470.jpg", "longitude": 139.051123, "latitude": 37.919081, "width": 500, "height": 399, "upload_date": "16 January 2007", "owner_id": 86411, "owner_name": "中村脩-Osamu nakamura", "owner_url": "http://www.panoramio.com/user/86411"} + , + {"photo_id": 5279707, "photo_title": "Jægervasstindane", "photo_url": "http://www.panoramio.com/photo/5279707", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5279707.jpg", "longitude": 19.651279, "latitude": 69.771296, "width": 500, "height": 375, "upload_date": "13 October 2007", "owner_id": 39160, "owner_name": "Snemann", "owner_url": "http://www.panoramio.com/user/39160"} + , + {"photo_id": 1057758, "photo_title": "Giant dragonfly in rice field", "photo_url": "http://www.panoramio.com/photo/1057758", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1057758.jpg", "longitude": 137.115641, "latitude": 34.862834, "width": 500, "height": 375, "upload_date": "27 February 2007", "owner_id": 11781, "owner_name": "ANDRE GARDELLA", "owner_url": "http://www.panoramio.com/user/11781"} + , + {"photo_id": 479454, "photo_title": "Morning sun over lake Øymarksjøen", "photo_url": "http://www.panoramio.com/photo/479454", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/479454.jpg", "longitude": 11.637611, "latitude": 59.338617, "width": 333, "height": 500, "upload_date": "18 January 2007", "owner_id": 39160, "owner_name": "Snemann", "owner_url": "http://www.panoramio.com/user/39160"} + , + {"photo_id": 87263, "photo_title": "Payun - Mendoza - Argentina", "photo_url": "http://www.panoramio.com/photo/87263", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/87263.jpg", "longitude": -69.280128, "latitude": -36.643080, "width": 500, "height": 333, "upload_date": "27 November 2006", "owner_id": 8409, "owner_name": "Hector Fabian Garrido", "owner_url": "http://www.panoramio.com/user/8409"} + , + {"photo_id": 11430112, "photo_title": "Tramonto dalla Pietra Parcellara", "photo_url": "http://www.panoramio.com/photo/11430112", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/11430112.jpg", "longitude": 9.476480, "latitude": 44.843334, "width": 500, "height": 375, "upload_date": "22 June 2008", "owner_id": 22921, "owner_name": "Francesco Favalesi - VAL LURETTA", "owner_url": "http://www.panoramio.com/user/22921"} + , + {"photo_id": 33760, "photo_title": "Yu Yuan Gardens", "photo_url": "http://www.panoramio.com/photo/33760", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/33760.jpg", "longitude": 121.487803, "latitude": 31.228821, "width": 500, "height": 375, "upload_date": "21 July 2006", "owner_id": 5168, "owner_name": "Markus Källander", "owner_url": "http://www.panoramio.com/user/5168"} + , + {"photo_id": 1935332, "photo_title": "Lafayette", "photo_url": "http://www.panoramio.com/photo/1935332", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1935332.jpg", "longitude": 2.311839, "latitude": 48.864475, "width": 384, "height": 500, "upload_date": "26 April 2007", "owner_id": 372189, "owner_name": "Phil©", "owner_url": "http://www.panoramio.com/user/372189"} + , + {"photo_id": 2558954, "photo_title": "Two Thumbs Morning", "photo_url": "http://www.panoramio.com/photo/2558954", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2558954.jpg", "longitude": 170.463352, "latitude": -43.999792, "width": 500, "height": 400, "upload_date": "04 June 2007", "owner_id": 286729, "owner_name": "jimwitkowski", "owner_url": "http://www.panoramio.com/user/286729"} + , + {"photo_id": 94190, "photo_title": "morning light", "photo_url": "http://www.panoramio.com/photo/94190", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/94190.jpg", "longitude": 138.362846, "latitude": 35.981896, "width": 500, "height": 375, "upload_date": "09 December 2006", "owner_id": 11781, "owner_name": "ANDRE GARDELLA", "owner_url": "http://www.panoramio.com/user/11781"} + , + {"photo_id": 1283054, "photo_title": "Panorama - Bahia desde la playa", "photo_url": "http://www.panoramio.com/photo/1283054", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1283054.jpg", "longitude": -1.990094, "latitude": 43.316053, "width": 500, "height": 167, "upload_date": "12 March 2007", "owner_id": 218075, "owner_name": "fotoramas", "owner_url": "http://www.panoramio.com/user/218075"} + , + {"photo_id": 2541040, "photo_title": "Színförgeteg", "photo_url": "http://www.panoramio.com/photo/2541040", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2541040.jpg", "longitude": 17.506886, "latitude": 47.744403, "width": 500, "height": 334, "upload_date": "03 June 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 837872, "photo_title": "Midnight Sunset", "photo_url": "http://www.panoramio.com/photo/837872", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/837872.jpg", "longitude": -14.670181, "latitude": 65.142363, "width": 500, "height": 333, "upload_date": "16 February 2007", "owner_id": 175423, "owner_name": "Fabien Barrau", "owner_url": "http://www.panoramio.com/user/175423"} + , + {"photo_id": 1706995, "photo_title": "Cantera de Manresa", "photo_url": "http://www.panoramio.com/photo/1706995", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1706995.jpg", "longitude": 3.131152, "latitude": 39.868942, "width": 335, "height": 500, "upload_date": "09 April 2007", "owner_id": 61890, "owner_name": "enriquevidalphoto.com", "owner_url": "http://www.panoramio.com/user/61890"} + , + {"photo_id": 575731, "photo_title": "Le Mont Saint-Michel (Francia)", "photo_url": "http://www.panoramio.com/photo/575731", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/575731.jpg", "longitude": -1.498604, "latitude": 48.636085, "width": 500, "height": 334, "upload_date": "26 January 2007", "owner_id": 38814, "owner_name": "Romeo Ferrari", "owner_url": "http://www.panoramio.com/user/38814"} + , + {"photo_id": 1960951, "photo_title": "Utah Autumn Aspen", "photo_url": "http://www.panoramio.com/photo/1960951", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1960951.jpg", "longitude": -111.620750, "latitude": 40.441721, "width": 500, "height": 332, "upload_date": "28 April 2007", "owner_id": 107359, "owner_name": "Ron Cooper", "owner_url": "http://www.panoramio.com/user/107359"} + , + {"photo_id": 162298, "photo_title": "Nuvole (Effetto Dio) sopra Marano Ticino (2 of 2), settembre 2005", "photo_url": "http://www.panoramio.com/photo/162298", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/162298.jpg", "longitude": 8.623238, "latitude": 45.629825, "width": 500, "height": 375, "upload_date": "16 December 2006", "owner_id": 18925, "owner_name": "Marco Ferrari", "owner_url": "http://www.panoramio.com/user/18925"} + , + {"photo_id": 9358587, "photo_title": "Sicilia, a me bedda!", "photo_url": "http://www.panoramio.com/photo/9358587", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/9358587.jpg", "longitude": 14.652908, "latitude": 38.068172, "width": 500, "height": 375, "upload_date": "14 April 2008", "owner_id": 325031, "owner_name": "Gibrail", "owner_url": "http://www.panoramio.com/user/325031"} + , + {"photo_id": 11271799, "photo_title": "Candelaria, version completa ( Candelaria, full version )", "photo_url": "http://www.panoramio.com/photo/11271799", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/11271799.jpg", "longitude": -18.005776, "latitude": 27.750886, "width": 334, "height": 500, "upload_date": "16 June 2008", "owner_id": 787217, "owner_name": "♣ Víctor S de Lara ♣", "owner_url": "http://www.panoramio.com/user/787217"} + , + {"photo_id": 81, "photo_title": "North Cape from plane", "photo_url": "http://www.panoramio.com/photo/81", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/81.jpg", "longitude": 25.786285, "latitude": 71.171196, "width": 500, "height": 340, "upload_date": "30 July 2005", "owner_id": 7, "owner_name": "Eduardo Manchón", "owner_url": "http://www.panoramio.com/user/7"} + , + {"photo_id": 6548480, "photo_title": "珠峰晓月", "photo_url": "http://www.panoramio.com/photo/6548480", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6548480.jpg", "longitude": 86.857567, "latitude": 28.119833, "width": 500, "height": 332, "upload_date": "18 December 2007", "owner_id": 1201050, "owner_name": "黄河影人", "owner_url": "http://www.panoramio.com/user/1201050"} + , + {"photo_id": 1989382, "photo_title": "", "photo_url": "http://www.panoramio.com/photo/1989382", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1989382.jpg", "longitude": 20.628827, "latitude": 52.062874, "width": 500, "height": 375, "upload_date": "29 April 2007", "owner_id": 234038, "owner_name": "Jacek M.", "owner_url": "http://www.panoramio.com/user/234038"} + , + {"photo_id": 3186699, "photo_title": "Ruta del Cares: Paredón de los Collainos -más 400 m. de vertical-", "photo_url": "http://www.panoramio.com/photo/3186699", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3186699.jpg", "longitude": -4.863296, "latitude": 43.253174, "width": 335, "height": 500, "upload_date": "08 July 2007", "owner_id": 129297, "owner_name": "Enrique Ortiz de Zárate", "owner_url": "http://www.panoramio.com/user/129297"} + , + {"photo_id": 9899533, "photo_title": "Grado: Are you Ready? . . . . . . . . . Honorable mention \"Scenery\" May Contest 2008", "photo_url": "http://www.panoramio.com/photo/9899533", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/9899533.jpg", "longitude": 13.395016, "latitude": 45.676262, "width": 500, "height": 375, "upload_date": "04 May 2008", "owner_id": 381221, "owner_name": "Flavio Snidero", "owner_url": "http://www.panoramio.com/user/381221"} + , + {"photo_id": 324623, "photo_title": "richmond bridge", "photo_url": "http://www.panoramio.com/photo/324623", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/324623.jpg", "longitude": 147.439506, "latitude": -42.734358, "width": 500, "height": 375, "upload_date": "06 January 2007", "owner_id": 66974, "owner_name": "lieskovec", "owner_url": "http://www.panoramio.com/user/66974"} + , + {"photo_id": 4450585, "photo_title": "Giorno di riposo", "photo_url": "http://www.panoramio.com/photo/4450585", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4450585.jpg", "longitude": 35.440521, "latitude": 33.732906, "width": 500, "height": 375, "upload_date": "06 September 2007", "owner_id": 407625, "owner_name": "Lyana Luna", "owner_url": "http://www.panoramio.com/user/407625"} + , + {"photo_id": 1088801, "photo_title": "Kalászos impresszió", "photo_url": "http://www.panoramio.com/photo/1088801", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1088801.jpg", "longitude": 17.727127, "latitude": 47.444575, "width": 500, "height": 360, "upload_date": "28 February 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 290083, "photo_title": "Beach full of life", "photo_url": "http://www.panoramio.com/photo/290083", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/290083.jpg", "longitude": -59.072113, "latitude": -52.430478, "width": 335, "height": 500, "upload_date": "03 January 2007", "owner_id": 61890, "owner_name": "enriquevidalphoto.com", "owner_url": "http://www.panoramio.com/user/61890"} + , + {"photo_id": 5734694, "photo_title": "Virginia Horse Country", "photo_url": "http://www.panoramio.com/photo/5734694", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5734694.jpg", "longitude": -78.754292, "latitude": 38.014964, "width": 500, "height": 375, "upload_date": "05 November 2007", "owner_id": 523038, "owner_name": "Yank in Dixie", "owner_url": "http://www.panoramio.com/user/523038"} + , + {"photo_id": 6012970, "photo_title": "Herbstliches Venedig", "photo_url": "http://www.panoramio.com/photo/6012970", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6012970.jpg", "longitude": 12.343435, "latitude": 45.433752, "width": 500, "height": 336, "upload_date": "19 November 2007", "owner_id": 8060, "owner_name": "Norbert MAIER", "owner_url": "http://www.panoramio.com/user/8060"} + , + {"photo_id": 6321454, "photo_title": "Sea Storm III - \" Dragonara \" Castle", "photo_url": "http://www.panoramio.com/photo/6321454", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6321454.jpg", "longitude": 9.151177, "latitude": 44.350211, "width": 444, "height": 500, "upload_date": "05 December 2007", "owner_id": 180947, "owner_name": "gilberto silvestri", "owner_url": "http://www.panoramio.com/user/180947"} + , + {"photo_id": 459569, "photo_title": "mt hakkai", "photo_url": "http://www.panoramio.com/photo/459569", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/459569.jpg", "longitude": 138.921432, "latitude": 37.092157, "width": 500, "height": 389, "upload_date": "16 January 2007", "owner_id": 86411, "owner_name": "中村脩-Osamu nakamura", "owner_url": "http://www.panoramio.com/user/86411"} + , + {"photo_id": 940337, "photo_title": "Sunrising Monuments", "photo_url": "http://www.panoramio.com/photo/940337", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/940337.jpg", "longitude": -110.110474, "latitude": 36.980255, "width": 500, "height": 287, "upload_date": "21 February 2007", "owner_id": 66847, "owner_name": "Lukas Novak", "owner_url": "http://www.panoramio.com/user/66847"} + , + {"photo_id": 2400305, "photo_title": "Cape of Favaritx, Gateway to Another Planet", "photo_url": "http://www.panoramio.com/photo/2400305", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2400305.jpg", "longitude": 4.264122, "latitude": 39.996608, "width": 500, "height": 352, "upload_date": "26 May 2007", "owner_id": 213866, "owner_name": "Nicolas Mertens", "owner_url": "http://www.panoramio.com/user/213866"} + , + {"photo_id": 398130, "photo_title": "Aiguille du Chardonnet", "photo_url": "http://www.panoramio.com/photo/398130", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/398130.jpg", "longitude": 7.013569, "latitude": 45.979190, "width": 500, "height": 333, "upload_date": "12 January 2007", "owner_id": 78506, "owner_name": "Philippe Stoop", "owner_url": "http://www.panoramio.com/user/78506"} + , + {"photo_id": 283954, "photo_title": "Dong-ao:The most beautiful coast of Taiwan", "photo_url": "http://www.panoramio.com/photo/283954", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/283954.jpg", "longitude": 121.850481, "latitude": 24.524822, "width": 500, "height": 375, "upload_date": "02 January 2007", "owner_id": 60214, "owner_name": "swinelin", "owner_url": "http://www.panoramio.com/user/60214"} + , + {"photo_id": 5115188, "photo_title": "Iceland", "photo_url": "http://www.panoramio.com/photo/5115188", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5115188.jpg", "longitude": -23.008804, "latitude": 64.947976, "width": 500, "height": 333, "upload_date": "05 October 2007", "owner_id": 588149, "owner_name": "Adam Salwanowicz", "owner_url": "http://www.panoramio.com/user/588149"} + , + {"photo_id": 1865268, "photo_title": "Rainbow Ridge Sunset", "photo_url": "http://www.panoramio.com/photo/1865268", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1865268.jpg", "longitude": -112.404728, "latitude": 36.426808, "width": 500, "height": 333, "upload_date": "21 April 2007", "owner_id": 66847, "owner_name": "Lukas Novak", "owner_url": "http://www.panoramio.com/user/66847"} + , + {"photo_id": 1633076, "photo_title": "Parliament", "photo_url": "http://www.panoramio.com/photo/1633076", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1633076.jpg", "longitude": 19.046752, "latitude": 47.512998, "width": 500, "height": 500, "upload_date": "04 April 2007", "owner_id": 52226, "owner_name": "jenoapu", "owner_url": "http://www.panoramio.com/user/52226"} + , + {"photo_id": 800056, "photo_title": "Karst Landscape in Guangxi, China", "photo_url": "http://www.panoramio.com/photo/800056", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/800056.jpg", "longitude": 107.121944, "latitude": 23.605000, "width": 500, "height": 191, "upload_date": "13 February 2007", "owner_id": 164125, "owner_name": "DannyXu", "owner_url": "http://www.panoramio.com/user/164125"} + , + {"photo_id": 21304, "photo_title": "Matterhorn", "photo_url": "http://www.panoramio.com/photo/21304", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/21304.jpg", "longitude": 7.718582, "latitude": 45.994577, "width": 375, "height": 500, "upload_date": "28 May 2006", "owner_id": 3404, "owner_name": "Csongor Böröczky", "owner_url": "http://www.panoramio.com/user/3404"} + , + {"photo_id": 402493, "photo_title": "Burg-Eltz", "photo_url": "http://www.panoramio.com/photo/402493", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/402493.jpg", "longitude": 7.336400, "latitude": 50.206104, "width": 369, "height": 500, "upload_date": "12 January 2007", "owner_id": 6105, "owner_name": "hackltom", "owner_url": "http://www.panoramio.com/user/6105"} + , + {"photo_id": 411453, "photo_title": "Dune 45 in Sosussvlei", "photo_url": "http://www.panoramio.com/photo/411453", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/411453.jpg", "longitude": 15.397339, "latitude": -24.739972, "width": 500, "height": 333, "upload_date": "13 January 2007", "owner_id": 78506, "owner_name": "Philippe Stoop", "owner_url": "http://www.panoramio.com/user/78506"} + , + {"photo_id": 1813822, "photo_title": "Csendes délután", "photo_url": "http://www.panoramio.com/photo/1813822", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1813822.jpg", "longitude": 17.779655, "latitude": 47.507229, "width": 500, "height": 334, "upload_date": "17 April 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 798783, "photo_title": "Georgia, Antelope Canyon, AZ", "photo_url": "http://www.panoramio.com/photo/798783", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/798783.jpg", "longitude": -111.385489, "latitude": 36.873441, "width": 376, "height": 500, "upload_date": "12 February 2007", "owner_id": 52440, "owner_name": "Hank Waxman", "owner_url": "http://www.panoramio.com/user/52440"} + , + {"photo_id": 5193281, "photo_title": "The park at Gamlehaugen a bautiful day in September 2007, Bergen - Norway", "photo_url": "http://www.panoramio.com/photo/5193281", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5193281.jpg", "longitude": 5.336909, "latitude": 60.341253, "width": 500, "height": 279, "upload_date": "09 October 2007", "owner_id": 121518, "owner_name": "S.M Tunli - www.tunliweb.no", "owner_url": "http://www.panoramio.com/user/121518"} + , + {"photo_id": 642882, "photo_title": "La Presolana e la Cometa Hale-Bopp", "photo_url": "http://www.panoramio.com/photo/642882", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/642882.jpg", "longitude": 10.094032, "latitude": 45.927991, "width": 500, "height": 375, "upload_date": "01 February 2007", "owner_id": 38814, "owner_name": "Romeo Ferrari", "owner_url": "http://www.panoramio.com/user/38814"} + , + {"photo_id": 304963, "photo_title": "Calanque d'En Vau 2", "photo_url": "http://www.panoramio.com/photo/304963", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/304963.jpg", "longitude": 5.500288, "latitude": 43.201422, "width": 500, "height": 375, "upload_date": "05 January 2007", "owner_id": 64344, "owner_name": "Seb - Lyon", "owner_url": "http://www.panoramio.com/user/64344"} + , + {"photo_id": 6126154, "photo_title": "Swan - EPping Forest", "photo_url": "http://www.panoramio.com/photo/6126154", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6126154.jpg", "longitude": 0.025658, "latitude": 51.638836, "width": 499, "height": 500, "upload_date": "25 November 2007", "owner_id": 1130880, "owner_name": "marksimms", "owner_url": "http://www.panoramio.com/user/1130880"} + , + {"photo_id": 441426, "photo_title": "Dettifoss", "photo_url": "http://www.panoramio.com/photo/441426", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/441426.jpg", "longitude": -16.390743, "latitude": 65.819939, "width": 500, "height": 350, "upload_date": "15 January 2007", "owner_id": 78506, "owner_name": "Philippe Stoop", "owner_url": "http://www.panoramio.com/user/78506"} + , + {"photo_id": 4105301, "photo_title": "Eikesdalsvatnet. Norway.", "photo_url": "http://www.panoramio.com/photo/4105301", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4105301.jpg", "longitude": 8.171768, "latitude": 62.561718, "width": 500, "height": 326, "upload_date": "22 August 2007", "owner_id": 806637, "owner_name": "Bjørn Fransgjerde", "owner_url": "http://www.panoramio.com/user/806637"} + , + {"photo_id": 519765, "photo_title": "Derűs szeglet", "photo_url": "http://www.panoramio.com/photo/519765", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/519765.jpg", "longitude": 17.173862, "latitude": 46.633997, "width": 500, "height": 282, "upload_date": "21 January 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 4401751, "photo_title": "Fire Escape", "photo_url": "http://www.panoramio.com/photo/4401751", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4401751.jpg", "longitude": -2.315347, "latitude": 52.644873, "width": 366, "height": 500, "upload_date": "04 September 2007", "owner_id": 1295, "owner_name": "Matthew Walters", "owner_url": "http://www.panoramio.com/user/1295"} + , + {"photo_id": 1747294, "photo_title": "Red Fort II / Fuerte rojo II", "photo_url": "http://www.panoramio.com/photo/1747294", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1747294.jpg", "longitude": 73.017197, "latitude": 26.296801, "width": 500, "height": 375, "upload_date": "12 April 2007", "owner_id": 414, "owner_name": "Sonia Villegas", "owner_url": "http://www.panoramio.com/user/414"} + , + {"photo_id": 2856289, "photo_title": "Copacabana Praia", "photo_url": "http://www.panoramio.com/photo/2856289", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2856289.jpg", "longitude": -43.179188, "latitude": -22.969457, "width": 500, "height": 375, "upload_date": "20 June 2007", "owner_id": 496676, "owner_name": "Quasebart", "owner_url": "http://www.panoramio.com/user/496676"} + , + {"photo_id": 3116906, "photo_title": "Mototaki Falls", "photo_url": "http://www.panoramio.com/photo/3116906", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3116906.jpg", "longitude": 139.954662, "latitude": 39.158750, "width": 500, "height": 375, "upload_date": "04 July 2007", "owner_id": 164173, "owner_name": "tsushima", "owner_url": "http://www.panoramio.com/user/164173"} + , + {"photo_id": 8919659, "photo_title": "Bavarian Forest", "photo_url": "http://www.panoramio.com/photo/8919659", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/8919659.jpg", "longitude": 12.429099, "latitude": 49.084548, "width": 500, "height": 332, "upload_date": "28 March 2008", "owner_id": 696605, "owner_name": "© alfredschaffer", "owner_url": "http://www.panoramio.com/user/696605"} + , + {"photo_id": 2040174, "photo_title": "Looking east from Sognefjellet - april 29", "photo_url": "http://www.panoramio.com/photo/2040174", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2040174.jpg", "longitude": 7.974873, "latitude": 61.561141, "width": 375, "height": 500, "upload_date": "03 May 2007", "owner_id": 39160, "owner_name": "Snemann", "owner_url": "http://www.panoramio.com/user/39160"} + , + {"photo_id": 1195122, "photo_title": "Cerro Macon", "photo_url": "http://www.panoramio.com/photo/1195122", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1195122.jpg", "longitude": -67.356405, "latitude": -24.528540, "width": 335, "height": 500, "upload_date": "06 March 2007", "owner_id": 232099, "owner_name": "mabut", "owner_url": "http://www.panoramio.com/user/232099"} + , + {"photo_id": 1182587, "photo_title": "Gaggenau-Moosbronn, Wallfahrtskirche", "photo_url": "http://www.panoramio.com/photo/1182587", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1182587.jpg", "longitude": 8.384285, "latitude": 48.840486, "width": 382, "height": 500, "upload_date": "05 March 2007", "owner_id": 66229, "owner_name": "Mast", "owner_url": "http://www.panoramio.com/user/66229"} + , + {"photo_id": 4787323, "photo_title": "Hell's Gate(Antigua-Caribe)", "photo_url": "http://www.panoramio.com/photo/4787323", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4787323.jpg", "longitude": -61.722651, "latitude": 17.140052, "width": 500, "height": 375, "upload_date": "20 September 2007", "owner_id": 83865, "owner_name": "Epi F.Villanueva", "owner_url": "http://www.panoramio.com/user/83865"} + , + {"photo_id": 5474175, "photo_title": "Chemin bucolique au Lauterbrunnental 2", "photo_url": "http://www.panoramio.com/photo/5474175", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5474175.jpg", "longitude": 7.909877, "latitude": 46.580479, "width": 500, "height": 384, "upload_date": "22 October 2007", "owner_id": 359127, "owner_name": "wx", "owner_url": "http://www.panoramio.com/user/359127"} + , + {"photo_id": 479364, "photo_title": "The Earth Above Us II", "photo_url": "http://www.panoramio.com/photo/479364", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/479364.jpg", "longitude": 19.053029, "latitude": 47.601392, "width": 500, "height": 317, "upload_date": "18 January 2007", "owner_id": 57869, "owner_name": "NAGY Albert", "owner_url": "http://www.panoramio.com/user/57869"} + , + {"photo_id": 575110, "photo_title": "A huge wave crashes against the front of Kiama Blowhole www.ozthunder.com", "photo_url": "http://www.panoramio.com/photo/575110", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/575110.jpg", "longitude": 150.863657, "latitude": -34.671264, "width": 500, "height": 338, "upload_date": "26 January 2007", "owner_id": 67208, "owner_name": "Michael Thompson", "owner_url": "http://www.panoramio.com/user/67208"} + , + {"photo_id": 543624, "photo_title": "Dalmát álom", "photo_url": "http://www.panoramio.com/photo/543624", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/543624.jpg", "longitude": 15.969143, "latitude": 43.624768, "width": 500, "height": 333, "upload_date": "23 January 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 121224, "photo_title": "ParadisePW", "photo_url": "http://www.panoramio.com/photo/121224", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/121224.jpg", "longitude": -62.907715, "latitude": -64.830254, "width": 500, "height": 329, "upload_date": "12 December 2006", "owner_id": 19856, "owner_name": "Juan Kratzmaier", "owner_url": "http://www.panoramio.com/user/19856"} + , + {"photo_id": 10074505, "photo_title": "Volcàn Chaitèn, Chaitèn, Palena, Chile Por Daniel Basualto", "photo_url": "http://www.panoramio.com/photo/10074505", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/10074505.jpg", "longitude": -72.759705, "latitude": -42.908160, "width": 375, "height": 500, "upload_date": "10 May 2008", "owner_id": 88547, "owner_name": "Patricia Santini", "owner_url": "http://www.panoramio.com/user/88547"} + , + {"photo_id": 10378, "photo_title": "Chiang Mai, temple", "photo_url": "http://www.panoramio.com/photo/10378", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/10378.jpg", "longitude": 98.921596, "latitude": 18.805157, "width": 319, "height": 500, "upload_date": "06 February 2006", "owner_id": 414, "owner_name": "Sonia Villegas", "owner_url": "http://www.panoramio.com/user/414"} + , + {"photo_id": 532620, "photo_title": "Morning mist near Skjønhaug", "photo_url": "http://www.panoramio.com/photo/532620", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/532620.jpg", "longitude": 11.297293, "latitude": 59.639511, "width": 333, "height": 500, "upload_date": "22 January 2007", "owner_id": 39160, "owner_name": "Snemann", "owner_url": "http://www.panoramio.com/user/39160"} + , + {"photo_id": 625805, "photo_title": "Primosten blue(s)", "photo_url": "http://www.panoramio.com/photo/625805", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/625805.jpg", "longitude": 15.932236, "latitude": 43.575168, "width": 500, "height": 334, "upload_date": "30 January 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 247704, "photo_title": "Paris in the night", "photo_url": "http://www.panoramio.com/photo/247704", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/247704.jpg", "longitude": 2.294512, "latitude": 48.858052, "width": 327, "height": 500, "upload_date": "27 December 2006", "owner_id": 51517, "owner_name": "threshold2000", "owner_url": "http://www.panoramio.com/user/51517"} + , + {"photo_id": 73888, "photo_title": "Fitz-Roy", "photo_url": "http://www.panoramio.com/photo/73888", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/73888.jpg", "longitude": -72.987328, "latitude": -49.277885, "width": 500, "height": 204, "upload_date": "01 November 2006", "owner_id": 7372, "owner_name": "vuillet", "owner_url": "http://www.panoramio.com/user/7372"} + , + {"photo_id": 6065568, "photo_title": "Amigos para siempre Paris-Francia", "photo_url": "http://www.panoramio.com/photo/6065568", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6065568.jpg", "longitude": 2.288697, "latitude": 48.861906, "width": 375, "height": 500, "upload_date": "22 November 2007", "owner_id": 83865, "owner_name": "Epi F.Villanueva", "owner_url": "http://www.panoramio.com/user/83865"} + , + {"photo_id": 9643938, "photo_title": "Occhio indiscreto ... sulla città ... illuminata ", "photo_url": "http://www.panoramio.com/photo/9643938", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/9643938.jpg", "longitude": 13.818569, "latitude": 45.641329, "width": 500, "height": 449, "upload_date": "23 April 2008", "owner_id": 1121720, "owner_name": "▬ Mauro Antonini ▬", "owner_url": "http://www.panoramio.com/user/1121720"} + , + {"photo_id": 532643, "photo_title": "Icecarved granite at Herføl", "photo_url": "http://www.panoramio.com/photo/532643", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/532643.jpg", "longitude": 11.054649, "latitude": 58.986512, "width": 375, "height": 500, "upload_date": "22 January 2007", "owner_id": 39160, "owner_name": "Snemann", "owner_url": "http://www.panoramio.com/user/39160"} + , + {"photo_id": 112298, "photo_title": "paris06_004IR", "photo_url": "http://www.panoramio.com/photo/112298", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/112298.jpg", "longitude": 2.343779, "latitude": 48.887746, "width": 500, "height": 500, "upload_date": "11 December 2006", "owner_id": 17599, "owner_name": "Dmitry Andreev", "owner_url": "http://www.panoramio.com/user/17599"} + , + {"photo_id": 525997, "photo_title": "Grand Canyon Desert View", "photo_url": "http://www.panoramio.com/photo/525997", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/525997.jpg", "longitude": -111.824341, "latitude": 36.043547, "width": 500, "height": 333, "upload_date": "22 January 2007", "owner_id": 85489, "owner_name": "Bruce MacIver", "owner_url": "http://www.panoramio.com/user/85489"} + , + {"photo_id": 2972849, "photo_title": "Donadea Forest", "photo_url": "http://www.panoramio.com/photo/2972849", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2972849.jpg", "longitude": -6.743374, "latitude": 53.346555, "width": 500, "height": 377, "upload_date": "27 June 2007", "owner_id": 137785, "owner_name": "W@Z", "owner_url": "http://www.panoramio.com/user/137785"} + , + {"photo_id": 1175992, "photo_title": "Mt. Roberts Tram, Juneau, Alaska", "photo_url": "http://www.panoramio.com/photo/1175992", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1175992.jpg", "longitude": -134.391643, "latitude": 58.294679, "width": 500, "height": 347, "upload_date": "05 March 2007", "owner_id": 52440, "owner_name": "Hank Waxman", "owner_url": "http://www.panoramio.com/user/52440"} + , + {"photo_id": 462521, "photo_title": "Fontaine de Trevi", "photo_url": "http://www.panoramio.com/photo/462521", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/462521.jpg", "longitude": 12.483280, "latitude": 41.901047, "width": 500, "height": 333, "upload_date": "17 January 2007", "owner_id": 78506, "owner_name": "Philippe Stoop", "owner_url": "http://www.panoramio.com/user/78506"} + , + {"photo_id": 848316, "photo_title": "Malyovitsa, Rila", "photo_url": "http://www.panoramio.com/photo/848316", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/848316.jpg", "longitude": 23.383627, "latitude": 42.201517, "width": 500, "height": 357, "upload_date": "17 February 2007", "owner_id": 16880, "owner_name": "evgenidinev.com", "owner_url": "http://www.panoramio.com/user/16880"} + , + {"photo_id": 459453, "photo_title": "bandaibashi3", "photo_url": "http://www.panoramio.com/photo/459453", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/459453.jpg", "longitude": 139.055586, "latitude": 37.920436, "width": 500, "height": 382, "upload_date": "16 January 2007", "owner_id": 86411, "owner_name": "中村脩-Osamu nakamura", "owner_url": "http://www.panoramio.com/user/86411"} + , + {"photo_id": 968639, "photo_title": "张永富 黄山风光06 Huangshan", "photo_url": "http://www.panoramio.com/photo/968639", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/968639.jpg", "longitude": 118.166199, "latitude": 30.105633, "width": 348, "height": 500, "upload_date": "23 February 2007", "owner_id": 203011, "owner_name": "SammyZhang", "owner_url": "http://www.panoramio.com/user/203011"} + , + {"photo_id": 97731, "photo_title": "Kaimondake", "photo_url": "http://www.panoramio.com/photo/97731", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/97731.jpg", "longitude": 130.652161, "latitude": 31.247443, "width": 500, "height": 212, "upload_date": "09 December 2006", "owner_id": 11781, "owner_name": "ANDRE GARDELLA", "owner_url": "http://www.panoramio.com/user/11781"} + , + {"photo_id": 2859205, "photo_title": "Lundy Lake Sunset", "photo_url": "http://www.panoramio.com/photo/2859205", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2859205.jpg", "longitude": -119.221230, "latitude": 38.031597, "width": 400, "height": 500, "upload_date": "21 June 2007", "owner_id": 376395, "owner_name": "JeffSullivan (www.MyPhotoGuides.com)", "owner_url": "http://www.panoramio.com/user/376395"} + , + {"photo_id": 309190, "photo_title": "Populonia, sunset", "photo_url": "http://www.panoramio.com/photo/309190", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/309190.jpg", "longitude": 10.490313, "latitude": 42.989581, "width": 308, "height": 500, "upload_date": "05 January 2007", "owner_id": 65478, "owner_name": "Gabriele Marabotti", "owner_url": "http://www.panoramio.com/user/65478"} + , + {"photo_id": 54982, "photo_title": "Baia dos Porcos", "photo_url": "http://www.panoramio.com/photo/54982", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/54982.jpg", "longitude": -32.443485, "latitude": -3.855177, "width": 500, "height": 333, "upload_date": "30 September 2006", "owner_id": 7562, "owner_name": "Marcelo E. Salgado", "owner_url": "http://www.panoramio.com/user/7562"} + , + {"photo_id": 58316, "photo_title": "800_Schafberg03", "photo_url": "http://www.panoramio.com/photo/58316", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/58316.jpg", "longitude": 13.429413, "latitude": 47.775445, "width": 500, "height": 316, "upload_date": "07 October 2006", "owner_id": 8060, "owner_name": "Norbert MAIER", "owner_url": "http://www.panoramio.com/user/8060"} + , + {"photo_id": 423887, "photo_title": "Dunes near Zagora", "photo_url": "http://www.panoramio.com/photo/423887", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/423887.jpg", "longitude": -5.872707, "latitude": 30.280713, "width": 500, "height": 333, "upload_date": "14 January 2007", "owner_id": 78506, "owner_name": "Philippe Stoop", "owner_url": "http://www.panoramio.com/user/78506"} + , + {"photo_id": 4136144, "photo_title": "Égi jel", "photo_url": "http://www.panoramio.com/photo/4136144", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4136144.jpg", "longitude": 17.564564, "latitude": 47.633181, "width": 500, "height": 376, "upload_date": "23 August 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 6620113, "photo_title": "Winterlandschaft - Winter Scenery - Emmental", "photo_url": "http://www.panoramio.com/photo/6620113", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6620113.jpg", "longitude": 7.787676, "latitude": 47.055856, "width": 500, "height": 374, "upload_date": "22 December 2007", "owner_id": 635422, "owner_name": "♫ Swissmay", "owner_url": "http://www.panoramio.com/user/635422"} + , + {"photo_id": 2702545, "photo_title": "Church at Oia, Santorini", "photo_url": "http://www.panoramio.com/photo/2702545", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2702545.jpg", "longitude": 25.376015, "latitude": 36.461330, "width": 375, "height": 500, "upload_date": "11 June 2007", "owner_id": 555551, "owner_name": "Marilyn Whiteley", "owner_url": "http://www.panoramio.com/user/555551"} + , + {"photo_id": 416472, "photo_title": "Ice Crystal Clouds", "photo_url": "http://www.panoramio.com/photo/416472", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/416472.jpg", "longitude": -105.650969, "latitude": 40.294126, "width": 500, "height": 374, "upload_date": "13 January 2007", "owner_id": 87752, "owner_name": "Richard Ryer", "owner_url": "http://www.panoramio.com/user/87752"} + , + {"photo_id": 6080988, "photo_title": "Zion Tree (HDR)", "photo_url": "http://www.panoramio.com/photo/6080988", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6080988.jpg", "longitude": -112.946116, "latitude": 37.213331, "width": 500, "height": 333, "upload_date": "23 November 2007", "owner_id": 17488, "owner_name": "John Gillett", "owner_url": "http://www.panoramio.com/user/17488"} + , + {"photo_id": 2321382, "photo_title": "Old Wreck at Bannack", "photo_url": "http://www.panoramio.com/photo/2321382", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2321382.jpg", "longitude": -112.997518, "latitude": 45.162614, "width": 500, "height": 375, "upload_date": "21 May 2007", "owner_id": 71099, "owner_name": "Eve in Montana", "owner_url": "http://www.panoramio.com/user/71099"} + , + {"photo_id": 122858, "photo_title": "Antelope Canyon - Page, Arizona", "photo_url": "http://www.panoramio.com/photo/122858", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/122858.jpg", "longitude": -111.399908, "latitude": 36.887447, "width": 332, "height": 500, "upload_date": "12 December 2006", "owner_id": 20332, "owner_name": "RJ", "owner_url": "http://www.panoramio.com/user/20332"} + , + {"photo_id": 4445933, "photo_title": "Tavi alkony", "photo_url": "http://www.panoramio.com/photo/4445933", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4445933.jpg", "longitude": 17.465172, "latitude": 47.864486, "width": 500, "height": 350, "upload_date": "06 September 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 1238515, "photo_title": "EDEN", "photo_url": "http://www.panoramio.com/photo/1238515", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1238515.jpg", "longitude": -83.677711, "latitude": 22.661542, "width": 500, "height": 345, "upload_date": "09 March 2007", "owner_id": 232099, "owner_name": "mabut", "owner_url": "http://www.panoramio.com/user/232099"} + , + {"photo_id": 398585, "photo_title": "Near Glittertind", "photo_url": "http://www.panoramio.com/photo/398585", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/398585.jpg", "longitude": 8.489170, "latitude": 61.621820, "width": 500, "height": 333, "upload_date": "12 January 2007", "owner_id": 78506, "owner_name": "Philippe Stoop", "owner_url": "http://www.panoramio.com/user/78506"} + , + {"photo_id": 10240311, "photo_title": "two planes", "photo_url": "http://www.panoramio.com/photo/10240311", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/10240311.jpg", "longitude": 20.306683, "latitude": 49.750107, "width": 332, "height": 500, "upload_date": "15 May 2008", "owner_id": 454219, "owner_name": "Rafal Ociepka", "owner_url": "http://www.panoramio.com/user/454219"} + , + {"photo_id": 7593894, "photo_title": "桂林名胜百景——遇龙河", "photo_url": "http://www.panoramio.com/photo/7593894", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/7593894.jpg", "longitude": 110.424957, "latitude": 24.781747, "width": 500, "height": 375, "upload_date": "04 February 2008", "owner_id": 161470, "owner_name": "John Su", "owner_url": "http://www.panoramio.com/user/161470"} + ]}; +} + diff --git a/markerclustererplus/markerclustererplus.d.ts b/markerclustererplus/markerclustererplus.d.ts new file mode 100644 index 000000000..24a2b2636 --- /dev/null +++ b/markerclustererplus/markerclustererplus.d.ts @@ -0,0 +1,834 @@ +// Type definitions for MarkerClustererPlus for Google Maps V3 2.1.1 +// Project: http://github.com/mahnunchik/markerclustererplus +// Definitions by: Mathias Rodriguez +// Definitions: https://github.com/borisyankov/DefinitelyTyped + + +/// + +/** + * @name ClusterIconStyle + * @class This class represents the object for values in the styles array passed + * to the {@link MarkerClusterer} constructor. The element in this array that is used to + * style the cluster icon is determined by calling the calculator function. + * + * @property {string} url The URL of the cluster icon image file. Required. + * @property {number} height The display height (in pixels) of the cluster icon. Required. + * @property {number} width The display width (in pixels) of the cluster icon. Required. + * @property {Array} [anchorText] The position (in pixels) from the center of the cluster icon to + * where the text label is to be centered and drawn. The format is [yoffset, xoffset] + * where yoffset increases as you go down from center and xoffset + * increases to the right of center. The default is [0, 0]. + * @property {Array} [anchorIcon] The anchor position (in pixels) of the cluster icon. This is the + * spot on the cluster icon that is to be aligned with the cluster position. The format is + * [yoffset, xoffset] where yoffset increases as you go down and + * xoffset increases to the right of the top-left corner of the icon. The default + * anchor position is the center of the cluster icon. + * @property {string} [textColor="black"] The color of the label text shown on the + * cluster icon. + * @property {number} [textSize=11] The size (in pixels) of the label text shown on the + * cluster icon. + * @property {string} [textDecoration="none"] The value of the CSS text-decoration + * property for the label text shown on the cluster icon. + * @property {string} [fontWeight="bold"] The value of the CSS font-weight + * property for the label text shown on the cluster icon. + * @property {string} [fontStyle="normal"] The value of the CSS font-style + * property for the label text shown on the cluster icon. + * @property {string} [fontFamily="Arial,sans-serif"] The value of the CSS font-family + * property for the label text shown on the cluster icon. + * @property {string} [backgroundPosition="0 0"] The position of the cluster icon image + * within the image defined by url. The format is "xpos ypos" + * (the same format as for the CSS background-position property). You must set + * this property appropriately when the image defined by url represents a sprite + * containing multiple images. Note that the position must be specified in px units. + */ + +declare class ClusterIconStyle { + url: string; + height: number; + width: number; + anchorText: number[]; + anchorIcon: number[]; + textColor: string; + textSize: number; + textDecoration: string; + fontWeight: string; + fontStyle: string; + fontFamily: string; + backgroundPosition: string; +} + +/** + * @name ClusterIconInfo + * @class This class is an object containing general information about a cluster icon. This is + * the object that a calculator function returns. + * + * @property {string} text The text of the label to be shown on the cluster icon. + * @property {number} index The index plus 1 of the element in the styles + * array to be used to style the cluster icon. + * @property {string} title The tooltip to display when the mouse moves over the cluster icon. + * If this value is undefined or "", title is set to the + * value of the title property passed to the MarkerClusterer. + */ + +declare class ClusterIconInfo extends google.maps.OverlayView { + text: string; + index: number; + title: string; + /** + * A cluster icon. + * + * @constructor + * @extends google.maps.OverlayView + * @param {Cluster} cluster The cluster with which the icon is to be associated. + * @param {Array} [styles] An array of {@link ClusterIconStyle} defining the cluster icons + * to use for various cluster sizes. + * @private + */ + constructor(cluster: Cluster, styles: ClusterIconStyle[]); + + /** + * Adds the icon to the DOM. + */ + onAdd(): void; + + /** + * Removes the icon from the DOM. + */ + onRemove(): void; + + /** + * Draws the icon. + */ + draw(): void; + + /** + * Hides the icon. + */ + hide(): void; + + /** + * Positions and shows the icon. + */ + show(): void; + + /** + * Sets the icon styles to the appropriate element in the styles array. + * + * @param {ClusterIconInfo} sums The icon label text and styles index. + */ + useStyle(sums: ClusterIconInfo[]): void; + + /** + * Sets the position at which to center the icon. + * + * @param {google.maps.LatLng} center The latlng to set as the center. + */ + setCenter(center: google.maps.LatLng): void; + + /** + * Creates the cssText style parameter based on the position of the icon. + * + * @param {google.maps.Point} pos The position of the icon. + * @return {string} The CSS style text. + */ + createCss(pos: google.maps.Point): string; + + /** + * Returns the position at which to place the DIV depending on the latlng. + * + * @param {google.maps.LatLng} latlng The position in latlng. + * @return {google.maps.Point} The position in pixels. + */ + getPosFromLatLng_(latLng: google.maps.LatLng): google.maps.Point; +} + +interface Cluster { + /** + * Creates a single cluster that manages a group of proximate markers. + * Used internally, do not call this constructor directly. + * @constructor + * @param {MarkerClusterer} mc The MarkerClusterer object with which this + * cluster is associated. + */ + new (mc: MarkerClusterer): Cluster; + + /** + * Returns the number of markers managed by the cluster. You can call this from + * a click, mouseover, or mouseout event handler + * for the MarkerClusterer object. + * + * @return {number} The number of markers in the cluster. + */ + getSize(): number; + + /** + * Returns the array of markers managed by the cluster. You can call this from + * a click, mouseover, or mouseout event handler + * for the MarkerClusterer object. + * + * @return {Array} The array of markers in the cluster. + */ + getMarkers(): google.maps.Marker[]; + + /** + * Returns the center of the cluster. You can call this from + * a click, mouseover, or mouseout event handler + * for the MarkerClusterer object. + * + * @return {google.maps.LatLng} The center of the cluster. + */ + getCenter(): google.maps.LatLng; + + /** + * Returns the map with which the cluster is associated. + * + * @return {google.maps.Map} The map. + * @ignore + */ + getMap(): google.maps.Map; + + /** + * Returns the MarkerClusterer object with which the cluster is associated. + * + * @return {MarkerClusterer} The associated marker clusterer. + * @ignore + */ + getMarkerClusterer(): MarkerClusterer; + + /** + * Returns the bounds of the cluster. + * + * @return {google.maps.LatLngBounds} the cluster bounds. + * @ignore + */ + getBounds(): google.maps.LatLngBounds; + + /** + * Removes the cluster from the map. + * + * @ignore + */ + remove(): void; + + /** + * Adds a marker to the cluster. + * + * @param {google.maps.Marker} marker The marker to be added. + * @return {boolean} True if the marker was added. + * @ignore + */ + addMarker(marker: google.maps.Marker): boolean; + + /** + * Determines if a marker lies within the cluster's bounds. + * + * @param {google.maps.Marker} marker The marker to check. + * @return {boolean} True if the marker lies in the bounds. + * @ignore + */ + isMarkerInClusterBounds(marker: google.maps.Marker): boolean; + + /** + * Calculates the extended bounds of the cluster with the grid. + */ + calculateBounds_(): void; + + /** + * Updates the cluster icon. + */ + updateIcon_(): void; + + /** + * Determines if a marker has already been added to the cluster. + * + * @param {google.maps.Marker} marker The marker to check. + * @return {boolean} True if the marker has already been added. + */ + isMarkerAlreadyAdded_(marker: google.maps.Marker): boolean; +} + +/** + * @name MarkerClustererOptions + * @class This class represents the optional parameter passed to + * the {@link MarkerClusterer} constructor. + * @property {number} [gridSize=60] The grid size of a cluster in pixels. The grid is a square. + * @property {number} [maxZoom=null] The maximum zoom level at which clustering is enabled or + * null if clustering is to be enabled at all zoom levels. + * @property {boolean} [zoomOnClick=true] Whether to zoom the map when a cluster marker is + * clicked. You may want to set this to false if you have installed a handler + * for the click event and it deals with zooming on its own. + * @property {boolean} [averageCenter=false] Whether the position of a cluster marker should be + * the average position of all markers in the cluster. If set to false, the + * cluster marker is positioned at the location of the first marker added to the cluster. + * @property {number} [minimumClusterSize=2] The minimum number of markers needed in a cluster + * before the markers are hidden and a cluster marker appears. + * @property {boolean} [ignoreHidden=false] Whether to ignore hidden markers in clusters. You + * may want to set this to true to ensure that hidden markers are not included + * in the marker count that appears on a cluster marker (this count is the value of the + * text property of the result returned by the default calculator). + * If set to true and you change the visibility of a marker being clustered, be + * sure to also call MarkerClusterer.repaint(). + * @property {string} [title=""] The tooltip to display when the mouse moves over a cluster + * marker. (Alternatively, you can use a custom calculator function to specify a + * different tooltip for each cluster marker.) + * @property {function} [calculator=MarkerClusterer.CALCULATOR] The function used to determine + * the text to be displayed on a cluster marker and the index indicating which style to use + * for the cluster marker. The input parameters for the function are (1) the array of markers + * represented by a cluster marker and (2) the number of cluster icon styles. It returns a + * {@link ClusterIconInfo} object. The default calculator returns a + * text property which is the number of markers in the cluster and an + * index property which is one higher than the lowest integer such that + * 10^i exceeds the number of markers in the cluster, or the size of the styles + * array, whichever is less. The styles array element used has an index of + * index minus 1. For example, the default calculator returns a + * text value of "125" and an index of 3 + * for a cluster icon representing 125 markers so the element used in the styles + * array is 2. A calculator may also return a title + * property that contains the text of the tooltip to be used for the cluster marker. If + * title is not defined, the tooltip is set to the value of the title + * property for the MarkerClusterer. + * @property {string} [clusterClass="cluster"] The name of the CSS class defining general styles + * for the cluster markers. Use this class to define CSS styles that are not set up by the code + * that processes the styles array. + * @property {Array} [styles] An array of {@link ClusterIconStyle} elements defining the styles + * of the cluster markers to be used. The element to be used to style a given cluster marker + * is determined by the function defined by the calculator property. + * The default is an array of {@link ClusterIconStyle} elements whose properties are derived + * from the values for imagePath, imageExtension, and + * imageSizes. + * @property {boolean} [enableRetinaIcons=false] Whether to allow the use of cluster icons that + * have sizes that are some multiple (typically double) of their actual display size. Icons such + * as these look better when viewed on high-resolution monitors such as Apple's Retina displays. + * Note: if this property is true, sprites cannot be used as cluster icons. + * @property {number} [batchSize=MarkerClusterer.BATCH_SIZE] Set this property to the + * number of markers to be processed in a single batch when using a browser other than + * Internet Explorer (for Internet Explorer, use the batchSizeIE property instead). + * @property {number} [batchSizeIE=MarkerClusterer.BATCH_SIZE_IE] When Internet Explorer is + * being used, markers are processed in several batches with a small delay inserted between + * each batch in an attempt to avoid Javascript timeout errors. Set this property to the + * number of markers to be processed in a single batch; select as high a number as you can + * without causing a timeout error in the browser. This number might need to be as low as 100 + * if 15,000 markers are being managed, for example. + * @property {string} [imagePath=MarkerClusterer.IMAGE_PATH] + * The full URL of the root name of the group of image files to use for cluster icons. + * The complete file name is of the form imagePathn.imageExtension + * where n is the image file number (1, 2, etc.). + * @property {string} [imageExtension=MarkerClusterer.IMAGE_EXTENSION] + * The extension name for the cluster icon image files (e.g., "png" or + * "jpg"). + * @property {Array} [imageSizes=MarkerClusterer.IMAGE_SIZES] + * An array of numbers containing the widths of the group of + * imagePathn.imageExtension image files. + * (The images are assumed to be square.) + **/ +interface MarkerClustererOptions { + gridSize: number; + maxZoom: number; + zoomOnClick: boolean; + averageCenter: boolean; + minimumClusterSize: number; + ignoreHidden: boolean; + title: string; + calculator(): Function; + clusterClass: string; + styles: ClusterIconStyle[]; + enableRetinaIcons: boolean; + batchSize: number; + batchSizeIE: number; + imagePath: string; + imageExtension: string; + imageSizes: number[]; +} + +interface MarkerClusterer extends google.maps.OverlayView { + /** + * Creates a MarkerClusterer object with the options specified in {@link MarkerClustererOptions}. + * @constructor + * @extends google.maps.OverlayView + * @param {google.maps.Map} map The Google map to attach to. + * @param {Array.} [opt_markers] The markers to be added to the cluster. + * @param {MarkerClustererOptions} [opt_options] The optional parameters. + */ + new (map: google.maps.Map, opt_markers: google.maps.Marker[], opt_options?: MarkerClustererOptions): MarkerClusterer; + + /** + * Implementation of the onAdd interface method. + * @ignore + */ + onAdd(): void; + + /** + * Implementation of the onRemove interface method. + * Removes map event listeners and all cluster icons from the DOM. + * All managed markers are also put back on the map. + * @ignore + */ + onRemove(): void; + + /** + * Implementation of the draw interface method. + * @ignore + */ + draw(): void; + + /** + * Sets up the styles object. + */ + setupStyles_(): void; + + /** + * Fits the map to the bounds of the markers managed by the clusterer. + */ + fitMapToMarkers(): void; + + /** + * Returns the value of the gridSize property. + * + * @return {number} The grid size. + */ + getGridSize(): number; + + /** + * Sets the value of the gridSize property. + * + * @param {number} gridSize The grid size. + */ + setGridSize(gridSize: number): void; + + /** + * Returns the value of the minimumClusterSize property. + * + * @return {number} The minimum cluster size. + */ + getMinimumClusterSize(): number; + + /** + * Sets the value of the minimumClusterSize property. + * + * @param {number} minimumClusterSize The minimum cluster size. + */ + setMinimumClusterSize(minimumClusterSize: number): void; + + /** + * Returns the value of the maxZoom property. + * + * @return {number} The maximum zoom level. + */ + getMaxZoom(): number; + + /** + * Sets the value of the maxZoom property. + * + * @param {number} maxZoom The maximum zoom level. + */ + setMaxZoom(maxZoom: number): void; + + /** + * Returns the value of the styles property. + * + * @return {Array} The array of styles defining the cluster markers to be used. + */ + getStyles(): ClusterIconStyle[]; + + /** + * Sets the value of the styles property. + * + * @param {Array.} styles The array of styles to use. + */ + setStyles(styles: ClusterIconStyle[]): void; + + /** + * Returns the value of the title property. + * + * @return {string} The content of the title text. + */ + getTitle(): string; + + /** + * Sets the value of the title property. + * + * @param {string} title The value of the title property. + */ + setTitle(title: string): void; + + /** + * Returns the value of the zoomOnClick property. + * + * @return {boolean} True if zoomOnClick property is set. + */ + getZoomOnClick(): boolean; + + /** + * Sets the value of the zoomOnClick property. + * + * @param {boolean} zoomOnClick The value of the zoomOnClick property. + */ + setZoomOnClick(zoomOnClick: boolean): void; + + /** + * Returns the value of the averageCenter property. + * + * @return {boolean} True if averageCenter property is set. + */ + getAverageCenter(): boolean; + + /** + * Sets the value of the averageCenter property. + * + * @param {boolean} averageCenter The value of the averageCenter property. + */ + setAverageCenter(averageCenter: boolean): void; + + /** + * Returns the value of the ignoreHidden property. + * + * @return {boolean} True if ignoreHidden property is set. + */ + getIgnoreHidden(): boolean; + + /** + * Sets the value of the ignoreHidden property. + * + * @param {boolean} ignoreHidden The value of the ignoreHidden property. + */ + setIgnoreHidden(ignoreHidden: boolean): void; + + /** + * Returns the value of the enableRetinaIcons property. + * + * @return {boolean} True if enableRetinaIcons property is set. + */ + getEnableRetinaIcons(): boolean; + + /** + * Sets the value of the enableRetinaIcons property. + * + * @param {boolean} enableRetinaIcons The value of the enableRetinaIcons property. + */ + setEnableRetinaIcons(enableRetinaIcons: boolean): void; + + /** + * Returns the value of the imageExtension property. + * + * @return {string} The value of the imageExtension property. + */ + getImageExtension(): string; + + /** + * Sets the value of the imageExtension property. + * + * @param {string} imageExtension The value of the imageExtension property. + */ + setImageExtension(imageExtension: string): void; + + /** + * Returns the value of the imagePath property. + * + * @return {string} The value of the imagePath property. + */ + getImagePath(): string; + + /** + * Sets the value of the imagePath property. + * + * @param {string} imagePath The value of the imagePath property. + */ + setImagePath(imagePath: string): void; + + /** + * Returns the value of the imageSizes property. + * + * @return {Array} The value of the imageSizes property. + */ + getImageSizes(): number[]; + + /** + * Sets the value of the imageSizes property. + * + * @param {Array} imageSizes The value of the imageSizes property. + */ + setImageSizes(imageSizes: number[]): void; + + /** + * Returns the value of the calculator property. + * + * @return {function} the value of the calculator property. + */ + getCalculator(): Function; + + /** + * Sets the value of the calculator property. + * + * @param {function(Array., number)} calculator The value + * of the calculator property. + */ + setCalculator(calculator: (marker: google.maps.Marker, value: number) => Function): void; + + /** + * Sets the value of the hideLabel property. + * + * @param {boolean} printable The value of the hideLabel property. + */ + setHideLabel(printable: boolean): void; + + /** + * Returns the value of the hideLabel property. + * + * @return {boolean} the value of the hideLabel property. + */ + getHideLabel(): boolean; + + /** + * Returns the value of the batchSizeIE property. + * + * @return {number} the value of the batchSizeIE property. + */ + getBatchSizeIE(): number; + + /** + * Sets the value of the batchSizeIE property. + * + * @param {number} batchSizeIE The value of the batchSizeIE property. + */ + setBatchSizeIE(batchSizeIE: number): void; + + /** + * Returns the value of the clusterClass property. + * + * @return {string} the value of the clusterClass property. + */ + getClusterClass(): string; + + /** + * Sets the value of the clusterClass property. + * + * @param {string} clusterClass The value of the clusterClass property. + */ + setClusterClass(clusterClass: string): void; + + /** + * Returns the array of markers managed by the clusterer. + * + * @return {Array} The array of markers managed by the clusterer. + */ + getMarkers(): google.maps.Marker[]; + + /** + * Returns the number of markers managed by the clusterer. + * + * @return {number} The number of markers. + */ + getTotalMarkers(): number; + + /** + * Returns the current array of clusters formed by the clusterer. + * + * @return {Array} The array of clusters formed by the clusterer. + */ + getClusters(): Cluster[]; + + /** + * Returns the number of clusters formed by the clusterer. + * + * @return {number} The number of clusters formed by the clusterer. + */ + getTotalClusters(): number; + + /** + * Adds a marker to the clusterer. The clusters are redrawn unless + * opt_nodraw is set to true. + * + * @param {google.maps.Marker} marker The marker to add. + * @param {boolean} [opt_nodraw] Set to true to prevent redrawing. + */ + addMarker(marker: google.maps.Marker, opt_nodraw: boolean): void; + + /** + * Adds an array of markers to the clusterer. The clusters are redrawn unless + * opt_nodraw is set to true. + * + * @param {Array.} markers The markers to add. + * @param {boolean} [opt_nodraw] Set to true to prevent redrawing. + */ + addMarkers(markers: google.maps.Marker[], opt_nodraw: boolean): void; + + /** + * Pushes a marker to the clusterer. + * + * @param {google.maps.Marker} marker The marker to add. + */ + pushMarkerTo_(marker: google.maps.Marker): void; + + /** + * Removes a marker from the cluster and map. The clusters are redrawn unless + * opt_nodraw is set to true. Returns true if the + * marker was removed from the clusterer. + * + * @param {google.maps.Marker} marker The marker to remove. + * @param {boolean} [opt_nodraw] Set to true to prevent redrawing. + * @param {boolean} [opt_noMapRemove] Set to true to prevent removal from map but still removing from cluster management + * @return {boolean} True if the marker was removed from the clusterer. + */ + removeMarker(marker: google.maps.Marker, opt_nodraw: boolean, noMapRemove: boolean): boolean; + + /** + * Removes an array of markers from the cluster and map. The clusters are redrawn unless + * opt_nodraw is set to true. Returns true if markers + * were removed from the clusterer. + * + * @param {Array.} markers The markers to remove. + * @param {boolean} [opt_nodraw] Set to true to prevent redrawing. + * @param {boolean} [opt_noMapRemove] Set to true to prevent removal from map but still removing from cluster management + * @return {boolean} True if markers were removed from the clusterer. + */ + removeMarkers(markers: google.maps.Marker[], opt_nodraw: boolean, opt_noMapRemove: boolean): boolean; + + /** + * Removes a marker and returns true if removed, false if not. + * + * @param {google.maps.Marker} marker The marker to remove + * @param {boolean} removeFromMap set to true to explicitly remove from map as well as cluster manangement + * @return {boolean} Whether the marker was removed or not + */ + removeMarker_(marker: google.maps.Marker, removeFromMap: boolean): boolean; + + /** + * Removes all clusters and markers from the map and also removes all markers + * managed by the clusterer. + */ + clearMarkers(): void; + + /** + * Recalculates and redraws all the marker clusters from scratch. + * Call this after changing any properties. + */ + repaint(): void; + + /** + * Returns the current bounds extended by the grid size. + * + * @param {google.maps.LatLngBounds} bounds The bounds to extend. + * @return {google.maps.LatLngBounds} The extended bounds. + * @ignore + */ + getExtendedBounds(bounds: google.maps.LatLngBounds): google.maps.LatLngBounds; + + /** + * Redraws all the clusters. + */ + redraw_(): void; + + /** + * Removes all clusters from the map. The markers are also removed from the map + * if opt_hide is set to true. + * + * @param {boolean} [opt_hide] Set to true to also remove the markers + * from the map. + */ + resetViewport_(opt_hide: boolean): void; + + /** + * Calculates the distance between two latlng locations in km. + * + * @param {google.maps.LatLng} p1 The first lat lng point. + * @param {google.maps.LatLng} p2 The second lat lng point. + * @return {number} The distance between the two points in km. + * @see http://www.movable-type.co.uk/scripts/latlong.html + */ + distanceBetweenPoints_(p1: google.maps.LatLng, p2: google.maps.LatLng): number; + + /** + * Determines if a marker is contained in a bounds. + * + * @param {google.maps.Marker} marker The marker to check. + * @param {google.maps.LatLngBounds} bounds The bounds to check against. + * @return {boolean} True if the marker is in the bounds. + */ + isMarkerInBounds_(marker: google.maps.Marker, bounds: google.maps.LatLngBounds): boolean; + + /** + * Adds a marker to a cluster, or creates a new cluster. + * + * @param {google.maps.Marker} marker The marker to add. + */ + addToClosestCluster_(marker: google.maps.Marker): void; + + /** + * Creates the clusters. This is done in batches to avoid timeout errors + * in some browsers when there is a huge number of markers. + * + * @param {number} iFirst The index of the first marker in the batch of + * markers to be added to clusters. + */ + createClusters_(iFirst: number): void; + + /** + * Extends an object's prototype by another's. + * + * @param {Object} obj1 The object to be extended. + * @param {Object} obj2 The object to extend with. + * @return {Object} The new extended object. + * @ignore + */ + extend(obj1: Object, obj2: Object): Object; + + /** + * The default function for determining the label text and style + * for a cluster icon. + * + * @param {Array.} markers The array of markers represented by the cluster. + * @param {number} numStyles The number of marker styles available. + * @return {ClusterIconInfo} The information resource for the cluster. + * @constant + * @ignore + */ + CALCULATOR(markers: google.maps.Marker[], numStyles: number): ClusterIconInfo; + + /** + * The number of markers to process in one batch. + * + * @type {number} + * @constant + */ + BATCH_SIZE: number; + + /** + * The number of markers to process in one batch (IE only). + * + * @type {number} + * @constant + */ + BATCH_SIZE_IE: number; + + /** + * The default root name for the marker cluster images. + * + * @type {string} + * @constant + */ + IMAGE_PATH: string; + + /** + * The default extension name for the marker cluster images. + * + * @type {string} + * @constant + */ + IMAGE_EXTENSION: string; + + /** + * The default array of sizes for the marker cluster images. + * + * @type {Array.} + * @constant + */ + IMAGE_SIZES: number[]; + +} + +declare var MarkerClusterer: MarkerClusterer; + +interface String { + trim(): string; +} diff --git a/matter-js/matter-js-tests.ts b/matter-js/matter-js-tests.ts new file mode 100644 index 000000000..31649fc44 --- /dev/null +++ b/matter-js/matter-js-tests.ts @@ -0,0 +1,57 @@ +/// + +var Engine = Matter.Engine, + World = Matter.World, + Body = Matter.Body, + Bodies = Matter.Bodies, + Composites = Matter.Composites, + Constraint = Matter.Constraint, + Events = Matter.Events, + Query = Matter.Query + + +var engine = Engine.create(document.body) + +//Bodies +var box1 = Bodies.rectangle(400,200,80,80) +var box2 = Bodies.rectangle(400,610,810,60, { + angle: 10, + angularSpeed: 11, + angularVelocity: 1, + density: 4, + isStatic: true +}) + +var circle1 = Bodies.circle(100,100,50) + +World.addBody(engine.world, box1) +World.add(engine.world, [box2, circle1]) + + +//Composites +var stack = Composites.stack(0, 100, 5, 1, 20, 0, function(x:number, y:number, column:number, row:number) { + return Bodies.circle(x, y, 75, { restitution: 0.9 }); + }); + +World.add(engine.world, stack); + +//Constraints +var constraint1 = Constraint.create({ + bodyA: box1, + bodyB: box2, + stiffness: 0.02 +}) + +//Query +var collisions = Query.ray([box1, box2, circle1], {x:1, y:2}, {x:3, y:4}); + +World.addConstraint(engine.world, constraint1) + + +//events +Events.on(engine, "beforeTick", (e:any)=>{ + +}) + + +Engine.run(engine) diff --git a/matter-js/matter-js.d.ts b/matter-js/matter-js.d.ts new file mode 100644 index 000000000..5c4426ea2 --- /dev/null +++ b/matter-js/matter-js.d.ts @@ -0,0 +1,1532 @@ +// Type definitions for Matter.js 0.8.0 +// Project: https://github.com/liabru/matter-js +// Definitions by: Ivane Gegia +// Definitions: https://github.com/borisyankov/DefinitelyTyped + + +declare module Matter +{ + export interface IEngineOptions + { + + } + + export interface IEngineTimingOptions + { + /** + *A Number that specifies the time correction factor to apply to the current timestep. It is automatically handled when using Engine.run, but is also only optional even if you use your own game loop. The value is defined as delta / lastDelta, i.e. the percentage change of delta between steps. This value is always 1 (no correction) when frame rate is constant or engine.timing.isFixed is true. If the framerate and hence delta are changing, then correction should be applied to the current update to account for the change. See the paper on Time Corrected Verlet for more information. + */ + correction:number; + + /** + * A Number that specifies the time step between updates in milliseconds. If engine.timing.isFixed is set to true, then delta is fixed. If it is false, then delta can dynamically change to maintain the correct apparant simulation speed. + */ + delta:number; + + /** + * A Number that specifies the global scaling factor of time for all bodies. A value of 0 freezes the simulation. A value of 0.1 gives a slow-motion effect. A value of 1.2 gives a speed-up effect. + */ + timeScale:number; + + /** + * A Number that specifies the current simulation-time in milliseconds starting from 0. It is incremented on every Engine.update by the timing.delta. + */ + timestamp:number; + + /** + * An integer Number that specifies the number of velocity iterations to perform each update. The higher the value, the higher quality the simulation will be at the expense of performance. + */ + velocityIterations:number; + + } + + export class Engine + { + /** + * Clears the engine including the world, pairs and broadphase. + * @param engine + */ + static clear(engine:Engine):void; + + /** + * Creates a new engine. The options parameter is an object that specifies any properties you wish to override the defaults. All properties have default values, and many are pre-calculated automatically based on other properties. See the properites section below for detailed information on what you can pass via the options object. + * @param element + * @param options + */ + static create(element?: HTMLElement|IEngineOptions, options?:IEngineOptions):Engine; + + /** + * Merges two engines by keeping the configuration of engineA but replacing the world with the one from engineB. + * @param engineA + * @param engineB + */ + static merge(engineA:Engine, engineB:Engine):void; + + /** + * Renders the world by calling its defined renderer engine.render.controller. Triggers beforeRender and afterRender events. + * @param engineA + * @param engineB + */ + static render(engineA:Engine, engineB:Engine):void; + + /** + * An optional utility function that provides a game loop, that handles updating the engine for you. Calls Engine.update and Engine.render on the requestAnimationFrame event automatically. Handles time correction and non-fixed dynamic timing (if enabled). Triggers beforeTick, tick and afterTick events. + * @param engine + */ + static run(engine:Engine):void; + + /** + * Moves the simulation forward in time by delta ms. Triggers beforeUpdate and afterUpdate events. + * + * @param engine + * @param delta + * @param correction + */ + static update(engine:Engine, delta:number, correction?:number):void; + + /** + * An integer Number that specifies the number of constraint iterations to perform each update. The higher the value, the higher quality the simulation will be at the expense of performance. The default value of 2 is usually very adequate. + */ + constraintIterations:number; + + /** + * A flag that specifies whether the engine is running or not. + */ + enabled:boolean; + + /** + * A flag that specifies whether the engine should allow sleeping via the Matter.Sleeping module. Sleeping can improve stability and performance, but often at the expense of accuracy. + */ + enableSleeping:boolean; + + /** + * An integer Number that specifies the number of position iterations to perform each update. The higher the value, the higher quality the simulation will be at the expense of performance. + */ + positionIterations:number; + + /** + * An instance of a Render controller. The default value is a Matter.Render instance created by Engine.create. One may also develop a custom renderer module based on Matter.Render and pass an instance of it to Engine.create via options.render. + A minimal custom renderer object must define at least three functions: create, clear and world (see Matter.Render). It is also possible to instead pass the module reference via options.render.controller and Engine.create will instantiate one for you. + */ + render:Render; + + /** + * An Object containing properties regarding the timing systems of the engine. + */ + timing:IEngineTimingOptions; + + /** + * A World composite object that will contain all simulated bodies and constraints. + */ + world:World; + } + + interface IWorldOptions + { + + } + + /** + * The Matter.World module contains methods for creating and manipulating the world composite. A Matter.World is a Matter.Composite body, which is a collection of Matter.Body, Matter.Constraint and other Matter.Composite. A Matter.World has a few additional properties including gravity and bounds. It is important to use the functions in the Matter.Composite module to modify the world composite, rather than directly modifying its properties. There are also a few methods here that alias those in Matter.Composite for easier readability. + */ + export class World + { + /** + * Add objects or arrays of objects of types: Body, Constraint, Composite + * @param world + * @param body + * @returns world + */ + static add(world:World, body:Body|Array|Composite|Array|Constraint|Array):World; + + /** + * An alias for Composite.addBody since World is also a Composite + * @param world + * @param body + * @returns world + */ + static addBody(world:World, body:Body):World; + + /** + * An alias for Composite.add since World is also a Composite + * @param world + * @param composite + */ + static addComposite(world:World, composite:Composite):World; + + /** + * An alias for Composite.addConstraint since World is also a Composite. + * @param world + * @param constraint + */ + static addConstraint(world:World, constraint:Constraint):World; + + /** + * An alias for Composite.clear since World is also a Composite. + * @param world + * @param keepStatic + */ + static clear(world:World, keepStatic:boolean):void; + + /** + * Creates a new world composite. The options parameter is an object that specifies any properties you wish to override the defaults. See the properites section below for detailed information on what you can pass via the options object. + * @param options + */ + static create(options:IWorldOptions):World; + + } + + export interface IBodyDefinition + { + angle?:number; + angularSpeed?:number; + angularVelocity?:number; + area?:number; + axes?:Array; + bounds?:Bounds; + density?:number; + force?:Vector; + friction?:number; + frictionAir?:number; + groupId?:number; + id?:number; + inertia?:number; + inverseInertia?:number; + inverseMass?:number; + isSleeping?:boolean; + isStatic?:boolean; + label?:string; + mass?:number; + motion?:number; + position?:Vector; + render?:IBodyRenderOptions; + restitution?:number; + sleepThreshold?:number; + slop?:number; + speed?:number; + timeScale?:number; + torque?:number; + type?:string; + velocity?:Vector; + vertices?:Array; + } + + /** + * The Matter.Body module contains methods for creating and manipulating body models. A Matter.Body is a rigid body that can be simulated by a Matter.Engine. Factories for commonly used body configurations (such as rectangles, circles and other polygons) can be found in the module Matter.Bodies. + */ + export class Body + { + /** + * Applies a force to a body from a given world-space position, including resulting torque. + * @param body + * @param position + * @param force + */ + static applyForce(body:Body, position:Vector, force:Vector):void; + + /** + * Applys a mass dependant force to all given bodies. + * @param bodies + * @param gravity + */ + static applyGravityAll(bodies:Array, gravity:Vector):void; + + /** + * Creates a new rigid body model. The options parameter is an object that specifies any properties you wish to override the defaults. All properties have default values, and many are pre-calculated automatically based on other properties. See the properites section below for detailed information on what you can pass via the options object. + * @param options + */ + static create(options:IBodyDefinition):Body; + + /** + * Returns the next unique groupID number. + */ + static nextGroupId():number; + + /** + * Zeroes the body.force and body.torque force buffers. + * @param bodies + */ + static resetForcesAll(bodies:Array):void; + + /** + * Rotates a body by a given angle relative to its current angle, without imparting any angular velocity. + * @param body + * @param angle + */ + static rotate(body:Body, angle:number):void; + + /** + * Sets the body as static, including isStatic flag and setting mass and inertia to Infinity. + * @param isStatic + */ + setStatic(isStatic:boolean):void; + + /** + * Scales the body, including updating physical properties (mass, area, axes, inertia), from a world-space point (default is body centre). + * @param body + * @param scaleX + * @param scaleY + * @param poinst + */ + static scale(body:Body, scaleX:number, scaleY:number, poinst?:Vector):void; + + /** + * Moves a body by a given vector relative to its current position, without imparting any velocity. + * + * @param body + * @param translation + */ + static translate(body:Body, translation:Vector):void; + + /** + *Performs a simulation step for the given body, including updating position and angle using Verlet integration. + * + * @param body + * @param deltaTime + * @param timeScale + * @param correction + */ + static update(body:Body, deltaTime:number, timeScale:number, correction:number):void; + + /** + * Applys Body.update to all given bodies. + * + * @param bodies + * @param deltaTime + * @param timeScale + * @param correction + * @param worldBounds + */ + static updateAll ( bodies:Array, deltaTime:number, timeScale:number, correction:number, worldBounds:Bounds ):void; + + /** + * A Number specifying the angle of the body, in radians. + */ + angle:number; + + /** + * A Number that measures the current angular speed of the body after the last Body.update. It is read-only and always positive (it's the magnitude of body.angularVelocity). + */ + angularSpeed:number; + + /** + * A Number that measures the current angular velocity of the body after the last Body.update. It is read-only. If you need to modify a body's angular velocity directly, you should apply a torque or simply change the body's angle (as the engine uses position-Verlet integration). + */ + angularVelocity:number; + + /** + * A Number that measures the area of the body's convex hull, calculated at creation by Body.create. + */ + area:number; + + /** + * An array of unique axis vectors (edge normals) used for collision detection. These are automatically calculated from the given convex hull (vertices array) in Body.create. They are constantly updated by Body.update during the simulation. + */ + axes:Array; + + /** + * A Bounds object that defines the AABB region for the body. It is automatically calculated from the given convex hull (vertices array) in Body.create and constantly updated by Body.update during simulation. + */ + bounds:Bounds; + + /** + * A Number that defines the density of the body, that is its mass per unit area. If you pass the density via Body.create the mass property is automatically calculated for you based on the size (area) of the object. This is generally preferable to simply setting mass and allows for more intuitive definition of materials (e.g. rock has a higher density than wood). + */ + density:number; + + /** + * A Vector that specifies the force to apply in the current step. It is zeroed after every Body.update. See also Body.applyForce. + */ + force:Vector; + + /** + * A Number that defines the friction of the body. The value is always positive and is in the range (0, 1). A value of 0 means that the body may slide indefinitely. A value of 1 means the body may come to a stop almost instantly after a force is applied. + The effects of the value may be non-linear. High values may be unstable depending on the body. The engine uses a Coulomb friction model including static and kinetic friction. Note that collision response is based on pairs of bodies, and that friction values are combined with the following formula: + Math.min(bodyA.friction, bodyB.friction) + */ + friction:number; + + /** + * A Number that defines the air friction of the body (air resistance). A value of 0 means the body will never slow as it moves through space. The higher the value, the faster a body slows when moving through space. The effects of the value are non-linear. + Default: 0.01 + */ + frictionAir:number; + + /** + * An integer Number that specifies the collision group the body belongs to. Bodies with the same groupId are considered as-one body and therefore do not interact. This allows for creation of segmented bodies that can self-intersect, such as a rope. The default value 0 means the body does not belong to a group, and can interact with all other bodies. + Default: 0 + */ + groupId:number; + + /** + * An integer Number uniquely identifying number generated in Body.create by Common.nextId. + */ + id:number; + + /** + * A Number that defines the moment of inertia (i.e. second moment of area) of the body. It is automatically calculated from the given convex hull (vertices array) and density in Body.create. If you modify this value, you must also modify the body.inverseInertia property (1 / inertia). + */ + inertia:number; + + /** + * A Number that defines the inverse moment of inertia of the body (1 / inertia). If you modify this value, you must also modify the body.inertia property. + */ + inverseInertia:number; + + /** + * A Number that defines the inverse mass of the body (1 / mass). If you modify this value, you must also modify the body.mass property. + */ + inverseMass:number; + + /** + * A flag that indicates whether the body is considered sleeping. A sleeping body acts similar to a static body, except it is only temporary and can be awoken. If you need to set a body as sleeping, you should use Sleeping.set as this requires more than just setting this flag. + Default: false + */ + isSleeping:boolean; + + /** + * A flag that indicates whether a body is considered static. A static body can never change position or angle and is completely fixed. If you need to set a body as static after its creation, you should use Body.setStatic as this requires more than just setting this flag. + Default: false + */ + isStatic:boolean; + + /** + * An arbitrary String name to help the user identify and manage bodies. + Default: "Body" + */ + label:string; + + /** + * A Number that defines the mass of the body, although it may be more appropriate to specify the density property instead. If you modify this value, you must also modify the body.inverseMass property (1 / mass). + */ + mass:number; + + /** + * A Number that measures the amount of movement a body currently has (a combination of speed and angularSpeed). It is read-only and always positive. It is used and updated by the Matter.Sleeping module during simulation to decide if a body has come to rest. + Default: 0 + */ + motion:number; + + /** + * A Vector that specifies the current world-space position of the body. + Default: { x: 0, y: 0 } + */ + position:Vector; + + /** + * An Object that defines the rendering properties to be consumed by the module Matter.Render. + */ + render:IBodyRenderOptions; + + /** + * A Number that defines the restitution (elasticity) of the body. The value is always positive and is in the range (0, 1). A value of 0 means collisions may be perfectly inelastic and no bouncing may occur. A value of 0.8 means the body may bounce back with approximately 80% of its kinetic energy. Note that collision response is based on pairs of bodies, and that restitution values are combined with the following formula: + Math.max(bodyA.restitution, bodyB.restitution) + Default: 0 + */ + restitution:number; + + /** + * A Number that defines the number of updates in which this body must have near-zero velocity before it is set as sleeping by the Matter.Sleeping module (if sleeping is enabled by the engine). + Default: 60 + */ + sleepThreshold:number; + + /** + * A Number that specifies a tollerance on how far a body is allowed to 'sink' or rotate into other bodies. Avoid changing this value unless you understand the purpose of slop in physics engines. The default should generally suffice, although very large bodies may require larger values for stable stacking. + Default: 0.05 + */ + slop:number; + + /** + * A Number that measures the current speed of the body after the last Body.update. It is read-only and always positive (it's the magnitude of body.velocity). + Default: 0 + */ + speed:number; + + /** + * A Number that allows per-body time scaling, e.g. a force-field where bodies inside are in slow-motion, while others are at full speed. + Default: 1 + */ + timeScale:number; + + /** + * A Number that specifies the torque (turning force) to apply in the current step. It is zeroed after every Body.update. + Default: 0 + */ + torque:number; + + /** + *A String denoting the type of object. + Default: "body" + */ + type:string; + + /** + * A Vector that measures the current velocity of the body after the last Body.update. It is read-only. If you need to modify a body's velocity directly, you should either apply a force or simply change the body's position (as the engine uses position-Verlet integration). + Default: { x: 0, y: 0 } + */ + velocity:Vector; + + /** + * An array of Vector objects that specify the convex hull of the rigid body. These should be provided about the origin (0, 0). E.g. + [{ x: 0, y: 0 }, { x: 25, y: 50 }, { x: 50, y: 0 }] + When passed via Body.create, the verticies are translated relative to body.position (i.e. world-space, and constantly updated by Body.update during simulation). The Vector objects are also augmented with additional properties required for efficient collision detection. + Other properties such as inertia and bounds are automatically calculated from the passed vertices (unless provided via options). Concave hulls are not currently supported. The module Matter.Vertices contains useful methods for working with vertices. + */ + vertices:Array; + + } + + export class Bodies { + /** + * Creates a new rigid body model with a circle hull. The options parameter is an object that specifies any properties you wish to override the defaults. See the properites section of the Matter.Body module for detailed information on what you can pass via the options object. + * + * @param x + * @param y + * @param radius + * @param options + * @param maxSides + */ + static circle(x:number, y:number, radius:number, options?:IBodyDefinition, maxSides?:number):Body; + + /** + * Creates a new rigid body model with a regular polygon hull with the given number of sides. The options parameter is an object that specifies any properties you wish to override the defaults. See the properites section of the Matter.Body module for detailed information on what you can pass via the options object. + * + * @param x + * @param y + * @param sides + * @param radius + * @param options + */ + static polygon(x:number, y:number, sides:number, radius:number, options?:IBodyDefinition):Body; + + /** + * Creates a new rigid body model with a rectangle hull. The options parameter is an object that specifies any properties you wish to override the defaults. See the properites section of the Matter.Body module for detailed information on what you can pass via the options object. + * + * @param x + * @param y + * @param width + * @param height + * @param options + */ + static rectangle(x:number, y:number, width:number, height:number, options?:IBodyDefinition):Body; + + /** + * Creates a new rigid body model with a trapezoid hull. The options parameter is an object that specifies any properties you wish to override the defaults. See the properites section of the Matter.Body module for detailed information on what you can pass via the options object. + * + * @param x + * @param y + * @param width + * @param height + * @param slope + * @param options + */ + static trapezoid(x:number, y:number, width:number, height:number, slope:number, options?:IBodyDefinition):Body; + + + } + + export interface IBodyRenderOptions + { + /** + * A String that defines the fill style to use when rendering the body (if a sprite is not defined). It is the same as when using a canvas, so it accepts CSS style property values. + Default: a random colour + */ + fillStyle:string; + + /** + * A Number that defines the line width to use when rendering the body outline (if a sprite is not defined). A value of 0 means no outline will be rendered. + Default: 1.5 + */ + lineWidth:number; + + /** + * An Object that defines the sprite properties to use when rendering, if any. + */ + sprite:IBodyRenderOptionsSprite; + + /** + * A String that defines the stroke style to use when rendering the body outline (if a sprite is not defined). It is the same as when using a canvas, so it accepts CSS style property values. + Default: a random colour + */ + strokeStyle:string; + + /** + * A flag that indicates if the body should be rendered. + Default: true + */ + visible:boolean; + + } + + export interface IBodyRenderOptionsSprite + { + /** + * An String that defines the path to the image to use as the sprite texture, if any. + */ + texture:string; + + /** + * A Number that defines the scaling in the x-axis for the sprite, if any. + Default: 1 + */ + xScale:number; + + /** + * A Number that defines the scaling in the y-axis for the sprite, if any. + Default: 1 + */ + yScale:number; + } + + export class Bounds + { + + } + + export class Vector + { + + x:number; + y:number; + + /** + * Adds the two vectors. + * + * @param vectorA + * @param vectorB + * @returns A new vector of vectorA and vectorB added. + */ + static add ( vectorA:Vector, vectorB:Vector ):Vector; + + /** + * Returns the angle in radians between the two vectors relative to the x-axis. + * + * @param vectorA + * @param vectorB + * @returns The angle in radians. + */ + static angle ( vectorA:Vector, vectorB:Vector ):number; + + /** + * Returns the cross-product of two vectors. + * + * @param vectorA + * @param vectorB + * @returns The cross product of the two vectors. + */ + static cross ( vectorA:Vector, vectorB:Vector ):number; + + /** + * Divides a vector and a scalar. + * + * @param vector + * @param scalar + * @returns A new vector divided by scalar. + */ + static div ( vector:Vector, scalar:number ):Vector; + + /** + * Returns the dot-product of two vectors. + * + * @param vectorA + * @param vectorB + * @returns The dot product of the two vectors + */ + static dot ( vectorA:Vector, vectorB:Vector ):Number; + + /** + * Returns the magnitude (length) of a vector. + * + * @param vector + * @returns The magnitude of the vector + */ + static magnitude ( vector:Vector ):number; + + /** + * Returns the magnitude (length) of a vector (therefore saving a sqrt operation). + * + * @param vector + * @returns The squared magnitude of the vector. + */ + static magnitudeSquared ( vector:Vector ):number; + + /** + * Multiplies a vector and a scalar. + * + * @param vector + * @param scalar + * @returns A new vector multiplied by scalar + */ + static mult ( vector:Vector, scalar:number ):Vector; + + /** + * Negates both components of a vector such that it points in the opposite direction. + * @param vector + * @returns The negated vector. + */ + static neg ( vector:Vector ):Vector; + + /** + * Normalises a vector (such that its magnitude is 1). + * + * @param vector + * @returns A new vector normalised + */ + static normalise ( vector:Vector ):Vector; + + /** + * Returns the perpendicular vector. Set negate to true for the perpendicular in the opposite direction. + * + * @param vector + * @param negate + * @returns The perpendicular vector + */ + static perp ( vector:Vector, negate?:boolean ):Vector; + + /** + * Rotates the vector about (0, 0) by specified angle. + * + * @param vector + * @param angle + * @returns A new vector rotated about (0, 0) + */ + static rotate ( vector:Vector, angle:number ):Vector; + + /** + * Rotates the vector about a specified point by specified angle. + * + * @param vector + * @param angle + * @param point + * @returns A new vector rotated about the point + */ + static rotateAbout ( vector:Vector, angle:number, point:Vector ):Vector; + + /** + * Subtracts the two vectors. + * + * @param vectorA + * @param vectorB + * @returns A new vector of vectorA and vectorB subtracted + */ + static sub ( vectorA:Vector, vectorB:Vector ):Vector; + } + + export class Constraint + { + /** + * Creates a new constraint. All properties have default values, and many are pre-calculated automatically based on other properties. See the properites section below for detailed information on what you can pass via the options object. + * + * @param options + * @returns constraint + */ + static create(options:IConstraintDefinition):Constraint; + + /** + * The first possible Body that this constraint is attached to. + */ + bodyA:Body; + + /** + * The second possible Body that this constraint is attached to. + */ + bodyB:Body; + + /** + * An integer Number uniquely identifying number generated in Composite.create by Common.nextId. + */ + id:number; + + /** + * An arbitrary String name to help the user identify and manage bodies. + * Default: "Constraint" + */ + label:string; + + /** + * A Number that specifies the target resting length of the constraint. It is calculated automatically in Constraint.create from intial positions of the constraint.bodyA and constraint.bodyB. + */ + length:number; + + /** + * A Vector that specifies the offset of the constraint from center of the constraint.bodyA if defined, otherwise a world-space position. + Default: { x: 0, y: 0 } + */ + pointA:Vector; + + /** + * A Vector that specifies the offset of the constraint from center of the constraint.bodyA if defined, otherwise a world-space position. + Default: { x: 0, y: 0 } + */ + pointB:Vector; + + /** + * An Object that defines the rendering properties to be consumed by the module Matter.Render. + */ + render:IConstraintRenderRefinition; + + /** + * A Number that specifies the stiffness of the constraint, i.e. the rate at which it returns to its resting constraint.length. A value of 1 means the constraint should be very stiff. A value of 0.2 means the constraint acts like a soft spring. + Default: 1 + */ + stiffness:number; + + /** + * A String denoting the type of object. + Default: "constraint" + */ + type:string; + } + + export class MouseConstraint + { + create(engine:Engine, options:IMouseConstraintDefinition):MouseConstraint; + + /** + * The Constraint object that is used to move the body during interaction. + */ + constraint:Constraint; + + /** + * The Body that is currently being moved by the user, or null if no body. + Default: null + */ + dragBody:Body; + + /** + * The Vector offset at which the drag started relative to the dragBody, if any. + Default: null + */ + dragPoint:Vector; + + /** + * The Mouse instance in use. + Default: engine.input.mouse + */ + mouse:Mouse; + + /** + * A String denoting the type of object. + Default: "constraint" + */ + type:string; + } + + export interface IMouseConstraintDefinition + { + /** + * The Constraint object that is used to move the body during interaction. + */ + constraint?:Constraint; + + /** + * The Body that is currently being moved by the user, or null if no body. + Default: null + */ + dragBody?:Body; + + /** + * The Vector offset at which the drag started relative to the dragBody, if any. + Default: null + */ + dragPoint?:Vector; + + /** + * The Mouse instance in use. + Default: engine.input.mouse + */ + mouse?:Mouse; + + /** + * A String denoting the type of object. + Default: "constraint" + */ + type?:string; + } + + export class Query + { + /** + * Casts a ray segment against a set of bodies and returns all collisions, ray width is optional. Intersection points are not provided. + * + * @param bodies + * @param startPoint + * @param endPoint + * @param [rayWidth] + * + * @returns Object[] Collisions + */ + static ray( bodies:Array, startPoint:Vector, endPoint:Vector, rayWidth?:number ):Array; + + /** + * Returns all bodies whose bounds are inside (or outside if set) the given set of bounds, from the given set of bodies. + * + * @param bodies + * @param bounds + * @returns Body[] The bodies matching the query + */ + static region( bodies:Array, bounds:Bounds, outside?:boolean ):Array; + } + + export class Mouse + { + + } + + export interface IConstraintRenderRefinition + { + /** + * A Number that defines the line width to use when rendering the constraint outline. A value of 0 means no outline will be rendered. + Default: 2 + */ + lineWidth:number; + + /** + * A String that defines the stroke style to use when rendering the constraint outline. It is the same as when using a canvas, so it accepts CSS style property values. + Default: a random colour + */ + strokeStyle:string; + + /** + * A flag that indicates if the constraint should be rendered. + Default: true + */ + visible:boolean; + } + + export interface IConstraintDefinition + { + /** + * The first possible Body that this constraint is attached to. + */ + bodyA?:Body; + + /** + * The second possible Body that this constraint is attached to. + */ + bodyB?:Body; + + /** + * An integer Number uniquely identifying number generated in Composite.create by Common.nextId. + */ + id?:number; + + /** + * An arbitrary String name to help the user identify and manage bodies. + * Default: "Constraint" + */ + label?:string; + + /** + * A Number that specifies the target resting length of the constraint. It is calculated automatically in Constraint.create from intial positions of the constraint.bodyA and constraint.bodyB. + */ + length?:number; + + /** + * A Vector that specifies the offset of the constraint from center of the constraint.bodyA if defined, otherwise a world-space position. + Default: { x: 0, y: 0 } + */ + pointA?:Vector; + + /** + * A Vector that specifies the offset of the constraint from center of the constraint.bodyA if defined, otherwise a world-space position. + Default: { x: 0, y: 0 } + */ + pointB?:Vector; + + /** + * An Object that defines the rendering properties to be consumed by the module Matter.Render. + */ + render?:IConstraintRenderRefinition; + + /** + * A Number that specifies the stiffness of the constraint, i.e. the rate at which it returns to its resting constraint.length. A value of 1 means the constraint should be very stiff. A value of 0.2 means the constraint acts like a soft spring. + Default: 1 + */ + stiffness?:number; + + /** + * A String denoting the type of object. + Default: "constraint" + */ + type?:string; + } + + export class Composite + { + /** + * Generic add function. Adds one or many body(s), constraint(s) or a composite(s) to the given composite. + * + * @param composite + * @param object + * + * @returns The original composite with the objects added + */ + static add(composite:Composite, object:Body|Composite|Constraint ):Composite; + + /** + * Adds a body to the given composite + * + * @param composite + * @param body + * + * @returns Composite The original composite with the body added + */ + static addBody(composite:Composite, body:Body):Composite; + + /** + * Adds a composite to the given composite + * + * @param compositeA + * @param compositeB + * + * @returns The original compositeA with the objects from compositeB added + */ + static addComposite(compositeA:Composite, compositeB:Composite):Composite; + + /** + * + * @param composite + * @param constraint + * @returns The original composite with the constraint added + */ + static addConstraint(composite:Composite, constraint:Constraint):Composite; + + /** + * Returns all bodies in the given composite, including all bodies in its children, recursively. + * + * @param composite + * @returns Body[] All the bodies + */ + static allBodies(composite:Composite):Array; + + /** + * Returns all composites in the given composite, including all composites in its children, recursively. + * + * @param composite + * @returns Composite[] All the composites + */ + static allComposites(composite:Composite):Array; + + /** + * Returns all constraints in the given composite, including all constraints in its children, recursively. + * + * @param composite + * @returns Constraint[] All the constraints + */ + static allConstraints(composite:Composite):Array; + + /** + * Removes all bodies, constraints and composites from the given composite Optionally clearing its children recursively. + * + * @param world + * @param keepStatic + * @param deep + */ + static clear(world:World, keepStatic:boolean, deep?:boolean):void; + + /** + * Creates a new composite. The options parameter is an object that specifies any properties you wish to override the defaults. See the properites section below for detailed information on what you can pass via the options object. + * + * @param options + * @returns A new composite + */ + static create(options:ICompositeDefinition):Composite; + + /** + * Searches the composite recursively for an object matching the type and id supplied, null if not found + * + * @param composite + * @param id + * @param type + * @returns The requested object, if found. + */ + static get(composite:Composite,id:number,type:string):Body|Composite|Constraint; + + /** + * Moves the given object(s) from compositeA to compositeB (equal to a remove followed by an add) + * + * @param compositeA + * @param objects + * @param compositeB + * @returns Returns compositeA + */ + static move(compositeA:Composite, objects:Array, compositeB:Composite):Composite; + + /** + * Assigns new ids for all objects in the composite, recursively. + * + * @param composite + * @returns Returns composite + */ + static rebase(composite:Composite):Composite; + + /** + * Generic remove function. Removes one or many body(s), constraint(s) or a composite(s) to the given composite. Optionally searching its children recursively. + * + * @param composite + * @param object + * @param deep + * @returns The original composite with the objects removed. + */ + static remove(composite:Composite, object:Body|Composite|Constraint, deep?:boolean):Composite; + + /** + * Removes a body from the given composite, and optionally searching its children recursively. + * + * @param composite + * @param body + * @param deep + * @returns The original composite with the body removed. + */ + static removeBody(composite:Composite, body:Body, deep?:boolean):Composite; + + /** + * Removes a body from the given composite. + * + * @param composite + * @param position + * @returns The original composite with the body removed. + */ + static removeBodyAt(composite:Composite, position:number):Composite; + + /** + * Removes a composite from the given composite, and optionally searching its children recursively + * + * @param compositeA + * @param compositeB + * @returns The original compositeA with the composite removed. + */ + static removeComposite(compositeA:Composite, compositeB:Composite, deep?:boolean):Composite; + + /** + * Removes a composite from the given composite + * + * @param composite + * @param position + * @returns The original composite with the composite removed. + */ + static removeCompositeAt(composite:Composite, position:number):Composite; + + /** + * Removes a constraint from the given composite, and optionally searching its children recursively + * + * @param composite + * @param constraint + * @param deep + * + * @returns The original composite with the constraint removed + */ + static removeConstraint(composite:Composite, constraint:Constraint, deep?:boolean):Composite; + + /** + * Removes a body from the given composite + * @param composite + * @param position + * @returns The original composite with the constraint removed + */ + static removeConstraintAt(composite:Composite, position:number):Composite; + + /** + * Sets the composite's isModified flag. If updateParents is true, all parents will be set (default: false). If updateChildren is true, all children will be set (default: false). + * + * @param composite + * @param isModified + * @param updateParents + */ + static setModified(composite:Composite, isModified:boolean, updateParents?:boolean):void; + + /** + * An array of Body that are direct children of this composite. To add or remove bodies you should use Composite.add and Composite.remove methods rather than directly modifying this property. If you wish to recursively find all descendants, you should use the Composite.allBodies method. + */ + bodies:Array; + + /** + * An array of Composite that are direct children of this composite. To add or remove composites you should use Composite.add and Composite.remove methods rather than directly modifying this property. If you wish to recursively find all descendants, you should use the Composite.allComposites method. + */ + composites:Array; + + /** + * An array of Constraint that are direct children of this composite. To add or remove constraints you should use Composite.add and Composite.remove methods rather than directly modifying this property. If you wish to recursively find all descendants, you should use the Composite.allConstraints method. + */ + constraints:Array; + + /** + * An integer Number uniquely identifying number generated in Composite.create by Common.nextId. + */ + id:number; + + /** + * A flag that specifies whether the composite has been modified during the current step. Most Matter.Composite methods will automatically set this flag to true to inform the engine of changes to be handled. If you need to change it manually, you should use the Composite.setModified method. + */ + isModified:boolean; + + /** + * An arbitrary String name to help the user identify and manage composites. + * Default: "Composite" + */ + label:string; + + /** + * The Composite that is the parent of this composite. It is automatically managed by the Matter.Composite methods. + */ + parent:Composite; + + /** + * A String denoting the type of object. + */ + type:String; + + } + + export class Composites + { + /** + * It will create car composite, wheels, car body and constraints. + * + * @param xx + * @param yy + * @param width + * @param height + * @param wheelSize + * + * @returns A new composite car body + */ + static car ( xx:number, yy:number, width:number, height:number, wheelSize:number ):Composite; + + /** + * Creates chain + * @param composite + * @param xOffsetA + * @param yOffsetA + * @param xOffsetB + * @param yOffsetB + * @param options + */ + static chain ( composite:Composite, xOffsetA:number, yOffsetA:number, xOffsetB:number, yOffsetB:number, options:any ):Composite; + + /** + *Connects bodies in the composite with constraints in a grid pattern, with optional cross braces + * + * @param composite + * @param columns + * @param rows + * @param crossBrace + * @param options + * @returns The composite containing objects meshed together with constraints + */ + static mesh(composite:Composite, columns:number, rows:number, crossBrace:boolean, options:any ):Composite; + + /** + * Creates newton cradle + * @param xx + * @param yy + * @param _number + * @param size + * @param length + * @returns A new composite newtonsCradle body + */ + newtonsCradle(xx:number, yy:number, _number:number, size:number, length:number):Composite; + + /** + * Creates pyramid + * + * @param xx + * @param yy + * @param columns + * @param rows + * @param columnGap + * @param rowGap + * @param callback + * @return A new composite containing objects created in the callback + */ + static pyramid(xx:number, yy:number, columns:number, rows:number, columnGap:number, rowGap:number, callback:Function):Composite; + + /** + * Creates a simple soft body like object + * + * @param xx + * @param yy + * @param columns + * @param rows + * @param columnGap + * @param rowGap + * @param crossBrace + * @param particleRadius + * @param particleOptions + * @param constraintOptions + * + * @returns A new composite softBody + */ + static softBody ( xx:number, yy:number, columns:number, rows:number, columnGap:number, rowGap:number, crossBrace:boolean, particleRadius:number, particleOptions:any, constraintOptions:any ):Composite; + + /** + * Creates objects in and stacks them up. + * @param xx + * @param yy + * @param columns + * @param rows + * @param columnGap + * @param rowGap + * @param callback + * @returns A new composite containing objects created in the callback + */ + static stack ( xx:number, yy:number, columns:number, rows:number, columnGap:number, rowGap:number, callback:Function ):Composite; + } + + export interface ICompositeDefinition + { + /** + * An array of Body that are direct children of this composite. To add or remove bodies you should use Composite.add and Composite.remove methods rather than directly modifying this property. If you wish to recursively find all descendants, you should use the Composite.allBodies method. + */ + bodies?:Array; + + /** + * An array of Composite that are direct children of this composite. To add or remove composites you should use Composite.add and Composite.remove methods rather than directly modifying this property. If you wish to recursively find all descendants, you should use the Composite.allComposites method. + */ + composites?:Array; + + /** + * An array of Constraint that are direct children of this composite. To add or remove constraints you should use Composite.add and Composite.remove methods rather than directly modifying this property. If you wish to recursively find all descendants, you should use the Composite.allConstraints method. + */ + constraints?:Array; + + /** + * An integer Number uniquely identifying number generated in Composite.create by Common.nextId. + */ + id?:number; + + /** + * A flag that specifies whether the composite has been modified during the current step. Most Matter.Composite methods will automatically set this flag to true to inform the engine of changes to be handled. If you need to change it manually, you should use the Composite.setModified method. + */ + isModified?:boolean; + + /** + * An arbitrary String name to help the user identify and manage composites. + * Default: "Composite" + */ + label?:string; + + /** + * The Composite that is the parent of this composite. It is automatically managed by the Matter.Composite methods. + */ + parent?:Composite; + + /** + * A String denoting the type of object. + */ + type?:String; + } + + export class Vertices + { + /** + * Returns the area of the set of vertices. + * + * @param vertices + * @param signed + */ + static area ( vertices:Array, signed:boolean ):number; + + /** + * Returns the centre (centroid) of the set of vertices. + * @param vertices + * @returns The centre point + */ + static centre ( vertices:Array ):Vector; + + /** + * Chamfers a set of vertices by giving them rounded corners, returns a new set of vertices. The radius parameter is a single number or an array to specify the radius for each vertex. + * @param vertices + */ + static chamfer ( vertices:Array, radius:Array, quality:number, qualityMin:number, qualityMax:number ):void; + + + /** + * Returns true if the point is inside the set of vertices. + * + * @param vertices + * @returns True if the vertices contains point, otherwise false. + */ + static contains ( vertices:Array, point:Vector ):boolean; + + /** + * Creates a new set of Matter.Body compatible vertices. The vertices argument accepts an array of Matter.Vector orientated around the origin (0, 0), for example: + [{ x: 0, y: 0 }, { x: 25, y: 50 }, { x: 50, y: 0 }] + The Vertices.create method then inserts additional indexing properties required for efficient collision detection routines. + + * @param vertices + * @param body + */ + static create ( vertices:Array, body:Body):void; + + /** + * Parses a simple SVG-style path into a set of Matter.Vector points. + * + * @param path + * @returns vertices + */ + static fromPath ( path:string ):Array; + + /** + * Returns the moment of inertia (second moment of area) of the set of vertices given the total mass. + * + * @param vertices + * @returns The polygon's moment of inertia + */ + static inertia( vertices:Array, mass:number ):number; + + /** + * Rotates the set of vertices in-place. + * + * @param vertices + * @param angle + * @param point + */ + static static ( vertices:Array, angle:number, point:Vector ):void; + + /** + * Scales the vertices from a point (default is centre) in-place. + * + * @param vertices + * @param scaleX + * @param scaleY + * @param point + */ + static scale( vertices:Array, scaleX:number, scaleY:number, point:Vector ):void; + + /** + * Translates the set of vertices in-place. + * + * @param vertices + */ + static translate ( vertices:Array, vector:Vector, scalar:number ):void; + } + + export class Render + { + + } + + export class Events + { + /** + * Fired after rendering + * @param obj + * @param name + * @param callback + */ + static on(obj:Engine, name:"afterRender", callback:(e:any) => void ):void; + + /** + * Fired after engine update and after rendering + * @param obj + * @param name + * @param callback + */ + static on(obj:Engine, name:"afterUpdate", callback:(e:any) => void ):void; + + /** + * Fired just before rendering + * @param obj + * @param name + * @param callback + */ + static on(obj:Engine, name:"beforeRender", callback:(e:any) => void ):void; + + /** + * Fired at the start of a tick, before any updates to the engine or timing + * @param obj + * @param name + * @param callback + */ + static on(obj:Engine, name:"beforeTick", callback:(e:any) => void ):void; + + /** + * Fired just before an update + * @param obj + * @param name + * @param callback + */ + static on(obj:Engine, name:"beforeUpdate", callback:(e:any) => void ):void; + + /** + * Fired after engine update, provides a list of all pairs that are colliding in the current tick (if any) + * @param obj + * @param name + * @param callback + */ + static on(obj:Engine, name:"collisionActive", callback:(e:any) => void ):void; + + + /** + * Fired after engine update, provides a list of all pairs that have ended collision in the current tick (if any) + * @param obj + * @param name + * @param callback + */ + static on(obj:Engine, name:"collisionEnd", callback:(e:any) => void ):void; + + /** + * Fired after engine update, provides a list of all pairs that have started to collide in the current tick (if any) + * @param obj + * @param name + * @param callback + */ + static on(obj:Engine, name:"collisionStart", callback:(e:any) => void ):void; + + /** + * Fired when the mouse is down (or a touch has started) during the last step + * @param obj + * @param name + * @param callback + */ + static on(obj:Engine, name:"mousedown", callback:(e:any) => void ):void; + + /** + * Fired when the mouse has moved (or a touch moves) during the last step + * @param obj + * @param name + * @param callback + */ + static on(obj:Engine, name:"mousemove", callback:(e:any) => void ):void; + + /** + * Fired when the mouse is up (or a touch has ended) during the last step + * @param obj + * @param name + * @param callback + */ + static on(obj:Engine, name:"mouseup", callback:(e:any) => void ):void; + + /** + * Fired after engine timing updated, but just before engine state updated + * @param obj + * @param name + * @param callback + */ + static on(obj:Engine, name:"tick", callback:(e:any) => void ):void; + + static on(obj:Engine, name:string, callback:(e:any) => void ):void; + + /** + * Removes the given event callback. If no callback, clears all callbacks in eventNames. If no eventNames, clears all events. + * + * @param obj + * @param eventName + * @param callback + */ + static off(obj:any, eventName:string, callback: (e:any) => void ):void; + + /** + * Fires all the callbacks subscribed to the given object's eventName, in the order they subscribed, if any. + * + * @param object + * @param eventNames + * @param event + */ + static trigger( object:any, eventNames:string, event: (e:any) => void ):void; + + } +} diff --git a/meteor/meteor-tests.ts b/meteor/meteor-tests.ts index ec2ad3b81..f26527911 100644 --- a/meteor/meteor-tests.ts +++ b/meteor/meteor-tests.ts @@ -272,7 +272,7 @@ Posts.allow({ Posts.deny({ update: function (userId, docs, fields, modifier) { // can't change owners - return docs.userId = userId; + return docs.userId !== userId; }, remove: function (userId, doc) { // can't remove locked documents diff --git a/meteor/meteor.d.ts b/meteor/meteor.d.ts index 4118fbe06..ed0c97b29 100644 --- a/meteor/meteor.d.ts +++ b/meteor/meteor.d.ts @@ -16,17 +16,17 @@ interface JSONable { interface EJSON extends EJSONable {} declare module Match { - var Any; - var String; - var Integer; - var Boolean; - var undefined; + var Any:any; + var String:any; + var Integer:any; + var Boolean:any; + var undefined:any; //function null(); // not allowed in TypeScript - var Object; - function Optional(pattern):boolean; - function ObjectIncluding(dico):boolean; - function OneOf(...patterns); - function Where(condition); + var Object:any; + function Optional(pattern:any):boolean; + function ObjectIncluding(dico:any):boolean; + function OneOf(...patterns:any[]):any; + function Where(condition:any):any; } declare module Meteor { @@ -89,8 +89,8 @@ declare module Meteor { } interface Tinytest { - add(name:string, func:Function); - addAsync(name:string, func:Function); + add(name:string, func:Function):any; + addAsync(name:string, func:Function):any; } enum StatusEnum { @@ -145,9 +145,9 @@ declare module Mongo { MONGO } interface AllowDenyOptions { - insert?: (userId:string, doc) => boolean; - update?: (userId, doc, fieldNames, modifier) => boolean; - remove?: (userId, doc) => boolean; + insert?: (userId:string, doc:any) => boolean; + update?: (userId:string, doc:any, fieldNames:string[], modifier:any) => boolean; + remove?: (userId:string, doc:any) => boolean; fetch?: string[]; transform?: Function; } @@ -184,10 +184,10 @@ declare module HTTP { declare module Email { interface EmailMessage { from: string; - to: any; // string or string[] - cc?: any; // string or string[] - bcc?: any; // string or string[] - replyTo?: any; // string or string[] + to: string|string[]; + cc?: string|string[]; + bcc?: string|string[]; + replyTo?: string|string[]; subject: string; text?: string; html?: string; @@ -197,14 +197,14 @@ declare module Email { declare module DDP { interface DDPStatic { - subscribe(name, ...rest); - call(method:string, ...parameters):void; - apply(method:string, ...parameters):void; - methods(IMeteorMethodsDictionary); + subscribe(name:string, ...rest:any[]):void; + call(method:string, ...parameters:any[]):void; + apply(method:string, ...parameters:any[]):void; + methods(IMeteorMethodsDictionary:any):any; status():DDPStatus; - reconnect(); - disconnect(); - onReconnect(); + reconnect():void; + disconnect():void; + onReconnect():void; } interface DDPStatus { @@ -344,7 +344,7 @@ declare module Accounts { declare module App { function accessRule(domainRule: string, options?: { launchExternal?: boolean; - }); /** TODO: add return value **/ + }):any; /** TODO: add return value **/ function configurePlugin(pluginName: string, config: Object): void; function icons(icons: Object): void; function info(options: { @@ -393,7 +393,7 @@ declare module Blaze { findAll(selector: string): Blaze.TemplateInstance[]; firstNode: Object; lastNode: Object; - subscribe(name: string, ...args): Meteor.SubscriptionHandle; + subscribe(name: string, ...args: any[]): Meteor.SubscriptionHandle; subscriptionsReady(): boolean; view: Object; } @@ -475,7 +475,7 @@ declare module Meteor { wait?: boolean; onResultReceived?: Function; }, asyncCallback?: Function): any; - function call(name: string, ...args): any; + function call(name: string, ...args: any[]): any; function clearInterval(id: number): void; function clearTimeout(id: number): void; function disconnect(): void; @@ -503,7 +503,7 @@ declare module Meteor { var settings: {[id:string]: any}; function startup(func: Function): void; function status(): Meteor.StatusEnum; - function subscribe(name: string, ...args): Meteor.SubscriptionHandle; + function subscribe(name: string, ...args: any[]): Meteor.SubscriptionHandle; function user(): Meteor.User; function userId(): string; var users: Mongo.Collection; @@ -521,16 +521,16 @@ declare module Mongo { } interface Collection { allow(options: { - insert?: (userId:string, doc) => boolean; - update?: (userId, doc, fieldNames, modifier) => boolean; - remove?: (userId, doc) => boolean; + insert?: (userId:string, doc:any) => boolean; + update?: (userId:string, doc:any, fieldNames:string[], modifier:any) => boolean; + remove?: (userId:string, doc:any) => boolean; fetch?: string[]; transform?: Function; }): boolean; deny(options: { - insert?: (userId:string, doc) => boolean; - update?: (userId, doc, fieldNames, modifier) => boolean; - remove?: (userId, doc) => boolean; + insert?: (userId:string, doc:any) => boolean; + update?: (userId:string, doc:any, fieldNames:string[], modifier:any) => boolean; + remove?: (userId:string, doc:any) => boolean; fetch?: string[]; transform?: Function; }): boolean; @@ -684,30 +684,30 @@ interface CompileStepStatic { } interface CompileStep { addAsset(options: { - }, path: string, data: any /** Buffer **/ | string); /** TODO: add return value **/ + }, path: string, data: any /** Buffer **/ | string): any; /** TODO: add return value **/ addHtml(options: { section?: string; data?: string; - }); /** TODO: add return value **/ + }): any; /** TODO: add return value **/ addJavaScript(options: { path?: string; data?: string; sourcePath?: string; - }); /** TODO: add return value **/ + }): any; /** TODO: add return value **/ addStylesheet(options: { - }, path: string, data: string, sourceMap: string); /** TODO: add return value **/ - arch; /** TODO: add return value **/ - declaredExports; /** TODO: add return value **/ + }, path: string, data: string, sourceMap: string): any; /** TODO: add return value **/ + arch: any; /** TODO: add return value **/ + declaredExports: any; /** TODO: add return value **/ error(options: { - }, message: string, sourcePath?: string, line?: number, func?: string); /** TODO: add return value **/ - fileOptions; /** TODO: add return value **/ - fullInputPath; /** TODO: add return value **/ - inputPath; /** TODO: add return value **/ - inputSize; /** TODO: add return value **/ - packageName; /** TODO: add return value **/ - pathForSourceMap; /** TODO: add return value **/ + }, message: string, sourcePath?: string, line?: number, func?: string): any; /** TODO: add return value **/ + fileOptions: any; /** TODO: add return value **/ + fullInputPath: any; /** TODO: add return value **/ + inputPath: any; /** TODO: add return value **/ + inputSize: any; /** TODO: add return value **/ + packageName: any; /** TODO: add return value **/ + pathForSourceMap: any; /** TODO: add return value **/ read(n?: number): any; - rootOutputPath; /** TODO: add return value **/ + rootOutputPath: any; /** TODO: add return value **/ } declare var PackageAPI: PackageAPIStatic; @@ -777,5 +777,5 @@ interface Template { } declare function MethodInvocation(options: { -}); /** TODO: add return value **/ +}): any; /** TODO: add return value **/ declare function check(value: any, pattern: any): void; diff --git a/mocha/mocha-tests.ts b/mocha/mocha-tests.ts index dffd86e44..f90fefaf9 100644 --- a/mocha/mocha-tests.ts +++ b/mocha/mocha-tests.ts @@ -24,6 +24,18 @@ function test_context() { }); } +function test_suite() { + suite('some context', () => { }); + + suite.only('some context', () => { }); + + suite.skip('some context', () => { }); + + suite('some context', function() { + this.timeout(2000); + }); +} + function test_it() { it('does something', () => { }); @@ -39,6 +51,21 @@ function test_it() { }); } +function test_test() { + + test('does something', () => { }); + + test('does something', (done) => { done(); }); + + test.only('does something', () => { }); + + test.skip('does something', () => { }); + + test('does something', function () { + this.timeout(2000); + }); +} + function test_before() { before(() => { }); @@ -221,4 +248,4 @@ function test_run_withOnComplete() { instance.run((failures: number): void => { console.log(failures); }); -} \ No newline at end of file +} diff --git a/mocha/mocha.d.ts b/mocha/mocha.d.ts index 3f5d3e571..63ad66014 100644 --- a/mocha/mocha.d.ts +++ b/mocha/mocha.d.ts @@ -52,7 +52,7 @@ interface MochaDone { declare var mocha: Mocha; -declare var describe : { +declare var describe: { (description: string, spec: () => void): void; only(description: string, spec: () => void): void; skip(description: string, spec: () => void): void; @@ -60,12 +60,20 @@ declare var describe : { } // alias for `describe` -declare var context : { +declare var context: { (contextTitle: string, spec: () => void): void; only(contextTitle: string, spec: () => void): void; skip(contextTitle: string, spec: () => void): void; timeout(ms: number): void; -} +}; + +// alias for `describe` +declare var suite: { + (suiteTitle: string, spec: () => void): void; + only(suiteTitle: string, spec: () => void): void; + skip(suiteTitle: string, spec: () => void): void; + timeout(ms: number): void; +}; declare var it: { (expectation: string, assertion?: () => void): void; @@ -77,6 +85,17 @@ declare var it: { timeout(ms: number): void; }; +// alias for `it` +declare var test: { + (expectation: string, assertion?: () => void): void; + (expectation: string, assertion?: (done: MochaDone) => void): void; + only(expectation: string, assertion?: () => void): void; + only(expectation: string, assertion?: (done: MochaDone) => void): void; + skip(expectation: string, assertion?: () => void): void; + skip(expectation: string, assertion?: (done: MochaDone) => void): void; + timeout(ms: number): void; +}; + declare function before(action: () => void): void; declare function before(action: (done: MochaDone) => void): void; diff --git a/moment-timezone/moment-timezone-tests.ts b/moment-timezone/moment-timezone-tests.ts index f6a754c6e..b7624b63a 100644 --- a/moment-timezone/moment-timezone-tests.ts +++ b/moment-timezone/moment-timezone-tests.ts @@ -8,13 +8,46 @@ june.tz('America/Los_Angeles').format('ha z'); var a = moment.tz("2013-11-18 11:55", "America/Toronto"); var b = moment.tz("May 12th 2014 8PM", "MMM Do YYYY hA", "America/Toronto"); var c = moment.tz(1403454068850, "America/Toronto"); +var d = moment.tz("May 12th 2014 8PM", "MMM Do YYYY hA", true, "America/Toronto"); -var arr = [2013, 5, 1], +a.tz(); + +var num = 1367337600000, + arr = [2013, 5, 1], str = "2013-12-01", - obj = { year : 2013, month : 5, day : 1 }; + date = new Date(2013, 4, 1), + mo = moment([2013, 4, 1]), + obj = { year : 2013, month : 5, day : 1 }, + format = "YYYY-MM-DD", + formats = ["YYYY-MM-DD", "YYYY/MM/DD"], + formatsIncludingSpecial = ["YYYY-MM-DD", moment.ISO_8601], + language = "en"; +moment.tz(); +moment.tz("America/Los_Angeles"); + +moment.tz(num, "America/Los_Angeles"); moment.tz(arr, "America/Los_Angeles"); moment.tz(str, "America/Los_Angeles"); +moment.tz(str, format, "America/Los_Angeles"); +moment.tz(str, format, true, "America/Los_Angeles"); +moment.tz(str, format, language, "America/Los_Angeles"); +moment.tz(str, format, language, true, "America/Los_Angeles"); +moment.tz(str, formats, "America/Los_Angeles"); +moment.tz(str, formats, true, "America/Los_Angeles"); +moment.tz(str, formats, language, "America/Los_Angeles"); +moment.tz(str, formats, language, true, "America/Los_Angeles"); +moment.tz(str, moment.ISO_8601, "America/Los_Angeles"); +moment.tz(str, moment.ISO_8601, true, "America/Los_Angeles"); +moment.tz(str, moment.ISO_8601, language, "America/Los_Angeles"); +moment.tz(str, moment.ISO_8601, language, true, "America/Los_Angeles"); +moment.tz(str, formatsIncludingSpecial, "America/Los_Angeles"); +moment.tz(str, formatsIncludingSpecial, true, "America/Los_Angeles"); +moment.tz(str, formatsIncludingSpecial, language, "America/Los_Angeles"); +moment.tz(str, formatsIncludingSpecial, language, true, "America/Los_Angeles"); + +moment.tz(date, "America/Los_Angeles"); +moment.tz(mo, "America/Los_Angeles"); moment.tz(obj, "America/Los_Angeles"); moment.tz.zone('America/Los_Angeles').abbr(1403465838805); diff --git a/moment-timezone/moment-timezone.d.ts b/moment-timezone/moment-timezone.d.ts index 1e908ace1..2ac473057 100644 --- a/moment-timezone/moment-timezone.d.ts +++ b/moment-timezone/moment-timezone.d.ts @@ -7,6 +7,7 @@ declare module moment { interface Moment { + tz(): string; tz(timezone: string): Moment; } @@ -27,9 +28,27 @@ interface MomentZone { } interface MomentTimezone { + (): moment.Moment; + (timezone: string): moment.Moment; (date: number, timezone: string): moment.Moment; (date: number[], timezone: string): moment.Moment; + (date: string, timezone: string): moment.Moment; (date: string, format: string, timezone: string): moment.Moment; + (date: string, format: string, strict: boolean, timezone: string): moment.Moment; + (date: string, format: string, language: string, timezone: string): moment.Moment; + (date: string, format: string, language: string, strict: boolean, timezone: string): moment.Moment; + (date: string, formats: string[], timezone: string): moment.Moment; + (date: string, formats: string[], strict: boolean, timezone: string): moment.Moment; + (date: string, formats: string[], language: string, timezone: string): moment.Moment; + (date: string, formats: string[], language: string, strict: boolean, timezone: string): moment.Moment; + (date: string, specialFormat: () => void, timezone: string): moment.Moment; + (date: string, specialFormat: () => void, strict: boolean, timezone: string): moment.Moment; + (date: string, specialFormat: () => void, language: string, timezone: string): moment.Moment; + (date: string, specialFormat: () => void, language: string, strict: boolean, timezone: string): moment.Moment; + (date: string, formatsIncludingSpecial: any[], timezone: string): moment.Moment; + (date: string, formatsIncludingSpecial: any[], strict: boolean, timezone: string): moment.Moment; + (date: string, formatsIncludingSpecial: any[], language: string, timezone: string): moment.Moment; + (date: string, formatsIncludingSpecial: any[], language: string, strict: boolean, timezone: string): moment.Moment; (date: Date, timezone: string): moment.Moment; (date: moment.Moment, timezone: string): moment.Moment; (date: Object, timezone: string): moment.Moment; diff --git a/moment/moment-external-tests.ts b/moment/moment-external-tests.ts index 1b1d083ba..c5855c12c 100644 --- a/moment/moment-external-tests.ts +++ b/moment/moment-external-tests.ts @@ -188,6 +188,7 @@ moment(1318874398806).valueOf(); moment(1318874398806).unix(); moment([2000]).isLeapYear(); moment().zone(); +moment().utcOffset(); moment("2012-2", "YYYY-MM").daysInMonth(); moment([2011, 2, 12]).isDST(); diff --git a/moment/moment-node.d.ts b/moment/moment-node.d.ts new file mode 100644 index 000000000..13f1b9362 --- /dev/null +++ b/moment/moment-node.d.ts @@ -0,0 +1,482 @@ +// Type definitions for Moment.js 2.8.0 +// Project: https://github.com/timrwood/moment +// Definitions by: Michael Lakerveld , Aaron King , Hiroki Horiuchi , Dick van den Brink , Adi Dahiya +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module moment { + + interface MomentInput { + + years?: number; + y?: number; + + months?: number; + M?: number; + + weeks?: number; + w?: number; + + days?: number; + d?: number; + + hours?: number; + h?: number; + + minutes?: number; + m?: number; + + seconds?: number; + s?: number; + + milliseconds?: number; + ms?: number; + + } + + interface Duration { + + humanize(withSuffix?: boolean): string; + + as(units: string): number; + + milliseconds(): number; + asMilliseconds(): number; + + seconds(): number; + asSeconds(): number; + + minutes(): number; + asMinutes(): number; + + hours(): number; + asHours(): number; + + days(): number; + asDays(): number; + + months(): number; + asMonths(): number; + + years(): number; + asYears(): number; + + add(n: number, p: string): Duration; + add(n: number): Duration; + add(d: Duration): Duration; + + subtract(n: number, p: string): Duration; + subtract(n: number): Duration; + subtract(d: Duration): Duration; + + toISOString(): string; + + } + + interface Moment { + + format(format: string): string; + format(): string; + + fromNow(withoutSuffix?: boolean): string; + + startOf(unitOfTime: string): Moment; + endOf(unitOfTime: string): Moment; + + /** + * Mutates the original moment by adding time. (deprecated in 2.8.0) + * + * @param unitOfTime the unit of time you want to add (eg "years" / "hours" etc) + * @param amount the amount you want to add + */ + add(unitOfTime: string, amount: number): Moment; + /** + * Mutates the original moment by adding time. + * + * @param amount the amount you want to add + * @param unitOfTime the unit of time you want to add (eg "years" / "hours" etc) + */ + add(amount: number, unitOfTime: string): Moment; + /** + * Mutates the original moment by adding time. Note that the order of arguments can be flipped. + * + * @param amount the amount you want to add + * @param unitOfTime the unit of time you want to add (eg "years" / "hours" etc) + */ + add(amount: string, unitOfTime: string): Moment; + /** + * Mutates the original moment by adding time. + * + * @param objectLiteral an object literal that describes multiple time units {days:7,months:1} + */ + add(objectLiteral: MomentInput): Moment; + /** + * Mutates the original moment by adding time. + * + * @param duration a length of time + */ + add(duration: Duration): Moment; + + /** + * Mutates the original moment by subtracting time. (deprecated in 2.8.0) + * + * @param unitOfTime the unit of time you want to subtract (eg "years" / "hours" etc) + * @param amount the amount you want to subtract + */ + subtract(unitOfTime: string, amount: number): Moment; + /** + * Mutates the original moment by subtracting time. + * + * @param unitOfTime the unit of time you want to subtract (eg "years" / "hours" etc) + * @param amount the amount you want to subtract + */ + subtract(amount: number, unitOfTime: string): Moment; + /** + * Mutates the original moment by subtracting time. Note that the order of arguments can be flipped. + * + * @param amount the amount you want to add + * @param unitOfTime the unit of time you want to subtract (eg "years" / "hours" etc) + */ + subtract(amount: string, unitOfTime: string): Moment; + /** + * Mutates the original moment by subtracting time. + * + * @param objectLiteral an object literal that describes multiple time units {days:7,months:1} + */ + subtract(objectLiteral: MomentInput): Moment; + /** + * Mutates the original moment by subtracting time. + * + * @param duration a length of time + */ + subtract(duration: Duration): Moment; + + calendar(): string; + calendar(start: Moment): string; + + clone(): Moment; + + /** + * @return Unix timestamp, or milliseconds since the epoch. + */ + valueOf(): number; + + local(): Moment; // current date/time in local mode + + utc(): Moment; // current date/time in UTC mode + + isValid(): boolean; + + year(y: number): Moment; + year(): number; + quarter(): number; + quarter(q: number): Moment; + month(M: number): Moment; + month(M: string): Moment; + month(): number; + day(d: number): Moment; + day(d: string): Moment; + day(): number; + date(d: number): Moment; + date(): number; + hour(h: number): Moment; + hour(): number; + hours(h: number): Moment; + hours(): number; + minute(m: number): Moment; + minute(): number; + minutes(m: number): Moment; + minutes(): number; + second(s: number): Moment; + second(): number; + seconds(s: number): Moment; + seconds(): number; + millisecond(ms: number): Moment; + millisecond(): number; + milliseconds(ms: number): Moment; + milliseconds(): number; + weekday(): number; + weekday(d: number): Moment; + isoWeekday(): number; + isoWeekday(d: number): Moment; + weekYear(): number; + weekYear(d: number): Moment; + isoWeekYear(): number; + isoWeekYear(d: number): Moment; + week(): number; + week(d: number): Moment; + weeks(): number; + weeks(d: number): Moment; + isoWeek(): number; + isoWeek(d: number): Moment; + isoWeeks(): number; + isoWeeks(d: number): Moment; + weeksInYear(): number; + isoWeeksInYear(): number; + dayOfYear(): number; + dayOfYear(d: number): Moment; + + from(f: Moment): string; + from(f: Moment, suffix: boolean): string; + from(d: Date): string; + from(s: string): string; + from(date: number[]): string; + + diff(b: Moment): number; + diff(b: Moment, unitOfTime: string): number; + diff(b: Moment, unitOfTime: string, round: boolean): number; + + toArray(): number[]; + toDate(): Date; + toISOString(): string; + toJSON(): string; + unix(): number; + + isLeapYear(): boolean; + zone(): number; + zone(b: number): Moment; + zone(b: string): Moment; + utcOffset(): number; + utcOffset(b: number): Moment; + utcOffset(b: string): Moment; + daysInMonth(): number; + isDST(): boolean; + + isBefore(): boolean; + isBefore(b: Moment): boolean; + isBefore(b: string): boolean; + isBefore(b: Number): boolean; + isBefore(b: Date): boolean; + isBefore(b: number[]): boolean; + isBefore(b: Moment, granularity: string): boolean; + isBefore(b: String, granularity: string): boolean; + isBefore(b: Number, granularity: string): boolean; + isBefore(b: Date, granularity: string): boolean; + isBefore(b: number[], granularity: string): boolean; + + isAfter(): boolean; + isAfter(b: Moment): boolean; + isAfter(b: string): boolean; + isAfter(b: Number): boolean; + isAfter(b: Date): boolean; + isAfter(b: number[]): boolean; + isAfter(b: Moment, granularity: string): boolean; + isAfter(b: String, granularity: string): boolean; + isAfter(b: Number, granularity: string): boolean; + isAfter(b: Date, granularity: string): boolean; + isAfter(b: number[], granularity: string): boolean; + + isSame(b: Moment): boolean; + isSame(b: string): boolean; + isSame(b: Number): boolean; + isSame(b: Date): boolean; + isSame(b: number[]): boolean; + isSame(b: Moment, granularity: string): boolean; + isSame(b: String, granularity: string): boolean; + isSame(b: Number, granularity: string): boolean; + isSame(b: Date, granularity: string): boolean; + isSame(b: number[], granularity: string): boolean; + + // Deprecated as of 2.8.0. + lang(language: string): Moment; + lang(reset: boolean): Moment; + lang(): MomentLanguage; + + locale(language: string): Moment; + locale(reset: boolean): Moment; + locale(): string; + + localeData(language: string): Moment; + localeData(reset: boolean): Moment; + localeData(): MomentLanguage; + + // Deprecated as of 2.7.0. + max(date: Date): Moment; + max(date: number): Moment; + max(date: any[]): Moment; + max(date: string): Moment; + max(date: string, format: string): Moment; + max(clone: Moment): Moment; + + // Deprecated as of 2.7.0. + min(date: Date): Moment; + min(date: number): Moment; + min(date: any[]): Moment; + min(date: string): Moment; + min(date: string, format: string): Moment; + min(clone: Moment): Moment; + + get(unit: string): number; + set(unit: string, value: number): Moment; + + } + + interface MomentCalendar { + + lastDay: any; + sameDay: any; + nextDay: any; + lastWeek: any; + nextWeek: any; + sameElse: any; + + } + + interface BaseMomentLanguage { + months ?: any; + monthsShort ?: any; + weekdays ?: any; + weekdaysShort ?: any; + weekdaysMin ?: any; + relativeTime ?: MomentRelativeTime; + meridiem ?: (hour: number, minute: number, isLowercase: boolean) => string; + calendar ?: MomentCalendar; + ordinal ?: (num: number) => string; + } + + interface MomentLanguage extends BaseMomentLanguage { + longDateFormat?: MomentLongDateFormat; + } + + interface MomentLanguageData extends BaseMomentLanguage { + /** + * @param formatType should be L, LL, LLL, LLLL. + */ + longDateFormat(formatType: string): string; + } + + interface MomentLongDateFormat { + + L: string; + LL: string; + LLL: string; + LLLL: string; + LT: string; + l?: string; + ll?: string; + lll?: string; + llll?: string; + lt?: string; + + } + + interface MomentRelativeTime { + + future: any; + past: any; + s: any; + m: any; + mm: any; + h: any; + hh: any; + d: any; + dd: any; + M: any; + MM: any; + y: any; + yy: any; + + } + + interface MomentStatic { + + version: string; + + (): Moment; + (date: number): Moment; + (date: number[]): Moment; + (date: string, format?: string, strict?: boolean): Moment; + (date: string, format?: string, language?: string, strict?: boolean): Moment; + (date: string, formats: string[], strict?: boolean): Moment; + (date: string, formats: string[], language?: string, strict?: boolean): Moment; + (date: string, specialFormat: () => void, strict?: boolean): Moment; + (date: string, specialFormat: () => void, language?: string, strict?: boolean): Moment; + (date: string, formatsIncludingSpecial: any[], strict?: boolean): Moment; + (date: string, formatsIncludingSpecial: any[], language?: string, strict?: boolean): Moment; + (date: Date): Moment; + (date: Moment): Moment; + (date: Object): Moment; + + utc(): Moment; + utc(date: number): Moment; + utc(date: number[]): Moment; + utc(date: string, format?: string, strict?: boolean): Moment; + utc(date: string, format?: string, language?: string, strict?: boolean): Moment; + utc(date: string, formats: string[], strict?: boolean): Moment; + utc(date: string, formats: string[], language?: string, strict?: boolean): Moment; + utc(date: Date): Moment; + utc(date: Moment): Moment; + utc(date: Object): Moment; + + unix(timestamp: number): Moment; + + invalid(parsingFlags?: Object): Moment; + isMoment(): boolean; + isMoment(m: any): boolean; + isDuration(): boolean; + isDuration(d: any): boolean; + + // Deprecated in 2.8.0. + lang(language?: string): string; + lang(language?: string, definition?: MomentLanguage): string; + + locale(language?: string): string; + locale(language?: string[]): string; + locale(language?: string, definition?: MomentLanguage): string; + + localeData(language?: string): MomentLanguageData; + + longDateFormat: any; + relativeTime: any; + meridiem: (hour: number, minute: number, isLowercase: boolean) => string; + calendar: any; + ordinal: (num: number) => string; + + duration(milliseconds: Number): Duration; + duration(num: Number, unitOfTime: string): Duration; + duration(input: MomentInput): Duration; + duration(object: any): Duration; + duration(): Duration; + + parseZone(date: string): Moment; + + months(): string[]; + months(index: number): string; + months(format: string): string[]; + months(format: string, index: number): string; + monthsShort(): string[]; + monthsShort(index: number): string; + monthsShort(format: string): string[]; + monthsShort(format: string, index: number): string; + + weekdays(): string[]; + weekdays(index: number): string; + weekdays(format: string): string[]; + weekdays(format: string, index: number): string; + weekdaysShort(): string[]; + weekdaysShort(index: number): string; + weekdaysShort(format: string): string[]; + weekdaysShort(format: string, index: number): string; + weekdaysMin(): string[]; + weekdaysMin(index: number): string; + weekdaysMin(format: string): string[]; + weekdaysMin(format: string, index: number): string; + + min(moments: Moment[]): Moment; + max(moments: Moment[]): Moment; + + normalizeUnits(unit: string): string; + relativeTimeThreshold(threshold: string, limit: number): void; + + /** + * Constant used to enable explicit ISO_8601 format parsing. + */ + ISO_8601(): void; + + } + +} + +declare module 'moment' { + var moment: moment.MomentStatic; + export = moment; +} diff --git a/moment/moment-tests.ts b/moment/moment-tests.ts index dc11eeac8..16490d2e1 100644 --- a/moment/moment-tests.ts +++ b/moment/moment-tests.ts @@ -188,6 +188,7 @@ moment(1318874398806).valueOf(); moment(1318874398806).unix(); moment([2000]).isLeapYear(); moment().zone(); +moment().utcOffset(); moment("2012-2", "YYYY-MM").daysInMonth(); moment([2011, 2, 12]).isDST(); diff --git a/moment/moment.d.ts b/moment/moment.d.ts index 834cc0462..736956e5d 100644 --- a/moment/moment.d.ts +++ b/moment/moment.d.ts @@ -3,470 +3,6 @@ // Definitions by: Michael Lakerveld , Aaron King , Hiroki Horiuchi , Dick van den Brink , Adi Dahiya // Definitions: https://github.com/borisyankov/DefinitelyTyped -declare module moment { - - interface MomentInput { - - years?: number; - y?: number; - - months?: number; - M?: number; - - weeks?: number; - w?: number; - - days?: number; - d?: number; - - hours?: number; - h?: number; - - minutes?: number; - m?: number; - - seconds?: number; - s?: number; - - milliseconds?: number; - ms?: number; - - } - - interface Duration { - - humanize(withSuffix?: boolean): string; - - as(units: string): number; - - milliseconds(): number; - asMilliseconds(): number; - - seconds(): number; - asSeconds(): number; - - minutes(): number; - asMinutes(): number; - - hours(): number; - asHours(): number; - - days(): number; - asDays(): number; - - months(): number; - asMonths(): number; - - years(): number; - asYears(): number; - - add(n: number, p: string): Duration; - add(n: number): Duration; - add(d: Duration): Duration; - - subtract(n: number, p: string): Duration; - subtract(n: number): Duration; - subtract(d: Duration): Duration; - - toISOString(): string; - - } - - interface Moment { - - format(format: string): string; - format(): string; - - fromNow(withoutSuffix?: boolean): string; - - startOf(unitOfTime: string): Moment; - endOf(unitOfTime: string): Moment; - - /** - * Mutates the original moment by adding time. (deprecated in 2.8.0) - * - * @param unitOfTime the unit of time you want to add (eg "years" / "hours" etc) - * @param amount the amount you want to add - */ - add(unitOfTime: string, amount: number): Moment; - /** - * Mutates the original moment by adding time. - * - * @param amount the amount you want to add - * @param unitOfTime the unit of time you want to add (eg "years" / "hours" etc) - */ - add(amount: number, unitOfTime: string): Moment; - /** - * Mutates the original moment by adding time. Note that the order of arguments can be flipped. - * - * @param amount the amount you want to add - * @param unitOfTime the unit of time you want to add (eg "years" / "hours" etc) - */ - add(amount: string, unitOfTime: string): Moment; - /** - * Mutates the original moment by adding time. - * - * @param objectLiteral an object literal that describes multiple time units {days:7,months:1} - */ - add(objectLiteral: MomentInput): Moment; - /** - * Mutates the original moment by adding time. - * - * @param duration a length of time - */ - add(duration: Duration): Moment; - - /** - * Mutates the original moment by subtracting time. (deprecated in 2.8.0) - * - * @param unitOfTime the unit of time you want to subtract (eg "years" / "hours" etc) - * @param amount the amount you want to subtract - */ - subtract(unitOfTime: string, amount: number): Moment; - /** - * Mutates the original moment by subtracting time. - * - * @param unitOfTime the unit of time you want to subtract (eg "years" / "hours" etc) - * @param amount the amount you want to subtract - */ - subtract(amount: number, unitOfTime: string): Moment; - /** - * Mutates the original moment by subtracting time. Note that the order of arguments can be flipped. - * - * @param amount the amount you want to add - * @param unitOfTime the unit of time you want to subtract (eg "years" / "hours" etc) - */ - subtract(amount: string, unitOfTime: string): Moment; - /** - * Mutates the original moment by subtracting time. - * - * @param objectLiteral an object literal that describes multiple time units {days:7,months:1} - */ - subtract(objectLiteral: MomentInput): Moment; - /** - * Mutates the original moment by subtracting time. - * - * @param duration a length of time - */ - subtract(duration: Duration): Moment; - - calendar(): string; - calendar(start: Moment): string; - - clone(): Moment; - - /** - * @return Unix timestamp, or milliseconds since the epoch. - */ - valueOf(): number; - - local(): Moment; // current date/time in local mode - - utc(): Moment; // current date/time in UTC mode - - isValid(): boolean; - - year(y: number): Moment; - year(): number; - quarter(): number; - quarter(q: number): Moment; - month(M: number): Moment; - month(M: string): Moment; - month(): number; - day(d: number): Moment; - day(d: string): Moment; - day(): number; - date(d: number): Moment; - date(): number; - hour(h: number): Moment; - hour(): number; - hours(h: number): Moment; - hours(): number; - minute(m: number): Moment; - minute(): number; - minutes(m: number): Moment; - minutes(): number; - second(s: number): Moment; - second(): number; - seconds(s: number): Moment; - seconds(): number; - millisecond(ms: number): Moment; - millisecond(): number; - milliseconds(ms: number): Moment; - milliseconds(): number; - weekday(): number; - weekday(d: number): Moment; - isoWeekday(): number; - isoWeekday(d: number): Moment; - weekYear(): number; - weekYear(d: number): Moment; - isoWeekYear(): number; - isoWeekYear(d: number): Moment; - week(): number; - week(d: number): Moment; - weeks(): number; - weeks(d: number): Moment; - isoWeek(): number; - isoWeek(d: number): Moment; - isoWeeks(): number; - isoWeeks(d: number): Moment; - weeksInYear(): number; - isoWeeksInYear(): number; - dayOfYear(): number; - dayOfYear(d: number): Moment; - - from(f: Moment): string; - from(f: Moment, suffix: boolean): string; - from(d: Date): string; - from(s: string): string; - from(date: number[]): string; - - diff(b: Moment): number; - diff(b: Moment, unitOfTime: string): number; - diff(b: Moment, unitOfTime: string, round: boolean): number; - - toArray(): number[]; - toDate(): Date; - toISOString(): string; - toJSON(): string; - unix(): number; - - isLeapYear(): boolean; - zone(): number; - zone(b: number): Moment; - zone(b: string): Moment; - daysInMonth(): number; - isDST(): boolean; - - isBefore(): boolean; - isBefore(b: Moment): boolean; - isBefore(b: string): boolean; - isBefore(b: Number): boolean; - isBefore(b: Date): boolean; - isBefore(b: number[]): boolean; - isBefore(b: Moment, granularity: string): boolean; - isBefore(b: String, granularity: string): boolean; - isBefore(b: Number, granularity: string): boolean; - isBefore(b: Date, granularity: string): boolean; - isBefore(b: number[], granularity: string): boolean; - - isAfter(): boolean; - isAfter(b: Moment): boolean; - isAfter(b: string): boolean; - isAfter(b: Number): boolean; - isAfter(b: Date): boolean; - isAfter(b: number[]): boolean; - isAfter(b: Moment, granularity: string): boolean; - isAfter(b: String, granularity: string): boolean; - isAfter(b: Number, granularity: string): boolean; - isAfter(b: Date, granularity: string): boolean; - isAfter(b: number[], granularity: string): boolean; - - isSame(b: Moment): boolean; - isSame(b: string): boolean; - isSame(b: Number): boolean; - isSame(b: Date): boolean; - isSame(b: number[]): boolean; - isSame(b: Moment, granularity: string): boolean; - isSame(b: String, granularity: string): boolean; - isSame(b: Number, granularity: string): boolean; - isSame(b: Date, granularity: string): boolean; - isSame(b: number[], granularity: string): boolean; - - // Deprecated as of 2.8.0. - lang(language: string): Moment; - lang(reset: boolean): Moment; - lang(): MomentLanguage; - - locale(language: string): Moment; - locale(reset: boolean): Moment; - locale(): string; - - localeData(language: string): Moment; - localeData(reset: boolean): Moment; - localeData(): MomentLanguage; - - // Deprecated as of 2.7.0. - max(date: Date): Moment; - max(date: number): Moment; - max(date: any[]): Moment; - max(date: string): Moment; - max(date: string, format: string): Moment; - max(clone: Moment): Moment; - - // Deprecated as of 2.7.0. - min(date: Date): Moment; - min(date: number): Moment; - min(date: any[]): Moment; - min(date: string): Moment; - min(date: string, format: string): Moment; - min(clone: Moment): Moment; - - get(unit: string): number; - set(unit: string, value: number): Moment; - - } - - interface MomentCalendar { - - lastDay: any; - sameDay: any; - nextDay: any; - lastWeek: any; - nextWeek: any; - sameElse: any; - - } - - interface MomentLanguage { - - months?: any; - monthsShort?: any; - weekdays?: any; - weekdaysShort?: any; - weekdaysMin?: any; - longDateFormat?: MomentLongDateFormat; - relativeTime?: MomentRelativeTime; - meridiem?: (hour: number, minute: number, isLowercase: boolean) => string; - calendar?: MomentCalendar; - ordinal?: (num: number) => string; - - } - - interface MomentLongDateFormat { - - L: string; - LL: string; - LLL: string; - LLLL: string; - LT: string; - l?: string; - ll?: string; - lll?: string; - llll?: string; - lt?: string; - - } - - interface MomentRelativeTime { - - future: any; - past: any; - s: any; - m: any; - mm: any; - h: any; - hh: any; - d: any; - dd: any; - M: any; - MM: any; - y: any; - yy: any; - - } - - interface MomentStatic { - - version: string; - - (): Moment; - (date: number): Moment; - (date: number[]): Moment; - (date: string, format?: string, strict?: boolean): Moment; - (date: string, format?: string, language?: string, strict?: boolean): Moment; - (date: string, formats: string[], strict?: boolean): Moment; - (date: string, formats: string[], language?: string, strict?: boolean): Moment; - (date: string, specialFormat: () => void, strict?: boolean): Moment; - (date: string, specialFormat: () => void, language?: string, strict?: boolean): Moment; - (date: string, formatsIncludingSpecial: any[], strict?: boolean): Moment; - (date: string, formatsIncludingSpecial: any[], language?: string, strict?: boolean): Moment; - (date: Date): Moment; - (date: Moment): Moment; - (date: Object): Moment; - - utc(): Moment; - utc(date: number): Moment; - utc(date: number[]): Moment; - utc(date: string, format?: string, strict?: boolean): Moment; - utc(date: string, format?: string, language?: string, strict?: boolean): Moment; - utc(date: string, formats: string[], strict?: boolean): Moment; - utc(date: string, formats: string[], language?: string, strict?: boolean): Moment; - utc(date: Date): Moment; - utc(date: Moment): Moment; - utc(date: Object): Moment; - - unix(timestamp: number): Moment; - - invalid(parsingFlags?: Object): Moment; - isMoment(): boolean; - isMoment(m: any): boolean; - isDuration(): boolean; - isDuration(d: any): boolean; - - // Deprecated in 2.8.0. - lang(language?: string): string; - lang(language?: string, definition?: MomentLanguage): string; - - locale(language?: string): string; - locale(language?: string[]): string; - locale(language?: string, definition?: MomentLanguage): string; - - localeData(language?: string): MomentLanguage; - - longDateFormat: any; - relativeTime: any; - meridiem: (hour: number, minute: number, isLowercase: boolean) => string; - calendar: any; - ordinal: (num: number) => string; - - duration(milliseconds: Number): Duration; - duration(num: Number, unitOfTime: string): Duration; - duration(input: MomentInput): Duration; - duration(object: any): Duration; - duration(): Duration; - - parseZone(date: string): Moment; - - months(): string[]; - months(index: number): string; - months(format: string): string[]; - months(format: string, index: number): string; - monthsShort(): string[]; - monthsShort(index: number): string; - monthsShort(format: string): string[]; - monthsShort(format: string, index: number): string; - - weekdays(): string[]; - weekdays(index: number): string; - weekdays(format: string): string[]; - weekdays(format: string, index: number): string; - weekdaysShort(): string[]; - weekdaysShort(index: number): string; - weekdaysShort(format: string): string[]; - weekdaysShort(format: string, index: number): string; - weekdaysMin(): string[]; - weekdaysMin(index: number): string; - weekdaysMin(format: string): string[]; - weekdaysMin(format: string, index: number): string; - - min(moments: Moment[]): Moment; - max(moments: Moment[]): Moment; - - normalizeUnits(unit: string): string; - relativeTimeThreshold(threshold: string, limit: number): void; - - /** - * Constant used to enable explicit ISO_8601 format parsing. - */ - ISO_8601(): void; - - } - -} +/// declare var moment: moment.MomentStatic; - -declare module 'moment' { - export = moment; -} diff --git a/mongoose/mongoose-tests.ts b/mongoose/mongoose-tests.ts index 1c8b804d6..de68f006a 100644 --- a/mongoose/mongoose-tests.ts +++ b/mongoose/mongoose-tests.ts @@ -146,6 +146,9 @@ Model.remove((err: any, res: IActor[]) => {}); Model.save((err: any, res: IActor, numberAffected: number) => {}); Model.create({ type: 'jelly bean' }, { type: 'snickers' }, (err: any, res1: IActor, res2: IActor) => {}); Model.create({ type: 'jawbreaker' }); +Model.create({ type: 'muffin' }).then(function (res) { + res.name; +}); Model.distinct('url', { clicks: {$gt: 100}}, (err: any, result: IActor[]) => {}); Model.distinct('url'); @@ -364,5 +367,14 @@ schema.virtual('display_name') .get(function(): string { return this.name; }) .set((value: string): void => {}); -var id : mongoose.Types.ObjectId; +var id: mongoose.Types.ObjectId = new mongoose.Types.ObjectId('foo'); +var id2: mongoose.Types.ObjectId = new mongoose.Types.ObjectId(123); +var id2: mongoose.Types.ObjectId = mongoose.Types.ObjectId.createFromTime(123); +var id2: mongoose.Types.ObjectId = mongoose.Types.ObjectId.createFromHexString('foo'); var s = id.toHexString(); +var valid = id.isValid(); +var eq = id.equals(id2); + +var kitty1 = new Kitty({}); +var kitty2 = new Kitty({}); +var kittyEq = kitty1._id.equals(kitty2._id); \ No newline at end of file diff --git a/mongoose/mongoose.d.ts b/mongoose/mongoose.d.ts index fedd8fec6..29e167dcd 100644 --- a/mongoose/mongoose.d.ts +++ b/mongoose/mongoose.d.ts @@ -79,7 +79,13 @@ declare module "mongoose" { } export module Types { export class ObjectId { - toHexString(): string; + constructor(id: string|number); + toHexString(): string; + equals(other: ObjectId): boolean; + getTimestamp(): Date; + isValid(): boolean; + static createFromTime(time: number): ObjectId; + static createFromHexString(hexString: string): ObjectId; } } @@ -137,7 +143,7 @@ declare module "mongoose" { aggregate(aggregation1: Object, aggregation2: Object, aggregation3: Object, callback: (err: any, res: T[]) => void): Promise; count(conditions: Object, callback?: (err: any, count: number) => void): Query; - create(doc: Object, fn?: (err: any, res: T) => void): Promise; + create(doc: Object, fn?: (err: any, res: T) => void): Promise; create(doc1: Object, doc2: Object, fn?: (err: any, res1: T, res2: T) => void): Promise; create(doc1: Object, doc2: Object, doc3: Object, fn?: (err: any, res1: T, res2: T, res3: T) => void): Promise; discriminator(name: string, schema: Schema): Model; @@ -374,7 +380,7 @@ declare module "mongoose" { export interface Document { id?: string; - _id: string; + _id: Types.ObjectId; equals(doc: Document): boolean; get(path: string, type?: new(...args: any[]) => any): any; diff --git a/mpromise/mpromise-tests.ts b/mpromise/mpromise-tests.ts new file mode 100644 index 000000000..cb09df475 --- /dev/null +++ b/mpromise/mpromise-tests.ts @@ -0,0 +1,134 @@ +/// +/// + +var assert = require('assert'); +import Promise = require('mpromise'); + +function ex1() { + var promise = new Promise; +} + +function ex2() { + var promise = new Promise (function(reason: string, ...args: number[]) { + return; + }); +} + +function ex3() { + var promise = new Promise(); + promise.onResolve(function(reason: string, ...args: number[]) { + return; + }); +} + +function fulfill() { + var promise = new Promise(); + promise.fulfill(1, 2, 3); +} + +function reject() { + var promise = new Promise(); + promise.reject('reason'); +} + +function onFulfill1() { + var promise = new Promise(); + promise.onFulfill(function (...args: number[]) { + assert.equal(3, args[0] + args[1]); + }); + promise.fulfill(1, 2); +} + +function onFulfill2() { + var promise = new Promise(); + promise.fulfill(" :D "); + promise.onFulfill(function (arg: string) { + console.log(arg); // logs " :D " + }); +} + +function onReject1() { + var promise = new Promise(); + promise.onReject(function (reason: string) { + assert.equal('sad', reason); + }); + promise.reject('sad'); +} + +function onReject2() { + var promise = new Promise(); + promise.reject(" :( "); + promise.onReject(function (reason: string) { + console.log(reason); // logs " :( " + }); +} + +function onResolve1() { + var promise = new Promise(); + promise.onResolve(function (err: R, ...args: number[]) { + console.log(args[0] + args[1]); // logs 3 + }); + promise.fulfill(1, 2); +} + +function onResolve2() { + // rejection + var promise = new Promise(); + promise.onResolve(function (err: Error) { + if (err) { + console.log(err.message); // logs "failed" + } + }); + promise.reject(new Error('failed')); +} + +function then() { + var promise = new Promise(); + + promise.then(function (arg: number) { + return arg + 1; + }).then(function (arg: number) { + throw new Error(arg + ' is an error!'); + }).then(null, function (err: Error) { + assert.ok(err instanceof Error); + assert.equal('2 is an error', err.message); + }); + promise.fulfill(1); +} + +function end1() { + var promise = new Promise(); + promise.then(function(){ throw new Error('shucks') }); + setTimeout(function () { + promise.fulfill(); + // error was caught and swallowed by the promise returned from + // p.then(). we either have to always register handlers on + // the returned promises or we can do the following... + }, 10); +} + +function end2() { + // this time we use .end() which prevents catching thrown errors + var promise = new Promise(); + setTimeout(function () { + promise.fulfill(); // throws "shucks" + }, 10); + return promise.then(function(){ throw new Error('shucks') }).end(); // <-- +} + +function chain() { + function makeMeAPromise(i: number) { + var p = new Promise(); + p.fulfill(i); + return p; + } + + var initialPromise = new Promise(); + var returnPromise = initialPromise; + for (var i=0; i<10; ++i) { + returnPromise = returnPromise.chain(makeMeAPromise(i)); + } + + initialPromise.fulfill(); + return returnPromise; +} diff --git a/mpromise/mpromise.d.ts b/mpromise/mpromise.d.ts new file mode 100644 index 000000000..2a99964c2 --- /dev/null +++ b/mpromise/mpromise.d.ts @@ -0,0 +1,42 @@ +// Type definitions for mpromise 0.5.4 +// Project: https://github.com/aheckmann/mpromise +// Definitions by: Seulgi Kim +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module "mpromise" { + interface IFulfillFunction { + (...args: F[]): void; + (arg: F): void; + } + interface IRejectFunction { + (err: R): void; + } + interface IResolveFunction { + (err: R, ...args: F[]): void; + (err: R, arg: F): void; + } + + class Promise { + constructor(fn?: IResolveFunction); + + static FAILURE: string; + static SUCCESS: string; + + fulfill(...args: F[]): Promise; + fulfill(arg: F): Promise; + reject(reason: R): Promise; + resolve(reason: R, ...args: F[]): Promise; + resolve(reason: R, arg: F): Promise; + + onFulfill(callback: IFulfillFunction): Promise; + onReject(callback: IRejectFunction): Promise; + onResolve(callback: IResolveFunction): Promise; + + then(onFulfilled: IFulfillFunction, onRejected?: IRejectFunction): Promise; + end(): void; + + chain(promise: Promise): Promise; + } + + export = Promise; +} diff --git a/multiplexjs/multiplexjs-tests.ts b/multiplexjs/multiplexjs-tests.ts new file mode 100644 index 000000000..2b9d7e9e9 --- /dev/null +++ b/multiplexjs/multiplexjs-tests.ts @@ -0,0 +1,2496 @@ +/// +/// + + +module MxTests { + + "use strict"; + + import Enumerator = mx.Enumerator; + import Enumerable = mx.Enumerable; + import Comparer = mx.Comparer; + import EqualityComparer = mx.EqualityComparer; + import Collection = mx.Collection; + import List = mx.List; + import ReadOnlyCollection = mx.ReadOnlyCollection; + import Dictionary = mx.Dictionary; + import SortedList = mx.SortedList; + import HashSet = mx.HashSet; + import LinkedList = mx.LinkedList; + import Queue = mx.Queue; + import Stack = mx.Stack; + import Lookup = mx.Lookup; + import RuntimeComparer = mx.RuntimeComparer; + + + var Enumerator = mx.Enumerator, + Enumerable = mx.Enumerable, + Comparer = mx.Comparer, + EqualityComparer = mx.EqualityComparer, + Collection = mx.Collection, + List = mx.List, + ReadOnlyCollection = mx.ReadOnlyCollection, + KeyValuePair = mx.KeyValuePair, + Dictionary = mx.Dictionary, + SortedList = mx.SortedList, + HashSet = mx.HashSet, + LinkedList = mx.LinkedList, + LinkedListNode = mx.LinkedListNode, + Queue = mx.Queue, + Stack = mx.Stack; + + + + + + + /* Classes + ---------------------------------------------------------------------- */ + + interface SimpleObject { + name: string; + value: number; + } + + // class without equality-comparer + class SimpleClass { + }; + + + // class overriding '__hash__' and '__equals__' methods. + class SimpleClassWithComparer implements RuntimeComparer, SimpleObject { + + constructor(val: number) { + this.value = val; + this.name = val.toString(); + } + + public name: string; + public value: number; + + __hash__(): number { + return mx.hash(this.value, this.name); + } + + __equals__(obj: any) { + return obj instanceof SimpleClassWithComparer && obj.value === this.value && obj.name === this.name; + } + }; + + + + + + + /* Tests + ---------------------------------------------------------------------- */ + + module MultiplexTests { + + QUnit.module("Multiplex"); + + + QUnit.test("Multiplex Array", function (assert) { + + var _source = mx([1, 2, 3, 4]); + assert.ok(MxCount(_source) === 4, "Passed!"); + }); + + + QUnit.test("Multiplex String", function (assert) { + var _source = mx("Multiplex"); + assert.ok(MxCount(_source) === 9, "Passed!"); + }); + + + QUnit.test("Multiplex Object", function (assert) { + var _source = mx({ name: "mx", id: 1 }); + assert.ok(MxCount(_source) === 2, "Passed!"); + }); + + + QUnit.test("Multiplex Array-like", function (assert) { + var _source = mx(arguments); + assert.ok(MxCount(_source) === 1, "Passed!"); + }); + + + //QUnit.test("Multiplex Iterable", function (assert) { + // var _set = new Set(), + // _source = mx(_set); + + // _set.add(1); + // _set.add(2); + // _set.add(3); + // assert.ok(MxCount(_source) === 3, "Passed!"); + //}); + + + QUnit.test("Multiplex Custom Enumerator", function (assert) { + var _source = mx(>{ + getEnumerator: function (): Enumerator { + var count = 3, index = 0; + return { + current: undefined, + next: function () { + if (index++ < count) { + this.current = index; + return true; + } + else { + this.current = undefined; + return false; + } + } + }; + } + }); + assert.ok(MxCount(_source) === 3, "Passed!"); + }); + + + QUnit.test("Multiplex Generator", function (assert) { + try { + var _source = eval("mx(function* () { yield 1; yield 2; yield 3; })"); + assert.ok(MxCount(_source) === 3, "Passed!"); + } + catch (e) { assert.ok(true, "Generator not implemented by the browser"); } + }); + + + QUnit.test("Multiplex Legacy Generator", function (assert) { + var _source = mx(function () { + var count = 3, + index = 0; + + return new Enumerator(function (yielder) { + if (index++ < count) { + yielder(index); + } + }); + }); + assert.ok(MxCount(_source) === 3, "Passed!"); + }); + + + QUnit.test("mx.range", function (assert) { + var _source = mx.range(0, 4); + assert.deepEqual(_source.toArray(), [0, 1, 2, 3], "Passed!"); + }); + + + QUnit.test("mx.repeat", function (assert) { + var _source = mx.repeat(1, 4); + assert.deepEqual(_source.toArray(), [1, 1, 1, 1], "Passed!"); + }); + + + QUnit.test("mx.empty", function (assert) { + var _source = mx.empty(); + assert.ok(MxCount(_source) === 0, "Passed!"); + }); + + + QUnit.test("mx.is", function (assert) { + assert.ok(mx.is(mx.range(1, 10)), "Enumerable Passed!"); + assert.ok(mx.is([1]), "Array Passed!"); + assert.ok(mx.is("mx"), "String Passed!"); + //assert.ok(mx.is(new Set()), "Iterable Passed!"); + + assert.ok(mx.is({ + getEnumerator: function (): Enumerator { + var count = 3, index = 0; + return { + current: undefined, + next: function () { + if (index++ < count) { + this.current = index; + return true; + } + else { + this.current = undefined; + return false; + } + } + }; + } + }), "Custom Enumerator Passed!"); + + try { + assert.ok(mx.is(eval("mx(function* () { yield 1; yield 2; yield 3; })")), "Generator Passed!"); + } + catch (e) { assert.ok(true, "Generator not implemented by the browser"); } + }); + + + + /* Factory methods + ---------------------------------------------------------------------- */ + + function MxCount(source: Enumerable): number { + var _e = source.getEnumerator(), + _i = 0; + + while (_e.next()) { + _i++; + } + + return _i; + } + } + + + module RuntimeTests { + + QUnit.module("Runtime"); + + + QUnit.test("hash", function (assert) { + + assert.ok(mx.hash(null) === 0, "hash null!"); + assert.ok(mx.hash(undefined) === 0, "hash undefined!"); + assert.ok(mx.hash(10) === mx.hash(10), "hash integer number!"); + assert.ok(mx.hash(10.5) === mx.hash(10.5), "hash float number!"); + assert.ok(mx.hash("string") === mx.hash("string"), "hash string!"); + assert.ok(mx.hash(true) === mx.hash(true), "hash boolean!"); + assert.ok(mx.hash(new Date(2015, 0, 1)) === mx.hash(new Date(2015, 0, 1)), "hash date!"); + assert.ok(mx.hash({ name: "A" }) === mx.hash({ name: "A" }), "hash object literal!"); + assert.ok(mx.hash(new SimpleClass()) !== mx.hash(new SimpleClass()), "hash class instance!"); + assert.ok(mx.hash(new SimpleClassWithComparer(10)) === mx.hash(new SimpleClassWithComparer(10)), "hash class instance overriding __hash__ method!"); + assert.ok(mx.hash(10, 10.5, "string", new Date(2015, 0, 1)) === mx.hash(10, 10.5, "string", new Date(2015, 0, 1)), "combine hash codes!"); + }); + + + QUnit.test("equals", function (assert) { + + assert.ok(mx.equals(null, null) === true, "equals null!"); + assert.ok(mx.equals(undefined, undefined) === true, "equals undefined!"); + assert.ok(mx.equals(10, 10), "equals integer number!"); + assert.ok(mx.equals(10.5, 10.5), "equals float number!"); + assert.ok(mx.equals("string", "string"), "equals string!"); + assert.ok(mx.equals(true, true), "equals boolean!"); + assert.ok(mx.equals(new Date(2015, 0, 1), new Date(2015, 0, 1)), "equals date!"); + assert.ok(mx.equals({ name: "A" }, { name: "A" }), "equals object literal!"); + assert.ok(mx.equals(new SimpleClass(), new SimpleClass()) === false, "equals class instance!"); + assert.ok(mx.equals(new SimpleClass(), new SimpleClass(), EqualityComparer.create((obj) => 0, (a, b) => true)), "equals class instance using comparer!"); + assert.ok(mx.equals(new SimpleClassWithComparer(10), new SimpleClassWithComparer(10)), "equals class instance overriding __equals__ method!"); + }); + + + QUnit.test("compare", function (assert) { + + assert.ok(mx.compare(1, null) === 1 && mx.compare(null, 1) === -1 && mx.compare(null, null) === 0, "compare null!"); + assert.ok(mx.compare(1, 0) === 1 && mx.compare(0, 1) === -1 && mx.compare(1, 1) === 0, "compare numbers!"); + assert.ok(mx.compare("B", "A") === 1 && mx.compare("A", "B") === -1 && mx.compare("A", "A") === 0, "compare string!"); + assert.ok(mx.compare(true, false) === 1 && mx.compare(false, true) === -1 && mx.compare(true, true) === 0, "compare bolean!"); + assert.ok(mx.compare(new Date(2015, 0, 2), new Date(2015, 0, 1)) === 1 && mx.compare(new Date(2015, 0, 1), new Date(2015, 0, 2)) === -1 && mx.compare(new Date(2015, 0, 1), new Date(2015, 0, 1)) === 0, "compare date!"); + assert.ok(mx.compare({ name: "A" }, { name: "B" }) === 0, "compare objects!"); + }); + + + QUnit.test("lambda", function (assert) { + + var _f1 = mx.runtime.lambda("t => t * t"), + _f2 = mx.runtime.lambda("(t, u) => t + u"), + _f3 = mx.runtime.lambda("(t, u, r) => t + u + r"), + _f4 = mx.runtime.lambda("(t, u) => {id:t, name:u}"); + + assert.ok(_f1(2) === 4, "square root lambda!"); + assert.ok(_f2(1, 2) === 3, "sum of 2 numbers lambda!"); + assert.ok(_f3(1, 2, 3) === 6, "sum of 3 numbers lambda!"); + assert.ok(_f4(1, "A").id === 1 && _f4(1, "A").name === "A", "object literal lambda!"); + }); + } + + + module LinqTests { + + QUnit.module("Linq"); + + + QUnit.test("aggregate", function (assert) { + + var _arr = CreateNumberArray(); + + assert.ok(mx(_arr).aggregate((a, b) => a + b) === 45, "Aggregate 10 numbers without seed!"); + assert.ok(mx(_arr).aggregate(10, (a, b) => a + b) === 55, "Aggregate 10 numbers with seed!"); + assert.ok(mx(_arr).aggregate(10, (a, b) => a + b, t => t * 2) === 110, "Aggregate 10 numbers with seed and result selector!"); + }); + + + QUnit.test("all", function (assert) { + + var _arr = CreateNumberArray(); + + assert.ok(mx(_arr).all(t => t < 100) === true, "First 10 numbers less than 100!"); + assert.ok(mx(_arr).all(t => t < 5) === false, "First 10 numbers less than 5!"); + }); + + + QUnit.test("any", function (assert) { + + var _arr = CreateNumberArray(); + + assert.ok(mx(_arr).any() === true, "First 10 numbers!"); + assert.ok(mx(_arr).any(t => t % 2 === 0) === true, "Any of the first 10 numbers is even!"); + assert.ok(mx(_arr).any(t => t > 10) === false, "Any of the first 10 numbers greater than 10!"); + }); + + + QUnit.test("average", function (assert) { + + assert.ok(mx(CreateNumberArray()).average() === 4.5, "Average of the first 10 numbers!"); + assert.throws(() => mx(CreateObjectLiteralArray()).average(), "throws an exception for average of non numeric values!"); + assert.throws(() => mx([]).average(), "throws an exception for average of empty collection!"); + }); + + + QUnit.test("concat", function (assert) { + var _s1 = [1, 2, 3], + _s2 = [3, 4], + _arr = CreateNumberArray(); + + assert.deepEqual(mx(_s1).concat(_s2).toArray(), [1, 2, 3, 3, 4], "Concat two array!"); + assert.ok(mx(_arr).concat(_arr).count() === 20, "Concat the first 10 numbers to itself!"); + }); + + + QUnit.test("contains", function (assert) { + + var _arr1 = CreateNumberArray(), + _arr2 = CreateSimpleClassArray(), + _arr3 = CreateSimpleClassWithComparerArray(), + _arr4 = CreateComplexObjectLiteralArray(); + + assert.ok(mx(_arr1).contains(1) === true, "1 contains in the first 10 numbers!"); + assert.ok(mx(_arr1).contains(10) === false, "10 does not contains in the first 10 numbers!"); + + assert.ok(mx(_arr2).contains(new SimpleClass()) === false, "Class instance without equality-comparer!"); + assert.ok(mx(_arr2).contains(new SimpleClass(), { hash: () => 0, equals: () => true }) === true, "Class instance with equality-comparer!"); + + assert.ok(mx(_arr3).contains(new SimpleClassWithComparer(5)) === true, "Class instance overriding equality-comparer!"); + + assert.ok(mx(_arr4).contains({ name: "n5", inner: { index: 5, val: {} } }) === true, "Object literal without equality-comparer!"); + assert.ok(mx(_arr4).contains({ name: "n5", inner: null }, { + hash: o => mx.hash(o.name), + equals: (a, b) => a.name === b.name + }) === true, "Object literal with equality-comparer!"); + }); + + + QUnit.test("count", function (assert) { + + var _arr = CreateNumberArray(); + + assert.ok(mx(_arr).count() === 10, "Count of the first 10 numbers!"); + assert.ok(mx(_arr).count(t => t % 2 === 0) === 5, "Count of the first even 10 numbers!"); + }); + + + QUnit.test("defaultIfEmpty", function (assert) { + + var _arr = CreateNumberArray(); + + assert.deepEqual(mx([]).defaultIfEmpty(1).toArray(), [1], "Empty array devalut value!"); + assert.ok(mx(_arr).defaultIfEmpty(1).count() === 10, "Count of the first 10 numbers with defaultIfEmpty!"); + assert.ok(mx(_arr).where(t => t > 100).defaultIfEmpty(10).count() === 1, "Count of the first 10 numbers greater than 100 with defaultIfEmpty!"); + }); + + + QUnit.test("distinct", function (assert) { + + var _arr1 = CreateObjectLiteralArray(), + _arr2 = CreateComplexObjectLiteralArray(), + _arr3 = CreateNumberArray(), + _arr4 = CreateFloatNumberArray(), + _arr5 = CreateStringArray(), + _arr6 = CreateDateArray(), + _arr7 = CreateBooleanArray(), + _arr8 = CreateSimpleClassWithComparerArray(), + _arr9 = CreateSimpleClassArray(); + + assert.ok(mx(_arr1).distinct().count() === 1, "Array of 10 empty object literal!"); + assert.ok(mx(_arr2).distinct().count() === 10, "Array of 10 distinct complex object literal!"); + assert.ok(mx(_arr3).distinct().count() === 10, "Array of 10 distinct numbers!"); + assert.ok(mx(_arr4).distinct().count() === 10, "Array of 10 distinct float numbers!"); + assert.ok(mx(_arr5).distinct().count() === 10, "Array of 10 distinct strings!"); + assert.ok(mx(_arr6).distinct().count() === 10, "Array of 10 distinct date objects!"); + assert.ok(mx(_arr7).distinct().count() === 2, "Array of 10 boolean values!"); + assert.ok(mx(_arr8).distinct().count() === 10, "Array of 10 distinct class instances overriding equality-comparer!"); + assert.ok(mx(_arr9).distinct().count() === 10, "Array of 10 distinct class instances!"); + assert.ok(mx(_arr2).distinct({ + hash: o => mx.hash(o.name), + equals: (a, b) => a.name === b.name + }).count() === 10, "Array of 10 distinct complex object literal with equality-comparer!"); + }); + + + QUnit.test("except", function (assert) { + + var _arr1 = CreateNumberArray(), + _arr2 = CreateObjectLiteralArray(), + _arr3 = CreateComplexObjectLiteralArray(); + + assert.ok(mx(_arr1).except(CreateNumberArray()).count() === 0, "Array of first 10 numbers except first 10 numbers!"); + assert.deepEqual(mx(_arr1).except([0, 1, 2, 3, 4]).toArray(), [5, 6, 7, 8, 9], "Array of first 10 numbers except first 5 numbers!"); + assert.ok(mx(_arr2).except([{}]).count() === 0, "Array of 10 empty object literal except an empty object literal!"); + assert.ok(mx(_arr3).except([{ name: "n5", inner: null }]).count() === 10, "Array of 10 distinct complex object literal without equality-comparer!"); + assert.ok(mx(_arr3).except([{ name: "n5", inner: null }], { + hash: o => mx.hash(o.name), + equals: (a, b) => a.name === b.name + }).count() === 9, "Array of 10 distinct complex object literal with equality-comparer!"); + }); + + + QUnit.test("elementAt", function (assert) { + + var _arr = CreateNumberArray(); + + assert.ok(mx(_arr).elementAt(0) === 0, "First element of the first 10 numbers!"); + assert.throws(() => mx(_arr).elementAt(100), "throws an exception for 100th element of the first 10 numbers!"); + }); + + + QUnit.test("first", function (assert) { + + var _arr = CreateNumberArray(); + + assert.ok(mx(_arr).first() === 0, "First element of the first 10 numbers!"); + assert.ok(mx(_arr).first(t => t > 5) === 6, "First element greater than 5 of the first 10 numbers!"); + assert.throws(() => mx([]).first(), "throws an exception getting first element of an empty collection!"); + assert.throws(() => mx(_arr).first(t => t > 100), "throws an exception getting first element greater than 100 of the first 10 numbers!"); + }); + + + QUnit.test("firstOrDefault", function (assert) { + + var _arr = CreateNumberArray(); + + assert.ok(mx(_arr).firstOrDefault() === 0, "First element of the first 10 numbers or default!"); + assert.ok(mx(_arr).firstOrDefault(t => t > 5) === 6, "First element greater than 5 of the first 10 numbers or default!"); + assert.ok(mx(_arr).firstOrDefault(t => t > 100) === null, "First element greater than 100 of the first 10 numbers or default!"); + assert.ok(mx(_arr).firstOrDefault(t => t > 100, 100) === 100, "First element greater than 100 of the first 10 numbers or 100 as default!"); + }); + + + QUnit.test("forEach", function (assert) { + + var _arr = CreateNumberArray(), + _sum = 0; + + mx(_arr).forEach(t => _sum += t); + assert.ok(_sum === 45, "ForEach operation on the first 10 numbers!"); + }); + + + QUnit.test("groupBy", function (assert) { + + var _arr1 = CreateObjectLiteralArray(), + _arr2 = CreateComplexObjectLiteralArray(); + + assert.ok(mx(_arr1).groupBy(t => t).count() === 1, "Group 10 distinct empty object literals!"); + assert.ok(mx(_arr2).groupBy(t => t.name).count() === 10, "Group 10 distinct complex object literals by name!"); + assert.ok(mx(_arr2).groupBy(t => t.name).first().key === "n0", "Group 10 distinct complex object literals by name, retrieve first key!"); + assert.ok(mx(_arr2).groupBy(t => t.name).first().count() === 1, "Group 10 distinct complex object literals by name, retrieve first group count!"); + }); + + + QUnit.test("groupJoin", function (assert) { + + var _arr1 = [{ name: "A", val: 1 }, { name: "B", val: 2 }, { name: "C", val: 3 }, { name: "D", val: 4 }], + _arr2 = [{ code: "A" }, { code: "A" }, { code: "B" }, { code: "B" }, { code: "C" }], + _result = mx(_arr1).groupJoin(_arr2, t => t.name, u => u.code, (t, u) => ({ item: t, group: u })); + + assert.ok(_result.count() === 4, "groupJoin 2 complex-object array, getting count"); + assert.ok(_result.first().item.name === "A", "groupJoin 2 complex-object array, getting item"); + assert.ok(_result.first().group.count() === 2, "groupJoin 2 complex-object array, getting group count"); + assert.ok(_result.last().group.count() === 0, "groupJoin 2 complex-object array, getting empty group count"); + }); + + + QUnit.test("intersect", function (assert) { + + var _arr1 = CreateNumberArray(), + _arr2 = CreateObjectLiteralArray(), + _arr3 = CreateComplexObjectLiteralArray(); + + assert.ok(mx(_arr1).intersect(CreateNumberArray()).count() === 10, "Array of first 10 numbers intersect with first 10 numbers!"); + assert.deepEqual(mx(_arr1).intersect([2, 3, 4]).toArray(), [2, 3, 4], "Array of first 10 numbers intersect with 3 numbers!"); + assert.ok(mx(_arr2).intersect([{}]).count() === 10, "Array of 10 empty object literal intersect with an empty object literal!"); + assert.ok(mx(_arr3).intersect([{ name: "n5", inner: null }]).count() === 0, "Array of 10 distinct complex object literal without equality-comparer!"); + assert.ok(mx(_arr3).intersect([{ name: "n5", inner: null }], { + hash: o => mx.hash(o.name), + equals: (a, b) => a.name === b.name + }).count() === 1, "Array of 10 distinct complex object literal with equality-comparer!"); + }); + + + QUnit.test("join", function (assert) { + var _arr1 = [{ name: "A", val: 1 }, { name: "B", val: 2 }, { name: "C", val: 3 }, { name: "D", val: 4 }], + _arr2 = [{ code: "A" }, { code: "A" }, { code: "B" }, { code: "B" }, { code: "C" }], + _arr3 = CreateObjectLiteralArray(), + _result = mx(_arr1).join(_arr2, t => t.name, u => u.code, (t, u) => ({ item1: t, item2: u })); + + assert.ok(_result.count() === 5, "join 2 complex-object array, getting count"); + assert.ok(_result.first().item1.name === "A" && _result.first().item2.code === "A", "join 2 complex-object array, getting item"); + assert.ok(mx(_arr3).join(mx(CreateObjectLiteralArray()), t => t, u => u, (t, u) => t).count() === 100, "join 2 empty object-literal array"); + assert.ok(mx(mx.empty()).join(mx(_arr3), t => t, u => u, (t, u) => t).count() === 0, "join empty collection with an array"); + }); + + + QUnit.test("last", function (assert) { + + var _arr = CreateNumberArray(); + + assert.ok(mx(_arr).last() === 9, "Last element of the first 10 numbers!"); + assert.ok(mx(_arr).last(t => t < 5) === 4, "Last element less than 5 of the first 10 numbers!"); + assert.throws(() => mx([]).last(), "throws an exception getting last element of an empty collection!"); + assert.throws(() => mx(_arr).last(t => t > 100), "throws an exception getting first element greater than 100 of the first 10 numbers!"); + }); + + + QUnit.test("lastOrDefault", function (assert) { + + var _arr = CreateNumberArray(); + + assert.ok(mx(_arr).lastOrDefault() === 9, "Last element of the first 10 numbers or default!"); + assert.ok(mx(_arr).lastOrDefault(t => t < 5) === 4, "Last element greater than 5 of the first 10 numbers or default!"); + assert.ok(mx(_arr).lastOrDefault(t => t > 100) === null, "Last element greater than 100 of the first 10 numbers or default!"); + assert.ok(mx(_arr).lastOrDefault(t => t > 100, 100) === 100, "Last element greater than 100 of the first 10 numbers or 100 as default!"); + }); + + + QUnit.test("max", function (assert) { + + var _arr1 = CreateNumberArray(), + _arr2 = CreateStringArray(), + _arr3 = CreateComplexObjectLiteralArray(); + + assert.ok(mx(_arr1).max() === 9, "Maximum of the first 10 numbers!"); + assert.ok(mx(_arr2).max() === "9_string", "Maximum of the 10 string array!"); + assert.ok(mx(_arr3).max(t => t.name) === "n9", "Maximum of a complex array by selector!"); + assert.throws(() => mx([]).max(), "throws an exception getting maximum of an empty collection!"); + }); + + + QUnit.test("min", function (assert) { + + var _arr1 = CreateNumberArray(), + _arr2 = CreateStringArray(), + _arr3 = CreateComplexObjectLiteralArray(); + + assert.ok(mx(_arr1).min() === 0, "Minimum of the first 10 numbers!"); + assert.ok(mx(_arr2).min() === "0_string", "Minimum of the 10 string array!"); + assert.ok(mx(_arr3).min(t => t.name) === "n0", "Minimum of a complex array by selector!"); + assert.throws(() => mx([]).min(), "throws an exception getting minimum of an empty collection!"); + }); + + + QUnit.test("ofType", function (assert) { + + var _arr = CreateNumberArray(); + + assert.ok(mx(_arr).ofType(Number).count() === 10, "Cast array of numbers to number!"); + assert.ok(mx(_arr).ofType(String).count() === 0, "Cast array of numbers to string!"); + }); + + + QUnit.test("orderBy", function (assert) { + + var _arr1 = CreateNumberArray(), + _arr2 = CreateComplexObjectLiteralArray(), + _arr3 = [{ name: "a", val: 1 }, { name: "a", val: 2 }, { name: "b", val: 1 }, { name: "c", val: 2 }], + _result = [{ name: "a", val: 1 }, { name: "b", val: 1 }, { name: "a", val: 2 }, { name: "c", val: 2 }] + + assert.deepEqual(mx(_arr1).orderBy(t => t).take(5).toArray(), [0, 1, 2, 3, 4], "Order array of numbers ascending!"); + assert.ok(mx(_arr2).orderBy(t => t.name).thenByDescending(t => t.inner.index).first().name === "n0", "Order array of complex object by 'name' ascending then by 'inner.index' descending !"); + assert.deepEqual(mx(_arr3).orderBy(t => t.val).thenBy(t => t.name).toArray(), _result, "Order and thenBy!"); + assert.ok(mx(_arr2).orderBy(t => t.name, { + hash: o => mx.hash(o), + equals: (a, b) => a === b + }).first().name === "n0", "Order array of complex object ascending with comparer!"); + }); + + + QUnit.test("orderByDescending", function (assert) { + + var _arr1 = CreateNumberArray(), + _arr2 = CreateComplexObjectLiteralArray(), + _arr3 = [{ name: "a", val: 1 }, { name: "a", val: 2 }, { name: "b", val: 1 }, { name: "c", val: 2 }], + _result = [{ name: "a", val: 2 }, { name: "c", val: 2 }, { name: "a", val: 1 }, { name: "b", val: 1 }]; + + assert.deepEqual(mx(_arr1).orderByDescending(t => t).take(5).toArray(), [9, 8, 7, 6, 5], "Order array of numbers descending!"); + assert.ok(mx(_arr2).orderByDescending(t => t.name).thenByDescending(t => t.inner.index).first().name === "n9", "Order array of complex object by 'name' descending then by 'inner.index' descending !"); + assert.deepEqual(mx(_arr3).orderByDescending(t => t.val).thenBy(t => t.name).toArray(), _result, "Order descending and thenBy!"); + assert.ok(mx(_arr2).orderByDescending(t => t.name, { + hash: o => mx.hash(o), + equals: (a, b) => a === b + }).first().name === "n9", "Order array of complex object descending with comparer!"); + }); + + + QUnit.test("reverse", function (assert) { + + var _arr1 = CreateNumberArray(), + _arr2 = CreateStringArray(); + + assert.deepEqual(mx(_arr1).reverse().take(5).toArray(), [9, 8, 7, 6, 5], "Reverse array of first 10 numbers!"); + assert.ok(mx(_arr2).reverse().first() === "9_string", "Reverse array of strings!"); + }); + + + QUnit.test("sequenceEqual", function (assert) { + + var _arr = CreateNumberArray(); + + assert.ok(mx(_arr).sequenceEqual(mx(CreateNumberArray())), "sequenceEqual on array of numbers!"); + assert.ok(mx([1, 2, 3]).sequenceEqual(mx([1, 2])) === false, "sequenceEqual on inharmonic arrays of numbers!"); + assert.ok(mx([{ name: "a" }]).sequenceEqual(mx([{ name: "a", val: 1 }]), { + hash: o => mx.hash(o.name), + equals: (a, b) => a.name === b.name + }), "sequenceEqual on arrays of objects with comparer!"); + }); + + + QUnit.test("select", function (assert) { + + var _arr = CreateNumberArray(); + + assert.ok(mx(_arr).select(t => t + 100).first() === 100, "select first 10 numbers plus 100!"); + assert.ok(mx(_arr).select((t, i) => i).last() === 9, "select index while enumerating 10 numbers!"); + }); + + + QUnit.test("selectMany", function (assert) { + + var _arr = [{ name: "A", values: [1, 2, 3, 4] }, { name: "B", values: [5, 6, 7, 8] }]; + + assert.ok(mx(_arr).selectMany(t => t.values).count() === 8, "selectMany on complex objects!"); + assert.deepEqual(mx(_arr).selectMany(t => t.values, (t, u) => ({ name: t.name, value: u })).first(), { name: "A", value: 1 }, "selectMany on complex objects with result selector!"); + }); + + + QUnit.test("single", function (assert) { + + var _arr = CreateNumberArray(); + + assert.ok(mx([1]).single() === 1, "Single element of a single array!"); + assert.ok(mx(_arr).single(t => t === 1) === 1, "Single element equal to 1 of the first 10 numbers!"); + assert.throws(() => mx([]).single(), "throws an exception getting single element of an empty collection!"); + assert.throws(() => mx(_arr).single(), "throws an exception getting single element of an collection containing more than one element!"); + assert.throws(() => mx(_arr).single(t => t > 100), "throws an exception getting single element greater than 100 of the first 10 numbers!"); + assert.throws(() => mx(_arr).single(t => t < 10), "throws an exception getting single element less than 10 of the first 10 numbers!"); + }); + + + QUnit.test("singleOrDefault", function (assert) { + + var _arr = CreateNumberArray(); + + assert.ok(mx([1]).singleOrDefault() === 1, "Single element of a single array or default!"); + assert.ok(mx([]).singleOrDefault() === null, "Single element of an empty array or default!"); + assert.ok(mx(_arr).singleOrDefault(t => t === 1) === 1, "Single element equal to 1 of the first 10 numbers or default!"); + assert.ok(mx(_arr).singleOrDefault(t => t === 100, 100) === 100, "Single element of an empty array or default!"); + assert.throws(() => mx(_arr).singleOrDefault(), "throws an exception getting single element of an collection containing more than one element!"); + assert.throws(() => mx(_arr).singleOrDefault(t => t < 10), "throws an exception getting single element less than 10 of the first 10 numbers!"); + }); + + + QUnit.test("skip", function (assert) { + + var _arr = CreateNumberArray(); + + assert.deepEqual(mx(_arr).skip(5).toArray(), [5, 6, 7, 8, 9], "Skip 5 element of a the first 10 numbers!"); + assert.deepEqual(mx(_arr).where(t => t % 2 === 0).skip(3).toArray(), [6, 8], "Skip 3 element of a the first 10 even numbers!"); + assert.ok(mx(_arr).skip(0).count() === 10, "Skip no items!"); + assert.ok(mx(_arr).skip(100).count() === 0, "Skip more than count of the collection!"); + }); + + + QUnit.test("skipWhile", function (assert) { + + var _arr = CreateNumberArray(); + + assert.deepEqual(mx(_arr).skipWhile(t => t < 5).toArray(), [5, 6, 7, 8, 9], "Skip while elements are less than 5 from the first 10 even numbers!"); + assert.ok(mx(_arr).skipWhile(t => t > 5).count() === 10, "Skip while elements are greater than 5 from the first 10 even numbers!"); + }); + + + QUnit.test("sum", function (assert) { + + var _arr = CreateNumberArray(); + + assert.ok(mx(_arr).sum() === 45, "Sum of the first 10 numbers!"); + assert.ok(mx(_arr).sum(t => t * 2) === 90, "Sum of the first 10 numbers multiply by 2!"); + assert.throws(() => mx(CreateObjectLiteralArray()).sum(), "throws an exception getting sum of non numeric elements!"); + assert.throws(() => mx(CreateComplexObjectLiteralArray()).sum(t => t.name), "throws an exception getting sum of non numeric properties!"); + }); + + + QUnit.test("take", function (assert) { + + var _arr = CreateNumberArray(); + + assert.deepEqual(mx(_arr).take(5).toArray(), [0, 1, 2, 3, 4], "Take 5 element of a the first 10 numbers!"); + assert.deepEqual(mx(_arr).where(t => t % 2 === 0).take(3).toArray(), [0, 2, 4], "Take 3 element of a the first 10 even numbers!"); + assert.ok(mx(_arr).take(0).count() === 0, "Take no items!"); + assert.ok(mx(_arr).take(100).count() === 10, "Take more than count of the collection!"); + }); + + + QUnit.test("takeWhile", function (assert) { + + var _arr = CreateNumberArray(); + + assert.deepEqual(mx(_arr).takeWhile(t => t < 5).toArray(), [0, 1, 2, 3, 4], "Take while elements are less than 5 from the first 10 even numbers!"); + assert.ok(mx(_arr).takeWhile(t => t > 5).count() === 0, "Take while elements are greater than 5 from the first 10 even numbers!"); + }); + + + QUnit.test("toArray", function (assert) { + + var _arr = CreateNumberArray(); + + assert.deepEqual(mx(_arr).where(t => t < 5).toArray(), [0, 1, 2, 3, 4], "Elements less than 5 from the first 10 even numbers!"); + }); + + + QUnit.test("toDictionary", function (assert) { + + var _arr = CreateComplexObjectLiteralArray(); + + assert.ok(mx(_arr).toDictionary(t => t.name).count() === 10, "toDictionary key-selector!"); + assert.ok(mx(_arr).toDictionary(t => t.name, t => t.inner.index).first().value === 0, "toDictionary key-selector & element-selector!"); + assert.ok(mx(_arr).toDictionary(t => t, { + hash: o => mx.hash(o.name), + equals: (a, b) => a.name === b.name + }).first().key.name === "n0", "toDictionary key-selector & comparer!"); + + assert.ok(mx(_arr).toDictionary(t => t, t => t.inner.index, { + hash: o => mx.hash(o.name), + equals: (a, b) => a.name === b.name + }).first().value === 0, "toDictionary key-selector, element-selector & comparer!"); + + assert.throws(() => mx([1, 1, 2]).toDictionary(t => t), "throws an exception with duplicate keys!"); + }); + + + QUnit.test("toList", function (assert) { + + var _arr = CreateNumberArray(); + + assert.ok(mx(_arr).toList().count() === 10, "toList first 10 numbers!"); + assert.ok(mx(_arr).toList()[1] === 1, "toList indexer first 10 numbers!"); + }); + + + QUnit.test("toLookup", function (assert) { + + var _arr1 = CreateNumberArray(), + _arr2 = CreateComplexObjectLiteralArray(); + + assert.ok(mx(_arr1).toLookup(t => t).count() === 10, "toLookup first 10 numbers!"); + assert.ok(mx(_arr1).toLookup(t => t).get(1).count() === 1, "toLookup indexer first 10 numbers!"); + + assert.ok(mx(_arr2).toLookup(t => t, { + hash: o => mx.hash(o.name), + equals: (a, b) => a.name === b.name + }).first().first().name === "n0", "toLookup with key-selector and comparer!"); + + assert.ok(mx(_arr2).toLookup(t => t, t => t.name, { + hash: (o) => mx.hash(o.name), + equals: (a, b) => a.name === b.name + }).first().first() === "n0", "toLookup with key-selector, element-selector and comparer!"); + }); + + + QUnit.test("union", function (assert) { + + var _arr = CreateNumberArray(); + + assert.ok(mx(_arr).union(CreateNumberArray()).count() === 10, "Union first 10 numbers with itself!"); + assert.deepEqual(mx([1, 2]).union(mx([2, 3])).toArray(), [1, 2, 3], "Union two arrays!"); + }); + + + QUnit.test("where", function (assert) { + + var _arr1 = CreateNumberArray(), + _arr2 = CreateComplexObjectLiteralArray(); + + assert.ok(mx(_arr1).where(t => t < 5).count() === 5, "Filter first 10 numbers less than 10!"); + assert.ok(mx(_arr2).where(t => t.inner.index < 5).count() === 5, "Filter complex object by value!"); + assert.deepEqual(mx(_arr1).where(t => t <= 1).toArray(), [0, 1], "Deep equal check!"); + }); + + + QUnit.test("zip", function (assert) { + + assert.ok(mx([1, 2]).zip([3, 4], (t, u) => t + u).first() === 4, "Zip two numeric array!"); + assert.ok(mx([1, 2]).zip([3], (t, u) => t + u).count() === 1, "Zip two inharmonic numeric array!"); + }); + + + + /* Factory methods + ---------------------------------------------------------------------- */ + + function CreateObjectLiteralArray(): Object[] { + return mx.range(0, 10).select(t => ({})).toArray(); + } + + function CreateComplexObjectLiteralArray(): { name: string; inner: { index: number; val: Object } }[] { + return mx.range(0, 10).select(t => ({ + name: "n" + t, + inner: { + index: t, + val: {} + } + })).toArray(); + } + + function CreateSimpleClassArray(): SimpleClass[] { + return mx.range(0, 10).select(t => new SimpleClass()).toArray(); + } + + function CreateSimpleClassWithComparerArray(): SimpleClassWithComparer[] { + return mx.range(0, 10).select(t => new SimpleClassWithComparer(t)).toArray(); + } + + function CreateNumberArray(): number[] { + return mx.range(0, 10).toArray(); + } + + function CreateFloatNumberArray(): number[] { + return mx.range(0, 10).select(t => t + 0.1).toArray(); + } + + function CreateStringArray(): string[] { + return mx.range(0, 10).select(t => t + "_string").toArray(); + } + + function CreateDateArray(): Date[] { + return mx.range(0, 10).select(t => new Date(new Date().getTime() + t)).toArray(); + } + + function CreateBooleanArray(): boolean[] { + return mx.range(0, 10).select(t => t % 2 === 0).toArray(); + } + } + + + module CollectionTests { + + QUnit.module("Collection"); + + + QUnit.test("constructor", function (assert) { + + assert.ok(CreateCollection().count() === 5, "initialize a Collection using specified collection!"); + }); + + + QUnit.test("count", function (assert) { + + var _col = CreateCollection(); + assert.ok(_col.count() === 5, "collection containing count!"); + assert.throws(() => new Collection().count(), "throws an error getting count of an empty collection."); + }); + + + QUnit.test("copyTo", function (assert) { + + var _col = CreateCollection(), + _arr = new Array(_col.count()); + + _col.copyTo(_arr, 0); + + assert.deepEqual(_arr, [1, 2, 3, 4, 5], "Collection copy to an array!"); + assert.throws(() => _col.copyTo([], 0), "throws an error when the number of elements is greater than the number of elements that the destination array can contain!"); + }); + + + QUnit.test("collection enumerable", function (assert) { + + var _col = CreateCollection(); + assert.deepEqual(_col.select(t => t * 2).where(t => t > 5).toArray(), [6, 8, 10], "select-where-toArray over a collection!"); + }); + + + + /* Factory methods + ---------------------------------------------------------------------- */ + + function CreateCollection(): Collection { + return new Collection(mx.range(1, 5)); + } + } + + + module ListTests { + + QUnit.module("List"); + + + QUnit.test("constructor", function (assert) { + assert.ok(new List().count() === 0, "an empty list!"); + assert.ok(new List(10).count() === 10, "an empty list with initial capacity!"); + assert.ok(new List(1, 2, 3, 4, 5).count() === 5, "list initializer!"); + assert.ok(new List(mx.range(0, 10)).count() === 10, "list from an Enumerable!"); + }); + + + QUnit.test("indexer", function (assert) { + + var _list = CreateList(); + + assert.ok(_list[0] === 1, "indexer get!"); + + _list[0] = 0; + assert.ok(_list[0] === 0 && _list.first() === 0, "indexer set!"); + }); + + + QUnit.test("add", function (assert) { + + var _list = new List(); + + _list.add(1); + assert.ok(_list[0] === 1, "add!"); + assert.ok(_list.count() === 1, "add count!"); + }); + + + QUnit.test("addRange", function (assert) { + + var _list = new List(); + + _list.addRange(mx.range(0, 10)); + assert.ok(_list.count() === 10, "add range of numbers!"); + }); + + + QUnit.test("asReadOnly", function (assert) { + + var _rlist = new List(mx.range(0, 10)).asReadOnly(); + + assert.ok(_rlist.count() === 10, "readOnlyCollection count!"); + assert.ok(_rlist[0] === 0, "readOnlyCollection get!"); + }); + + + QUnit.test("binarySearch", function (assert) { + + var _list1 = new List(mx.range(0, 100)), + _list2 = new List<{ index: number }>(mx.range(0, 100).select(t => ({ index: t }))); + + assert.ok(_list1.binarySearch(50) === 50, "binary-search to find an item!"); + assert.ok(_list1.binarySearch(100) < 0, "binary-search item not found!"); + + assert.ok(_list2.binarySearch({ index: 50 }, { compare: (a, b) => a.index - b.index }) === 50, "binary-search find an item with comparer!"); + assert.ok(_list2.binarySearch({ index: 80 }, 50, 40, { compare: (a, b) => a.index - b.index }) === 80, "binary-search find an item with index, count and comparer!"); + }); + + + QUnit.test("clear", function (assert) { + + var _list = CreateList(); + + _list.clear(); + assert.ok(_list.count() === 0, "Clear list!"); + }); + + + QUnit.test("contains", function (assert) { + + var _list = CreateList(); + + assert.ok(_list.contains(3) === true, "list contains!"); + assert.ok(_list.contains(6) === false, "list not containing!"); + }); + + + QUnit.test("copyTo", function (assert) { + + var _list = CreateList(), + _arr = new Array(_list.count()); + + _list.copyTo(_arr, 0); + + assert.deepEqual(_arr, [1, 2, 3, 4, 5], "list copyTo an array!"); + }); + + + QUnit.test("exists", function (assert) { + + var _list = CreateList(); + + assert.ok(_list.exists(t => t % 2 === 0), "an even number exists in a list of the first 5 number!"); + assert.ok(_list.exists(t => t > 5) === false, "6 exists in a list of the first 5 number!"); + }); + + + QUnit.test("find", function (assert) { + + var _list = CreateList(); + + assert.ok(_list.find(t => t % 2 === 0) === 2, "find an even number in a list of the first 5 number!"); + assert.ok(_list.find(t => t > 5) === null, "find a number greater than 5 in a list of the first 5 number!"); + }); + + + QUnit.test("findIndex", function (assert) { + + var _list = CreateList(); + + assert.ok(_list.findIndex(t => t % 2 === 0) === 1, "find index of an even numbers in a list of the first 5 number!"); + assert.ok(_list.findIndex(2, t => t % 2 === 0) === 3, "find index of an even numbers in a list of the first 5 number, starting from 2!"); + assert.ok(_list.findIndex(2, 1, t => t % 2 === 0) === -1, "find index of an even numbers in a list of the first 5 number, starting from 3, for 1 attempt!"); + }); + + + QUnit.test("findLast", function (assert) { + + var _list = CreateList(); + + assert.ok(_list.findLast(t => t % 2 === 0) === 4, "find last even number in a list of the first 5 number!"); + assert.ok(_list.findLast(t => t > 5) === null, "find last number greater than 5 in a list of the first 5 number!"); + }); + + + QUnit.test("findLastIndex", function (assert) { + + var _list = new List(0, 1, 2, 3, 4, 5, 6, 7, 8, 9); + + assert.ok(_list.findLastIndex(t => t % 2 === 0) === 8, "find last index of an even numbers in a list of the first 10 number!"); + assert.ok(_list.findLastIndex(5, t => t % 2 === 0) === 4, "find last index of an even numbers in a list of the first 10 number, starting from 5!"); + assert.ok(_list.findLastIndex(5, 1, t => t % 2 === 0) === -1, "find last index of an even numbers in a list of the first 10 number, starting from 5, for 1 attempt!"); + }); + + + QUnit.test("forEach", function (assert) { + + var _list = CreateList(), + _count = 0; + + _list.forEach(t => _count += t); + + assert.ok(_count === 15, "forEach to get sum of a the items in a list!"); + }); + + + QUnit.test("get", function (assert) { + + var _list = CreateList(); + + assert.ok(_list.get(1) === 2, "get item at index 1 from a list of 5 numbers!"); + assert.throws(() => _list.get(10), "throws an error when the number of elements is greater than the number of elements that the destination array can contain!"); + }); + + + QUnit.test("getRange", function (assert) { + + var _list = CreateList(); + + assert.deepEqual(_list.getRange(0, 3).toArray(), [1, 2, 3], "get range of first 3 items of a list of first 5 numbers!"); + assert.throws(() => _list.getRange(0, 10), "throws an error getting first 10 items from a list of 5 numbers!"); + }); + + + QUnit.test("indexOf", function (assert) { + + var _list = CreateList(); + + assert.ok(_list.indexOf(3) === 2, "get index of 3 in a list of first 5 numbers!"); + assert.ok(_list.indexOf(10) === -1, "get index of 10 in a list of first 5 numbers!"); + assert.ok(_list.indexOf(3, 4) === -1, "get index of 3 in a list of first 5 numbers, starting from index 4!"); + }); + + + QUnit.test("insert", function (assert) { + + var _list = CreateList(); + + _list.insert(3, 0); + + assert.ok(_list.count() === 6, "insert an item in a list of 5 numbers, get count!"); + assert.ok(_list[3] === 0, "insert an item in a list of 5 numbers, get item!"); + assert.throws(() => _list.insert(10, 0), "throws an error inserting in 10th index of a list of 5 numbers!"); + }); + + + QUnit.test("insertRange", function (assert) { + + var _list = CreateList(); + + _list.insertRange(3, mx.range(0, 3)); + + assert.ok(_list.count() === 8, "insert range of items in a list of 5 numbers, get count!"); + assert.ok(_list[3] === 0 && _list[4] === 1 && _list[5] === 2, "insert range of items in a list of 5 numbers, get items!"); + assert.throws(() => _list.insertRange(10, mx.range(0, 3)), "throws an error inserting range of items in 10th index of a list of 5 numbers!"); + }); + + + QUnit.test("lastIndexOf", function (assert) { + + var _list = CreateList(); + + assert.ok(_list.lastIndexOf(3) === 2, "get last index of 3 in a list of first 5 numbers!"); + assert.ok(_list.lastIndexOf(10) === -1, "get last index of 10 in a list of first 5 numbers!"); + assert.ok(_list.lastIndexOf(3, 1) === -1, "get last index of 3 in a list of first 5 numbers, starting from index 1!"); + }); + + + QUnit.test("remove", function (assert) { + + var _list = CreateList(); + + assert.ok(_list.remove(2) === true && _list.count() === 4, "remove an item from a list, get count!"); + assert.ok(_list.remove(10) === false && _list.count() === 4, "remove an item which does not exist in a list, get count!"); + }); + + + QUnit.test("removeAll", function (assert) { + + var _list = CreateList(); + + assert.ok(_list.removeAll(t => t % 2 === 0) === 2 && _list.count() === 3, "remove all even numbers from a list of first 5 numbers, get count!"); + assert.ok(_list.removeAll(t => t % 2 === 0) === 0 && _list.count() === 3, "remove all even numbers from a list of first 3 odd numbers, get count!"); + }); + + + QUnit.test("removeAt", function (assert) { + + var _list = CreateList(); + + _list.removeAt(2); + + assert.ok(_list[2] === 4 && _list.count() === 4, "remove item from 2nd index of a list of first 5 numbers, get count!"); + assert.throws(() => _list.removeAt(10), "throws an error removing item from 10th index of a list of first 5 numbers!"); + }); + + + QUnit.test("removeRange", function (assert) { + + var _list = CreateList(); + + _list.removeRange(1, 3); + + assert.ok(_list[0] === 1 && _list[1] === 5 && _list.count() === 2, "remove range of 3 items, starting from 1st index from a list of first 5 numbers, get count!"); + assert.throws(() => _list.removeRange(10, 10), "throws an error removing a range of items starting from 10th index of a list of first 5 numbers!"); + }); + + + QUnit.test("reverse", function (assert) { + + var _arr = [1, 2, 3, 4, 5], + _list1 = new List(_arr), + _list2 = new List(_arr); + + _list1.reverse(); + _list2.reverse(0, 3); + + assert.deepEqual(_list1.toArray(), [5, 4, 3, 2, 1], "reverse list of 5 first numbers!"); + assert.deepEqual(_list2.toArray(), [3, 2, 1, 4, 5], "reverse first 3 items of a list of 5 first numbers!"); + }); + + + QUnit.test("set", function (assert) { + + var _list = CreateList(); + + _list.set(1, 0); + + assert.ok(_list[1] === 0, "set value at index 1 of a list!"); + assert.throws(() => _list.set(10, 1), "throws an error setting item at index 10 from a list of 5 numbers!"); + }); + + + QUnit.test("sort", function (assert) { + + var _arr = [7, 1, 8, 3, 2, 0, 9, 6, 4, 5], + _list1 = new List(_arr), + _list2 = new List(_arr), + _list3 = new List(_arr), + _list4 = new List(_arr), + _sorter = (a: number, b: number) => a - b; + + _list1.sort(); + _list2.sort(_sorter); + _list3.sort({ compare: _sorter }); + _list4.sort(0, 5, { compare: _sorter }); + + assert.deepEqual(_list1.toArray(), [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], "sort list of first 10 numbers!"); + assert.deepEqual(_list2.toArray(), [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], "sort list of first 10 numbers with a comparison function!"); + assert.deepEqual(_list3.toArray(), [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], "sort list of first 10 numbers with a comparer!"); + assert.deepEqual(_list4.toArray(), [1, 2, 3, 7, 8, 0, 9, 6, 4, 5], "sort 5 first items of list of first 10 numbers with a comparer!"); + }); + + + QUnit.test("toArray", function (assert) { + + var _list = CreateList(); + + assert.deepEqual(_list.toArray(), [1, 2, 3, 4, 5], "converts a list of numbers to an array!"); + }); + + + QUnit.test("trueForAll", function (assert) { + + var _list = CreateList(); + + assert.ok(_list.trueForAll(t => t < 10) === true, "checks whether all items in a list of 5 first numbers are less than 10!"); + assert.ok(_list.trueForAll(t => t < 3) === false, "checks whether all items in a list of 5 first numbers are less than 3!"); + }); + + + QUnit.test("list enumerable", function (assert) { + + var _list = CreateList(); + + assert.deepEqual(_list.select(t => t * 2).where(t => t > 5).toArray(), [6, 8, 10], "select-where-toArray over a list!"); + }); + + + + /* Factory methods + ---------------------------------------------------------------------- */ + + function CreateList(): List { + return new List(1, 2, 3, 4, 5); + } + } + + + module ReadOnlyCollectionTests { + + QUnit.module("ReadOnlyCollection"); + + + QUnit.test("constructor", function (assert) { + assert.ok(CreateReadOnlyCollection().count() === 5, "initialize a ReadOnlyCollection!"); + assert.throws(() => new ReadOnlyCollection(null), "throws an exception creating an ampty ReadOnlyCollection!"); + }); + + + QUnit.test("indexer", function (assert) { + + var _col = CreateReadOnlyCollection(); + + assert.ok(_col[0] === 1, "indexer get!"); + assert.ok(function () { + try { _col[0] = 0; } + catch (e) { } + return _col[0] === 1; + }, "indexer set!"); + + assert.ok(function () { + try { _col[10] = 0; } + catch (e) { } + return _col[10] === undefined; + }, "out of range indexer set!"); + }); + + + QUnit.test("get", function (assert) { + + var _col = CreateReadOnlyCollection(); + + assert.ok(_col.get(1) === 2, "get item at index 1 from a collection of 5 numbers!"); + assert.throws(() => _col.get(10), "throws error getting item at index 10 from a collection of 5 numbers!"); + }); + + + QUnit.test("contains", function (assert) { + + var _col = CreateReadOnlyCollection(); + + assert.ok(_col.contains(3) === true, "collection contains!"); + assert.ok(_col.contains(6) === false, "collection not containing!"); + }); + + + QUnit.test("copyTo", function (assert) { + + var _col = CreateReadOnlyCollection(), + _arr = new Array(_col.count()); + + _col.copyTo(_arr, 0); + assert.deepEqual(_arr, [1, 2, 3, 4, 5], "collection copyTo an array!"); + assert.throws(() => _col.copyTo([], 0), "throws an error when the number of elements is greater than the number of elements that the destination array can contain!"); + }); + + + QUnit.test("indexOf", function (assert) { + + var _col = CreateReadOnlyCollection(); + + assert.ok(_col.indexOf(3) === 2, "get index of 3 in a collection of first 5 numbers!"); + assert.ok(_col.indexOf(10) === -1, "get index of 10 in a collection of first 5 numbers!"); + }); + + + QUnit.test("collection enumerable", function (assert) { + + var _col = CreateReadOnlyCollection(); + + assert.deepEqual(_col.select(t => t * 2).where(t => t > 5).toArray(), [6, 8, 10], "select-where-toArray over a collection!"); + }); + + + + /* Factory methods + ---------------------------------------------------------------------- */ + + function CreateReadOnlyCollection(): ReadOnlyCollection { + return new ReadOnlyCollection(new List(1, 2, 3, 4, 5)); + } + } + + + module SortedListTests { + + QUnit.module("SortedList"); + + + QUnit.test("constructor", function (assert) { + + var _comparer = Comparer.create((a: number, b: number) => a - b), + _dic = CreateDictionary(), + _s1 = new SortedList(), + _s2 = new SortedList(5), + _s3 = new SortedList(_dic), + _s4 = new SortedList(_comparer), + _s5 = new SortedList(5, _comparer), + _s6 = new SortedList(_dic, _comparer); + + + assert.ok(_s1.count() === 0 && _s1.capacity() === 0, "initialize a SortedList!"); + assert.ok(_s2.count() === 0 && _s2.capacity() === 5, "initialize a SortedList using initial capacity!"); + assert.ok(_s3.count() === 5 && _s3.capacity() === 5, "initialize a SortedList using specified dictionary!"); + assert.ok(_s4.count() === 0 && _s4.capacity() === 0, "initialize a SortedList using specified comparer!"); + assert.ok(_s5.count() === 0 && _s5.capacity() === 5, "initialize a SortedList using using initial capacity and comparer!"); + assert.ok(_s6.count() === 5 && _s6.capacity() === 5, "initialize a SortedList using specified dictionary and comparer!"); + }); + + + QUnit.test("add", function (assert) { + + assert.ok(CreateSortedList().count() == 5, "sorted-list add!"); + assert.throws(() => CreateSortedList().add(1, "AA"), "throws an error adding existing key to the list!"); + }); + + + QUnit.test("get", function (assert) { + + var _list = CreateSortedList(); + + assert.ok(_list.get(1) === "A", "sorted-list get!"); + assert.throws(() => _list.get(10), "throws an error getting invalid key!"); + }); + + + QUnit.test("capacity", function (assert) { + + var _list = CreateSortedList(); + + assert.ok(_list.capacity() > 0, "get sorted-list capacity!"); + + _list.capacity(10); + assert.ok(_list.capacity() === 10, "set sorted-list capacity!"); + }); + + + QUnit.test("clear", function (assert) { + + var _list = CreateSortedList(); + + _list.clear(); + assert.ok(_list.count() === 0 && _list.capacity() === 0, "clear sorted-list!"); + }); + + + QUnit.test("comparer", function (assert) { + + var _comparer = CreateSortedList().comparer(); + + assert.ok(_comparer.compare(5, 1) > 0 && _comparer.compare(1, 5) < 0 && _comparer.compare(1, 1) === 0, "sorted-list comparer!"); + }); + + + QUnit.test("containsKey", function (assert) { + + var _list1 = CreateSortedList(), + _list2 = new SortedList<{ id: number; name: string }, number>({ compare: (a, b) => a.name.localeCompare(b.name) }); + + assert.ok(_list1.containsKey(1) === true, "sorted-list contains key!"); + assert.ok(_list1.containsKey(10) === false, "sorted-list does not contain key!"); + + + _list2.add({ id: 2, name: "B" }, 2); + _list2.add({ id: 5, name: "E" }, 5); + _list2.add({ id: 4, name: "D" }, 4); + _list2.add({ id: 3, name: "C" }, 3); + _list2.add({ id: 1, name: "A" }, 1); + + assert.ok(_list2.containsKey({ id: 3, name: "C" }), "sorted-list contains key using specified comparer"); + }); + + + QUnit.test("containsValue", function (assert) { + + var _list = CreateSortedList(); + + assert.ok(_list.containsValue("A") === true, "sorted-list contains value!"); + assert.ok(_list.containsValue("Z") === false, "sorted-list does not contain value!"); + }); + + + QUnit.test("keys", function (assert) { + + var _list = CreateSortedList(); + + assert.deepEqual(_list.keys().toArray(), [1, 2, 3, 4, 5], "sorted-list keys!"); + assert.deepEqual(new SortedList().keys().toArray(), [], "empty sorted-list keys!"); + }); + + + QUnit.test("values", function (assert) { + + var _list = CreateSortedList(); + + assert.deepEqual(_list.values().toArray(), ["A", "B", "C", "D", "E"], "sorted-list values!"); + assert.deepEqual(new SortedList().values().toArray(), [], "empty sorted-list values!"); + }); + + + QUnit.test("indexOfKey", function (assert) { + + var _list = CreateSortedList(); + + assert.ok(_list.indexOfKey(1) === 0, "sorted-list index of key!"); + assert.ok(_list.indexOfKey(10) < 0, "sorted-list index of invalid key!"); + }); + + + QUnit.test("indexOfValue", function (assert) { + + var _list = CreateSortedList(); + + assert.ok(_list.indexOfValue("A") === 0, "sorted-list index of value!"); + assert.ok(_list.indexOfValue("Z") < 0, "sorted-list index of invalid value!"); + }); + + + QUnit.test("remove", function (assert) { + + var _list = CreateSortedList(); + + assert.ok(_list.remove(1) === true && _list.count() === 4 && _list.indexOfKey(1) < 0, "sorted-list remove key!"); + assert.ok(_list.remove(1) === false && _list.count() === 4, "sorted-list remove invalid key!"); + }); + + + QUnit.test("removeAt", function (assert) { + + var _list = CreateSortedList(); + + _list.removeAt(0); + assert.ok(_list.count() === 4 && _list.indexOfKey(1) < 0, "sorted-list remove at index!"); + assert.throws(() => _list.removeAt(10), "throws an error removing item at invalid index"); + }); + + + QUnit.test("set", function (assert) { + + var _list = CreateSortedList(); + + _list.set(1, "AA"); + assert.ok(_list.count() === 5 && _list.get(1) === "AA", "sorted-list set exisiting key's value!"); + + _list.set(6, "F"); + assert.ok(_list.count() === 6 && _list.get(6) === "F", "sorted-list set new key and value!"); + }); + + + QUnit.test("tryGetValue", function (assert) { + + var _list = CreateSortedList(); + + assert.ok(function () { + var value: string; + var res = _list.tryGetValue(1, val => value = val); + + return res && value === "A"; + + }, "sorted-list tryGetValue, exisiting key!"); + + + assert.ok(function () { + var value: string; + var res = _list.tryGetValue(10, val => value = val); + + return res === false; + + }, "sorted-list tryGetValue, invalid key!"); + }); + + + QUnit.test("sorted-list enumerable", function (assert) { + + var _list = CreateSortedList(); + + assert.deepEqual(_list.select(t => t.key * 2).where(t => t > 5).toArray(), [6, 8, 10], "select-where-toArray over a sorted-list!"); + assert.deepEqual(_list.where(t => t.key > 2).select(t => t.value).toArray(), ["C", "D", "E"], "where-select-toArray over a sorted-list!"); + }); + + + QUnit.test("evaluate sorting", function (assert) { + + var _list1 = CreateSortedList(), + _list2 = new SortedList<{ id: number; name: string }, number>({ compare: (a, b) => a.name.localeCompare(b.name) }); + + _list1.remove(5); + _list1.add(6, "F"); + _list1.remove(4); + _list1.add(7, "G"); + _list1.remove(3); + _list1.add(8, "H"); + _list1.remove(2); + _list1.add(9, "I"); + _list1.remove(1); + _list1.add(10, "J"); + + assert.deepEqual(_list1.keys().toArray(), [6, 7, 8, 9, 10], "evaluate sorted keys after multiple add/remove"); + assert.deepEqual(_list1.values().toArray(), ["F", "G", "H", "I", "J"], "evaluate sorted values after multiple add/remove"); + + + + _list2.add({ id: 2, name: "B" }, 2); + _list2.add({ id: 5, name: "E" }, 5); + _list2.add({ id: 4, name: "D" }, 4); + _list2.add({ id: 3, name: "C" }, 3); + _list2.add({ id: 1, name: "A" }, 1); + + assert.deepEqual(_list2.keys().select(t => t.id).toArray(), [1, 2, 3, 4, 5], "evaluate sorted keys after multiple add/remove using specified comparer!"); + }); + + + + /* Factory methods + ---------------------------------------------------------------------- */ + + function CreateDictionary(): Dictionary { + var _dic = new Dictionary(); + _dic.add(1, "A"); + _dic.add(2, "B"); + _dic.add(3, "C"); + _dic.add(4, "D"); + _dic.add(5, "E"); + + return _dic; + } + + function CreateSortedList(): SortedList { + var _list = new SortedList(); + _list.add(5, "E"); + _list.add(3, "C"); + _list.add(2, "B"); + _list.add(4, "D"); + _list.add(1, "A"); + + return _list; + } + } + + + module DictionaryTests { + + QUnit.module("Dictionary"); + + + QUnit.test("constructor", function (assert) { + + var _comparer = EqualityComparer.create(o => mx.hash(o), (a, b) => a === b), + _d1 = new Dictionary(), + _d2 = new Dictionary(CreateDictionary()), + _d3 = new Dictionary(_comparer), + _d4 = new Dictionary(5), + _d5 = new Dictionary(5, _comparer), + _d6 = new Dictionary(CreateDictionary(), _comparer); + + + assert.ok(_d1.count() === 0, "initialize a Dictionary!"); + assert.ok(_d2.count() === 5, "initialize a Dictionary using specified dictionary!"); + assert.ok(_d3.count() === 0, "initialize a Dictionary using specified comparer!"); + assert.ok(_d4.count() === 0, "initialize a Dictionary using initial capacity!"); + assert.ok(_d5.count() === 0, "initialize a Dictionary using using initial capacity and comparer!"); + assert.ok(_d6.count() === 5, "initialize a Dictionary using specified dictionary and comparer!"); + }); + + + QUnit.test("add", function (assert) { + var _dic = new Dictionary(); + _dic.add(1, "A"); + + assert.ok(_dic.count() === 1, "ditionary add"); + assert.throws(() => _dic.add(1, "B"), "throws an error adding duplicate key"); + }); + + + QUnit.test("clear", function (assert) { + var _dic = CreateDictionary(); + _dic.clear(); + + assert.ok(_dic.count() === 0, "ditionary clear!"); + }); + + + QUnit.test("containsKey", function (assert) { + + var _dic = CreateDictionary(); + + assert.ok(_dic.containsKey(1) === true, "dictionary contains key!"); + assert.ok(_dic.containsKey(10) === false, "dictionary does not contain key!"); + }); + + + QUnit.test("containsValue", function (assert) { + + var _dic = CreateDictionary(); + + assert.ok(_dic.containsValue("A") === true, "dictionary contains value!"); + assert.ok(_dic.containsValue("Z") === false, "dictionary does not contain value!"); + }); + + + QUnit.test("copyTo", function (assert) { + + var _dic = CreateDictionary(), + _arr = new Array(_dic.count()); + + _dic.copyTo(_arr, 0); + assert.deepEqual(_arr, [1, 2, 3, 4, 5], "dictionary copy to an array!"); + assert.throws(() => _dic.copyTo([], 0), "throws an error when the number of elements is greater than the number of elements that the destination array can contain!"); + }); + + + QUnit.test("keys", function (assert) { + + var _dic = CreateDictionary(); + + assert.deepEqual(_dic.keys().toArray(), [1, 2, 3, 4, 5], "dictionary keys!"); + assert.deepEqual(new Dictionary().keys().toArray(), [], "empty dictionary keys!"); + }); + + + QUnit.test("values", function (assert) { + + var _dic = CreateDictionary(); + + assert.deepEqual(_dic.values().toArray(), ["A", "B", "C", "D", "E"], "dictionary values!"); + assert.deepEqual(new Dictionary().values().toArray(), [], "empty dictionary values!"); + }); + + + QUnit.test("get", function (assert) { + + var _dic = CreateDictionary(); + + assert.ok(_dic.get(1) === "A", "dictionary get value!"); + assert.throws(() => _dic.get(10), "throws an error getting non existing key!"); + }); + + + QUnit.test("set", function (assert) { + + var _dic = CreateDictionary(); + + _dic.set(1, "AA"); + assert.ok(_dic.get(1) === "AA", "dictionary set value!"); + + _dic.set(6, "F"); + assert.ok(_dic.count() === 6 && _dic.get(6) === "F", "dictionary set new key and value!"); + }); + + + QUnit.test("tryGetValue", function (assert) { + + var _dic = CreateDictionary(); + + assert.ok(function () { + var value: string; + var res = _dic.tryGetValue(1, val => value = val); + + return res && value === "A"; + + }, "dictionary tryGetValue, exisiting key!"); + + + assert.ok(function () { + var value: string; + var res = _dic.tryGetValue(10, val => value = val); + + return res === false; + + }, "dictionary tryGetValue, invalid key!"); + }); + + + QUnit.test("remove", function (assert) { + + var _dic = CreateDictionary(); + + assert.ok(_dic.remove(1) === true && _dic.count() === 4, "dictionary remove key!"); + assert.ok(_dic.remove(10) === false && _dic.count() === 4, "dictionary remove non existing key!"); + }); + + + QUnit.test("key-value pair", function (assert) { + + var _pair1 = new KeyValuePair(1, "A"), + _pair2 = new KeyValuePair(1, "A"); + + assert.ok(_pair1.key === 1 && _pair1.value === "A", "KeyValuePair get key/value!"); + assert.throws(() => _pair1.key = 2, "throws an error trysing to set KeyValuePair key!"); + assert.throws(() => _pair1.value = "B", "throws an error trysing to set KeyValuePair value!"); + assert.ok(mx.hash(_pair1) === mx.hash(_pair2), "KeyValuePair get hash code!"); + assert.ok(mx.equals(_pair1, _pair2), "KeyValuePair equality check!"); + }); + + + QUnit.test("dictionary enumerable", function (assert) { + + var _dic = CreateDictionary(); + + assert.deepEqual(_dic.select(t => t.key).toArray(), [1, 2, 3, 4, 5], "dictionary select keys, to array!"); + assert.deepEqual(_dic.select(t => t.value).toArray(), ["A", "B", "C", "D", "E"], "dictionary select values, to array!"); + assert.ok(_dic.toArray()[0].key === 1 && _dic.toArray()[0].value === "A", "dictionary select key-value items!"); + }); + + + + /* Factory methods + ---------------------------------------------------------------------- */ + + function CreateDictionary(): Dictionary { + var _dic = new Dictionary(); + _dic.add(1, "A"); + _dic.add(2, "B"); + _dic.add(3, "C"); + _dic.add(4, "D"); + _dic.add(5, "E"); + + return _dic; + } + } + + + module HashSetTests { + + QUnit.module("Hashset"); + + + QUnit.test("constructor", function (assert) { + + assert.ok(new HashSet().count() === 0, "initialize an empty HashSet!"); + assert.ok(new HashSet(mx.range(1, 5)).count() === 5, "initialize a HashSet using specified collection!"); + assert.ok(new HashSet(mx.EqualityComparer.defaultComparer).count() === 0, "initialize a HashSet using specified equality comparer!"); + assert.ok(CreateObjectHashSet().count() === 2, "initialize a HashSet using specified collection and equality comparer!"); + }); + + + QUnit.test("add", function (assert) { + + var _hash1 = CreateNumericHashSet(), + _hash2 = CreateObjectHashSet(); + + assert.ok(_hash1.add(6) === true, "add item to a HashSet of numbers!"); + assert.ok(_hash1.add(1) === false, "add existing item to a HashSet of numbers!"); + assert.ok(_hash2.add({ name: "C", value: 5 }) === true, "add item to a HashSet of objects!"); + assert.ok(_hash2.add({ name: "A", value: 5 }) === false, "add an existing item to a HashSet of objects!"); + }); + + + QUnit.test("clear", function (assert) { + + var _hash = CreateNumericHashSet(); + + _hash.clear(); + assert.ok(_hash.count() === 0, "clear a HashSet!"); + }); + + + QUnit.test("contains", function (assert) { + + var _hash1 = CreateNumericHashSet(), + _hash2 = CreateObjectHashSet(); + + assert.ok(_hash1.contains(1) === true, "HashSet of numbers contains an item!"); + assert.ok(_hash1.contains(6) === false, "HashSet of numbers does not contain an item!"); + assert.ok(_hash2.contains({ name: "A", value: 5 }) === true, "HashSet of objects contains an item!"); + assert.ok(_hash2.contains({ name: "C", value: 5 }) === false, "HashSet of objects does not contain an item!"); + }); + + + QUnit.test("copyTo", function (assert) { + + var _hash = CreateNumericHashSet(), + _arr = new Array(_hash.count()); + + _hash.copyTo(_arr, 0); + + assert.deepEqual(_arr, [1, 2, 3, 4, 5], "HashSet copy to an array!"); + assert.throws(() => _hash.copyTo([], 0), "throws an error when the number of elements is greater than the number of elements that the destination array can contain!"); + }); + + + QUnit.test("comparer", function (assert) { + + var _hash1 = CreateNumericHashSet(), + _hash2 = CreateObjectHashSet(); + + assert.ok(_hash1.comparer() === mx.EqualityComparer.defaultComparer, "HashSet default comparer!"); + assert.ok(_hash2.comparer().equals({ name: "A", value: 1 }, { name: "A", value: 2 }), "HashSet custom comparer!"); + }); + + + QUnit.test("remove", function (assert) { + + var _hash1 = CreateNumericHashSet(), + _hash2 = CreateObjectHashSet(); + + assert.ok(_hash1.remove(1) === true, "HashSet of numbers remove an item!"); + assert.ok(_hash1.remove(1) === false, "HashSet of numbers remove non existing item!"); + assert.ok(_hash2.remove({ name: "A", value: 1 }) === true, "HashSet of objects remove an item!"); + assert.ok(_hash2.remove({ name: "A", value: 1 }) === false, "HashSet of objects remove non existing item!"); + }); + + + QUnit.test("removeWhere", function (assert) { + + var _hash1 = CreateNumericHashSet(), + _hash2 = CreateObjectHashSet(); + + assert.ok(_hash1.removeWhere(t => t < 3) === 2, "HashSet of numbers remove with predicate, get number of items removed!"); + assert.ok(_hash1.removeWhere(t => t < 3) === 0, "HashSet of numbers remove with invalid predicate, get number of items removed!"); + assert.ok(_hash1.count() === 3, "HashSet of numbers remove with predicate, get count!"); + + assert.ok(_hash2.removeWhere(t => t.value < 3) === 1, "HashSet of objects remove with predicate, get number of items removed!"); + assert.ok(_hash2.removeWhere(t => t.value < 3) === 0, "HashSet of objects remove with invalid predicate, get number of items removed!"); + assert.ok(_hash2.count() === 1, "HashSet of objects remove with predicate, get count!"); + }); + + + QUnit.test("exceptWith", function (assert) { + + var _hash1 = CreateNumericHashSet(), + _hash2 = CreateObjectHashSet(), + _hash3 = CreateNumericHashSet(); + + _hash1.exceptWith([1, 2, 3]); + _hash2.exceptWith([{ name: "A", value: 0 }]); + _hash3.exceptWith(CreateNumericHashSet()); + + assert.ok(_hash1.count() === 2 && _hash1.contains(1) === false, "HashSet of numbers except a collection, get count!"); + assert.ok(_hash2.count() === 1 && _hash2.contains({ name: "A", value: 0 }) === false, "HashSet of objects except a collection, get count!"); + assert.ok(_hash3.count() === 0, "HashSet of numbers except an equal set, get count!"); + }); + + + QUnit.test("intersectWith", function (assert) { + + var _hash1 = CreateNumericHashSet(), + _hash2 = CreateObjectHashSet(), + _hash3 = CreateNumericHashSet(); + + _hash1.intersectWith([1, 2, 3]); + _hash2.intersectWith([{ name: "A", value: 0 }]); + _hash3.intersectWith(CreateNumericHashSet()); + + assert.ok(_hash1.count() === 3 && _hash1.contains(1) === true, "HashSet of numbers intersect with a collection, get count!"); + assert.ok(_hash2.count() === 1 && _hash2.contains({ name: "A", value: 0 }) === true, "HashSet of objects intersect with a collection, get count!"); + assert.ok(_hash3.count() === 5, "HashSet of numbers intersect with an equal set, get count!"); + }); + + + QUnit.test("isProperSubsetOf", function (assert) { + + var _hash = CreateNumericHashSet(); + + assert.ok(new HashSet().isProperSubsetOf([1, 2, 3]) === true, "an empty set is a proper subset of any other collection!"); + assert.ok(new HashSet().isProperSubsetOf([]) === false, "an empty set is not a proper subset of another empty collection!"); + assert.ok(_hash.isProperSubsetOf([1, 2, 3, 4]) === false, "a hash set is not a proper subset of another collection when count is greater than the number of elements in other!"); + assert.ok(_hash.isProperSubsetOf([1, 2, 3, 4, 5]) === false, "a hash set is not a proper subset of another collection when count is equal to the number of elements in other!"); + assert.ok(_hash.isProperSubsetOf([1, 2, 3, 4, 5, 6]) === true, "hash set proper subset!"); + }); + + + QUnit.test("isProperSupersetOf", function (assert) { + + var _hash = CreateNumericHashSet(); + + assert.ok(new HashSet().isProperSupersetOf([1, 2, 3]) === false, "an empty set is a not superset of any other collection!"); + assert.ok(new HashSet().isProperSupersetOf([]) === false, "an empty set is not a proper superset of another empty collection!"); + assert.ok(_hash.isProperSupersetOf([1, 2, 3, 4, 5, 6]) === false, "a hash set is not a proper superset of another collection when count is less than the number of elements in other!"); + assert.ok(_hash.isProperSupersetOf([1, 2, 3, 4, 5]) === false, "a hash set is not a proper superset of another collection when count is equal to the number of elements in other!"); + assert.ok(_hash.isProperSupersetOf([1, 2, 3]) === true, "hash set proper superset!"); + }); + + + QUnit.test("isSubsetOf", function (assert) { + + var _hash = CreateNumericHashSet(); + + assert.ok(new HashSet().isSubsetOf([1, 2, 3]) === true, "an empty set is a subset of any other collection!"); + assert.ok(new HashSet().isSubsetOf([]) === true, "an empty set is a subset of another empty collection!"); + assert.ok(_hash.isSubsetOf([1, 2, 3, 4]) === false, "a hash set is not a subset of another collection when count is greater than the number of elements in other!"); + assert.ok(_hash.isSubsetOf([1, 2, 3, 4, 5]) === true, "a hash set is a proper subset of another collection when count is equal to the number of elements in other!"); + assert.ok(_hash.isSubsetOf([1, 2, 3, 4, 5, 6]) === true, "hash set subset!"); + }); + + + QUnit.test("isSupersetOf", function (assert) { + + var _hash = CreateNumericHashSet(); + + assert.ok(new HashSet().isSupersetOf([1, 2, 3]) === false, "an empty set is a not superset of any other collection!"); + assert.ok(new HashSet().isSupersetOf([]) === true, "an empty set is superset of another empty collection!"); + assert.ok(_hash.isSupersetOf([1, 2, 3, 4, 5, 6]) === false, "a hash set is not a superset of another collection when count is less than the number of elements in other!"); + assert.ok(_hash.isSupersetOf([1, 2, 3, 4, 5]) === true, "a hash set is a proper superset of another collection when count is equal to the number of elements in other!"); + assert.ok(_hash.isSupersetOf([1, 2, 3]) === true, "hash set superset!"); + }); + + + QUnit.test("overlaps", function (assert) { + + var _hash1 = CreateNumericHashSet(), + _hash2 = CreateObjectHashSet(); + + assert.ok(_hash1.overlaps([1, 2, 3]) === true, "HashSet of numbers overlaps with another collection!"); + assert.ok(_hash2.overlaps([{ name: "A", value: 0 }]) === true, "HashSet of objects overlaps with another collection!"); + assert.ok(new HashSet().overlaps([1, 2, 3]) === false, "an empty HashSet does not overlap with another collection!"); + }); + + + QUnit.test("setEquals", function (assert) { + + var _hash1 = CreateNumericHashSet(), + _hash2 = CreateNumericHashSet(); + + assert.ok(_hash1.setEquals(_hash2) === true, "HashSet of numbers equals with another HashSet!"); + assert.ok(_hash1.setEquals([1, 2, 3, 4, 5]) === true, "HashSet of numbers equals with another collection!"); + assert.ok(new HashSet().setEquals([]) === true, "an empty HashSet equals with an empty collection!"); + assert.ok(new HashSet().setEquals([1, 2, 3]) === false, "an empty HashSet does not equals with another collection!"); + }); + + + QUnit.test("symmetricExceptWith", function (assert) { + + var _hash1 = CreateNumericHashSet(), + _hash2 = CreateObjectHashSet(), + _hash3 = CreateNumericHashSet(); + + _hash1.symmetricExceptWith([2, 3, 4]); + _hash2.symmetricExceptWith([{ name: "A", value: 0 }]); + _hash3.exceptWith(CreateNumericHashSet()); + + assert.ok(_hash1.count() === 2, "HashSet of numbers symmetric except another collection, get count!"); + assert.ok(_hash1.contains(1) === true && _hash1.contains(5) === true, "HashSet of numbers symmetric except another collection, check contains!"); + assert.ok(_hash2.count() === 1, "HashSet of objects symmetric except another collection, get count!"); + assert.ok(_hash2.contains({ name: "A", value: 0 }) === false && _hash2.contains({ name: "B", value: 0 }) === true, "HashSet of objects symmetric except another collection, check contains!"); + assert.ok(_hash3.count() === 0, "HashSet of numbers symmetric except an equal set, get count!"); + }); + + + QUnit.test("unionWith", function (assert) { + + var _hash1 = CreateNumericHashSet(), + _hash2 = CreateObjectHashSet(), + _hash3 = CreateNumericHashSet(); + + _hash1.unionWith([5, 6, 7, 8]); + _hash2.unionWith([{ name: "A", value: 5 }, { name: "B", value: 6 }, { name: "C", value: 7 }, { name: "D", value: 8 }]); + _hash3.unionWith(CreateNumericHashSet()); + + assert.ok(_hash1.count() === 8, "HashSet of numbers union with another collection, get count!"); + assert.ok(_hash1.contains(1) === true && _hash1.contains(8) === true, "HashSet of numbers union with another collection, check contains!"); + assert.ok(_hash2.count() === 4, "HashSet of objects union with another collection, get count!"); + assert.ok(_hash2.contains({ name: "A", value: 0 }) === true && _hash2.contains({ name: "D", value: 0 }) === true, "HashSet of objects union with another collection, check contains!"); + assert.ok(_hash3.count() === 5, "HashSet of numbers union with an equal set, get count!"); + }); + + + QUnit.test("set enumerable", function (assert) { + + var _hash1 = CreateNumericHashSet(), + _hash2 = CreateObjectHashSet(); + + assert.deepEqual(_hash1.select(t => t * 2).where(t => t > 5).toArray(), [6, 8, 10], "select-where-toArray over a HashSet of numbers!"); + assert.deepEqual(_hash2.select(t => t.value * 2).where(t => t > 5).toArray(), [6], "select-where-toArray over a HashSet of objects!"); + }); + + + + /* Factory methods + ---------------------------------------------------------------------- */ + + function CreateNumericHashSet(): HashSet { + return new HashSet(mx.range(1, 5)); + } + + function CreateObjectHashSet(): HashSet { + + var _items: SimpleObject[] = [{ name: "A", value: 1 }, { name: "A", value: 2 }, { name: "B", value: 3 }, { name: "B", value: 4 }], + _comparer = EqualityComparer.create(obj => mx.hash(obj.name), (a, b) => a.name === b.name); + + return new HashSet(_items, _comparer); + } + } + + + module LinkedListTests { + + QUnit.module("LinkedList"); + + + QUnit.test("constructor", function (assert) { + + assert.ok(new LinkedList().count() === 0, "initialize an empty LinkedList!"); + assert.ok(CreateLinkedList().count() === 5, "initialize a LinkedList using specified collection!"); + }); + + + QUnit.test("add", function (assert) { + + var _list = CreateLinkedList(); + + _list.add(6); + assert.ok(_list.count() === 6, "add an item to a LinkedList!"); + }); + + + QUnit.test("clear", function (assert) { + + var _list = CreateLinkedList(); + + _list.clear(); + assert.ok(_list.count() === 0, "clear a LinkedList!"); + }); + + + QUnit.test("contains", function (assert) { + + var _list = CreateLinkedList(); + + assert.ok(_list.contains(1) && _list.contains(5), "LinkedList contains an item!"); + assert.ok(_list.contains(10) === false, "LinkedList does not contains an item!"); + }); + + + QUnit.test("copyTo", function (assert) { + + var _list = CreateLinkedList(), + _arr = new Array(_list.count()); + + _list.copyTo(_arr, 0); + + assert.deepEqual(_arr, [1, 2, 3, 4, 5], "LinkedList copy to an array!"); + assert.throws(() => _list.copyTo([], 0), "throws an error when the number of elements is greater than the number of elements that the destination array can contain!"); + }); + + + QUnit.test("getFirst", function (assert) { + + var _list = CreateLinkedList(); + + assert.ok(_list.getFirst().value() === 1, "LinkedList first item!"); + assert.ok(new LinkedList().getFirst() === null, "empty LinkedList first item!"); + }); + + + QUnit.test("getLast", function (assert) { + + var _list = CreateLinkedList(); + + assert.ok(_list.getLast().value() === 5, "LinkedList last item!"); + assert.ok(new LinkedList().getLast() === null, "empty LinkedList last item!"); + }); + + + QUnit.test("addAfter", function (assert) { + + var _list = CreateLinkedList(), + _first = _list.getFirst(), + _node = new LinkedListNode(6); + + _list.addAfter(_first, _node); + _list.addAfter(_first, 7); + + assert.ok(_list.count() === 7, "LinkedList add after item, get count!"); + assert.ok(_list.contains(6) && _list.contains(7), "LinkedList add after item, check contains!"); + }); + + + QUnit.test("addBefore", function (assert) { + + var _list = CreateLinkedList(), + _last = _list.getLast(), + _node = new LinkedListNode(6); + + _list.addBefore(_last, _node); + _list.addBefore(_last, 7); + + assert.ok(_list.count() === 7, "LinkedList add before item, get count!"); + assert.ok(_list.contains(6) && _list.contains(7), "LinkedList add before item, check contains!"); + }); + + + QUnit.test("addFirst", function (assert) { + + var _list = CreateLinkedList(), + _node = new LinkedListNode(0); + + _list.addFirst(_node); + _list.addFirst(-1); + + assert.ok(_list.count() === 7, "LinkedList add first, get count!"); + assert.ok(_list.contains(0) && _list.contains(-1), "LinkedList add first, check contains!"); + assert.ok(_list.getFirst().value() === -1, "LinkedList add first, get first!"); + }); + + + QUnit.test("addLast", function (assert) { + + var _list = CreateLinkedList(), + _node = new LinkedListNode(6); + + _list.addLast(_node); + _list.addLast(7); + + assert.ok(_list.count() === 7, "LinkedList add last, get count!"); + assert.ok(_list.contains(6) && _list.contains(7), "LinkedList add last, check contains!"); + assert.ok(_list.getLast().value() === 7, "LinkedList add last, get last!"); + }); + + + QUnit.test("find", function (assert) { + + var _list = CreateLinkedList(); + + assert.ok(_list.find(4).value() === 4, "LinkedList find an item!"); + assert.ok(_list.find(10) === null, "LinkedList does not find an item!"); + }); + + + QUnit.test("findLast", function (assert) { + + var _list = CreateLinkedList(), + _node = new LinkedListNode(1); + + _list.addLast(_node); + + assert.ok(_list.findLast(1) === _node, "LinkedList find last!"); + assert.ok(_list.findLast(10) === null, "LinkedList does not find last item!"); + }); + + + QUnit.test("remove", function (assert) { + + var _list = CreateLinkedList(), + _last = _list.getLast(); + + assert.ok(_list.remove(1) === true, "LinkedList remove an item!"); + assert.ok(_list.remove(1) === false, "LinkedList remove non existing item!"); + assert.ok(_list.remove(_last) === true, "LinkedList remove a node!"); + assert.throws(() => _list.remove(_last), "throws an error when removing non existing or invalid node!"); + assert.ok(_list.count() === 3, "LinkedList remove, get count!"); + }); + + + QUnit.test("removeFirst", function (assert) { + + var _list = CreateLinkedList(); + + _list.removeFirst(); + + assert.ok(_list.count() === 4 && _list.contains(1) === false, "LinkedList remove first node!"); + assert.throws(() => new LinkedList().removeFirst(), "throws an error removing from an empty linked list!"); + }); + + + QUnit.test("removeLast", function (assert) { + + var _list = CreateLinkedList(); + + _list.removeLast(); + + assert.ok(_list.count() === 4 && _list.contains(5) === false, "LinkedList remove last node!"); + assert.throws(() => new LinkedList().removeLast(), "throws an error removing from an empty linked list!"); + }); + + + QUnit.test("linked-list enumerable", function (assert) { + + var _list = CreateLinkedList(); + assert.deepEqual(_list.select(t => t * 2).where(t => t > 5).toArray(), [6, 8, 10], "select-where-toArray over a linked-list!"); + }); + + + + + /* Factory methods + ---------------------------------------------------------------------- */ + + function CreateLinkedList(): LinkedList { + return new LinkedList(mx.range(1, 5)); + } + } + + + module QueueTests { + + QUnit.module("Queue"); + + + QUnit.test("constructor", function (assert) { + + assert.ok(new Queue().count() === 0, "initialize an empty Queue!"); + assert.ok(CreateQueue().count() === 5, "initialize a Queue using specified collection!"); + }); + + + QUnit.test("clear", function (assert) { + + var _queue = CreateQueue(); + + _queue.clear(); + assert.ok(_queue.count() === 0, "clears a Queue!"); + }); + + + QUnit.test("contains", function (assert) { + + var _queue = CreateQueue(); + + assert.ok(_queue.contains(1) === true, "queue containing an item!"); + assert.ok(_queue.contains(10) === false, "queue does not contain an item!"); + }); + + + QUnit.test("copyTo", function (assert) { + + var _queue = CreateQueue(), + _arr = new Array(_queue.count()); + + _queue.copyTo(_arr, 0); + assert.deepEqual(_arr, [1, 2, 3, 4, 5], "queue copy to an array!"); + assert.throws(() => _queue.copyTo([], 0), "throws an error when the number of elements is greater than the number of elements that the destination array can contain!"); + }); + + + QUnit.test("dequeue", function (assert) { + + var _queue = CreateQueue(); + + assert.ok(_queue.dequeue() === 1, "queue dequeue an item!"); + + _queue.clear(); + assert.throws(() => _queue.dequeue(), "throws an error dequeue from empty queue!"); + }); + + + QUnit.test("enqueue", function (assert) { + + var _queue = CreateQueue(); + + _queue.enqueue(6); + assert.ok(_queue.count() === 6 && _queue.peek() === 1, "queue dequeue an item!"); + }); + + + QUnit.test("peek", function (assert) { + + var _queue = CreateQueue(); + + assert.ok(_queue.peek() === 1, "queue peek an item!"); + + _queue.clear(); + assert.throws(() => _queue.peek(), "throws an error peek from empty queue!"); + }); + + + QUnit.test("toArray", function (assert) { + + var _queue = CreateQueue(); + + assert.deepEqual(_queue.toArray(), [1, 2, 3, 4, 5], "queue to array!"); + }); + + + QUnit.test("queue enumerable", function (assert) { + + var _queue = CreateQueue(); + + assert.deepEqual(_queue.select(t => t * 2).where(t => t > 5).toArray(), [6, 8, 10], "select-where-toArray over a queue!"); + }); + + + + /* Factory methods + ---------------------------------------------------------------------- */ + + function CreateQueue(): Queue { + return new Queue(mx.range(1, 5)); + } + } + + + module StackTests { + + QUnit.module("Stack"); + + + QUnit.test("constructor", function (assert) { + + assert.ok(new Stack().count() === 0, "initialize an empty Stack!"); + assert.ok(CreateStack().count() === 5, "initialize a Stack using specified collection!"); + }); + + + QUnit.test("clear", function (assert) { + + var _stack = CreateStack(); + + _stack.clear(); + assert.ok(_stack.count() === 0, "clears a Stack!"); + }); + + + QUnit.test("contains", function (assert) { + + var _stack = CreateStack(); + + assert.ok(_stack.contains(1) === true, "stack containing an item!"); + assert.ok(_stack.contains(10) === false, "stack does not contain an item!"); + }); + + + QUnit.test("copyTo", function (assert) { + + var _stack = CreateStack(), + _arr = new Array(_stack.count()); + + _stack.copyTo(_arr, 0); + assert.deepEqual(_arr, [1, 2, 3, 4, 5], "stack copy to an array!"); + assert.throws(() => _stack.copyTo([], 0), "throws an error when the number of elements is greater than the number of elements that the destination array can contain!"); + }); + + + QUnit.test("peek", function (assert) { + + var _stack = CreateStack(); + + assert.ok(_stack.peek() === 5, "stack peek an item!"); + + _stack.clear(); + assert.throws(() => _stack.peek(), "throws an error peek from empty stack!"); + }); + + + QUnit.test("pop", function (assert) { + + var _stack = CreateStack(); + + assert.ok(_stack.pop() === 5, "stack pop an item!"); + + _stack.clear(); + assert.throws(() => _stack.pop(), "throws an error pop from empty stack!"); + }); + + + QUnit.test("push", function (assert) { + + var _stack = CreateStack(); + + _stack.push(6); + assert.ok(_stack.count() === 6 && _stack.peek() === 6, "stack push an item!"); + }); + + + QUnit.test("toArray", function (assert) { + + var _stack = CreateStack(); + + assert.deepEqual(_stack.toArray(), [1, 2, 3, 4, 5], "stack to array!"); + }); + + + QUnit.test("stack enumerable", function (assert) { + + var _stack = CreateStack(); + + assert.deepEqual(_stack.select(t => t * 2).where(t => t > 5).toArray(), [6, 8, 10], "select-where-toArray over a stack!"); + }); + + + + /* Factory methods + ---------------------------------------------------------------------- */ + + function CreateStack(): Stack { + return new Stack(mx.range(1, 5)); + } + } + + + module LookupTests { + + QUnit.module("Lookup"); + + + QUnit.test("contains", function (assert) { + + var _lookup = CreateLookup(); + + assert.ok(_lookup.contains(1) === true, "lookup contains an item!"); + assert.ok(_lookup.contains(10) === false, "lookup does not an item!"); + }); + + + QUnit.test("count", function (assert) { + + var _lookup = CreateLookup(); + + assert.ok(_lookup.count() === 4, "lookup count!"); + }); + + + QUnit.test("get", function (assert) { + + var _lookup = CreateLookup(); + + assert.ok(_lookup.get(1).count() === 2, "lookup get an item!"); + assert.ok(_lookup.get(10).count() === 0, "lookup get non existing item!"); + }); + + + QUnit.test("lookup enumerable", function (assert) { + + var _lookup = CreateLookup(); + + assert.deepEqual(_lookup.select(t => t.key).toArray(), [1, 2, 3, 4], "lookup select keys, to array!"); + assert.deepEqual(_lookup.selectMany(t => t).toArray(), [1, 1, 2, 3, 3, 4, 4, 4], "lookup select all items, to array!"); + assert.deepEqual(_lookup.select(t => t.count()).toArray(), [2, 1, 2, 3], "lookup select items count!"); + }); + + + + /* Factory methods + ---------------------------------------------------------------------- */ + + function CreateLookup(): Lookup { + return mx([1, 1, 2, 3, 3, 4, 4, 4]).toLookup(t => t); + } + } +} \ No newline at end of file diff --git a/multiplexjs/multiplexjs.d.ts b/multiplexjs/multiplexjs.d.ts new file mode 100644 index 000000000..dc39fe6b6 --- /dev/null +++ b/multiplexjs/multiplexjs.d.ts @@ -0,0 +1,2551 @@ +// Type definitions for Multiplex.js 0.9 +// Project: http://github.com/multiplex/multiplex.js +// Definitions by: Kamyar Nazeri +// Definitions: https://github.com/borisyankov/DefinitelyTyped + + + +declare var multiplex: multiplex.MultiplexStatic; + + +// Support AMD require +declare module 'multiplex' { + export = multiplex; +} + + +// Collapse multiplex into mx +import mx = multiplex; + + +// ES6 compatibility +interface Array extends multiplex.Iterable { } +interface String extends multiplex.Iterable { } + + + +declare module multiplex { + + /** + * ES6 Iterable + */ + interface Iterable { + "@@iterator"(): Iterator + } + interface Iterator { + next(): IteratorResult; + return?(value?: any): IteratorResult; + throw?(e?: any): IteratorResult; + } + interface IteratorResult { + done: boolean; + value?: T; + } + + + + /** + * Supports a simple iteration over a collection. + */ + interface Enumerator { + + /** + * Advances the enumerator to the next element of the collection. + */ + next(): boolean; + + /** + * Gets the element in the collection at the current position of the enumerator. + */ + current: T; + } + interface EnumeratorConstructor { + new (generator: (yielder: (value: T) => T) => any): Enumerator; + } + + + + /** + * Exposes the enumerator, which supports a simple iteration over a collection of a specified type. + * Enumerable uses ES6 Iteration protocol. + */ + interface Enumerable extends Iterable { + + /** + * Returns an enumerator that iterates through the collection. + */ + getEnumerator(): Enumerator; + } + interface EnumerableConstructor { + + /** + * Exposes the enumerator, which supports an iteration over the specified Enumerable object. + * @param obj An Iterable object. eg. Enumerable, Array, String, Set, Map, Iterable & Generators + */ + new (obj: Iterable): Enumerable; + + + /** + * Defines an enumerator, which supports an iteration over the specified Generator function. + * @param factory An Enumerator factory function. + */ + new (factory: () => Enumerator): Enumerable; + + /** + * Defines an enumerator, which supports an iteration over the items of the specified Array-like object. + * An Array-like object is an object which has the "length" property and indexed properties access, eg. jQuery + * @param obj An Array-like object. + */ + new (obj: ArrayLike): Enumerable; + + /** + * Defines an enumerator, which supports an iteration over the arguments local variable available within all functions. + * @param obj arguments local variable available within all functions. + */ + new (obj: IArguments): Enumerable; + + /** + * Defines an enumerator, which supports an iteration over the properties of the specified object. + * @param obj A regular Object. + */ + new (obj: Object): Enumerable>; + + + + + /** + * Returns an empty Enumerable. + */ + empty(): Enumerable; + + /** + * Detects if an object is Enumerable. + * @param obj An object to check its Enumerability. + */ + is(obj: any): boolean; + + /** + * Generates a sequence of integral numbers within a specified range. + * @param start The value of the first integer in the sequence. + * @param count The number of sequential integers to generate. + */ + range(start: number, count: number): Enumerable; + + /** + * Generates a sequence that contains one repeated value. + * @param element The value to be repeated. + * @param count The number of times to repeat the value in the generated sequence. + */ + repeat(element: T, count: number): Enumerable; + } + + + + /** + * Defines a method that a type implements to compare two objects. + */ + interface Comparer { + /** + * Compares two objects and returns a value indicating whether one is less than, equal to, or greater than the other. + * returns An integer that indicates the relative values of x and y, as shown in the following table: + * Less than zero x is less than y. + * Zero x equals y. + * Greater than zero x is greater than y.. + * @param x The first object to compare. + * @param y The second object to compare. + */ + compare(x: T, y: T): number; + } + interface ComparerConstructor { + + /** + * Returns a default sort order comparer for the type specified by the generic argument. + */ + defaultComparer: Comparer; + + /** + * Creates a comparer by using the specified comparison. + * @param comparison The comparison to use. + */ + create(comparison: (x: T, y: T) => number): Comparer; + } + + + + /** + * Provides a base class for implementations of the EqualityComparer. + */ + interface EqualityComparer { + + /** + * Determines whether the specified objects are equal. + * @param x The first object of type Object to compare. + * @param y The second object of type Object to compare. + */ + equals(x: T, y: T): boolean; + + + /** + * Returns a hash code for the specified object. + * @param obj The Object for which a hash code is to be returned. + */ + hash(obj: T): number + } + interface EqualityComparerConstructor { + + /** + * Gets a default equality comparer for the type specified by the generic argument. + */ + defaultComparer: EqualityComparer; + + + /** + * Creates an EqualityComparer by using the specified equality and hashCodeProvider. + * @param hashCodeProvider The hashCodeProvider to use for a hash code is to be returned. + * @param equality The equality function. + */ + create(hashCodeProvider: (obj: T) => number, equality: (x: T, y: T) => boolean): EqualityComparer; + } + + + + /** + * Initializes a new instance of the abstract Collection class. + */ + interface Collection extends Enumerable { + + /** + * Gets the number of elements contained in the Collection. + */ + count(): number; + + + /** + * Copies the Collection to an existing one-dimensional Array, starting at the specified array index. + * @param array The one-dimensional Array that is the destination of the elements copied from Dictionary keys. + * @param arrayIndex The zero-based index in array at which copying begins. + */ + copyTo(array: T[], arrayIndex: number): void + } + interface CollectionConstructor { + + /** + * Initializes a new instance of the Collection class that is empty. + */ + new (): Collection + + + /** + * Initializes a new instance of the Collection class that is wrapper around the specified Enumerable. + * @param value The Iterable to wrap. + */ + new (value: Iterable): Collection + } + + + + /** + * Initializes a new instance of the abstract Collection class. + */ + interface ReadOnlyCollection extends Collection { + + /** + * Gets the element at the specified index. + * @param index The zero-based index of the element to get. + */ + [index: number]: T; + + + /** + * Gets the element at the specified index. + * @param index The zero-based index of the element to get. + */ + get(index: number): T + + + /** + * Determines whether the ReadOnlyCollection contains a specific value. + * @param item The object to locate in the ReadOnlyCollection. + */ + contains(item: T): boolean + + + /** + * Searches for the specified object and returns the zero-based index of the first occurrence within the entire ReadOnlyCollection. + * @param item The object to locate in the ReadOnlyCollection. + */ + indexOf(item: T): number + } + interface ReadOnlyCollectionConstructor { + + /** + * Initializes a new instance of the ReadOnlyCollection class that is a read-only wrapper around the specified list. + * @param list The list to wrap. + */ + new (list: List): ReadOnlyCollection + } + + + + /** + * Represents a strongly typed list of objects that can be accessed by index. + */ + interface List extends Collection { + + /** + * Gets the element at the specified index. + * @param index The zero-based index of the element to get. + */ + [index: number]: T; + + + /** + * Adds an object to the end of the List. + * @param item The object to be added to the end of the List. + */ + add(item: T): void + + + /** + * Adds the elements of the specified collection to the end of the List. + * @param collection The collection whose elements should be added to the end of the List. + */ + addRange(collection: Iterable): void + + + /** + * Returns a read-only wrapper for the current list. + */ + asReadOnly(): ReadOnlyCollection + + + /** + * Searches the entire sorted List for an element using the default comparer and returns the zero-based index of the element. + * Returns The zero-based index of item in the sorted List, if item is found; otherwise, a negative number + * that is the bitwise complement of the index of the next element that is larger than item or, if there is no larger element, + * the bitwise complement of List.count(). + * @param item The object to locate. The value can be null for reference types. + */ + binarySearch(item: T): number + + + /** + * Searches the entire sorted List for an element using the specified comparer and returns the zero-based index of the element. + * returns The zero-based index of item in the sorted List, if item is found; otherwise, a negative number + * that is the bitwise complement of the index of the next element that is larger than item or, if there is no larger element, + * the bitwise complement of List.count(). + * @param item The object to locate. The value can be null for reference types. + * @param comparer The Comparer implementation to use when comparing elements. + */ + binarySearch(item: T, comparer: Comparer): number + + + /** + * Searches a range of elements in the sorted List for an element using the specified comparer and returns the zero-based index of the element. + * returns The zero-based index of item in the sorted List, if item is found; otherwise, a negative number + * that is the bitwise complement of the index of the next element that is larger than item or, if there is no larger element, + * the bitwise complement of List.count(). + * @param item The object to locate. The value can be null for reference types. + * @param index The zero-based starting index of the range to search. + * @param count The length of the range to search. + * @param comparer The Comparer implementation to use when comparing elements. + */ + binarySearch(item: T, index: number, count: number, comparer: Comparer): number + + + /** + * Removes all items from the List. + */ + clear(): void + + + /** + * Determines whether the List contains elements that match the conditions defined by the specified predicate. + * @param match The predicate function that defines the conditions of the elements to search for. + */ + exists(match: (item: T) => boolean): boolean + + + /** + * Searches for an element that matches the conditions defined by the specified predicate, and returns the first occurrence within the entire List. + * @param match The predicate function that defines the conditions of the elements to search for. + */ + find(match: (item: T) => boolean): T + + + /** + * Retrieves all the elements that match the conditions defined by the specified predicate. + * @param match The predicate function that defines the conditions of the elements to search for. + */ + findAll(match: (item: T) => boolean): List + + + /** + * Searches for an element that matches the conditions defined by the specified predicate, + * and returns the zero-based index of the first occurrence within the entire List, if found; otherwise, –1. + * @param match The predicate function that defines the conditions of the elements to search for. + */ + findIndex(match: (item: T) => boolean): number + + + /** + * Searches for an element that matches the conditions defined by the specified predicate, + * and returns the zero-based index of the first occurrence within the range of elements + * in the List that extends from the specified index to the last element, if found; otherwise, –1. + * @param startIndex The zero-based starting index of the search. + * @param match The predicate function that defines the conditions of the elements to search for. + */ + findIndex(startIndex: number, match: (item: T) => boolean): number + + + /** + * Searches for an element that matches the conditions defined by the specified predicate, + * and returns the zero-based index of the first occurrence within the range of elements + * in the List that starts at the specified index and contains the specified number of elements, if found; otherwise, –1. + * @param startIndex The zero-based starting index of the search. + * @param count The number of elements in the section to search. + * @param match The predicate function that defines the conditions of the elements to search for. + */ + findIndex(startIndex: number, count: number, match: (item: T) => boolean): number + + + /** + * Searches for an element that matches the conditions defined by the specified predicate, + * and returns the last occurrence within the entire List. + * @param match The predicate function that defines the conditions of the elements to search for. + */ + findLast(match: (item: T) => boolean): T + + + /** + * Searches for an element that matches the conditions defined by the specified predicate, + * and returns the zero-based index of the last occurrence within the entire List, if found; otherwise, –1. + * @param match The predicate function that defines the conditions of the elements to search for. + */ + findLastIndex(match: (item: T) => boolean): number + + + /** + * Searches for an element that matches the conditions defined by the specified predicate, + * and returns the zero-based index of the last occurrence within the range of elements + * in the List that extends from the first element to the specified index, if found; otherwise, –1. + * @param startIndex The zero-based starting index of the search. + * @param match The predicate function that defines the conditions of the elements to search for. + */ + findLastIndex(startIndex: number, match: (item: T) => boolean): number + + + /** + * Searches for an element that matches the conditions defined by the specified predicate, + * and returns the zero-based index of the last occurrence within the range of elements + * in the List that contains the specified number of elements and ends at the specified index, if found; otherwise, –1. + * @param startIndex The zero-based starting index of the search. + * @param count The number of elements in the section to search. + * @param match The predicate function that defines the conditions of the elements to search for. + */ + findLastIndex(startIndex: number, count: number, match: (item: T) => boolean): number + + + /** + * Performs the specified action on each element of the List. + * @param action The action function to perform on each element of the List. + */ + forEach(action: (item: T) => void): void + + + /** + * Gets the element at the specified index. + * @param index The zero-based index of the element to get. + */ + get(index: number): T + + + /** + * Creates a shallow copy of a range of elements in the source List. + * @param index The zero-based List index at which the range starts. + * @param count The number of elements in the range. + */ + getRange(index: number, count: number): List + + + /** + * Searches for the specified object and returns the zero-based index of the first occurrence within the entire List, if found; otherwise, –1. + * @param item The object to locate in the List. + */ + indexOf(item: T): number + + + /** + * Searches for the specified object and returns the zero-based index of the first occurrence within + * the range of elements in the List that extends from the specified index to the last element, if found; otherwise, –1. + * @param item The object to locate in the List. + * @param index The zero-based starting index of the search. 0 (zero) is valid in an empty list. + */ + indexOf(item: T, index: number): number + + + /** + * Inserts an element into the List at the specified index. + * @param index The zero-based index at which item should be inserted. + * @param item The object to insert. The value can be null for reference types. + */ + insert(index: number, item: T): void + + + /** + * Inserts the elements of a collection into the List at the specified index. + * @param index The zero-based index at which item should be inserted. + * @param collection The collection whose elements should be inserted into the List. + */ + insertRange(index: number, collection: Iterable): void + + + /** + * Gets an Array wrapper around the List. + */ + items(): T[] + + + /** + * Searches for the specified object and returns the zero-based index of the last occurrence within the entire List, if found; otherwise, –1. + * @param item The object to locate in the List. + */ + lastIndexOf(item: T): number + + + /** + * Searches for the specified object and returns the zero-based index of the last occurrence + * within the range of elements in the List that extends from the specified index to the last element if found; otherwise, –1. + * @param item The object to locate in the List. + * @param index The zero-based starting index of the search. 0 (zero) is valid in an empty list. + */ + lastIndexOf(item: T, index: number): number + + + /** + * Removes the first occurrence of a specific object from the List. + * @param item The object to remove from the List. + */ + remove(item: T): boolean + + + /** + * Removes all the elements that match the conditions defined by the specified predicate. + * @param match The predicate function that defines the conditions of the elements to remove. + */ + removeAll(match: (item: T) => boolean): number + + + /** + * Removes the element at the specified index of the List. + * @param index The zero-based index of the element to remove. + */ + removeAt(index: number): void + + + /** + * Removes a range of elements from the List. + * @param index The zero-based index of the element to remove. + * @param count The number of elements to remove. + */ + removeRange(index: number, count: number): void + + + /** + * Reverses the order of the elements in the entire List + */ + reverse(): any + + + /** + * Reverses the order of the elements in the entire List + * @param index The zero-based starting index of the range to reverse. + * @param count The number of elements in the range to reverse. + */ + reverse(index: number, count: number): void + + + /** + * Sets the element at the specified index. + * @param index The zero-based index of the element to set. + * @param item The object to be added at the specified index. + */ + set(index: number, value: T): void + + + /** + * Sorts the elements in the entire List using the default comparer. + */ + sort(): void + + + /** + * Sorts the elements in the entire List using the specified Comparison. + * @param comparison The comparison function to use when comparing elements. + */ + sort(comparison: (x: T, y: T) => number): void + + + /** + * Sorts the elements in the entire List using the specified comparer. + * @param comparer The Comparer implementation to use when comparing elements. + */ + sort(comparer: Comparer): void + + + /** + * Sorts the elements in a range of elements in List using the specified comparer. + * @param index The zero-based starting index of the range to sort. + * @param count The length of the range to sort. + * @param comparer The Comparer implementation to use when comparing elements. + */ + sort(index: number, count: number, comparer: Comparer): void + + + /** + * Copies the elements of the List to a new array. + */ + toArray(): T[] + + + /** + * Determines whether every element in the List matches the conditions defined by the specified predicate. + * @param match The Predicate function that defines the conditions to check against the elements. + */ + trueForAll(match: (item: T) => boolean): boolean + } + interface ListConstructor { + + /** + * Initializes a new instance of the List class that is empty. + */ + new (): List + + + /** + * Initializes a new instance of the List class that is empty and has the specified initial capacity. + * @param capacity The number of elements that the new list can initially store. + */ + new (capacity: number): List + + + /** + * Initializes a new instance of the List class that contains elements copied from the specified arguments + * @param args Arbitrary number of arguments to copy to the new list. + */ + new (...args: T[]): List + + + /** + * Initializes a new instance of the List class that contains elements copied from the specified collection + * and has sufficient capacity to accommodate the number of elements copied. + * @param collection The collection whose elements are copied to the new list. + */ + new (collection: Iterable): List + } + + + + /** + * Represents a collection of key/value pairs that are sorted by key based on the associated Comparer implementation. + */ + interface SortedList extends Collection> { + + /** + * Adds an element with the specified key and value into the SortedList. + * @param key The key of the element to add. + * @param value The value of the element to add. The value can be null for reference types. + */ + add(key: TKey, value: TValue): void + + + /** + * Gets the value associated with the specified key. + * @param key The key whose value to get. + */ + get(key: TKey): TValue + + + /** + * Gets or sets the number of elements that the SortedList can contain. + * @param value The number of elements that the SortedList can contain. + */ + capacity(value?: number): number + + + /** + * Removes all elements from the SortedList. + */ + clear(): void + + + /** + * Gets the Comparer for the sorted list. + */ + comparer(): Comparer + + + /** + * Determines whether the SortedList contains a specific key. + * @param key The key to locate in the SortedList. + */ + containsKey(key: TKey): boolean + + + /** + * Determines whether the SortedList contains a specific value. + * @param value The value to locate in the SortedList. + */ + containsValue(value: TValue): boolean + + + /** + * Gets a collection containing the keys in the SortedList, in sorted order. + */ + keys(): Collection + + + /** + * Gets a collection containing the values in the SortedLis. + */ + values(): Collection + + + /** + * Searches for the specified key and returns the zero-based index within the entire SortedList. + * @param key The key to locate in the SortedList. + */ + indexOfKey(key: TKey): number + + + /** + * Searches for the specified value and returns the zero-based index of the first occurrence within the entire SortedList. + * @param value The value to locate in the SortedList. + */ + indexOfValue(value: TValue): number + + + /** + * Removes the element with the specified key from the SortedList. + * Returns true if the element is successfully removed; otherwise, false. This method also returns false if key was not found in the original SortedList. + * @param key The key of the element to remove. + */ + remove(key: TKey): boolean + + + /** + * Removes the element at the specified index of the SortedList. + * @param index The zero-based index of the element to remove. + */ + removeAt(index: number): void + + + /** + * Sets the value associated with the specified key. + * @param key The key whose value to get or set. + * @param value The value associated with the specified key. + */ + set(key: TKey, value: TValue): void + + + /** + * Sets the capacity to the actual number of elements in the SortedList, if that number is less than 90 percent of current capacity. + */ + trimExcess(): void + + + /** + * Gets the value associated with the specified key. + * @param key The key whose value to get. + * @param callback When this method returns, callback method is called with the value + * associated with the specified key, if the key is found; otherwise, null for the type of the value parameter. + */ + tryGetValue(key: TKey, callback: (value: TValue) => void): boolean + } + interface SortedListConstructor { + + /** + * Initializes a new instance of the SortedList class that is empty, + * has the default initial capacity, and uses the default Comparer. + */ + new (): SortedList + + + /** + * Initializes a new instance of the SortedList class that contains elements copied from the specified Dictionary, + * has sufficient capacity to accommodate the number of elements copied, and uses the default Comparer. + * @param dictionary The Dictionary whose elements are copied to the new SortedList. + */ + new (dictionary: Dictionary): SortedList + + + /** + * Initializes a new instance of the SortedList class that is empty, + * has the default initial capacity, and uses the specified Comparer. + * @param comparer The Comparer implementation to use when comparing keys.-or-null to use the default Comparer for the type of the key. + */ + new (comparer: Comparer): SortedList + + + /** + * Initializes a new instance of the SortedList class that is empty, + * has the specified initial capacity, and uses the default Comparer. + * @param capacity The initial number of elements that the SortedList can contain. + */ + new (capacity: number): SortedList + + + /** + * Initializes a new instance of the SortedList class that contains elements copied from the specified Dictionary, + * has sufficient capacity to accommodate the number of elements copied, and uses the specified Comparer. + * @param dictionary The Dictionary whose elements are copied to the new SortedList. + * @param comparer The Comparer implementation to use when comparing keys.-or-null to use the default Comparer for the type of the key. + */ + new (dictionary: Dictionary, comparer: Comparer): SortedList + + + /** + * Initializes a new instance of the SortedList class that is empty, + * has the specified initial capacity, and uses the specified Comparer. + * @param capacity The initial number of elements that the SortedList can contain. + * @param comparer The Comparer implementation to use when comparing keys.-or-null to use the default Comparer for the type of the key. + */ + new (capacity: number, comparer: Comparer): SortedList + } + + + + /** + * Defines a key/value pair that can be set or retrieved. + */ + interface KeyValuePair { + + /** + * Gets the key in the key/value pair. + */ + key: TKey; + + + /** + * Gets the value in the key/value pair. + */ + value: TValue; + } + interface KeyValuePairConstructor { + + /** + * Initializes a new instance of the KeyValuePair with the specified key and value. + * @param key The object defined in each key/value pair. + * @param value The definition associated with key. + */ + new (key: TKey, value: TValue): KeyValuePair + } + + + + /** + * Represents a collection of keys and values. + */ + interface Dictionary extends Collection> { + + /** + * Adds an element with the provided key and value to the Dictionary. + * @param key The object to use as the key of the element to add. + * @param value The object to use as the value of the element to add. + */ + add(key: TKey, value: TValue): void + + + /** + * Removes all keys and values from the Dictionary. + */ + clear(): void + + + /** + * Determines whether the Dictionary contains the specified key. + * @param key The key to locate in the Dictionary. + */ + containsKey(key: TKey): boolean + + + /** + * Determines whether the Dictionary contains a specific value. + * @param value The value to locate in the Dictionary. + */ + containsValue(value: TValue): boolean + + + /** + * Copies the Dictionary keys to an existing one-dimensional Array, starting at the specified array index. + * @param array The one-dimensional Array that is the destination of the elements copied from Dictionary keys. + * @param arrayIndex The zero-based index in array at which copying begins. + */ + copyTo(array: TKey[], arrayIndex: number): void + copyTo(array: KeyValuePair[], arrayIndex: number): void + + + /** + * Gets a Collection containing the keys of the Dictionary. + */ + keys(): Collection + + + /** + * Gets a Collection containing the values in the Dictionary. + */ + values(): Collection + + + /** + * Gets element with the specified key. + * @param key The key of the element to get. + */ + get(key: TKey): TValue + + + /** + * Sets the element with the specified key. + * @param key The key of the element to set. + * @param value The object to use as the value of the element to set. + */ + set(key: TKey, value: TValue): void + + + /** + * Gets the value associated with the specified key. + * @param key The key whose value to get. + * @param callback When this method returns, callback method is called with the value + * associated with the specified key, if the key is found; otherwise, null for the type of the value parameter. + */ + tryGetValue(key: TKey, callback: (value: TValue) => void): boolean + + + /** + * Removes the element with the specified key from the Dictionary. + * @param key The key of the element to remove. + */ + remove(key: TKey): boolean + } + interface DictionaryConstructor { + + /** + * Initializes a new instance of the Dictionary class that is empty, + */ + new (): Dictionary + + + /** + * Initializes a new instance of the Dictionary class that contains elements copied + * from the specified Dictionary and uses the default equality comparer for the key type. + * @param dictionary The Dictionary whose elements are copied to the new Dictionary. + */ + new (dictionary: Dictionary): Dictionary + + + /** + * Initializes a new instance of the Dictionary class that is empty, and uses the specified EqualityComparer. + * @param comparer The EqualityComparer implementation to use when comparing keys. + */ + new (comparer: EqualityComparer): Dictionary + + + /** + * Initializes a new instance of the Dictionary class that is empty, has the specified initial capacity, and uses the default equality comparer for the key type. + * @param capacity The initial number of elements that the Dictionary can contain. + */ + new (capacity: number): Dictionary + + + /** + * Initializes a new instance of the Dictionary that is empty, has the specified initial capacity, and uses the specified EqualityComparer. + * @param capacity The initial number of elements that the Dictionary can contain. + * @param comparer The EqualityComparer implementation to use when comparing keys. + */ + new (capacity: number, comparer: EqualityComparer): Dictionary + + + /** + * Initializes a new instance of the Dictionary class that contains elements copied + * from the specified Dictionary and uses the specified EqualityComparer. + * @param dictionary The Dictionary whose elements are copied to the new Dictionary. + * @param comparer The EqualityComparer implementation to use when comparing keys. + */ + new (dictionary: Dictionary, comparer: EqualityComparer): Dictionary + } + + + + /** + * Represents a set of values. + */ + interface HashSet extends Collection { + + /** + * Adds an element to the current set. + * @param item The element to add to the set. + */ + add(item: T): boolean + + + /** + * Removes all elements from a HashSet object. + */ + clear(): void + + + /** + * Copies the elements of a HashSet object to an array. + * @param array The one-dimensional array that is the destination of the elements copied from the HashSet object. + */ + copyTo(array: T[]): void + + + /** + * Copies the elements of a HashSet object to an array. starting at the specified array index. + * @param array The one-dimensional array that is the destination of the elements copied from the HashSet object. + * @param arrayIndex The zero-based index in array at which copying begins. + */ + copyTo(array: T[], arrayIndex: number): void + + + /** + * Copies the elements of a HashSet object to an array. + * @param array The one-dimensional array that is the destination of the elements copied from the HashSet object. + * @param arrayIndex The zero-based index in array at which copying begins. + * @param count The number of elements to copy to array. + */ + copyTo(array: T[], arrayIndex: number, count: number): void + + + /** + * Gets the EqualityComparer object that is used to determine equality for the values in the set. + */ + comparer(): EqualityComparer + + + /** + * Removes the specified element from a HashSet object. + * @param item The element to remove. + */ + remove(item: T): boolean + + + /** + * Removes all elements that match the conditions defined by the specified predicate from a HashSet collection. + * @param match The predicate function that defines the conditions of the elements to remove. + */ + removeWhere(match: (item: T) => boolean): number + + + /** + * Removes all elements in the specified collection from the current set. + * @param other The collection of items to remove from the set. + */ + exceptWith(other: Iterable): void + + + /** + * Modifies the current set so that it contains only elements that are also in a specified collection. + * @param other The collection to compare to the current set. + */ + intersectWith(other: Iterable): void + + + /** + * Determines whether the current set is a proper (strict) subset of a specified collection. + * @param other The collection to compare to the current set. + */ + isProperSubsetOf(other: Iterable): boolean + + + /** + * Determines whether the current set is a proper (strict) superset of a specified collection. + * @param other The collection to compare to the current set. + */ + isProperSupersetOf(other: Iterable): boolean + + + /** + * Determines whether a set is a subset of a specified collection. + * @param other The collection to compare to the current set. + */ + isSubsetOf(other: Iterable): boolean + + + /** + * Determines whether the current set is a superset of a specified collection. + * @param other The collection to compare to the current set. + */ + isSupersetOf(other: Iterable): boolean + + + /** + * Determines whether the current set overlaps with the specified collection. + * @param other The collection to compare to the current set. + */ + overlaps(other: Iterable): boolean + + + /** + * Determines whether the current set and the specified collection contain the same elements. + * @param other The collection to compare to the current set. + */ + setEquals(other: Iterable): boolean + + + /** + * Modifies the current set so that it contains only elements that are present + * either in the current set or in the specified collection, but not both. + * @param other The collection to compare to the current set. + */ + symmetricExceptWith(other: Iterable): void + + + /** + * Modifies the current set so that it contains all elements that are present + * in either the current set or the specified collection. + * @param other The collection to compare to the current set. + */ + unionWith(other: Iterable): void + + } + interface HashSetConstructor { + + /** + * Initializes a new instance of the HashSet class that is empty and uses the default equality comparer for the set type. + */ + new (): HashSet + + + /** + * Initializes a new instance of the HashSet class that uses the default equality comparer for the set type, + * and contains elements copied from the specified collection. + * @param collection The collection whose elements are copied to the new set. + */ + new (collection: Iterable): HashSet + + + /** + * Initializes a new instance of the HashSet class that is empty and uses the specified equality comparer for the set type. + * @param comparer The EqualityComparer implementation to use when comparing values in the set. + */ + new (comparer: EqualityComparer): HashSet + + + /** + * Initializes a new instance of the HashSet class that uses the specified equality comparer for the set type, + * contains elements copied from the specified collection, and uses the specified equality comparer for the set type. + * @param collection The collection whose elements are copied to the new set. + * @param comparer The EqualityComparer implementation to use when comparing values in the set. + */ + new (collection: Iterable, comparer: EqualityComparer): HashSet + } + + + + /** + * Represents a node in a LinkedList. + */ + interface LinkedListNode { + + /** + * Gets the value contained in the node. + */ + value(): T + + + /** + * Gets the LinkedList that the LinkedListNode belongs to. + */ + list(): LinkedList + + + /** + * Gets the next node in the LinkedList. + */ + next(): LinkedListNode + + + /** + * Gets the previous node in the LinkedList. + */ + previous(): LinkedListNode + } + interface LinkedListNodeConstructor { + + /** + * Initializes a new instance of the LinkedListNode class, containing the specified value. + * @param value The value to contain in the LinkedListNode + */ + new (value: T): LinkedListNode + } + + + + /** + * Represents a doubly linked list. + */ + interface LinkedList extends Collection { + + /** + * Adds an item to the LinkedList. + * @param item The object to add to the LinkedList. + */ + add(item: T): void + + + /** + * Removes all nodes from the LinkedList. + */ + clear(): void + + + /** + * Determines whether a value is in the LinkedList. + * @param value The value to locate in the LinkedList. The value can be null for reference types. + */ + contains(item: T): boolean + + + /** + * Gets the first node of the LinkedList. + */ + getFirst(): LinkedListNode + + + /** + * Gets the last node of the LinkedList. + */ + getLast(): LinkedListNode + + + /** + * Adds the specified new node after the specified existing node in the LinkedList and returns the new LinkedListNode. + * @param node The LinkedListNode after which to insert newNode. + * @param newNode The new LinkedListNode to add to the LinkedList. + */ + addAfter(node: LinkedListNode, newNode: LinkedListNode): LinkedListNode + + + /** + * Adds the specified new node after the specified existing node in the LinkedList. + * returns The new LinkedListNode containing value. + * @param node The LinkedListNode after which to insert newNode. + * @param value The value to add to the LinkedList. + */ + addAfter(node: LinkedListNode, value: T): LinkedListNode + + + /** + * Adds the specified new node before the specified existing node in the LinkedList. + * returns The new LinkedListNode. + * @param node The LinkedListNode before which to insert newNode. + * @param newNode The new LinkedListNode to add to the LinkedList. + */ + addBefore(node: LinkedListNode, newNode: LinkedListNode): LinkedListNode + + + /** + * Adds the specified new node before the specified existing node in the LinkedList. + * returns The new LinkedListNode containing value. + * @param node The LinkedListNode before which to insert newNode. + * @param value The value to add to the LinkedList. + */ + addBefore(node: LinkedListNode, value: T): LinkedListNode + + + /** + * Adds the specified new node at the start of the LinkedList. + * returns The new LinkedListNode. + * @param node The new LinkedListNode to add at the start of the LinkedList. + */ + addFirst(node: LinkedListNode): LinkedListNode + + + /** + * Adds the specified new node at the start of the LinkedList. + * returns The new LinkedListNode containing value. + * @param value The value to add at the start of the LinkedList. + */ + addFirst(value: T): LinkedListNode + + + /** + * Adds the specified new node at the end of the LinkedList. + * returns The new LinkedListNode. + * @param node The new LinkedListNode to add at the end of the LinkedList. + */ + addLast(node: LinkedListNode): LinkedListNode + + + /** + * Adds the specified new node at the end of the LinkedList. + * returns The new LinkedListNode containing value. + * @param value The value to add at the end of the LinkedList. + */ + addLast(value: T): LinkedListNode + + + /** + * Finds the first node that contains the specified value. + * @param value The value to locate in the LinkedList. + */ + find(value: T): LinkedListNode + + + /** + * Finds the last node that contains the specified value. + * @param value The value to locate in the LinkedList. + */ + findLast(value: T): LinkedListNode + + /** + * Removes the node at the start of the LinkedList. + * returns true if the node is successfully removed; otherwise, false. + * This method also returns false if value was not found in the original LinkedList. + * @param node + */ + remove(node: LinkedListNode): boolean + + + /** + * Removes the first occurrence of the specified value from the LinkedList. + * returns true if the element containing value is successfully removed; otherwise, false. + * This method also returns false if value was not found in the original LinkedList. + * @param value The value to remove from the LinkedList. + */ + remove(value: T): boolean + + + /** + * Removes the node at the start of the LinkedList. + */ + removeFirst(): void + + + /** + * Removes the node at the end of the LinkedList. + */ + removeLast(): void + } + interface LinkedListConstructor { + + /** + * Initializes a new instance of the LinkedList class that is empty. + */ + new (): LinkedList + + + /** + * Initializes a new instance of the LinkedList class that contains elements copied from the specified Enumerable. + * @param collection The collection to copy elements from. + */ + new (collection: Iterable): LinkedList + } + + + + /** + * Represents a first-in, first-out collection of objects. + */ + interface Queue extends Collection { + + /** + * Removes all objects from the Queue. + */ + clear(): void + + + /** + * Determines whether an element is in the Queue. + * @param item The object to locate in the Queue. + */ + contains(item: T): boolean + + + /** + * Removes and returns the object at the beginning of the Queue. + */ + dequeue(): T + + /** + * Adds an object to the end of the Queue. + * @param item The object to add to the Queue. + */ + enqueue(item: T): void + + + /** + * Returns the object at the beginning of the Queue without removing it. + */ + peek(): T + + + /** + * Copies the Queue to a new array. + */ + toArray(): T[] + } + interface QueueConstructor { + + /** + * Initializes a new instance of the Queue class that is empty. + */ + new (): Queue + + + /** + * Initializes a new instance of the Queue class that contains elements copied from the specified collection. + * @param collection The collection to copy elements from. + */ + new (collection: Iterable): Queue + } + + + + /** + * Represents a variable size last-in-first-out (LIFO) collection of instances of the same arbitrary type. + */ + interface Stack extends Collection { + + /** + * Removes all objects from the Stack. + */ + clear(): void + + + /** + * Determines whether an element is in the Stack. + * @param item The object to locate in the Stack. + */ + contains(item: T): boolean + + + /** + * Returns the object at the top of the Stack without removing it. + */ + peek(): T + + + /** + * Removes and returns the object at the top of the Stack. + */ + pop(): T + + + /** + * Inserts an object at the top of the Stack. + * @param item The object to push onto the Stack. + */ + push(item: T): void + + + /** + * Copies the Stack to a new array. + */ + toArray(): T[] + } + interface StackConstructor { + + /** + * Initializes a new instance of the Stack class that is empty. + */ + new (): Stack + + + /** + * Initializes a new instance of the Stack class that contains elements copied from the specified collection. + * @param collection The collection to copy elements from. + */ + new (collection: Iterable): Stack + } + + + + /** + * Defines a data structures that map keys to Enumerable sequences of values. + */ + interface Lookup extends Collection> { + + /** + * Determines whether a specified key exists in the Lookup. + * @param key The key to search for in the Lookup. + */ + contains(key: TKey): boolean + contains(item: Grouping): boolean + + + + /** + * Gets the value associated with the specified key. + * @param key The key of the element to add. + */ + get(key: TKey): Enumerable + } + + + + /** + * Represents a collection of objects that have a common key. + */ + interface Grouping extends Collection { + + /** + * Gets the key of the Grouping. + */ + key: TKey + } + + + + /** + * Exposes the enumerator, which supports a simple iteration over a collection of a specified type. + */ + interface OrderedEnumerable extends Enumerable { + + /** + * Performs a subsequent ordering on the elements of an OrderedEnumerable according to a key. + * @param keySelector The selector used to extract the key for each element. + * @param comparer The Comparer used to compare keys for placement in the returned sequence. + * @param descending true to sort the elements in descending order; false to sort the elements in ascending order. + */ + createOrderedEnumerable(keySelector: (item: TElement) => TKey, comparer: Comparer, descending: boolean): OrderedEnumerable + + + /** + * Performs a subsequent ordering of the elements in a sequence in descending order, according to a key. + * Returns an OrderedEnumerable whose elements are sorted in descending order according to a key. + * @param keySelector A function to extract a key from each element. + */ + thenBy(keySelector: (item: TElement) => TKey): OrderedEnumerable + + + /** + * Performs a subsequent ordering of the elements in a sequence in ascending order by using a specified comparer. + * Returns an OrderedEnumerable whose elements are sorted according to a key. + * @param keySelector A function to extract a key from each element. + * @param comparer A Comparer to compare keys. + */ + thenBy(keySelector: (item: TElement) => TKey, comparer: Comparer): OrderedEnumerable + + + /** + * Performs a subsequent ordering of the elements in a sequence in descending order, according to a key. + * Returns an OrderedEnumerable whose elements are sorted in descending order according to a key. + * @param keySelector A function to extract a key from each element. + */ + thenByDescending(keySelector: (item: TElement) => TKey): OrderedEnumerable + + + /** + * Performs a subsequent ordering of the elements in a sequence in descending order, according to a key. + * Returns an OrderedEnumerable whose elements are sorted in descending order according to a key. + * @param keySelector A function to extract a key from each element. + * @param comparer A Comparer to compare keys. + */ + thenByDescending(keySelector: (item: TElement) => TKey, comparer: Comparer): OrderedEnumerable + } + + + + /** + * Defines Enumerable extention methods applied on Enumerable + */ + interface Enumerable { + + + /** + * Applies an accumulator function over a sequence. + * Returns the final accumulator value. + * @param func An accumulator function to be invoked on each element. + */ + aggregate(func: (accumulate: T, item: T) => T): T + + + /** + * Applies an accumulator function over a sequence. The specified seed value is used as the initial accumulator value. + * Returns the final accumulator value. + * @param seed The initial accumulator value. + * @param func An accumulator function to be invoked on each element. + */ + aggregate(seed: TAccumulate, func: (accumulate: TAccumulate, item: T) => TAccumulate): TAccumulate + + + /** + * Applies an accumulator function over a sequence. The specified seed value is used as the initial accumulator value, + * and the specified function is used to select the result value. + * Returns the final accumulator value. + * @param seed The initial accumulator value. + * @param func An accumulator function to be invoked on each element. + * @param resultSelector A function to transform the final accumulator value into the result value. + */ + aggregate(seed: TAccumulate, func: (accumulate: TAccumulate, item: T) => TAccumulate, resultSelector: (accumulate: TAccumulate) => TResult): TResult; + + + /** + * Determines whether all elements of a sequence satisfy a condition. + * Returns true if every element of the source sequence passes the test in the specified predicate, or if the sequence is empty; otherwise, false. + * @param predicate A function to test each element for a condition. + */ + all(predicate: (item: T) => boolean): boolean + + + /** + * Determines whether a sequence contains any elements. + * Returns true if the source sequence contains any elements; otherwise, false. + */ + any(): boolean + + + /** + * Determines whether any element of a sequence satisfies a condition. + * Returns true if any elements in the source sequence pass the test in the specified predicate; otherwise, false. + * @param predicate A function to test each element for a condition. + */ + any(predicate: (item: T) => boolean): boolean + + + /** + * Returns the input typed as Enumerable. + */ + asEnumerable(): Enumerable + + + /** + * Computes the average of a sequence of numeric values. + */ + average(): number + + + /** + * Computes the average of a sequence of numeric values that are obtained by invoking a transform function on each element of the input sequence. + * @param selector A transform function to apply to each element. + */ + average(selector: (item: number) => number): number + + + /** + * Concatenates two sequences. + * @param second The sequence to concatenate to the first sequence. + */ + concat(second: Iterable): Enumerable + + + /** + * Determines whether a sequence contains a specified element by using the default equality comparer. + * @param value The value to locate in the sequence. + */ + contains(value: T): boolean + + + /** + * Returns the last element of a sequence that satisfies a specified condition. + * @param value The value to locate in the sequence. + * @param comparer An equality comparer to compare values. + */ + contains(value: T, comparer: EqualityComparer): boolean + + + /** + * Returns the number of elements in a sequence. + */ + count(): number + + + /** + * Returns a number that represents how many elements in the specified sequence satisfy a condition. + * @param predicate A function to test each element for a condition. + */ + count(predicate: (item: T) => boolean): number + + + /** + * Returns the elements of the specified sequence or null if the sequence is empty. + */ + defaultIfEmpty(): Enumerable + + + /** + * Returns the elements of the specified sequence or the specified value in a singleton collection if the sequence is empty. + * @param defaultValue The value to return if the sequence is empty. + */ + defaultIfEmpty(defaultValue: T): Enumerable + + + /** + * Returns distinct elements from a sequence by using the default equality comparer to compare values. + */ + distinct(): Enumerable + + + /** + * Produces the set difference of two sequences by using the EqualityComparer to compare values. + * @param comparer An EqualityComparer to compare values. + */ + distinct(comparer: EqualityComparer): Enumerable + + + /** + * Produces the set difference of two sequences by using the default equality comparer to compare values. + * @param second An Iterable whose elements that also occur in the first sequence will cause those elements to be removed from the returned sequence. + */ + except(second: Iterable): Enumerable + + + /** + * Produces the set difference of two sequences by using the specified EqualityComparer to compare values. + * @param second An Iterable whose elements that also occur in the first sequence will cause those elements to be removed from the returned sequence. + * @param comparer An EqualityComparer to compare values. + */ + except(second: Iterable, comparer: EqualityComparer): Enumerable + + + /** + * Returns the element at a specified index in a sequence. Throws an error if the index is less than 0 or greater than or equal to the number of elements in source. + * @param index The zero-based index of the element to retrieve. + */ + elementAt(index: number): T + + + /** + * Returns the first element of a sequence. this method throws an exception if there is no element in the sequence. + */ + first(): T + + + /** + * Returns the first element in a sequence that satisfies a specified condition. this method throws an exception if there is no element in the sequence. + * @param predicate A function to test each source element for a condition; the second parameter of the function represents the index of the source element. + */ + first(predicate: (item: T) => boolean): T + + + /** + * Returns the first element of a sequence, or null if the sequence contains no elements. + */ + firstOrDefault(): T + + + /** + * Returns the first element of the sequence that satisfies a condition or null if no such element is found. + * @param predicate A function to test each source element for a condition; the second parameter of the function represents the index of the source element. + */ + firstOrDefault(predicate: (item: T) => boolean): T + + + /** + * Returns the first element of the sequence that satisfies a condition or a default value if no such element is found. + * @param predicate A function to test each source element for a condition; the second parameter of the function represents the index of the source element. + * @param defaultValue The value to return if no element exists with specified condition. + */ + firstOrDefault(predicate: (item: T) => boolean, defaultValue: T): T + + + /** + * Performs the specified action on each element of an Enumerable. + * @param action The action function to perform on each element of an Enumerable. + */ + forEach(action: (item: T) => void): void + + + /** + * Performs the specified action on each element of an Enumerable. + * @param action The action function to perform on each element of an Enumerable; the second parameter of the function represents the index of the source element. + */ + forEach(action: (item: T, index: number) => void): void + + + /** + * Groups the elements of a sequence according to a specified key selector function. + * @param keySelector A function to extract the key for each element. + */ + groupBy(keySelector: (item: T) => TKey): Enumerable>; + + + /** + * Groups the elements of a sequence according to a specified key selector function. + * @param keySelector A function to extract the key for each element. + * @param comparer An equality comparer to compare values. + */ + groupBy(keySelector: (item: T) => TKey, comparer: EqualityComparer): Enumerable>; + + + /** + * Groups the elements of a sequence according to a specified key selector function and projects the elements for each group by using a specified function. + * @param keySelector A function to extract the key for each element. + * @param elementSelector A function to map each source element to an element in the Grouping. + */ + groupBy(keySelector: (item: T) => TKey, elementSelector: (item: T) => TElement): Enumerable>; + + + /** + * Groups the elements of a sequence according to a key selector function. + * The keys are compared by using a comparer and each group's elements are projected by using a specified function. + * @param keySelector A function to extract the key for each element. + * @param elementSelector A function to map each source element to an element in the Grouping. + * @param comparer An equality comparer to compare values. + */ + groupBy(keySelector: (item: T) => TKey, elementSelector: (item: T) => TElement, comparer: EqualityComparer): Enumerable>; + + + /** + * Groups the elements of a sequence according to a specified key selector function and projects the elements for each group by using a specified function. + * @param keySelector A function to extract the key for each element. + * @param elementSelector A function to map each source element to an element in the Grouping. + * @param resultSelector A function to extract the key for each element. + */ + groupBy(keySelector: (item: T) => TKey, elementSelector: (item: T) => TElement, resultSelector: (key: TKey, elements: Iterable) => TResult): Enumerable; + + + /** + * Groups the elements of a sequence according to a key selector function. + * The keys are compared by using a comparer and each group's elements are projected by using a specified function. + * @param keySelector A function to extract the key for each element. + * @param elementSelector A function to map each source element to an element in the Grouping. + * @param resultSelector A function to extract the key for each element. + * @param comparer An equality comparer to compare values. + */ + groupBy(keySelector: (item: T) => TKey, elementSelector: (item: T) => TElement, resultSelector: (key: TKey, elements: Iterable) => TResult, comparer: EqualityComparer): Enumerable; + + + /** + * Correlates the elements of two sequences based on equality of keys and groups the results. The default equality comparer is used to compare keys. + * @param inner The sequence to join to the current sequence. + * @param outerKeySelector A function to extract the join key from each element of the first sequence. + * @param innerKeySelector A function to extract the join key from each element of the second sequence. + * @param resultSelector A function to create a result element from an element from the first sequence and a collection of matching elements from the second sequence. + */ + groupJoin(inner: Iterable, outerKeySelector: (item: T) => TKey, innerKeySelector: (item: TInner) => TKey, resultSelector: (outer: T, inner: Enumerable) => TResult): Enumerable; + + + /** + * Correlates the elements of two sequences based on key equality and groups the results. A specified EqualityComparer is used to compare keys. + * @param inner The sequence to join to the current sequence. + * @param outerKeySelector A function to extract the join key from each element of the first sequence. + * @param innerKeySelector A function to extract the join key from each element of the second sequence. + * @param resultSelector A function to create a result element from an element from the first sequence and a collection of matching elements from the second sequence. + * @param comparer An equality comparer to compare values. + */ + groupJoin(inner: Iterable, outerKeySelector: (item: T) => TKey, innerKeySelector: (item: TInner) => TKey, resultSelector: (outer: T, inner: Enumerable) => TResult, comparer: EqualityComparer): Enumerable; + + + /** + * Produces the set intersection of two sequences by using the default equality comparer to compare values. + * @param second An Iterable whose distinct elements that also appear in the first sequence will be returned. + */ + intersect(second: Iterable): Enumerable; + + + /** + * Produces the set intersection of two sequences by using the default equality comparer to compare values. + * @param second An Iterable whose distinct elements that also appear in the first sequence will be returned. + * @param comparer An EqualityComparer to compare values. + */ + intersect(second: Iterable, comparer: EqualityComparer): Enumerable; + + + /** + * Correlates the elements of two sequences based on matching keys. The default equality comparer is used to compare keys. + * @param inner The sequence to join to the current sequence. + * @param outerKeySelector A function to extract the join key from each element of the first sequence. + * @param innerKeySelector A function to extract the join key from each element of the second sequence. + * @param resultSelector A function to create a result element from an element from the first sequence and a collection of matching elements from the second sequence. + */ + join(inner: Iterable, outerKeySelector: (item: T) => TKey, innerKeySelector: (item: TInner) => TKey, resultSelector: (outer: T, inner: TInner) => TResult): Enumerable; + + + /** + * Correlates the elements of two sequences based on matching keys. A specified EqualityComparer is used to compare keys. + * @param inner The sequence to join to the current sequence. + * @param outerKeySelector A function to extract the join key from each element of the first sequence. + * @param innerKeySelector A function to extract the join key from each element of the second sequence. + * @param resultSelector A function to create a result element from an element from the first sequence and a collection of matching elements from the second sequence. + * @param comparer An equality comparer to compare values. + */ + join(inner: Iterable, outerKeySelector: (item: T) => TKey, innerKeySelector: (item: TInner) => TKey, resultSelector: (outer: T, inner: TInner) => TResult, comparer: EqualityComparer): Enumerable; + + + /** + * Returns the last element of a sequence. + */ + last(): T + + + /** + * Returns the last element of a sequence that satisfies a specified condition. + * @param predicate A function to test each source element for a condition. + */ + last(predicate: (item: T) => boolean): T + + + /** + * Returns the first element of a sequence, or null if the sequence contains no elements. + */ + lastOrDefault(): T + + + /** + * Returns the last element of a sequence, or null if the sequence contains no elements. + * @param predicate A function to test each source element for a condition. + */ + lastOrDefault(predicate: (item: T) => boolean): T + + + /** + * Returns the last element of a sequence that satisfies a condition or null if no such element is found. + * @param predicate A function to test each source element for a condition. + * @param defaultValue The value to return if no element exists with specified condition. + */ + lastOrDefault(predicate: (item: T) => boolean, defaultValue: T): T + + + /** + * Returns the maximum value in a sequence of values. + */ + max(): T + + + /** + * Invokes a transform function on each element of a sequence and returns the maximum value. + * @param selector A transform function to apply to each element. + */ + max(selector: (item: T) => TResult): TResult + + + /** + * Returns the minimum value in a sequence of values. + */ + min(): T + + + /** + * Invokes a transform function on each element of a sequence and returns the minimum value. + * @param selector A transform function to apply to each element. + */ + min(selector: (item: T) => TResult): TResult + + + /** + * Filters the elements of an Enumerable based on a specified type. + * @param type The type to filter the elements of the sequence on. + */ + ofType(type: { new (...args: any[]): TResult }): Enumerable + + + /** + * Sorts the elements of a sequence in ascending order by using a specified comparer. + * @param keySelector A function to extract a key from each element. + */ + orderBy(keySelector: (item: T) => TKey): OrderedEnumerable + + + /** + * Sorts the elements of a sequence in ascending order by using a specified comparer. + * Returns an OrderedEnumerable whose elements are sorted according to a key. + * @param keySelector A function to extract a key from each element. + * @param comparer A Comparer to compare keys. + */ + orderBy(keySelector: (item: T) => TKey, comparer: EqualityComparer): OrderedEnumerable + + + /** + * Sorts the elements of a sequence in descending order by using a specified comparer. + * Returns an OrderedEnumerable whose elements are sorted according to a key. + * Returns an OrderedEnumerable whose elements are sorted in descending order according to a key. + * @param keySelector A function to extract a key from each element. + */ + orderByDescending(keySelector: (item: T) => TKey): OrderedEnumerable + + + /** + * Sorts the elements of a sequence in descending order by using a specified comparer. + * Returns an OrderedEnumerable whose elements are sorted in descending order according to a key. + * @param keySelector A function to extract a key from each element. + * @param comparer A Comparer to compare keys. + */ + orderByDescending(keySelector: (item: T) => TKey, comparer: EqualityComparer): OrderedEnumerable + + + /** + * Inverts the order of the elements in a sequence. + */ + reverse(): Enumerable + + + /** + * Determines whether two sequences are equal by comparing the elements by using the default equality comparer for their type. + * @param second An Iterable to compare to the first sequence. + */ + sequenceEqual(second: Iterable): boolean + + + /** + * Determines whether two sequences are equal by comparing their elements by using a specified EqualityComparer. + * @param second An Iterable to compare to the first sequence. + * @param comparer The EqualityComparer to compare values. + */ + sequenceEqual(second: Iterable, comparer: EqualityComparer): boolean + + + /** + * Projects each element of a sequence into a new form. + * @param selector A transform function to apply to each source element. + */ + select(selector: (item: T) => TResult): Enumerable + + + /** + * Projects each element of a sequence into a new form by incorporating the element's index. + * @param selector A transform function to apply to each source element; the second parameter of the function represents the index of the source element. + */ + select(selector: (item: T, index: number) => TResult): Enumerable + + + /** + * Projects each element of a sequence to an Enumerable and flattens the resulting sequences into one sequence. + * @param collectionSelector A transform function to apply to each source element. + */ + selectMany(selector: (item: T) => Iterable): Enumerable; + + + /** + * Projects each element of a sequence to an Enumerable and flattens the resulting sequences into one sequence. The index of each source element is used in the projected form of that element. + * @param collectionSelector A transform function to apply to each source element; the second parameter of the function represents the index of the source element. + */ + selectMany(selector: (item: T, index: number) => Iterable): Enumerable; + + + /** + * Projects each element of a sequence to an Enumerable and flattens the resulting sequences into one sequence. + * @param collectionSelector A transform function to apply to each source element; the second parameter of the function represents the index of the source element. + * @param resultSelector A transform function to apply to each element of the intermediate sequence. + */ + selectMany(collectionSelector: (item: T) => Iterable, resultSelector: (item: T, collection: TCollection) => TResult): Enumerable; + + + /** + * Projects each element of a sequence to an Enumerable and flattens the resulting sequences into one sequence. The index of each source element is used in the projected form of that element. + * @param collectionSelector A transform function to apply to each source element; the second parameter of the function represents the index of the source element. + * @param resultSelector A transform function to apply to each element of the intermediate sequence. + */ + selectMany(collectionSelector: (item: T, index: number) => Iterable, resultSelector: (item: T, collection: TCollection) => TResult): Enumerable; + + + /** + * Returns the only element of a sequence, and throws an exception if there is not exactly one element in the sequence. + */ + single(): T + + + /** + * Returns the only element of a sequence that satisfies a specified condition, and throws an exception if more than one such element exists. + * @param predicate A function to test each source element for a condition. + */ + single(predicate: (item: T) => boolean): T + + + /** + * Returns the only element of a sequence, or a null if the sequence is empty; this method throws an exception if there is more than one element in the sequence. + */ + singleOrDefault(): T + + + /** + * Returns the only element of a sequence that satisfies a specified condition or a null if no such element exists; this method throws an exception if more than one element satisfies the condition. + * @param predicate A function to test each source element for a condition. + */ + singleOrDefault(predicate: (item: T) => boolean): T + + + /** + * Returns the only element of a sequence that satisfies a specified condition or a default value if no such element exists; this method throws an exception if more than one element satisfies the condition. + * @param predicate A function to test each source element for a condition. + * @param defaultValue The value to return if no element exists with specified condition. + */ + singleOrDefault(predicate: (item: T) => boolean, defaultValue: T): T + + + /** + * Bypasses a specified number of elements in a sequence and then returns the remaining elements. + * @param count The number of elements to skip before returning the remaining elements. + */ + skip(count: number): Enumerable + + + /** + * Bypasses elements in a sequence as long as a specified condition is true and then returns the remaining elements. + * @param predicate A function to test each source element for a condition. + */ + skipWhile(predicate: (item: T) => boolean): Enumerable + + + /** + * Bypasses elements in a sequence as long as a specified condition is true and then returns the remaining elements. The element's index is used in the logic of the predicate function. + * @param predicate A function to test each source element for a condition; the second parameter of the function represents the index of the source element. + */ + skipWhile(predicate: (item: T, index: number) => boolean): Enumerable + + + /** + * Computes the sum of a sequence of values. + */ + sum(): number + + + /** + * Computes the sum of the sequence of values that are obtained by invoking a transform function on each element of the input sequence. + * @param selector A transform function to apply to each element. + */ + sum(selector: (item: T) => number): number + + + /** + * Returns a specified number of contiguous elements from the start of a sequence. + * @param count The number of elements to return. + */ + take(count: number): Enumerable + + + /** + * Returns elements from a sequence as long as a specified condition is true. + * @param predicate A function to test each source element for a condition. + */ + takeWhile(predicate: (item: T) => boolean): Enumerable + + + /** + * Returns elements from a sequence as long as a specified condition is true. The element's index is used in the logic of the predicate function. + * @param predicate A function to test each source element for a condition; the second parameter of the function represents the index of the source element. + */ + takeWhile(predicate: (item: T, index: number) => boolean): Enumerable + + + /** + * Creates an array from an Enumerable. + */ + toArray(): T[] + + + /** + * Creates a Dictionary from an Enumerable according to a specified key selector function. + * @param keySelector A function to extract a key from each element. + */ + toDictionary(keySelector: (item: T) => TKey): Dictionary; + + + /** + * Creates a Dictionary from an Enumerable according to specified key selector and comparer. + * @param keySelector A function to extract a key from each element. + * @param comparer An equality comparer to compare values. + */ + toDictionary(keySelector: (item: T) => TKey, comparer: EqualityComparer): Dictionary; + + + /** + * Creates a Dictionary from an Enumerable according to specified key selector and element selector functions. + * @param keySelector A function to extract a key from each element. + * @param elementSelector A transform function to produce a result element value from each element. + */ + toDictionary(keySelector: (item: T) => TKey, elementSelector: (item: T) => TElement): Dictionary; + + + /** + * Creates a Dictionary from an Enumerable according to a specified key selector function, a comparer, and an element selector function. + * @param keySelector A function to extract a key from each element. + * @param elementSelector A transform function to produce a result element value from each element. + * @param comparer An equality comparer to compare values. + */ + toDictionary(keySelector: (item: T) => TKey, elementSelector: (item: T) => TElement, comparer: EqualityComparer): Dictionary; + + + /** + * Creates a List from an Enumerable. + */ + toList(): List + + + /** + * Creates a Lookup from an Enumerable according to a specified key selector function. + * @param keySelector A function to extract a key from each element. + */ + toLookup(keySelector: (item: T) => TKey): Lookup; + + + /** + * Creates a Lookup from an Enumerable according to a specified key selector function and comparer. + * @param keySelector A function to extract a key from each element. + * @param comparer An equality comparer to compare values. + */ + toLookup(keySelector: (item: T) => TKey, comparer: EqualityComparer): Lookup; + + + /** + * Creates a Lookup from an Enumerable according to specified key selector and element selector functions. + * @param keySelector A function to extract a key from each element. + * @param elementSelector A transform function to produce a result element value from each element. + */ + toLookup(keySelector: (item: T) => TKey, elementSelector: (item: T) => TElement): Lookup; + + + /** + * Creates a Lookup from an Enumerable according to a specified key selector function, a comparer and an element selector function. + * @param keySelector A function to extract a key from each element. + * @param elementSelector A transform function to produce a result element value from each element. + * @param comparer An equality comparer to compare values. + */ + toLookup(keySelector: (item: T) => TKey, elementSelector: (item: T) => TElement, comparer: EqualityComparer): Lookup; + + + /** + * Produces the set union of two sequences by using the default equality comparer. + * @param second An Iterable whose distinct elements form the second set for the union. + */ + union(second: Iterable): Enumerable + + + /** + * Produces the set union of two sequences by using a specified EqualityComparer. + * @param second An Iterable whose distinct elements form the second set for the union. + * @param comparer The EqualityComparer to compare values. + */ + union(second: Iterable, comparer: EqualityComparer): Enumerable + + + /** + * Filters a sequence of values based on a predicate. + * @param predicate A function to test each source element for a condition. + */ + where(predicate: (item: T) => boolean): Enumerable; + + + /** + * Filters a sequence of values based on a predicate. Each element's index is used in the logic of the predicate function. + * @param predicate A function to test each source element for a condition; the second parameter of the function represents the index of the source element. + */ + where(predicate: (item: T, index: number) => boolean): Enumerable; + + + /** + * Merges two sequences by using the specified predicate function. + * @param second The second sequence to merge. + * @param resultSelector A function that specifies how to merge the elements from the two sequences. + */ + zip(second: Iterable, resultSelector: (first: T, second: TSecond) => TResult): Enumerable; + } + + + + /** + * Represents Array-like objects which has the "length" property and indexed properties access, eg. jQuery + */ + interface ArrayLike { + length: number; + [n: number]: T; + } + + + + /** + * Provides 'hash' and 'equals' functions for a particular type, suitable for use in hashing algorithms and data structures such as a hash table. + */ + interface RuntimeComparer { + + /** + * Serves as a hash function for a particular type. + */ + __hash__(): number; + + /** + * Determines whether the specified Object is equal to the current Object. + */ + __equals__(obj: any): boolean; + } + + + + /** + * Provides a set of static methods that provide support for internal operations. + */ + interface MultiplexRuntime { + + /** + * Serves as a hash function for a particular type, suitable for use in hashing algorithms and data structures such as a hash table. + * @param obj An object to retrieve the hash code for. + */ + hash(obj: any): number; + + + /** + * Determines whether the specified object instances are considered equal. + * @param objA The first object to compare. + * @param objB The second object to compare. + */ + equals(objA: any, objB: any): boolean; + + + /** + * Performs a comparison of two objects of the same type and returns a value indicating whether one object is less than, equal to, or greater than the other. + * @param objA The first object to compare. + * @param objB The second object to compare. + */ + compare(objA: T, objB: T): number; + + + /** + * Creates A function expression from the specified string lambda expression + * @param exp String lambda expression. + */ + lambda(exp: string): (obj: T) => TResult; + + + /** + * Creates A function expression from the specified string lambda expression + * @param exp String lambda expression. + */ + lambda(exp: string): (obj1: T1, obj2: T2) => TResult; + + + /** + * Creates A function expression from the specified string lambda expression + * @param exp String lambda expression. + */ + lambda(exp: string): (obj1: T1, obj2: T2, obj3: T3) => TResult; + + + /** + * Creates A function expression from the specified string lambda expression + * @param exp String lambda expression. + */ + lambda(exp: string): (...args: any[]) => TResult; + + + /** + * Defines new or modifies existing properties directly on the specified object, returning the object. + * @param obj The object on which to define or modify properties. + * @param prop The name of the property to be defined or modified. + * @param attributes The descriptor for the property being defined or modified. + */ + define(obj: T, prop: String, attributes: PropertyDescriptor): T; + + + /** + * Extends the given object by implementing supplied members. + * @param obj The object on which to define or modify properties. + * @param properties Represetnts the mixin source object + * @param attributes The descriptor for the property being defined or modified. + */ + mixin(obj: T, properties: Object, attributes?: PropertyDescriptor): T; + } + + + + /** + * Defines MultiplexStatic module members + */ + interface MultiplexStatic { + + + + /* Factory Methods + --------------------------------------------------------------------------*/ + + /** + * Exposes the enumerator, which supports an iteration over the specified Enumerable object. + * @param obj An Iterable object. eg. Enumerable, Array, String, Set, Map, Iterable & Generators + */ + (obj: Iterable): Enumerable + + + /** + * Defines an enumerator, which supports an iteration over the specified Generator function. + * @param factory An Enumerator factory function. + */ + (factory: () => Enumerator): Enumerable + + + /** + * Defines an enumerator, which supports an iteration over the items of the specified Array-like object. + * An Array-like object is an object which has the "length" property and indexed properties access, eg. jQuery + * @param obj An Array-like object. + */ + (obj: ArrayLike): Enumerable + + + /** + * Defines an enumerator, which supports an iteration over the arguments local variable available within all functions. + * @param obj arguments local variable available within all functions. + */ + (obj: IArguments): Enumerable + + + /** + * Defines an enumerator, which supports an iteration over the properties of the specified object. + * @param obj A regular Object. + */ + (obj: Object): Enumerable> + + + + + + + /* Static Methods + --------------------------------------------------------------------------*/ + + /** + * Gets and combines hash code for the given parameters, calls the overridden "hash" method when available. + * @param objs Optional number of objects to combine their hash codes. + */ + hash(...obj: any[]): number; + + + /** + * Determines whether the specified object instances are considered equal. calls the overridden "equals" method when available. + * @param objA The first object to compare. + * @param objB The second object to compare. + */ + equals(objA: any, objB: any): boolean; + + + /** + * Determines whether the specified object instances are considered equal. calls the overridden "equals" method when available. + * @param objA The first object to compare. + * @param objB The second object to compare. + * @param comparer An equality comparer to compare values. + */ + equals(objA: any, objB: any, comparer: EqualityComparer): boolean; + + + /** + * Performs a comparison of two objects of the same type and returns a value indicating whether one object is less than, equal to, or greater than the other. + * @param objA The first object to compare. + * @param objB The second object to compare. + */ + compare(objA: T, objB: T): number; + + + /** + * Extends Enumerable extension methods to the given type + * @param type The type to extend. + */ + enumerableExtend(type: Function): void; + + + /** + * Returns an empty Enumerable. + */ + empty(): Enumerable; + + + /** + * Detects if an object is Enumerable. + * @param obj An object to check its Enumerability. + */ + is(obj: any): boolean; + + + /** + * Generates a sequence of integral numbers within a specified range. + * @param start The value of the first integer in the sequence. + * @param count The number of sequential integers to generate. + */ + range(start: number, count: number): Enumerable; + + + /** + * Generates a sequence that contains one repeated value. + * @param element The value to be repeated. + * @param count The number of times to repeat the value in the generated sequence. + */ + repeat(element: T, count: number): Enumerable; + + + + + + + /* Mutiplex Types + --------------------------------------------------------------------------*/ + + /** + * Provides a set of static methods that provide support for internal operations. + */ + runtime: MultiplexRuntime + + /** + * Supports a simple iteration over a collection. + */ + Enumerator: EnumeratorConstructor + + /** + * Exposes the enumerator, which supports a simple iteration over a collection of a specified type. + */ + Enumerable: EnumerableConstructor + + /** + * Provides a base class for implementations of Comparer generic interface. + */ + Comparer: ComparerConstructor + + /** + * Provides a base class for implementations of the EqualityComparer. + */ + EqualityComparer: EqualityComparerConstructor + + /** + * Initializes a new instance of the abstract Collection class. + */ + Collection: CollectionConstructor + + /** + * Initializes a new instance of the abstract Collection class. + */ + ReadOnlyCollection: ReadOnlyCollectionConstructor + + /** + * Represents a strongly typed list of objects that can be accessed by index. + */ + List: ListConstructor + + /** + * Represents a collection of key/value pairs that are sorted by key based on the associated Comparer implementation. + */ + SortedList: SortedListConstructor + + /** + * Defines a key/value pair that can be set or retrieved. + */ + KeyValuePair: KeyValuePairConstructor + + /** + * Represents a collection of keys and values. + */ + Dictionary: DictionaryConstructor + + /** + * Represents a set of values. + */ + HashSet: HashSetConstructor + + /** + * Represents a node in a LinkedList. + */ + LinkedListNode: LinkedListNodeConstructor + + /** + * Represents a doubly linked list. + */ + LinkedList: LinkedListConstructor + + /** + * Represents a first-in, first-out collection of objects. + */ + Queue: QueueConstructor + + /** + * Represents a variable size last-in-first-out (LIFO) collection of instances of the same arbitrary type. + */ + Stack: StackConstructor + } +} \ No newline at end of file diff --git a/ng-i18next/ng-i18next-tests.ts b/ng-i18next/ng-i18next-tests.ts new file mode 100644 index 000000000..243a39865 --- /dev/null +++ b/ng-i18next/ng-i18next-tests.ts @@ -0,0 +1,8 @@ +/// +/** +* @summary Test for "ng-i18next" with options. +*/ +function testOptions() { + var $provider: angular.i18next.I18nextProvider; + $provider.options = {}; +} diff --git a/ng-i18next/ng-i18next.d.ts b/ng-i18next/ng-i18next.d.ts new file mode 100644 index 000000000..33af5c42c --- /dev/null +++ b/ng-i18next/ng-i18next.d.ts @@ -0,0 +1,12 @@ +// Type definitions for i18next v0.3.6 +// Project: https://github.com/i18next/ng-i18next +// Definitions by: Cyril Schumacher +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module angular.i18next { + interface I18nextProvider { + options: I18nextOptions; + } +} \ No newline at end of file diff --git a/node-gcm/node-gcm-tests.ts b/node-gcm/node-gcm-tests.ts new file mode 100644 index 000000000..b184949ed --- /dev/null +++ b/node-gcm/node-gcm-tests.ts @@ -0,0 +1,72 @@ +/// + +import gcm = require('node-gcm'); + +// Create a message +// ... with default values +var message = new gcm.Message(); + +// ... or some given values +var message = new gcm.Message({ + collapseKey: 'demo', + delayWhileIdle: true, + timeToLive: 3, + data: { + key1: 'message1', + key2: 'message2' + } +}); + +// Change the message data +// ... as key-value +message.addData('key1','message1'); +message.addData('key2','message2'); + +// ... or as a data object (overwrites previous data object) +message.addData({ + key1: 'message1', + key2: 'message2' +}); + +// Change the message variables +message.collapseKey = 'demo'; +message.delayWhileIdle = true; +message.timeToLive = 3; +message.dryRun = true; + +// Set up the sender with you API key +var sender = new gcm.Sender('insert Google Server API Key here'); + +// Add the registration IDs of the devices you want to send to +var registrationIds: string[] = []; +registrationIds.push('regId1'); +registrationIds.push('regId2'); + +// Send the message +// ... trying only once +sender.sendNoRetry(message, registrationIds, (err, result) => { + if (err) { + console.error(err); + } else { + console.log(result); + } +}); + +// ... or retrying +sender.send(message, registrationIds, (err, result) => { + if (err) { + console.error(err); + } else { + console.log(result); + } +}); + +// ... or retrying a specific number of times (10) +sender.send(message, registrationIds, 10, (err, result) => { + if (err) { + console.error(err); + } else { + console.log(result); + } +}); + diff --git a/node-gcm/node-gcm.d.ts b/node-gcm/node-gcm.d.ts new file mode 100644 index 000000000..3272acac4 --- /dev/null +++ b/node-gcm/node-gcm.d.ts @@ -0,0 +1,62 @@ +// Type definitions for node-gcm 0.9.15 +// Project: https://www.npmjs.org/package/node-gcm +// Definitions by: Hiroki Horiuchi +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module "node-gcm" { + + export interface IMessageOptions { + collapseKey?: string; + delayWhileIdle?: boolean; + timeToLive?: number; + dryRun?: boolean; + } + + export class Message { + constructor(options?: IMessageOptions); + collapseKey: string; + delayWhileIdle: boolean; + timeToLive: number; + dryRun: boolean; + + addData(key: string, value: string): void; + addData(data: any): void; + } + + + export interface ISenderOptions { + proxy?: any; + maxSockets?: number; + timeout?: number; + } + export interface ISenderSendOptions { + retries?: number; + backoff?: number; + } + + export class Sender { + constructor(key: string, options?: ISenderOptions); + key: string; + options: ISenderOptions; + + send(message: Message, registrationIds: string|string[], callback: (err: any, resJson: IResponseBody) => void): void; + send(message: Message, registrationIds: string|string[], retries: number, callback: (err: any, resJson: IResponseBody) => void): void; + send(message: Message, registrationIds: string|string[], options: ISenderSendOptions, callback: (err: any, resJson: IResponseBody) => void): void; + sendNoRetry(message: Message, registrationIds: string|string[], callback: (err: any, resJson: IResponseBody) => void): void; + } + + + export interface IResponseBody { + success: number; + failure: number; + canonical_ids: number; + multicast_id?: number; + results?: { + message_id?: string; + registration_id?: string; + error?: string; + }[]; + } + +} + diff --git a/node-sass/node-sass-tests.ts b/node-sass/node-sass-tests.ts new file mode 100644 index 000000000..a7c1477cb --- /dev/null +++ b/node-sass/node-sass-tests.ts @@ -0,0 +1,71 @@ +/// +import sass = require('node-sass'); +sass.render({ + file: '/path/to/myFile.scss', + data: 'body{background:blue; a{color:black;}}', + importer: function(url, prev, done) { + // url is the path in import as is, which libsass encountered. + // prev is the previously resolved path. + // done is an optional callback, either consume it or return value synchronously. + // this.options contains this options hash, this.callback contains the node-style callback + someAsyncFunction(url, prev, function(result) { + done({ + file: result.path, // only one of them is required, see section Sepcial Behaviours. + contents: result.data + }); + }); + // OR + var result = someSyncFunction(url, prev); + return { file: result.path, contents: result.data }; + }, + includePaths: ['lib/', 'mod/'], + outputStyle: 'compressed' +}, function(error, result) { // node-style callback from v3.0.0 onwards + if (error) { + console.log(error.status); // used to be "code" in v2x and below + console.log(error.column); + console.log(error.message); + console.log(error.line); + } + else { + console.log(result.css.toString()); + + console.log(result.stats); + + console.log(result.map.toString()); + // or better + console.log(JSON.stringify(result.map)); // note, JSON.stringify accepts Buffer too + } +}); +// OR +var result = sass.renderSync({ + file: '/path/to/file.scss', + data: 'body{background:blue; a{color:black;}}', + outputStyle: 'compressed', + outFile: '/to/my/output.css', + sourceMap: true, // or an absolute or relative (to outFile) path + importer: function(url, prev, done) { + // url is the path in import as is, which libsass encountered. + // prev is the previously resolved path. + // done is an optional callback, either consume it or return value synchronously. + // this.options contains this options hash + someAsyncFunction(url, prev, function(result) { + done({ + file: result.path, // only one of them is required, see section Sepcial Behaviours. + contents: result.data + }); + }); + // OR + var result = someSyncFunction(url, prev); + return { file: result.path, contents: result.data }; + }, +}); + +console.log(result.css); +console.log(result.map); +console.log(result.stats); + +function someAsyncFunction(url: string, prev: string, callback: (result: { path: string; data: string }) => void): void {} +function someSyncFunction(url: string, prev: string): { path: string; data: string} { + return null; +} diff --git a/node-sass/node-sass.d.ts b/node-sass/node-sass.d.ts new file mode 100644 index 000000000..09ea71d4e --- /dev/null +++ b/node-sass/node-sass.d.ts @@ -0,0 +1,56 @@ +// Type definitions for Node Sass +// Project: https://github.com/sass/node-sass +// Definitions by: Asana +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module "node-sass" { + interface Importer { + (url: string, prev: string, done: (data: { file: string; contents: string; }) => void): void; + } + + interface Options { + file?: string; + data?: string; + importer?: Importer | Importer[]; + functions?: { [key: string]: Function }; + includePaths?: string[]; + indentedSyntax?: boolean; + indentType?: string; + indentWidth?: number; + linefeed?: string; + omitSourceMapUrl?: boolean; + outFile?: string; + outputStyle?: string; + precision?: number; + sourceComments?: boolean; + sourceMap?: boolean | string; + sourceMapContents?: boolean; + sourceMapEmbed?: boolean; + sourceMapRoot?: boolean; + } + + interface SassError extends Error { + message: string; + line: number; + column: number; + status: number; + file: string; + } + + interface Result { + css: Buffer; + map: Buffer; + stats: { + entry: string; + start: number; + end: number; + duration: number; + includedFiles: string[]; + } + } + + export function render(options: Options, callback: (err: SassError, result: Result) => any): void; + export function renderSync(options: Options): Result; +} diff --git a/node-uuid/node-uuid-tests.ts b/node-uuid/node-uuid-tests.ts index 9ad3c1cfc..e922c04de 100644 --- a/node-uuid/node-uuid-tests.ts +++ b/node-uuid/node-uuid-tests.ts @@ -23,7 +23,14 @@ var buf : number[] = [] uuid.parse(uid4, buf, offset) uuid.unparse(buf, offset) -uuid.v1(options, padding, offset) -uuid.v2(options, padding, offset) -uuid.v3(options, padding, offset) -uuid.v4(options, padding, offset) +var uid21: number[] = uuid.v1(options, padding, offset) +var uid22: number[] = uuid.v2(options, padding, offset) +var uid23: number[] = uuid.v3(options, padding, offset) +var uid24: number[] = uuid.v4(options, padding, offset) + +var buffer: Buffer; + +var uid31: Buffer = uuid.v1(options, buffer, offset) +var uid32: Buffer = uuid.v2(options, buffer, offset) +var uid33: Buffer = uuid.v3(options, buffer, offset) +var uid34: Buffer = uuid.v4(options, buffer, offset) diff --git a/node-uuid/node-uuid.d.ts b/node-uuid/node-uuid.d.ts index d1e1e8c2e..b069e8f37 100644 --- a/node-uuid/node-uuid.d.ts +++ b/node-uuid/node-uuid.d.ts @@ -11,39 +11,43 @@ interface UUIDOptions { * Node id as Array of 6 bytes (per 4.1.6). * Default: Randomly generated ID. See note 1. */ - node: any[] + node?: any[] /** * (Number between 0 - 0x3fff) RFC clock sequence. * Default: An internally maintained clockseq is used. */ - clockseq: number + clockseq?: number /** * (Number | Date) Time in milliseconds since unix Epoch. * Default: The current time is used. */ - msecs: any + msecs?: any /** * (Number between 0-9999) additional time, in 100-nanosecond units. Ignored if msecs is unspecified. * Default: internal uuid counter is used, as per 4.2.1.2. */ - nsecs: number + nsecs?: number } interface UUID { - v1(options?: UUIDOptions, buffer?: number[], offset?: number): string - v1(options?: UUIDOptions, buffer?: Buffer, offset?: number): string + v1(options?: UUIDOptions): string + v1(options?: UUIDOptions, buffer?: number[], offset?: number): number[] + v1(options?: UUIDOptions, buffer?: Buffer, offset?: number): Buffer - v2(options?: UUIDOptions, buffer?: number[], offset?: number): string - v2(options?: UUIDOptions, buffer?: Buffer, offset?: number): string + v2(options?: UUIDOptions): string + v2(options?: UUIDOptions, buffer?: number[], offset?: number): number[] + v2(options?: UUIDOptions, buffer?: Buffer, offset?: number): Buffer - v3(options?: UUIDOptions, buffer?: number[], offset?: number): string - v3(options?: UUIDOptions, buffer?: Buffer, offset?: number): string + v3(options?: UUIDOptions): string + v3(options?: UUIDOptions, buffer?: number[], offset?: number): number[] + v3(options?: UUIDOptions, buffer?: Buffer, offset?: number): Buffer - v4(options?: UUIDOptions, buffer?: number[], offset?: number): string - v4(options?: UUIDOptions, buffer?: Buffer, offset?: number): string + v4(options?: UUIDOptions): string + v4(options?: UUIDOptions, buffer?: number[], offset?: number): number[] + v4(options?: UUIDOptions, buffer?: Buffer, offset?: number): Buffer parse(id: string, buffer?: number[], offset?: number): number[] parse(id: string, buffer?: Buffer, offset?: number): Buffer diff --git a/node/node.d.ts b/node/node.d.ts index 95ea4d8fd..2543ccaca 100644 --- a/node/node.d.ts +++ b/node/node.d.ts @@ -15,7 +15,7 @@ * * ************************************************/ declare var process: NodeJS.Process; -declare var global: any; +declare var global: NodeJS.Global; declare var __filename: string; declare var __dirname: string; @@ -190,6 +190,71 @@ declare module NodeJS { send?(message: any, sendHandle?: any): void; } + export interface Global { + Array: typeof Array; + ArrayBuffer: typeof ArrayBuffer; + Boolean: typeof Boolean; + Buffer: typeof Buffer; + DataView: typeof DataView; + Date: typeof Date; + Error: typeof Error; + EvalError: typeof EvalError; + Float32Array: typeof Float32Array; + Float64Array: typeof Float64Array; + Function: typeof Function; + GLOBAL: Global; + Infinity: typeof Infinity; + Int16Array: typeof Int16Array; + Int32Array: typeof Int32Array; + Int8Array: typeof Int8Array; + Intl: typeof Intl; + JSON: typeof JSON; + Map: typeof Map; + Math: typeof Math; + NaN: typeof NaN; + Number: typeof Number; + Object: typeof Object; + Promise: Function; + RangeError: typeof RangeError; + ReferenceError: typeof ReferenceError; + RegExp: typeof RegExp; + Set: typeof Set; + String: typeof String; + Symbol: Function; + SyntaxError: typeof SyntaxError; + TypeError: typeof TypeError; + URIError: typeof URIError; + Uint16Array: typeof Uint16Array; + Uint32Array: typeof Uint32Array; + Uint8Array: typeof Uint8Array; + Uint8ClampedArray: Function; + WeakMap: typeof WeakMap; + WeakSet: Function; + clearImmediate: (immediateId: any) => void; + clearInterval: (intervalId: NodeJS.Timer) => void; + clearTimeout: (timeoutId: NodeJS.Timer) => void; + console: typeof console; + decodeURI: typeof decodeURI; + decodeURIComponent: typeof decodeURIComponent; + encodeURI: typeof encodeURI; + encodeURIComponent: typeof encodeURIComponent; + escape: (str: string) => string; + eval: typeof eval; + global: Global; + isFinite: typeof isFinite; + isNaN: typeof isNaN; + parseFloat: typeof parseFloat; + parseInt: typeof parseInt; + process: Process; + root: Global; + setImmediate: (callback: (...args: any[]) => void, ...args: any[]) => any; + setInterval: (callback: (...args: any[]) => void, ms: number, ...args: any[]) => NodeJS.Timer; + setTimeout: (callback: (...args: any[]) => void, ms: number, ...args: any[]) => NodeJS.Timer; + undefined: typeof undefined; + unescape: (str: string) => string; + gc: () => void; + } + export interface Timer { ref() : void; unref() : void; @@ -276,6 +341,7 @@ declare module "http" { export interface Server extends events.EventEmitter { listen(port: number, hostname?: string, backlog?: number, callback?: Function): Server; + listen(port: number, hostname?: string, callback?: Function): Server; listen(path: string, callback?: Function): Server; listen(handle: any, listeningListener?: Function): Server; close(cb?: any): Server; @@ -679,8 +745,8 @@ declare module "child_process" { timeout?: number; maxBuffer?: number; killSignal?: string; - }, callback: (error: Error, stdout: Buffer, stderr: Buffer) =>void ): ChildProcess; - export function exec(command: string, callback: (error: Error, stdout: Buffer, stderr: Buffer) =>void ): ChildProcess; + }, callback?: (error: Error, stdout: Buffer, stderr: Buffer) =>void ): ChildProcess; + export function exec(command: string, callback?: (error: Error, stdout: Buffer, stderr: Buffer) =>void ): ChildProcess; export function execFile(file: string, callback?: (error: Error, stdout: Buffer, stderr: Buffer) =>void ): ChildProcess; export function execFile(file: string, args?: string[], diff --git a/nodemailer-direct-transport/nodemailer-direct-transport-tests.ts b/nodemailer-direct-transport/nodemailer-direct-transport-tests.ts new file mode 100644 index 000000000..ef8c78479 --- /dev/null +++ b/nodemailer-direct-transport/nodemailer-direct-transport-tests.ts @@ -0,0 +1,22 @@ +/// + +import directTransport = require('nodemailer-direct-transport'); + +var opts: directTransport.DirectOptions = { + name: "harry" +}; + +var transport: nodemailer.Transport = directTransport(opts); + +// setup e-mail data with unicode symbols +var mailOptions: nodemailer.SendMailOptions = { + from: 'Fred Foo ✔ ', // sender address + to: 'bar@blurdybloop.com, baz@blurdybloop.com', // list of receivers + subject: 'Hello ✔', // Subject line + text: 'Hello world ✔', // plaintext body + html: 'Hello world ✔' // html body +}; +transport.send(mailOptions, (error: Error, info: nodemailer.SentMessageInfo): void => { + // nothing +}); + diff --git a/nodemailer-direct-transport/nodemailer-direct-transport.d.ts b/nodemailer-direct-transport/nodemailer-direct-transport.d.ts new file mode 100644 index 000000000..aa04d8ea6 --- /dev/null +++ b/nodemailer-direct-transport/nodemailer-direct-transport.d.ts @@ -0,0 +1,35 @@ +// Type definitions for nodemailer-direct-transport 1.0.2 +// Project: https://github.com/andris9/nodemailer-direct-transport +// Definitions by: Rogier Schouten +// Definitions: https://github.com/borisyankov/DefinitelyTyped + + +/// + +declare module "nodemailer-direct-transport" { + + module directTransport { + + export interface AuthOptions { + user?: string; + pass?: string; + xoauth2?: any; + } + + export interface DirectOptions { + /** + * optional hostname of the client, used for identifying to the server + */ + name?: string; + /** + * if true, the connection emits all traffic between client and server as 'log' events + */ + debug?: boolean; + } + } + + function directTransport(options: directTransport.DirectOptions): nodemailer.Transport; + + export = directTransport; + +} diff --git a/nodemailer-smtp-pool/nodemailer-smtp-pool-tests.ts b/nodemailer-smtp-pool/nodemailer-smtp-pool-tests.ts new file mode 100644 index 000000000..1970ebab5 --- /dev/null +++ b/nodemailer-smtp-pool/nodemailer-smtp-pool-tests.ts @@ -0,0 +1,23 @@ +/// + +import smtpPool = require('nodemailer-smtp-pool'); + +var opts: smtpPool.SmtpPoolOptions = { + maxConnections: 5, + maxMessages: 10 +}; + +var transport: nodemailer.Transport = smtpPool(opts); + +// setup e-mail data with unicode symbols +var mailOptions: nodemailer.SendMailOptions = { + from: 'Fred Foo ✔ ', // sender address + to: 'bar@blurdybloop.com, baz@blurdybloop.com', // list of receivers + subject: 'Hello ✔', // Subject line + text: 'Hello world ✔', // plaintext body + html: 'Hello world ✔' // html body +}; +transport.send(mailOptions, (error: Error, info: nodemailer.SentMessageInfo): void => { + // nothing +}); + diff --git a/nodemailer-smtp-pool/nodemailer-smtp-pool.d.ts b/nodemailer-smtp-pool/nodemailer-smtp-pool.d.ts new file mode 100644 index 000000000..2c9a77932 --- /dev/null +++ b/nodemailer-smtp-pool/nodemailer-smtp-pool.d.ts @@ -0,0 +1,88 @@ +// Type definitions for nodemailer-smtp-pool 1.0.1 +// Project: https://github.com/andris9/nodemailer-smtp-pool +// Definitions by: Rogier Schouten +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// +/// + +declare module "nodemailer-smtp-pool" { + import tls = require("tls"); + + module smtpPool { + + export interface AuthOptions { + user?: string; + pass?: string; + xoauth2?: any; + } + + export interface SmtpPoolOptions { + /** + * is the port to connect to (defaults to 25 or 465) + */ + port?: number; + /** + * is the hostname or IP address to connect to (defaults to 'localhost') + */ + host?: string; + /** + * defines if the connection should use SSL (if true) or not (if false) + */ + secure?: boolean; + /** + * defines authentication data (see authentication section below) + */ + auth?: AuthOptions; + /** + * turns off STARTTLS support if true + */ + ignoreTLS?: boolean; + /** + * optional hostname of the client, used for identifying to the server + */ + name?: string; + /** + * is the local interface to bind to for network connections + */ + localAddress?: string; + /** + * how many milliseconds to wait for the connection to establish + */ + connectionTimeout?: number; + /** + * how many milliseconds to wait for the greeting after connection is established + */ + greetingTimeout?: number; + /** + * how many milliseconds of inactivity to allow + */ + socketTimeout?: number; + /** + * if true, the connection emits all traffic between client and server as 'log' events + */ + debug?: boolean; + /** + * defines preferred authentication method, eg. 'PLAIN' + */ + authMethod?: string; + /** + * defines additional options to be passed to the socket constructor, eg. {rejectUnauthorized: true} + */ + tls?: tls.ConnectionOptions; + /** + * (defaults to 5) is the count of maximum simultaneous connections to make against the SMTP server + */ + maxConnections?: number; + /** + * (defaults to 100) limits the message count to be sent using a single connection. After maxMessages messages the connection is dropped and a new one is created for the following messages + */ + maxMessages?: number; + } + } + + + function smtpPool(options: smtpPool.SmtpPoolOptions): nodemailer.Transport; + export = smtpPool; + +} diff --git a/nodemailer-smtp-transport/nodemailer-smtp-transport-tests.ts b/nodemailer-smtp-transport/nodemailer-smtp-transport-tests.ts new file mode 100644 index 000000000..3b0c2e29a --- /dev/null +++ b/nodemailer-smtp-transport/nodemailer-smtp-transport-tests.ts @@ -0,0 +1,23 @@ +/// + +import smtpTransport = require('nodemailer-smtp-transport'); + +var opts: smtpTransport.SmtpOptions = { + host: "localhost", + port: 25 +}; + +var transport: nodemailer.Transport = smtpTransport(opts); + +// setup e-mail data with unicode symbols +var mailOptions: nodemailer.SendMailOptions = { + from: 'Fred Foo ✔ ', // sender address + to: 'bar@blurdybloop.com, baz@blurdybloop.com', // list of receivers + subject: 'Hello ✔', // Subject line + text: 'Hello world ✔', // plaintext body + html: 'Hello world ✔' // html body +}; +transport.send(mailOptions, (error: Error, info: nodemailer.SentMessageInfo): void => { + // nothing +}); + diff --git a/nodemailer-smtp-transport/nodemailer-smtp-transport.d.ts b/nodemailer-smtp-transport/nodemailer-smtp-transport.d.ts new file mode 100644 index 000000000..a12d66991 --- /dev/null +++ b/nodemailer-smtp-transport/nodemailer-smtp-transport.d.ts @@ -0,0 +1,79 @@ +// Type definitions for nodemailer-smtp-transport 1.0.2 +// Project: https://github.com/andris9/nodemailer-smtp-transport +// Definitions by: Rogier Schouten +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// +/// + +declare module "nodemailer-smtp-transport" { + + import tls = require("tls"); + + module smtpTransport { + export interface AuthOptions { + user?: string; + pass?: string; + xoauth2?: any; + } + + export interface SmtpOptions { + /** + * is the port to connect to (defaults to 25 or 465) + */ + port?: number; + /** + * is the hostname or IP address to connect to (defaults to 'localhost') + */ + host?: string; + /** + * defines if the connection should use SSL (if true) or not (if false) + */ + secure?: boolean; + /** + * defines authentication data (see authentication section below) + */ + auth?: AuthOptions; + /** + * turns off STARTTLS support if true + */ + ignoreTLS?: boolean; + /** + * optional hostname of the client, used for identifying to the server + */ + name?: string; + /** + * is the local interface to bind to for network connections + */ + localAddress?: string; + /** + * how many milliseconds to wait for the connection to establish + */ + connectionTimeout?: number; + /** + * how many milliseconds to wait for the greeting after connection is established + */ + greetingTimeout?: number; + /** + * how many milliseconds of inactivity to allow + */ + socketTimeout?: number; + /** + * if true, the connection emits all traffic between client and server as 'log' events + */ + debug?: boolean; + /** + * defines preferred authentication method, eg. 'PLAIN' + */ + authMethod?: string; + /** + * defines additional options to be passed to the socket constructor, eg. {rejectUnauthorized: true} + */ + tls?: tls.ConnectionOptions; + } + } + + function smtpTransport(options: smtpTransport.SmtpOptions): nodemailer.Transport; + + export = smtpTransport; +} diff --git a/nodemailer/nodemailer-tests.ts b/nodemailer/nodemailer-tests.ts index 94a955e67..1d99046c0 100644 --- a/nodemailer/nodemailer-tests.ts +++ b/nodemailer/nodemailer-tests.ts @@ -1,105 +1,28 @@ -/// /// -var nodemailer: Nodemailer; -var fs: any; -var pathlib: any; +import nodemailer = require('nodemailer'); -// Create an Amazon SES transport object -var transport:Transport = nodemailer.createTransport("SES", { - AWSAccessKeyID: "AWSACCESSKEY", - AWSSecretKey: "/AWS/SECRET", - ServiceUrl: "https://email.us-east-1.amazonaws.com" // optional +// create reusable transporter object using SMTP transport +var transporter: nodemailer.Transporter = nodemailer.createTransport({ + service: 'Gmail', + auth: { + user: 'gmail.user@gmail.com', + pass: 'userpass' + } }); -console.log('SES Configured'); - -// optional DKIM signing - -transport.useDKIM({ - domainName: "do-not-trust.node.ee", // signing domain - keySelector: "dkim", // selector name (in this case there's a dkim._domainkey.do-not-trust.node.ee TXT record set up) - privateKey: fs.readFileSync(pathlib.join(__dirname,"test_private.pem")) -}); - - -// Message object -var message:MailComposer = { - - // sender info - from: 'Sender Name ', - - // Comma separated list of recipients - to: '"Receiver Name" ', - - // Subject of the message - subject: 'Nodemailer is unicode friendly ✔', // - - // plaintext body - text: 'Hello to myself!', - - // HTML body - html: '

    Hello to myself

    ' + - '

    Here\'s a nyan cat for you as an embedded attachment:

    ', - - // An array of attachments - attachments: [ - - // String attachment - { - fileName: 'notes.txt', - contents: 'Some notes about this e-mail', - contentType: 'text/plain' // optional, would be detected from the filename - }, - - // Binary Buffer attachment - { - fileName: 'image.png', - contents: new Buffer('iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAABlBMVEUAAAD/' + - '//+l2Z/dAAAAM0lEQVR4nGP4/5/h/1+G/58ZDrAz3D/McH8yw83NDDeNGe4U' + - 'g9C9zwz3gVLMDA/A6P9/AFGGFyjOXZtQAAAAAElFTkSuQmCC', 'base64'), - - cid: 'note@node' // should be as unique as possible - }, - - // File Stream attachment - { - fileName: 'nyancat.gif', - filePath: __dirname + "/nyan.gif", - cid: 'nyan@node' // should be as unique as possible - } - ] +// setup e-mail data with unicode symbols +var mailOptions: nodemailer.SendMailOptions = { + from: 'Fred Foo ✔ ', // sender address + to: 'bar@blurdybloop.com, baz@blurdybloop.com', // list of receivers + subject: 'Hello ✔', // Subject line + text: 'Hello world ✔', // plaintext body + html: 'Hello world ✔' // html body }; -console.log('Sending Mail'); - -transport.sendMail(message, function (error) { - if (error) { - console.log('Error occured'); - console.log(error.message); - return; - } - console.log('Message sent successfully!'); +// send mail with defined transport object +transporter.sendMail(mailOptions, (error: Error, info: nodemailer.SentMessageInfo): void => { + // nothing }); -// From the SMTP section of https://npmjs.org/package/nodemailer README - -var smptTransport1: Transport = nodemailer.createTransport("SMTP", { - service: "Gmail", // sets automatically host, port and connection security settings - auth: { - user: "gmail.user@gmail.com", - pass: "userpass" - } -}); - -var smtpTransport2: Transport = nodemailer.createTransport("SMTP", { - host: "smtp.gmail.com", // hostname - secureConnection: true, // use SSL - port: 465, // port for secure SMTP - auth: { - user: "gmail.user@gmail.com", - pass: "userpass" - } -}); - diff --git a/nodemailer/nodemailer-types.d.ts b/nodemailer/nodemailer-types.d.ts new file mode 100644 index 000000000..bffa6b301 --- /dev/null +++ b/nodemailer/nodemailer-types.d.ts @@ -0,0 +1,149 @@ +// Type definitions for Nodemailer 1.3.2 +// Project: https://github.com/andris9/Nodemailer +// Definitions by: Rogier Schouten +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module nodemailer { + + export interface AttachmentObject { + /** + * filename to be reported as the name of the attached file, use of unicode is allowed + */ + filename?: string; + /** + * optional content id for using inline images in HTML message source + */ + cid?: string; + /** + * Pathname or URL to use streaming + */ + path?: string; + /** + * String, Buffer or a Stream contents for the attachment + */ + content: string|Buffer|NodeJS.ReadableStream; + /** + * If set and content is string, then encodes the content to a Buffer using the specified encoding. Example values: base64, hex, 'binary' etc. Useful if you want to use binary attachments in a JSON formatted e-mail object. + */ + encoding?: string; + /** + * optional content type for the attachment, if not set will be derived from the filename property + */ + contentType?: string; + /** + * optional content disposition type for the attachment, defaults to 'attachment' + */ + contentDisposition?: string; + } + + export interface SendMailOptions { + /** + * The e-mail address of the sender. All e-mail addresses can be plain 'sender@server.com' or formatted 'Sender Name ', see here for details + */ + from?: string; + /** + * An e-mail address that will appear on the Sender: field + */ + sender?: string; + /** + * Comma separated list or an array of recipients e-mail addresses that will appear on the To: field + */ + to?: string|string[]; + /** + * Comma separated list or an array of recipients e-mail addresses that will appear on the Cc: field + */ + cc?: string|string[]; + /** + * Comma separated list or an array of recipients e-mail addresses that will appear on the Bcc: field + */ + bcc?: string|string[]; + /** + * An e-mail address that will appear on the Reply-To: field + */ + replyTo?: string; + /** + * The message-id this message is replying + */ + inReplyTo?: string; + /** + * Message-id list (an array or space separated string) + */ + references?: string|string[]; + /** + * The subject of the e-mail + */ + sbject?: string; + /** + * The plaintext version of the message as an Unicode string, Buffer, Stream or an object {path: '...'} + */ + text?: string|Buffer|NodeJS.ReadableStream|AttachmentObject; + /** + * The HTML version of the message as an Unicode string, Buffer, Stream or an object {path: '...'} + */ + html?: string|Buffer|NodeJS.ReadableStream|AttachmentObject; + /** + * An object or array of additional header fields (e.g. {"X-Key-Name": "key value"} or [{key: "X-Key-Name", value: "val1"}, {key: "X-Key-Name", value: "val2"}]) + */ + headers?: any; + /** + * An array of attachment objects (see below for details) + */ + attachments?: AttachmentObject[]; + /** + * An array of alternative text contents (in addition to text and html parts) (see below for details) + */ + alternatives?: AttachmentObject[]; + /** + * optional Message-Id value, random value will be generated if not set + */ + messageId?: string; + /** + * optional Date value, current UTC string will be used if not set + */ + date?: Date; + /** + * optional transfer encoding for the textual parts (defaults to 'quoted-printable') + */ + encoding?: string; + } + + export interface SentMessageInfo { + /** + * most transports should return the final Message-Id value used with this property + */ + messageId: string; + /** + * includes the envelope object for the message + */ + envelope: any; + /** + * is an array returned by SMTP transports (includes recipient addresses that were accepted by the server) + */ + accepted: string[]; + /** + * is an array returned by SMTP transports (includes recipient addresses that were rejected by the server) + */ + rejected: string[]; + /** + * is an array returned by Direct SMTP transport. Includes recipient addresses that were temporarily rejected together with the server response + */ + pending?: string[]; + /** + * is a string returned by SMTP transports and includes the last SMTP response from the server + */ + response: string; + } + + /** + * This is what you implement to create a new transporter yourself + */ + export interface Transport { + name: string; + version: string; + send(mail: SendMailOptions, callback?: (error: Error, info: SentMessageInfo) => void): void; + close(): void; + } + +} diff --git a/nodemailer/nodemailer.d.ts b/nodemailer/nodemailer.d.ts index a63479e83..e0d1300b0 100644 --- a/nodemailer/nodemailer.d.ts +++ b/nodemailer/nodemailer.d.ts @@ -1,111 +1,63 @@ -// Type definitions for Nodemailer -// Project: https://github.com/andris9/Nodemailer -// Definitions by: Vincent Bortone -// Definitions: https://github.com/borisyankov/DefinitelyTyped - -// Nodemailer is an easy to use module to send e-mails with Node.JS (using SMTP or sendmail or Amazon SES) and is unicode friendly . - -declare class Transport { - static transports: { - SMTP: Transport; - SES: Transport; - SENDMAIL: Transport; - STUB: Transport; - }; - - constructor(type: string, options?: any); - options: Object; - transportType: string; - sendMailWithTransport(emailMessage: MailComposer, callback?: (err: Error) => any): any; - useDKIM(dkim: DKIMOptions): void; - close(callback?: (err: Error) => any): any; - sendMail(message: MailComposer, callback?: (err: Error) => any): any; - send_mail(message:MailComposer, callback?: (err: Error) => any): any; -} - -interface NodeMailerAttachment { - fileName: string; - filePath?: string; - contents?: any; - contentType?: string; - cid?: string; -} - -interface MailComposer { - from: string; // sender info - to: string; // Comma separated list of recipients - subject: string; // Subject of the message - headers?: {}; - text?: string; // plaintext body - html?: string; // HTML body - attachments?: NodeMailerAttachment[]; // An array of attachments - forceEmbeddedImages?: boolean; -} - -interface DKIMOptions{ - domainName: string; // signing domain - keySelector: string; // selector name (in this case there's a dkim._domainkey.do-not-trust.node.ee TXT record set up) - privateKey: any; -} - -declare class XOAuthGenerator { - constructor(options: XOAuthGeneratorOptions); - generate(callback: () => any): string; -} - -interface XOAuthGeneratorOptions { - user: string; - consumerKey: string; // optional - consumerSecret: string; // optional - token: string; - tokenSecret: string; -} - -interface XOAuth2Options { - user: string; - clientId: string; - clientSecret: string; - refreshToken: string; -} - -interface NodemailerTransportOptions { - service?: string; - auth?: NodemailerAuthInterface; - debug?: boolean; - AWSAccessKeyID?: string; - AWSSecretKey: string; - ServiceUrl: string; -} - -interface NodemailerAuthInterface { - user?: string; - pass?: string; - XOAuthToken?: XOAuthGenerator; - XOAuth2?: XOAuth2Options; -} - -interface NodemailerSMTPTransportOptions { - service?: string; - host?: string; - port?: number; - secureConnection?: boolean; - name?: string; - auth: NodemailerAuthInterface; - ignoreTLS?: boolean; - debug?: boolean; - maxConnections?: number; -} - - -interface Nodemailer { - createTransport(type: string): Transport; - createTransport(type: string, options: NodemailerTransportOptions): Transport; - createTransport(type: string, options: NodemailerSMTPTransportOptions): Transport; - createTransport(type: string, path: string): Transport; - createXOAuthGenerator(options: XOAuthGeneratorOptions): XOAuthGenerator; -} - -declare module "nodemailer" { - var nodemailer: Nodemailer; - export = nodemailer; -} +// Type definitions for Nodemailer 1.3.2 +// Project: https://github.com/andris9/Nodemailer +// Definitions by: Rogier Schouten +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// +/// +/// +/// + +declare module "nodemailer" { + + import directTransport = require("nodemailer-direct-transport"); + import smtpTransport = require("nodemailer-smtp-transport"); + + export type Transport = nodemailer.Transport; + export type SendMailOptions = nodemailer.SendMailOptions; + export type SentMessageInfo = nodemailer.SentMessageInfo; + + /** + * Transporter plugin + */ + export interface Plugin { + (mail: SendMailOptions, callback?: (error: Error, info: SentMessageInfo) => void): void; + } + + /** + * This is what you use to send mail + */ + export interface Transporter { + /** + * Send a mail + */ + sendMail(mail: SendMailOptions, callback?: (error: Error, info: SentMessageInfo) => void): void; + + /** + * Attach a plugin. 'compile' and 'stream' plugins can be attached with use(plugin) method + * + * @param step is a string, either 'compile' or 'stream' thatd defines when the plugin should be hooked + * @param pluginFunc is a function that takes two arguments: the mail object and a callback function + */ + use(step: string, plugin: Plugin): void; + + + /** + * Close all connections + */ + close?(): void; + } + + /** + * Create a direct transporter + */ + export function createTransport(options?: directTransport.DirectOptions): Transporter; + /** + * Create an SMTP transporter + */ + export function createTransport(options?: smtpTransport.SmtpOptions): Transporter; + /** + * Create a transporter from a given implementation + */ + export function createTransport(transport: Transport): Transporter; +} diff --git a/oauth.js/oauth.js-tests.ts b/oauth.js/oauth.js-tests.ts new file mode 100644 index 000000000..81fa694b8 --- /dev/null +++ b/oauth.js/oauth.js-tests.ts @@ -0,0 +1,95 @@ +/// + +var encoded1: string = OAuth.percentEncode("abcあいう"); +var encoded2: string = OAuth.percentEncode(["abc", "あいう"]); +var decoded1: string = OAuth.decodePercent("abc%E3%81%82%E3%81%84%E3%81%86"); + +var list: OAuth.ParameterList; +list = OAuth.getParameterList([["name1", "value1"], ["name2", "value2"]]); +list = OAuth.getParameterList({ name1: "value1", name2: "value2" }); +list = OAuth.getParameterList("name1=value1&name2=value2"); + +var map: OAuth.ParameterMap; +map = OAuth.getParameterMap([["name1", "value1"], ["name2", "value2"]]); +map = OAuth.getParameterMap({ name1: "value1", name2: "value2" }); +map = OAuth.getParameterMap("name1=value1&name2=value2"); + +var param: string; +param = OAuth.getParameter([["name1", "value1"], ["name2", "value2"]], "name1"); +param = OAuth.getParameter({ name1: "value1", name2: "value2" }, "name1"); +param = OAuth.getParameter("name1=value1&name2=value2", "name1"); + +var formEncoded1: string = OAuth.formEncode([["name1", "value1"], ["name2", "value2"]]); +var formEncoded2: string = OAuth.formEncode({ name1: "value1", name2: "value2" }); + +var formDecoded1: OAuth.ParameterList = OAuth.decodeForm("name1=value1&name2=value2"); + +var message1: OAuth.Message = { action: "http://example.org/", method: "GET", parameters: [] }; +OAuth.setParameter(message1, "name1", "value1"); +var message2: OAuth.Message = { action: "http://example.org/", method: "GET", parameters: {} }; +OAuth.setParameter(message2, "name1", "value1"); + +var message3: OAuth.Message = { action: "http://example.org/", method: "GET", parameters: [] }; +OAuth.setParameters(message3, [["name1", "value1"], ["name2", "value2"]]); +OAuth.setParameters(message3, { name3: "value3", name4: "value4" }); +OAuth.setParameters(message3, "name5=value5&name6=value6"); +var message4: OAuth.Message = { action: "http://example.org/", method: "GET", parameters: {} }; +OAuth.setParameters(message4, [["name1", "value1"], ["name2", "value2"]]); +OAuth.setParameters(message4, { name3: "value3", name4: "value4" }); +OAuth.setParameters(message4, "name5=value5&name6=value6"); + +var accessor: OAuth.Accessor = { consumerKey: "ck", consumerSecret: "cs", token: "t", tokenSecret: "ts" }; +var message5: OAuth.Message = { action: "http://example.org/", method: "GET", parameters: [["name1", "value1"]] }; +OAuth.completeRequest(message5, accessor); +var message6: OAuth.Message = { action: "http://example.org/", method: "GET", parameters: { name1: "value1" } }; +OAuth.completeRequest(message6, accessor); + +var message7: OAuth.Message = { action: "http://example.org/", method: "GET", parameters: [["name1", "value1"]] }; +OAuth.setTimestampAndNonce(message7); +var message8: OAuth.Message = { action: "http://example.org/", method: "GET", parameters: { name1: "value1" } }; +OAuth.setTimestampAndNonce(message8); + +var url1: string = OAuth.addToURL("http://example.org/", [["name1", "value1"]]); +var url2: string = OAuth.addToURL("http://example.org/?name1=value1", [["name1", "value1"]]); +var url3: string = OAuth.addToURL("http://example.org/", { name1: "value1" }); +var url4: string = OAuth.addToURL("http://example.org/?name1=value1", { name1: "value1" }); + +var authorizationHeader1: string = OAuth.getAuthorizationHeader("realm", [["name1", "value1"], ["oauth_param1", "oauth_value1"]]); +var authorizationHeader2: string = OAuth.getAuthorizationHeader("realm", { name1: "value1", oauth_param1: "oauth_value1" }); +var authorizationHeader3: string = OAuth.getAuthorizationHeader("realm", "name1=value1&oauth_param1=oauth_value1"); + +OAuth.correctTimestampFromSrc(); +OAuth.correctTimestampFromSrc("timestamp_param_name"); + +OAuth.correctTimestamp((new Date()).getTime() / 1000); + +var timeCorrectionMsec: number = OAuth.timeCorrectionMsec; + +var timestamp: number = OAuth.timestamp(); + +var nonce: string = OAuth.nonce(16); + + +var message9: OAuth.Message = { method: "GET", action: "http://example.org/1", parameters: [] }; +var baseString: string = OAuth.SignatureMethod.getBaseString(message9); + +var normalizedUrl: string = OAuth.SignatureMethod.normalizeUrl("http://example.org:80/2"); + +var uri: OAuth.Uri = OAuth.SignatureMethod.parseUri("http://example.org:80/3?name1=value1&name2=value2"); + +var normalizedParameters1: string = OAuth.SignatureMethod.normalizeParameters([["name1", "value1"], ["name2", "value2"]]); +var normalizedParameters2: string = OAuth.SignatureMethod.normalizeParameters({ name1: "value1", name2: "value2" }); + +var message10: OAuth.Message = { action: "http://example.org/", method: "GET", parameters: [["name1", "value1"]] }; +OAuth.SignatureMethod.sign(message9, accessor); + +var signatureMethodConstructor: { new (): OAuth.SignatureMethod; } = + OAuth.SignatureMethod.makeSubclass(function getSignature(baseString) { return this.key }); +OAuth.SignatureMethod.registerMethodClass(["PLAINTEXT"], signatureMethodConstructor); + +var signatureMethod1: OAuth.SignatureMethod = OAuth.SignatureMethod.newMethod("PLAINTEXT", accessor); +var message11: OAuth.Message = { action: "http://example.org/", method: "GET", parameters: [["name1", "value1"]] }; +var signature: string = signatureMethod1.sign(message11); +var signatureMethod2: OAuth.SignatureMethod = new signatureMethodConstructor(); +signatureMethod2.initialize("PLAINTEXT", accessor); + diff --git a/oauth.js/oauth.js.d.ts b/oauth.js/oauth.js.d.ts new file mode 100644 index 000000000..24baa0990 --- /dev/null +++ b/oauth.js/oauth.js.d.ts @@ -0,0 +1,197 @@ +// Type definitions for JavaScript software for implementing an OAuth consumer +// Project: https://code.google.com/p/oauth/ +// Definitions by: NOBUOKA Yu +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module OAuth { + + /** An Array of name-value pairs [[name, value], [name2, value2]]. */ + type ParameterList = [string, string][]; + + /** A map {name: value, name2: value2}. */ + type ParameterMap = { [name: string]: string; }; + + type ParameterListOrMap = ParameterList|ParameterMap; + + /** + * An OAuth message is represented as an object like this: + * { method: "GET", action: "http://server.com/path", parameters: ... } + */ + interface Message { + action: string; + method: string; + parameters: ParameterListOrMap; + } + + /** + * SignatureMethod expects an accessor object to be like this: + * {tokenSecret: "lakjsdflkj...", consumerSecret: "QOUEWRI..", accessorSecret: "xcmvzc..."} + * The accessorSecret property is optional. + */ + interface Accessor { + consumerKey: string; + consumerSecret: string; + accessorSecret?: string; + token: string; + tokenSecret: string; + } + + /** + * Encode text value according to OAuth Percent Encoding. + * @see {@link https://tools.ietf.org/html/rfc5849#section-3.6} + * @param s Target text value. + */ + function percentEncode(s: string): string; + + /** + * Encode text values according to OAuth Percent Encoding. + * Encoded values are joined with an ampersand character (&) in between them. + * @see {@link https://tools.ietf.org/html/rfc5849#section-3.6} + * @param s Target text values. + */ + function percentEncode(s: string[]): string; + + /** + * Decode percent-encoded value. + * @see {@link https://tools.ietf.org/html/rfc5849#section-3.6} + * @param s Target percent-encoded value. + */ + function decodePercent(s: string): string; + + /** + * Convert the given parameters to an Array of name-value pairs. + */ + function getParameterList(parameters: ParameterListOrMap): ParameterList; + + /** + * Convert the given parameters to an Array of name-value pairs. + */ + function getParameterList(parameters: string): ParameterList; + + /** + * Convert the given parameters to a map from name to value. + */ + function getParameterMap(parameters: ParameterListOrMap): ParameterMap; + + /** + * Convert the given parameters to a map from name to value. + */ + function getParameterMap(parameters: string): ParameterMap; + + function getParameter(parameters: ParameterListOrMap, name: string): string; + function getParameter(parameters: string, name: string): string; + + function formEncode(parameters: ParameterListOrMap): string; + + function decodeForm(form: string): ParameterList; + + function setParameter(message: Message, name: string, value: string): void; + + function setParameters(message: Message, parameters: ParameterListOrMap): void; + function setParameters(message: Message, parameters: string): void; + + /** + * Fill in parameters to help construct a request message. + * This function doesn't fill in every parameter. + * @param message Target request message. + * @param accessor Accessor object. The accessorSecret property is optional. + */ + function completeRequest(message: Message, accessor: Accessor): void; + + function setTimestampAndNonce(message: Message): void; + + /** + * Add specified parameters into URL as query parameters. + * @param url URL that parameters added into. + * @param parameters Parameters added into URL. + * @return New URL string. + */ + function addToURL(url: string, parameters: ParameterListOrMap): string; + + /** Construct the value of the Authorization header for an HTTP request. */ + function getAuthorizationHeader(realm: string, parameters: ParameterListOrMap): string; + function getAuthorizationHeader(realm: string, parameters: string): string; + + /** Correct the time using a parameter from the URL from which the last script was loaded. */ + function correctTimestampFromSrc(parameterName?: string): void; + + /** Generate timestamps starting with the given value. */ + function correctTimestamp(timestamp: number): void; + + /** The difference between the correct time and my clock. */ + var timeCorrectionMsec: number; + + function timestamp(): number; + + function nonce(length: number): string; + + interface Uri { + source: string; + protocol: string; + authority: string; + userInfo: string; + user: string; + password: string; + host: string; + port: string; + relative: string; + path: string; + directory: string; + file: string; + query: string; + anchor: string; + } + + interface SignatureMethodStatic { + sign(message: Message, accessor: Accessor): void; + + /** Instantiate a SignatureMethod for the given method name. */ + newMethod(name: string, accessor: Accessor): SignatureMethod; + + /** A map from signature method name to constructor. */ + REGISTERED: { [name: string]: { new (): SignatureMethod }; }; + + /** + * Subsequently, the given constructor will be used for the named methods. + * The constructor will be called with no parameters. + * The resulting object should usually implement getSignature(baseString). + * You can easily define such a constructor by calling makeSubclass method. + */ + registerMethodClass(names: string[], classConstructor: { new(): SignatureMethod }): void; + + /** + * Create a subclass of OAuth.SignatureMethod, with the given getSignature function. + * @param getSignatureFunction + */ + makeSubclass(getSignatureFunction: (baseString: string) => string): { new(): SignatureMethod }; + + /** + * Generate a signature base string from a Message object. + * @see {@link https://tools.ietf.org/html/rfc5849#section-3.4.1} + * @param message Source of the signature base string. + */ + getBaseString(message: Message): string; + + normalizeUrl(url: string): string; + + parseUri(str: string): Uri; + + normalizeParameters(parameters: ParameterListOrMap): string; + } + + interface SignatureMethod { + getSignature(baseString: string): string; + + key: string; + + /** Add a signature to the message. */ + sign(message: Message): string; + + /** Set the key string for signing. */ + initialize(name: string, accessor: Accessor): void; + } + + var SignatureMethod: SignatureMethodStatic; + +} + diff --git a/object-path/object-path-tests.ts b/object-path/object-path-tests.ts index d29cec141..0b696abd9 100644 --- a/object-path/object-path-tests.ts +++ b/object-path/object-path-tests.ts @@ -23,20 +23,26 @@ obj.get(array); obj.set(array, 'value'); obj.insert(1, 10); -objectPath.del(array) === ['12']; -objectPath.del(object) === object; +objectPath.del(object, array) === object; +objectPath.del(object, [1,2]) === object; +objectPath.del(object, [1,'2']) === object; +objectPath.del(object, 1) === object; +objectPath.del(object, '1') === object; objectPath.del(object) === object; obj.del() === object; objectPath.has(object, ['1','2','3']) === true; objectPath.has(object, ['1.2.3']) === false; objectPath.has(object, [1,2,3]) === true; +objectPath.has(object, [1,'2',3]) === true; objectPath.has(object, 1) === false; +objectPath.has(object, '1') === false; objectPath.has() === false; objectPath.del() === void 0; objectPath.del(object, ['1','2','3']); objectPath.del(object, [1,2,3]); +objectPath.del(object, [1,'2',3]); objectPath.del(object, 1); objectPath.del(object, 'one').one === 1; obj.del('one').one === 1; @@ -45,13 +51,15 @@ objectPath.coalesce(object, ['1','2']) === void 0; objectPath.coalesce(object, ['1',['2','1']]) === void 0; objectPath.coalesce(object, ['1',['2','1']], 1) === 1; objectPath.coalesce(object, [1,1], 1) === 1; -objectPath.coalesce(object, >[1,[1,1]], 1) === 1; -obj.coalesce(>[1,[1,1]], 1) === 1; +objectPath.coalesce(object, [1,'1'], 1) === 1; +objectPath.coalesce(object, [1,[1,1],'1',[1,'1']], 1) === 1; +obj.coalesce([1,[1,1],'1',['1',1]], 1) === 1; objectPath.ensureExists(object, '1.2', 2); objectPath.ensureExists(object, 1, 2); objectPath.ensureExists(object, [1,2], 2); objectPath.ensureExists(object, ['1','2'], 2); +objectPath.ensureExists(object, ['1',2], 2); objectPath.ensureExists(object, ['1','2'], 2) === 3; objectPath.ensureExists(object, ['1','2'], 2) === [[]]; obj.ensureExists(['1','2'], 2) === [[]]; @@ -60,7 +68,9 @@ objectPath.push(object, 1, 1,2,3,4); objectPath.push(object, 1, 1,'2', 3, false); objectPath.push(object, 'one.four', 1,'2', 3, false); objectPath.push(object, ['one','two'], [1,'2', 3, false]); +objectPath.push(object, [1, 'two'], [1,'2', 3, false]); obj.push(['one','two'], [1,'2', 3, false]); +obj.push(['one', 2], [1,'2', 3, false]); objectPath.get(array) === array; objectPath.get(Null) === Null; @@ -73,16 +83,20 @@ objectPath.get(object, 0, 3) === 3; objectPath.get(object, 0, '3') === '3'; objectPath.get(object, 0, ['1','2']) === ['1','2']; objectPath.get(object, 0) === 10; -obj.get(0) === 10; +objectPath.get(object, 0) === 10; +obj.get(0, 10) === 10; objectPath.set(object, '1.2', true); objectPath.set(object, ['1','2'], true); objectPath.set(object, [1, 2], true); +objectPath.set(object, [1, '2'], true); objectPath.set(object, '1.2', true, true); objectPath.set(object, '1.2', true, false); objectPath.set(object, '1.2', true, false) === ['string']; objectPath.set(object, '1.2', true, false) === object; obj.set('1.2', true, false) === object; +obj.set(['1','2'], true, false) === object; +obj.set(['1', 2], true, false) === object; objectPath.insert(object, '1.2', 1); objectPath.insert(object, ['1','2'], 1); @@ -90,5 +104,8 @@ objectPath.insert(object, 1, 1); objectPath.insert(object, [1,2], 1); objectPath.insert(object, '1.2', 1, 2); objectPath.insert(object, ['1.2'], 1, 6); +objectPath.insert(object, ['1',2], 1, 6); obj.insert(['1.2'], 1, 6); - +obj.insert(1, 1, 6); +obj.insert(['1',1], 1, 6); +obj.insert('1', 1, 6); \ No newline at end of file diff --git a/object-path/object-path.d.ts b/object-path/object-path.d.ts index 711a305dc..dd9137610 100644 --- a/object-path/object-path.d.ts +++ b/object-path/object-path.d.ts @@ -3,17 +3,12 @@ // Definitions by: Paulo Cesar // Definitions: https://github.com/borisyankov/DefinitelyTyped -declare var objectPath: objectPath.IObjectPathStatic; +declare var objectPath: ObjectPathGlobal.IObjectPathStatic; -declare module objectPath { +declare module ObjectPathGlobal { - interface IStringArray { - [index: number]: string; - } - - interface INumberArray { - [index: number]: number; - } + type IPath = Array|number|string; + type IMultiArray = Array; interface IObjectPathStatic { /** @@ -29,23 +24,11 @@ declare module objectPath { * @param {string[]|string} path * @return object */ - del(object: T, path: IStringArray): T; + del(object: T, path: IPath): T; /** * @see objectPath.del */ - del(object: T, path: INumberArray): T; - /** - * @see objectPath.del - */ - del(object: T, path: number): T; - /** - * @see objectPath.del - */ - del(object: T, path: string): T; - /** - * @see objectPath.del - */ - del(object: T): T; + del(object: T):T; /** * @see objectPath.del */ @@ -58,19 +41,7 @@ declare module objectPath { * @param {string[]|string} path * @return object */ - has(object: T, path: IStringArray): boolean; - /** - * @see objectPath.has - */ - has(object: T, path: INumberArray): boolean; - /** - * @see objectPath.has - */ - has(object: T, path: string): boolean; - /** - * @see objectPath.has - */ - has(object: T, path: number): boolean; + has(object: T, path: IPath): boolean; /** * @see objectPath.has */ @@ -87,19 +58,7 @@ declare module objectPath { * @param {string|string[]|number|number[]} path * @param {*} [defaultValue=undefined] */ - get(object: T, path: string, defaultValue?: TResult): TResult; - /** - * @see objectPath.get - */ - get(object: T, path: IStringArray, defaultValue?: TResult): TResult; - /** - * @see objectPath.get - */ - get(object: T, path: number, defaultValue?: TResult): TResult; - /** - * @see objectPath.get - */ - get(object: T, path: INumberArray, defaultValue?: TResult): TResult; + get(object: T, path: IPath, defaultValue?: TResult): TResult; /** * @see objectPath.get */ @@ -118,19 +77,7 @@ declare module objectPath { * @param {boolean} [doNotReplace=false] * @return Any existing value on the path if any */ - set(object: T, path: string, value: any, doNotReplace?:boolean): TExisting; - /** - * @see objectPath.set - */ - set(object: T, path: number, value: any, doNotReplace?:boolean): TExisting; - /** - * @see objectPath.set - */ - set(object: T, path: IStringArray, value: any, doNotReplace?:boolean): TExisting; - /** - * @see objectPath.set - */ - set(object: T, path: INumberArray, value: any, doNotReplace?:boolean): TExisting; + set(object: T, path: IPath, value: any, doNotReplace?:boolean): TExisting; /** * @see objectPath.set */ @@ -145,19 +92,7 @@ declare module objectPath { * Create (if path isn't an array) and push the value to it. Can push unlimited number of values * @param {object} object */ - push(object: T, path: INumberArray, ...args:any[]):void; - /** - * @see objectPath.push - */ - push(object: T, path: IStringArray, ...args:any[]):void; - /** - * @see objectPath.push - */ - push(object: T, path: number, ...args:any[]):void; - /** - * @see objectPath.push - */ - push(object: T, path: string, ...args:any[]):void; + push(object: T, path: IPath, ...args:any[]):void; /** * @see objectPath.push */ @@ -171,19 +106,7 @@ declare module objectPath { * @param {*} defaultValue * @return {*} */ - coalesce(object: T, paths: IStringArray, defaultValue?: any):TResult; - /** - * @see objectPath.coalesce - */ - coalesce(object: T, paths: INumberArray, defaultValue?: any):TResult; - /** - * @see objectPath.coalesce - */ - coalesce(object: T, paths: IStringArray[], defaultValue?: any):TResult; - /** - * @see objectPath.coalesce - */ - coalesce(object: T, paths: INumberArray[], defaultValue?: any):TResult; + coalesce(object: T, paths: IMultiArray, defaultValue?: TResult):TResult; /*======== Empty =========*/ /** @@ -192,19 +115,7 @@ declare module objectPath { * @param {object} object * @param {string|string[]|number[]} path */ - empty(object: T, path: string):TResult; - /** - * @see objectPath.empty - */ - empty(object: T, path: INumberArray):TResult; - /** - * @see objectPath.empty - */ - empty(object: T, path: IStringArray):TResult; - /** - * @see objectPath.empty - */ - empty(object: T, path: number):TResult; + empty(object: T, path: IPath):TResult; /** * @see objectPath.empty */ @@ -220,19 +131,7 @@ declare module objectPath { * @param {object} object * @param {string|string[]|number|number[]} path */ - ensureExists(object: T, path: string, value: any):TResult; - /** - * @see objectPath.ensureExists - */ - ensureExists(object: T, path: number, value: any):TResult; - /** - * @see objectPath.ensureExists - */ - ensureExists(object: T, path: INumberArray, value: any):TResult; - /** - * @see objectPath.ensureExists - */ - ensureExists(object: T, path: IStringArray, value: any):TResult; + ensureExists(object: T, path: IPath, value: any):TExisting; /** * @see objectPath.ensureExists */ @@ -250,19 +149,7 @@ declare module objectPath { * @param {*} value * @param {number} [at=0] */ - insert(object: T, path: string, value: any, at?: number):void; - /** - * @see objectPath.insert - */ - insert(object: T, path: INumberArray, value: any, at?: number):void; - /** - * @see objectPath.insert - */ - insert(object: T, path: IStringArray, value: any, at?: number):void; - /** - * @see objectPath.insert - */ - insert(object: T, path: number, value: any, at?: number):void; + insert(object: T, path: IPath, value: any, at?: number):void; } interface IObjectPathBound { @@ -271,19 +158,7 @@ declare module objectPath { /** * @see objectPath.ensureExists */ - del(path: IStringArray): T; - /** - * @see objectPath.del - */ - del(path: INumberArray): T; - /** - * @see objectPath.del - */ - del(path: number): T; - /** - * @see objectPath.del - */ - del(path: string): T; + del(path: IPath): T; /** * @see objectPath.del */ @@ -293,19 +168,7 @@ declare module objectPath { /** * @see objectPath.ensureExists */ - has(path: IStringArray): boolean; - /** - * @see objectPath.has - */ - has(path: INumberArray): boolean; - /** - * @see objectPath.has - */ - has(path: string): boolean; - /** - * @see objectPath.has - */ - has(path: number): boolean; + has(path: IPath): boolean; /** * @see objectPath.has */ @@ -315,19 +178,7 @@ declare module objectPath { /** * @see objectPath.ensureExists */ - get(path: string, defaultValue?: TResult): TResult; - /** - * @see objectPath.get - */ - get(path: IStringArray, defaultValue?: TResult): TResult; - /** - * @see objectPath.get - */ - get(path: number, defaultValue?: TResult): TResult; - /** - * @see objectPath.get - */ - get(path: INumberArray, defaultValue?: TResult): TResult; + get(path: IPath, defaultValue?: TResult): TResult; /** * @see objectPath.get */ @@ -337,19 +188,7 @@ declare module objectPath { /** * @see objectPath.ensureExists */ - set(path: string, value: any, doNotReplace?:boolean): TExisting; - /** - * @see objectPath.set - */ - set(path: number, value: any, doNotReplace?:boolean): TExisting; - /** - * @see objectPath.set - */ - set(path: IStringArray, value: any, doNotReplace?:boolean): TExisting; - /** - * @see objectPath.set - */ - set(path: INumberArray, value: any, doNotReplace?:boolean): TExisting; + set(path: IPath, value: any, doNotReplace?:boolean): TExisting; /** * @see objectPath.set */ @@ -359,19 +198,7 @@ declare module objectPath { /** * @see objectPath.ensureExists */ - push(path: INumberArray, ...args:any[]):void; - /** - * @see objectPath.push - */ - push(path: IStringArray, ...args:any[]):void; - /** - * @see objectPath.push - */ - push(path: number, ...args:any[]):void; - /** - * @see objectPath.push - */ - push(path: string, ...args:any[]):void; + push(path: IPath, ...args:any[]):void; /** * @see objectPath.push */ @@ -381,37 +208,13 @@ declare module objectPath { /** * @see objectPath.ensureExists */ - coalesce(paths: IStringArray, defaultValue?: any):TResult; - /** - * @see objectPath.coalesce - */ - coalesce(paths: INumberArray, defaultValue?: any):TResult; - /** - * @see objectPath.coalesce - */ - coalesce(paths: IStringArray[], defaultValue?: any):TResult; - /** - * @see objectPath.coalesce - */ - coalesce(paths: INumberArray[], defaultValue?: any):TResult; + coalesce(paths: IMultiArray, defaultValue?: TResult):TResult; /*======== Empty =========*/ /** * @see objectPath.ensureExists */ - empty(path: string):TResult; - /** - * @see objectPath.empty - */ - empty(path: INumberArray):TResult; - /** - * @see objectPath.empty - */ - empty(path: IStringArray):TResult; - /** - * @see objectPath.empty - */ - empty(path: number):TResult; + empty(path: IPath):T; /** * @see objectPath.empty */ @@ -421,19 +224,7 @@ declare module objectPath { /** * @see objectPath.ensureExists */ - ensureExists(path: string, value: any):TResult; - /** - * @see objectPath.ensureExists - */ - ensureExists(path: number, value: any):TResult; - /** - * @see objectPath.ensureExists - */ - ensureExists(path: INumberArray, value: any):TResult; - /** - * @see objectPath.ensureExists - */ - ensureExists(path: IStringArray, value: any):TResult; + ensureExists(path: IPath, value: any):TExisting; /** * @see objectPath.ensureExists */ @@ -443,19 +234,7 @@ declare module objectPath { /** * @see objectPath.insert */ - insert(path: string, value: any, at?: number):void; - /** - * @see objectPath.insert - */ - insert(path: INumberArray, value: any, at?: number):void; - /** - * @see objectPath.insert - */ - insert(path: IStringArray, value: any, at?: number):void; - /** - * @see objectPath.insert - */ - insert(path: number, value: any, at?: number):void; + insert(path: IPath, value: any, at?: number):void; } } diff --git a/papaparse/papaparse-tests.ts b/papaparse/papaparse-tests.ts new file mode 100644 index 000000000..14cc40bb3 --- /dev/null +++ b/papaparse/papaparse-tests.ts @@ -0,0 +1,55 @@ +/// + +import Papa = require("papaparse"); + +/** + * Parsing + */ +var res = Papa.parse("3,3,3"); + +res.errors[0].code; + +Papa.parse("3,3,3", { + delimiter: ';', + comments: false, + + step: function(results, p) { + p.abort(); + results.data.length; + } +}); + +var file = new File(); + +Papa.parse(file, { + complete: function(a, b) { + a.meta.fields; + b.name; + } +}); + +/** + * Unparsing + */ +Papa.unparse([{a: 1, b: 1, c: 1}]); +Papa.unparse([[1, 2, 3], [4, 5, 6]]); +Papa.unparse({ + fields: ["3"], + data: [] +}); + + + +/** + * Properties + */ +Papa.SCRIPT_PATH; +Papa.LocalChunkSize; + +/** + * Parser + */ +var parser = new Papa.Parser({}) +parser.getCharIndex(); +parser.abort(); +parser.parse("", 0, false); \ No newline at end of file diff --git a/papaparse/papaparse.d.ts b/papaparse/papaparse.d.ts new file mode 100644 index 000000000..028dd2aab --- /dev/null +++ b/papaparse/papaparse.d.ts @@ -0,0 +1,144 @@ +// Type definitions for PapaParse v4.1 +// Project: https://github.com/mholt/PapaParse +// Definitions by: Pedro Flemming +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module PapaParse { + interface Static { + /** + * Parse a csv string or a csv file + */ + parse(csvString: string, config?: ParseConfig): ParseResult; + + parse(file: File, config?: ParseConfig): ParseResult; + + /** + * Unparses javascript data objects and returns a csv string + */ + unparse(data: Array, config?: UnparseConfig): string; + + unparse(data: Array>, config?: UnparseConfig): string; + + unparse(data: UnparseObject, config?: UnparseConfig): string; + + /** + * Read-Only Properties + */ + // An array of characters that are not allowed as delimiters. + BAD_DELIMETERS: Array; + + // The true delimiter. Invisible. ASCII code 30. Should be doing the job we strangely rely upon commas and tabs for. + RECORD_SEP: string; + + // Also sometimes used as a delimiting character. ASCII code 31. + UNIT_SEP: string; + + // Whether or not the browser supports HTML5 Web Workers. If false, worker: true will have no effect. + WORKERS_SUPPORTED: boolean; + + // The relative path to Papa Parse. This is automatically detected when Papa Parse is loaded synchronously. + SCRIPT_PATH: string; + + /** + * Configurable Properties + */ + // The size in bytes of each file chunk. Used when streaming files obtained from the DOM that exist on the local computer. Default 10 MB. + LocalChunkSize: string; + + // Same as LocalChunkSize, but for downloading files from remote locations. Default 5 MB. + RemoteChunkSize: string; + + // The delimiter used when it is left unspecified and cannot be detected automatically. Default is comma. + DefaultDelimiter: string; + + /** + * On Papa there are actually more classes exposed + * but none of them are officially documented + * Since we can interact with the Parser from one of the callbacks + * I have included the API for this class. + */ + Parser: ParserConstructor; + } + + interface ParseConfig { + delimiter?: string; // default: "" + newline?: string; // default: "" + header?: boolean; // default: false + dynamicTyping?: boolean; // default: false + preview?: number; // default: 0 + encoding?: string; // default: "" + worker?: boolean; // default: false + comments?: boolean; // default: false + download?: boolean; // default: false + skipEmptyLines?: boolean; // default: false + fastMode?: boolean; // default: undefined + + // Callbacks + step?(results: ParseResult, parser: Parser): void; // default: undefined + complete?(results: ParseResult, file?: File): void; // default: undefined + error?(error: ParseError, file?: File): void; // default: undefined + chunk?(results: ParseResult, parser: Parser): void; // default: undefined + beforeFirstChunk?(chunk: string): string|void; // default: undefined + } + + interface UnparseConfig { + quotes: boolean; // default: false + delimiter: string; // default: "," + newline: string; // default: "\r\n" + } + + interface UnparseObject { + fields: Array; + data: string | Array; + } + + interface ParseError { + type: string; // A generalization of the error + code: string; // Standardized error code + message: string; // Human-readable details + row: number; // Row index of parsed data where error is + } + + interface ParseMeta { + delimiter: string; // Delimiter used + linebreak: string; // Line break sequence used + aborted: boolean; // Whether process was aborted + fields: Array; // Array of field names + truncated: boolean; // Whether preview consumed all input + } + + /** + * @interface ParseResult + * + * data: is an array of rows. If header is false, rows are arrays; otherwise they are objects of data keyed by the field name. + * errors: is an array of errors + * meta: contains extra information about the parse, such as delimiter used, the newline sequence, whether the process was aborted, etc. Properties in this object are not guaranteed to exist in all situations + */ + interface ParseResult { + data: Array; + errors: Array; + meta: ParseMeta; + } + + /** + * Parser + */ + interface ParserConstructor { new(config: ParseConfig): Parser; } + interface Parser { + // Parses the input + parse(input: string, baseIndex: number, ignoreLastRow: boolean): any; + + // Sets the abort flag + abort(): void; + + // Gets the cursor position + getCharIndex(): number; + } +} + +declare var Papa: PapaParse.Static; + +declare module "papaparse" { + var Papa: PapaParse.Static; + export = Papa; +} diff --git a/parallel/parallel.d.ts b/parallel/parallel.d.ts index 049ecda7d..8d880f698 100644 --- a/parallel/parallel.d.ts +++ b/parallel/parallel.d.ts @@ -102,3 +102,7 @@ declare class Parallel { public require(fn: Function): Parallel; } +/* commonjs binding for npm use */ +declare module "paralleljs" { + export = Parallel; +} \ No newline at end of file diff --git a/parse/parse.d.ts b/parse/parse.d.ts index 1aab10416..9f8df5c3f 100644 --- a/parse/parse.d.ts +++ b/parse/parse.d.ts @@ -842,7 +842,6 @@ declare module Parse { INVALID_CONTENT_LENGTH = 128, FILE_TOO_LARGE = 129, FILE_SAVE_ERROR = 130, - FILE_DELETE_ERROR = 153, DUPLICATE_VALUE = 137, INVALID_ROLE_NAME = 139, EXCEEDED_QUOTA = 140, @@ -851,6 +850,9 @@ declare module Parse { INVALID_IMAGE_DATA = 150, UNSAVED_FILE_ERROR = 151, INVALID_PUSH_TIME_ERROR = 152, + FILE_DELETE_ERROR = 153, + REQUEST_LIMIT_EXCEEDED = 155, + INVALID_EVENT_NAME = 160, USERNAME_MISSING = 200, PASSWORD_MISSING = 201, USERNAME_TAKEN = 202, @@ -860,6 +862,7 @@ declare module Parse { SESSION_MISSING = 206, MUST_CREATE_USER_THROUGH_SIGNUP = 207, ACCOUNT_ALREADY_LINKED = 208, + INVALID_SESSION_TOKEN = 209, LINKED_ID_MISSING = 250, INVALID_LINKED_SESSION = 251, UNSUPPORTED_SERVICE = 252, diff --git a/passport-local/passport-local-tests.ts b/passport-local/passport-local-tests.ts index de799a4d8..f462846b8 100644 --- a/passport-local/passport-local-tests.ts +++ b/passport-local/passport-local-tests.ts @@ -44,6 +44,26 @@ passport.use(new local.Strategy(function (username, password, done) { }); })); +passport.use(new local.Strategy({ + passReqToCallback: true +}, function (req, username, password, done) { + User.findOne({ username: username }, function (err, user) { + if (err) { + return done(err); + } + + if (!user) { + return done(null, false); + } + + if (!user.verifyPassword(password)) { + return done(null, false); + } + + return done(null, user); + }); +})); + // Sample from https://github.com/jaredhanson/passport-local#authenticate-requests var app = express(); app.post('/login', diff --git a/passport-local/passport-local.d.ts b/passport-local/passport-local.d.ts index d61e51b15..34fca8194 100644 --- a/passport-local/passport-local.d.ts +++ b/passport-local/passport-local.d.ts @@ -16,16 +16,26 @@ declare module 'passport-local' { passReqToCallback?: boolean; } + interface IStrategyOptionsWithRequest { + usernameField?: string; + passwordField?: string; + passReqToCallback: boolean; + } + interface IVerifyOptions { message: string; } - interface VerifyFunction { + interface VerifyFunctionWithRequest { (req: express.Request, username: string, password: string, done: (error: any, user?: any, options?: IVerifyOptions) => void): void; + } + + interface VerifyFunction { (username: string, password: string, done: (error: any, user?: any, options?: IVerifyOptions) => void): void; } class Strategy implements passport.Strategy { + constructor(options: IStrategyOptionsWithRequest, verify: VerifyFunctionWithRequest); constructor(options: IStrategyOptions, verify: VerifyFunction); constructor(verify: VerifyFunction); diff --git a/pickadate/pickadate-tests.ts b/pickadate/pickadate-tests.ts index 4700310b8..21bc5b074 100644 --- a/pickadate/pickadate-tests.ts +++ b/pickadate/pickadate-tests.ts @@ -1,279 +1,796 @@ -/// -/// +/// -function testApiMethods(api: Pickadate.Api) { - api.clear(); - api.close(); - api.close(true); - api.get('value'); - api.get('value', 'yyyy-mm-dd'); - api.off('open'); - api.off('open', 'close', 'render'); - api.on('set', (context: {[key: string]: any}) => { }); - api.on('get', () => { }); - api.open(); - api.open(true); - api.render(); - api.render(true); - api.set('value', '2014-09-23'); - api.set({ - value: '2014-09-23', - max: new Date(2014, 12, 1) - }); - api.start(); - api.stop(); - api.trigger('open'); +// Date picker tests from http://amsul.ca/pickadate.js/date/ - api.start().open().close().stop(); +$('.datepicker').pickadate(); - var pickerInputElement = api.$node; - pickerInputElement.show(); - - var pickerRootElement = api.$root; - pickerRootElement.show(); -} - -function testDateApiMethods(api: Pickadate.DateApi) { - api.get('select'); - api.get('select', 'yyyy/mm/dd'); - api.get('highlight'); - api.get('highlight', 'yyyy/mm/dd'); - api.get('view'); - api.get('view', 'yyyy/mm/dd'); - api.get('min'); - api.get('min', 'yyyy/mm/dd'); - api.get('max'); - api.get('max', 'yyyy/mm/dd'); -} - -function testTimeApiMethods(api: Pickadate.TimeApi) { - api.get('select'); - api.get('select', 'hh:i'); - api.get('highlight'); - api.get('highlight', 'hh:i'); - api.get('view'); - api.get('view', 'hh:i'); - api.get('min'); - api.get('min', 'hh:i'); - api.get('max'); - api.get('max', 'hh:i'); -} - -// ==================================================================================================================== - -var datePickerInput = $("input.date"); - -datePickerInput.pickadate(); - -datePickerInput.pickadate({ - monthsFull: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'], - monthsShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], - weekdaysFull: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'], - weekdaysShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], - showMonthsShort: true, - showWeekdaysFull: true, - - today: 'Today', - clear: 'Clear', - close: 'Close', - - labelMonthNext: 'Next month', - labelMonthPrev: 'Previous month', - labelMonthSelect: 'Select a month', - labelYearSelect: 'Select a year', - - // Formats - format: 'd mmmm, yyyy', - formatSubmit: 'yyyy-mm-dd', - hiddenPrefix: 'foo', - hiddenSuffix: '_submit', - hiddenName: 'bar', - - // Editable input - editable: true, - - // Dropdown selectors - selectYears: true, - selectMonths: 10, - - // First day of the week - firstDay: 0, - - // Date limits - min: new Date(2013, 3, 20), - max: [2013, 7, 14], - - // Disable dates - disable: [ new Date(2013, 3, 21) ], - - // Root container - container: '.root-container', - - // Events - onStart: () => { }, - onRender: () => { }, - onOpen: () => { }, - onClose: () => { }, - onSet: (context: {[key: string]: any}) => { }, - onStop: () => { } +// Change the month and weekday labels +$('.datepicker').pickadate({ + weekdaysShort: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'], + showMonthsShort: true }); -datePickerInput.pickadate({ - klass: { - // The element states - input: 'picker__input', - active: 'picker__input--active', +// Change button text or hide a button completely +$('.datepicker').pickadate({ + today: '', + clear: 'Clear selection', + close: 'Cancel' +}); - // The root picker and states * - picker: 'picker', - opened: 'picker--opened', - focused: 'picker--focused', +// Change the title attributes of several elements within the picker +$('.datepicker').pickadate({ + labelMonthNext: 'Go to the next month', + labelMonthPrev: 'Go to the previous month', + labelMonthSelect: 'Pick a month from the dropdown', + labelYearSelect: 'Pick a year from the dropdown', + selectMonths: true, + selectYears: true +}); - // The picker holder - holder: 'picker__holder', +// Extend the default picker options for all instances. +$.extend($.fn.pickadate.defaults, { + monthsFull: ['Janvier', 'Février', 'Mars', 'Avril', 'Mai', 'Juin', 'Juillet', 'Août', 'Septembre', 'Octobre', 'Novembre', 'Décembre'], + weekdaysShort: ['Dim', 'Lun', 'Mar', 'Mer', 'Jeu', 'Ven', 'Sam'], + today: 'aujourd\'hui', + clear: 'effacer', + formatSubmit: 'yyyy/mm/dd' +}); - // The picker frame, wrapper, and box - frame: 'picker__frame', - wrap: 'picker__wrap', - box: 'picker__box', +// Or, pass the months and weekdays as an array for each invocation. +$('.datepicker').pickadate({ + monthsFull: ['Janvier', 'Février', 'Mars', 'Avril', 'Mai', 'Juin', 'Juillet', 'Août', 'Septembre', 'Octobre', 'Novembre', 'Décembre'], + weekdaysShort: ['Dim', 'Lun', 'Mar', 'Mer', 'Jeu', 'Ven', 'Sam'], + today: 'aujourd\'hui', + clear: 'effacer', + formatSubmit: 'yyyy/mm/dd' +}); - // The picker header - header: 'picker__header', +// Display a human-friendly format and use an alternate one to submit to the server +$('.datepicker').pickadate({ + // Escape any "rule" characters with an exclamation mark (!). + format: 'You selecte!d: dddd, dd mmm, yyyy', + formatSubmit: 'yyyy/mm/dd', + hiddenPrefix: 'prefix__', + hiddenSuffix: '__suffix' +}); - // Month navigation - navPrev: 'picker__nav--prev', - navNext: 'picker__nav--next', - navDisabled: 'picker__nav--disabled', +// Send the hidden value only +$('.datepicker').pickadate({ + formatSubmit: 'yyyy/mm/dd', + hiddenName: true +}); - // Month & year labels - month: 'picker__month', - year: 'picker__year', +// Editable input +$('.datepicker').pickadate({ + editable: true +}); - // Month & year dropdowns - selectMonth: 'picker__select--month', - selectYear: 'picker__select--year', +// Display select menus to pick the month and year +$('.datepicker').pickadate({ + selectYears: true, + selectMonths: true +}); - // Table of dates - table: 'picker__table', +// Specify the number of years to show in the dropdown using an +// even integer - half before and half after the year in focus: +$('.datepicker').pickadate({ + // `true` defaults to 10. + selectYears: 4 +}); - // Weekday labels - weekdays: 'picker__weekday', +// The first day of the week can be set to either Sunday or Monday. +// Anything truth-y sets it as Monday and anything false-y as Sunday. +$('.datepicker').pickadate({ + firstDay: 1 +}); - // Day states - day: 'picker__day', - disabled: 'picker__day--disabled', - selected: 'picker__day--selected', - highlighted: 'picker__day--highlighted', - now: 'picker__day--today', - infocus: 'picker__day--infocus', - outfocus: 'picker__day--outfocus', +// Date Limits - // The picker footer - footer: 'picker__footer', +// Using JavaScript dates +$('.datepicker').pickadate({ + min: new Date(2013, 3, 20), + max: new Date(2013, 7, 14) +}); - // Today, clear, & close buttons - buttonClear: 'picker__button--clear', - buttonClose: 'picker__button--close', - buttonToday: 'picker__button--today' +// Using arrays formatted as [YEAR,MONTH,DATE] +$('.datepicker').pickadate({ + min: [2013, 3, 20], + max: [2013, 7, 14] +}); + +// Using integers or a boolean +$('.datepicker').pickadate({ + // An integer (positive/negative) sets it relative to today. + min: -15, + // `true` sets it to today. `false` removes any limits. + max: true +}); + +// Disable dates + +// Using JavaScript dates +$('.datepicker').pickadate({ + disable: [ + new Date(2013, 3, 13), + new Date(2013, 3, 29) + ] +}); + +// Using arrays formatted as [YEAR,MONTH,DATE] +$('.datepicker').pickadate({ + disable: [ + [2015, 3, 3], + [2015, 3, 12], + [2015, 3, 20] + ] +}); + +// Using integers as days of the week (1 to 7) +$('.datepicker').pickadate({ + disable: [ + 1, 4, 7 + ] +}); + +// Using objects as a range of dates +$('.datepicker').pickadate({ + disable: [ + { from: [2016, 2, 14], to: [2016, 2, 27] } + ] +}); + +// Enable only a specific or arbitrary set of dates by setting true as the first item in the collection +$('.datepicker').pickadate({ + disable: [ + true, + 1, 4, 7, + [2013, 3, 3], + [2013, 3, 12], + [2013, 3, 20], + new Date(2015, 3, 13), + new Date(2015, 3, 29) + ] +}); + +// Enable dates that fall within a range of disabled dates by adding +// the inverted parameter to the item within the collection +$('.datepicker').pickadate({ + disable: [ + 5, + [2015, 10, 21, 'inverted'], + { from: [2016, 3, 15], to: [2016, 3, 25] }, + [2016, 3, 20, 'inverted'], + { from: [2016, 3, 17], to: [2016, 3, 18], inverted: true } + ] +}); + +// Specify where to insert the root element by passing any valid CSS selector to the container option +$('.datepicker').pickadate({ + container: '#root-picker-outlet' +}); + +// Specify where to insert the hidden element by passing any valid CSS selector to the containerHidden option +$('.datepicker').pickadate({ + containerHidden: '#hidden-input-outlet' +}); + +// Close on a user action +$('.datepicker').pickadate({ + closeOnSelect: false, + closeOnClear: false +}); + +// Fire off events as the user interacts with the picker +$('.datepicker').pickadate({ + onStart: function () { + console.log('Hello there :)') + }, + onRender: function () { + console.log('Whoa.. rendered anew') + }, + onOpen: function () { + console.log('Opened up') + }, + onClose: function () { + console.log('Closed now') + }, + onStop: function () { + console.log('See ya.') + }, + onSet: function (context) { + console.log('Just set stuff:', context) } }); -var datePickerApi = datePickerInput.pickadate('picker'); +// Time picker tests from http://amsul.ca/pickadate.js/time/ -datePickerInput.pickadate('open'); -datePickerInput.pickadate('get', 'value'); -datePickerInput.pickadate('$node').show(); -datePickerInput.pickadate('$root').show(); -datePickerInput.pickadate('_hidden').show(); +$('.timepicker').pickatime(); -testApiMethods(datePickerApi); -testDateApiMethods(datePickerApi); +// Extend the default picker options for all instances. +$.extend($.fn.pickatime.defaults, { + clear: 'Effacer' +}); -// ==================================================================================================================== +// Or, pass the months and weekdays as an array for each invocation. +$('.timepicker').pickatime({ + clear: 'Effacer' +}); -var timePickerInput = $("input.time"); +// Change the text or hide the button completely by passing a false-y value +$('.timepicker').pickatime({ + clear: '' +}); -timePickerInput.pickatime(); - -timePickerInput.pickatime({ - // Translations and clear button - clear: 'Clear', - - // Formats - format: 'h:i A', +// Display a human-friendly label and input format and use an alternate one to submit +$('.timepicker').pickatime({ + // Escape any "rule" characters with an exclamation mark (!). + format: 'T!ime selected: h:i a', formatLabel: 'h:i a', formatSubmit: 'HH:i', hiddenPrefix: 'prefix__', - hiddenSuffix: '__suffix', - - // Editable input - editable: true, - - // Time intervals - interval: 30, - - // Time limits - min: new Date(2013, 3, 20, 7), - max: [7, 14], - - // Disable times - disable: [ new Date(2013, 3, 21, 7) ], - - // Root container - container: '.root-container', - - // Events - onStart: () => { }, - onRender: () => { }, - onOpen: () => { }, - onClose: () => { }, - onSet: (context: {[key: string]: any}) => { }, - onStop: () => { } + hiddenSuffix: '__suffix' }); -timePickerInput.pickatime({ - klass: { - // The element states - input: 'picker__input', - active: 'picker__input--active', - - // The root picker and states * - picker: 'picker picker--time', - opened: 'picker--opened', - focused: 'picker--focused', - - // The picker holder - holder: 'picker__holder', - - // The picker frame, wrapper, and box - frame: 'picker__frame', - wrap: 'picker__wrap', - box: 'picker__box', - - // List of times - list: 'picker__list', - listItem: 'picker__list-item', - - // Time states - disabled: 'picker__list-item--disabled', - selected: 'picker__list-item--selected', - highlighted: 'picker__list-item--highlighted', - viewset: 'picker__list-item--viewset', - now: 'picker__list-item--now', - - // Clear button - buttonClear: 'picker__button--clear' +// The formatLabel option is unique. It can contain HTML and it can also +// be a function if you want to create the label during run-time: +$('.timepicker').pickatime({ + formatLabel: function (time) { + var hours = (time.pick - this.get('now').pick) / 60, + label = hours < 0 ? ' !hours to now' : hours > 0 ? ' !hours from now' : 'now' + return 'h:i a ' + (hours ? Math.abs(hours) : '') + label + '' } }); -var timePickerApi = timePickerInput.pickatime('picker'); +// Send the hidden value only +$('.timepicker').pickatime({ + formatSubmit: 'HH:i', + hiddenName: true +}); -timePickerInput.pickatime('open'); -timePickerInput.pickatime('get', 'value'); -timePickerInput.pickatime('$node').show(); -timePickerInput.pickatime('$root').show(); -timePickerInput.pickatime('_hidden').show(); +// Editable input +$('.timepicker').pickatime({ + editable: true +}); -testApiMethods(timePickerApi); -testTimeApiMethods(timePickerApi); +// Choose the minutes interval between each time in the list +$('.timepicker').pickatime({ + interval: 150 +}); +// Time Limits + +// Using JavaScript dates +$('.timepicker').pickatime({ + min: new Date(2015, 3, 20, 7), + max: new Date(2015, 7, 14, 18, 30) +}); + +// Using arrays formatted as [HOUR,MINUTE] +$('.timepicker').pickatime({ + min: [7, 30], + max: [14, 0] +}); + +// Using integers or a boolean +$('.timepicker').pickatime({ + // An integer (positive/negative) sets it as intervals relative from now. + min: -5, + // `true` sets it to now. `false` removes any limits. + max: true +}); + +// Disable Times + +// Using JavaScript dates +$('.timepicker').pickatime({ + disable: [ + new Date(2016, 3, 20, 4, 30), + new Date(2016, 3, 20, 9) + ] +}); + +// Using arrays formatted as [HOUR,MINUTE] +$('.timepicker').pickatime({ + disable: [ + [0, 30], + [2, 0], + [8, 30], + [9, 0] + ] +}); + +// Using integers as hours (0 to 23) +$('.timepicker').pickatime({ + disable: [ + 3, 5, 7 + ] +}); + +// Using objects as a range of times +$('.timepicker').pickatime({ + disable: [ + { from: [2, 0], to: [5, 30] } + ] +}); + +// Enable only a specific or arbitrary set of times by setting true as the first item in the collection +$('.timepicker').pickatime({ + disable: [ + true, + 3, 5, 7, + [0, 30], + [2, 0], + [8, 30], + [9, 0] + ] +}); + +// Enable times that fall within a range of disabled times by adding +// the inverted parameter to the item within the collection +$('.timepicker').pickatime({ + disable: [ + 1, + [1, 30, 'inverted'], + { from: [4, 30], to: [10, 30] }, + [6, 30, 'inverted'], + { from: [8, 0], to: [9, 0], inverted: true } + ] +}); + +// Specify where to insert the root element by passing any valid CSS selector to the container option +$('.timepicker').pickatime({ + container: '#root-picker-outlet' +}); + +// Specify where to insert the hidden element by passing any valid CSS selector to the containerHidden option +$('.timepicker').pickatime({ + containerHidden: '#hidden-input-outlet' +}); + +// Close on a user action +$('.timepicker').pickatime({ + closeOnSelect: false, + closeOnClear: false +}); + +// Fire off events as the user interacts with the picker +$('.timepicker').pickatime({ + onStart: function () { + console.log('Hello there :)') + }, + onRender: function () { + console.log('Whoa.. rendered anew') + }, + onOpen: function () { + console.log('Opened up') + }, + onClose: function () { + console.log('Closed now') + }, + onStop: function () { + console.log('See ya.') + }, + onSet: function (context) { + console.log('Just set stuff:', context) + } +}); + +// API tests from http://amsul.ca/pickadate.js/api/ + +var $input = $('.datepicker').pickadate(); + +// Use the picker object directly. +var picker = $input.pickadate('picker'); + +picker.$node; +picker.$root; +picker._hidden; + +// Or pass through the element’s plugin data. +$input.pickadate('open'); +$input.pickadate('close'); +$input.pickadate('close'); +$input.pickadate('start'); +$input.pickadate('stop'); +$input.pickadate('render'); +$input.pickadate('get'); +$input.pickadate('set', 'highlight', 1429970887654); +$input.pickadate('on', 'open', function () { }); +$input.pickadate('on', 'close', function () { }); +$input.pickadate('off', 'open', 'close'); +$input.pickadate('trigger', 'open'); + +$input.pickadate('$node'); +$input.pickadate('$root'); +$input.pickadate('_hidden'); + +picker.open().clear().close(); + +picker.open(); +picker.close(); +picker.close(true); + +picker.open(false); +$(document).on('click', function () { + picker.close(); +}); + +picker.start(); +picker.stop(); +picker.render(); +picker.render(true); +picker.clear(); + +picker.get(); // Short for `picker.get('value')` + +picker.get('select'); +picker.get('select', 'yyyy/mm/dd'); + +picker.get('highlight'); +picker.get('highlight', 'yyyy/mm/dd'); + +picker.get('view'); +picker.get('view', 'yyyy/mm/dd'); + +picker.get('min'); +picker.get('min', 'yyyy/mm/dd'); +picker.get('max'); +picker.get('max', 'yyyy/mm/dd'); + +picker.get('open'); +picker.get('start'); +picker.get('id'); +picker.get('enable'); +picker.get('disable'); + +// Set multiple at once +picker.set({ + select: new Date(2015, 3, 20), + highlight: [2015, 3, 20], + min: -4 +}); + +// Muted callbacks + +// One at a time +picker.set('disable', 'flip', { muted: true }); + +// Multiple at once +picker.set({ + select: [1988, 7, 14], + view: new Date(1988, 7, 14), + max: 4 +}, { muted: true }); + +// Clear the value in the picker’s input element. +picker.set('clear'); + +// Set select for a date item object + +// Using arrays formatted as [YEAR,MONTH,DATE]. +picker.set('select', [2013, 3, 20]); + +// Using JavaScript Date objects. +picker.set('select', new Date(2013, 3, 20)); + +// Using positive integers as UNIX timestamps. +picker.set('select', 1365961912346); + +// Using a string along with the parsing format (defaults to `format` option). +picker.set('select', '2016-04-20', { format: 'yyyy-mm-dd' }); + +// Set select for a time item object + +// Using arrays formatted as [HOUR,MINUTE]. +picker.set('select', [3, 0]); + +// Using JavaScript Date objects. +picker.set('select', new Date(2015, 3, 20, 10, 30)); + +// Using positive integers as minutes. +picker.set('select', 540); + +// Using a string along with the parsing format (defaults to `format` option). +picker.set('select', '04-30', { format: 'hh-i' }); + +// Set highlight for a date item object + +// Using arrays formatted as [YEAR,MONTH,DATE]. +picker.set('highlight', [2013, 3, 20]); + +// Using JavaScript Date objects. +picker.set('highlight', new Date(2015, 3, 30)); + +// Using positive integers as UNIX timestamps. +picker.set('highlight', 1365961912346); + +// Using a string along with the parsing format (defaults to `format` option). +picker.set('highlight', '2016-04-20', { format: 'yyyy-mm-dd' }); + +// Set highlight for a time item object + +// Using arrays formatted as [HOUR,MINUTE]. +picker.set('highlight', [15, 30]); + +// Using JavaScript Date objects. +picker.set('highlight', new Date(2015, 3, 20, 10, 30)); + +// Using positive integers as minutes. +picker.set('highlight', 1080); + +// Using a string along with the parsing format (defaults to `format` option). +picker.set('highlight', '04-30', { format: 'hh-i' }); + +// Set view for a date item object + +// Using arrays formatted as [YEAR,MONTH,DATE]. +picker.set('view', [2000, 3, 20]); + +// Using JavaScript Date objects. +picker.set('view', new Date(1988, 7, 14)); + +// Using positive integers as UNIX timestamps. +picker.set('view', 1587355200000); + +// Using a string along with the parsing format (defaults to `format` option). +picker.set('view', '2016-04-20', { format: 'yyyy-mm-dd' }); + +// Set view for a time item object + +// Using arrays formatted as [HOUR,MINUTE]. +picker.set('view', [15, 30]); + +// Using JavaScript Date objects. +picker.set('view', new Date(2015, 3, 20, 10, 30)); + +// Using positive integers as minutes. +picker.set('view', 1080); + +// Using a string along with the parsing format (defaults to `format` option). +picker.set('view', '04-30', { format: 'hh-i' }); + +// Limit the min date + +// Using arrays formatted as [YEAR,MONTH,DATE]. +picker.set('min', [2013, 3, 20]); + +// Using JavaScript Date objects. +picker.set('min', new Date(2015, 7, 14)); + +// Using formatted strings. +picker.set('min', '8 January, 2016'); + +// Using integers as days relative to today. +picker.set('min', -4); + +// Using `true` for "today". +picker.set('min', true); + +// Using `false` to remove. +picker.set('min', false); + +// Limit the min time + +// Using arrays formatted as [HOUR,MINUTE]. +picker.set('min', [15, 30]); + +// Using JavaScript Date objects. +picker.set('min', new Date(2015, 3, 20, 10, 30)); + +// Using formatted strings. +picker.set('min', '4:30 PM'); + +// Using integers as intervals relative from now. +picker.set('min', -4); + +// Using `true` for "now". +picker.set('min', true); + +// Using `false` to remove. +picker.set('min', false); + +// Limit the max date + +// Using arrays formatted as [YEAR,MONTH,DATE]. +picker.set('max', [2013, 3, 20]); + +// Using JavaScript Date objects. +picker.set('max', new Date(2015, 7, 14)); + +// Using formatted strings. +picker.set('max', '20 April, 2016'); + +// Using integers as days relative to today. +picker.set('max', 4); + +// Using `true` for "today". +picker.set('max', true); + +// Using `false` to remove. +picker.set('max', false); + +// Limit the max time + +// Using arrays formatted as [HOUR,MINUTE]. +picker.set('max', [15, 30]); + +// Using JavaScript Date objects. +picker.set('max', new Date(2015, 3, 20, 10, 30)); + +// Using formatted strings. +picker.set('max', '11:30 AM'); + +// Using integers as intervals relative from now. +picker.set('max', 4); + +// Using `true` for "now". +picker.set('max', true); + +// Using `false` to remove. +picker.set('max', false); + +// Disable/enable specific dates +picker.set('disable', [ + // Using a collection of arrays formatted as [YEAR,MONTH,DATE] + [2016, 9, 3], [2016, 9, 9], [2016, 9, 20], + + // Using JavaScript Date objects + new Date(2015, 9, 13), new Date(2015, 9, 24) +]); + +picker.set('enable', [ + [2016, 9, 9], + [2016, 9, 13], + new Date(2015, 9, 20) +]); + +// Disable/enable ranges of dates +picker.set('disable', [ + 1, 4, 7, // Using integers as the days of the week (1 to 7) + + // Using a range object with a "from" and "to" property + { from: [2016, 2, 14], to: [2016, 2, 27] } +]); + +picker.set('enable', [ + 4, + { from: [2016, 2, 24], to: [2016, 2, 27] } +]); + +// "Flip" the enabled and disabled dates: +picker.set('disable', 'flip'); +picker.set('enable', 'flip'); + +// Disable all the dates +picker.set('disable', true); +picker.set('enable', false); + +// Enable all the dates +picker.set('enable', true); +picker.set('disable', false); + +// Disable/enable specific times +picker.set('disable', [ + // Using a collection of arrays formatted as [HOUR,MINUTES] + [2, 30], [4, 30], [9, 0], + + // Using JavaScript Date objects + new Date(2015, 9, 13, 6), new Date(2015, 9, 13, 12, 30) +]); + +picker.set('enable', [ + [4, 30], [6, 0], + new Date(2015, 9, 13, 9) +]); + +// Disable/enable ranges of times +picker.set('disable', [ + 1, 4, 7, // Using integers as hours of the day (from 0 to 23) + + // Using a range object with a “from” and “to” property + { from: [10, 30], to: [18, 0] } +]); + +picker.set('enable', [ + 4, + { from: [14, 0], to: [16, 30] } +]); + +// "Flip" the enabled and disabled times: +picker.set('disable', 'flip'); +picker.set('enable', 'flip'); + +// Disable all the times +picker.set('disable', true); +picker.set('enable', true); + +// Enable all the times +picker.set('enable', true); +picker.set('disable', false); + +// Enable an element within a disabled range + +picker.set('disable', [ + // Disable all Mondays, except November 15th, 2015. + 1, [2015, 10, 15, 'inverted'], + + // Disable all dates from March 2nd, 2016 to March 28th, 2016 + // except for March 10th and all between March 14th and March 23rd. + { from: [2016, 2, 2], to: [2016, 2, 28] }, + [2016, 2, 10, 'inverted'], + { from: [2016, 2, 14], to: [2016, 2, 23], inverted: true } +]); + +picker.set('disable', [ + // Disable all times from 1:00 AM to 1:59 AM, except 1:30 AM. + 1, [1, 30, 'inverted'], + + // Disable all times from 3:00 AM to 6:00 PM except + // for 4:30 AM and all between 7:30 AM and 11:30 AM. + { from: [3, 0], to: [18, 0] }, + [4, 30, 'inverted'], + { from: [7, 30], to: [11, 30], inverted: true } +]); + +// For the time picker only, you can change the interval between each time display +// using integers representing the interval length in minutes. +picker.set('interval', 15); +picker.set('interval', 20); +picker.set('interval', 120); + + +picker.on({ + open: function () { + console.log('Opened up!') + }, + close: function () { + console.log('Closed now') + }, + render: function () { + console.log('Just rendered anew') + }, + stop: function () { + console.log('See ya') + }, + set: function (thingSet) { + console.log('Set stuff:', thingSet) + } +}); + +$('.datepicker').pickadate({ + onOpen: function () { + console.log('Opened up!') + }, + onClose: function () { + console.log('Closed now') + }, + onRender: function () { + console.log('Just rendered anew') + }, + onStart: function () { + console.log('Hello there :)') + }, + onStop: function () { + console.log('See ya') + }, + onSet: function (thingSet) { + console.log('Set stuff:', thingSet) + } +}); + +picker.on('open', function () { + console.log('Even when I’m opened, I’m not logged..'); +}); +picker.off('open'); + +// Trigger an event’s callbacks that have been queued up +picker.on('open', function () { + console.log('This logs without opening!'); +}); +picker.trigger('open'); + +// Optionally, you can also pass some data to the method being triggered +picker.on('open', function (data) { + console.log('This logs without opening with this data:', data); +}); +picker.trigger('open', { some: 'value' }); diff --git a/pickadate/pickadate.d.ts b/pickadate/pickadate.d.ts index 1f96085f7..ac8e7b181 100644 --- a/pickadate/pickadate.d.ts +++ b/pickadate/pickadate.d.ts @@ -1,474 +1,545 @@ -// Type definitions for pickadate.js 3.5.4 +// Type definitions for pickadate.js 3.5.5 // Project: https://github.com/amsul/pickadate.js -// Definitions by: Adi Dahiya +// Definitions by: Theodore Brown // Definitions: https://github.com/borisyankov/DefinitelyTyped +/// + declare module Pickadate { + // KlassOptions shared between date and time pickers + interface KlassOptions { + // The element states + input?: string; // default 'picker__input' + active?: string; // default 'picker__input--active' - export interface Api { - /** - * Clear the value in the picker's input element. - */ - clear(): Pickadate.Api; + // The root picker and states + picker?: string; // default 'picker' or 'picker picker--time' + opened?: string; // default 'picker--opened' + focused?: string; // default 'picker--focused' - /** - * Close the picker. - * - * @param keepFocus whether to retain focus on the input element (default: false) - */ - close(keepFocus?: boolean): Pickadate.Api; + // The picker holder + holder?: string; // default 'picker__holder' - /** - * Get the properties, objects, and states of the picker. - * - * @param field one of [ "value", "select", "highlight", "view", "min", "max", "open", "start", "id", "disable", "enable" ] - * @param format string formatter (available for certain fields) - */ - get(field: string, format?: string): any; + // The picker frame, wrapper, and box + frame?: string; // default 'picker__frame' + wrap?: string; // default 'picker__wrap' + box?: string; // default 'picker__box' - /** - * Returns the string value of the picker’s input element. - */ - get(field: "value"): string; + // Day/Time states + disabled?: string; // default 'picker__day--disabled' or 'picker__list-item--disabled' + selected?: string // default 'picker__day--selected' or 'picker__list-item--selected' + highlighted?: string // default 'picker__day--highlighted' or 'picker__list-item--highlighted' + now?: string; // default 'picker__day--today' or 'picker__list-item--now' - /** - * Returns a boolean value of whether the picker is open or not. - */ - get(field: "open"): boolean; - - /** - * Returns a boolean value of whether the picker has started or not. - */ - get(field: "start"): boolean; - - /** - * Returns a unique string that is the ID of the picker and it’s element. If the element has no ID, it is set to something random. - */ - get(field: "id"): string; - - /** - * "enable" and "disable" work together to determine which item objects to disable on the picker. - * - * "enable" returns 1 to represent a base enabled state, meaning that specific dates or times are disabled and all others are enabled; - * or -1 to indicate a base disabled state, meaning that specific dates or times are enabled and all others are disabled. - */ - get(field: "enable"): number; - - /** - * If "enable" is 1, returns the collection of dates or times to disable. If "enable" is -1, returns the collection of dates or - * times to *not* disable. - */ - get(field: "disable"): any; - - /** - * Unbind callbacks that are bound using the `on` method. - * @param methodName one of [ "open, "close", "render", "start", "stop", "set" ] - */ - off(methodName: string, ...moreMethodNames: string[]): Pickadate.Api; - - /** - * Attach an event handler for the picker. Only "set" events callbacks receive a "context" object. - * - * @param methodName event to attach handler to, one of [ "open", "close", "render", "start", "stop", or "set" ] - * @param callback event handler - */ - on(methodName: string, callback: (context?: any) => void): Pickadate.Api; - - /** - * Open the picker. - * - * @param keepFocus whether to focus the input element (default: true) - */ - open(keepFocus?: boolean): Pickadate.Api; - - /** - * Refresh the picker after adding something to the holder. - * By default, only the "face" of the picker (i.e. the box element), has its contents re-rendered. - * - * @param fromRoot whether to render the entire picker from the root up (default: false) - */ - render(fromRoot?: boolean): Pickadate.Api; - - /** - * Set the properties, objects, and states of the picker. - * - * @param field one of [ "clear", "select", "highlight", "view", "min", "max", "disable", "enable", "interval" ] - * @param value the thing you want to set - */ - set(field: string, value: any, options?: {[key: string]: any}): Pickadate.Api; - /** - * Batch set picker options after initialization. - */ - set(values: {[field: string]: any}, options?: {[key: string]: any}): Pickadate.Api; - - /** - * Rebuild the picker. - */ - start(): Pickadate.Api; - - /** - * Destroy the picker. - */ - stop(): Pickadate.Api; - - /** - * Trigger a picker event. - * @param eventName the event to trigger - */ - trigger(eventName: string): Pickadate.Api; - - /** - * The picker's relative element. - */ - $node: JQuery; - - /** - * The picker's relative root holder element. - */ - $root: JQuery; - - /** - * The picker's relative hidden element, which is undefined if there's no formatSubmit option. - * This is meant to be mostly for internal use. - */ - _hidden: JQuery; + // Clear button + buttonClear?: string; // default 'picker__button--clear' } - export interface DateApi extends Api { - get(field: string, format?: string): any; + interface DateKlassOptions extends KlassOptions { + // The picker header + header?: string; // default 'picker__header' - /** - * Returns the item object or formatted string of the date that is visually selected. - * Defaults to null when there’s no value. - */ - get(field: "select"): DateItem; - get(field: "select", format: string): string; + // Month navigation + navPrev?: string; // default 'picker__nav--prev' + navNext?: string; // default 'picker__nav--next' + navDisabled?: string; // default 'picker__nav--disabled' - /** - * Returns the item object or formatted string of the date that is visually highlighted. - * Defaults to "today" when there’s no value. - */ - get(field: "highlight"): DateItem; - get(field: "highlight", format: string): string; + // Month & year labels + month?: string; // default 'picker__month' + year?: string; // default 'picker__year' - /** - * Returns the item object or formatted string of the date that determines the current view. - * Defaults to the first day of the current month when there’s no value. - */ - get(field: "view"): DateItem; - get(field: "view", format: string): string; + // Month & year dropdowns + selectMonth?: string; // default 'picker__select--month' + selectYear?: string; // default 'picker__select--year' - /** - * Returns the item object or formatted string of the date that determines the lower limit. - * Defaults to a -Infinity item object when it is not explicitly set in the options or through the picker’s API. - */ - get(field: "min"): DateItem; - get(field: "min", format: string): string; + // Table of dates + table?: string; // default 'picker__table' - /** - * Returns the item object or formatted string of the date that determines the upper limit. - * Defaults to an Infinity item object when it is not explicitly set in the options or through the picker’s API. - */ - get(field: "max"): DateItem; - get(field: "max", format: string): string; + // Weekday labels + weekdays?: string; // default 'picker__weekday' + + // Day states + day?: string; // default 'picker__day' + infocus?: string; // default 'picker__day--infocus' + outfocus?: string; // default 'picker__day--outfocus' + + // The picker footer + footer?: string; // default 'picker__footer' + + // Today & close buttons + buttonClose?: string; // default 'picker__button--close' + buttonToday?: string; // default 'picker__button--today' } - export interface DateItem { - // The full year. - year: number; + interface TimeKlassOptions extends KlassOptions { + // The root picker + picker?: string; // default 'picker picker--time' - // The month with zero-as-index. - month: number; + // List of times + list?: string; // default 'picker__list' + listItem?: string; // default 'picker__list-item' - // The date of the month. - date: number; - - // The day of the week with zero-as-index. - day: number; - - // The underlying JavaScript Date object. - obj: Date; - - // The "pick" value used for comparisons. - pick: number; + // Time states + viewset?: string; // default 'picker__list-item--viewset' } - export interface DateOptions { - // String and translations - monthsFull?: string[]; - monthsShort?: string[]; - weekdaysFull?: string[]; - weekdaysShort?: string[] + // options shared between date and time pickers + interface Options { + /** + * Set the clear button text. + * Defaults to 'Clear' + */ + clear?: string; + + /** + * The human-friendly display format. + * Escape any "rule" characters with an exclamation mark (!). + * Defaults to 'd mmmm, yyyy' + */ + format?: string; + + /** + * An alternate format to submit to the server. + * Defaults to undefined. + */ + formatSubmit?: string; + + /** + * An optional name prefix for the new hidden input element used + * when a custom human-friendly display format is specified. + * Defaults to undefined. + */ + hiddenPrefix?: string; + + /** + * An optional name suffix for the new hidden input element used + * when a custom human-friendly display format is specified. + * Defaults to '_submit' + */ + hiddenSuffix?: string; + + /** + * A majority of the time, the value that needs to be sent to the server + * is just the hidden value and not the visible one. To make this happen, + * use the hiddenName option. This essentially nullifies the hiddenPrefix + * and hiddenSuffix, strips the name attribute from the source input, and + * then sets it as the name of the hidden input. Defaults to undefined. + */ + hiddenName?: boolean; + + /** + * By default, typing into the input is disabled by giving it a readOnly + * attribute. Setting the editable option to true allows the input field + * to be edited directly. + */ + editable?: boolean; + + /** + * Specify where to insert the picker's root element by passing any + * valid CSS selector to this option. Defaults to undefined. + */ + container?: string; + + /** + * The hidden input container. + * Defaults to undefined. + */ + containerHidden?: string; + + /** + * Whether or not to close the picker when a date is selected. + * Defaults to `true`. + */ + closeOnSelect?: boolean; + + /** + * Whether or not to close the picker when the "clear" button is pressed. + * Defaults to `true`. + */ + closeOnClear?: boolean; + + // Events + onStart?: (event: any) => void; + onRender?: (event: any) => void; + onOpen?: (event: any) => void; + onClose?: (event: any) => void; + onSet?: (event: any) => void; + onStop?: (event: any) => void; + } + + type MinOrMaxDateOption = Date | [number, number, number] | number | boolean; + type MinOrMaxTimeOption = Date | [number, number] | number | boolean; + + export interface DateOptions extends Options { + // Strings and translations + monthsFull?: string[]; // default 'January' through 'December' + monthsShort?: string[]; // default 'Jan' through 'Dec' + weekdaysFull?: string[]; // default 'Sunday' through 'Saturday' + weekdaysShort?: string[]; // default 'Sun' through 'Sat' showMonthsShort?: boolean; showWeekdaysFull?: boolean; - // Button labels (if falsy, the corresponding button is disabled) - today?: string; - clear?: string; - close?: string; + // Buttons + today?: string; // default 'Today' + close?: string; // default 'Close' // Accessibility labels - labelMonthNext?: string; - labelMonthPrev?: string; - labelMonthSelect?: string; - labelYearSelect?: string; + labelMonthNext?: string; // default 'Next month' + labelMonthPrev?: string; // default 'Previous month' + labelMonthSelect?: string; // default 'Select a month' + labelYearSelect?: string; //default 'Select a year' - // Formats - format?: string; - formatSubmit?: string; - hiddenPrefix?: string; - hiddenSuffix?: string; - hiddenName?: string; + /** + * True enables the dropdown selector and false replaces it with text. + * You can also specify the number of years to show in the dropdown + * using an even integer - half before and half after the year in focus. + * If true the value will default to 10. + */ + selectYears?: boolean | number; - // Editable input - editable?: boolean; + /** + * True enables the dropdown selector and false replaces it with text + */ + selectMonths?: boolean; - // Number of months to show in the month selection dropdown OR a boolean - selectMonths?: any; - // Number of years to show in the month selection dropdown OR a boolean - selectYears?: any; + /** + * The first day of the week can be set to either Sunday or Monday. + * True or 1 sets it as Monday and false or 0 as Sunday. + */ + firstDay?: boolean | number; - // First day of the week - firstDay?: number + /** + * Set the minimum selectable date on the picker. Accepts a Date object, + * array formatted as [YEAR, MONTH, DATE], a positive or negative integer + * for a date relative to today, or a boolean (`true` sets it to today, + * `false` removes any limit). + */ + min?: MinOrMaxDateOption; - // Disable dates (elements can be Dates, [YEAR, MONTH, DATE] arrays, or integers of the week) + /** + * Set the maximum selectable date on the picker. + * Accepts the same values as the `min` property. + */ + max?: MinOrMaxDateOption; + + /** + * Disable a specific or arbitrary set of dates selectable on the + * picker. Accepts an array of Date objects, arrays formatted as + * [YEAR, MONTH, DATE], integers representing days of the week + * (from 1 to 7), or objects with a range of dates. Switch to a + * whitelist by setting `true` as the first item in the collection. + * Enable dates that fall within a range of disabled dates by + * adding an `inverted` parameter to the item within the collection. + */ disable?: any[]; - // Root container selector (string) or element (JQuery) - container?: any; - - // Events - onStart?: () => void; - onRender?: () => void; - onOpen?: () => void; - onClose?: () => void; - onSet?: (context: {[key: string]: any}) => void; - onStop?: () => void; - // Classes klass?: DateKlassOptions; } - export interface DateKlassOptions { - // The element states - input?: string; - active?: string; - - // The root picker and states - picker?: string; - opened?: string; - focused?: string; - - // The picker holder - holder?: string; - - // The picker frame, wrapper, and box - frame?: string; - wrap?: string; - box?: string; - - // The picker header - header?: string; - - // Month navigation - navPrev?: string; - navNext?: string; - navDisabled?: string; - - // Month & year labels - month?: string; - year?: string; - - // Month & year dropdowns - selectMonth?: string; - selectYear?: string; - - // Table of dates - table?: string; - - // Weekday labels - weekdays?: string; - - // Day states - day?: string; - disabled?: string; - selected?: string; - highlighted?: string; - now?: string; - infocus?: string; - outfocus?: string; - - // The picker footer - footer?: string; - - // Today, clear, & close buttons - buttonClear?: string; - buttonClose?: string; - buttonToday?: string - } - - export interface TimeApi extends Api { - get(field: string, format?: string): any; + export interface TimeOptions extends Options { + /** + * The formatLabel option is unique. It can contain HTML and it can + * also be a function if you want to create the label during run-time. + */ + formatLabel?: string | ((time: TimeItem) => string); /** - * Returns the item object or formatted string of the date that is visually selected. - * Defaults to null when there’s no value. - */ - get(field: "select"): TimeItem; - get(field: "select", format: string): string; - - /** - * Returns the item object or formatted string of the date that is visually highlighted. - * Defaults to "now" when there’s no value. - */ - get(field: "highlight"): TimeItem; - get(field: "highlight", format: string): string; - - /** - * Returns the item object or formatted string of the date that determines the current view. - * Defaults to "now" when there’s no value. - */ - get(field: "view"): TimeItem; - get(field: "view", format: string): string; - - /** - * Returns the item object or formatted string of the date that determines the lower limit. - * Defaults to a -Infinity item object when it is not explicitly set in the options or through the picker’s API. - */ - get(field: "min"): TimeItem; - get(field: "min", format: string): string; - - /** - * Returns the item object or formatted string of the date that determines the upper limit. - * Defaults to an Infinity item object when it is not explicitly set in the options or through the picker’s API. - */ - get(field: "max"): TimeItem; - get(field: "max", format: string): string; - } - - export interface TimeItem { - // Hour of the day from 0 to 23. - hour: number; - - // The minutes of the hour from 0 to 59 (based on the interval). - mins: number; - - // The "pick" value used for comparisons. - pick: number; - } - - export interface TimeOptions { - // Translations and clear button - clear?: string; - - // Formats - format?: string; - formatLabel?: string; - formatSubmit?: string; - hiddenPrefix?: string; - hiddenSuffix?: string; - - // Editable input - editable?: boolean; - - // Time intervals + * Choose the interval in minutes between each time in the list. + * Default is 30. + */ interval?: number; - // Time limits (can be Dates, arrays formatted as [HOUR, MINUTE], integers, or booleans) - min?: any; - max?: any; + /** + * Set the minimum selectable time on the picker. Accepts a Date object, + * array formatted as [HOUR, MINUTE], a positive or negative integer + * for a time relative to now, or a boolean (`true` sets it to now, and + * `false` removes any limit). + */ + min?: MinOrMaxTimeOption; - // Disable dates (elements can be Dates, [YEAR, MONTH, DATE] arrays, or integers of the week) + /** + * Set the maximum selectable time on the picker. + * Accepts the same values as the `min` property. + */ + max?: MinOrMaxTimeOption; + + /** + * Disable a specific or arbitrary set of times selectable on the picker. + * Accepts an array of Date objects, arrays formatted as [HOUR, MINUTE], + * integers representing hours (from 0 to 23), or objects with a range of + * times. Switch to a whitelist by setting `true` as the first item in the + * collection. Enable times that fall within a range of disabled times by + * adding an `inverted` parameter to the item within the collection. + */ disable?: any[]; - // Root container selector (string) or element (JQuery) - container?: any; - - // Events - onStart?: () => void; - onRender?: () => void; - onOpen?: () => void; - onClose?: () => void; - onSet?: (context: {[key: string]: any}) => void; - onStop?: () => void; - // Classes klass?: TimeKlassOptions; } - export interface TimeKlassOptions { - // The element states - input?: string; - active?: string; - - // The root picker and states - picker?: string; - opened?: string; - focused?: string; - - // The picker holder - holder?: string; - - // The picker frame, wrapper, and box - frame?: string; - wrap?: string; - box?: string; - - // List of times - list?: string; - listItem?: string; - - // Time states - disabled?: string; - selected?: string; - highlighted?: string; - viewset?: string; - now?: string; - - // Clear button - buttonClear?: string; + interface Item { + /** + * The "pick" value used for comparisons. + */ + pick: number; } + + export interface DateItem extends Item { + /** + * The full year. + */ + year: number; + + /** + * The month with zero-as-index. + */ + month: number; + + /** + * The date of the month. + */ + date: number; + + /** + * The day of the week with zero-as-index. + */ + day: number; + + /** + * The underlying JavaScript Date object. + */ + obj: Date; + } + + export interface TimeItem extends Item { + /** + * Hour of the day from 0 to 23. + */ + hour: number; + + /** + * The minutes of the hour from 0 to 59 (based on the interval). + */ + mins: number; + } + + export interface CallbackObject { + open?: () => void; + close?: () => void; + render?: () => void; + start?: () => void; + stop?: () => void; + set?: (thingSet: any) => void; + } + + export interface SetObject { + clear?: any; + select?: any; + highlight?: any; + view?: any; + min?: any; + max?: any; + disable?: any; + enable?: any; + } + + export interface TimeSetObject extends SetObject { + /** + * Choose the minutes interval between each time in the list. + * Defaults to 30. + */ + interval?: number; + } + + export interface SetOptions { + /** + * By default, any callbacks bound with the on method will be fired + * when its relevant thing is set. To silently set a thing, pass an + * options object with the muted parameter set to true. + */ + muted?: boolean; + format?: string; + } + + interface Picker { + /** + * The picker's relative input element wrapped as a jQuery object. + */ + $node: JQuery; + + /** + * The picker's relative root holder element wrapped as a jQuery object. + */ + $root: JQuery; + + /** + * This is the picker’s relative hidden element, which is undefined if + * there’s no formatSubmit option. There should be no reason to use this + * – it's mostly for internal use. If you have a valid reason for using + * this, please mention it in the issues. + */ + _hidden: HTMLInputElement; + + open(withoutFocus?: boolean): TPickerObject; + close(withFocus?: boolean): TPickerObject; + + /** + * Rebuild the picker. + */ + start(): TPickerObject; + + /** + * Destroy the picker. + */ + stop(): TPickerObject; + + /** + * Refresh the picker box after adding something to the holder. + * By default, only the "face" of the picker (i.e. the box element) + * has it’s contents re-rendered. To render the entire picker from + * the root up, pass true as the first argument. + */ + render(entirePicker?: boolean): TPickerObject; + + /** + * Clear the value in the picker's input element. + */ + clear(): TPickerObject; + + /** + * Short for picker.get('value') + */ + get(): string; + + /** + * Get the properties, objects, and states that make up the current + * state of the picker. + */ + get(thing: string): any; + + /** + * Returns the string value of the picker's input element. + */ + get(thing: 'value'): string; + + /** + * Returns the item object that is visually selected. + */ + get(thing: 'select'): TItemObject; + + /** + * Returns the item object that is visually highlighted. + */ + get(thing: 'highlight'): TItemObject; + + /** + * Returns the item object that sets the current view. + */ + get(thing: 'view'): TItemObject; + + /** + * Returns the item object that limits the picker's lower range. + */ + get(thing: 'min'): TItemObject; + + /** + * Returns the item object that limits the picker's upper range. + */ + get(thing: 'max'): TItemObject; + + /** + * Returns a boolean value of whether the picker is open or not. + */ + get(thing: 'open'): boolean; + + /** + * Returns a boolean value of whether the picker has started or not. + */ + get(thing: 'start'): boolean; + + /** + * Returns a unique 9-digit integer that is the ID of the picker. + */ + get(thing: 'id'): number; + + /** + * Returns an array of items that determine which item objects to + * disable on the picker. + */ + get(thing: 'disable'): any[]; + + /** + * Returns a formatted string for the item object specified by `thing` + */ + get(thing: string, format: string): string; + + /** + * Set the properties, objects, and states to change the state of the picker. + */ + set(thing: string, value?: any, options?: SetOptions): TPickerObject; + set(things: TOptions, options?: SetOptions): TPickerObject; + + /** + * Bind callbacks to get fired off when the relative picker method is called. + */ + on(methodName: string, callback: (data?: any) => void): TPickerObject; + + /** + * Bind multiple callbacks at once to get fired off when the relative + * picker method is called. + */ + on(callbackObject: CallbackObject): TPickerObject; + + /** + * Unbind callbacks that are bound using the on method. + */ + off(...methodName: string[]): TPickerObject; + + /** + * Trigger callbacks that have been queued up using the the on method. + */ + trigger(event: string, data?: any): TPickerObject; + } + + export interface DatePicker extends Picker { } + export interface TimePicker extends Picker { } } interface JQuery { /** - * Access the API object after initialization. + * Access the API object on an initialized date picker element. */ - pickadate(keyword: "picker"): Pickadate.DateApi; + pickadate(keyword: "picker"): Pickadate.DatePicker; pickadate(objectName: "$node"): JQuery; pickadate(objectName: "$root"): JQuery; - pickadate(objectName: "_hidden"): JQuery; + pickadate(objectName: "_hidden"): HTMLInputElement; /** - * Invoke API methods after picker initialization. - * @param methodName - * @param arguments any arguments to pass to the method + * Invoke API methods after date picker initialization. */ pickadate(methodName: string, ...arguments: any[]): any; /** * Initialize a date picker. - * @returns the original JQuery selection */ pickadate(options?: Pickadate.DateOptions): JQuery; - - pickatime(keyword: "picker"): Pickadate.TimeApi; + /** + * Access the API object on an initialized time picker element. + */ + pickatime(keyword: "picker"): Pickadate.TimePicker; pickatime(objectName: "$node"): JQuery; pickatime(objectName: "$root"): JQuery; - pickatime(objectName: "_hidden"): JQuery; - + pickatime(objectName: "_hidden"): HTMLInputElement; + /** - * Invoke API methods after picker initialization. - * @param methodName - * @param arguments any arguments to pass to the method + * Invoke API methods after time picker initialization. */ pickatime(methodName: string, ...arguments: any[]): any; /** * Initialize a time picker. - * @returns the original JQuery selection */ pickatime(options?: Pickadate.TimeOptions): JQuery; } - diff --git a/piwik-tracker/piwik-tracker-tests.ts b/piwik-tracker/piwik-tracker-tests.ts new file mode 100644 index 000000000..7d06d6bdc --- /dev/null +++ b/piwik-tracker/piwik-tracker-tests.ts @@ -0,0 +1,28 @@ +/// +/// + +// Example code taken from https://www.npmjs.com/package/piwik-tracker + +var PiwikTracker = require('piwik-tracker'); + +// Initialize with your site ID and Piwik URL +var piwik = new PiwikTracker(1, 'http://mywebsite.com/piwik.php'); + +// Optional: Respond to tracking errors +piwik.on('error', function(err : Error) { + console.log('error tracking request: ', err) +}) + +// Track a request URL: +// Either as a simple string … +piwik.track('http://example.com/track/this/url'); + +// … or provide further options: +piwik.track({ + url: 'http://example.com/track/this/url', + action_name: 'This will be shown in your dashboard', + ua: 'Node.js v0.10.24', + cvar: JSON.stringify({ + '1': ['custom variable name', 'custom variable value'] + }) +}); diff --git a/piwik-tracker/piwik-tracker.d.ts b/piwik-tracker/piwik-tracker.d.ts new file mode 100644 index 000000000..129b714ca --- /dev/null +++ b/piwik-tracker/piwik-tracker.d.ts @@ -0,0 +1,95 @@ +// Type definitions for PiwikTracker v0.1.1 +// Project: https://www.npmjs.com/package/piwik-tracker +// Definitions by: Guilherme Bernal +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module "piwik-tracker" { + + import events = require('events'); + + export = PiwikTracker; + + // refer to http://developer.piwik.org/api-reference/tracking-api + interface PiwikTrackOptions { + // Required parameters + url : string; + + // Recommended parameters + action_name? : string; + _id? : string; + rand? : string; + apiv? : number; + + // Optional User info + urlref? : string; + _cvar? : string; + _idvc? : string; + _viewts? : string; + _idts? : string; + _rcn? : string; + _rck? : string; + res? : string; + h? : number; + m? : number; + s? : number; + ua? : string; + lang? : string; + uid? : string; + cid? : string; + new_visit? : number; + + // Optional Action info + cvar? : string; + link? : string; + download? : string; + search? : string; + search_cat? : string; + search_count? : number; + idgoal? : number; + revenue? : number; + gt_ms? : number; + cs? : string; + + // Optional Event Tracking info + e_c? : string; + e_a? : string; + e_n? : string; + e_v? : string; + + // Optional Content Tracking info + c_n? : string; + c_p? : string; + c_t? : string; + c_i? : string; + + // Optional Ecommerce info + ec_id? : string; + ec_items? : string; + ec_st? : number; + ec_tx? : number; + ec_sh? : number; + ec_dt? : number; + _ects? : number; + + // Other parameters (require authentication via token_auth) + token_auth? : string; + cip? : string; + cdt? : string; + country? : string; + region? : string; + city? : string; + lat? : string; + long? : string; + + // Other parameters + send_image? : number; + } + + class PiwikTracker extends events.EventEmitter { + constructor(siteId : number, trackerUrl : string); + track(options : PiwikTrackOptions) : void; + } + +} diff --git a/q/Q-tests.ts b/q/Q-tests.ts index 7872f23b2..2e9b7547b 100644 --- a/q/Q-tests.ts +++ b/q/Q-tests.ts @@ -64,6 +64,15 @@ Q.allResolved([]) }) }); +Q(42) + .tap(() => "hello") + .tap(x => { + console.log(x); + }) + .then(x => { + console.log("42 == " + x); + }); + declare var arrayPromise: Q.IPromise; declare var stringPromise: Q.IPromise; declare function returnsNumPromise(text: string): Q.Promise; diff --git a/q/Q.d.ts b/q/Q.d.ts index 590fd92ad..2a239dc18 100644 --- a/q/Q.d.ts +++ b/q/Q.d.ts @@ -122,6 +122,12 @@ declare module Q { * A sugar method, equivalent to promise.then(function () { throw reason; }). */ thenReject(reason: any): Promise; + + /** + * Attaches a handler that will observe the value of the promise when it becomes fulfilled, returning a promise for that same value, perhaps deferred but not replaced by the promise returned by the onFulfilled handler. + */ + tap(onFulfilled: (value: T) => any): Promise; + timeout(ms: number, message?: string): Promise; /** * Returns a promise that will have the same result as promise, but will only be fulfilled or rejected after at least ms milliseconds have passed. diff --git a/qtip2/qtip2-tests.ts b/qtip2/qtip2-tests.ts new file mode 100644 index 000000000..144b4aa51 --- /dev/null +++ b/qtip2/qtip2-tests.ts @@ -0,0 +1,1051 @@ +/// + +var $a = $('_'); + + +/** + * Test core properties (http://qtip2.com/options#core) + */ +function testCoreProperties() { + // Test with all core options specififed + $a.qtip({ + content: 'Jan Jansen', + id: 'jan-jansen', + prerender: true, + overwrite: true, + suppress: true, + metadata: { + type: 'html5', + name: 'qtipopts' + } + }); + + // Test ID as boolean + $a.qtip({ + content: 'yoshimo', + id: false + }); + + // Test with no options specified + $a.qtip({ + content: 'aerie' + }); +} + + +/** + * http://qtip2.com/options#content.text + */ +function testContentText() { + // Shorthand string + $a.qtip({ + content: 'valygar' + }); + + // Regular string + $a.qtip({ + content: { text: 'kivan' } + }); + + // Shorthand boolean + $a.qtip({ + content: true + }); + + // Regular boolean + $a.qtip({ + content: { text: true } + }); + + // Shorthand Deferred / Promise + $a.qtip({ + content: $.Deferred().resolve('cernd') + }); + + $a.qtip({ + content: $.Deferred().reject().promise() + }); + + // Regular Deferred / Promise + $a.qtip({ + content: { text: $.Deferred().resolve('horatio') } + }); + + $a.qtip({ + content: { text: $.Deferred().reject().promise() } + }); + + // Shorthand function + $a.qtip({ + content: function(event: Event, api: QTip2.Api) { } + }); + + $a.qtip({ + content: function(event: Event) { return 2; } + }); + + $a.qtip({ + content: function() { } + }); + + // Regular function + $a.qtip({ + content: { text: function(event: Event, api: QTip2.Api) {} } + }); + + $a.qtip({ + content: { text: function(event: Event) { return 2; } } + }); + + $a.qtip({ + content: { text: function() { } } + }); + + // Shorthand jQuery elements + $a.qtip({ + content: $('.irenicus') + }); + + // Regular jQuery elements + $a.qtip({ + content: { text: $('.irenicus') } + }); +} + + +/** + * http://qtip2.com/options#content.title + */ +function testContentTitle() { + // Shorthand string + $a.qtip({ + content: { title: 'keldorn' } + }); + + // Regular string + $a.qtip({ + content: { + title: { text: 'nalia' } + } + }); + + // Shorthand boolean + $a.qtip({ + content: { title: true } + }); + + // Regular boolean + $a.qtip({ + content: { + title: { text: true } + } + }); + + // Shorthand Deferred / Promise + $a.qtip({ + content: { title: $.Deferred().resolve('mazzy') } + }); + + $a.qtip({ + content: { title: $.Deferred().reject().promise() } + }); + + // Regular Deferred / Promise + $a.qtip({ + content: { title: { text: $.Deferred().resolve('bodhi') } } + }); + + $a.qtip({ + content: { title: { text: $.Deferred().reject().promise() } } + }); + + // Shorthand function + $a.qtip({ + content: { title: function(event: Event, api: QTip2.Api) {} } + }); + + $a.qtip({ + content: { title: function(event: Event) { return 2; } } + }); + + $a.qtip({ + content: { title: function() { } } + }); + + // Regular function + $a.qtip({ + content: { title: { text: function(event: Event, api: QTip2.Api) { } } } + }); + + $a.qtip({ + content: { title: { text: function(event: Event) { return 2; } } } + }); + + $a.qtip({ + content: { title: { text: function() { } } } + }); + + // Shorthand jQuery elements + $a.qtip({ + content: { title: $('.irenicus') } + }); + + // Regular jQuery elements + $a.qtip({ + content: { title: { text: $('.irenicus') } } + }); +} + + +/** + * http://qtip2.com/options#content.button + */ +function testContentButtonProperty() { + $a.qtip({ + content: { button: $('.minsc') } + }); + + $a.qtip({ + content: { button: 'jaheira' } + }); + + $a.qtip({ + content: { button: true } + }); +} + + +/** + * http://qtip2.com/options#content.attr + */ +function testContentAttrProperty() { + $a.qtip({ + content: { attr: 'viconia' } + }); +} + + +/** + * http://qtip2.com/options#position + */ +function testPositionProperty() { + // Shorthand + $a.qtip({ position: 'top left' }); + + // The below four calls test all combinations of all sub-properties + $a.qtip({ + position: { + target: $('.khalid'), + my: 'top left', + at: 'bottom right', + container: $('.edwin-odesseiron'), + viewport: $('.dynaheir'), + effect: function(api: QTip2.Api, pos: any, viewport: any) { }, + adjust: { x: 2 } + } + }); + + $a.qtip({ + position: { + target: [2, 2], + my: true, + at: true, + container: false, + viewport: true, + effect: function(api: QTip2.Api, pos: any) { return 2; }, + adjust: { y: 2 } + } + }); + + $a.qtip({ + position: { + target: 'mouse', + effect: function(api: QTip2.Api) {}, + adjust: { x: 2, y: 2 } + } + }); + + $a.qtip({ + position: { + target: false, + effect: function() {}, + adjust: { + mouse: true, + resize: true, + scroll: false, + method: 'flipinvert' + } + } + }); + + $a.qtip({ + position: { + adjust: { } + } + }); +} + + +/** + * http://qtip2.com/options#show + */ +function testShowProperty() { + // Shorthand + $a.qtip({ show: true }); + $a.qtip({ show: 'mouseenter' }); + $a.qtip({ show: $('.korgan') }); + + // The below calls test all combinations of all sub-properties + $a.qtip({ + show: { + target: $('.gorion'), + event: false, + delay: 42, + solo: $('.imoen'), + ready: true, + effect: function(offset) { + }, + modal: true + } + }); + + $a.qtip({ + show: { + target: false, + event: 'mouseenter', + solo: '.qtips', + effect: true, + modal: { + on: true, + blur: false, + escape: true, + stealfocus: true, + effect: true + } + } + }); + + $a.qtip({ + show: { + solo: false, + modal: { + effect: function(state) {} + } + } + }); + + $a.qtip({ + show: { + modal: {} + } + }); +} + + +/** + * http://qtip2.com/options#hide + */ +function testHideProperty() { + // Shorthand + $a.qtip({ hide: 'mouseenter' }); + $a.qtip({ hide: $('.montaron') }); + + // The below calls test all combinations of all sub-properties + $a.qtip({ + hide: { + target: $('.gorion'), + event: false, + delay: 42, + inactive: 64, + fixed: true, + leave: 'window', + distance: 32, + effect: function(offset) { + }, + } + }); + + $a.qtip({ + hide: { + target: false, + event: 'mouseenter', + inactive: false, + leave: false, + distance: false, + effect: true, + } + }); +} + + +/** + * http://qtip2.com/options#style + */ +function testStyleProperty() { + // Shorthand + $a.qtip({ style: 'kagain' }); + + // The below calls test all combinations of all sub-properties + $a.qtip({ + style: { + classes: 'anomen', + def: true, + widget: true, + width: '24pt', + height: '24pt', + tip: 'top left' + } + }); + + $a.qtip({ + style: { + classes: false, + width: 24, + height: 24, + tip: false + } + }); + + $a.qtip({ + style: { + classes: false, + width: false, + height: false, + tip: { + corner: 'bottom right', + mimic: 'bottom right', + border: 3, + width: 27, + height: 32, + offset: 1 + } + } + }); + + $a.qtip({ + style: { + tip: { + corner: true, + mimic: true, + border: false + } + } + }); + + $a.qtip({ + style: { + tip: { } + } + }); +} + + +function baseCase() { + $a.qtip(); + $a.qtip({}); + + $a.qtip('horatio'); + $a.qtip('activate'); + $a.qtip('deactivate'); +} + + +/** + * Test with all options specified. Copied from http://qtip2.com/options#global and amended. + */ +function allTogetherNow() { + $a.qtip({ + prerender: false, + id: false, + overwrite: true, + suppress: true, + content: { + title: true, + attr: 'title', + text: false, + button: false + }, + position: { + my: 'top left', + at: 'bottom right', + target: false, + container: false, + viewport: false, + adjust: { + x: 0, y: 0, + mouse: true, + resize: true, + method: 'flip flip' + }, + effect: function(api, pos, viewport) { + $(this).animate(pos, { + duration: 200, + queue: false + }); + } + }, + show: { + target: false, + event: 'mouseenter', + effect: true, + delay: 90, + solo: false, + ready: false, + modal: { + on: false, + effect: true, + blur: true, + escape: true + } + }, + hide: { + target: false, + event: 'mouseleave', + effect: true, + delay: 0, + fixed: false, + inactive: false, + leave: 'window', + distance: false + }, + style: { + classes: '', + widget: false, + width: false, + height: false, + tip: { + corner: true, + mimic: false, + width: 8, + height: 8, + border: true, + offset: 0 + } + }, + events: { + render: null, + move: null, + show: null, + hide: null, + toggle: null, + visible: null, + hidden: null, + focus: null, + blur: null + } + }); +} + + +/** + * http://qtip2.com/api#api-methods.get + */ +function testApiGetViaObject() { + $a.qtip({}); + + var api = $a.qtip('api'); + + api.get('id'); + api.get('prerender'); + api.get('overwrite'); + api.get('suppress'); + api.get('metadata'); + + api.get('content'); + api.get('content.text'); + api.get('content.attr'); + api.get('content.title'); + api.get('content.button'); + + api.get('position'); + api.get('position.my'); + api.get('position.at'); + api.get('position.target'); + api.get('position.container'); + api.get('position.viewport'); + any)> + api.get('position.effect'); + api.get('position.adjust'); + + api.get('show'); + api.get('show.target'); + api.get('show.event'); + api.get('show.delay'); + api.get('show.solo'); + api.get('show.ready'); + any)> api.get('show.effect'); + api.get('show.modal'); + + api.get('hide'); + api.get('hide.target'); + api.get('hide.event'); + api.get('hide.delay'); + api.get('hide.leave'); + api.get('hide.distance'); + any)> api.get('hide.effect'); + + api.get('style'); + api.get('style.classes'); + api.get('style.def'); + api.get('style.widget'); + api.get('style.width'); + api.get('style.height'); + api.get('style.tip'); + + api.get('events'); + api.get('events.render'); + api.get('events.show'); + api.get('events.hide'); + api.get('events.toggle'); + api.get('events.visible'); + api.get('events.hidde'); + api.get('events.move'); + api.get('events.focus'); + api.get('events.blur'); +} + + +/** + * http://qtip2.com/api#api.updating + */ +function testApiGetViaString() { + $a.qtip({}); + + $a.qtip('option', 'id'); + $a.qtip('option', 'prerender'); + $a.qtip('option', 'overwrite'); + $a.qtip('option', 'suppress'); + $a.qtip('option', 'metadata'); + + $a.qtip('option', 'content'); + $a.qtip('option', 'content.text'); + $a.qtip('option', 'content.attr'); + $a.qtip('option', 'content.title'); + $a.qtip('option', 'content.button'); + + $a.qtip('option', 'position'); + $a.qtip('option', 'position.my'); + $a.qtip('option', 'position.at'); + $a.qtip('option', 'position.target'); + $a.qtip('option', 'position.container'); + $a.qtip('option', 'position.viewport'); + any)> + $a.qtip('option', 'position.effect'); + $a.qtip('option', 'position.adjust'); + + $a.qtip('option', 'show'); + $a.qtip('option', 'show.target'); + $a.qtip('option', 'show.event'); + $a.qtip('option', 'show.delay'); + $a.qtip('option', 'show.solo'); + $a.qtip('option', 'show.ready'); + any)> $a.qtip('option', 'show.effect'); + $a.qtip('option', 'show.modal'); + + $a.qtip('option', 'hide'); + $a.qtip('option', 'hide.target'); + $a.qtip('option', 'hide.event'); + $a.qtip('option', 'hide.delay'); + $a.qtip('option', 'hide.leave'); + $a.qtip('option', 'hide.distance'); + any)> $a.qtip('option', 'hide.effect'); + + $a.qtip('option', 'style'); + $a.qtip('option', 'style.classes'); + $a.qtip('option', 'style.def'); + $a.qtip('option', 'style.widget'); + $a.qtip('option', 'style.width'); + $a.qtip('option', 'style.height'); + $a.qtip('option', 'style.tip'); + + $a.qtip('option', 'events'); + $a.qtip('option', 'events.render'); + $a.qtip('option', 'events.show'); + $a.qtip('option', 'events.hide'); + $a.qtip('option', 'events.toggle'); + $a.qtip('option', 'events.visible'); + $a.qtip('option', 'events.hidde'); + $a.qtip('option', 'events.move'); + $a.qtip('option', 'events.focus'); + $a.qtip('option', 'events.blur'); +} + + +/** + * http://qtip2.com/api#api-methods.set + */ +function testApiSetViaObject() { + + // TODO + $a.qtip({}); + + var api = $a.qtip('api'); + + api.set({ + prerender: false, + id: false, + overwrite: true, + suppress: true, + content: { + title: true, + attr: 'title', + text: false, + button: false + }, + position: { + my: 'top left', + at: 'bottom right', + target: false, + container: false, + viewport: false, + adjust: { + x: 0, y: 0, + mouse: true, + resize: true, + method: 'flip flip' + }, + effect: function(api, pos, viewport) { + $(this).animate(pos, { + duration: 200, + queue: false + }); + } + }, + show: { + target: false, + event: 'mouseenter', + effect: true, + delay: 90, + solo: false, + ready: false, + modal: { + on: false, + effect: true, + blur: true, + escape: true + } + }, + hide: { + target: false, + event: 'mouseleave', + effect: true, + delay: 0, + fixed: false, + inactive: false, + leave: 'window', + distance: false + }, + style: { + classes: '', + widget: false, + width: false, + height: false, + tip: { + corner: true, + mimic: false, + width: 8, + height: 8, + border: true, + offset: 0 + } + }, + events: { + render: null, + move: null, + show: null, + hide: null, + toggle: null, + visible: null, + hidden: null, + focus: null, + blur: null + } + }); + + api.set('id', null); + api.set('prerender', null); + api.set('overwrite', null); + api.set('suppress', null); + api.set('metadata', null); + + api.set('content', null); + api.set('content.title', null); + api.set('content.text', null); + api.set('content.attr', null); + api.set('content.button', null); + + api.set('position', null); + api.set('position.my', null); + api.set('position.at', null); + api.set('position.target', null); + api.set('position.container', null); + api.set('position.viewport', null); + api.set('position.effect', void)> null); + api.set('position.adjust', null); + + api.set('show', null); + api.set('show.target', null); + api.set('show.event', null); + api.set('show.delay', null); + api.set('show.solo', null); + api.set('show.ready', null); + api.set('show.effect', void)> null); + api.set('show.modal', null); + + api.set('hide', null); + api.set('hide.target', null); + api.set('hide.event', null); + api.set('hide.inactive', null); + api.set('hide.fixed', null); + api.set('hide.leave', null); + api.set('hide.distance', null); + api.set('hide.effect', void)> null); + + api.set('style', null); + api.set('style.classes', null); + api.set('style.def', null); + api.set('style.widget', null); + api.set('style.width', null); + api.set('style.height', null); + api.set('style.tip', null); + + api.set('events', null); + api.set('events.render', null); + api.set('events.show', null); + api.set('events.hide', null); + api.set('events.toggle', null); + api.set('events.visible', null); + api.set('events.hidden', null); + api.set('events.move', null); + api.set('events.focus', null); + api.set('events.blur', null); +} + + +/** + * http://qtip2.com/api#api.updating + */ +function testApiSetViaString() { + $a.qtip({}); + + $a.qtip('option', { + prerender: false, + id: false, + overwrite: true, + suppress: true, + content: { + title: true, + attr: 'title', + text: false, + button: false + }, + position: { + my: 'top left', + at: 'bottom right', + target: false, + container: false, + viewport: false, + adjust: { + x: 0, y: 0, + mouse: true, + resize: true, + method: 'flip flip' + }, + effect: function(api: QTip2.Api, pos: any, viewport: any) { + $(this).animate(pos, { + duration: 200, + queue: false + }); + } + }, + show: { + target: false, + event: 'mouseenter', + effect: true, + delay: 90, + solo: false, + ready: false, + modal: { + on: false, + effect: true, + blur: true, + escape: true + } + }, + hide: { + target: false, + event: 'mouseleave', + effect: true, + delay: 0, + fixed: false, + inactive: false, + leave: 'window', + distance: false + }, + style: { + classes: '', + widget: false, + width: false, + height: false, + tip: { + corner: true, + mimic: false, + width: 8, + height: 8, + border: true, + offset: 0 + } + }, + events: { + render: null, + move: null, + show: null, + hide: null, + toggle: null, + visible: null, + hidden: null, + focus: null, + blur: null + } + }); + + $a.qtip('option', 'id', null); + $a.qtip('option', 'prerender', null); + $a.qtip('option', 'overwrite', null); + $a.qtip('option', 'suppress', null); + $a.qtip('option', 'metadata', null); + + $a.qtip('option', 'content', null); + $a.qtip('option', 'content.title', null); + $a.qtip('option', 'content.text', null); + $a.qtip('option', 'content.attr', null); + $a.qtip('option', 'content.button', null); + + $a.qtip('option', 'position', null); + $a.qtip('option', 'position.my', null); + $a.qtip('option', 'position.at', null); + $a.qtip('option', 'position.target', null); + $a.qtip('option', 'position.container', null); + $a.qtip('option', 'position.viewport', null); + $a.qtip('option', 'position.effect', void)> null); + $a.qtip('option', 'position.adjust', null); + + $a.qtip('option', 'show', null); + $a.qtip('option', 'show.target', null); + $a.qtip('option', 'show.event', null); + $a.qtip('option', 'show.delay', null); + $a.qtip('option', 'show.solo', null); + $a.qtip('option', 'show.ready', null); + $a.qtip('option', 'show.effect', void)> null); + $a.qtip('option', 'show.modal', null); + + $a.qtip('option', 'hide', null); + $a.qtip('option', 'hide.target', null); + $a.qtip('option', 'hide.event', null); + $a.qtip('option', 'hide.inactive', null); + $a.qtip('option', 'hide.fixed', null); + $a.qtip('option', 'hide.leave', null); + $a.qtip('option', 'hide.distance', null); + $a.qtip('option', 'hide.effect', void)> null); + + $a.qtip('option', 'style', null); + $a.qtip('option', 'style.classes', null); + $a.qtip('option', 'style.def', null); + $a.qtip('option', 'style.widget', null); + $a.qtip('option', 'style.width', null); + $a.qtip('option', 'style.height', null); + $a.qtip('option', 'style.tip', null); + + $a.qtip('option', 'events', null); + $a.qtip('option', 'events.render', null); + $a.qtip('option', 'events.show', null); + $a.qtip('option', 'events.hide', null); + $a.qtip('option', 'events.toggle', null); + $a.qtip('option', 'events.visible', null); + $a.qtip('option', 'events.hidden', null); + $a.qtip('option', 'events.move', null); + $a.qtip('option', 'events.focus', null); + $a.qtip('option', 'events.blur', null); +} + + +/** + * http://qtip2.com/api#api-methods + */ +function testApiViaObject() { + $a.qtip({}); + + var api = $a.qtip('api'); + + api.toggle(); + api.toggle(true); + api.toggle(false, null); + + api.show(); + api.show( null); + + api.hide(); + api.hide( null); + + api.disable(); + api.disable(true); + + api.enable(); + + api.reposition(); + api.reposition( null); + api.reposition( null, true); + + api.focus(); + api.focus( null); + + api.blur(); + api.blur( null); + + api.destroy(); + api.destroy(true); +} + + +/** + * http://qtip2.com/api#api.updating + */ +function testApiMethodsViaString() { + $a.qtip('toggle'); + $a.qtip('toggle', true); + $a.qtip('toggle', true, null); + + $a.qtip('show'); + $a.qtip('show', null); + + $a.qtip('hide'); + $a.qtip('hide', null); + + $a.qtip('disable'); + $a.qtip('disable', true); + + $a.qtip('enable'); + + $a.qtip('reposition'); + $a.qtip('reposition', null); + $a.qtip('reposition', null, true); + + $a.qtip('focus'); + $a.qtip('focus', null); + + $a.qtip('blur'); + $a.qtip('blur', null); + + $a.qtip('destroy'); + $a.qtip('destroy', true); +} + + +/** + * http://qtip2.com/options#global + * + * $.fn is of type any, therefore we can't (and don't need to) add type bindings for QTip2 globals under it. + */ +function testGlobals() { + $.fn.qtip.defaults.prerender = true; +} \ No newline at end of file diff --git a/qtip2/qtip2-tests.ts.tscparams b/qtip2/qtip2-tests.ts.tscparams new file mode 100644 index 000000000..2280b0116 --- /dev/null +++ b/qtip2/qtip2-tests.ts.tscparams @@ -0,0 +1,2 @@ + +--noImplicitAny \ No newline at end of file diff --git a/qtip2/qtip2.d.ts b/qtip2/qtip2.d.ts new file mode 100644 index 000000000..3d1f841f2 --- /dev/null +++ b/qtip2/qtip2.d.ts @@ -0,0 +1,409 @@ +// Type definitions for qtip2 v2.2.1 +// Project: http://qtip2.com/ +// Definitions by: Nathan Pitman +// Definitions: https://github.com/borisyankov/DefinitelyTyped +// Notes: +// - Type bindings for the QTip2 API and options are included. Bindings for global settings aren't required. +// - Deprecated functionality is not supported. +// - Where possible, things are strongly typed and 'any' is avoided. +// - QTip2 includes a lot of shorthand notation for various expressions. These bindings support it all. + +/// + +declare module QTip2 { + type EventApiFunc = (event: Event, api: Api) => void; + + + /** + * Content property + */ + type Title = string | JQuery | EventApiFunc | boolean | JQueryGenericPromise; + type Text = string | JQuery | EventApiFunc | boolean | JQueryGenericPromise; + + interface Content { + title?: Title | { text: Title }; + text?: Text; + attr?: string; + button?: string | JQuery | boolean; + } + + + /** + * Position property + */ + interface PositionAdjust { + x?: number; + y?: number; + mouse?: boolean; + resize?: boolean; + scroll?: boolean; + method?: string; + } + + type Target = JQuery | number[] | string; + + interface Position { + my?: string | boolean; + at?: string | boolean; + target?: Target | boolean; + container?: JQuery | boolean; + viewport?: JQuery | boolean; + effect?: boolean | ((api: Api, pos: any, viewport: any) => void); + adjust?: PositionAdjust; + } + + + /** + * Show property + */ + interface Show { + target?: JQuery | boolean; + event?: string | boolean; + delay?: number; + solo?: JQuery | string | boolean; + ready?: boolean; + effect?: boolean | ((offset: any) => void); + modal?: boolean | Modal; + } + + interface Modal + { + on?: boolean; + blur?: boolean; + escape?: boolean; + stealfocus?: boolean; + effect?: boolean | ((state: any) => void); + } + + + /** + * Hide property + */ + interface Hide { + target?: JQuery | boolean; + event?: string | boolean; + delay?: number; + inactive?: number | boolean; + fixed?: boolean; + leave?: string | boolean; + distance?: number | boolean; + effect?: boolean | ((offset: any) => void); + } + + + /** + * Style property + */ + interface Style { + classes?: string | boolean; + def?: boolean; + widget?: boolean; + width?: string | number | boolean; + height?: string | number | boolean; + tip?: string | boolean | Tip; + } + + interface Tip { + corner?: string | boolean; + mimic?: string | boolean; + border?: number | boolean; + width?: number; + height?: number; + offset?: number; + } + + + /** + * Events property + */ + interface Events { + render?: EventApiFunc; + show?: EventApiFunc; + hide?: EventApiFunc; + toggle?: EventApiFunc; + visible?: EventApiFunc; + hidden?: EventApiFunc; + move?: EventApiFunc; + focus?: EventApiFunc; + blur?: EventApiFunc; + } + + + /** + * Options + */ + interface QTipOptions { + id?: string | boolean; + prerender?: boolean; + overwrite?: boolean; + suppress?: boolean; + metadata?: any; + content?: Text | Content; + position?: string | Position; + style?: string | Style; + show?: string | boolean | JQuery | Show; + hide?: string | JQuery | Hide; + events?: Events; + } + + + /** + * API + */ + interface Api { + get(propertyName: 'id'): string | boolean; + get(propertyName: 'prerender'): boolean; + get(propertyName: 'overwrite'): boolean; + get(propertyName: 'suppress'): boolean; + get(propertyName: 'metadata'): any; + get(propertyName: 'content'): Content; + get(propertyName: 'content.text'): Text; + get(propertyName: 'content.attr'): string; + get(propertyName: 'content.title'): Title; + get(propertyName: 'content.button'): string | JQuery | boolean; + get(propertyName: 'position'): Position; + get(propertyName: 'position.my'): string | boolean; + get(propertyName: 'position.at'): string | boolean; + get(propertyName: 'position.target'): Target | boolean; + get(propertyName: 'position.container'): JQuery | boolean; + get(propertyName: 'position.viewport'): JQuery | boolean; + get(propertyName: 'position.effect'): boolean | ((api: any, pos: any, viewport: any) => void); + get(propertyName: 'position.adjust'): PositionAdjust; + get(propertyName: 'show'): Show; + get(propertyName: 'show.target'): JQuery | boolean; + get(propertyName: 'show.event'): string | boolean; + get(propertyName: 'show.delay'): number; + get(propertyName: 'show.solo'): JQuery | string | boolean; + get(propertyName: 'show.ready'): boolean; + get(propertyName: 'show.effect'): boolean | ((offset: any) => void); + get(propertyName: 'show.modal'): boolean | Modal; + get(propertyName: 'hide'): Hide; + get(propertyName: 'hide.target'): JQuery | boolean; + get(propertyName: 'hide.event'): string | boolean; + get(propertyName: 'hide.delay'): number; + get(propertyName: 'hide.leave'): string | boolean; + get(propertyName: 'hide.distance'): number | boolean; + get(propertyName: 'hide.effect'): boolean | ((offset: any) => void); + get(propertyName: 'style'): Style; + get(propertyName: 'style.classes'): string | boolean; + get(propertyName: 'style.def'): boolean; + get(propertyName: 'style.widget'): boolean; + get(propertyName: 'style.width'): string | number | boolean; + get(propertyName: 'style.height'): string | number | boolean; + get(propertyName: 'style.tip'): string | boolean | Tip; + get(propertyName: 'events'): Events; + get(propertyName: 'events.render'): EventApiFunc; + get(propertyName: 'events.show'): EventApiFunc; + get(propertyName: 'events.hide'): EventApiFunc; + get(propertyName: 'events.toggle'): EventApiFunc; + get(propertyName: 'events.visible'): EventApiFunc; + get(propertyName: 'events.hidden'): EventApiFunc; + get(propertyName: 'events.move'): EventApiFunc; + get(propertyName: 'events.focus'): EventApiFunc; + get(propertyName: 'events.blur'): EventApiFunc; + get(propertyName: string): any; + + set(properties: QTipOptions): Api; + set(propertyName: 'id', value: string | boolean): Api; + set(propertyName: 'prerender', value: boolean): Api; + set(propertyName: 'overwrite', value: boolean): Api; + set(propertyName: 'suppress', value: boolean): Api; + set(propertyName: 'metadata', value: any): Api; + set(propertyName: 'content', value: Text | Content): Api; + set(propertyName: 'content.title', value: Title | { text: Title }): Api; + set(propertyName: 'content.text', value: Text): Api; + set(propertyName: 'content.attr', value: string): Api; + set(propertyName: 'content.button', value: string | JQuery | boolean): Api; + set(propertyName: 'position', value: Position): Api; + set(propertyName: 'position.my', value: string | boolean): Api; + set(propertyName: 'position.at', value: string | boolean): Api; + set(propertyName: 'position.target', value: Target | boolean): Api; + set(propertyName: 'position.container', value: JQuery | boolean): Api; + set(propertyName: 'position.viewport', value: JQuery | boolean): Api; + set(propertyName: 'position.effect', value: boolean | ((api: Api, pos: any, viewport: any) => void) ): Api; + set(propertyName: 'position.adjust', value: PositionAdjust): Api; + set(propertyName: 'show', value: Show): Api; + set(propertyName: 'show.target', value: JQuery | boolean): Api; + set(propertyName: 'show.event', value: string | boolean): Api; + set(propertyName: 'show.delay', value: number): Api; + set(propertyName: 'show.solo', value: JQuery | string | boolean): Api; + set(propertyName: 'show.ready', value: boolean): Api; + set(propertyName: 'show.effect', value: boolean | ((offset: any) => void)): Api; + set(propertyName: 'show.modal', value: boolean | Modal): Api; + set(propertyName: 'hide', value: Hide): Api; + set(propertyName: 'hide.target', value: JQuery | boolean): Api; + set(propertyName: 'hide.event', value: string | boolean): Api; + set(propertyName: 'hide.inactive', value: number | boolean): Api; + set(propertyName: 'hide.fixed', value: boolean): Api; + set(propertyName: 'hide.leave', value: string | boolean): Api; + set(propertyName: 'hide.distance', value: number | boolean): Api; + set(propertyName: 'hide.effect', value: boolean | ((offset: any) => void)): Api + set(propertyName: 'style', value: Style): Api; + set(propertyName: 'style.classes', value: string | boolean): Api; + set(propertyName: 'style.def', value: boolean): Api; + set(propertyName: 'style.widget', value: boolean): Api; + set(propertyName: 'style.width', value: string | number | boolean): Api; + set(propertyName: 'style.height', value: string | number | boolean): Api; + set(propertyName: 'style.tip', value: string | boolean | Tip): Api; + set(propertyName: 'events', value: Events): Api; + set(propertyName: 'events.render', value: EventApiFunc): Api; + set(propertyName: 'events.show', value: EventApiFunc): Api; + set(propertyName: 'events.hide', value: EventApiFunc): Api; + set(propertyName: 'events.toggle', value: EventApiFunc): Api; + set(propertyName: 'events.visible', value: EventApiFunc): Api; + set(propertyName: 'events.hidden', value: EventApiFunc): Api; + set(propertyName: 'events.move', value: EventApiFunc): Api; + set(propertyName: 'events.focus', value: EventApiFunc): Api; + set(propertyName: 'events.blur', value: EventApiFunc): Api; + set(propertyName: string, value: any): Api; + + toggle(state?: boolean, event?: Event): Api; + + show(event?: Event): Api; + + hide(event?: Event): Api; + + disable(state?: boolean): Api; + + enable(): Api; + + reposition(event?: Event, effect?: boolean): Api; + + focus(event?: Event): Api; + + blur(event?: Event): Api; + + destroy(immediate?: boolean): Api; + } +} + + +interface JQuery { + qtip(options?: QTip2.QTipOptions): JQuery; + + qtip(methodName: 'api'): QTip2.Api; + + qtip(methodName: 'option', propertyName: 'id'): string | boolean; + qtip(methodName: 'option', propertyName: 'prerender'): boolean; + qtip(methodName: 'option', propertyName: 'overwrite'): boolean; + qtip(methodName: 'option', propertyName: 'suppress'): boolean; + qtip(methodName: 'option', propertyName: 'metadata'): any; + qtip(methodName: 'option', propertyName: 'content'): QTip2.Content; + qtip(methodName: 'option', propertyName: 'content.text'): QTip2.Text; + qtip(methodName: 'option', propertyName: 'content.attr'): string; + qtip(methodName: 'option', propertyName: 'content.title'): QTip2.Title; + qtip(methodName: 'option', propertyName: 'content.button'): string | JQuery | boolean; + qtip(methodName: 'option', propertyName: 'position'): QTip2.Position; + qtip(methodName: 'option', propertyName: 'position.my'): string | boolean; + qtip(methodName: 'option', propertyName: 'position.at'): string | boolean; + qtip(methodName: 'option', propertyName: 'position.target'): QTip2.Target | boolean; + qtip(methodName: 'option', propertyName: 'position.container'): JQuery | boolean; + qtip(methodName: 'option', propertyName: 'position.viewport'): JQuery | boolean; + qtip(methodName: 'option', propertyName: 'position.effect'): boolean | ((api: QTip2.Api, pos: any, viewport: any) => void); + qtip(methodName: 'option', propertyName: 'position.adjust'): QTip2.PositionAdjust; + qtip(methodName: 'option', propertyName: 'show'): QTip2.Show; + qtip(methodName: 'option', propertyName: 'show.target'): JQuery | boolean; + qtip(methodName: 'option', propertyName: 'show.event'): string | boolean; + qtip(methodName: 'option', propertyName: 'show.delay'): number; + qtip(methodName: 'option', propertyName: 'show.solo'): JQuery | string | boolean; + qtip(methodName: 'option', propertyName: 'show.ready'): boolean; + qtip(methodName: 'option', propertyName: 'show.effect'): boolean | ((offset: any) => void); + qtip(methodName: 'option', propertyName: 'show.modal'): boolean | QTip2.Modal; + qtip(methodName: 'option', propertyName: 'hide'): QTip2.Hide; + qtip(methodName: 'option', propertyName: 'hide.target'): JQuery | boolean; + qtip(methodName: 'option', propertyName: 'hide.event'): string | boolean; + qtip(methodName: 'option', propertyName: 'hide.delay'): number; + qtip(methodName: 'option', propertyName: 'hide.leave'): string | boolean; + qtip(methodName: 'option', propertyName: 'hide.distance'): number | boolean; + qtip(methodName: 'option', propertyName: 'hide.effect'): boolean | ((offset: any) => void); + qtip(methodName: 'option', propertyName: 'style'): QTip2.Style; + qtip(methodName: 'option', propertyName: 'style.classes'): string | boolean; + qtip(methodName: 'option', propertyName: 'style.def'): boolean; + qtip(methodName: 'option', propertyName: 'style.widget'): boolean; + qtip(methodName: 'option', propertyName: 'style.width'): string | number | boolean; + qtip(methodName: 'option', propertyName: 'style.height'): string | number | boolean; + qtip(methodName: 'option', propertyName: 'style.tip'): string | boolean | QTip2.Tip; + qtip(methodName: 'option', propertyName: 'events'): QTip2.Events; + qtip(methodName: 'option', propertyName: 'events.render'): QTip2.EventApiFunc; + qtip(methodName: 'option', propertyName: 'events.show'): QTip2.EventApiFunc; + qtip(methodName: 'option', propertyName: 'events.hide'): QTip2.EventApiFunc; + qtip(methodName: 'option', propertyName: 'events.toggle'): QTip2.EventApiFunc; + qtip(methodName: 'option', propertyName: 'events.visible'): QTip2.EventApiFunc; + qtip(methodName: 'option', propertyName: 'events.hidden'): QTip2.EventApiFunc; + qtip(methodName: 'option', propertyName: 'events.move'): QTip2.EventApiFunc; + qtip(methodName: 'option', propertyName: 'events.focus'): QTip2.EventApiFunc; + qtip(methodName: 'option', propertyName: 'events.blur'): QTip2.EventApiFunc; + + qtip(methodName: 'option', properties: QTip2.QTipOptions): QTip2.Api; + qtip(methodName: 'option', propertyName: 'id', value: string | boolean): QTip2.Api; + qtip(methodName: 'option', propertyName: 'prerender', value: boolean): QTip2.Api; + qtip(methodName: 'option', propertyName: 'overwrite', value: boolean): QTip2.Api; + qtip(methodName: 'option', propertyName: 'suppress', value: boolean): QTip2.Api; + qtip(methodName: 'option', propertyName: 'metadata', value: any): QTip2.Api; + qtip(methodName: 'option', propertyName: 'content', value: QTip2.Text | QTip2.Content): QTip2.Api; + qtip(methodName: 'option', propertyName: 'content.title', value: QTip2.Title | { text: QTip2.Title }): QTip2.Api; + qtip(methodName: 'option', propertyName: 'content.text', value: QTip2.Text): QTip2.Api; + qtip(methodName: 'option', propertyName: 'content.attr', value: string): QTip2.Api; + qtip(methodName: 'option', propertyName: 'content.button', value: string | JQuery | boolean): QTip2.Api; + qtip(methodName: 'option', propertyName: 'position', value: QTip2.Position): QTip2.Api; + qtip(methodName: 'option', propertyName: 'position.my', value: string | boolean): QTip2.Api; + qtip(methodName: 'option', propertyName: 'position.at', value: string | boolean): QTip2.Api; + qtip(methodName: 'option', propertyName: 'position.target', value: QTip2.Target | boolean): QTip2.Api; + qtip(methodName: 'option', propertyName: 'position.container', value: JQuery | boolean): QTip2.Api; + qtip(methodName: 'option', propertyName: 'position.viewport', value: JQuery | boolean): QTip2.Api; + qtip(methodName: 'option', propertyName: 'position.effect', value: boolean | ((api: QTip2.Api, pos: any, viewport: any) => void) ): QTip2.Api; + qtip(methodName: 'option', propertyName: 'position.adjust', value: QTip2.PositionAdjust): QTip2.Api; + qtip(methodName: 'option', propertyName: 'show', value: QTip2.Show): QTip2.Api; + qtip(methodName: 'option', propertyName: 'show.target', value: JQuery | boolean): QTip2.Api; + qtip(methodName: 'option', propertyName: 'show.event', value: string | boolean): QTip2.Api; + qtip(methodName: 'option', propertyName: 'show.delay', value: number): QTip2.Api; + qtip(methodName: 'option', propertyName: 'show.solo', value: JQuery | string | boolean): QTip2.Api; + qtip(methodName: 'option', propertyName: 'show.ready', value: boolean): QTip2.Api; + qtip(methodName: 'option', propertyName: 'show.effect', value: boolean | ((offset: any) => void)): QTip2.Api; + qtip(methodName: 'option', propertyName: 'show.modal', value: boolean | QTip2.Modal): QTip2.Api; + qtip(methodName: 'option', propertyName: 'hide', value: QTip2.Hide): QTip2.Api; + qtip(methodName: 'option', propertyName: 'hide.target', value: JQuery | boolean): QTip2.Api; + qtip(methodName: 'option', propertyName: 'hide.event', value: string | boolean): QTip2.Api; + qtip(methodName: 'option', propertyName: 'hide.inactive', value: number | boolean): QTip2.Api; + qtip(methodName: 'option', propertyName: 'hide.fixed', value: boolean): QTip2.Api; + qtip(methodName: 'option', propertyName: 'hide.leave', value: string | boolean): QTip2.Api; + qtip(methodName: 'option', propertyName: 'hide.distance', value: number | boolean): QTip2.Api; + qtip(methodName: 'option', propertyName: 'hide.effect', value: boolean | ((offset: any) => void)): QTip2.Api + qtip(methodName: 'option', propertyName: 'style', value: QTip2.Style): QTip2.Api; + qtip(methodName: 'option', propertyName: 'style.classes', value: string | boolean): QTip2.Api; + qtip(methodName: 'option', propertyName: 'style.def', value: boolean): QTip2.Api; + qtip(methodName: 'option', propertyName: 'style.widget', value: boolean): QTip2.Api; + qtip(methodName: 'option', propertyName: 'style.width', value: string | number | boolean): QTip2.Api; + qtip(methodName: 'option', propertyName: 'style.height', value: string | number | boolean): QTip2.Api; + qtip(methodName: 'option', propertyName: 'style.tip', value: string | boolean | QTip2.Tip): QTip2.Api; + qtip(methodName: 'option', propertyName: 'events', value: QTip2.Events): QTip2.Api; + qtip(methodName: 'option', propertyName: 'events.render', value: QTip2.EventApiFunc): QTip2.Api; + qtip(methodName: 'option', propertyName: 'events.show', value: QTip2.EventApiFunc): QTip2.Api; + qtip(methodName: 'option', propertyName: 'events.hide', value: QTip2.EventApiFunc): QTip2.Api; + qtip(methodName: 'option', propertyName: 'events.toggle', value: QTip2.EventApiFunc): QTip2.Api; + qtip(methodName: 'option', propertyName: 'events.visible', value: QTip2.EventApiFunc): QTip2.Api; + qtip(methodName: 'option', propertyName: 'events.hidden', value: QTip2.EventApiFunc): QTip2.Api; + qtip(methodName: 'option', propertyName: 'events.move', value: QTip2.EventApiFunc): QTip2.Api; + qtip(methodName: 'option', propertyName: 'events.focus', value: QTip2.EventApiFunc): QTip2.Api; + qtip(methodName: 'option', propertyName: 'events.blur', value: QTip2.EventApiFunc): QTip2.Api; + + qtip(methodName: 'toggle', state?: boolean, event?: Event): JQuery; + + qtip(methodName: 'show', event?: Event): JQuery; + + qtip(methodName: 'hide', event?: Event): JQuery; + + qtip(methodName: 'disable', state?: boolean): JQuery; + + qtip(methodName: 'enable'): JQuery + + qtip(methodName: 'reposition', event?: Event, effect?: boolean): JQuery; + + qtip(methodName: 'focus', event?: Event): JQuery; + + qtip(methodName: 'blur', event?: Event): JQuery; + + qtip(methodName: 'destroy', immediate?: boolean): JQuery; + + qtip(methodName: string, p1?: any, p2?: any, p3?: any): any; +} diff --git a/raphael/raphael.d.ts b/raphael/raphael.d.ts index bef33d99c..593d5eb61 100644 --- a/raphael/raphael.d.ts +++ b/raphael/raphael.d.ts @@ -104,79 +104,79 @@ interface RaphaelSet { exclude(element: RaphaelElement): boolean; forEach(callback: Function, thisArg?: any): RaphaelSet; pop(): RaphaelElement; - push(...RaphaelElement: any[]): RaphaelElement; + push(...RaphaelElement: any[]): RaphaelSet; splice(index: number, count: number): RaphaelSet; splice(index: number, count: number, ...insertion: RaphaelElement[]): RaphaelSet; length: number; [key: number]: RaphaelElement; - animate(params: { [key: string]: any; }, ms: number, easing?: string, callback?: Function): RaphaelElement; - animate(animation: RaphaelAnimation): RaphaelElement; - animateWith(el: RaphaelElement, anim: RaphaelAnimation, params: any, ms: number, easing?: string, callback?: Function): RaphaelElement; - animateWith(el: RaphaelElement, anim: RaphaelAnimation, animation: RaphaelAnimation): RaphaelElement; - attr(attrName: string, value: any): RaphaelElement; - attr(params: { [key: string]: any; }): RaphaelElement; + animate(params: { [key: string]: any; }, ms: number, easing?: string, callback?: Function): RaphaelSet; + animate(animation: RaphaelAnimation): RaphaelSet; + animateWith(el: RaphaelElement, anim: RaphaelAnimation, params: any, ms: number, easing?: string, callback?: Function): RaphaelSet; + animateWith(el: RaphaelElement, anim: RaphaelAnimation, animation: RaphaelAnimation): RaphaelSet; + attr(attrName: string, value: any): RaphaelSet; + attr(params: { [key: string]: any; }): RaphaelSet; attr(attrName: string): any; attr(attrNames: string[]): any[]; - click(handler: Function): RaphaelElement; - clone(): RaphaelElement; + click(handler: Function): RaphaelSet; + clone(): RaphaelSet; data(key: string): any; - data(key: string, value: any): RaphaelElement; - dblclick(handler: Function): RaphaelElement; - drag(onmove: (dx: number, dy: number, x: number, y: number, event: DragEvent) =>{ }, onstart: (x: number, y: number, event: DragEvent) =>{ }, onend: (DragEvent: any) =>{ }, mcontext?: any, scontext?: any, econtext?: any): RaphaelElement; + data(key: string, value: any): RaphaelSet; + dblclick(handler: Function): RaphaelSet; + drag(onmove: (dx: number, dy: number, x: number, y: number, event: DragEvent) =>{ }, onstart: (x: number, y: number, event: DragEvent) =>{ }, onend: (DragEvent: any) =>{ }, mcontext?: any, scontext?: any, econtext?: any): RaphaelSet; getBBox(isWithoutTransform?: boolean): BoundingBox; glow(glow?: { width?: number; fill?: boolean; opacity?: number; offsetx?: number; offsety?: number; color?: string; }): RaphaelSet; - hide(): RaphaelElement; - hover(f_in: Function, f_out: Function, icontext?: any, ocontext?: any): RaphaelElement; + hide(): RaphaelSet; + hover(f_in: Function, f_out: Function, icontext?: any, ocontext?: any): RaphaelSet; id: string; - insertAfter(): RaphaelElement; - insertBefore(): RaphaelElement; + insertAfter(): RaphaelSet; + insertBefore(): RaphaelSet; isPointInside(x: number, y: number): boolean; isVisible(): boolean; matrix: RaphaelMatrix; - mousedown(handler: Function): RaphaelElement; - mousemove(handler: Function): RaphaelElement; - mouseout(handler: Function): RaphaelElement; - mouseover(handler: Function): RaphaelElement; - mouseup(handler: Function): RaphaelElement; - next: RaphaelElement; - onDragOver(f: Function): RaphaelElement; + mousedown(handler: Function): RaphaelSet; + mousemove(handler: Function): RaphaelSet; + mouseout(handler: Function): RaphaelSet; + mouseover(handler: Function): RaphaelSet; + mouseup(handler: Function): RaphaelSet; + next: RaphaelSet; + onDragOver(f: Function): RaphaelSet; paper: RaphaelPaper; - pause(anim?: RaphaelAnimation): RaphaelElement; - prev: RaphaelElement; + pause(anim?: RaphaelAnimation): RaphaelSet; + prev: RaphaelSet; raphael: RaphaelStatic; remove(): void; - removeData(key?: string): RaphaelElement; - resume(anim?: RaphaelAnimation): RaphaelElement; + removeData(key?: string): RaphaelSet; + resume(anim?: RaphaelAnimation): RaphaelSet; setTime(anim: RaphaelAnimation): void; - setTime(anim: RaphaelAnimation, value: number): RaphaelElement; - show(): RaphaelElement; + setTime(anim: RaphaelAnimation, value: number): RaphaelSet; + show(): RaphaelSet; status(): { anim: RaphaelAnimation; status: number; }[]; status(anim: RaphaelAnimation): number; - status(anim: RaphaelAnimation, value: number): RaphaelElement; - stop(anim?: RaphaelAnimation): RaphaelElement; - toBack(): RaphaelElement; - toFront(): RaphaelElement; - touchcancel(handler: Function): RaphaelElement; - touchend(handler: Function): RaphaelElement; - touchmove(handler: Function): RaphaelElement; - touchstart(handler: Function): RaphaelElement; + status(anim: RaphaelAnimation, value: number): RaphaelSet; + stop(anim?: RaphaelAnimation): RaphaelSet; + toBack(): RaphaelSet; + toFront(): RaphaelSet; + touchcancel(handler: Function): RaphaelSet; + touchend(handler: Function): RaphaelSet; + touchmove(handler: Function): RaphaelSet; + touchstart(handler: Function): RaphaelSet; transform(): string; - transform(tstr: string): RaphaelElement; - unclick(handler: Function): RaphaelElement; - undblclick(handler: Function): RaphaelElement; - undrag(): RaphaelElement; - unhover(): RaphaelElement; - unhover(f_in: Function, f_out: Function): RaphaelElement; - unmousedown(handler: Function): RaphaelElement; - unmousemove(handler: Function): RaphaelElement; - unmouseout(handler: Function): RaphaelElement; - unmouseover(handler: Function): RaphaelElement; - unmouseup(handler: Function): RaphaelElement; - untouchcancel(handler: Function): RaphaelElement; - untouchend(handler: Function): RaphaelElement; - untouchmove(handler: Function): RaphaelElement; - untouchstart(handler: Function): RaphaelElement; + transform(tstr: string): RaphaelSet; + unclick(handler: Function): RaphaelSet; + undblclick(handler: Function): RaphaelSet; + undrag(): RaphaelSet; + unhover(): RaphaelSet; + unhover(f_in: Function, f_out: Function): RaphaelSet; + unmousedown(handler: Function): RaphaelSet; + unmousemove(handler: Function): RaphaelSet; + unmouseout(handler: Function): RaphaelSet; + unmouseover(handler: Function): RaphaelSet; + unmouseup(handler: Function): RaphaelSet; + untouchcancel(handler: Function): RaphaelSet; + untouchend(handler: Function): RaphaelSet; + untouchmove(handler: Function): RaphaelSet; + untouchstart(handler: Function): RaphaelSet; } interface RaphaelMatrix { diff --git a/raygun4js/raygun4js-tests.ts b/raygun4js/raygun4js-tests.ts new file mode 100644 index 000000000..56577765c --- /dev/null +++ b/raygun4js/raygun4js-tests.ts @@ -0,0 +1,48 @@ +/// + +var client: raygun.RaygunStatic = Raygun.noConflict(); + +var newClient: raygun.RaygunStatic = client.constructNewRaygun(); + +client.init('api-key'); +client.init('api-key', { allowInsecureSubmissions: true }); +client.init('api-key', { allowInsecureSubmissions: true }, { some: 'data' }); + +client.withCustomData({ some: 'data' }); + +client.withTags(['tag1', 'tag2']); + +client.attach().detach(); + +client.send(new Error('a error')); +client.send(new Error('a error'), ['tag1', 'tag2']); + +try { + throw new Error('oops'); +} +catch (e) { + client.send(e); +} + +client.setUser('username'); +client.setUser('username', true); +client.setUser('username', false, 'user@email.com', 'Robbie Robot'); +client.setUser('username', false, 'user@email.com', 'Robbie Robot', 'Robbie'); +client.setUser('username', false, 'user@email.com', 'Robbie Robot', 'Robbie', '8ae89fc9-1144-42d6-9629-bf085dab18d2'); + +client.resetAnonymousUser(); + +client.setVersion('1.2.3.4'); + +client.saveIfOffline(true); + +client.filterSensitiveData(['field1', 'field2']); + +client.setFilterScope('all'); + +client.whitelistCrossOriginDomains(['domain1', 'domain2']); + +client.onBeforeSend(payload=> { + payload.OccurredOn = new Date(); + return payload; +}); \ No newline at end of file diff --git a/raygun4js/raygun4js.d.ts b/raygun4js/raygun4js.d.ts new file mode 100644 index 000000000..a3c2feeb4 --- /dev/null +++ b/raygun4js/raygun4js.d.ts @@ -0,0 +1,97 @@ +// Type definitions for raygun4js 1.18.3 +// Project: https://github.com/MindscapeHQ/raygun4js +// Definitions by: Brian Surowiec +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module raygun { + + // https://github.com/MindscapeHQ/raygun4js/blob/c7d8880045214ab6d403d5cc613c207f696a3cdd/src/raygun.js#L533-539 + interface IStackTrace { + LineNumber: number; + ColumnNumber: number; + ClassName: string; + FileName: string; + MethodName: string; + } + + // https://github.com/MindscapeHQ/raygun4js/blob/c7d8880045214ab6d403d5cc613c207f696a3cdd/src/raygun.js#L598-637 + interface IPayload { + OccurredOn: Date; + Details: { + Error: { + ClassName: string; + Message: string; + StackTrace: IStackTrace[]; + }; + Environment: { + UtcOffset: number; + 'User-Language': string; + 'Document-Mode': number; + 'Browser-Width': number; + 'Browser-Height': number; + 'Screen-Width': number; + 'Screen-Height': number; + 'Color-Depth': number; + Browser: string; + 'Browser-Name': string; + 'Browser-Version': string; + Platform: string; + }; + Client: { + Name: string; + Version: string; + }; + UserCustomData: any; + Tags: string[]; + Request: { + Url: string; + QueryString: string; + Headers: { + 'User-Agent': string; + Referer: string; + Host: string; + }; + }; + Version: string; + }; + } + + // https://github.com/MindscapeHQ/raygun4js/blob/c7d8880045214ab6d403d5cc613c207f696a3cdd/src/raygun.js#L61-82 + interface IRaygunOptions { + allowInsecureSubmissions?: boolean; + ignoreAjaxAbort?: boolean; + ignoreAjaxError?: boolean; + disableAnonymousUserTracking?: boolean; + excludedHostnames?: boolean; + excludedUserAgents?: boolean; + wrapAsynchronousCallbacks?: boolean; + debugMode?: boolean; + ignore3rdPartyErrors?: boolean; + } + + interface RaygunStatic { + noConflict(): RaygunStatic; + constructNewRaygun(): RaygunStatic; + init(apiKey: string, options?: IRaygunOptions, customdata?: any): RaygunStatic; + withCustomData(customdata: any): RaygunStatic; + withTags(tags: string[]): RaygunStatic; + attach(): RaygunStatic; + detach(): RaygunStatic; + send(e: Error, customData?: any, tags?: string[]): RaygunStatic; + setUser(user: string, isAnonymous?: boolean, email?: string, fullName?: string, firstName?: string, uuid?: string): RaygunStatic; + resetAnonymousUser(): void; + setVersion(version: string): RaygunStatic; + saveIfOffline(enableOffline: boolean): RaygunStatic; + filterSensitiveData(filteredKeys: string[]): RaygunStatic; + setFilterScope(scope: string): RaygunStatic; + whitelistCrossOriginDomains(whitelist: string[]): RaygunStatic; + onBeforeSend(callback: (payload: IPayload) => IPayload): RaygunStatic; + } + +} + +declare var Raygun: raygun.RaygunStatic; + +declare module 'Raygun' { + export = Raygun; +} \ No newline at end of file diff --git a/react-router/react-router-test.ts b/react-router/react-router-test.ts index c220b3c24..41b352af3 100644 --- a/react-router/react-router-test.ts +++ b/react-router/react-router-test.ts @@ -263,6 +263,7 @@ class CreateTest { v: Router.Router; constructor() { + // React.createElement() version this.v = Router.create({ routes: React.createElement(Router.Route, null) }); @@ -271,6 +272,16 @@ class CreateTest { location: Router.HistoryLocation, scrollBehavior: Router.ImitateBrowserBehavior }); + + // React.createFactory() version + this.v = Router.create({ + routes: React.createFactory(Router.Route)() + }); + this.v = Router.create({ + routes: React.createFactory(Router.Route)(), + location: Router.HistoryLocation, + scrollBehavior: Router.ImitateBrowserBehavior + }); } run() { @@ -281,12 +292,21 @@ class CreateTest { class RunTest { constructor() { + // React.createElement() version var v1: Router.Router = Router.run(React.createElement(Router.Route, null), (Handler) => { React.render(React.createElement(Handler, null), document.body); }); var v2: Router.Router = Router.run(React.createElement(Router.Route, null), Router.HistoryLocation, (Handler, state) => { React.render(React.createElement(Handler, null), document.body); }); + + // React.createFactory() version + var v3: Router.Router = Router.run(React.createFactory(Router.Route)(), (Handler) => { + React.render(React.createElement(Handler, null), document.body); + }); + var v4: Router.Router = Router.run(React.createFactory(Router.Route)(), Router.HistoryLocation, (Handler, state) => { + React.render(React.createElement(Handler, null), document.body); + }); } } diff --git a/react-router/react-router.d.ts b/react-router/react-router.d.ts index 8f63f2d69..58ec9069a 100644 --- a/react-router/react-router.d.ts +++ b/react-router/react-router.d.ts @@ -179,7 +179,7 @@ declare module ReactRouter { } interface RouterCreateOption { - routes: Route; + routes: React.ReactElement; location?: LocationBase; scrollBehavior?: ScrollBehaviorBase; } @@ -187,8 +187,8 @@ declare module ReactRouter { type RouterRunCallback = (Handler: Router, state: RouterState) => void; function create(options: RouterCreateOption): Router; - function run(routes: Route, callback: RouterRunCallback): Router; - function run(routes: Route, location: LocationBase, callback: RouterRunCallback): Router; + function run(routes: React.ReactElement, callback: RouterRunCallback): Router; + function run(routes: React.ReactElement, location: LocationBase, callback: RouterRunCallback): Router; // diff --git a/react/react-addons-global.d.ts b/react/react-addons-global.d.ts index 891e0d101..bccd3f427 100644 --- a/react/react-addons-global.d.ts +++ b/react/react-addons-global.d.ts @@ -77,9 +77,9 @@ declare module React { // ---------------------------------------------------------------------- interface UpdateSpec { - $set: any; - $merge: {}; - $apply(value: any): any; + $set?: any; + $merge?: {}; + $apply?(value: any): any; // [key: string]: UpdateSpec; } diff --git a/react/react-addons.d.ts b/react/react-addons.d.ts index 54fce3ada..c4e768f27 100644 --- a/react/react-addons.d.ts +++ b/react/react-addons.d.ts @@ -234,6 +234,10 @@ declare module "react/addons" { type: string; } + interface DragEvent extends SyntheticEvent { + dataTransfer: DataTransfer; + } + interface ClipboardEvent extends SyntheticEvent { clipboardData: DataTransfer; } @@ -308,6 +312,7 @@ declare module "react/addons" { (event: E): void; } + interface DragEventHandler extends EventHandler {} interface ClipboardEventHandler extends EventHandler {} interface KeyboardEventHandler extends EventHandler {} interface FocusEventHandler extends EventHandler {} @@ -341,14 +346,14 @@ declare module "react/addons" { onSubmit?: FormEventHandler; onClick?: MouseEventHandler; onDoubleClick?: MouseEventHandler; - onDrag?: MouseEventHandler; - onDragEnd?: MouseEventHandler; - onDragEnter?: MouseEventHandler; - onDragExit?: MouseEventHandler; - onDragLeave?: MouseEventHandler; - onDragOver?: MouseEventHandler; - onDragStart?: MouseEventHandler; - onDrop?: MouseEventHandler; + onDrag?: DragEventHandler; + onDragEnd?: DragEventHandler; + onDragEnter?: DragEventHandler; + onDragExit?: DragEventHandler; + onDragLeave?: DragEventHandler; + onDragOver?: DragEventHandler; + onDragStart?: DragEventHandler; + onDrop?: DragEventHandler; onMouseDown?: MouseEventHandler; onMouseEnter?: MouseEventHandler; onMouseLeave?: MouseEventHandler; @@ -807,9 +812,9 @@ declare module "react/addons" { // ---------------------------------------------------------------------- interface UpdateSpec { - $set: any; - $merge: {}; - $apply(value: any): any; + $set?: any; + $merge?: {}; + $apply?(value: any): any; // [key: string]: UpdateSpec; } diff --git a/react/react-global.d.ts b/react/react-global.d.ts index f7b7859d4..c3fa9fc7c 100644 --- a/react/react-global.d.ts +++ b/react/react-global.d.ts @@ -234,6 +234,10 @@ declare module React { type: string; } + interface DragEvent extends SyntheticEvent { + dataTransfer: DataTransfer; + } + interface ClipboardEvent extends SyntheticEvent { clipboardData: DataTransfer; } @@ -308,6 +312,7 @@ declare module React { (event: E): void; } + interface DragEventHandler extends EventHandler {} interface ClipboardEventHandler extends EventHandler {} interface KeyboardEventHandler extends EventHandler {} interface FocusEventHandler extends EventHandler {} @@ -341,14 +346,14 @@ declare module React { onSubmit?: FormEventHandler; onClick?: MouseEventHandler; onDoubleClick?: MouseEventHandler; - onDrag?: MouseEventHandler; - onDragEnd?: MouseEventHandler; - onDragEnter?: MouseEventHandler; - onDragExit?: MouseEventHandler; - onDragLeave?: MouseEventHandler; - onDragOver?: MouseEventHandler; - onDragStart?: MouseEventHandler; - onDrop?: MouseEventHandler; + onDrag?: DragEventHandler; + onDragEnd?: DragEventHandler; + onDragEnter?: DragEventHandler; + onDragExit?: DragEventHandler; + onDragLeave?: DragEventHandler; + onDragOver?: DragEventHandler; + onDragStart?: DragEventHandler; + onDrop?: DragEventHandler; onMouseDown?: MouseEventHandler; onMouseEnter?: MouseEventHandler; onMouseLeave?: MouseEventHandler; diff --git a/react/react.d.ts b/react/react.d.ts index 64796ddf4..d92279305 100644 --- a/react/react.d.ts +++ b/react/react.d.ts @@ -234,6 +234,10 @@ declare module "react" { type: string; } + interface DragEvent extends SyntheticEvent { + dataTransfer: DataTransfer; + } + interface ClipboardEvent extends SyntheticEvent { clipboardData: DataTransfer; } @@ -308,6 +312,7 @@ declare module "react" { (event: E): void; } + interface DragEventHandler extends EventHandler {} interface ClipboardEventHandler extends EventHandler {} interface KeyboardEventHandler extends EventHandler {} interface FocusEventHandler extends EventHandler {} @@ -341,14 +346,14 @@ declare module "react" { onSubmit?: FormEventHandler; onClick?: MouseEventHandler; onDoubleClick?: MouseEventHandler; - onDrag?: MouseEventHandler; - onDragEnd?: MouseEventHandler; - onDragEnter?: MouseEventHandler; - onDragExit?: MouseEventHandler; - onDragLeave?: MouseEventHandler; - onDragOver?: MouseEventHandler; - onDragStart?: MouseEventHandler; - onDrop?: MouseEventHandler; + onDrag?: DragEventHandler; + onDragEnd?: DragEventHandler; + onDragEnter?: DragEventHandler; + onDragExit?: DragEventHandler; + onDragLeave?: DragEventHandler; + onDragOver?: DragEventHandler; + onDragStart?: DragEventHandler; + onDrop?: DragEventHandler; onMouseDown?: MouseEventHandler; onMouseEnter?: MouseEventHandler; onMouseLeave?: MouseEventHandler; diff --git a/recursive-readdir/recursive-readdir-tests.ts b/recursive-readdir/recursive-readdir-tests.ts new file mode 100644 index 000000000..2d3e1d7c9 --- /dev/null +++ b/recursive-readdir/recursive-readdir-tests.ts @@ -0,0 +1,6 @@ +/// + +import recursiveReaddir = require("recursive-readdir"); + +recursiveReaddir("some/path", (err, files) => {}); +recursiveReaddir("some/path", ["foo.cs", "*.html"], (err, files) => {}); diff --git a/recursive-readdir/recursive-readdir.d.ts b/recursive-readdir/recursive-readdir.d.ts new file mode 100644 index 000000000..b948fac87 --- /dev/null +++ b/recursive-readdir/recursive-readdir.d.ts @@ -0,0 +1,18 @@ +// Type definitions for recursive-readdir v1.2.1 +// Project: https://github.com/jergason/recursive-readdir/ +// Definitions by: Elisée Maurer +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module "recursive-readdir" { + + module RecursiveReaddir { + interface readdir { + (path: string, callback: (error: Error, files: string[]) => any): void; + // ignorePattern supports glob syntax via https://github.com/isaacs/minimatch + (path: string, ignorePattern: string[], callback: (error: Error, files: string[]) => any): void; + } + } + + var r: RecursiveReaddir.readdir; + export = r; +} diff --git a/request/request.d.ts b/request/request.d.ts index eff35ada6..e16eafadb 100644 --- a/request/request.d.ts +++ b/request/request.d.ts @@ -15,40 +15,40 @@ declare module 'request' { export = RequestAPI; - function RequestAPI(uri: string, options?: RequestAPI.Options, callback?: (error: any, response: any, body: any) => void): RequestAPI.Request; - function RequestAPI(uri: string, callback?: (error: any, response: any, body: any) => void): RequestAPI.Request; - function RequestAPI(options: RequestAPI.Options, callback?: (error: any, response: any, body: any) => void): RequestAPI.Request; + function RequestAPI(uri: string, options?: RequestAPI.Options, callback?: (error: any, response: http.IncomingMessage, body: any) => void): RequestAPI.Request; + function RequestAPI(uri: string, callback?: (error: any, response: http.IncomingMessage, body: any) => void): RequestAPI.Request; + function RequestAPI(options: RequestAPI.Options, callback?: (error: any, response: http.IncomingMessage, body: any) => void): RequestAPI.Request; module RequestAPI { export function defaults(options: Options): typeof RequestAPI; - export function request(uri: string, options?: Options, callback?: (error: any, response: any, body: any) => void): Request; - export function request(uri: string, callback?: (error: any, response: any, body: any) => void): Request; - export function request(options?: Options, callback?: (error: any, response: any, body: any) => void): Request; + export function request(uri: string, options?: Options, callback?: (error: any, response: http.IncomingMessage, body: any) => void): Request; + export function request(uri: string, callback?: (error: any, response: http.IncomingMessage, body: any) => void): Request; + export function request(options?: Options, callback?: (error: any, response: http.IncomingMessage, body: any) => void): Request; - export function get(uri: string, options?: Options, callback?: (error: any, response: any, body: any) => void): Request; - export function get(uri: string, callback?: (error: any, response: any, body: any) => void): Request; - export function get(options: Options, callback?: (error: any, response: any, body: any) => void): Request; + export function get(uri: string, options?: Options, callback?: (error: any, response: http.IncomingMessage, body: any) => void): Request; + export function get(uri: string, callback?: (error: any, response: http.IncomingMessage, body: any) => void): Request; + export function get(options: Options, callback?: (error: any, response: http.IncomingMessage, body: any) => void): Request; - export function post(uri: string, options?: Options, callback?: (error: any, response: any, body: any) => void): Request; - export function post(uri: string, callback?: (error: any, response: any, body: any) => void): Request; - export function post(options: Options, callback?: (error: any, response: any, body: any) => void): Request; + export function post(uri: string, options?: Options, callback?: (error: any, response: http.IncomingMessage, body: any) => void): Request; + export function post(uri: string, callback?: (error: any, response: http.IncomingMessage, body: any) => void): Request; + export function post(options: Options, callback?: (error: any, response: http.IncomingMessage, body: any) => void): Request; - export function put(uri: string, options?: Options, callback?: (error: any, response: any, body: any) => void): Request; - export function put(uri: string, callback?: (error: any, response: any, body: any) => void): Request; - export function put(options: Options, callback?: (error: any, response: any, body: any) => void): Request; + export function put(uri: string, options?: Options, callback?: (error: any, response: http.IncomingMessage, body: any) => void): Request; + export function put(uri: string, callback?: (error: any, response: http.IncomingMessage, body: any) => void): Request; + export function put(options: Options, callback?: (error: any, response: http.IncomingMessage, body: any) => void): Request; - export function head(uri: string, options?: Options, callback?: (error: any, response: any, body: any) => void): Request; - export function head(uri: string, callback?: (error: any, response: any, body: any) => void): Request; - export function head(options: Options, callback?: (error: any, response: any, body: any) => void): Request; + export function head(uri: string, options?: Options, callback?: (error: any, response: http.IncomingMessage, body: any) => void): Request; + export function head(uri: string, callback?: (error: any, response: http.IncomingMessage, body: any) => void): Request; + export function head(options: Options, callback?: (error: any, response: http.IncomingMessage, body: any) => void): Request; - export function patch(uri: string, options?: Options, callback?: (error: any, response: any, body: any) => void): Request; - export function patch(uri: string, callback?: (error: any, response: any, body: any) => void): Request; - export function patch(options: Options, callback?: (error: any, response: any, body: any) => void): Request; + export function patch(uri: string, options?: Options, callback?: (error: any, response: http.IncomingMessage, body: any) => void): Request; + export function patch(uri: string, callback?: (error: any, response: http.IncomingMessage, body: any) => void): Request; + export function patch(options: Options, callback?: (error: any, response: http.IncomingMessage, body: any) => void): Request; - export function del(uri: string, options?: Options, callback?: (error: any, response: any, body: any) => void): Request; - export function del(uri: string, callback?: (error: any, response: any, body: any) => void): Request; - export function del(options: Options, callback?: (error: any, response: any, body: any) => void): Request; + export function del(uri: string, options?: Options, callback?: (error: any, response: http.IncomingMessage, body: any) => void): Request; + export function del(uri: string, callback?: (error: any, response: http.IncomingMessage, body: any) => void): Request; + export function del(options: Options, callback?: (error: any, response: http.IncomingMessage, body: any) => void): Request; export function forever(agentOptions: any, optionsArg: any): Request; export function jar(): CookieJar; @@ -59,9 +59,10 @@ declare module 'request' { export interface Options { url?: string; uri?: string; - callback?: (error: any, response: any, body: any) => void; + callback?: (error: any, response: http.IncomingMessage, body: any) => void; jar?: any; // CookieJar form?: any; // Object or string + auth?: AuthOptions; oauth?: OAuthOptions; aws?: AWSOptions; hawk ?: HawkOptions; @@ -107,6 +108,7 @@ declare module 'request' { multipart(multipart: RequestPart[]): Request; json(val: any): Request; aws(opts: AWSOptions, now?: boolean): Request; + auth(username: string, password: string, sendInmediately?: boolean, bearer?: string): Request; oauth(oauth: OAuthOptions): Request; jar(jar: CookieJar): Request; diff --git a/restangular/restangular.d.ts b/restangular/restangular.d.ts index c2013f6c4..4f48101d8 100644 --- a/restangular/restangular.d.ts +++ b/restangular/restangular.d.ts @@ -15,7 +15,7 @@ declare module restangular { $object: T; } - interface ICollectionPromise extends ng.IPromise { + interface ICollectionPromise extends ng.IPromise { push(object: any): ICollectionPromise; call(methodName: string, params?: any): ICollectionPromise; get(fieldName: string): ICollectionPromise; @@ -93,8 +93,9 @@ declare module restangular { withConfig(configurer: (RestangularProvider: IProvider) => any): IService; restangularizeElement(parent: any, element: any, route: string, collection?: any, reqParams?: any): IElement; restangularizeCollection(parent: any, element: any, route: string): ICollection; - service(route: string, parent: any): IService; + service(route: string, parent?: any): IService; stripRestangular(element: any): any; + extendModel(route: string, extender: (model: IElement) => any): void; } interface IElement extends IService { @@ -114,6 +115,7 @@ declare module restangular { patch(queryParams?: any, headers?: any): IPromise; clone(): IElement; plain(): any; + plain(): T; withHttpConfig(httpConfig: IRequestConfig): IElement; save(queryParams?: any, headers?: any): IPromise; getRestangularUrl(): string; @@ -130,6 +132,9 @@ declare module restangular { patch(queryParams?: any, headers?: any): IPromise; putElement(idx: any, params: any, headers: any): IPromise; withHttpConfig(httpConfig: IRequestConfig): ICollection; + clone(): ICollection; + plain(): any; + plain(): T[]; getRestangularUrl(): string; } } diff --git a/restify/restify-tests.ts b/restify/restify-tests.ts index 3ff16da55..3e0697c1d 100644 --- a/restify/restify-tests.ts +++ b/restify/restify-tests.ts @@ -99,23 +99,117 @@ server.del( /(.*)/, send); server.get( /(.*)/, send); server.head(/(.*)/, send); -new restify.ConflictError("test"); -new restify.InvalidArgumentError("message"); -new restify.RestError("message"); -new restify.BadDigestError("message"); -new restify.BadMethodError("message"); -new restify.BadRequestError('test'); -new restify.InternalError("message"); -new restify.InvalidContentError("message"); -new restify.InvalidCredentialsError("message"); -new restify.InvalidHeaderError("message"); -new restify.InvalidVersionError("message"); -new restify.MissingParameterError("message"); -new restify.NotAuthorizedError("message"); -new restify.RequestExpiredError("jjmessage"); -new restify.RequestThrottledError("message"); -new restify.ResourceNotFoundError("message"); -new restify.WrongAcceptError("message"); + +new restify.BadRequestError(); +new restify.UnauthorizedError(); +new restify.PaymentRequiredError(); +new restify.ForbiddenError(); +new restify.NotFoundError(); +new restify.MethodNotAllowedError(); +new restify.NotAcceptableError(); +new restify.ProxyAuthenticationRequiredError(); +new restify.RequestTimeoutError(); +new restify.ConflictError(); +new restify.GoneError(); +new restify.LengthRequiredError(); +new restify.RequestEntityTooLargeError(); +new restify.RequesturiTooLargeError(); +new restify.UnsupportedMediaTypeError(); +new restify.RequestedRangeNotSatisfiableError(); +new restify.ExpectationFailedError(); +new restify.ImATeapotError(); +new restify.UnprocessableEntityError(); +new restify.LockedError(); +new restify.FailedDependencyError(); +new restify.UnorderedCollectionError(); +new restify.UpgradeRequiredError(); +new restify.PreconditionRequiredError(); +new restify.TooManyRequestsError(); +new restify.RequestHeaderFieldsTooLargeError(); +new restify.InternalServerError(); +new restify.NotImplementedError(); +new restify.BadGatewayError(); +new restify.ServiceUnavailableError(); +new restify.GatewayTimeoutError(); +new restify.HttpVersionNotSupportedError(); +new restify.VariantAlsoNegotiatesError(); +new restify.InsufficientStorageError(); +new restify.BandwidthLimitExceededError(); +new restify.NotExtendedError(); +new restify.NetworkAuthenticationRequiredError(); +new restify.RestError(); + +new restify.BadRequestError(new Error(), 'foo'); +new restify.UnauthorizedError(new Error(), 'foo'); +new restify.PaymentRequiredError(new Error(), 'foo'); +new restify.ForbiddenError(new Error(), 'foo'); +new restify.NotFoundError(new Error(), 'foo'); +new restify.MethodNotAllowedError(new Error(), 'foo'); +new restify.NotAcceptableError(new Error(), 'foo'); +new restify.ProxyAuthenticationRequiredError(new Error(), 'foo'); +new restify.RequestTimeoutError(new Error(), 'foo'); +new restify.ConflictError(new Error(), 'foo'); +new restify.GoneError(new Error(), 'foo'); +new restify.LengthRequiredError(new Error(), 'foo'); +new restify.RequestEntityTooLargeError(new Error(), 'foo'); +new restify.RequesturiTooLargeError(new Error(), 'foo'); +new restify.UnsupportedMediaTypeError(new Error(), 'foo'); +new restify.RequestedRangeNotSatisfiableError(new Error(), 'foo'); +new restify.ExpectationFailedError(new Error(), 'foo'); +new restify.ImATeapotError(new Error(), 'foo'); +new restify.UnprocessableEntityError(new Error(), 'foo'); +new restify.LockedError(new Error(), 'foo'); +new restify.FailedDependencyError(new Error(), 'foo'); +new restify.UnorderedCollectionError(new Error(), 'foo'); +new restify.UpgradeRequiredError(new Error(), 'foo'); +new restify.PreconditionRequiredError(new Error(), 'foo'); +new restify.TooManyRequestsError(new Error(), 'foo'); +new restify.RequestHeaderFieldsTooLargeError(new Error(), 'foo'); +new restify.InternalServerError(new Error(), 'foo'); +new restify.NotImplementedError(new Error(), 'foo'); +new restify.BadGatewayError(new Error(), 'foo'); +new restify.ServiceUnavailableError(new Error(), 'foo'); +new restify.GatewayTimeoutError(new Error(), 'foo'); +new restify.HttpVersionNotSupportedError(new Error(), 'foo'); +new restify.VariantAlsoNegotiatesError(new Error(), 'foo'); +new restify.InsufficientStorageError(new Error(), 'foo'); +new restify.BandwidthLimitExceededError(new Error(), 'foo'); +new restify.NotExtendedError(new Error(), 'foo'); +new restify.NetworkAuthenticationRequiredError(new Error(), 'foo'); +new restify.RestError(new Error(), 'foo'); + +new restify.PreconditionFailedError(new Error(), 'foo'); +new restify.BadDigestError(new Error(), 'foo'); +new restify.BadMethodError(new Error(), 'foo'); +new restify.InternalError(new Error(), 'foo'); +new restify.InvalidArgumentError(new Error(), 'foo'); +new restify.InvalidContentError(new Error(), 'foo'); +new restify.InvalidCredentialsError(new Error(), 'foo'); +new restify.InvalidHeaderError(new Error(), 'foo'); +new restify.InvalidVersionError(new Error(), 'foo'); +new restify.MissingParameterError(new Error(), 'foo'); +new restify.NotAuthorizedError(new Error(), 'foo'); +new restify.RequestExpiredError(new Error(), 'foo'); +new restify.RequestThrottledError(new Error(), 'foo'); +new restify.ResourceNotFoundError(new Error(), 'foo'); +new restify.WrongAcceptError(new Error(), 'foo'); + +new restify.PreconditionFailedError(); +new restify.BadDigestError(); +new restify.BadMethodError(); +new restify.InternalError(); +new restify.InvalidArgumentError(); +new restify.InvalidContentError(); +new restify.InvalidCredentialsError(); +new restify.InvalidHeaderError(); +new restify.InvalidVersionError(); +new restify.MissingParameterError(); +new restify.NotAuthorizedError(); +new restify.RequestExpiredError(); +new restify.RequestThrottledError(); +new restify.ResourceNotFoundError(); +new restify.WrongAcceptError(); + server.name = ""; server.version = ""; diff --git a/restify/restify.d.ts b/restify/restify.d.ts index e890ef2b2..596637f23 100644 --- a/restify/restify.d.ts +++ b/restify/restify.d.ts @@ -179,25 +179,68 @@ declare module "restify" { export function createStringClient(options?: ClientOptions): Client; export function createClient(options?: ClientOptions): HttpClient; - export class ConflictError { constructor(message?: any); } - export class InvalidArgumentError { constructor(message?: any); } - export class RestError { constructor(message?: any); } - export class BadDigestError { constructor(message: any); } - export class BadMethodError { constructor(message: any); } - export class BadRequestError { constructor(message: any); } - export class InternalError { constructor(message: any); } - export class InvalidContentError { constructor(message: any); } - export class InvalidCredentialsError { constructor(message: any); } - export class InvalidHeaderError { constructor(message: any); } - export class InvalidVersionError { constructor(message: any); } - export class MissingParameterError { constructor(message: any); } - export class NotAuthorizedError { constructor(message: any); } - export class RequestExpiredError { constructor(message: any); } - export class RequestThrottledError { constructor(message: any); } - export class ResourceNotFoundError { constructor(message: any); } - export class WrongAcceptError { constructor(message: any); } - export class UnsupportedMediaTypeError { constructor(message: any); } - export class RequestTimeoutError { constructor(message: any); } + export class HttpError { constructor(cause: any, message?: any); } + + class DefiniteHttpError { + constructor(message?: any); + constructor(cause: any, message?: any); + } + + export class BadRequestError extends DefiniteHttpError {} + export class UnauthorizedError extends DefiniteHttpError {} + export class PaymentRequiredError extends DefiniteHttpError {} + export class ForbiddenError extends DefiniteHttpError {} + export class NotFoundError extends DefiniteHttpError {} + export class MethodNotAllowedError extends DefiniteHttpError {} + export class NotAcceptableError extends DefiniteHttpError {} + export class ProxyAuthenticationRequiredError extends DefiniteHttpError {} + export class RequestTimeoutError extends DefiniteHttpError {} + export class ConflictError extends DefiniteHttpError {} + export class GoneError extends DefiniteHttpError {} + export class LengthRequiredError extends DefiniteHttpError {} + export class RequestEntityTooLargeError extends DefiniteHttpError {} + export class RequesturiTooLargeError extends DefiniteHttpError {} + export class UnsupportedMediaTypeError extends DefiniteHttpError {} + export class RequestedRangeNotSatisfiableError extends DefiniteHttpError {} + export class ExpectationFailedError extends DefiniteHttpError {} + export class ImATeapotError extends DefiniteHttpError {} + export class UnprocessableEntityError extends DefiniteHttpError {} + export class LockedError extends DefiniteHttpError {} + export class FailedDependencyError extends DefiniteHttpError {} + export class UnorderedCollectionError extends DefiniteHttpError {} + export class UpgradeRequiredError extends DefiniteHttpError {} + export class PreconditionRequiredError extends DefiniteHttpError {} + export class TooManyRequestsError extends DefiniteHttpError {} + export class RequestHeaderFieldsTooLargeError extends DefiniteHttpError {} + export class InternalServerError extends DefiniteHttpError {} + export class NotImplementedError extends DefiniteHttpError {} + export class BadGatewayError extends DefiniteHttpError {} + export class ServiceUnavailableError extends DefiniteHttpError {} + export class GatewayTimeoutError extends DefiniteHttpError {} + export class HttpVersionNotSupportedError extends DefiniteHttpError {} + export class VariantAlsoNegotiatesError extends DefiniteHttpError {} + export class InsufficientStorageError extends DefiniteHttpError {} + export class BandwidthLimitExceededError extends DefiniteHttpError {} + export class NotExtendedError extends DefiniteHttpError {} + export class NetworkAuthenticationRequiredError extends DefiniteHttpError {} + export class RestError extends DefiniteHttpError {} + + export class PreconditionFailedError extends RestError {} + export class BadDigestError extends RestError {} + export class BadMethodError extends RestError {} + export class InternalError extends RestError {} + export class InvalidArgumentError extends RestError {} + export class InvalidContentError extends RestError {} + export class InvalidCredentialsError extends RestError {} + export class InvalidHeaderError extends RestError {} + export class InvalidVersionError extends RestError {} + export class MissingParameterError extends RestError {} + export class NotAuthorizedError extends RestError {} + export class RequestExpiredError extends RestError {} + export class RequestThrottledError extends RestError {} + export class ResourceNotFoundError extends RestError {} + export class WrongAcceptError extends RestError {} + export function acceptParser(parser: any): RequestHandler; export function authorizationParser(): RequestHandler; diff --git a/routie/routie-tests.ts b/routie/routie-tests.ts index 323142c7e..12ee397c4 100644 --- a/routie/routie-tests.ts +++ b/routie/routie-tests.ts @@ -54,4 +54,24 @@ routie("users/12312312"); routie("*", function () { }); -routie("anything"); \ No newline at end of file +routie("anything"); + +// STATIC + +// Lookup +var existing = routie.lookup("users/bob", () => { +}); + +// Remove +routie.remove("users/bob", () => { +}); + +// RemoveAll +routie.removeAll(); + +// Navigate +routie.navigate("users/bob"); +routie.navigate("users/bob", { silent: true }); + +// NoConflict +var myRoutie = routie.noConflict(); diff --git a/routie/routie.d.ts b/routie/routie.d.ts index 9317904d4..79ab2dc8a 100644 --- a/routie/routie.d.ts +++ b/routie/routie.d.ts @@ -3,15 +3,33 @@ // Definitions by: Adilson // Definitions: https://github.com/borisyankov/DefinitelyTyped -interface Route { - constructor(path: string, name: string): Route; - addHandler(fn: Function): void; - removeHandler(fn: Function): void; - run(params: any): void; - match(path: string, params: any): boolean; - toURL(params: any): string; +declare module routie { + interface Route { + constructor(path: string, name: string): Route; + addHandler(fn: Function): void; + removeHandler(fn: Function): void; + run(params: any): void; + match(path: string, params: any): boolean; + toURL(params: any): string; + } + + interface Routie extends RoutieStatic { + (path: string): void; + (path: string, fn: Function): void; + (routes: { [key: string]: Function }): void; + } + + interface RoutieStatic { + lookup(name: string, fn: Function): string; + remove(path: string, fn: Function): void; + removeAll(): void; + navigate(path: string, options?: RouteOptions): void; + noConflict(): Routie; + } + + interface RouteOptions { + silent?: boolean; + } } -declare function routie(path: string): void; -declare function routie(path: string, fn: Function): void; -declare function routie(routes: { [key: string]: Function }): void; \ No newline at end of file +declare var routie: routie.Routie; diff --git a/sequelize/sequelize-tests.ts b/sequelize/sequelize-tests.ts index 0bbfe3f6d..8766745b8 100644 --- a/sequelize/sequelize-tests.ts +++ b/sequelize/sequelize-tests.ts @@ -101,6 +101,8 @@ model.belongsTo(model); model.belongsTo(model, assocOpts); model.hasMany(model); model.hasMany(model, assocOpts); +model.belongsToMany(model); +model.belongsToMany(model, assocOpts); promiseMe = model.sync(); promiseMe = model.drop(dropOpts); diff --git a/sequelize/sequelize.d.ts b/sequelize/sequelize.d.ts index 08eb47272..85d473f28 100644 --- a/sequelize/sequelize.d.ts +++ b/sequelize/sequelize.d.ts @@ -909,6 +909,14 @@ declare module "sequelize" */ belongsTo(target: Model, options?: AssociationOptions): void; + /** + * Creates an association to connect sources with multiple targets. Furthermore the targets can also have connections to multiple sources. + * + * @param target + * @param options + */ + belongsToMany(target: Model, options?: AssociationOptions): void; + /** * Create an association that is either 1:m or n:m. * diff --git a/sinon-chai/sinon-chai-tests.ts b/sinon-chai/sinon-chai-tests.ts index 48ac47ee9..65036219e 100644 --- a/sinon-chai/sinon-chai-tests.ts +++ b/sinon-chai/sinon-chai-tests.ts @@ -1,19 +1,17 @@ -/// /// -declare var expect: chai.ExpectStatic; - import chai = require('chai'); import sinonChai = require('sinon-chai'); chai.use(sinonChai); +var expect = chai.expect; +declare var spy: Sinon.SinonSpy; +declare var anotherSpy: Sinon.SinonSpy; +declare var context: {}; +declare var match: RegExp; +// ReSharper disable WrongExpressionStatement function test() { - var spy: Function; - var anotherSpy: Function; - var context: any; - var match: any; - expect(spy).to.have.been.called; expect(spy).to.have.been.calledOnce; expect(spy).to.have.been.calledTwice; @@ -32,6 +30,10 @@ function test() { expect(spy).to.always.have.been.calledWithMatch(match); expect(spy).to.have.returned(1); expect(spy).to.have.always.returned(1); + expect(spy).to.have.thrown(new Error()); + expect(spy).to.have.thrown(Error); expect(spy).to.have.thrown('an error'); + expect(spy).to.have.always.thrown(new Error()); + expect(spy).to.have.always.thrown(Error); expect(spy).to.have.always.thrown('an error'); } diff --git a/sinon-chai/sinon-chai.d.ts b/sinon-chai/sinon-chai.d.ts index d16969dd9..03bd0e81d 100644 --- a/sinon-chai/sinon-chai.d.ts +++ b/sinon-chai/sinon-chai.d.ts @@ -1,34 +1,84 @@ -// Type definitions for sinon-chai 2.4.0 +// Type definitions for sinon-chai 2.7.0 // Project: https://github.com/domenic/sinon-chai -// Definitions by: Kazi Manzur Rashid +// Definitions by: Kazi Manzur Rashid , Jed Mao // Definitions: https://github.com/borisyankov/DefinitelyTyped /// +/// -declare module chai { - interface Expect { - called: Expect; - calledOnce: Expect; - calledTwice: Expect; - calledThrice: Expect; - callCount(count: number): Expect; - calledBefore(spy: Function): Expect; - calledAfter(spy: Function): Expect; - calledWithNew: Expect; - calledOn(context: any): Expect; - calledWith(...args: any[]): Expect; - calledWithExactly(...args: any[]): Expect; - calledWithMatch(...args: any[]): Expect; - returned(returnVal: any): Expect; - thrown(errorObjOrErrorTypeStringOrNothing: any): Expect; - } +declare module Chai { interface LanguageChains { - always: Expect; + always: Assertion; + } + + interface Assertion { + /** + * true if the spy was called at least once. + */ + called: Assertion; + /** + * @param count The number of recorded calls. + */ + callCount(count: number): Assertion; + /** + * true if the spy was called exactly once. + */ + calledOnce: Assertion; + /** + * true if the spy was called exactly twice. + */ + calledTwice: Assertion; + /** + * true if the spy was called exactly thrice. + */ + calledThrice: Assertion; + /** + * Returns true if the spy was called before anotherSpy. + */ + calledBefore(anotherSpy: Sinon.SinonSpy): Assertion; + /** + * Returns true if the spy was called after anotherSpy. + */ + calledAfter(anotherSpy: Sinon.SinonSpy): Assertion; + /** + * Returns true if spy/stub was called with the new operator. Beware that + * this is inferred based on the value of the this object and the spy + * function's prototype, so it may give false positives if you actively + * return the right kind of object. + */ + calledWithNew: Assertion; + /** + * Returns true if context was this for this call. + */ + calledOn(context: any): Assertion; + /** + * Returns true if call received provided arguments (and possibly others). + */ + calledWith(...args: any[]): Assertion; + /** + * Returns true if call received provided arguments and no others. + */ + calledWithExactly(...args: any[]): Assertion; + /** + * Returns true if call received matching arguments (and possibly others). + * This behaves the same as spyCall.calledWith(sinon.match(arg1), sinon.match(arg2), ...). + */ + calledWithMatch(...args: any[]): Assertion; + /** + * Returns true if spy returned the provided value at least once. Uses + * deep comparison for objects and arrays. Use spy.returned(sinon.match.same(obj)) + * for strict comparison (see matchers). + */ + returned(obj: any): Assertion; + /** + * Returns true if spy threw the provided exception object at least once. + */ + thrown(obj?: Error|typeof Error|string): Assertion; } } declare module "sinon-chai" { - function exports(_chai: typeof chai, utils: any): void; - export = exports; + function sinonChai(chai: any, utils: any): void; + export = sinonChai; } diff --git a/sinon/sinon-tests.ts b/sinon/sinon-tests.ts index b9b71c10e..ca916788d 100644 --- a/sinon/sinon-tests.ts +++ b/sinon/sinon-tests.ts @@ -1,95 +1,103 @@ /// function once(fn: Function) { - var returnValue: any, called = false; - return function () { - if (!called) { - called = true; - returnValue = fn.apply(this, arguments); - } - return returnValue; - }; + var returnValue: any, called = false; + return function () { + if (!called) { + called = true; + returnValue = fn.apply(this, arguments); + } + return returnValue; + }; } function testOne() { - var callback = sinon.spy(); - var proxy = once(callback); - proxy(); - if (callback.calledOnce) { console.log("test1 calledOnce success"); } else { console.log("test1 calledOnce failure"); } + var callback = sinon.spy(); + var proxy = once(callback); + proxy(); + if (callback.calledOnce) { console.log("test1 calledOnce success"); } else { console.log("test1 calledOnce failure"); } } function testTwo() { - var callback = sinon.spy(() => {}); - var proxy = once(callback); - proxy(); - proxy(); - if (callback.calledOnce) { console.log("test2 calledOnce success"); } else { console.log("test2 calledOnce failure"); } + var callback = sinon.spy(() => {}); + var proxy = once(callback); + proxy(); + proxy(); + if (callback.calledOnce) { console.log("test2 calledOnce success"); } else { console.log("test2 calledOnce failure"); } } function testThree() { - var obj = { thisObj: true }; - var callback = sinon.spy({}, "method"); - var proxy = once(callback); - proxy.call(obj, callback, 1, 2, 3); - if (callback.calledOn(obj)) { console.log("test3 calledOn success"); } else { console.log("test3 calledOn failure"); } - if (callback.calledWith(callback, 1, 2, 3)) { console.log("test3 calledWith success"); } else { console.log("test3 calledWith failure"); } + var obj = { thisObj: true }; + var callback = sinon.spy({}, "method"); + var proxy = once(callback); + proxy.call(obj, callback, 1, 2, 3); + if (callback.calledOn(obj)) { console.log("test3 calledOn success"); } else { console.log("test3 calledOn failure"); } + if (callback.calledWith(callback, 1, 2, 3)) { console.log("test3 calledWith success"); } else { console.log("test3 calledWith failure"); } } function testFour() { - var obj = { thisObj: true }; - var callback = sinon.stub().returns(42); - var proxy = once(callback); - var val = proxy.apply(callback, [1, 2, 3]); - if (val == 42) { console.log("test4 returns success"); } else { console.log("test4 returns failure"); } + var callback = sinon.stub().returns(42); + var proxy = once(callback); + var val = proxy.apply(callback, [1, 2, 3]); + if (val === 42) { console.log("test4 returns success"); } else { console.log("test4 returns failure"); } } function testFive() { - var obj = { thisObj: true }; - var callback = sinon.stub().returnsArg(1); - var proxy = once(callback); - var val = proxy.apply(callback, [1, 2, 3]); - if (val == 2) { console.log("test5 returnsArg success"); } else { console.log("test5 returnsArg failure"); } + var callback = sinon.stub().returnsArg(1); + var proxy = once(callback); + var val = proxy.apply(callback, [1, 2, 3]); + if (val === 2) { console.log("test5 returnsArg success"); } else { console.log("test5 returnsArg failure"); } } var objectUnderTest: any = { - process: function (obj: any) { - // It doesn't really matter what's here because the stub is going to replace this function - var dummy = true; - if (dummy) { return obj.success(99); } else { obj.failure(99); } - } + process: (obj: any) => { + // It doesn't really matter what's here because the stub is going to replace this function + return obj.success(99); + } }; function testSix() { - var obj = { thisObj: true }; - var stub = sinon.stub(objectUnderTest, "process").yieldsTo("success"); - var val = objectUnderTest.process({ - success: function () { console.log("test6 yieldsTo success"); }, - failure: function () { console.log("test6 yieldsTo failure"); } - }); - stub.restore(); + var stub = sinon.stub(objectUnderTest, "process").yieldsTo("success"); + objectUnderTest.process({ + success: () => { console.log("test6 yieldsTo success"); }, + failure: () => { console.log("test6 yieldsTo failure"); } + }); + stub.restore(); } function testSeven() { - var obj = { functionToTest : function () { } }; - var mockObj = sinon.mock(obj); - obj.functionToTest(); - mockObj.expects('functionToTest').once(); + var obj = { functionToTest : () => { } }; + var mockObj = sinon.mock(obj); + obj.functionToTest(); + mockObj.expects('functionToTest').once(); } function testEight() { - var combinedMatcher = sinon.match.typeOf("object").and(sinon.match.has("pages")); + sinon.match.typeOf("object").and(sinon.match.has("pages")); +} + +function testNine() { + var callback = sinon.stub().returns(42); + callback({ x: 5, y: 5 }); + callback.calledWithMatch({ x: 5 }); + callback.alwaysCalledWithMatch({ y: 5 }); + callback.neverCalledWithMatch({ x: 6 }); + callback.notCalledWithMatch({ x: 6 }); + sinon.assert.calledWithMatch(callback, { x: 5 }); + sinon.assert.alwaysCalledWithMatch(callback, { y: 5 }); + sinon.assert.neverCalledWithMatch(callback, { x: 6 }); } function testSandbox() { - var sandbox = sinon.sandbox.create(); - if (sandbox.spy().called) { - sandbox.stub(objectUnderTest, "process").yieldsTo("success"); - sandbox.mock(objectUnderTest).expects("process").once(); - } - sandbox.useFakeTimers(); - sandbox.useFakeXMLHttpRequest(); - sandbox.useFakeServer(); - sandbox.restore(); + var sandbox = sinon.sandbox.create(); + if (sandbox.spy().called) { + sandbox.stub(objectUnderTest, "process").yieldsTo("success"); + sandbox.mock(objectUnderTest).expects("process").once(); + } + sandbox.useFakeTimers(); + sandbox.useFakeXMLHttpRequest(); + sandbox.useFakeServer(); + sandbox.restore(); } testOne(); @@ -100,3 +108,4 @@ testFive(); testSix(); testSeven(); testEight(); +testNine(); diff --git a/sinon/sinon.d.ts b/sinon/sinon.d.ts index 4b8656661..6440dda90 100644 --- a/sinon/sinon.d.ts +++ b/sinon/sinon.d.ts @@ -3,415 +3,417 @@ // Definitions by: William Sears // Definitions: https://github.com/borisyankov/DefinitelyTyped -interface SinonSpyCallApi { - // Properties - thisValue: any; - args: any[]; - exception: any; - returnValue: any; +declare module Sinon { + interface SinonSpyCallApi { + // Properties + thisValue: any; + args: any[]; + exception: any; + returnValue: any; - // Methods - calledOn(obj: any): boolean; - calledWith(...args: any[]): boolean; - calledWithExactly(...args: any[]): boolean; - calledWithMatch(...args: SinonMatcher[]): boolean; - notCalledWith(...args: any[]): boolean; - notCalledWithMatch(...args: SinonMatcher[]): boolean; - returned(value: any): boolean; - threw(): boolean; - threw(type: string): boolean; - threw(obj: any): boolean; - callArg(pos: number): void; - callArgOn(pos: number, obj: any, ...args: any[]): void; - callArgWith(pos: number, ...args: any[]): void; - callArgOnWith(pos: number, obj: any, ...args: any[]): void; - yield(...args: any[]): void; - yieldOn(obj: any, ...args: any[]): void; - yieldTo(property: string, ...args: any[]): void; - yieldToOn(property: string, obj: any, ...args: any[]): void; + // Methods + calledOn(obj: any): boolean; + calledWith(...args: any[]): boolean; + calledWithExactly(...args: any[]): boolean; + calledWithMatch(...args: any[]): boolean; + notCalledWith(...args: any[]): boolean; + notCalledWithMatch(...args: any[]): boolean; + returned(value: any): boolean; + threw(): boolean; + threw(type: string): boolean; + threw(obj: any): boolean; + callArg(pos: number): void; + callArgOn(pos: number, obj: any, ...args: any[]): void; + callArgWith(pos: number, ...args: any[]): void; + callArgOnWith(pos: number, obj: any, ...args: any[]): void; + yield(...args: any[]): void; + yieldOn(obj: any, ...args: any[]): void; + yieldTo(property: string, ...args: any[]): void; + yieldToOn(property: string, obj: any, ...args: any[]): void; + } + + interface SinonSpyCall extends SinonSpyCallApi { + calledBefore(call: SinonSpyCall): boolean; + calledAfter(call: SinonSpyCall): boolean; + calledWithNew(call: SinonSpyCall): boolean; + } + + interface SinonSpy extends SinonSpyCallApi { + // Properties + callCount: number; + called: boolean; + notCalled: boolean; + calledOnce: boolean; + calledTwice: boolean; + calledThrice: boolean; + firstCall: SinonSpyCall; + secondCall: SinonSpyCall; + thirdCall: SinonSpyCall; + lastCall: SinonSpyCall; + thisValues: any[]; + args: any[][]; + exceptions: any[]; + returnValues: any[]; + + // Methods + (...args: any[]): any; + calledBefore(anotherSpy: SinonSpy): boolean; + calledAfter(anotherSpy: SinonSpy): boolean; + calledWithNew(spy: SinonSpy): boolean; + withArgs(...args: any[]): SinonSpy; + alwaysCalledOn(obj: any): boolean; + alwaysCalledWith(...args: any[]): boolean; + alwaysCalledWithExactly(...args: any[]): boolean; + alwaysCalledWithMatch(...args: any[]): boolean; + neverCalledWith(...args: any[]): boolean; + neverCalledWithMatch(...args: any[]): boolean; + alwaysThrew(): boolean; + alwaysThrew(type: string): boolean; + alwaysThrew(obj: any): boolean; + alwaysReturned(): boolean; + invokeCallback(...args: any[]): void; + getCall(n: number): SinonSpyCall; + reset(): void; + printf(format: string, ...args: any[]): string; + restore(): void; + } + + interface SinonSpyStatic { + (): SinonSpy; + (func: any): SinonSpy; + (obj: any, method: string): SinonSpy; + } + + interface SinonStatic { + spy: SinonSpyStatic; + } + + interface SinonStub extends SinonSpy { + resetBehavior(): void; + returns(obj: any): SinonStub; + returnsArg(index: number): SinonStub; + throws(type?: string): SinonStub; + throws(obj: any): SinonStub; + callsArg(index: number): SinonStub; + callsArgOn(index: number, context: any): SinonStub; + callsArgWith(index: number, ...args: any[]): SinonStub; + callsArgOnWith(index: number, context: any, ...args: any[]): SinonStub; + callsArgAsync(index: number): SinonStub; + callsArgOnAsync(index: number, context: any): SinonStub; + callsArgWithAsync(index: number, ...args: any[]): SinonStub; + callsArgOnWithAsync(index: number, context: any, ...args: any[]): SinonStub; + onCall(n: number): SinonStub; + onFirstCall(): SinonStub; + onSecondCall(): SinonStub; + onThirdCall(): SinonStub; + yields(...args: any[]): SinonStub; + yieldsOn(context: any, ...args: any[]): SinonStub; + yieldsTo(property: string, ...args: any[]): SinonStub; + yieldsToOn(property: string, context: any, ...args: any[]): SinonStub; + yieldsAsync(...args: any[]): SinonStub; + yieldsOnAsync(context: any, ...args: any[]): SinonStub; + yieldsToAsync(property: string, ...args: any[]): SinonStub; + yieldsToOnAsync(property: string, context: any, ...args: any[]): SinonStub; + withArgs(...args: any[]): SinonStub; + } + + interface SinonStubStatic { + (): SinonStub; + (obj: any): SinonStub; + (obj: any, method: string): SinonStub; + (obj: any, method: string, func: any): SinonStub; + } + + interface SinonStatic { + stub: SinonStubStatic; + } + + interface SinonExpectation extends SinonStub { + atLeast(n: number): SinonExpectation; + atMost(n: number): SinonExpectation; + never(): SinonExpectation; + once(): SinonExpectation; + twice(): SinonExpectation; + thrice(): SinonExpectation; + exactly(n: number): SinonExpectation; + withArgs(...args: any[]): SinonExpectation; + withExactArgs(...args: any[]): SinonExpectation; + on(obj: any): SinonExpectation; + verify(): SinonExpectation; + restore(): void; + } + + interface SinonExpectationStatic { + create(methodName?: string): SinonExpectation; + } + + interface SinonMock { + expects(method: string): SinonExpectation; + restore(): void; + verify(): void; + } + + interface SinonMockStatic { + (): SinonExpectation; + (obj: any): SinonMock; + } + + interface SinonStatic { + expectation: SinonExpectationStatic; + mock: SinonMockStatic; + } + + interface SinonFakeTimers { + now: number; + create(now: number): SinonFakeTimers; + setTimeout(callback: (...args: any[]) => void, timeout: number, ...args: any[]): number; + clearTimeout(id: number): void; + setInterval(callback: (...args: any[]) => void, timeout: number, ...args: any[]): number; + clearInterval(id: number): void; + tick(ms: number): number; + reset(): void; + Date(): Date; + Date(year: number): Date; + Date(year: number, month: number): Date; + Date(year: number, month: number, day: number): Date; + Date(year: number, month: number, day: number, hour: number): Date; + Date(year: number, month: number, day: number, hour: number, minute: number): Date; + Date(year: number, month: number, day: number, hour: number, minute: number, second: number): Date; + Date(year: number, month: number, day: number, hour: number, minute: number, second: number, ms: number): Date; + restore(): void; + } + + interface SinonFakeTimersStatic { + (): SinonFakeTimers; + (...timers: string[]): SinonFakeTimers; + (now: number, ...timers: string[]): SinonFakeTimers; + } + + interface SinonStatic { + useFakeTimers: SinonFakeTimersStatic; + clock: SinonFakeTimers; + } + + interface SinonFakeUploadProgress { + eventListeners: { + progress: any[]; + load: any[]; + abort: any[]; + error: any[]; + }; + + addEventListener(event: string, listener: (e: Event) => any): void; + removeEventListener(event: string, listener: (e: Event) => any): void; + dispatchEvent(event: Event): void; + } + + interface SinonFakeXMLHttpRequest { + // Properties + onCreate: (xhr: SinonFakeXMLHttpRequest) => void; + url: string; + method: string; + requestHeaders: any; + requestBody: string; + status: number; + statusText: string; + async: boolean; + username: string; + password: string; + withCredentials: boolean; + upload: SinonFakeUploadProgress; + responseXML: Document; + getResponseHeader(header: string): string; + getAllResponseHeaders(): any; + + // Methods + restore(): void; + useFilters: boolean; + addFilter(filter: (method: string, url: string, async: boolean, username: string, password: string) => boolean): void; + setResponseHeaders(headers: any): void; + setResponseBody(body: string): void; + respond(status: number, headers: any, body: string): void; + autoRespond(ms: number): void; + } + + interface SinonFakeXMLHttpRequestStatic { + (): SinonFakeXMLHttpRequest; + } + + interface SinonStatic { + useFakeXMLHttpRequest: SinonFakeXMLHttpRequestStatic; + FakeXMLHttpRequest: SinonFakeXMLHttpRequest; + } + + interface SinonFakeServer { + // Properties + autoRespond: boolean; + autoRespondAfter: number; + fakeHTTPMethods: boolean; + getHTTPMethod: (request: SinonFakeXMLHttpRequest) => string; + requests: SinonFakeXMLHttpRequest[]; + + // Methods + respondWith(body: string): void; + respondWith(response: any[]): void; + respondWith(fn: (xhr: SinonFakeXMLHttpRequest) => void): void; + respondWith(url: string, body: string): void; + respondWith(url: string, response: any[]): void; + respondWith(url: string, fn: (xhr: SinonFakeXMLHttpRequest) => void): void; + respondWith(method: string, url: string, body: string): void; + respondWith(method: string, url: string, response: any[]): void; + respondWith(method: string, url: string, fn: (xhr: SinonFakeXMLHttpRequest) => void): void; + respondWith(url: RegExp, body: string): void; + respondWith(url: RegExp, response: any[]): void; + respondWith(url: RegExp, fn: (xhr: SinonFakeXMLHttpRequest) => void): void; + respondWith(method: string, url: RegExp, body: string): void; + respondWith(method: string, url: RegExp, response: any[]): void; + respondWith(method: string, url: RegExp, fn: (xhr: SinonFakeXMLHttpRequest) => void): void; + respond(): void; + restore(): void; + } + + interface SinonFakeServerStatic { + create(): SinonFakeServer; + } + + interface SinonStatic { + fakeServer: SinonFakeServerStatic; + fakeServerWithClock: SinonFakeServerStatic; + } + + interface SinonExposeOptions { + prefix?: string; + includeFail?: boolean; + } + + interface SinonAssert { + // Properties + failException: string; + fail: (message?: string) => void; // Overridable + pass: (assertion: any) => void; // Overridable + + // Methods + notCalled(spy: SinonSpy): void; + called(spy: SinonSpy): void; + calledOnce(spy: SinonSpy): void; + calledTwice(spy: SinonSpy): void; + calledThrice(spy: SinonSpy): void; + callCount(spy: SinonSpy, count: number): void; + callOrder(...spies: SinonSpy[]): void; + calledOn(spy: SinonSpy, obj: any): void; + alwaysCalledOn(spy: SinonSpy, obj: any): void; + calledWith(spy: SinonSpy, ...args: any[]): void; + alwaysCalledWith(spy: SinonSpy, ...args: any[]): void; + neverCalledWith(spy: SinonSpy, ...args: any[]): void; + calledWithExactly(spy: SinonSpy, ...args: any[]): void; + alwaysCalledWithExactly(spy: SinonSpy, ...args: any[]): void; + calledWithMatch(spy: SinonSpy, ...args: any[]): void; + alwaysCalledWithMatch(spy: SinonSpy, ...args: any[]): void; + neverCalledWithMatch(spy: SinonSpy, ...args: any[]): void; + threw(spy: SinonSpy): void; + threw(spy: SinonSpy, exception: string): void; + threw(spy: SinonSpy, exception: any): void; + alwaysThrew(spy: SinonSpy): void; + alwaysThrew(spy: SinonSpy, exception: string): void; + alwaysThrew(spy: SinonSpy, exception: any): void; + expose(obj: any, options?: SinonExposeOptions): void; + } + + interface SinonStatic { + assert: SinonAssert; + } + + interface SinonMatcher { + and(expr: SinonMatcher): SinonMatcher; + or(expr: SinonMatcher): SinonMatcher; + } + + interface SinonMatch { + (value: number): SinonMatcher; + (value: string): SinonMatcher; + (expr: RegExp): SinonMatcher; + (obj: any): SinonMatcher; + (callback: (value: any) => boolean): SinonMatcher; + any: SinonMatcher; + defined: SinonMatcher; + truthy: SinonMatcher; + falsy: SinonMatcher; + bool: SinonMatcher; + number: SinonMatcher; + string: SinonMatcher; + object: SinonMatcher; + func: SinonMatcher; + array: SinonMatcher; + regexp: SinonMatcher; + date: SinonMatcher; + same(obj: any): SinonMatcher; + typeOf(type: string): SinonMatcher; + instanceOf(type: any): SinonMatcher; + has(property: string, expect?: any): SinonMatcher; + hasOwn(property: string, expect?: any): SinonMatcher; + } + + interface SinonStatic { + match: SinonMatch; + } + + interface SinonSandboxConfig { + injectInto?: any; + properties?: string[]; + useFakeTimers?: any; + useFakeServer?: any; + } + + interface SinonSandbox { + clock: SinonFakeTimers; + requests: SinonFakeXMLHttpRequest; + server: SinonFakeServer; + spy: SinonSpyStatic; + stub: SinonStubStatic; + mock: SinonMockStatic; + useFakeTimers: SinonFakeTimersStatic; + useFakeXMLHttpRequest: SinonFakeXMLHttpRequestStatic; + useFakeServer(): SinonFakeServer; + restore(): void; + } + + interface SinonSandboxStatic { + create(): SinonSandbox; + create(config: SinonSandboxConfig): SinonSandbox; + } + + interface SinonStatic { + sandbox: SinonSandboxStatic; + } + + interface SinonTestConfig { + injectIntoThis?: boolean; + injectInto?: any; + properties?: string[]; + useFakeTimers?: boolean; + useFakeServer?: boolean; + } + + interface SinonTestWrapper extends SinonSandbox { + (...args: any[]): any; + } + + interface SinonStatic { + config: SinonTestConfig; + test(fn: (...args: any[]) => any): SinonTestWrapper; + testCase(tests: any): any; + } + + // Utility overridables + interface SinonStatic { + createStubInstance(constructor: any): SinonStub; + format(obj: any): string; + log(message: string): void; + restore(object: any): void; + } } -interface SinonSpyCall extends SinonSpyCallApi { - calledBefore(call: SinonSpyCall): boolean; - calledAfter(call: SinonSpyCall): boolean; - calledWithNew(call: SinonSpyCall): boolean; -} - -interface SinonSpy extends SinonSpyCallApi { - // Properties - callCount: number; - called: boolean; - notCalled: boolean; - calledOnce: boolean; - calledTwice: boolean; - calledThrice: boolean; - firstCall: SinonSpyCall; - secondCall: SinonSpyCall; - thirdCall: SinonSpyCall; - lastCall: SinonSpyCall; - thisValues: any[]; - args: any[][]; - exceptions: any[]; - returnValues: any[]; - - // Methods - (...args: any[]): any; - calledBefore(anotherSpy: SinonSpy): boolean; - calledAfter(anotherSpy: SinonSpy): boolean; - calledWithNew(spy: SinonSpy): boolean; - withArgs(...args: any[]): SinonSpy; - alwaysCalledOn(obj: any): boolean; - alwaysCalledWith(...args: any[]): boolean; - alwaysCalledWithExactly(...args: any[]): boolean; - alwaysCalledWithMatch(...args: SinonMatcher[]): boolean; - neverCalledWith(...args: any[]): boolean; - neverCalledWithMatch(...args: SinonMatcher[]): boolean; - alwaysThrew(): boolean; - alwaysThrew(type: string): boolean; - alwaysThrew(obj: any): boolean; - alwaysReturned(): boolean; - invokeCallback(...args: any[]): void; - getCall(n: number): SinonSpyCall; - reset(): void; - printf(format: string, ...args: any[]): string; - restore(): void; -} - -interface SinonSpyStatic { - (): SinonSpy; - (func: any): SinonSpy; - (obj: any, method: string): SinonSpy; -} - -interface SinonStatic { - spy: SinonSpyStatic; -} - -interface SinonStub extends SinonSpy { - resetBehavior(): void; - returns(obj: any): SinonStub; - returnsArg(index: number): SinonStub; - throws(type?: string): SinonStub; - throws(obj: any): SinonStub; - callsArg(index: number): SinonStub; - callsArgOn(index: number, context: any): SinonStub; - callsArgWith(index: number, ...args: any[]): SinonStub; - callsArgOnWith(index: number, context: any, ...args: any[]): SinonStub; - callsArgAsync(index: number): SinonStub; - callsArgOnAsync(index: number, context: any): SinonStub; - callsArgWithAsync(index: number, ...args: any[]): SinonStub; - callsArgOnWithAsync(index: number, context: any, ...args: any[]): SinonStub; - onCall(n: number): SinonStub; - onFirstCall(): SinonStub; - onSecondCall(): SinonStub; - onThirdCall(): SinonStub; - yields(...args: any[]): SinonStub; - yieldsOn(context: any, ...args: any[]): SinonStub; - yieldsTo(property: string, ...args: any[]): SinonStub; - yieldsToOn(property: string, context: any, ...args: any[]): SinonStub; - yieldsAsync(...args: any[]): SinonStub; - yieldsOnAsync(context: any, ...args: any[]): SinonStub; - yieldsToAsync(property: string, ...args: any[]): SinonStub; - yieldsToOnAsync(property: string, context: any, ...args: any[]): SinonStub; - withArgs(...args: any[]): SinonStub; -} - -interface SinonStubStatic { - (): SinonStub; - (obj: any): SinonStub; - (obj: any, method: string): SinonStub; - (obj: any, method: string, func: any): SinonStub; -} - -interface SinonStatic { - stub: SinonStubStatic; -} - -interface SinonExpectation extends SinonStub { - atLeast(n: number): SinonExpectation; - atMost(n: number): SinonExpectation; - never(): SinonExpectation; - once(): SinonExpectation; - twice(): SinonExpectation; - thrice(): SinonExpectation; - exactly(n: number): SinonExpectation; - withArgs(...args: any[]): SinonExpectation; - withExactArgs(...args: any[]): SinonExpectation; - on(obj: any): SinonExpectation; - verify(): SinonExpectation; - restore(): void; -} - -interface SinonExpectationStatic { - create(methodName?: string): SinonExpectation; -} - -interface SinonMock { - expects(method: string): SinonExpectation; - restore(): void; - verify(): void; -} - -interface SinonMockStatic { - (): SinonExpectation; - (obj: any): SinonMock; -} - -interface SinonStatic { - expectation: SinonExpectationStatic; - mock: SinonMockStatic; -} - -interface SinonFakeTimers { - now: number; - create(now: number): SinonFakeTimers; - setTimeout(callback: (...args: any[]) => void , timeout: number, ...args: any[]): number; - clearTimeout(id: number): void; - setInterval(callback: (...args: any[]) => void , timeout: number, ...args: any[]): number; - clearInterval(id: number): void; - tick(ms: number): number; - reset(): void; - Date(): Date; - Date(year: number): Date; - Date(year: number, month: number): Date; - Date(year: number, month: number, day: number): Date; - Date(year: number, month: number, day: number, hour: number): Date; - Date(year: number, month: number, day: number, hour: number, minute: number): Date; - Date(year: number, month: number, day: number, hour: number, minute: number, second: number): Date; - Date(year: number, month: number, day: number, hour: number, minute: number, second: number, ms: number): Date; - restore(): void; -} - -interface SinonFakeTimersStatic { - (): SinonFakeTimers; - (...timers: string[]): SinonFakeTimers; - (now: number, ...timers: string[]): SinonFakeTimers; -} - -interface SinonStatic { - useFakeTimers: SinonFakeTimersStatic; - clock: SinonFakeTimers; -} - -interface SinonFakeUploadProgress { - eventListeners: { - progress: any[]; - load: any[]; - abort: any[]; - error: any[]; - }; - - addEventListener(event: string, listener: (e: Event) => any): void; - removeEventListener(event: string, listener: (e: Event) => any): void; - dispatchEvent(event: Event): void; -} - -interface SinonFakeXMLHttpRequest { - // Properties - onCreate: (xhr: SinonFakeXMLHttpRequest) => void; - url: string; - method: string; - requestHeaders: any; - requestBody: string; - status: number; - statusText: string; - async: boolean; - username: string; - password: string; - withCredentials: boolean; - upload: SinonFakeUploadProgress; - responseXML: Document; - getResponseHeader(header: string): string; - getAllResponseHeaders(): any; - - // Methods - restore(): void; - useFilters: boolean; - addFilter(filter: (method: string, url: string, async: boolean, username: string, password: string) => boolean): void; - setResponseHeaders(headers: any): void; - setResponseBody(body: string): void; - respond(status: number, headers: any, body: string): void; - autoRespond(ms: number): void; -} - -interface SinonFakeXMLHttpRequestStatic { - (): SinonFakeXMLHttpRequest; -} - -interface SinonStatic { - useFakeXMLHttpRequest: SinonFakeXMLHttpRequestStatic; - FakeXMLHttpRequest: SinonFakeXMLHttpRequest; -} - -interface SinonFakeServer { - // Properties - autoRespond: boolean; - autoRespondAfter: number; - fakeHTTPMethods: boolean; - getHTTPMethod: (request: SinonFakeXMLHttpRequest) => string; - requests: SinonFakeXMLHttpRequest[]; - - // Methods - respondWith(body: string): void; - respondWith(response: any[]): void; - respondWith(fn: (xhr: SinonFakeXMLHttpRequest) => void ): void; - respondWith(url: string, body: string): void; - respondWith(url: string, response: any[]): void; - respondWith(url: string, fn: (xhr: SinonFakeXMLHttpRequest) => void ): void; - respondWith(method: string, url: string, body: string): void; - respondWith(method: string, url: string, response: any[]): void; - respondWith(method: string, url: string, fn: (xhr: SinonFakeXMLHttpRequest) => void ): void; - respondWith(url: RegExp, body: string): void; - respondWith(url: RegExp, response: any[]): void; - respondWith(url: RegExp, fn: (xhr: SinonFakeXMLHttpRequest) => void ): void; - respondWith(method: string, url: RegExp, body: string): void; - respondWith(method: string, url: RegExp, response: any[]): void; - respondWith(method: string, url: RegExp, fn: (xhr: SinonFakeXMLHttpRequest) => void ): void; - respond(): void; - restore(): void; -} - -interface SinonFakeServerStatic { - create(): SinonFakeServer; -} - -interface SinonStatic { - fakeServer: SinonFakeServerStatic; - fakeServerWithClock: SinonFakeServerStatic; -} - -interface SinonExposeOptions { - prefix?: string; - includeFail?: boolean; -} - -interface SinonAssert { - // Properties - failException: string; - fail: (message?: string) => void; // Overridable - pass: (assertion: any) => void; // Overridable - - // Methods - notCalled(spy: SinonSpy): void; - called(spy: SinonSpy): void; - calledOnce(spy: SinonSpy): void; - calledTwice(spy: SinonSpy): void; - calledThrice(spy: SinonSpy): void; - callCount(spy: SinonSpy, count: number): void; - callOrder(...spies: SinonSpy[]): void; - calledOn(spy: SinonSpy, obj: any): void; - alwaysCalledOn(spy: SinonSpy, obj: any): void; - calledWith(spy: SinonSpy, ...args: any[]): void; - alwaysCalledWith(spy: SinonSpy, ...args: any[]): void; - neverCalledWith(spy: SinonSpy, ...args: any[]): void; - calledWithExactly(spy: SinonSpy, ...args: any[]): void; - alwaysCalledWithExactly(spy: SinonSpy, ...args: any[]): void; - calledWithMatch(spy: SinonSpy, ...args: SinonMatcher[]): void; - alwaysCalledWithMatch(spy: SinonSpy, ...args: SinonMatcher[]): void; - neverCalledWithMatch(spy: SinonSpy, ...args: SinonMatcher[]): void; - threw(spy: SinonSpy): void; - threw(spy: SinonSpy, exception: string): void; - threw(spy: SinonSpy, exception: any): void; - alwaysThrew(spy: SinonSpy): void; - alwaysThrew(spy: SinonSpy, exception: string): void; - alwaysThrew(spy: SinonSpy, exception: any): void; - expose(obj: any, options?: SinonExposeOptions): void; -} - -interface SinonStatic { - assert: SinonAssert; -} - -interface SinonMatcher { - and(expr: SinonMatcher): SinonMatcher; - or(expr: SinonMatcher): SinonMatcher; -} - -interface SinonMatch { - (value: number): SinonMatcher; - (value: string): SinonMatcher; - (expr: RegExp): SinonMatcher; - (obj: any): SinonMatcher; - (callback: (value: any) => boolean): SinonMatcher; - any: SinonMatcher; - defined: SinonMatcher; - truthy: SinonMatcher; - falsy: SinonMatcher; - bool: SinonMatcher; - number: SinonMatcher; - string: SinonMatcher; - object: SinonMatcher; - func: SinonMatcher; - array: SinonMatcher; - regexp: SinonMatcher; - date: SinonMatcher; - same(obj: any): SinonMatcher; - typeOf(type: string): SinonMatcher; - instanceOf(type: any): SinonMatcher; - has(property: string, expect?: any): SinonMatcher; - hasOwn(property: string, expect?: any): SinonMatcher; -} - -interface SinonStatic { - match: SinonMatch; -} - -interface SinonSandboxConfig { - injectInto?: any; - properties?: string[]; - useFakeTimers?: any; - useFakeServer?: any; -} - -interface SinonSandbox { - clock: SinonFakeTimers; - requests: SinonFakeXMLHttpRequest; - server: SinonFakeServer; - spy: SinonSpyStatic; - stub: SinonStubStatic; - mock: SinonMockStatic; - useFakeTimers: SinonFakeTimersStatic; - useFakeXMLHttpRequest: SinonFakeXMLHttpRequestStatic; - useFakeServer(): SinonFakeServer; - restore(): void; -} - -interface SinonSandboxStatic { - create(): SinonSandbox; - create(config: SinonSandboxConfig): SinonSandbox; -} - -interface SinonStatic { - sandbox: SinonSandboxStatic; -} - -interface SinonTestConfig { - injectIntoThis?: boolean; - injectInto?: any; - properties?: string[]; - useFakeTimers?: boolean; - useFakeServer?: boolean; -} - -interface SinonTestWrapper extends SinonSandbox { - (...args: any[]): any; -} - -interface SinonStatic { - config: SinonTestConfig; - test(fn: (...args: any[]) => any): SinonTestWrapper; - testCase(tests: any): any; -} - -// Utility overridables -interface SinonStatic { - createStubInstance: (constructor: any) => SinonStub; - format: (obj: any) => string; - log: (message: string) => void; - restore(object: any): void; -} - -declare var sinon: SinonStatic; +declare var sinon: Sinon.SinonStatic; declare module "sinon" { export = sinon; diff --git a/socket.io/socket.io.d.ts b/socket.io/socket.io.d.ts index 258b573d5..ac5381f09 100644 --- a/socket.io/socket.io.d.ts +++ b/socket.io/socket.io.d.ts @@ -46,6 +46,7 @@ declare module SocketIO { name: string; connected: { [id: string]: Socket }; use(fn: Function): Namespace; + in(room: string): Namespace; on(event: 'connection', listener: (socket: Socket) => void): Namespace; on(event: 'connect', listener: (socket: Socket) => void): Namespace; @@ -58,6 +59,17 @@ declare module SocketIO { conn: any; request: any; id: string; + handshake: { + headers: any; + time: string; + address: any; + xdomain: boolean; + secure: boolean; + issued: number; + url: string; + query: any; + }; + emit(name: string, ...args: any[]): Socket; join(name: string, fn?: Function): Socket; leave(name: string, fn?: Function): Socket; diff --git a/source-map-support/source-map-support.d.ts b/source-map-support/source-map-support.d.ts index b0de346a7..31a642042 100644 --- a/source-map-support/source-map-support.d.ts +++ b/source-map-support/source-map-support.d.ts @@ -1,15 +1,17 @@ -// Type definitions for source-map-support 0.2.6 +// Type definitions for source-map-support 0.2.10 // Project: https://github.com/evanw/source-map-support // Definitions by: Bart van der Schoor // Definitions: https://github.com/borisyankov/DefinitelyTyped +/// + declare module 'source-map-support' { /** * Output of retrieveSourceMap(). */ export interface UrlAndMap { url: string; - map: any; // string or Buffer + map: string|Buffer; } /** diff --git a/sprintf-js/sprintf-js.d.ts b/sprintf-js/sprintf-js.d.ts new file mode 100644 index 000000000..fba1925b6 --- /dev/null +++ b/sprintf-js/sprintf-js.d.ts @@ -0,0 +1,71 @@ +// Type definitions for sprintf-js +// Project: https://www.npmjs.com/package/sprintf-js +// Definitions by: Jason Swearingen +// Definitions: https://github.com/borisyankov/DefinitelyTyped + + +/** sprintf.js is a complete open source JavaScript sprintf implementation for the browser and node.js. + +Its prototype is simple: + +string sprintf(string format , [mixed arg1 [, mixed arg2 [ ,...]]]) +*/ +declare module "sprintf-js" { + /** sprintf.js is a complete open source JavaScript sprintf implementation for the browser and node.js. +Its prototype is simple: + string sprintf(string format , [mixed arg1 [, mixed arg2 [ ,...]]]) + +==Placeholders== + The placeholders in the format string are marked by % and are followed by one or more of these elements. see "fmt" arg for more docs on placeholders. + +==Argument swapping== +You can also swap the arguments. That is, the order of the placeholders doesn't have to match the order of the arguments. You can do that by simply indicating in the format string which arguments the placeholders refer to: + sprintf("%2$s %3$s a %1$s", "cracker", "Polly", "wants") + And, of course, you can repeat the placeholders without having to increase the number of arguments. + +==Named arguments== +Format strings may contain replacement fields rather than positional placeholders. Instead of referring to a certain argument, you can now refer to a certain key within an object. Replacement fields are surrounded by rounded parentheses - ( and ) - and begin with a keyword that refers to a key: + var user = {name: "Dolly"} + sprintf("Hello %(name)s", user) // Hello Dolly +Keywords in replacement fields can be optionally followed by any number of keywords or indexes: + var users = [{name: "Dolly"},{name: "Molly"},{name: "Polly"}] + sprintf("Hello %(users[0].name)s, %(users[1].name)s and %(users[2].name)s", {users: users}) // Hello Dolly, Molly and Polly +Note: mixing positional and named placeholders is not (yet) supported + +==Computed values== +You can pass in a function as a dynamic value and it will be invoked (with no arguments) in order to compute the value on-the-fly. + sprintf("Current timestamp: %d", Date.now) // Current timestamp: 1398005382890 + sprintf("Current date and time: %s", function() { return new Date().toString() }) + */ + export function sprintf( + /** The placeholders in the format string are marked by % and are followed by one or more of these elements, in this order: + +An optional number followed by a $ sign that selects which argument index to use for the value. If not specified, arguments will be placed in the same order as the placeholders in the input string. +An optional + sign that forces to preceed the result with a plus or minus sign on numeric values. By default, only the - sign is used on negative numbers. +An optional padding specifier that says what character to use for padding (if specified). Possible values are 0 or any other character precedeed by a ' (single quote). The default is to pad with spaces. +An optional - sign, that causes sprintf to left-align the result of this placeholder. The default is to right-align the result. +An optional number, that says how many characters the result should have. If the value to be returned is shorter than this number, the result will be padded. +An optional precision modifier, consisting of a . (dot) followed by a number, that says how many digits should be displayed for floating point numbers. When used on a string, it causes the result to be truncated. +A type specifier that can be any of: +% - yields a literal % character +b - yields an integer as a binary number +c - yields an integer as the character with that ASCII value +d or i - yields an integer as a signed decimal number +e - yields a float using scientific notation +u - yields an integer as an unsigned decimal number +f - yields a float as is +o - yields an integer as an octal number +s - yields a string as is +x - yields an integer as a hexadecimal number (lower-case) +X - yields an integer as a hexadecimal number (upper-case) + */ + fmt: string, + /** */ + ...args: any[] + ): string; + /** vsprintf is the same as sprintf except that it accepts an array of arguments, rather than a variable number of arguments: + + vsprintf("The first 4 letters of the english alphabet are: %s, %s, %s and %s", ["a", "b", "c", "d"]) +*/ + export function vsprintf(fmt: string, args: any[]): string; +} diff --git a/sprintf-js/sprintf-tests.ts b/sprintf-js/sprintf-tests.ts new file mode 100644 index 000000000..ba48ccab7 --- /dev/null +++ b/sprintf-js/sprintf-tests.ts @@ -0,0 +1,14 @@ +/// + +import sprintf = require('sprintf-js'); + +var str: string; +var num: number; + +sprintf.sprintf(str, str); +sprintf.sprintf(str, str, num); +sprintf.sprintf(str, num, str); + +sprintf.vsprintf(str, [str]); +sprintf.vsprintf(str, [str, num]); +sprintf.vsprintf(str, [num, str]); diff --git a/squirejs/squirejs.d.ts b/squirejs/squirejs.d.ts index 693ca7d90..a6ee7ec20 100644 --- a/squirejs/squirejs.d.ts +++ b/squirejs/squirejs.d.ts @@ -9,7 +9,7 @@ declare module 'Squire' { constructor(context: string); mock(name: string, mock: any): Squire; mock(mocks: {[name: string]: any}): Squire; - require(dependencies: string[], callback: Function, errback: Function): Squire; + require(dependencies: string[], callback: Function, errback?: Function): Squire; store(name: string | string[]): Squire; clean(): Squire; clean(name: string | string[]): Squire; diff --git a/stack-trace/stack-trace-tests.ts b/stack-trace/stack-trace-tests.ts new file mode 100644 index 000000000..a0b2f8d55 --- /dev/null +++ b/stack-trace/stack-trace-tests.ts @@ -0,0 +1,8 @@ +import stackTrace = require('stack-trace'); + +var currentStackTrace = stackTrace.get(); + +var err = new Error('something went wrong'); +var trace = stackTrace.parse(err); + +var fileName = trace[0].getFileName(); diff --git a/stack-trace/stack-trace.d.ts b/stack-trace/stack-trace.d.ts new file mode 100644 index 000000000..21c12f8f2 --- /dev/null +++ b/stack-trace/stack-trace.d.ts @@ -0,0 +1,20 @@ +// Type definitions for node-stack-trace +// Project: https://github.com/felixge/node-stack-trace +// Definitions by: Exceptionless +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module 'stack-trace' { + export interface StackFrame { + getTypeName():string; + getFunctionName():string; + getMethodName():string; + getFileName():string; + getTypeName():string; + getLineNumber():number; + getColumnNumber():number; + isNative():boolean; + } + + export function get(belowFn?:() => void): StackFrame[]; + export function parse(err:Error): StackFrame[]; +} diff --git a/stacktrace-js/stacktrace-js-tests.ts b/stacktrace-js/stacktrace-js-tests.ts new file mode 100644 index 000000000..c4c9bcf87 --- /dev/null +++ b/stacktrace-js/stacktrace-js-tests.ts @@ -0,0 +1,24 @@ +/// + +function interestingFn() { + return 'https://github.com/exceptionless/Exceptionless'; +} + +var callback = function(stackframes:StackTrace.StackFrame[]) { + var stringifiedStack = stackframes.map(function(sf:StackTrace.StackFrame) { + return sf.toString(); + }).join('\n'); + console.log(stringifiedStack); +}; + +var errorCallback = function(err:Error) { console.log(err.message); }; + +StackTrace.get(); + +// Somewhere else... +var error = new Error('BOOM!'); +StackTrace.fromError(error); +StackTrace.generateArtificially(); + +StackTrace.instrument(interestingFn, callback, errorCallback); +StackTrace.deinstrument(interestingFn); diff --git a/stacktrace-js/stacktrace-js.d.ts b/stacktrace-js/stacktrace-js.d.ts new file mode 100644 index 000000000..9f7ce5ea2 --- /dev/null +++ b/stacktrace-js/stacktrace-js.d.ts @@ -0,0 +1,66 @@ +// Type definitions for stacktrace.js +// Project: https://github.com/stacktracejs/stacktrace.js +// Definitions by: Exceptionless +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module StackTrace { + export interface StackTraceOptions { + filter?: (stackFrame:StackFrame) => boolean; + sourceCache?: { URL:string }; + offline?: boolean; + } + + export interface StackFrame { + constructor(functionName:string, args:any, fileName:string, lineNumber:number, columnNumber:number): StackFrame; + + functionName?:string; + args?:any; + fileName?:string; + lineNumber?:number; + columnNumber?:number; + toString():string; + } + + /** + * Get a backtrace from invocation point. + * @param options Options Object + * @return Array[StackFrame] + */ + export function get(options?: StackTraceOptions): Promise; + + /** + * Given an error object, parse it. + * @param error Error object + * @param options Object for options + * @return Array[StackFrame] + */ + export function fromError(error:Error, options?:StackTraceOptions): Promise; + + /** + * Use StackGenerator to generate a backtrace. + * @param options Object options + * @returns Array[StackFrame] + */ + export function generateArtificially(options?: StackTraceOptions): Promise; + + /** + * Given a function, wrap it such that invocations trigger a callback that + * is called with a stack trace. + * + * @param {Function} fn to be instrumented + * @param {Function} callback function to call with a stack trace on invocation + * @param {Function} errorCallback optional function to call with error if unable to get stack trace. + * @param {Object} thisArg optional context object (e.g. window) + */ + export function instrument(fn:() => void, callback:(stackFrames:StackFrame[]) => void, errorCallback:(error:Error) => void, thisArg?:any): void; + + /** + * Given a function that has been instrumented, + * revert the function to it's original (non-instrumented) state. + * + * @param fn {Function} + */ + export function deinstrument(fn:() => void): void; +} diff --git a/stripe-checkout/stripe-checkout-tests.ts b/stripe-checkout/stripe-checkout-tests.ts new file mode 100644 index 000000000..c054b2365 --- /dev/null +++ b/stripe-checkout/stripe-checkout-tests.ts @@ -0,0 +1,38 @@ +/// + +// Test the minimum amount of configuration required. +var handler = StripeCheckout.configure({ + key: "my-secret-key", + token: function(token: StripeTokenResponse) { + console.log(token.id); + } +}); + +handler.open(); + +handler.close(); + +// Test all configuration options. +var options = { + key: "my-secret-key", + token: function(token: StripeTokenResponse) { + console.log(token.id); + }, + image: "http://placehold.it/128x128", + name: "Definitely Typed", + description: "A DefinitelyTyped test for Stripe Checkout", + amount: Number.MAX_VALUE, + currency: "USD", + panelLabel: "Pay Definitely Typed {{amount}}", + label: "Pay Definitely Typed", + zipCode: false, + email: "test@example.com", + allowRememberMe: false, + bitcoin: false, + opened: function() {}, + closed: function() {} +} + +handler = StripeCheckout.configure(options); + +handler.open(options); \ No newline at end of file diff --git a/stripe-checkout/stripe-checkout.d.ts b/stripe-checkout/stripe-checkout.d.ts new file mode 100644 index 000000000..f648a1bb3 --- /dev/null +++ b/stripe-checkout/stripe-checkout.d.ts @@ -0,0 +1,35 @@ +// Type definitions for Stripe Checkout +// Project: https://stripe.com/checkout +// Definitions by: Chris Wrench +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +interface StripeCheckoutStatic { + configure(options: StripeCheckoutOptions): StripeCheckoutHandler; +} + +interface StripeCheckoutHandler { + open(options?: StripeCheckoutOptions): void; + close(): void; +} + +interface StripeCheckoutOptions { + key: string; + token: (token: StripeTokenResponse) => void; + image?: string; + name?: string; + description?: string; + amount?: number; + currency?: string; + panelLabel?: string; + zipCode?: boolean; + email?: string; + label?: string; + allowRememberMe?: boolean; + bitcoin?: boolean; + opened?: () => void; + closed?: () => void; +} + +declare var StripeCheckout: StripeCheckoutStatic; \ No newline at end of file diff --git a/stripe/stripe-node-tests.ts b/stripe/stripe-node-tests.ts new file mode 100644 index 000000000..3217b78fb --- /dev/null +++ b/stripe/stripe-node-tests.ts @@ -0,0 +1,310 @@ +/// + +import StripeNode = require('stripe'); + +var stripe = new StripeNode("sk_test_BF573NobVn98OiIsPAv7A04K"); + +stripe.setApiVersion('2015-02-18'); +stripe.customers.list({ limit: 3 }, function (err, customers) { + // asynchronously called +}); + +stripe.charges.create({ + amount: 400, + currency: "usd", + source: "tok_15V2YhEe31JkLCeQy9iUgsJX", // obtained with Stripe.js + description: "Charge for test@example.com" +}, function (err, charge) { + // asynchronously called +}); + +stripe.charges.retrieve( + "ch_15fvyXEe31JkLCeQOo0SwFk9", + function (err, charge) { + // asynchronously called + } + ); + +stripe.charges.update( + "ch_15fvyXEe31JkLCeQOo0SwFk9", + { + description: "Charge for test@example.com" + }, + function (err, charge) { + // asynchronously called + } + ); + +stripe.charges.capture("ch_15fvyXEe31JkLCeQOo0SwFk9", function (err, charge) { + // asynchronously called +}); + +stripe.charges.list({ limit: 3 }, function (err, charges) { + // asynchronously called +}); + +stripe.charges.createRefund( + "ch_15fvyXEe31JkLCeQOo0SwFk9", + {}, + function (err, refund) { + // asynchronously called + } + ); + +stripe.charges.retrieveRefund( + "ch_15fvyXEe31JkLCeQOo0SwFk9", + "re_15jzA4Ee31JkLCeQcxbTbjaL", + function (err, refund) { + // asynchronously called + } + ); + +stripe.charges.updateRefund( + "ch_15fvyXEe31JkLCeQOo0SwFk9", + "re_15jzA4Ee31JkLCeQcxbTbjaL", + { metadata: { key: "value" } }, + function (err, refund) { + // asynchronously called + } + ); + +stripe.charges.listRefunds('ch_15fvyXEe31JkLCeQOo0SwFk9', null, function (err, refunds) { + // asynchronously called +}); + +stripe.customers.create({ + description: 'Customer for test@example.com', + source: "tok_15V2YhEe31JkLCeQy9iUgsJX" // obtained with Stripe.js +}, function (err, customer) { + // asynchronously called + }); + +stripe.customers.retrieve( + "cus_5rfJKDJkuxzh5Q", + function (err, customer) { + // asynchronously called + } + ); + +stripe.customers.update("cus_5rfJKDJkuxzh5Q", { + description: "Customer for test@example.com" +}, function (err, customer) { + // asynchronously called + }); + +stripe.customers.del( + "cus_5rfJKDJkuxzh5Q", + function (err, confirmation) { + // asynchronously called + } + ); + +stripe.customers.list({ limit: 3 }, function (err, customers) { + // asynchronously called +}); + +stripe.customers.createCard( + "cus_5rfJKDJkuxzh5Q", + { card: "tok_15V2YhEe31JkLCeQy9iUgsJX" }, + function (err, card) { + // asynchronously called + } + ); + +stripe.customers.retrieveCard( + "cus_5rfJKDJkuxzh5Q", + "card_15fvyXEe31JkLCeQ9KMktP5S", + function (err, card) { + // asynchronously called + } + ); + +stripe.customers.retrieveCard( + "cus_5rfJKDJkuxzh5Q", + "card_15fvyXEe31JkLCeQ9KMktP5S", + function (err, card) { + // asynchronously called + } + ); + +stripe.customers.updateCard( + "cus_5rfJKDJkuxzh5Q", + "card_15fvyXEe31JkLCeQ9KMktP5S", + { name: "Jane Austen" }, + function (err, card) { + // asynchronously called + } + ); + +stripe.customers.updateCard( + "cus_5rfJKDJkuxzh5Q", + "card_15fvyXEe31JkLCeQ9KMktP5S", + { name: "Jane Austen" }, + function (err, card) { + // asynchronously called + } + ); + +stripe.customers.deleteCard( + "cus_5rfJKDJkuxzh5Q", + "card_15fvyXEe31JkLCeQ9KMktP5S", + function (err, confirmation) { + // asynchronously called + } + ); + +stripe.customers.listCards('cu_15fvyVEe31JkLCeQvr155iqc', null, function (err, cards) { + // asynchronously called +}); + +stripe.customers.retrieveSubscription( + "cus_5rfJKDJkuxzh5Q", + "sub_5rfJxnBLGSwsYp", + function (err, subscription) { + // asynchronously called + } + ); + +stripe.customers.updateSubscription( + "cus_5rfJKDJkuxzh5Q", + "sub_5rfJxnBLGSwsYp", + { plan: "platypi-dev" }, + function (err, subscription) { + // asynchronously called + } + ); + +stripe.customers.cancelSubscription( + "cus_5rfJKDJkuxzh5Q", + "sub_5rfJxnBLGSwsYp", + null, + function (err, confirmation) { + // asynchronously called + } + ); + +stripe.customers.listSubscriptions('cu_15fvyVEe31JkLCeQvr155iqc', null, function (err, subscriptions) { + // asynchronously called +}); + +stripe.plans.create({ + amount: 2000, + interval: "month", + name: "Amazing Gold Plan", + currency: "usd", + id: "gold" +}, function (err, plan) { + // asynchronously called + }); + +stripe.plans.retrieve( + "platypi-dev", + function (err, plan) { + // asynchronously called + } + ); + +stripe.plans.update("platypi-dev", { + name: "New plan name" +}, function (err, plan) { + // asynchronously called + }); + +stripe.plans.del( + "platypi-dev", + function (err, confirmation) { + // asynchronously called + } + ); + +stripe.plans.list(null, function (err, plans) { + // asynchronously called +}); + +stripe.coupons.create({ + percent_off: 25, + duration: 'repeating', + duration_in_months: 3, + id: '25OFF' +}, function (err, coupon) { + // asynchronously called + }); + +stripe.coupons.retrieve( + "25OFF", + function (err, coupon) { + // asynchronously called + } + ); + +stripe.coupons.update("25OFF", { + metadata: { key: "value" } +}, function (err, coupon) { + // asynchronously called + }); + +stripe.coupons.del("25OFF", function (err, confirmation) { + +}); + +stripe.coupons.list({ limit: 3 }, function (err, coupons) { + // asynchronously called +}); + +stripe.customers.deleteDiscount("cus_5rfJKDJkuxzh5Q", function (err, confirmation) { + // asynchronously called +}); + +stripe.customers.deleteSubscriptionDiscount("cus_5rfJKDJkuxzh5Q", "sub_5rfJxnBLGSwsYp", function (err, confirmation) { + // asynchronously called +}); + +stripe.invoices.create({ + customer: "cus_5rfJKDJkuxzh5Q" +}, function (err, invoice) { + // asynchronously called + }); + +stripe.invoices.retrieve( + "in_15fvyXEe31JkLCeQH7QbgZZb", + function (err, invoice) { + // asynchronously called + } + ); + +stripe.invoices.retrieveLines( + "in_15fvyXEe31JkLCeQH7QbgZZb", + { limit: 5 }, + function (err, lines) { + // asynchronously called + } + ); + +stripe.invoices.retrieveUpcoming( + "cus_5rfJKDJkuxzh5Q", + null, + function (err, upcoming) { + // asynchronously called + } + ); + +stripe.invoices.update( + "in_15fvyXEe31JkLCeQH7QbgZZb", + { + closed: true + }, + function (err, invoice) { + // asynchronously called + } + ); + +stripe.invoices.pay("in_15fvyXEe31JkLCeQH7QbgZZb", function (err, invoice) { + // asynchronously called +}); + +stripe.invoices.list( + { customer: "cus_5rfJKDJkuxzh5Q", limit: 3 }, + function (err, invoices) { + // asynchronously called + } + ); diff --git a/stripe/stripe-node.d.ts b/stripe/stripe-node.d.ts new file mode 100644 index 000000000..cb5932086 --- /dev/null +++ b/stripe/stripe-node.d.ts @@ -0,0 +1,3107 @@ +// Type definitions for stripe-node +// Project: https://github.com/stripe/stripe-node/ +// Definitions by: William Johnston +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module 'stripe' { + var out: typeof StripeNode.Stripe; + export = out; +} + +declare module StripeNode { + class Stripe { + static DEFAULT_HOST: string; + static DEFAULT_PORT: string; + static DEFAULT_BASE_PATH: string; + static DEFAULT_API_VERSION: string; + static DEFAULT_TIMEOUT: number; + static PACKAGE_VERSION: string; + static USER_AGENT: { + bindings_version: string; + lang: string; + lang_version: string; + platform: string; + publisher: string; + uname: string; + }; + static USER_AGENT_SERIALIZED: string; + + static resources: typeof resources; + static StripeResource: typeof StripeResource; + + account: resources.Account; + balance: resources.Balance; + charges: resources.Charges; + coupons: resources.Coupons; + customers: resources.Customers; + events: resources.Events; + invoices: resources.Invoices; + invoiceItems: resources.InvoiceItems; + plans: resources.Plans; + recipientCards: resources.RecipientCards; + recipients: resources.Recipients; + tokens: resources.Tokens; + yransfers: resources.Transfers; + applicationFees: resources.ApplicationFees; + fileUploads: resources.FileUploads; + bitcoinReceivers: resources.BitcoinReceivers; + customerCards: resources.CustomerCards; + customerSubscriptions: resources.CustomerSubscriptions; + chargeRefunds: resources.ChargeRefunds; + applicationFeeRefunds: resources.ApplicationFeeRefunds; + transferReversals: resources.TransferReversals; + + constructor(apiKey: string, version?: string); + + setHost(host: string): void; + setHost(host: string, port: string|number): void; + setHost(host: string, port: string|number, protocol: string): void; + + setProtocol(protocol: string): void; + setPort(port: string|number): void; + setApiVersion(version?: string): void; + setApiKey(key?: string): void; + setTimeout(timeout?: number): void; + setHttpAgent(agent: string): void; + getConstant(c: string): any; + getClientUserAgent(response: (userAgent: string) => void): void; + } + + module account { } + + module balance { + interface IBalanceTransaction { + id: string; + + /** + * Value is 'balance_transaction' + */ + object: string; + + /** + * Gross amount of the transaction, in cents. + */ + amount: number; + + /** + * The date the transactions net funds will become available in the Stripe balance. + */ + available_on: number; + created: number; + + /** + * Three-letter ISO currency code representing the currency. + */ + currency: string; + + /** + * Fee (in cents) paid for this transaction + */ + fee: number; + + /** + * Detailed breakdown of fees (in cents) paid for this transaction + */ + fee_details: Array<{ + amount: number; + + /** + * Three-letter ISO currency code representing the currency of the amount that was disputed. + */ + currency: string; + + /** + * Type of the fee, one of: application_fee, stripe_fee or tax. + */ + type: string; + application: string; + description: string; + }>; + + /** + * Net amount of the transaction, in cents. + */ + net: number; + + /** + * If the transactions net funds are available in the Stripe balance yet. Either available or pending. + */ + status: string; + + /** + * Type of the transaction, one of: charge, refund, adjustment, application_fee, + * application_fee_refund, transfer, transfer_cancel or transfer_failure. + */ + type: string; + description?: string; + + /** + * The Stripe object this transaction is related to. + */ + source?: IPaymentToken | ICard; + source_transfers: IList; + } + } + + module charges { + + /** + * To charge a credit or a debit card, you create a charge object. You can retrieve and refund individual + * charges as well as list all charges. Charges are identified by a unique random ID. + */ + interface ICharge { + id: string; + + /** + * Value is 'charge' + */ + object: string; + + livemode: boolean; + + /** + * Amount charged in cents, positive integer or zero. + */ + amount: number; + + /** + * If the charge was created without capturing, this boolean represents whether or not it is + * still uncaptured or has since been captured. + */ + captured: boolean; + + created: number; + + /** + * Three-letter ISO currency code representing the currency in which the charge was made. + */ + currency: string; + + paid: boolean; + + /** + * Whether or not the charge has been fully refunded. If the charge is only partially refunded, + * this attribute will still be false. + */ + refunded: boolean; + + /** + * A list of refunds that have been applied to the charge. + */ + refunds: IList; + + /** + * For most Stripe users, the source of every charge is a credit or debit card. + * This hash is then the card object describing that card. + */ + source: ICard; + + /** + * The status of the payment is either succeeded or failed. + */ + status: string; + + /** + * Amount in cents refunded (can be less than the amount attribute on the charge if a partial refund was issued). + */ + amount_refunded: number; + + /** + * ID of the balance transaction that describes the impact of this charge on your account balance (not including refunds or disputes). + */ + balance_transaction: string; + + /** + * ID of the customer this charge is for if one exists. + */ + customer: string; + description?: string; + + /** + * Details about the dispute if the charge has been disputed. + */ + dispute?: IDispute; + + /** + * Error code explaining reason for charge failure if available (see the errors section for a list of + * codes: https://stripe.com/docs/api#errors). + */ + failure_code: string; + + /** + * Message to user further explaining reason for charge failure if available. + */ + failure_message: string; + + /** + * ID of the invoice this charge is for if one exists. + */ + invoice: string; + metadata: IMetadata; + + /** + * This is the email address that the receipt for this charge was sent to. + */ + receipt_email: string; + + /** + * This is the transaction number that appears on email receipts sent for this charge. + */ + receipt_number: string; + application_fee?: string; + + /** + * Hash with information on fraud assessments for the charge. + */ + fraud_details: { + /** + * Assessments reported by you have the key user_report and, if set, possible values of safe and fraudulent. + */ + user_report?: string; + + /** + * Assessments from Stripe have the key stripe_report and, if set, the value fraudulent. + */ + stripe_report?: string; + }; + + /** + * Shipping information for the charge. + */ + shipping?: IShippingInformation; + } + } + + module coupons { + /** + * A discount represents the actual application of a coupon to a particular customer. It contains information + * about when the discount began and when it will end. + */ + interface IDiscount { + /** + * Value is 'discount' + */ + object: string; + + /** + * Hash describing the coupon applied to create this discount + */ + coupon: ICoupon; + customer: string; + + /** + * Date that the coupon was applied + */ + start: number; + + /** + * If the coupon has a duration of once or repeating, the date that this discount will end. If the coupon + * used has a forever duration, this attribute will be null. + */ + end: number; + + /** + * The subscription that this coupon is applied to, if it is applied to a particular subscription + */ + subscription: string; + } + + /** + * A coupon contains information about a percent-off or amount-off discount you might want to apply to a customer. + * Coupons only apply to invoices; they do not apply to one-off charges. + */ + interface ICoupon { + id: string; + + /** + * Value is 'coupon' + */ + object: string; + livemode: boolean; + created: number; + + /** + * One of forever, once, and repeating. Describes how long a customer who applies this coupon will get the discount. + */ + duration: string; + + /** + * Amount (in the currency specified) that will be taken off the subtotal of any invoices for this customer. + */ + amount_off: number; + + /** + * If amount_off has been set, the currency of the amount to take off. + */ + currency: string; + + /** + * If duration is repeating, the number of months the coupon applies. Null if coupon duration is forever or once. + */ + duration_in_months: number; + + /** + * Maximum number of times this coupon can be redeemed, in total, before it is no longer valid. + */ + max_redemptions: number; + + /** + * A set of key/value pairs that you can attach to a coupon object. It can be useful for storing + * additional information about the coupon in a structured format. + */ + metadata: IMetadata; + + /** + * Percent that will be taken off the subtotal of any invoices for this customer for the duration + * of the coupon. For example, a coupon with percent_off of 50 will make a $100 invoice $50 instead. + */ + percent_off: number; + + /** + * Date after which the coupon can no longer be redeemed + */ + redeem_by: number; + + /** + * Number of times this coupon has been applied to a customer. + */ + times_redeemed: number; + + /** + * Taking account of the above properties, whether this coupon can still be applied to a customer + */ + valid: boolean; + } + } + module customers { + /** + * Customer objects allow you to perform recurring charges and track multiple charges that are associated + * with the same customer. The API allows you to create, delete, and update your customers. You can + * retrieve individual customers as well as a list of all your customers. + */ + interface ICustomer { + id: string; + + /** + * Value is 'customer' + */ + object: string; + livemode: boolean; + created: number; + + /** + * Current balance, if any, being stored on the customers account. If negative, the customer has credit to apply to + * the next invoice. If positive, the customer has an amount owed that will be added to the next invoice. The balance + * does not refer to any unpaid invoices; it solely takes into account amounts that have yet to be successfully applied + * to any invoice. This balance is only taken into account for recurring charges. + */ + account_balance?: number; + + /** + * The currency the customer can be charged in for recurring billing purposes (subscriptions, invoices, invoice items). + */ + currency: string; + + /** + * ID of the default source attached to this customer. + */ + default_source: string; + + /** + * Whether or not the latest charge for the customers latest invoice has failed + */ + delinquent: boolean; + + /** + * Describes the current discount active on the customer, if there is one. + */ + discount: coupons.IDiscount; + description?: string; + email?: string; + + /** + * A set of key/value pairs that you can attach to a customer object. It can be useful for storing + * additional information about the customer in a structured format. + */ + metadata?: IMetadata; + + sources?: IList; + + /** + * The customers current subscriptions, if any + */ + subscriptions: IList; + } + } + module events { } + module invoices { + /** + * Invoices are statements of what a customer owes for a particular billing period, including subscriptions, + * invoice items, and any automatic proration adjustments if necessary. Once an invoice is created, payment + * is automatically attempted. Note that the payment, while automatic, does not happen exactly at the time of + * invoice creation. If you have configured webhooks, the invoice will wait until one hour after the last + * webhook is successfully sent (or the last webhook times out after failing). Any customer credit on the + * account is applied before determining how much is due for that invoice (the amount that will be actually + * charged). If the amount due for the invoice is less than 50 cents (the minimum for a charge), we add the + * amount to the customer's running account balance to be added to the next invoice. If this amount is + * negative, it will act as a credit to offset the next invoice. Note that the customer account balance does + * not include unpaid invoices; it only includes balances that need to be taken into account when calculating + * the amount due for the next invoice. + */ + interface IInvoice { + id: string; + + /** + * Value is 'invoice' + */ + object: string; + livemode: boolean; + + /** + * Final amount due at this time for this invoice. If the invoices total is smaller than the minimum charge + * amount, for example, or if there is account credit that can be applied to the invoice, the amount_due may + * be 0. If there is a positive starting_balance for the invoice (the customer owes money), the amount_due + * will also take that into account. The charge that gets generated for the invoice will be for the amount + * specified in amount_due. + */ + amount_due: number; + + /** + * Number of payment attempts made for this invoice, from the perspective of the payment retry schedule. Any + * payment attempt counts as the first attempt, and subsequently only automatic retries increment the attempt + * count. In other words, manual payment attempts after the first attempt do not affect the retry schedule. + */ + attempt_count: number; + + /** + * Whether or not an attempt has been made to pay the invoice. An invoice is not attempted until 1 hour after + * the invoice.created webhook, for example, so you might not want to display that invoice as unpaid to your + * users. + */ + attempted: boolean; + + /** + * Whether or not the invoice is still trying to collect payment. An invoice is closed if its either paid or + * it has been marked closed. A closed invoice will no longer attempt to collect payment. + */ + closed: boolean; + currency: string; + customer: string; + date: number; + + /** + * Whether or not the invoice has been forgiven. Forgiving an invoice instructs us to update the subscription + * status as if the invoice were succcessfully paid. Once an invoice has been forgiven, it cannot be unforgiven + * or reopened + */ + forgiven: boolean; + + /** + * The individual line items that make up the invoice + */ + lines: IList; + + /** + * Whether or not payment was successfully collected for this invoice. An invoice can be paid (most commonly) + * with a charge or with credit from the customers account balance. + */ + paid: boolean; + + /** + * End of the usage period during which invoice items were added to this invoice + */ + period_end: number; + + /** + * Start of the usage period during which invoice items were added to this invoice + */ + period_start: number; + + /** + * Starting customer balance before attempting to pay invoice. If the invoice has not been attempted yet, + * this will be the current customer balance. + */ + starting_balance: number; + + /** + * Total of all subscriptions, invoice items, and prorations on the invoice before any discount is applied + */ + subtotal: number; + + /** + * Total after discount + */ + total: number; + + /** + * The fee in cents that will be applied to the invoice and transferred to the application owners + * Stripe account when the invoice is paid. + */ + application_fee: number; + + /** + * ID of the latest charge generated for this invoice, if any. + */ + charge: string; + description: string; + discount: coupons.IDiscount; + + /** + * Ending customer balance after attempting to pay invoice. If the invoice has not been attempted yet, + * this will be null. + */ + ending_balance: number; + + /** + * The time at which payment will next be attempted. + */ + next_payment_attempt: number; + + /** + * This is the transaction number that appears on email receipts sent for this invoice. + */ + receipt_number: string; + + /** + * Extra information about an invoice for the customers credit card statement. + */ + statement_descriptor: string; + + /** + * The subscription that this invoice was prepared for, if any. + */ + subscription: string; + + /** + * The time at which webhooks for this invoice were successfully delivered (if the invoice had no webhooks to + * deliver, this will match date). Invoice payment is delayed until webhooks are delivered, or until all webhook + * delivery attempts have been exhausted. + */ + webhooks_delivered_at: number; + + /** + * A set of key/value pairs that you can attach to an invoice object. It can be useful for storing additional + * information about the invoice in a structured format. + */ + metadata: IMetadata; + + /** + * The amount of tax included in the total, calculated from tax_percent and the subtotal. If no tax_percent + * is defined, this value will be null. + */ + tax: number; + + /** + * This percentage of the subtotal has been added to the total amount of the invoice, including invoice line + * items and discounts. This field is inherited from the subscriptions tax_percent field, but can be changed + * before the invoice is paid. This field defaults to null. + */ + tax_percent: number; + } + } + module invoiceItems { + interface InvoiceLineItem { + /** + * The ID of the source of this line item, either an invoice item or a subscription + */ + id: string; + + /** + * Value is 'line_item' + */ + object: string; + + /** + * Whether or not this is a test line item + */ + livemode: boolean; + + /** + * The amount, in cents + */ + amount: number; + currency: string; + + /** + * If true, discounts will apply to this line item. Always false for prorations. + */ + discountable: boolean; + + /** + * The period this line_item covers + */ + period: { + /** + * The period start date + */ + start: number; + /** + * The period end date + */ + end: number; + }; + + /** + * Whether or not this is a proration + */ + proration: boolean; + + /** + * A string identifying the type of the source of this line item, either an invoiceitem or a subscription + */ + type: string; + + /** + * A text description of the line item, if the line item is an invoice item + */ + description: string; + + /** + * Key-value pairs attached to the line item, if the line item is an invoice item + */ + metadata: IMetadata; + + /** + * The plan of the subscription, if the line item is a subscription or a proration + */ + plan: plans.IPlan; + + /** + * The quantity of the subscription, if the line item is a subscription or a proration + */ + quantity: number; + + /** + * When type is invoiceitem, the subscription that the invoice item pertains to, if any. Left blank when + * type is already subscription, as itd be redundant with id. + */ + subscription: string; + } + } + module plans { + /** + * A subscription plan contains the pricing information for different products and feature levels on your site. + * For example, you might have a $10/month plan for basic features and a different $20/month plan for premium features. + */ + interface IPlan { + id: string; + + /** + * Value is 'plan' + */ + object: string; + livemode: boolean; + + /** + * The amount in cents to be charged on the interval specified + */ + amount: number; + created: number; + + /** + * Currency in which subscription will be charged + */ + currency: string; + + /** + * One of day, week, month or year. The frequency with which a subscription should be billed. + */ + interval: string; + + /** + * The number of intervals (specified in the interval property) between each subscription billing. For example, + * interval=month and interval_count=3 bills every 3 months. + */ + interval_count: number; + + /** + * Display name of the plan + */ + name: string; + + /** + * A set of key/value pairs that you can attach to a plan object. It can be useful for storing additional information + * about the plan in a structured format. + */ + metadata: IMetadata; + + /** + * Number of trial period days granted when subscribing a customer to this plan. Null if the plan has no trial period. + */ + trial_period_days: number; + + /** + * Extra information about a charge for the customers credit card statement. + */ + statement_descriptor: string; + } + } + module recipientCards { } + module recipients { } + module tokens { } + module transfers { + interface ITransfer { + id: string; + object: string; + livemode: boolean; + + /** + * Amount (in cents) to be transferred to your bank account + */ + amount: number; + + /** + * Time that this record of the transfer was first created. + */ + created: number; + + /** + * Three-letter ISO currency code representing the currency. + */ + currency: string; + + /** + * Date the transfer is scheduled to arrive in the bank. This doesnt factor in delays like weekends or bank holidays. + */ + date: number; + + /** + * A list of reversals that have been applied to the transfer. + */ + reversals: IList; + + /** + * Whether or not the transfer has been fully reversed. If the transfer is only partially reversed, this attribute + * will still be false. + */ + reversed: boolean; + + /** + * Current status of the transfer (paid, pending, canceled or failed). A transfer will be pending until it is submitted, at which + * point it becomes paid. If it does not go through successfully, its status will change to failed or canceled. + */ + status: string; + + /** + * The type of this type of this transfer. Can be card or bank_account. + */ + type: string; + + /** + * Amount in cents reversed (can be less than the amount attribute on the transfer if a partial reversal was issued). + */ + amount_reversed: number; + + /** + * Balance transaction that describes the impact of this transfer on your account balance. + */ + balance_transaction: string; + + /** + * Internal-only description of the transfer + */ + description: string; + + /** + * Error code explaining reason for transfer failure if available. See Types of transfer failures for a + * list of failure codes: https://stripe.com/docs/api#transfer_failures + */ + failure_code: string; + + /** + * Message to user further explaining reason for transfer failure if available. + */ + failure_message: string; + metadata: IMetadata; + application_fee: string; + + /** + * Hash describing the bank account this transfer was sent to + */ + bank_account: IBankAccount; + + /** + * Hash describing the debit card this transfer was sent to + */ + card: ICard; + + /** + * ID of the recipient this transfer is for if one exists. Transfers to your bank account do not have a recipient. + */ + recipient: string; + source_transaction: string; + + /** + * Extra information about a transfer to be displayed on the users bank statement. + */ + statement_descriptor: string; + } + } + module applicationFees { } + module fileUploads { } + module bitcoinReceivers { + /** + * A Bitcoin receiver wraps a Bitcoin address so that a customer can push a payment to you. This guide describes how to use + * receivers to create Bitcoin payments. + */ + interface IBitcoinReceiver { + id: string; + + /** + * Value is 'bitcoin_receiver' + */ + object: string; + livemode: boolean; + + /** + * True when this bitcoin receiver has received a non-zero amount of bitcoin. + */ + active: boolean; + + /** + * The amount of currency that you are collecting as payment. + */ + amount: number; + + /** + * The amount of currency to which bitcoin_amount_received has been converted. + */ + amount_received: number; + + /** + * The amount of bitcoin that the customer should send to fill the receiver. The bitcoin_amount is denominated in Satoshi: + * there are 10^8 Satoshi in one bitcoin. + */ + bitcoin_amount: number; + + /** + * The amount of bitcoin that has been sent by the customer to this receiver. + */ + bitcoin_amount_received: number; + + /** + * This URI can be displayed to the customer as a clickable link (to activate their bitcoin client) or as a QR code (for mobile wallets). + */ + bitcoin_uri: number; + created: number; + + /** + * Three-letter ISO currency code representing the currency to which the bitcoin will be converted. + */ + currency: string; + + /** + * This flag is initially false and updates to true when the customer sends the bitcoin_amount to this receiver. + */ + filled: boolean; + + /** + * A bitcoin address that is specific to this receiver. The customer can send bitcoin to this address to fill the receiver. + */ + inbound_address: string; + + /** + * A list with one entry for each time that the customer sent bitcoin to the receiver. Hidden when viewing the + * receiver with a publishable key. + */ + transactions: IList; + + /** + * This receiver contains uncaptured funds that can be used for a payment or refunded. + */ + uncaptured_funds: boolean; + description: string; + + /** + * The customers email address, set by the API call that creates the receiver. + */ + email: string; + + /** + * A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information + * about the customer in a structured format. + */ + metadata: IMetadata; + + /** + * The ID of the payment created from the receiver, if any. Hidden when viewing the receiver with a publishable key. + */ + payment: string; + + /** + * The refund address for these bitcoin, if communicated by the customer. + */ + refund_address: string; + customer: string; + } + + interface IBitcoinTransaction { + id: string; + + /** + * Value is 'list' + */ + object: string; + + /** + * The amount of currency that the transaction was converted to in real-time. + */ + amount: number; + + /** + * The amount of bitcoin contained in the transaction. + */ + bitcoin_amount: number; + created: number; + + /** + * The currency to which this transaction was converted. + */ + currency: string; + + /** + * The receiver to which this transaction was sent. + */ + receiver: string; + } + } + module customerCards { } + + module customerSubscriptions { + /** + * Subscriptions allow you to charge a customer's card on a recurring basis. A subscription ties a customer to + * a particular plan you've created: https://stripe.com/docs/api#create_plan + */ + interface ISubscription { + id: string; + + /** + * Value is 'subscription' + */ + object: string; + + /** + * If the subscription has been canceled with the at_period_end flag set to true, cancel_at_period_end on the + * subscription will be true. You can use this attribute to determine whether a subscription that has a status + * of active is scheduled to be canceled at the end of the current period. + */ + cancel_at_period_end: boolean; + customer: string; + + /** + * Hash describing the plan the customer is subscribed to + */ + plan: plans.IPlan; + + /** + * The number of subscriptions for the associated plan + */ + quantity: number; + + /** + * Date the subscription started + */ + start: number; + + /** + * Possible values are trialing, active, past_due, canceled, or unpaid. A subscription still in its trial period is trialing + * and moves to active when the trial period is over. When payment to renew the subscription fails, the subscription becomes + * past_due. After Stripe has exhausted all payment retry attempts, the subscription ends up with a status of either canceled + * or unpaid depending on your retry settings. Note that when a subscription has a status of unpaid, no subsequent invoices + * will be attempted (invoices will be created, but then immediately automatically closed. Additionally, updating customer + * card details will not lead to Stripe retrying the latest invoice.). After receiving updated card details from a customer, + * you may choose to reopen and pay their closed invoices. + */ + status: string; + + /** + * A positive decimal that represents the fee percentage of the subscription invoice amount that will be transferred to + * the application owners Stripe account each billing period. + */ + application_fee_percent: number; + + /** + * If the subscription has been canceled, the date of that cancellation. If the subscription was canceled with + * cancel_at_period_end, canceled_at will still reflect the date of the initial cancellation request, not the end of the + * subscription period when the subscription is automatically moved to a canceled state. + */ + canceled_at: number; + + /** + * End of the current period that the subscription has been invoiced for. At the end of this period, a new invoice will be created. + */ + current_period_end: number; + + /** + * Start of the current period that the subscription has been invoiced for + */ + current_period_start: number; + + /** + * Describes the current discount applied to this subscription, if there is one. When billing, a discount applied to a + * subscription overrides a discount applied on a customer-wide basis. + */ + discount: coupons.IDiscount; + + /** + * If the subscription has ended (either because it was canceled or because the customer was switched to a subscription + * to a new plan), the date the subscription ended + */ + ended_at: number; + + /** + * A set of key/value pairs that you can attach to a subscription object. It can be useful for storing additional + * information about the subscription in a structured format. + */ + metadata: IMetadata; + + /** + * If the subscription has a trial, the end of that trial. + */ + trial_end: number; + + /** + * If the subscription has a trial, the beginning of that trial. + */ + trial_start: number; + + /** + * If provided, each invoice created by this subscription will apply the tax rate, increasing the amount billed to the customer. + */ + tax_percent: number; + } + } + + module chargeRefunds { + interface IRefund { + id: string; + + /** + * Value is 'list' + */ + object: string; + + /** + * Amount reversed in cents. + */ + amount: number; + + created: number; + + /** + * Three-letter ISO currency code representing the currency in which the charge was made. + */ + currency: string; + + /** + * Balance transaction that describes the impact of this reversal on your account balance. + */ + balance_transaction: string; + + /** + * ID of the charge that was refunded. + */ + charge: string; + + metadata: IMetadata; + + /** + * Reason for the refund. If set, possible values are duplicate, fraudulent, and requested_by_customer. + */ + reason: string; + + /** + * This is the transaction number that appears on email receipts sent for this refund. + */ + receipt_number: string; + + description: string; + } + } + + module applicationFeeRefunds { } + module transferReversals { } + + class StripeResource { + constructor(stripe: Stripe, urlData: any); + } + + module resources { + class Account extends StripeResource { + create(): void; + list(): void; + update(id: string): void; + retrieve(id: string): void; + } + + class ApplicationFeeRefunds extends StripeResource { + create(): void; + list(): void; + update(id: string): void; + retrieve(id: string): void; + } + + class ApplicationFees extends StripeResource { + list(): void; + retrieve(id: string): void; + } + + class Balance extends StripeResource { + retrieve(id: string): void; + } + + class BitcoinReceivers extends StripeResource { + create(): void; + list(): void; + update(id: string): void; + retrieve(id: string): void; + } + + class ChargeRefunds extends StripeResource { + create(): void; + list(): void; + update(id: string): void; + retrieve(id: string): void; + } + + class Charges extends StripeResource { + /** + * To charge a credit card, you create a charge object. If your API key is in test mode, the supplied card won't actually be charged, though + * everything else will occur as if in live mode. (Stripe assumes that the charge would have completed successfully). + * + * @returns Returns a charge object if the charge succeeded. Throws an error if something goes wrong. A common source of error is an invalid or + * expired card, or a valid card with insufficient available balance. If the cvc parameter is provided, Stripe will attempt to check the CVC's + * correctness, and the check's result will be returned. Similarly, If address_line1 or address_zip are provided, Stripe will similarly try to + * check the validity of those parameters. Some banks do not support checking one or more of these parameters, in which case Stripe will return + * an 'unavailable' result. Also note that, depending on the bank, charges can succeed even when passed incorrect CVC and address information. + * + * @param options Options for creating a charge. + * @param response A callback to receive the response and newly created charge, or errors if they exist. + */ + create(options: { + /** + * A positive integer in the smallest currency unit (e.g 100 cents to charge $1.00, or 1 to charge 1, a 0-decimal currency) + * representing how much to charge the card. The minimum amount is $0.50 (or equivalent in charge currency). + */ + amount: number; + + /** + * 3-letter ISO code for currency. + */ + currency: string; + + /** + * The ID of an existing customer that will be charged in this request. + */ + customer?: string; + + /** + * A payment source to be charged, such as a credit card. If you also pass a customer ID, the source must be the ID of + * a source belonging to the customer. Otherwise, if you do not pass a customer ID, the source you provide must either + * be a token, like the ones returned by Stripe.js, or a object containing a user's credit card details, with the options + * described below. Although not all information is required, the extra info helps prevent fraud. + */ + source?: string | IPaymentToken | ICard; + + /** + * An arbitrary string which you can attach to a charge object. It is displayed when in the web interface alongside the + * charge. Note that if you use Stripe to send automatic email receipts to your customers, your receipt emails will include + * the description of the charge(s) that they are describing. + */ + description?: string; + metadata?: IMetadata; + + /** + * Whether or not to immediately capture the charge. When false, the charge issues an authorization (or pre-authorization), + * and will need to be captured later. Uncaptured charges expire in 7 days. For more information, see authorizing charges + * and settling later: https://support.stripe.com/questions/can-i-authorize-a-charge-and-then-wait-to-settle-it-later + */ + capture?: boolean; + + /** + * An arbitrary string to be displayed on your customer's credit card statement. This may be up to 22 characters. + * As an example, if your website is RunClub and the item you're charging for is a race ticket, you may want to + * specify a statement_descriptor of RunClub 5K race ticket. The statement description may not include <>"' characters, + * and will appear on your customer's statement in capital letters. Non-ASCII characters are automatically stripped. + * While most banks display this information consistently, some may display it incorrectly or not at all. + */ + statement_descriptor?: string; + + /** + * The email address to send this charge's receipt to. The receipt will not be sent until the charge is paid. + * If this charge is for a customer, the email address specified here will override the customer's email address. + * Receipts will not be sent for test mode charges. If receipt_email is specified for a charge in live mode, a receipt + * will be sent regardless of your email settings. + */ + receipt_email?: string; + + /** + * A fee in cents that will be applied to the charge and transferred to the application owner's Stripe account. + * The request must be made with an OAuth key in order to take an application fee. For more information, + * see the application fees documentation: https://stripe.com/docs/connect/collecting-fees + */ + application_fee?: string; + + /** + * Shipping information for the charge. Helps prevent fraud on charges for physical goods. + */ + shipping?: IShippingInformation; + }, response: IResponseFn): void; + + /** + * Retrieves the details of a charge that has previously been created. Supply the unique charge ID that was returned + * from your previous request, and Stripe will return the corresponding charge information. The same information is + * returned when creating or refunding the charge. + * + * @param id The identifier of the charge to be retrieved + * @param response A callback that takes in a potential error and a charge object. + */ + retrieve(id: string, response: IResponseFn): void; + + /** + * Updates the specified charge by setting the values of the parameters passed. Any parameters not provided will be left unchanged. + * This request accepts only the description, metadata, receipt_emailand fraud_details as arguments. + * + * @param id The identifier of the charge to be updated + * @param update An object containing the updated properties. + */ + update(id: string, update: { + /** + * An arbitrary string which you can attach to a charge object. It is displayed when in the web interface alongside the charge. + * Note that if you use Stripe to send automatic email receipts to your customers, your receipt emails will include the description + * of the charge(s) that they are describing. This can be unset by updating the value to null and then saving. + */ + description?: string; + + /** + * You can unset an individual key by setting its value to null and then saving. To clear all keys, set metadata to null, then save. + */ + metadata?: IMetadata; + + /** + * This is the email address that the receipt for this charge will be sent to. + * If this field is updated, then a new email receipt will be sent to the updated address. + */ + receipt_email?: string; + + /** + * A set of key/value pairs you can attach to a charge giving information about its riskiness. + */ + fraud_details?: { + /** + * If you believe a charge is fraudulent, include a user_report key with a value of fraudulent. If you believe a + * charge is safe, include a user_report key with a value of safe. Note that you must refund a charge before setting + * the user_report to fraudulent. Stripe will use the information you send to improve our fraud detection algorithm + */ + user_report?: string; + } + }, response: IResponseFn): void; + + /** + * Capture the payment of an existing, uncaptured, charge. This is the second half of the two-step payment flow, where first + * you created a charge with the capture option set to false. Uncaptured payments expire exactly seven days after they are + * created. If they are not captured by that point in time, they will be marked as refunded and will no longer be capturable. + */ + capture(id: string, response: IResponseFn): void; + + /** + * Returns a list of charges you've previously created. The charges are returned in sorted order, with the most recent charges + * appearing first. + * + * @returns An object with a data property that contains an array of up to limit charges, starting after charge starting_after. + * Each entry in the array is a separate charge object. If no more charges are available, the resulting array will be empty. + * If you provide a non-existent customer ID, this call throws an error. You can optionally request that the response include + * the total count of all charges that match your filters. To do so, specify include[]=total_count in your request. + * + * @param options Filtering options for the returned items. + */ + list(options: IListOptions, response: IResponseFn>): void; + + /** + * When you get a dispute, contacting your customer is always the best first step. If that doesn't work, you can submit evidence in + * order to help us resolve the dispute in your favor. You can do this in your dashboard, but if you prefer, you can use the API to + * submit evidence programmatically. Depending on your dispute type, different evidence fields will give you a better chance of winning + * your dispute. You may want to consult our guide to dispute types to help you figure out which evidence fields to provide: + * https://stripe.com/help/dispute-types + * + * @param chargeId The ID for the disputed charge + * @param options The fields to update + */ + updateDispute(chargeId: string, options: { + /** + * Evidence to upload to respond to a dispute. Updating any field in the hash will submit all fields in the hash for review. + */ + evidence?: IDisputeEvidence; + /** + * A set of key/value pairs that you can attach to a dispute object. It can be useful for storing additional information about the + * dispute in a structured format. This can be unset by updating the value to null and then saving. + */ + metadata?: IMetadata; + }, response: IResponseFn): void; + + + /** + * Closing the dispute for a charge indicates that you do not have any evidence to submit and are essentially 'dismissing' the dispute, + * acknowledging it as lost. The status of the dispute will change from under_review to lost. + * + * IMPORTANT: Closing a dispute is irreversible. + * + * @param chargeId The ID of the disputed charge + */ + closeDispute(chargeId: string): void; + + /** + * When you create a new refund, you must specify a charge to create it on. Creating a new refund will refund a charge that has previously + * been created but not yet refunded. Funds will be refunded to the credit or debit card that was originally charged. The fees you were + * originally charged are also refunded. You can optionally refund only part of a charge. You can do so as many times as you wish until + * the entire charge has been refunded. Once entirely refunded, a charge can't be refunded again. This method will throw an error when + * called on an already-refunded charge, or when trying to refund more money than is left on a charge. + * + * @returns Returns the refund object if the refund succeeded. Throws an error if the charge has already been refunded or an invalid + * charge identifier was provided. + * + * @param id The identifier of the charge to be refunded. + * @param options Options for specifying reasons and refund amount + * @param response The refund. + */ + createRefund(id: string, options: { + /** + * A positive integer in cents representing how much of this charge to refund. Can only refund up to the unrefunded amount remaining + * of the charge. + */ + amount?: number; + + /** + * Boolean indicating whether the application fee should be refunded when refunding this charge. If a full charge refund is given, the + * full application fee will be refunded. Else, the application fee will be refunded with an amount proportional to the amount of the + * charge refunded. An application fee can only be refunded by the application that created the charge. + */ + refund_applcation_fee?: boolean; + + /** + * String indicating the reason for the refund. If set, possible values are duplicate, fraudulent, and requested_by_customer. Specifying + * fraudulent as the reason when you believe the charge to be fraudulent will help us improve our fraud detection algorithms. + */ + reason?: string; + + /** + * A set of key/value pairs that you can attach to a refund object. It can be useful for storing additional information about the refund + * in a structured format. You can unset an individual key by setting its value to null and then saving. To clear all keys, set metadata + * to null, then save. + */ + metadata?: IMetadata; + }, response: IResponseFn): void; + + /** + * By default, you can see the 10 most recent refunds stored directly on the charge object, but you can also retrieve details about a specific + * refund stored on the charge. + * + * @param chargeId The ID of the charge refunded + * @param refundId The ID of the refund to retrieve + */ + retrieveRefund(chargeId: string, refundId: string, response: IResponseFn): void; + + /** + * Updates the specified refund by setting the values of the parameters passed. Any parameters not provided will be left unchanged. + * This request only accepts metadata as an argument. + * + * @param chargeId The ID of the charge refunded + * @param refundId The ID of the refund to update + */ + updateRefund(chargeId: string, refundId: string, options: { + /** + * A set of key/value pairs that you can attach to a refund object. It can be useful for storing additional information about the refund + * in a structured format. You can unset an individual key by setting its value to null and then saving. To clear all keys, set metadata + * to null, then save. + */ + metadata: IMetadata; + }, response: IResponseFn): void; + + /** + * You can see a list of the refunds belonging to a specific charge. Note that the 10 most recent refunds are always available by default on + * the charge object. If you need more than those 10, you can use this API method and the limit and starting_after parameters to page through + * additional refunds. + * + * @returns A object with a data property that contains an array of up to limit refunds, starting after refund starting_after. + * Each entry in the array is a separate refund object. If no more refunds are available, the resulting array will be empty. If you provide + * a non-existent customer ID or charge ID, this call throws an error. You can optionally request that the response include the total count + * of all refunds that match your filters. To do so, specify include[]=total_count in your request. + * + * @param chargeId The ID of the charge refunded + * @param options Used to filter the refunds returned + */ + listRefunds(chargeId: string, options: IListOptions, response: IResponseFn>): void; + } + + class Coupons extends StripeResource { + /** + * You can create coupons easily via the coupon management page of the Stripe dashboard. Coupon creation is also accessible via the API if + * you need to create coupons on the fly. A coupon has either a percent_off or an amount_off and currency. If you set an amount_off, that + * amount will be subtracted from any invoice's subtotal. For example, an invoice with a subtotal of $10 will have a final total of $0 if + * a coupon with an amount_off of 2000 is applied to it and an invoice with a subtotal of $30 will have a final total of $10 if a coupon + * with an amount_off of 2000 is applied to it. + * + * @returns Returns the coupon object. + * + * @param options Options for creating the coupon. + */ + create(options: { + /** + * Unique string of your choice that will be used to identify this coupon when applying it a customer. This is often a specific code + * youll give to your customer to use when signing up (e.g. FALL25OFF). If you dont want to specify a particular code, you can leave + * the ID blank and well generate a random code for you. + */ + id?: string; + + /** + * Specifies how long the discount will be in effect. Can be forever, once, or repeating. + */ + duration: string; + + /** + * A positive integer representing the amount to subtract from an invoice total (required if percent_off is not passed) + */ + amount_off?: number; + + /** + * Currency of the amount_off parameter (required if amount_off is passed) + */ + currency?: string; + + /** + * required only if duration is repeating If duration is repeating, a positive integer that specifies the number of months the + * discount will be in effect + */ + duration_in_months?: number; + + /** + * A positive integer specifying the number of times the coupon can be redeemed before its no longer valid. For example, you might + * have a 50% off coupon that the first 20 readers of your blog can use. + */ + max_redemptions?: number; + + /** + * A set of key/value pairs that you can attach to a coupon object. It can be useful for storing additional information about the + * coupon in a structured format. This can be unset by updating the value to null and then saving. + */ + metadata?: IMetadata; + + /** + * A positive integer between 1 and 100 that represents the discount the coupon will apply (required if amount_off is not passed) + */ + percent_off?: number; + + /** + * Unix timestamp specifying the last time at which the coupon can be redeemed. After the redeem_by date, the coupon can no longer + * be applied to new customers. + */ + redeem_by?: number; + }, response: IResponseFn): void; + + /** + * Retrieves the coupon with the given ID. + * + * @returns Returns a coupon if a valid coupon ID was provided. Throws an error otherwise. + * + * @param id The ID of the desired coupon + */ + retrieve(id: string, response: IResponseFn): void; + + /** + * Updates the metadata of a coupon. Other coupon details (currency, duration, amount_off) are, by design, not editable. + * + * @returns The newly updated coupon object if the call succeeded. Otherwise, this call throws an error, such as if the coupon has + * been deleted. + * + * @param id The ID of the coupon to be updated + * @param options Metadata to update + */ + update(id: string, options: { + /** + * A set of key/value pairs that you can attach to a coupon object. It can be useful for storing additional information about the + * coupon in a structured format. + */ + metadata?: IMetadata; + }, response: IResponseFn): void; + + /** + * You can delete coupons via the coupon management page of the Stripe dashboard. However, deleting a coupon does not affect any + * customers who have already applied the coupon; it means that new customers can't redeem the coupon. You can also delete coupons + * via the API. + * + * @returns An object with the deleted coupon's ID and a deleted flag upon success. Otherwise, this call throws an error, such as + * if the coupon has already been deleted. + * + * @param id The ID of the coupon to be deleted. + */ + del(id: string, response: IResponseFn): void; + + /** + * Returns a list of your coupons. + * + * @returns A object with a data property that contains an array of up to limit coupons, starting after coupon starting_after. Each + * entry in the array is a separate coupon object. If no more coupons are available, the resulting array will be empty. This request + * should never throw an error. You can optionally request that the response include the total count of all coupons. To do so, specify + * include[]=total_count in your request. + * + * @param options Filtering options for the list. + */ + list(options: IListOptions, response: IResponseFn): void; + } + + class CustomerCards extends StripeResource { + create(): void; + list(): void; + update(id: string): void; + retrieve(id: string): void; + del(id: string): void; + } + + class Customers extends StripeResource { + /** + * Creates a new customer object. + * + * @returns Returns a customer object if the call succeeded. The returned object will have information about subscriptions, discount, + * and payment sources, if that information has been provided. If a non-free plan is specified and a source is not provided (unless + * the plan has a trial period), the call will throw an error. If a non-existent plan or a non-existent or expired coupon is provided, + * the call will throw an error. If a source has been attached to the customer, the returned customer object will have a default_source + * attribute, which is an ID that can be expanded into the full source details when retrieving the customer. + * + * @param options The options for the new customer + */ + create(options: { + /** + * An integer amount in cents that is the starting account balance for your customer. A negative amount represents a credit that + * will be used before attempting any charges to the customers card; a positive amount will be added to the next invoice. + */ + account_balance?: number; + + /** + * If you provide a coupon code, the customer will have a discount applied on all recurring charges. Charges you create through the + * API will not have the discount. + */ + coupon?: string; + + /** + * An arbitrary string that you can attach to a customer object. It is displayed alongside the customer in the dashboard. This can + * be unset by updating the value to null and then saving. + */ + description?: string; + + /** + * Customers email address. Its displayed alongside the customer in your dashboard and can be useful for searching and tracking. + * This can be unset by updating the value to null and then saving. + */ + email?: string; + + /** + * A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the + * customer in a structured format. This can be unset by updating the value to null and then saving. + */ + metadata?: IMetadata; + + /** + * The identifier of the plan to subscribe the customer to. If provided, the returned customer object will have a list of subscriptions + * that the customer is currently subscribed to. If you subscribe a customer to a plan without a free trial, the customer must have a + * valid card as well. + */ + plan?: string; + + /** + * The quantity youd like to apply to the subscription youre creating (if you pass in a plan). For example, if your plan is + * 10 cents/user/month, and your customer has 5 users, you could pass 5 as the quantity to have the customer charged 50 cents + * (5 x 10 cents) monthly. Defaults to 1 if not set. Only applies when the plan parameter is also provided. + */ + quantity?: number; + source?: string | ICard; + + /** + * Unix timestamp representing the end of the trial period the customer will get before being charged. If set, trial_end will + * override the default trial period of the plan the customer is being subscribed to. The special value now can be provided to + * end the customers trial immediately. Only applies when the plan parameter is also provided. + */ + trial_end?: number; + }, response: IResponseFn): void; + + /** + * Returns a list of your customers. The customers are returned sorted by creation date, with the most recently created customers + * appearing first. + * + * @returns A object with a data property that contains an array of up to limit customers, starting after customer starting_after. + * Each entry in the array is a separate customer object. If no more customers are available, the resulting array will be empty. + * This request should never throw an error. You can optionally request that the response include the total count of all customers + * that match your filters. To do so, specify include[]=total_count in your request. + * + * @param options Allows you to filter the customers you want. + */ + list(options: IListOptions, response: IResponseFn>): void; + + /** + * Updates the specified customer by setting the values of the parameters passed. Any parameters not provided will be left unchanged. + * For example, if you pass the card parameter, that becomes the customer's active card to be used for all charges in the future. + * When you update a customer to a new valid card: for each of the customer's current subscriptions, if the subscription is in the + * past_due state, then the latest unpaid, unclosed invoice for the subscription will be retried (note that this retry will not count + * as an automatic retry, and will not affect the next regularly scheduled payment for the invoice). (Note also that no invoices + * pertaining to subscriptions in the unpaid state, or invoices pertaining to canceled subscriptions, will be retried as a result + * of updating the customer's card.) This request accepts mostly the same arguments as the customer creation call. + * + * @returns Returns the customer object if the update succeeded. Throws an error if update parameters are invalid (e.g. specifying + * an invalid coupon or an invalid card). + */ + update(id: string, options: { + /** + * An integer amount in cents that is the starting account balance for your customer. A negative amount represents a credit that + * will be used before attempting any charges to the customers card; a positive amount will be added to the next invoice. + */ + account_balance?: number; + + /** + * If you provide a coupon code, the customer will have a discount applied on all recurring charges. Charges you create through the + * API will not have the discount. + */ + coupon?: string; + + /** + * An arbitrary string that you can attach to a customer object. It is displayed alongside the customer in the dashboard. This can + * be unset by updating the value to null and then saving. + */ + description?: string; + + /** + * Customers email address. Its displayed alongside the customer in your dashboard and can be useful for searching and tracking. + * This can be unset by updating the value to null and then saving. + */ + email?: string; + + /** + * A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the + * customer in a structured format. This can be unset by updating the value to null and then saving. + */ + metadata?: IMetadata; + + /** + * The identifier of the plan to subscribe the customer to. If provided, the returned customer object will have a list of subscriptions + * that the customer is currently subscribed to. If you subscribe a customer to a plan without a free trial, the customer must have a + * valid card as well. + */ + plan?: string; + + /** + * The quantity youd like to apply to the subscription youre creating (if you pass in a plan). For example, if your plan is + * 10 cents/user/month, and your customer has 5 users, you could pass 5 as the quantity to have the customer charged 50 cents + * (5 x 10 cents) monthly. Defaults to 1 if not set. Only applies when the plan parameter is also provided. + */ + quantity?: number; + source?: ICard; + + /** + * Unix timestamp representing the end of the trial period the customer will get before being charged. If set, trial_end will + * override the default trial period of the plan the customer is being subscribed to. The special value now can be provided to + * end the customers trial immediately. Only applies when the plan parameter is also provided. + */ + trial_end?: number; + }, response: IResponseFn): void; + + /** + * Retrieves the details of an existing customer. You need only supply the unique customer identifier that was returned upon customer + * creation. + * + * @returns Returns a customer object if a valid identifier was provided. When requesting the ID of a customer that has been deleted, + * a subset of the customer's information will be returned, including a "deleted" property, which will be true. + * + * @param id The identifier of the customer to be retrieved. + */ + retrieve(id: string, response: IResponseFn): void; + + /** + * Permanently deletes a customer. It cannot be undone. Also immediately cancels any active subscriptions on the customer. + * + * @returns Returns an object with a deleted parameter on success. If the customer ID does not exist, this call throws an error. Unlike + * other objects, deleted customers can still be retrieved through the API, in order to be able to track the history of customers while + * still removing their credit card details and preventing any further operations to be performed (such as adding a new subscription). + * + * @param id The identifier of the customer to be deleted. + */ + del(id: string, response: IResponseFn): void; + + /** + * When you create a new credit card, you must specify a customer or recipient to create it on. If the card's owner has no default card, + * then the new card will become the default. However, if the owner already has a default then it will not change. To change the default, + * you should either update the customer to have a new default_source or update the recipient to have a new default_card. + * + * @returns Returns the card object. + * + * @param customerId The customer ID to which to add the card. + */ + createCard(customerId: string, options: { + /** + * The source can either be a token, like the ones returned by our Stripe.js, or a dictionary containing a users credit card details + * (with the options shown below). Whenever you create a new card for a customer, Stripe will automatically validate the card. + */ + source?: string | ICard; + card?: string | IPaymentToken; + }, response: IResponseFn): void; + + /** + * By default, you can see the 10 most recent cards stored on a customer or recipient directly on the customer or recipient object, but + * you can also retrieve details about a specific card stored on the customer or recipient. + * + * @returns Returns the card object. + * + * @param customerId The ID of the customer whose card needs to be retrieved. + * @param cardId The ID of the card to be retrieved. + */ + retrieveCard(customerId: string, cardId: string, response: IResponseFn): void; + + /** + * If you need to update only some card details, like the billing address or expiration date, you can do so without having to re-enter the + * full card details. Stripe also works directly with card networks so that your customers can continue using your service without + * interruption. When you update a card, Stripe will automatically validate the card. + * + * @returns Returns the card object. + * + * @param customerId The ID of the customer whose card needs to be retrieved. + * @param cardId The ID of the card to be retrieved. + */ + updateCard(customerId: string, cardId: string, options: { + /** + * The card number + */ + 'number'?: number; + exp_month?: number; + exp_year?: number; + address_city?: string; + + /** + * Billing address country, if provided when creating card + */ + address_country?: string; + address_line1?: string; + address_line2?: string; + address_state?: string; + address_zip?: string; + + /** + * Two-letter ISO code representing the country of the card. You could use this + * attribute to get a sense of the international breakdown of cards youve collected. + */ + country?: string; + + /** + * Cardholder name + */ + name?: string; + }, response: IResponseFn): void; + + /** + * You can delete cards from a customer or recipient. If you delete a card that is currently the + * default source on a customer, then the most recently added source will become the new default. + * If you delete a card that is the last remaining source on the customer then the default_source + * attribute will become null. Similarly, if you delete the default card on a recipient, then the + * most recently added card will become the new default. If you delete the last remaining card on + * a recipient, then the default_card attribute will become null. Note that for cards belonging to + * customers, you may want to prevent customers on paid subscriptions from deleting all cards on + * file so that there is at least one default card for the next invoice payment attempt. + * + * @returns Returns the deleted card object. + * + * @param customerId The ID of the customer whose card needs to be retrieved. + * @param cardId The ID of the card to be retrieved. + */ + deleteCard(customerId: string, cardId: string, response: IResponseFn): void; + + /** + * You can see a list of the cards belonging to a customer or recipient. Note that the 10 most recent + * cards are always available by default on the customer or recipient object. If you need more than + * those 10, you can use this API method and the limit and starting_after parameters to page through + * additional cards. + * + * @returns Returns a list of the cards stored on the customer or recipient. You can optionally request + * that the response include the total count of all cards for the customer or recipient. To do so, + * specify include[]=total_count in your request. + * + * @param customerId The ID of the customer whose cards will be retrieved + * @param options Filtering options + */ + listCards(customerId: string, options: IListOptions, response: IResponseFn>): void; + + /** + * Creates a new subscription on an existing customer. + * + * @returns The newly created subscription object if the call succeeded. If the customer has no card or the + * attempted charge fails, this call throws an error (unless the specified plan is free or has a trial + * period). + * + * @param customerId The customer to which the add the subscription. + * @param options The options for the new subscription + */ + createSubscription(customerId: string, options: { + /** + * The identifier of the plan to subscribe the customer to. + */ + plan: string; + + /** + * The code of the coupon to apply to this subscription. A coupon applied to a subscription will only + * affect invoices created for that particular subscription. + */ + coupon?: string; + + /** + * Unix timestamp representing the end of the trial period the customer will get before being charged + * for the first time. If set, trial_end will override the default trial period of the plan the customer + * is being subscribed to. The special value now can be provided to end the customer's trial immediately. + */ + trial_end?: number; + + /** + * The source can either be a token, like the ones returned by our Stripe.js, or a object containing a + * user's credit card details (with the options shown below). You must provide a source if the customer + * does not already have a valid source attached, and you are subscribing the customer for a plan that + * is not free. Passing source will create a new source object, make it the customer default source, and + * delete the old customer default if one exists. If you want to add an additional source to use with + * subscriptions, instead use the card creation API to add the card and then the customer update API to + * set it as the default. Whenever you attach a card to a customer, Stripe will automatically validate + * the card. + */ + source?: IPaymentToken | ICard; + + /** + * The quantity you'd like to apply to the subscription you're creating. For example, if your plan is + * $10/user/month, and your customer has 5 users, you could pass 5 as the quantity to have the customer + * charged $50 (5 x $10) monthly. If you update a subscription but don't change the plan ID (e.g. + * changing only the trial_end), the subscription will inherit the old subscription's quantity attribute + * unless you pass a new quantity parameter. If you update a subscription and change the plan ID, the new + * subscription will not inherit the quantity attribute and will default to 1 unless you pass a quantity + * parameter. + */ + quantity?: number; + + /** + * A positive decimal (with at most two decimal places) between 1 and 100. This represents the percentage + * of the subscription invoice subtotal that will be transferred to the application owners Stripe account. + * The request must be made with an OAuth key in order to set an application fee percentage. For more + * information, see the application fees documentation: https://stripe.com/docs/connect/collecting-fees#subscriptions + */ + application_fee_percent?: number; + + /** + * A positive decimal (with at most two decimal places) between 1 and 100. This represents the percentage + * of the subscription invoice subtotal that will be calculated and added as tax to the final amount each + * billing period. For example, a plan which charges $10/month with a tax_percent of 20.0 will charge + * $12 per invoice. + */ + tax_percent?: number; + + /** + * A set of key/value pairs that you can attach to a subscription object. It can be useful for + * storing additional information about the subscription in a structured format. + */ + metadata?: IMetadata; + }, response: IResponseFn): void; + + /** + * By default, you can see the 10 most recent active subscriptions stored on a customer directly on the customer + * object, but you can also retrieve details about a specific active subscription for a customer. + * + * @returns Returns the subscription object. + * + * @param customerId The customer ID for the subscription + * @param subscriptionId The ID of the subscription to retrieve + */ + retrieveSubscription(customerId: string, subscriptionId: string, response: IResponseFn): void; + + /** + * Updates an existing subscription on a customer to match the specified parameters. When changing plans or quantities, + * we will optionally prorate the price we charge next month to make up for any price changes. + * + * By default, we prorate subscription changes. For example, if a customer signs up on May 1 for a $10 plan, she'll be billed + * $10 immediately. If she then switches to a $20 plan on May 15, on June 1 she'll be billed $25 ($20 for a renewal of her + * subscription and a $5 prorating adjustment for the previous month). Similarly, a downgrade will generate a credit to be + * applied to the next invoice. We also prorate when you make quantity changes. Switching plans does not change the billing + * date or generate an immediate charge unless you're switching between different intervals (e.g. monthly to yearly), in which + * case we apply a credit for the time unused on the old plan and charge for the new plan starting right away, resetting the + * billing date. (Note that if we charge for the new plan, and that payment fails, the plan change will not go into effect). If + * you'd like to charge for an upgrade immediately, just pass prorate as true as usual, and then invoice the customer as soon + * as you make the subscription change. That'll collect the proration adjustments into a new invoice, and Stripe will automatically + * attempt to pay the invoice. If you don't want to prorate at all, set the prorate option to false and the customer would be billed + * $10 on May 1 and $20 on June 1. Similarly, if you set prorate to false when switching between different billing intervals + * (monthly to yearly, for example), we won't generate any credits for the old subscription's unused time, although we will still + * reset the billing date and bill immediately for the new subscription. + * + * @returns The newly updated subscription object if the call succeeded. If a charge is required for the update, and + * the charge fails, this call raises throws an error, and the subscription update does not go into effect. + * + * @param customerId The ID of the customer whose subscription needs to be updated. + * @param subscriptionId The ID of the subscription to update. + * @param options The fields to update + */ + updateSubscription(customerId: string, subscriptionId: string, options: { + /** + * The identifier of the plan to update the subscription to. If omitted, the subscription will not change plans. + */ + plan?: string; + + /** + * The code of the coupon to apply to the customer if you would like to apply it at the same time as updating the subscription. + */ + coupon?: string; + + /** + * Flag telling us whether to prorate switching plans during a billing cycle. + */ + prorate?: boolean; + + /** + * Unix timestamp representing the end of the trial period the customer will get before being charged for the first time. If set, + * trial_end will override the default trial period of the plan the customer is being subscribed to. The special value now can be + * provided to end the customer's trial immediately. + */ + trial_end?: number; + + /** + * The source can either be a token, like the ones returned by our Stripe.js, or a object containing a user's credit card details + * (with the options shown below). You must provide a source if the customer does not already have a valid source attached, and + * you are subscribing the customer for a plan that is not free. Passing source will create a new source object, make it the + * customer default source, and delete the old customer default if one exists. If you want to add an additional source to use + * with subscriptions, instead use the card creation API to add the card and then the customer update API to set it as the default. + * Whenever you attach a card to a customer, Stripe will automatically validate the card. + */ + source?: IPaymentToken | ICard; + + /** + * The quantity you'd like to apply to the subscription you're updating. For example, if your plan is $10/user/month, and your + * customer has 5 users, you could pass 5 as the quantity to have the customer charged $50 (5 x $10) monthly. If you update a + * subscription but don't change the plan ID (e.g. changing only the trial_end), the subscription will inherit the old subscription's + * quantity attribute unless you pass a new quantity parameter. If you update a subscription and change the plan ID, the new + * subscription will not inherit the quantity attribute and will default to 1 unless you pass a quantity parameter. + */ + quantity?: number; + + /** + * A positive decimal (with at most two decimal places) between 1 and 100 that represents the percentage of the subscription + * invoice amount due each billing period (including any bundled invoice items) that will be transferred to the application + * owners Stripe account. The request must be made with an OAuth key in order to set an application fee percentage . For more + * information, see the application fees documentation: https://stripe.com/docs/connect/collecting-fees#subscriptions + */ + application_fee_percent?: number; + + /** + * Update the amount of tax applied to this subscription. Changing the tax_percent of a subscription will only affect future + * invoices. + */ + tax_percent?: number; + + /** + * A set of key/value pairs that you can attach to a subscription object. It can be useful for storing additional information + * about the subscription in a structured format. + */ + metadata?: IMetadata; + }, response: IResponseFn): void; + + /** + * Cancels a customer's subscription. If you set the at_period_end parameter to true, the subscription will remain active until + * the end of the period, at which point it will be canceled and not renewed. By default, the subscription is terminated + * immediately. In either case, the customer will not be charged again for the subscription. Note, however, that any pending + * invoice items that you've created will still be charged for at the end of the period unless manually deleted. If you've set + * the subscription to cancel at period end, any pending prorations will also be left in place and collected at the end of the + * period, but if the subscription is set to cancel immediately, pending prorations will be removed. By default, all unpaid + * invoices for the customer will be closed upon subscription cancellation. We do this in order to prevent unexpected payment + * retries once the customer has canceled a subscription. However, you can reopen the invoices manually after subscription + * cancellation to have us proceed with automatic retries, or you could even re-attempt payment yourself on all unpaid invoices + * before allowing the customer to cancel the subscription at all. + * + * @returns The canceled subscription object. Its subscription status will be set to "canceled" unless you've set at_period_end + * to true when canceling, in which case the status will remain "active" but the cancel_at_period_end attribute will change to true. + * + * @param customerId The ID of the customer whose subscription needs to be cancelled. + * @param subscriptionId The ID of the subscription to cancel. + * @param options Specify when to cancel the subscription + */ + cancelSubscription(customerId: string, subscriptionId: string, options: { + /** + * A flag that if set to true will delay the cancellation of the subscription until the end of the current period. + */ + at_period_end?: boolean; + }, response: IResponseFn): void; + + /** + * You can see a list of the customer's active subscriptions. Note that the 10 most recent active subscriptions are always available + * by default on the customer object. If you need more than those 10, you can use the limit and starting_after parameters to page + * through additional subscriptions. + * + * @returns Returns a list of the customer's active subscriptions. You can optionally request that the response include the total + * count of all subscriptions for the customer. To do so, specify include[]=total_count in your request. + * + * @param customerId The ID of the customer whose subscriptions will be retrieved + * @param options Filtering options + */ + listSubscriptions(customerId: string, options: IListOptions, response: IResponseFn>): void; + + /** + * Removes the currently applied discount on a customer. + * + * @returns An object with a deleted flag set to true upon success. This call throws an error otherwise, such as if no + * discount exists on this customer. + * + * @param customerId The ID of the customer. + */ + deleteDiscount(customerId: string, response: IResponseFn): void; + + /** + * Removes the currently applied discount on a subscription. + * + * @returns An object with a deleted flag set to true upon success. This call throws an error otherwise, such as if no + * discount exists on this subscription. + * + * @param customerId The ID of the customer. + * @param subscriptionId The ID of the subscription. + */ + deleteSubscriptionDiscount(customerId: string, subscriptionId: string, response: IResponseFn): void; + } + + class CustomerSubscriptions extends StripeResource { + create(): void; + list(): void; + update(id: string): void; + retrieve(id: string): void; + del(id: string): void; + } + + class Events extends StripeResource { + list(): void; + retrieve(id: string): void; + } + + class FileUploads extends StripeResource { + list(): void; + retrieve(id: string): void; + } + + class InvoiceItems extends StripeResource { + create(): void; + list(): void; + update(id: string): void; + retrieve(id: string): void; + del(id: string): void; + } + + class Invoices extends StripeResource { + /** + * If you need to invoice your customer outside the regular billing cycle, you can create an invoice that + * pulls in all pending invoice items, including prorations. The customer's billing cycle and regular subscription + * won't be affected. Once you create the invoice, it'll be picked up and paid automatically, though you can + * choose to pay it right away: https://stripe.com/docs/api#pay_invoice + * + * @returns Returns the invoice object if there are pending invoice items to invoice. Throws an error if there + * are no pending invoice items or if the customer ID provided is invalid. + * + * @param options Options used to create the invoice. + */ + create(options: { + customer: string; + + /** + * A fee in cents that will be applied to the invoice and transferred to the application owners Stripe account. + * The request must be made with an OAuth key or the Stripe-Account header in order to take an application fee. + * For more information, see the application fees documentation. + */ + application_fee?: number; + description?: string; + metadata?: IMetadata; + + /** + * Extra information about a charge for the customers credit card statement. + */ + statement_descriptor?: string; + + /** + * The ID of the subscription to invoice. If not set, the created invoice will include all pending invoice items + * for the customer. If set, the created invoice will exclude pending invoice items that pertain to other + * subscriptions. + */ + subscription?: string; + + /** + * The percent tax rate applied to the invoice, represented as a decimal number. + */ + tax_percent?: number; + }, response: IResponseFn): void; + + /** + * Retrieves the invoice with the given ID. The invoice object contains a + * lines hash that contains information about the subscriptions and invoice items that have been applied to the + * invoice, as well as any prorations that Stripe has automatically calculated. Each line on the invoice has an + * amount attribute that represents the amount actually contributed to the invoice's total. For invoice items and + * prorations, the amount attribute is the same as for the invoice item or proration respectively. For + * subscriptions, the amount may be different from the plan's regular price depending on whether the invoice + * covers a trial period or the invoice period differs from the plan's usual interval. The invoice object has + * both a subtotal and a total. The subtotal represents the total before any discounts, while the total is the final + * amount to be charged to the customer after all coupons have been applied. The invoice also has a + * next_payment_attempt attribute that tells you the next time (as a Unix timestamp) payment for the invoice will be + * automatically attempted. For invoices that have been closed or that have reached the maximum number of retries + * (specified in your retry settings), the next_payment_attempt will be null. + * + * @returns Returns an invoice object if a valid invoice ID was provided. Throws an error otherwise. + * + * @param id The ID of the desired invoice. + */ + retrieve(id: string, response: IResponseFn): void; + + /** + * When retrieving an invoice, you'll get a lines property containing the total count of line items and the first + * handful of those items. There is also a URL where you can retrieve the full (paginated) list of line items. + * + * @returns Returns a list of line_item objects. + * + * @param id The id of the invoice containing the lines to be retrieved + * @param options Filtering options + */ + retrieveLines(id: string, options: { + /** + * In the case of upcoming invoices, the customer of the upcoming invoice is required. In other cases it is ignored. + */ + customer?: string; + + /** + * A cursor for use in pagination. ending_before is an object ID that defines your place in the list. + * For instance, if you make a list request and receive 100 objects, starting with obj_bar, your subsequent + * call can include ending_before=obj_bar in order to fetch the previous page of the list. + */ + ending_before?: string; + + /** + * A limit on the number of objects to be returned. Limit can range between 1 and 100 items. + */ + limit?: number; + + /** + * A cursor for use in pagination. starting_after is an object ID that defines your place in the list. For instance, + * if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include + * starting_after=obj_foo in order to fetch the next page of the list. + */ + starting_after?: string; + + /** + * In the case of upcoming invoices, the subscription of the upcoming invoice is optional. In other cases it is ignored. + */ + subscription?: string; + }, response: IResponseFn>): void; + + /** + * At any time, you can preview the upcoming invoice for a customer. This will show you all the charges that are pending, + * including subscription renewal charges, invoice item charges, etc. It will also show you any discount that is applicable + * to the customer. Note that when you are viewing an upcoming invoice, you are simply viewing a preview -- the invoice has + * not yet been created. As such, the upcoming invoice will not show up in invoice listing calls, and you cannot use the API + * to pay or edit the invoice. If you want to change the amount that your customer will be billed, you can add, remove, or + * update pending invoice items, or update the customer's discount. + * + * @returns Returns an invoice if a valid customer ID was provided. Throws an error otherwise. + * + * @param id The identifier of the customer whose upcoming invoice you'd like to retrieve. + */ + retrieveUpcoming(id: string, options: { + /** + * The identifier of the subscription for which you'd like to retrieve the upcoming invoice. If not provided, you will + * retrieve the next upcoming invoice from among the customer's subscriptions. + */ + subscription?: string; + }, response: IResponseFn): void; + + /** + * Until an invoice is paid, it is marked as open (closed=false). If you'd like to stop Stripe from automatically attempting + * payment on an invoice or would simply like to close the invoice out as no longer owed by the customer, you can update the + * closed parameter. + * + * @returns Returns the invoice object. + * + * @param id The ID of the invoice to update + * @param options Fields to update + */ + update(id: string, options: { + /** + * A fee in cents that will be applied to the invoice and transferred to the application owners Stripe account. The request + * must be made with an OAuth key or the Stripe-Account header in order to take an application fee. For more information, + * see the application fees documentation: https://stripe.com/docs/connect/collecting-fees#subscriptions + */ + application_fee?: number; + + /** + * Boolean representing whether an invoice is closed or not. To close an invoice, pass true. + */ + closed?: boolean; + description?: string; + + /** + * Boolean representing whether an invoice is forgiven or not. To forgive an invoice, pass true. Forgiving an invoice instructs + * us to update the subscription status as if the invoice were succcessfully paid. Once an invoice has been forgiven, it + * cannot be unforgiven or reopened. + */ + forgiven?: string; + metadata?: IMetadata; + + /** + * Extra information about a charge for the customers credit card statement. + */ + statement_descriptor?: string; + + /** + * The percent tax rate applied to the invoice, represented as a decimal number. The tax rate of a paid or forgiven invoice + * cannot be changed. + */ + tax_percent?: number; + }, response: IResponseFn): void; + + /** + * Stripe automatically creates and then attempts to pay invoices for customers on subscriptions. We'll also retry unpaid + * invoices according to your retry settings. However, if you'd like to attempt to collect payment on an invoice out of the + * normal retry schedule or for some other reason, you can do so. + * + * @returns Returns the invoice object. + * + * @param id The ID of the invoice to pay. + */ + pay(id: string, response: IResponseFn): void; + + /** + * You can list all invoices, or list the invoices for a specific customer. The invoices are returned + * sorted by creation date, with the most recently created invoices appearing first. + * + * @returns A object with a data property that contains an array of invoice objects. Throws an error if the + * customer ID is invalid. + * + * @param options Filtering options + */ + list(options: IListOptions, response: IResponseFn>): void; + } + + class Plans extends StripeResource { + /** + * You can create plans easily via the plan management page of the Stripe dashboard. Plan creation is also + * accessible via the API if you need to create plans on the fly. + * + * @returns The newly created plan + * + * @param options Options for the new plan. + */ + create(options: { + /** + * Unique string of your choice that will be used to identify this plan when subscribing a customer. + * This could be an identifier like "gold" or a primary key from your own database. + */ + id: string; + + /** + * A positive integer in cents (or 0 for a free plan) representing how much to charge (on a recurring basis). + */ + amount: number; + + /** + * 3-letter ISO code for currency. + */ + currency: string; + + /** + * Specifies billing frequency. Either day, week, month or year. + */ + interval: string; + + /** + * The number of intervals between each subscription billing. For example, interval=month and + * interval_count=3 bills every 3 months. Maximum of one year interval allowed (1 year, 12 months, + * or 52 weeks). + */ + interval_count?: number; + + /** + * Name of the plan, to be displayed on invoices and in the web interface. + */ + name: string; + + /** + * Specifies a trial period in (an integer number of) days. If you include a trial period, the customer + * won't be billed for the first time until the trial period ends. If the customer cancels before the + * trial period is over, she'll never be billed at all. + */ + trial_period_days?: number; + + /** + * A set of key/value pairs that you can attach to a plan object. It can be useful for storing additional + * information about the plan in a structured format. + */ + metadata?: IMetadata; + + /** + * An arbitrary string to be displayed on your customer's credit card statement. This may be up to 22 characters. + * As an example, if your website is RunClub and the item you're charging for is your Silver Plan, you may want + * to specify a statement_descriptor of RunClub Silver Plan. The statement description may not include <>"' + * characters, and will appear on your customer's statement in capital letters. Non-ASCII characters are + * automatically stripped. While most banks display this information consistently, some may display it incorrectly + * or not at all. + */ + statement_descriptor?: string; + }, response: IResponseFn): void; + + /** + * Retrieves the plan with the given ID. + * + * @returns Returns a plan if a valid plan ID was provided. Throws an error otherwise. + * + * @param id The ID of the desired plan. + */ + retrieve(id: string, response: IResponseFn): void; + + /** + * Updates the name of a plan. Other plan details (price, interval, etc.) are, by design, not editable. + * + * @returns The updated plan object is returned upon success. Otherwise, this call throws an error. + * + * @param id The plan ID to update + * @param options The fields to update + */ + update(id: string, options: { + /** + * Name of the plan, to be displayed on invoices and in the web interface. + */ + name?: string; + + /** + * A set of key/value pairs that you can attach to a plan object. It can be useful for storing additional information + * about the plan in a structured format. You can unset an individual key by setting its value to null and then saving. + * To clear all keys, set metadata to null, then save. + */ + metadata?: IMetadata; + + /** + * An arbitrary string to be displayed on your customer's credit card statement. This may be up to 22 characters. + * As an example, if your website is RunClub and the item you're charging for is your Silver Plan, you may want + * to specify a statement_descriptor of RunClub Silver Plan. The statement description may not include <>"' + * characters, and will appear on your customer's statement in capital letters. Non-ASCII characters are + * automatically stripped. While most banks display this information consistently, some may display it incorrectly + * or not at all. + */ + statement_descriptor?: string; + }, response: IResponseFn): void; + + /** + * You can delete plans via the plan management page of the Stripe dashboard. However, deleting a plan does not affect + * any current subscribers to the plan; it merely means that new subscribers can't be added to that plan. You can also + * delete plans via the API. + * + * @returns An object with the deleted plan's ID and a deleted flag upon success. Otherwise, this call throws an error, such as if the plan has already been deleted. + * + * @param id The identifier of the plan to be deleted. + */ + del(id: string, response: IResponseFn): void; + + /** + * Returns a list of your plans. + * + * @returns An object with a data property that contains an array of up to limit plans, starting after plan starting_after. + * Each entry in the array is a separate plan object. If no more plans are available, the resulting array will be empty. This + * request should never throw an error. You can optionally request that the response include the total count of all plans. To + * do so, specify include[]=total_count in your request. + */ + list(options: IListOptions, response: IResponseFn>): void; + } + + class RecipientCards extends StripeResource { + create(): void; + list(): void; + update(id: string): void; + retrieve(id: string): void; + del(id: string): void; + } + + class Recipients extends StripeResource { + create(): void; + list(): void; + update(id: string): void; + retrieve(id: string): void; + del(id: string): void; + } + + class Tokens extends StripeResource { + create(): void; + retrieve(id: string): void; + } + + class TransferReversals extends StripeResource { + create(): void; + list(): void; + update(id: string): void; + retrieve(id: string): void; + } + + class Transfers extends StripeResource { + create(): void; + list(): void; + update(id: string): void; + retrieve(id: string): void; + } + } + + interface IResponseFn { + (err: IStripeError, value: R): void; + } + + interface IDeleteConfirmation { id: string; deleted: boolean; } + + /** + * Options for filtering a list by created period. + */ + interface IDateFilter { + /** + * Return values where the created field is after this timestamp. + */ + gt?: string; + + /** + * Return values where the created field is after or equal to this timestamp. + */ + gte?: string; + + /** + * Return values where the created field is before this timestamp. + */ + lt?: string; + + /** + * Return values where the created field is before or equal to this timestamp. + */ + lte?: string; + } + + /** + * A dispute occurs when a customer questions your charge with their bank or credit card company. + * When a customer disputes your charge, you're given the opportunity to respond to the dispute with + * evidence that shows the charge is legitimate. You can find more information about the dispute process + * in our disputes FAQ: https://stripe.com/help/disputes + */ + interface IDispute { + /** + * Valud is 'dispute' + */ + object: string; + livemode: boolean; + + /** + * Disputed amount. Usually the amount of the charge, but can differ (usually because of currency + * fluctuation or because only part of the order is disputed). + */ + amount: number; + + /** + * ID of the charge that was disputed + */ + charge: string; + + /** + * Date dispute was opened + */ + created: number; + + /** + * Three-letter ISO currency code representing the currency of the amount that was disputed. + */ + currency: string; + + /** + * Reason given by cardholder for dispute. Possible values are duplicate, fraudulent, subscription_canceled, + * product_unacceptable, product_not_received, unrecognized, credit_not_processed, general. + * Read more about dispute reasons: https://stripe.com/help/disputes#reasons + */ + reason: string; + + /** + * Current status of dispute. Possible values are warning_needs_response, warning_under_review, warning_closed, + * needs_response, response_disabled, under_review, charge_refunded, won, lost. + */ + status: string; + + /** + * List of zero, one, or two balance transactions that show funds withdrawn and reinstated to your + * Stripe account as a result of this dispute. + */ + balance_transactions: Array; + + /** + * Evidence provided to respond to a dispute. Updating any field in the hash will submit all fields in the hash for review. + */ + evidence: IDisputeEvidence; + + /** + * Information about the evidence submission. + */ + evidence_details?: { + /** + * Whether or not evidence has been saved for this dispute. + */ + has_evidence: boolean; + + /** + * The number of times the evidence has been submitted. You may submit evidence a maximum of 5 times + */ + submission_count: number; + + /** + * Date by which evidence must be submitted in order to successfully challenge dispute. Will be null + * if the customers bank or credit card company doesnt allow a response for this particular dispute. + */ + due_by: number; + + /** + * Whether or not the last evidence submission was submitted past the due date. Defaults to false + * if no evidence submissions have occurred. If true, then delivery of the latest evidence is not guaranteed. + */ + past_due: boolean; + }; + + /** + * If true, it is still possible to refund the disputed payment. Once the payment has been fully + * refunded, no further funds will be withdrawn from your Stripe account as a result of this dispute. + */ + is_charge_refundable: boolean; + metadata: IMetadata; + } + + interface IBankAccount { + id: string; + object: string; + + /** + * Two-letter ISO code representing the country the bank account is located in. + */ + country: string; + + /** + * Three-letter ISO currency code representing the currency paid out to the bank account. + */ + currency: string; + default_for_currency: boolean; + last4: string; + + /** + * Possible values are new, validated, verified, or errored. A bank account that hasnt had any activity or validation performed + * is new. If Stripe can determine that the bank account exists, its status will be validated. Note that there often isnt enough + * information to know (e.g. for smaller credit unions), and the validation is not always run. If the recipient or customer proves + * that they own the bank account (via microdeposit or login), the status will be verified. If a transfer sent to this bank account + * fails, well set the status to errored and will not continue to send transfers until the bank details are updated. + */ + status: string; + + /** + * Name of the bank associated with the routing number, e.g. WELLS FARGO. + */ + bank_name: string; + + /** + * Uniquely identifies this particular bank account. You can use this attribute to check whether two bank accounts are the same. + */ + fingerprint: string; + + /** + * The routing transit number for the bank account. + */ + routing_number: string; + } + + interface IReversal { + id: string; + + /** + * Value is 'list' + */ + object: string; + + /** + * Amount reversed, in cents. + */ + amount: number; + created: number; + + /** + * Three-letter ISO currency code representing the currency. + */ + currency: string; + + /** + * Balance transaction that describes the impact of this reversal on your account balance. + */ + balance_transaction: string; + metadata: IMetadata; + + /** + * ID of the transfer that was reversed. + */ + transfer: string; + } + + interface IDisputeEvidence { + /** + * Any server or activity logs showing proof that the customer accessed or downloaded the purchased + * digital product. This information should include IP addresses, corresponding timestamps, and any + * detailed recorded activity. + */ + access_activity_log?: string; + + /** + * The billing addess provided by the customer. + */ + billing_address?: string; + + /** + * (ID of a file upload) Your subscription cancellation policy, as shown to the customer. + */ + cancellation_policy?: string; + + /** + * An explanation of how and when the customer was shown your refund policy prior to purchase. + */ + cancellation_policy_disclosure?: string; + + /** + * A justification for why the customers subscription was not canceled. + */ + cancellation_rebuttal?: string; + + /** + * (ID of a file upload) Any communication with the customer that you feel is relevant to your case (for + * example emails proving that they received the product or service, or demonstrating their use of or + * satisfaction with the product or service). + */ + customer_communication?: string; + + /** + * The email address of the customer. + */ + customer_email_address?: string; + + /** + * The name of the customer. + */ + customer_name?: string; + + /** + * The IP address that the customer used when making the purchase. + */ + customer_purchase_ip?: string; + + /** + * (ID of a file upload) A relevant document or contract showing the customers signature. + */ + customer_signature?: string; + + /** + * (ID of a file upload) Documentation for the prior charge that can uniquely identify the charge, + * such as a receipt, shipping label, work order, etc. This document should be paired with a similar + * document from the disputed payment that proves the two payments are separate. + */ + duplicate_charge_documentation?: string; + + /** + * An explanation of the difference between the disputed charge and the prior charge that appears to be a duplicate. + */ + duplicate_charge_explanation?: string; + + /** + * The Stripe ID for the prior charge which appears to be a duplicate of the disputed charge. + */ + duplicate_charge_id?: string; + + /** + * A description of the product or service which was sold. + */ + product_description?: string; + + /** + * (ID of a file upload) Any receipt or message sent to the customer notifying them of the charge. + */ + receipt?: string; + + /** + * (ID of a file upload) Your refund policy, as shown to the customer. + */ + refund_policy?: string; + + /** + * Documentation demonstrating that the customer was shown your refund policy prior to purchase. + */ + refund_policy_disclosure?: string; + + /** + * A justification for why the customer is not entitled to a refund. + */ + refund_refusal_explanation?: string; + + /** + * The date on which the customer received or began receiving the purchased service, in a clear human-readable format. + */ + service_date?: string; + + /** + * (ID of a file upload) Documentation showing proof that a service was provided to the customer. This could + * include a copy of a signed contract, work order, or other form of written agreement. + */ + service_documentation?: string; + + /** + * The address to which a physical product was shipped. You should try to include as much complete address information as possible. + */ + shipping_address?: string; + + /** + * The delivery service that shipped a physical product, such as Fedex, UPS, USPS, etc. If multiple carriers were used + * for this purchase, please separate them with commas. + */ + shipping_carrier?: string; + + /** + * The date on which a physical product began its route to the shipping address, in a clear human-readable format. + */ + shipping_date?: string; + + /** + * (ID of a file upload) Documentation showing proof that a product was shipped to the customer at the same address + * the customer provided to you. This could include a copy of the shipment receipt, shipping label, etc, and should + * show the full shipping address of the customer, if possible. + */ + shipping_documentation?: string; + + /** + * The tracking number for a physical product, obtained from the delivery service. If multiple tracking numbers + * were generated for this purchase, please separate them with commas. + */ + shipping_tracking_number?: string; + + /** + * (ID of a file upload) Any additional evidence or statements. + */ + uncategorized_file?: string; + + /** + * Any additional evidence or statements. + */ + uncategorized_text?: string; + } + + /** + * To safely retry an API request without accidentally performing the same operation twice, + * you can attach a unique key to any POST request made to the Stripe API via the Idempotency-Key: header. + * For example, if a request to create a charge fails due to a network connection error, you can make + * a second request with the same key to guarantee that only a single charge is created. + * The creation of the key is completely up to you we suggest using random strings or UUIDs. + * We'll always send back the same response for requests made with the same key, even if you make the request + * with different request parameters. The keys expire after 24 hours. + */ + interface IIdempotentOptions { + idempotency_key: string; + } + + /** + * A set of key/value pairs that you can attach to a reversal. It can be useful for storing + * additional information about the reversal in a structured format. + */ + interface IMetadata extends Object { } + + interface IShippingInformation { + /** + * Shipping address. + */ + address: { + /** + * Address line 1 (Street address/PO Box/Company name) + */ + line1: string; + + /** + * Address line 2 (Apartment/Suite/Unit/Building) + */ + line2: string; + + /** + * City/Suburb/Town/Village + */ + city: string; + + /** + * State/Province/County + */ + state: string; + + /** + * Zip/Postal Code + */ + postal_code: string; + + /** + * 2-letter country code + */ + country: string; + }; + + /** + * Recipient name. + */ + name: string; + + /** + * The delivery service that shipped a physical product, such as Fedex, UPS, USPS, etc. + */ + carrier: string; + + /** + * Recipient phone (including extension). + */ + phone: string; + + /** + * The tracking number for a physical product, obtained from the delivery service. If multiple + * tracking numbers were generated for this purchase, please separate them with commas. + */ + tracking_number: string; + } + + + interface IList { + /** + * Value is 'list' + */ + object: string; + + data: Array; + + has_more: boolean; + + /** + * The URL where this list can be accessed. + */ + url: string; + + /** + * The total number of items available. This value is not included by default, + * but you can request it by specifying ?include[]=total_count + */ + total_count: number; + } + + interface IPaymentToken { + id: string; + card: { + name: string; + address_line1: string; + address_line2: string; + address_city: string; + address_state: string; + address_zip: string; + address_country: string; + country: string; + exp_month: number; + exp_year: number; + last4: string; + object: string; + brand: string; + funding: string; + }; + created: number; + livemode: boolean; + type: string; + object: string; + used: boolean; + } + + /** + * You can store multiple cards on a customer in order to charge the customer later. You + * can also store multiple debit cards on a recipient in order to transfer to those cards later. + */ + interface ICard { + /** + * ID of card (used in conjunction with a customer or recipient ID) + */ + id: string; + + /** + * Value is 'card' + */ + object: string; + + /** + * The card number + */ + 'number': number; + + /** + * Card brand. Can be Visa, American Express, MasterCard, Discover, JCB, Diners Club, or Unknown. + */ + brand: string; + exp_month: number; + exp_year: number; + + /** + * Card funding type. Can be credit, debit, prepaid, or unknown + */ + funding: string; + last4: string; + address_city: string; + + /** + * Billing address country, if provided when creating card + */ + address_country: string; + address_line1: string; + + /** + * If address_line1 was provided, results of the check: pass, fail, unavailable, or unchecked. + */ + address_line1_check: string; + address_line2: string; + address_state: string; + address_zip: string; + + /** + * If address_zip was provided, results of the check: pass, fail, unavailable, or unchecked. + */ + address_zip_check: string; + + /** + * Two-letter ISO code representing the country of the card. You could use this + * attribute to get a sense of the international breakdown of cards youve collected. + */ + country: string; + + /** + * The customer that this card belongs to. This attribute will not be in the card object + * if the card belongs to a recipient instead. + */ + customer: string; + + /** + * If a CVC was provided, results of the check: pass, fail, unavailable, or unchecked + */ + cvc_check: string; + + /** + * (For Apple Pay integrations only.) The last four digits of the device account number. + */ + dynamic_last4: string; + + /** + * Cardholder name + */ + name: string; + + /** + * The recipient that this card belongs to. This attribute will not be in the card object if + * the card belongs to a customer instead. + */ + recipient: string; + + /** + * Uniquely identifies this particular card number. You can use this attribute to check + * whether two customers whove signed up with you are using the same card number, for example. + */ + fingerprint: string; + } + + interface IListOptions { + /** + * A filter on the list based on the object created field. The value can be a string with an integer Unix timestamp, or it can + * be a dictionary. + */ + created?: string | IDateFilter; + + /** + * A filter on the list based on the object date field. The value can be a string with an integer Unix timestamp, + * or it can be a dictionary. + */ + date?: string | IDateFilter; + + /** + * Only return charges for the customer specified by this customer ID. + */ + customer?: string; + + /** + * A cursor for use in pagination. ending_before is an object ID that defines your place in the list. For instance, if you make + * a list request and receive 100 objects, starting with obj_bar, your subsequent call can include ending_before=obj_bar in + * order to fetch the previous page of the list. + */ + ending_before?: string; + + /** + * A limit on the number of objects to be returned. Limit can range between 1 and 100 items. + */ + limit?: number; + + /** + * A cursor for use in pagination. starting_after is an object ID that defines your place in the list. For instance, if you make + * a list request and receive 100 objects, ending with obj_foo, your subsequent call can include starting_after=obj_foo in order + * to fetch the next page of the list. + */ + starting_after?: string; + } + + /** + * Stripe uses conventional HTTP response codes to indicate success or failure of an API request. + * In general, codes in the 2xx range indicate success, codes in the 4xx range indicate an error that + * resulted from the provided information (e.g. a required parameter was missing, a charge failed, etc.), + * and codes in the 5xx range indicate an error with Stripe's servers. Not all errors map cleanly onto HTTP + * response codes, however. When a request is valid but does not complete successfully (e.g. a card is + * declined), we return a 402 error code. + * + * 200 - OK Everything worked as expected. + * 400 - Bad Request Often missing a required parameter. + * 401 - Unauthorized No valid API key provided. + * 402 - Request Failed Parameters were valid but request failed. + * 404 - Not Found The requested item doesn't exist. + * 500, 502, 503, 504 - Server Errors Something went wrong on Stripe's end. + */ + interface IStripeError { + /** + * The type of error returned. Can be invalid_request_error, api_error, or card_error. + * + * + * invalid_request_error Invalid request errors arise when your request has invalid parameters. + * + * api_error API errors cover any other type of problem (e.g. a temporary problem with Stripe's + * servers) and should turn up only very infrequently. + * + * card_error Card errors are the most common type of error you should expect to handle. They result + * when the user enters a card that can't be charged for some reason. + */ + type: string; + + /** + * A human-readable message giving more details about the error. For card errors, these messages can + * be shown to your users. + */ + message?: string; + + /** + * For card errors, a short string from amongst those listed on the right describing the kind of card + * error that occurred. + * + * incorrect_number The card number is incorrect. + * invalid_number The card number is not a valid credit card number. + * invalid_expiry_month The card's expiration month is invalid. + * invalid_expiry_year The card's expiration year is invalid. + * invalid_cvc The card's security code is invalid. + * expired_card The card has expired. + * incorrect_cvc The card's security code is incorrect. + * incorrect_zip The card's zip code failed validation. + * card_declined The card was declined. + * missing There is no card on a customer that is being charged. + * processing_error An error occurred while processing the card. + * rate_limit An error occurred due to requests hitting the API too + * quickly. Please let us know if you're consistently running + * into this error. + */ + code?: string; + + /** + * The parameter the error relates to if the error is parameter-specific. You can use this to display a + * message near the correct form field, for example. + */ + param?: string; + } +} diff --git a/stripe/stripe.d.ts b/stripe/stripe.d.ts index 2d5005618..ca589e133 100644 --- a/stripe/stripe.d.ts +++ b/stripe/stripe.d.ts @@ -4,12 +4,12 @@ // Definitions: https://github.com/borisyankov/DefinitelyTyped interface StripeStatic { - setPublishableKey(key: string); + setPublishableKey(key: string): void; validateCardNumber(cardNumber: string): boolean; validateExpiry(month: string, year: string): boolean; validateCVC(cardCVC: string): boolean; cardType(cardNumber: string): string; - getToken(token: string, responseHandler: (status: number, response: StripeTokenResponse) => void); + getToken(token: string, responseHandler: (status: number, response: StripeTokenResponse) => void): void; card: StripeCardData; } @@ -58,7 +58,7 @@ interface StripeCardData { address_zip?: string; address_country?: string; - createToken(data: StripeTokenData, responseHandler: (status: number, response: StripeTokenResponse) => void); + createToken(data: StripeTokenData, responseHandler: (status: number, response: StripeTokenResponse) => void): void; } declare var Stripe: StripeStatic; diff --git a/strophe/strophe-tests.ts b/strophe/strophe-tests.ts new file mode 100644 index 000000000..78ffb3941 --- /dev/null +++ b/strophe/strophe-tests.ts @@ -0,0 +1,102 @@ +/// + +function log(msg: string): void { + console.log(msg); +} + +function rawInput(data: string): void { + log('RECV: ' + data); +} + +function rawOutput(data: string): void { + log('SENT: ' + data); +} + +function onOwnMessage(msg: HTMLElement): boolean { + + console.log(msg); + var elems = msg.getElementsByTagName('own-message'); + if (elems.length > 0) { + var own = elems[0]; + var to = msg.getAttribute('to'); + var from = msg.getAttribute('from'); + var iq = $iq({ + to: from, + type: 'error', + id: msg.getAttribute('id') + }).cnode(own).up().c('error', { type: 'cancel', code: '501' }) + .c('feature-not-implemented', { xmlns: 'urn:ietf:params:xml:ns:xmpp-stanzas' }); + + connection.sendIQ(iq); + } + + return true; +} + +function onMessage(msg: Element): boolean { + var to = msg.getAttribute('to'); + var from = msg.getAttribute('from'); + var type = msg.getAttribute('type'); + var elems = msg.getElementsByTagName('body'); + + if (type == "chat" && elems.length > 0) { + var body = elems[0]; + + log('ECHOBOT: I got a message from ' + from + ': ' + + Strophe.getText(body)); + + var text = Strophe.getText(body) + " (this is echo)"; + + //var reply = $msg({to: from, from: to, type: 'chat', id: 'purple4dac25e4'}).c('active', {xmlns: "http://jabber.org/protocol/chatstates"}).up().cnode(body); + //.cnode(Strophe.copyElement(body)); + //connection.send(reply.tree()); + + log('ECHOBOT: I sent ' + from + ': ' + Strophe.getText(body)); + } + + // we must return true to keep the handler alive. + // returning false would remove it after it finishes. + return true; +} + + +function sendMessage() { + var message = "some message"; + var to = "some recipient"; + if (message && to) { + var reply = $msg({ + to: to, + type: 'chat' + }) + .cnode(Strophe.xmlElement('body', message)).up() + .c('active', { xmlns: "http://jabber.org/protocol/chatstates" }); + + connection.send(reply); + + log('I sent ' + to + ': ' + message); + } +} + +var connection = new Strophe.Connection("someservice"); +connection.rawInput = rawInput; +connection.rawOutput = rawOutput; + +function onConnect(status: Strophe.Status): void { + if (status == Strophe.Status.CONNECTING) { + log('Strophe is connecting.'); + } else if (status == Strophe.Status.CONNFAIL) { + log('Strophe failed to connect.'); + } else if (status == Strophe.Status.DISCONNECTING) { + log('Strophe is disconnecting.'); + } else if (status == Strophe.Status.DISCONNECTED) { + log('Strophe is disconnected.'); + } else if (status == Strophe.Status.CONNECTED) { + log('Strophe is connected.'); + log('ECHOBOT: Send a message to ' + connection.jid + + ' to talk to me.'); + + connection.addHandler(onMessage, null, 'message', null, null, null); + connection.addHandler(onOwnMessage, null, 'iq', 'set', null, null); + connection.send($pres().tree()); + } +} diff --git a/strophe/strophe.d.ts b/strophe/strophe.d.ts new file mode 100644 index 000000000..b8fc33989 --- /dev/null +++ b/strophe/strophe.d.ts @@ -0,0 +1,1068 @@ +// Type definitions for Strophe.js v1.2.0 +// Project: http://strophe.im/strophejs/ +// Definitions by: David Deutsch +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/** Function: $build + * Create a Strophe.Builder. + * This is an alias for 'new Strophe.Builder(name, attrs)'. + * + * Parameters: + * (String) name - The root element name. + * (Object) attrs - The attributes for the root element in object notation. + * + * Returns: + * A new Strophe.Builder object. + */ +declare function $build(name: string, attrs?: any): Strophe.Builder; + +/** Function: $msg + * Create a Strophe.Builder with a element as the root. + * + * Parmaeters: + * (Object) attrs - The element attributes in object notation. + * + * Returns: + * A new Strophe.Builder object. + */ +declare function $msg(attrs?: any): Strophe.Builder; + +/** Function: $iq + * Create a Strophe.Builder with an element as the root. + * + * Parameters: + * (Object) attrs - The element attributes in object notation. + * + * Returns: + * A new Strophe.Builder object. + */ +declare function $iq(attrs?: any): Strophe.Builder; + +/** Function: $pres + * Create a Strophe.Builder with a element as the root. + * + * Parameters: + * (Object) attrs - The element attributes in object notation. + * + * Returns: + * A new Strophe.Builder object. + */ +declare function $pres(attrs?: any): Strophe.Builder; + +declare module Strophe { + /** Constant: VERSION + * The version of the Strophe library. Unreleased builds will have + * a version of head-HASH where HASH is a partial revision. + */ + var VERSION: string; + + /** Constants: XMPP Namespace Constants + * Common namespace constants from the XMPP RFCs and XEPs. + * + * NS.HTTPBIND - HTTP BIND namespace from XEP 124. + * NS.BOSH - BOSH namespace from XEP 206. + * NS.CLIENT - Main XMPP client namespace. + * NS.AUTH - Legacy authentication namespace. + * NS.ROSTER - Roster operations namespace. + * NS.PROFILE - Profile namespace. + * NS.DISCO_INFO - Service discovery info namespace from XEP 30. + * NS.DISCO_ITEMS - Service discovery items namespace from XEP 30. + * NS.MUC - Multi-User Chat namespace from XEP 45. + * NS.SASL - XMPP SASL namespace from RFC 3920. + * NS.STREAM - XMPP Streams namespace from RFC 3920. + * NS.BIND - XMPP Binding namespace from RFC 3920. + * NS.SESSION - XMPP Session namespace from RFC 3920. + * NS.XHTML_IM - XHTML-IM namespace from XEP 71. + * NS.XHTML - XHTML body namespace from XEP 71. + */ + var NS: { + HTTPBIND: string; + BOSH: string; + CLIENT: string; + AUTH: string; + ROSTER: string; + PROFILE: string; + DISCO_INFO: string; + DISCO_ITEMS: string; + MUC: string; + SASL: string; + STREAM: string; + FRAMING: string; + BIND: string; + SESSION: string; + VERSION: string; + STANZAS: string; + XHTML_IM: string; + XHTML: string; + } + + /** Constants: Connection Status Constants + * Connection status constants for use by the connection handler + * callback. + * + * Status.ERROR - An error has occurred + * Status.CONNECTING - The connection is currently being made + * Status.CONNFAIL - The connection attempt failed + * Status.AUTHENTICATING - The connection is authenticating + * Status.AUTHFAIL - The authentication attempt failed + * Status.CONNECTED - The connection has succeeded + * Status.DISCONNECTED - The connection has been terminated + * Status.DISCONNECTING - The connection is currently being terminated + * Status.ATTACHED - The connection has been attached + */ + enum Status { + ERROR, + CONNECTING, + CONNFAIL, + AUTHENTICATING, + AUTHFAIL, + CONNECTED, + DISCONNECTED, + DISCONNECTING, + ATTACHED, + REDIRECT + } + + /** Constants: Log Level Constants + * Logging level indicators. + * + * LogLevel.DEBUG - Debug output + * LogLevel.INFO - Informational output + * LogLevel.WARN - Warnings + * LogLevel.ERROR - Errors + * LogLevel.FATAL - Fatal errors + */ + enum LogLevel { + DEBUG, + INFO, + WARN, + ERROR, + FATAL + } + + /** Function: addNamespace + * This function is used to extend the current namespaces in + * Strophe.NS. It takes a key and a value with the key being the + * name of the new namespace, with its actual value. + * For example: + * Strophe.addNamespace('PUBSUB', "http://jabber.org/protocol/pubsub"); + * + * Parameters: + * (String) name - The name under which the namespace will be + * referenced under Strophe.NS + * (String) value - The actual namespace. + */ + function addNamespace(name: string, value: string): void; + + /** Function: forEachChild + * Map a function over some or all child elements of a given element. + * + * This is a small convenience function for mapping a function over + * some or all of the children of an element. If elemName is null, all + * children will be passed to the function, otherwise only children + * whose tag names match elemName will be passed. + * + * Parameters: + * (XMLElement) elem - The element to operate on. + * (String) elemName - The child element tag name filter. + * (Function) func - The function to apply to each child. This + * function should take a single argument, a DOM element. + */ + function forEachChild(elem: Element, elemName: string, func:(child: Element) => any): void; + + /** Function: isTagEqual + * Compare an element's tag name with a string. + * + * This function is case sensitive. + * + * Parameters: + * (XMLElement) el - A DOM element. + * (String) name - The element name. + * + * Returns: + * true if the element's tag name matches _el_, and false + * otherwise. + */ + function isTagEqual(el: Element, name: string): boolean; + + /** Function: xmlGenerator + * Get the DOM document to generate elements. + * + * Returns: + * The currently used DOM document. + */ + function xmlGenerator(): Document; + + /** Function: xmlElement + * Create an XML DOM element. + * + * This function creates an XML DOM element correctly across all + * implementations. Note that these are not HTML DOM elements, which + * aren't appropriate for XMPP stanzas. + * + * Parameters: + * (String) name - The name for the element. + * (Array|Object) attrs - An optional array or object containing + * key/value pairs to use as element attributes. The object should + * be in the format {'key': 'value'} or {key: 'value'}. The array + * should have the format [['key1', 'value1'], ['key2', 'value2']]. + * (String) text - The text child data for the element. + * + * Returns: + * A new XML DOM element. + */ + function xmlElement(name: string, attrs?: any, text?: string): Element; + function xmlElement(name: string, text?: string, attrs?: any): Element; + + /* Function: xmlescape + * Excapes invalid xml characters. + * + * Parameters: + * (String) text - text to escape. + * + * Returns: + * Escaped text. + */ + function xmlescape(text: string): string; + + /* Function: xmlunescape + * Unexcapes invalid xml characters. + * + * Parameters: + * (String) text - text to unescape. + * + * Returns: + * Unescaped text. + */ + function xmlunescape(text: string): string; + + /** Function: xmlTextNode + * Creates an XML DOM text node. + * + * Provides a cross implementation version of document.createTextNode. + * + * Parameters: + * (String) text - The content of the text node. + * + * Returns: + * A new XML DOM text node. + */ + function xmlTextNode(text: string): Text; + + /** Function: xmlHtmlNode + * Creates an XML DOM html node. + * + * Parameters: + * (String) html - The content of the html node. + * + * Returns: + * A new XML DOM text node. + */ + function xmlHtmlNode(html: string): Document; + + /** Function: getText + * Get the concatenation of all text children of an element. + * + * Parameters: + * (XMLElement) elem - A DOM element. + * + * Returns: + * A String with the concatenated text of all text element children. + */ + function getText(elem: Element): string; + + /** Function: copyElement + * Copy an XML DOM element. + * + * This function copies a DOM element and all its descendants and returns + * the new copy. + * + * Parameters: + * (XMLElement) elem - A DOM element. + * + * Returns: + * A new, copied DOM element tree. + */ + function copyElement(elem: Element): Element; + + /** Function: createHtml + * Copy an HTML DOM element into an XML DOM. + * + * This function copies a DOM element and all its descendants and returns + * the new copy. + * + * Parameters: + * (Element) elem - A DOM element. + * + * Returns: + * A new, copied DOM element tree. + */ + function createHtml(elem: Element): Element; + + /** Function: escapeNode + * Escape the node part (also called local part) of a JID. + * + * Parameters: + * (String) node - A node (or local part). + * + * Returns: + * An escaped node (or local part). + */ + function escapeNode(node: string): string; + + /** Function: unescapeNode + * Unescape a node part (also called local part) of a JID. + * + * Parameters: + * (String) node - A node (or local part). + * + * Returns: + * An unescaped node (or local part). + */ + function unescapeNode(node: string): string; + + /** Function: getNodeFromJid + * Get the node portion of a JID String. + * + * Parameters: + * (String) jid - A JID. + * + * Returns: + * A String containing the node. + */ + function getNodeFromJid(jid: string): string; + + /** Function: getDomainFromJid + * Get the domain portion of a JID String. + * + * Parameters: + * (String) jid - A JID. + * + * Returns: + * A String containing the domain. + */ + function getDomainFromJid(jid: string): string; + + /** Function: getResourceFromJid + * Get the resource portion of a JID String. + * + * Parameters: + * (String) jid - A JID. + * + * Returns: + * A String containing the resource. + */ + function getResourceFromJid(jid: string): string; + + /** Function: getBareJidFromJid + * Get the bare JID from a JID String. + * + * Parameters: + * (String) jid - A JID. + * + * Returns: + * A String containing the bare JID. + */ + function getBareJidFromJid(jid: string): string; + + /** Function: log + * User overrideable logging function. + * + * This function is called whenever the Strophe library calls any + * of the logging functions. The default implementation of this + * function does nothing. If client code wishes to handle the logging + * messages, it should override this with + * > Strophe.log = function (level, msg) { + * > (user code here) + * > }; + * + * Please note that data sent and received over the wire is logged + * via Strophe.Connection.rawInput() and Strophe.Connection.rawOutput(). + * + * The different levels and their meanings are + * + * DEBUG - Messages useful for debugging purposes. + * INFO - Informational messages. This is mostly information like + * 'disconnect was called' or 'SASL auth succeeded'. + * WARN - Warnings about potential problems. This is mostly used + * to report transient connection errors like request timeouts. + * ERROR - Some error occurred. + * FATAL - A non-recoverable fatal error occurred. + * + * Parameters: + * (Integer) level - The log level of the log message. This will + * be one of the values in Strophe.LogLevel. + * (String) msg - The log message. + */ + function log(level: LogLevel, msg: string): void; + + /** Functions: debug, info, warn, error + * Log a message at the appropriate Strophe.LogLevel + * + * Parameters: + * (String) msg - The log message. + */ + function debug(msg: string): void; + function info(msg: string): void; + function warn(msg: string): void; + function error(msg: string): void; + function fatal(msg: string): void; + + /** Function: serialize + * Render a DOM element and all descendants to a String. + * + * Parameters: + * (XMLElement) elem - A DOM element. + * + * Returns: + * The serialized element tree as a String. + */ + function serialize(elem: Element | Builder): string; + + /** Function: addConnectionPlugin + * Extends the Strophe.Connection object with the given plugin. + * + * Parameters: + * (String) name - The name of the extension. + * (Object) ptype - The plugin's prototype. + */ + function addConnectionPlugin(name: string, ptype: any): void; + + var Builder: { + /** Constructor: Strophe.Builder + * Create a Strophe.Builder object. + * + * The attributes should be passed in object notation. For example + * > var b = new Builder('message', {to: 'you', from: 'me'}); + * or + * > var b = new Builder('messsage', {'xml:lang': 'en'}); + * + * Parameters: + * (String) name - The name of the root element. + * (Object) attrs - The attributes for the root element in object notation. + * + * Returns: + * A new Strophe.Builder. + */ + new (name: string, attrs?: any): Builder; + prototype: any; + } + + + /** Class: Strophe.Builder + * XML DOM builder. + * + * This object provides an interface similar to JQuery but for building + * DOM element easily and rapidly. All the functions except for toString() + * and tree() return the object, so calls can be chained. Here's an + * example using the $iq() builder helper. + * > $iq({to: 'you', from: 'me', type: 'get', id: '1'}) + * > .c('query', {xmlns: 'strophe:example'}) + * > .c('example') + * > .toString() + * The above generates this XML fragment + * > + * > + * > + * > + * > + * The corresponding DOM manipulations to get a similar fragment would be + * a lot more tedious and probably involve several helper variables. + * + * Since adding children makes new operations operate on the child, up() + * is provided to traverse up the tree. To add two children, do + * > builder.c('child1', ...).up().c('child2', ...) + * The next operation on the Builder will be relative to the second child. + */ + interface Builder { + /** Function: tree + * Return the DOM tree. + * + * This function returns the current DOM tree as an element object. This + * is suitable for passing to functions like Strophe.Connection.send(). + * + * Returns: + * The DOM tree as a element object. + */ + tree(): Element; + + /** Function: toString + * Serialize the DOM tree to a String. + * + * This function returns a string serialization of the current DOM + * tree. It is often used internally to pass data to a + * Strophe.Request object. + * + * Returns: + * The serialized DOM tree in a String. + */ + toString(): string; + + /** Function: up + * Make the current parent element the new current element. + * + * This function is often used after c() to traverse back up the tree. + * For example, to add two children to the same element + * > builder.c('child1', {}).up().c('child2', {}); + * + * Returns: + * The Stophe.Builder object. + */ + up(): Builder; + + /** Function: attrs + * Add or modify attributes of the current element. + * + * The attributes should be passed in object notation. This function + * does not move the current element pointer. + * + * Parameters: + * (Object) moreattrs - The attributes to add/modify in object notation. + * + * Returns: + * The Strophe.Builder object. + */ + attrs(moreattrs: any): Builder; + + /** Function: c + * Add a child to the current element and make it the new current + * element. + * + * This function moves the current element pointer to the child, + * unless text is provided. If you need to add another child, it + * is necessary to use up() to go back to the parent in the tree. + * + * Parameters: + * (String) name - The name of the child. + * (Object) attrs - The attributes of the child in object notation. + * (String) text - The text to add to the child. + * + * Returns: + * The Strophe.Builder object. + */ + c(name: string, attrs?: any, text?: string): Builder; + + /** Function: cnode + * Add a child to the current element and make it the new current + * element. + * + * This function is the same as c() except that instead of using a + * name and an attributes object to create the child it uses an + * existing DOM element object. + * + * Parameters: + * (XMLElement) elem - A DOM element. + * + * Returns: + * The Strophe.Builder object. + */ + cnode(elem: Node): Builder; + + /** Function: t + * Add a child text element. + * + * This *does not* make the child the new current element since there + * are no children of text elements. + * + * Parameters: + * (String) text - The text data to append to the current element. + * + * Returns: + * The Strophe.Builder object. + */ + t(text: string): Builder; + + /** Function: h + * Replace current element contents with the HTML passed in. + * + * This *does not* make the child the new current element + * + * Parameters: + * (String) html - The html to insert as contents of current element. + * + * Returns: + * The Strophe.Builder object. + */ + h(html: string): Builder; + } + + interface ConnectionOptions { + protocol?: string; + sync?: boolean; + } + var Connection: { + /** Constructor: Strophe.Connection + * Create and initialize a Strophe.Connection object. + * + * The transport-protocol for this connection will be chosen automatically + * based on the given service parameter. URLs starting with "ws://" or + * "wss://" will use WebSockets, URLs starting with "http://", "https://" + * or without a protocol will use BOSH. + * + * To make Strophe connect to the current host you can leave out the protocol + * and host part and just pass the path, e.g. + * + * > var conn = new Strophe.Connection("/http-bind/"); + * + * WebSocket options: + * + * If you want to connect to the current host with a WebSocket connection you + * can tell Strophe to use WebSockets through a "protocol" attribute in the + * optional options parameter. Valid values are "ws" for WebSocket and "wss" + * for Secure WebSocket. + * So to connect to "wss://CURRENT_HOSTNAME/xmpp-websocket" you would call + * + * > var conn = new Strophe.Connection("/xmpp-websocket/", {protocol: "wss"}); + * + * Note that relative URLs _NOT_ starting with a "/" will also include the path + * of the current site. + * + * Also because downgrading security is not permitted by browsers, when using + * relative URLs both BOSH and WebSocket connections will use their secure + * variants if the current connection to the site is also secure (https). + * + * BOSH options: + * + * by adding "sync" to the options, you can control if requests will + * be made synchronously or not. The default behaviour is asynchronous. + * If you want to make requests synchronous, make "sync" evaluate to true: + * > var conn = new Strophe.Connection("/http-bind/", {sync: true}); + * You can also toggle this on an already established connection: + * > conn.options.sync = true; + * + * + * Parameters: + * (String) service - The BOSH or WebSocket service URL. + * (Object) options - A hash of configuration options + * + * Returns: + * A new Strophe.Connection object. + */ + new (service: string, options?: ConnectionOptions): Connection; + prototype: any; + } + + /** Class: Strophe.Connection + * XMPP Connection manager. + * + * This class is the main part of Strophe. It manages a BOSH connection + * to an XMPP server and dispatches events to the user callbacks as + * data arrives. It supports SASL PLAIN, SASL DIGEST-MD5, SASL SCRAM-SHA1 + * and legacy authentication. + * + * After creating a Strophe.Connection object, the user will typically + * call connect() with a user supplied callback to handle connection level + * events like authentication failure, disconnection, or connection + * complete. + * + * The user will also have several event handlers defined by using + * addHandler() and addTimedHandler(). These will allow the user code to + * respond to interesting stanzas or do something periodically with the + * connection. These handlers will be active once authentication is + * finished. + * + * To send data to the connection, use send(). + */ + interface Connection { + + jid: string; + authzid: string; + pass: string; + authcid: string; + domain: string; + servtype: string; + maxRetries: number; + //todo: what other members are meant to be public? + + /** Function: reset + * Reset the connection. + * + * This function should be called after a connection is disconnected + * before that connection is reused. + */ + reset(): void; + + /** Function: pause + * Pause the request manager. + * + * This will prevent Strophe from sending any more requests to the + * server. This is very useful for temporarily pausing + * BOSH-Connections while a lot of send() calls are happening quickly. + * This causes Strophe to send the data in a single request, saving + * many request trips. + */ + pause(): void; + + /** Function: resume + * Resume the request manager. + * + * This resumes after pause() has been called. + */ + resume(): void; + + /** Function: getUniqueId + * Generate a unique ID for use in elements. + * + * All stanzas are required to have unique id attributes. This + * function makes creating these easy. Each connection instance has + * a counter which starts from zero, and the value of this counter + * plus a colon followed by the suffix becomes the unique id. If no + * suffix is supplied, the counter is used as the unique id. + * + * Suffixes are used to make debugging easier when reading the stream + * data, and their use is recommended. The counter resets to 0 for + * every new connection for the same reason. For connections to the + * same server that authenticate the same way, all the ids should be + * the same, which makes it easy to see changes. This is useful for + * automated testing as well. + * + * Parameters: + * (String) suffix - A optional suffix to append to the id. + * + * Returns: + * A unique string to be used for the id attribute. + */ + getUniqueId(suffix?: string | number): string; + + /** Function: connect + * Starts the connection process. + * + * As the connection process proceeds, the user supplied callback will + * be triggered multiple times with status updates. The callback + * should take two arguments - the status code and the error condition. + * + * The status code will be one of the values in the Strophe.Status + * constants. The error condition will be one of the conditions + * defined in RFC 3920 or the condition 'strophe-parsererror'. + * + * The Parameters _wait_, _hold_ and _route_ are optional and only relevant + * for BOSH connections. Please see XEP 124 for a more detailed explanation + * of the optional parameters. + * + * Parameters: + * (String) jid - The user's JID. This may be a bare JID, + * or a full JID. If a node is not supplied, SASL ANONYMOUS + * authentication will be attempted. + * (String) pass - The user's password. + * (Function) callback - The connect callback function. + * (Integer) wait - The optional HTTPBIND wait value. This is the + * time the server will wait before returning an empty result for + * a request. The default setting of 60 seconds is recommended. + * (Integer) hold - The optional HTTPBIND hold value. This is the + * number of connections the server will hold at one time. This + * should almost always be set to 1 (the default). + * (String) route - The optional route value. + */ + connect(jid?: string, pass?: string, callback?: (status: Status, condition: string) => any, wait?: number, hold?: number, route?: string): void; + + /** Function: attach + * Attach to an already created and authenticated BOSH session. + * + * This function is provided to allow Strophe to attach to BOSH + * sessions which have been created externally, perhaps by a Web + * application. This is often used to support auto-login type features + * without putting user credentials into the page. + * + * Parameters: + * (String) jid - The full JID that is bound by the session. + * (String) sid - The SID of the BOSH session. + * (String) rid - The current RID of the BOSH session. This RID + * will be used by the next request. + * (Function) callback The connect callback function. + * (Integer) wait - The optional HTTPBIND wait value. This is the + * time the server will wait before returning an empty result for + * a request. The default setting of 60 seconds is recommended. + * Other settings will require tweaks to the Strophe.TIMEOUT value. + * (Integer) hold - The optional HTTPBIND hold value. This is the + * number of connections the server will hold at one time. This + * should almost always be set to 1 (the default). + * (Integer) wind - The optional HTTBIND window value. This is the + * allowed range of request ids that are valid. The default is 5. + */ + attach(jid: string, sid: string, rid: string, callback?: (status: Status, condition: string) => any, wait?: number, hold?: number, wind?: number): void; + + /** Function: xmlInput + * User overrideable function that receives XML data coming into the + * connection. + * + * The default function does nothing. User code can override this with + * > Strophe.Connection.xmlInput = function (elem) { + * > (user code) + * > }; + * + * Due to limitations of current Browsers' XML-Parsers the opening and closing + * tag for WebSocket-Connoctions will be passed as selfclosing here. + * + * BOSH-Connections will have all stanzas wrapped in a tag. See + * if you want to strip this tag. + * + * Parameters: + * (XMLElement) elem - The XML data received by the connection. + */ + xmlInput(elem: Element): void; + + /** Function: xmlOutput + * User overrideable function that receives XML data sent to the + * connection. + * + * The default function does nothing. User code can override this with + * > Strophe.Connection.xmlOutput = function (elem) { + * > (user code) + * > }; + * + * Due to limitations of current Browsers' XML-Parsers the opening and closing + * tag for WebSocket-Connoctions will be passed as selfclosing here. + * + * BOSH-Connections will have all stanzas wrapped in a tag. See + * if you want to strip this tag. + * + * Parameters: + * (XMLElement) elem - The XMLdata sent by the connection. + */ + xmlOutput(elem: Element): void; + + /** Function: rawInput + * User overrideable function that receives raw data coming into the + * connection. + * + * The default function does nothing. User code can override this with + * > Strophe.Connection.rawInput = function (data) { + * > (user code) + * > }; + * + * Parameters: + * (String) data - The data received by the connection. + */ + rawInput(data: string): void; + + /** Function: rawOutput + * User overrideable function that receives raw data sent to the + * connection. + * + * The default function does nothing. User code can override this with + * > Strophe.Connection.rawOutput = function (data) { + * > (user code) + * > }; + * + * Parameters: + * (String) data - The data sent by the connection. + */ + rawOutput(data: string): void; + + /** Function: send + * Send a stanza. + * + * This function is called to push data onto the send queue to + * go out over the wire. Whenever a request is sent to the BOSH + * server, all pending data is sent and the queue is flushed. + * + * Parameters: + * (XMLElement | + * [XMLElement] | + * Strophe.Builder) elem - The stanza to send. + */ + send(elem: Element | Element[]| Builder): void; + + /** Function: flush + * Immediately send any pending outgoing data. + * + * Normally send() queues outgoing data until the next idle period + * (100ms), which optimizes network use in the common cases when + * several send()s are called in succession. flush() can be used to + * immediately send all pending data. + */ + flush(): void; + + /** Function: sendIQ + * Helper function to send IQ stanzas. + * + * Parameters: + * (XMLElement) elem - The stanza to send. + * (Function) callback - The callback function for a successful request. + * (Function) errback - The callback function for a failed or timed + * out request. On timeout, the stanza will be null. + * (Integer) timeout - The time specified in milliseconds for a + * timeout to occur. + * + * Returns: + * The id used to send the IQ. + */ + sendIQ(elem: Element | Builder, callback?: (stanza: Element) => any, errback?: (stanza: Element) => any, timeout?: number): string; //todo: Is callback correct? + + /** Function: addTimedHandler + * Add a timed handler to the connection. + * + * This function adds a timed handler. The provided handler will + * be called every period milliseconds until it returns false, + * the connection is terminated, or the handler is removed. Handlers + * that wish to continue being invoked should return true. + * + * Because of method binding it is necessary to save the result of + * this function if you wish to remove a handler with + * deleteTimedHandler(). + * + * Note that user handlers are not active until authentication is + * successful. + * + * Parameters: + * (Integer) period - The period of the handler. + * (Function) handler - The callback function. + * + * Returns: + * A reference to the handler that can be used to remove it. + */ + addTimedHandler(period: number, handler: () => boolean): any; + + /** Function: deleteTimedHandler + * Delete a timed handler for a connection. + * + * This function removes a timed handler from the connection. The + * handRef parameter is *not* the function passed to addTimedHandler(), + * but is the reference returned from addTimedHandler(). + * + * Parameters: + * (Strophe.TimedHandler) handRef - The handler reference. + */ + deleteTimedHandler(handRef: any): void; + + + /** Function: addHandler + * Add a stanza handler for the connection. + * + * This function adds a stanza handler to the connection. The + * handler callback will be called for any stanza that matches + * the parameters. Note that if multiple parameters are supplied, + * they must all match for the handler to be invoked. + * + * The handler will receive the stanza that triggered it as its argument. + * *The handler should return true if it is to be invoked again; + * returning false will remove the handler after it returns.* + * + * As a convenience, the ns parameters applies to the top level element + * and also any of its immediate children. This is primarily to make + * matching /iq/query elements easy. + * + * The options argument contains handler matching flags that affect how + * matches are determined. Currently the only flag is matchBare (a + * boolean). When matchBare is true, the from parameter and the from + * attribute on the stanza will be matched as bare JIDs instead of + * full JIDs. To use this, pass {matchBare: true} as the value of + * options. The default value for matchBare is false. + * + * The return value should be saved if you wish to remove the handler + * with deleteHandler(). + * + * Parameters: + * (Function) handler - The user callback. + * (String) ns - The namespace to match. + * (String) name - The stanza name to match. + * (String) type - The stanza type attribute to match. + * (String) id - The stanza id attribute to match. + * (String) from - The stanza from attribute to match. + * (String) options - The handler options + * + * Returns: + * A reference to the handler that can be used to remove it. + */ + addHandler(handler: (stanza: Element) => boolean, ns: string, name: string, type?: string, id?: string, from?: string, options?: { matchBare: boolean }): any; //todo: is callback correct? Also, are the elements specified as optional truly optional? + + /** Function: deleteHandler + * Delete a stanza handler for a connection. + * + * This function removes a stanza handler from the connection. The + * handRef parameter is *not* the function passed to addHandler(), + * but is the reference returned from addHandler(). + * + * Parameters: + * (Strophe.Handler) handRef - The handler reference. + */ + deleteHandler(handRef: any): void; + + /** Function: disconnect + * Start the graceful disconnection process. + * + * This function starts the disconnection process. This process starts + * by sending unavailable presence and sending BOSH body of type + * terminate. A timeout handler makes sure that disconnection happens + * even if the BOSH server does not respond. + * If the Connection object isn't connected, at least tries to abort all pending requests + * so the connection object won't generate successful requests (which were already opened). + * + * The user supplied connection callback will be notified of the + * progress as this process happens. + * + * Parameters: + * (String) reason - The reason the disconnect is occuring. + */ + disconnect(reason: string): void; + } + + /** Interface: Strophe.SASLMechanism + * + * encapsulates SASL authentication mechanisms. + * + * User code may override the priority for each mechanism or disable it completely. + * See for information about changing priority and for informatian on + * how to disable a mechanism. + * + * By default, all mechanisms are enabled and the priorities are + * + * SCRAM-SHA1 - 40 + * DIGEST-MD5 - 30 + * Plain - 20 + */ + interface SASLMechanism { + /** + * Function: test + * Checks if mechanism able to run. + * To disable a mechanism, make this return false; + * + * To disable plain authentication run + * > Strophe.SASLPlain.test = function() { + * > return false; + * > } + * + * See for a list of available mechanisms. + * + * Parameters: + * (Strophe.Connection) connection - Target Connection. + * + * Returns: + * (Boolean) If mechanism was able to run. + */ + test(connection: Connection): boolean; + + /** Variable: priority + * Determines which is chosen for authentication (Higher is better). + * Users may override this to prioritize mechanisms differently. + * + * In the default configuration the priorities are + * + * SCRAM-SHA1 - 40 + * DIGEST-MD5 - 30 + * Plain - 20 + * + * Example: (This will cause Strophe to choose the mechanism that the server sent first) + * + * > Strophe.SASLMD5.priority = Strophe.SASLSHA1.priority; + * + * See for a list of available mechanisms. + * + */ + priority: number; + } + + /** Constants: SASL mechanisms + * Available authentication mechanisms + * + * Strophe.SASLAnonymous - SASL Anonymous authentication. + * Strophe.SASLPlain - SASL Plain authentication. + * Strophe.SASLMD5 - SASL Digest-MD5 authentication + * Strophe.SASLSHA1 - SASL SCRAM-SHA1 authentication + */ + var SASLAnonymous: SASLMechanism; + var SASLPlain: SASLMechanism; + var SASLSHA1: SASLMechanism; + var SASLMD5: SASLMechanism; +} + diff --git a/succinct/succinct-tests.ts b/succinct/succinct-tests.ts new file mode 100644 index 000000000..7b81e5f85 --- /dev/null +++ b/succinct/succinct-tests.ts @@ -0,0 +1,31 @@ +/// + +// Call with no arguments (accepting defaults) +$(".truncate").succinct(); + +// Specify size +$(".truncate").succinct({ + size: 120 +}); + +// Specify ellipsis replacement +$(".truncate").succinct({ + omission: "→" +}); + +// Specify flag to leave trailing special characters +$(".truncate").succinct({ + ignore: false +}); + +// Combine options +$(".truncate").succinct({ + size: 120, + omission: '...', + ignore: false +}); + +// Can chain jQuery methods +$(".truncate") + .succinct() + .removeClass("truncate"); \ No newline at end of file diff --git a/succinct/succinct.d.ts b/succinct/succinct.d.ts new file mode 100644 index 000000000..59a1646e3 --- /dev/null +++ b/succinct/succinct.d.ts @@ -0,0 +1,18 @@ +// Type definitions for jQuery Succinct v1.1.0 +// Project: http://mikeking.io/succinct/ +// Definitions by: Matt Brooks +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module JQuerySuccinct { + interface Options { + size?: number; + omission?: string; + ignore?: boolean; + } +} + +interface JQuery { + succinct(settings?: JQuerySuccinct.Options): JQuery; +} \ No newline at end of file diff --git a/svgjs/svgjs.d.ts b/svgjs/svgjs.d.ts index 08513b78b..c04f19536 100644 --- a/svgjs/svgjs.d.ts +++ b/svgjs/svgjs.d.ts @@ -92,6 +92,8 @@ declare module svgjs { center(x:number, y:number, anchor?:boolean):Element; cx(x:number, anchor?:boolean):Element; cy(y:number, anchor?:boolean):Element; + cx(): number; + cy(): number; size(w:number, h:number, anchor?:boolean):Element; @@ -269,3 +271,7 @@ declare module svgjs { f?: number; } } + +declare module "svg.js" { + export = svgjs +} diff --git a/sweetalert/sweetalert-tests.ts b/sweetalert/sweetalert-tests.ts index 1ccb93ba3..ca0faacbf 100644 --- a/sweetalert/sweetalert-tests.ts +++ b/sweetalert/sweetalert-tests.ts @@ -63,7 +63,10 @@ swal({ text: "I will close in 2 seconds.", timer: 2000, showConfirmButton: false -}); +}, + function () { + swal("Time Out!", "The time is out of joint.", "success"); + }); // A replacement for the "prompt" function swal({ @@ -72,7 +75,9 @@ swal({ type: "input", showCancelButton: true, closeOnConfirm: false, - animation: "slide-from-top" + animation: "slide-from-top", + inputPlaceholder: "Write something plx", + inputValue: "Write something" }, function (inputValue) { if (inputValue === false) return false; diff --git a/sweetalert/sweetalert.d.ts b/sweetalert/sweetalert.d.ts index d5b4cd607..61b643c32 100644 --- a/sweetalert/sweetalert.d.ts +++ b/sweetalert/sweetalert.d.ts @@ -1,4 +1,4 @@ -// Type definitions for SweetAlert 0.5.0 +// Type definitions for SweetAlert 1.0.1 // Project: https://github.com/t4t5/sweetalert/ // Definitions by: Markus Peloso // Definitions: https://github.com/borisyankov/DefinitelyTyped @@ -28,7 +28,7 @@ declare module SweetAlert { * If set to true, the user can dismiss the modal by pressing the Escape key. * Default: true */ - allowEsxcapeKey?: boolean; + allowEscapeKey?: boolean; /** * A custom CSS class for the modal. @@ -78,6 +78,12 @@ declare module SweetAlert { */ closeOnConfirm?: boolean; + /** + * Set to false if you want the modal to stay open even if the user presses the "Cancel"-button. This is especially useful if the function attached to the "Cancel"-button is another SweetAlert. + * Default: true + */ + closeOnCancel?: boolean; + /** * Add a customized icon for the modal.Should contain a string with the path to the image. * Default: null @@ -91,7 +97,7 @@ declare module SweetAlert { imageSize?: string; /** - * Auto close timer of the modal.Set in ms (milliseconds). + * Auto close timer of the modal. Set in ms (milliseconds). * Default: null */ timer?: number; @@ -104,7 +110,7 @@ declare module SweetAlert { /** * If set to false, the modal's animation will be disabled. Possible animations: "slide-from-top", "slide-from-bottom", "pop" (use true instead) and "none" (use false instead). - * Default: true, "pop" + * Default: true */ animation?: boolean | string; @@ -113,6 +119,18 @@ declare module SweetAlert { * Default: "text" */ inputType?: string; + + /** + * When using the input-type, you can specify a placeholder to help the user. + * Default: null + */ + inputPlaceholder?: string; + + /** + * Specify a default text value that you want your input to show when using type: "input" + * Default: null + */ + inputValue?: string; } interface Settings extends SettingsBase { diff --git a/swipe/swipe-tests.ts b/swipe/swipe-tests.ts new file mode 100644 index 000000000..a13006ebb --- /dev/null +++ b/swipe/swipe-tests.ts @@ -0,0 +1,4 @@ +/// + +// Creation of element +var mySwipe = new Swipe(document.getElementById('slider')); \ No newline at end of file diff --git a/swipe/swipe.d.ts b/swipe/swipe.d.ts new file mode 100644 index 000000000..9cb753ef9 --- /dev/null +++ b/swipe/swipe.d.ts @@ -0,0 +1,28 @@ +// Type definitions for Swipe 2.0 +// Project: https://github.com/thebird/Swipe +// Definitions by: Andrey Kurdyumov +// Definitions: https://github.com/borisyankov/DefinitelyTyped + + +interface SwipeOptions { + startSlide?: number; + speed?: number; + auto?: number; + continuous?: boolean; + disableScroll?: boolean; + stopPropagation?: boolean; + callback?: (index: number, elem: HTMLElement) => void; + transitionEnd?: (index: number, elem: HTMLElement) => void; +} + +declare class Swipe { + constructor(container: HTMLElement, options?: SwipeOptions); + prev(): void; + next(): void; + getPos(): number; + getNumSlides(): number; + kill(): void; + attachEvents(): void; + setup(): void; + slide(index: number, duration: number): void; +} diff --git a/tcomb/tcomb-tests.ts b/tcomb/tcomb-tests.ts index aeecdcb31..3a27ffc7f 100644 --- a/tcomb/tcomb-tests.ts +++ b/tcomb/tcomb-tests.ts @@ -1,288 +1,1792 @@ // ReSharper disable InconsistentNaming // ReSharper disable WrongExpressionStatement +/// +/// +/// -import t = require("tcomb"); +// tests adapted from/for tcomb's test folder -var Str = t.Str; -var Num = t.Num; +'use strict'; +import assert = require('assert'); +var t = require('../index'); + +var Any = t.Any; +var Nil = t.Nil; var Bool = t.Bool; +var Num = t.Num; +var Str = t.Str; var Arr = t.Arr; var Obj = t.Obj; var Func = t.Func; var Err = t.Err; var Re = t.Re; var Dat = t.Dat; -var Nil = t.Nil; -var Any = t.Any; -var Type = t.Type; - var struct = t.struct; +var enums = t.enums; +var union = t.union; var tuple = t.tuple; +var maybe = t.maybe; +var subtype = t.subtype; var list = t.list; var dict = t.dict; -var union = t.union; -var maybe = t.maybe; var func = t.func; -var subtype = t.subtype; +var getTypeName = t.getTypeName; +var mixin = t.mixin; +var format = t.format; -Str.is("a string"); // => true -Str.is(1); // => false +// +// setup +// -Num.is("a string"); // => true -Num.is(1); // => false +var ok = function (x:any) { assert.strictEqual(true, x); }; +var ko = function (x:any) { assert.strictEqual(false, x); }; +var eq = assert.deepEqual; +var throwsWithMessage = function (f:any, message:any) { + assert.throws(f, function (err:any) { + ok(err instanceof Error); + eq(err.message, message); + return true; + }); +}; +var doesNotThrow = assert.doesNotThrow; -Bool.is("a string"); // => true -Bool.is(1); // => false - -Arr.is("a string"); // => true -Arr.is(1); // => false - -Obj.is("a string"); // => true -Obj.is(1); // => false - -Func.is("a string"); // => true -Func.is(1); // => false - -Err.is("a string"); // => true -Err.is(1); // => false - -Re.is("a string"); // => true -Re.is(1); // => false - -Dat.is("a string"); // => true -Dat.is(1); // => false - -Nil.is("a string"); // => true -Nil.is(1); // => false - -Any.is("a string"); // => true -Any.is(1); // => false - -Type.is("a string"); // => true -Type.is(1); // => false - -var assert = t.assert; - -assert(t.Str.is("a string")); // => ok -assert(t.Str.is(1)); // => fail! - -var x = -2; -var min = 0; -// throws "-2 should be greater then 0" -assert(x > min, "%s should be greater then %s", x, min); - -Str("a string"); // => ok - -class Point1 { - x: number; - y: number; - constructor(x: number, y: number) { - this.x = Num(x); - this.y = Num(y); - } -} - -var Foo = t.irreducible("Foo", x => { - return t.Bool(x.hasOwnProperty("bar")); -}); - -Foo.is({ bar: "baz" }); // => true - -// defines a type representing positive numbers -var Positive = t.subtype(t.Num, n => { - return n >= 0; -}, "Positive"); - -Positive.is(1); // => true -Positive.is(-1); // => false - -var Country = t.enums({ - IT: "Italy", - US: "United States" -}, "Country"); - -Country.is("IT"); // => true -Country.is("FR"); // => false - -// values will mirror the keys -Country = t.enums.of("IT US", "Country"); - -// same as - -Country = t.enums(["IT", "US"], "Country"); - -// same as - -Country = t.enums({ - IT: "IT", - US: "US" -}, "Country"); - -var Point = t.struct({ +var noop = function () {}; +var Point = struct({ x: Num, y: Num -}, "Point"); - -// constructor usage, `p` is immutable, new is optional -var p2 = new Point({ x: 1, y: 2 }); - -Point.is(p2); // => true - -// now p is mutable -new Point({ x: 1, y: 2 }, true); - -Point.extend({ z: Num }, "Point3D"); - -// multiple inheritance -var A = struct({}); -var B = struct({}); -var MixinC = {}; -var MixinD = {}; -A.extend([B, MixinC, MixinD]); - -var Rectangle = struct({ - width: Num, - height: Num }); -Rectangle.prototype.getArea = function() { - return this.width * this.height; -}; +describe('update', function () { + + var update = t.update; + var Tuple = tuple([Str, Num]); + var List = list(Num); + var Dict = dict(Str, Num); + + it('should handle $set command', function () { + var instance = 1; + var actual = update(instance, {$set: 2}); + eq(actual, 2); + var instance2 = [1, 2, 3]; + actual = update(instance2, {1: {'$set': 4}}); + eq(instance2, [1, 2, 3]); + eq(actual, [1, 4, 3]); + }); + + it('$set and null value, fix #65', function () { + var NullStruct = struct({a: Num, b: maybe(Num)}); + var instance = new NullStruct({a: 1}); + var updated = update(instance, {b: {$set: 2}}); + eq(instance, {a: 1, b: null}); + eq(updated, {a: 1, b: 2}); + }); + + it('should handle $apply command', function () { + var $apply = function (n:any) { return n + 1; }; + var instance = 1; + var actual = update(instance, {$apply: $apply}); + eq(actual, 2); + var instance2 = [1, 2, 3]; + actual = update(instance2, {1: {'$apply': $apply}}); + eq(instance2, [1, 2, 3]); + eq(actual, [1, 3, 3]); + }); + + it('should handle $unshift command', function () { + var actual = update([1, 2, 3], {'$unshift': [4]}); + eq(actual, [4, 1, 2, 3]); + actual = update([1, 2, 3], {'$unshift': [4, 5]}); + eq(actual, [4, 5, 1, 2, 3]); + actual = update([1, 2, 3], {'$unshift': [[4, 5]]}); + eq(actual, [[4, 5], 1, 2, 3]); + }); + + it('should handle $push command', function () { + var actual = update([1, 2, 3], {'$push': [4]}); + eq(actual, [1, 2, 3, 4]); + actual = update([1, 2, 3], {'$push': [4, 5]}); + eq(actual, [1, 2, 3, 4, 5]); + actual = update([1, 2, 3], {'$push': [[4, 5]]}); + eq(actual, [1, 2, 3, [4, 5]]); + }); + + it('should handle $splice command', function () { + var instance = [1, 2, {a: [12, 17, 15]}]; + var actual = update(instance, {2: {a: {$splice: [[1, 1, 13, 14]]}}}); + eq(instance, [1, 2, {a: [12, 17, 15]}]); + eq(actual, [1, 2, {a: [12, 13, 14, 15]}]); + }); + + it('should handle $remove command', function () { + var instance = {a: 1, b: 2}; + var actual = update(instance, {'$remove': ['a']}); + eq(instance, {a: 1, b: 2}); + eq(actual, {b: 2}); + }); + + it('should handle $swap command', function () { + var instance = [1, 2, 3, 4]; + var actual = update(instance, {'$swap': {from: 1, to: 2}}); + eq(instance, [1, 2, 3, 4]); + eq(actual, [1, 3, 2, 4]); + }); + + describe('structs', function () { + + var instance = new Point({x: 0, y: 1}); + + it('should handle $set command', function () { + var updated = update(instance, {x: {$set: 1}}); + eq(instance, {x: 0, y: 1}); + eq(updated, {x: 1, y: 1}); + }); + + it('should handle $apply command', function () { + var updated = update(instance, {x: {$apply: function (x:any) { + return x + 2; + }}}); + eq(instance, {x: 0, y: 1}); + eq(updated, {x: 2, y: 1}); + }); + + it('should handle $merge command', function () { + var updated = update(instance, {'$merge': {x: 2, y: 2}}); + eq(instance, {x: 0, y: 1}); + eq(updated, {x: 2, y: 2}); + var Nested = struct({ + a: Num, + b: struct({ + c: Num, + d: Num, + e: Num + }) + }); + instance = new Nested({a: 1, b: {c: 2, d: 3, e: 4}}); + updated = update(instance, {b: {'$merge': {c: 5, e: 6}}}); + eq(instance, {a: 1, b: {c: 2, d: 3, e: 4}}); + eq(updated, {a: 1, b: {c: 5, d: 3, e: 6}}); + }); + + }); + + describe('tuples', function () { + + var instance = Tuple(['a', 1]); + + it('should handle $set command', function () { + var updated = update(instance, {0: {$set: 'b'}}); + eq(updated, ['b', 1]); + }); + + }); + + describe('lists', function () { + + var instance = List([1, 2, 3, 4]); + + it('should handle $set command', function () { + var updated = update(instance, {2: {$set: 5}}); + eq(updated, [1, 2, 5, 4]); + }); + + it('should handle $splice command', function () { + var updated = update(instance, {$splice: [[1, 2, 5, 6]]}); + eq(updated, [1, 5, 6, 4]); + }); + + it('should handle $concat command', function () { + var updated = update(instance, {$push: [5]}); + eq(updated, [1, 2, 3, 4, 5]); + updated = update(instance, {$push: [5, 6]}); + eq(updated, [1, 2, 3, 4, 5, 6]); + }); + + it('should handle $prepend command', function () { + var updated = update(instance, {$unshift: [5]}); + eq(updated, [5, 1, 2, 3, 4]); + updated = update(instance, {$unshift: [5, 6]}); + eq(updated, [5, 6, 1, 2, 3, 4]); + }); + + it('should handle $swap command', function () { + var updated = update(instance, {$swap: {from: 1, to: 2}}); + eq(updated, [1, 3, 2, 4]); + }); + + }); + + describe('dicts', function () { + + var instance = Dict({a: 1, b: 2}); + + it('should handle $set command', function () { + var updated = update(instance, {a: {$set: 2}}); + eq(updated, {a: 2, b: 2}); + }); + + it('should handle $remove command', function () { + var updated = update(instance, {$remove: ['a']}); + eq(updated, {b: 2}); + }); + + }); + + describe('memory saving', function () { + + it('should reuse members that are not updated', function () { + var Struct = struct({ + a: Num, + b: Str, + c: tuple([Num, Num]), + }); + var List = list(Struct); + var instance = List([{ + a: 1, + b: 'one', + c: [1000, 1000000] + },{ + a: 2, + b: 'two', + c: [2000, 2000000] + }]); + + var updated = update(instance, { + 1: { + a: {$set: 119} + } + }); + + assert.strictEqual(( updated)[0], ( instance)[0]); + assert.notStrictEqual(( updated)[1], ( instance)[1]); + assert.strictEqual(( updated)[1].c, ( instance)[1].c); + }); + }); + + describe('all together now', function () { + + it('should handle mixed commands', function () { + var Struct = struct({ + a: Num, + b: Tuple, + c: List, + d: Dict + }); + var instance = new Struct({ + a: 1, + b: ['a', 1], + c: [1, 2, 3, 4], + d: {a: 1, b: 2} + }); + var updated = update(instance, { + a: {$set: 1}, + b: {0: {$set: 'b'}}, + c: {2: {$set: 5}}, + d: {$remove: ['a']} + }); + eq(updated, { + a: 1, + b: ['b', 1], + c: [1, 2, 5, 4], + d: {b: 2} + }); + }); + + it('should handle nested structures', function () { + var Struct = struct({ + a: struct({ + b: tuple([ + Str, + list(Num) + ]) + }) + }); + var instance = new Struct({ + a: { + b: ['a', [1, 2, 3]] + } + }); + var updated = update(instance, { + a: {b: {1: {2: {$set: 4}}}} + }); + eq(updated, { + a: { + b: ['a', [1, 2, 4]] + } + }); + }); + + }); -var Cube = Rectangle.extend({ - thickness: Num }); -// typeof Cube.prototype.getArea === 'function' -Cube.prototype.getVolume = function() { - return this.getArea() * this.thickness; -}; +// +// assert +// -var Area = tuple([Num, Num]); +describe('assert', function () { -// constructor usage, `area` is immutable -Area([1, 2]); + var assert = t.assert; -var Path = list(Point); + it('should nor throw when guard is true', function () { + assert(true); + }); -// costructor usage, `path` is immutable -Path([ - { x: 0, y: 0 }, // tcomb hydrates automatically using the `Point` constructor - { x: 1, y: 1 } -]); + it('should throw a default message', function () { + throwsWithMessage(function () { + assert(1 === 2); + }, 'assert failed'); + }); -var Tel = dict(Str, Num); + it('should throw the specified message', function () { + throwsWithMessage(function () { + assert(1 === 2, 'my message'); + }, 'my message'); + }); -// costructor usage, `tel` is immutable -Tel({ jack: 4098, sape: 4139 }); + it('should format the specified message', function () { + throwsWithMessage(function () { + assert(1 === 2, '%s !== %s', 1, 2); + }, '1 !== 2'); + }); -var ReactKey = union([Str, Num]); + it('should handle custom fail behaviour', function () { + var fail = t.fail; + t.fail = function (message) { + try { + throw new Error(message); + } catch (e) { + eq(e.message, 'report error'); + } + }; + doesNotThrow(function () { + assert(1 === 2, 'report error'); + }); + t.fail = fail; + }); -ReactKey.is("a"); // => true -ReactKey.is(1); // => true -ReactKey.is(true); // => false +}); -ReactKey.dispatch = x => { - if (Str.is(x)) return Str; - if (Num.is(x)) return Num; - return Any; -}; +// +// utils +// -// now you can do this without a fail -ReactKey("a"); +describe('format(str, [...])', function () { -// the value of a radio input where null = no selection -var Radio = maybe(Str); + it('should format strings', function () { + eq(format('%s', 'a'), 'a'); + eq(format('%s', 2), '2'); + eq(format('%s === %s', 1, 1), '1 === 1'); + }); -Radio.is("a"); // => true -Radio.is(null); // => true -Radio.is(1); // => false + it('should format JSON', function () { + eq(format('%j', {a: 1}), '{"a":1}'); + }); -// add takes two `Num`s and returns a `Num` -var add = func([Num, Num], Num) - .of((x: number, y: number) => { return x + y; }); + it('should handle undefined formatters', function () { + eq(format('%o', 'a'), '%o a'); + }); -add("Hello", 2); // Raises error: Invalid `Hello` supplied to `Num` -add("Hello"); // Raises error: Invalid `Hello` supplied to `Num` + it('should handle escaping %', function () { + eq(format('%%s'), '%s'); + }); -add(1, 2); // Returns: 3 -add(1)(2); // Returns: 3 + it('should not consume an argument with a single %', function () { + eq(format('%s%', '100'), '100%'); + }); -// An `A` takes a `Str` and returns an `Num` -func(Str, Num); + it('should handle less arguments than placeholders', function () { + eq(format('%s %s', 'a'), 'a %s'); + }); -// A `B` takes a `Func` (which takes a `Str` and returns a `Num`) and returns a `Str`. -func(func(Str, Num), Str); + it('should handle more arguments than placeholders', function () { + eq(format('%s', 'a', 'b', 'c'), 'a b c'); + }); -// An `ExcitedStr` is a `Str` containing an exclamation mark -var ExcitedStr = subtype(Str, s => { return s.indexOf("!") !== -1; }, "ExcitedStr"); + it('should be extensible', function () { + (format).formatters.l = function (x:any) { return x.length; }; + eq(format('%l', ['a', 'b', 'c']), '3'); + }); -// An `Exciter` takes a `Str` and returns an `ExcitedStr` -var Exciter = func(Str, ExcitedStr); +}); -// A `C` takes an `A`, a `B` and a `Str` and returns a `Num` -func([A, B, Str], Num); +describe('mixin(x, y, [overwrite])', function () { -func(A, B).of(() => {}); + it('should mix two objects', function () { + var o1 = {a: 1}; + var o2 = {b: 2}; + var o3 = mixin(o1, o2); + ok(o3 === o1); + eq(o3.a, 1); + eq(o3.b, 2); + }); -var simpleQuestionator = Exciter.of((s: string) => { return s + "?"; }); -var simpleExciter = Exciter.of((s: string) => { return s + "!"; }); + it('should throw if a property already exists', function () { + throwsWithMessage(function () { + var o1 = {a: 1}; + var o2 = {a: 2, b: 2}; + mixin(o1, o2); + }, 'Cannot overwrite property a'); + }); -// Raises error: -// Invalid `Hello?` supplied to `ExcitedStr`, insert a valid value for the subtype -simpleQuestionator("Hello"); + it('should not throw if a property already exists but overwrite = true', function () { + var o1 = {a: 1}; + var o2 = {a: 2, b: 2}; + var o3 = mixin(o1, o2, true); + eq(o3.a, 2); + eq(o3.b, 2); + }); -// Raises error: Invalid `1` supplied to `Str` -simpleExciter(1); + it('should not mix prototype properties', function () { + function F() {} + F.prototype.method = noop; + var source = new (F)(); + var target = {}; + mixin(target, source); + eq((target).method, undefined); + }); -// Returns: "Hello!" -simpleExciter("Hello"); +}); -// We can reasonably suggest that add has the following type signature -// add : Num -> Num -> Num -add = func([Num, Num], Num) - .of((x: number, y: number) => { return x + y }); +describe('getFunctionName(f, [defaultName])', function () { -add("Hello"); // As this raises: "Error: Invalid `Hello` supplied to `Num`" + var getFunctionName = t.getFunctionName; -var add2 = add(2); -add2(1); // And this returns: 3 + it('should return the name of a named function', function () { + eq(getFunctionName(function myfunc(){}), 'myfunc'); + }); -func(A, B).is(x); + it('should return the value of `displayName` if specified', function () { + var f = function myfunc(){}; + (f).displayName = 'mydisplayname'; + eq(getFunctionName(f), 'mydisplayname'); + }); -Exciter.is(simpleExciter); // Returns: true -Exciter.is(simpleQuestionator); // Returns: true + it('should fallback on function arity if nothing is specified', function () { + eq(getFunctionName(function (a:any, b:any, c:any) { return a + b + c; }), ''); + }); -var id = (x: number) => { return x; }; +}); -func([Num, Num], Num).is(func([Num, Num], Num).of(id)); // Returns: true -func([Num, Num], Num).is(func(Num, Num).of(id)); // Returns: false +describe('getTypeName(type)', function () { -var p4 = new Point({x: 1, y: 2}); + var UnnamedStruct = struct({}); + var NamedStruct = struct({}, 'NamedStruct'); + var UnnamedUnion = union([Str, Num]); + var NamedUnion = union([Str, Num], 'NamedUnion'); + var UnnamedMaybe = maybe(Str); + var NamedMaybe = maybe(Str, 'NamedMaybe'); + var UnnamedEnums = enums({a: 'A', b: 'B'}); + var NamedEnums = enums({}, 'NamedEnums'); + var UnnamedTuple = tuple([Str, Num]); + var NamedTuple = tuple([Str, Num], 'NamedTuple'); + var UnnamedSubtype = subtype(Str, function notEmpty(x) { return x !== ''; }); + var NamedSubtype = subtype(Str, function (x) { return x !== ''; }, 'NamedSubtype'); + var UnnamedList = list(Str); + var NamedList = list(Str, 'NamedList'); + var UnnamedDict = dict(Str, Str); + var NamedDict = dict(Str, Str, 'NamedDict'); + var UnnamedFunc = func(Str, Str); + var NamedFunc = func(Str, Str, 'NamedFunc'); -p4 = Point.update(p4, { x: { "$set": 3 } }); // => {x: 3, y: 2} + it('should return the name of a named type', function () { + eq(getTypeName(NamedStruct), 'NamedStruct'); + eq(getTypeName(NamedUnion), 'NamedUnion'); + eq(getTypeName(NamedMaybe), 'NamedMaybe'); + eq(getTypeName(NamedEnums), 'NamedEnums'); + eq(getTypeName(NamedTuple), 'NamedTuple'); + eq(getTypeName(NamedSubtype), 'NamedSubtype'); + eq(getTypeName(NamedList), 'NamedList'); + eq(getTypeName(NamedDict), 'NamedDict'); + eq(getTypeName(NamedFunc), 'NamedFunc'); + }); -var Type2 = dict(Str, Num); -var instance = Type2({ a: 1, b: 2 }); -Type2.update(instance, { $remove: ["a"] }); // => {b: 2} + it('should return a meaningful name of a unnamed type', function () { + eq(getTypeName(UnnamedStruct), '{}'); + eq(getTypeName(UnnamedUnion), 'Str | Num'); + eq(getTypeName(UnnamedMaybe), '?Str'); + eq(getTypeName(UnnamedEnums), '"a" | "b"'); + eq(getTypeName(UnnamedTuple), '[Str, Num]'); + eq(getTypeName(UnnamedSubtype), '{Str | notEmpty}'); + eq(getTypeName(UnnamedList), 'Array'); + eq(getTypeName(UnnamedDict), '{[key:Str]: Str}'); + eq(getTypeName(UnnamedFunc), '(Str) => Str'); + }); -var Type3 = list(Num); -var instance2 = Type3([1, 2, 3, 4]); -Type3.update(instance2, { "$swap": { from: 1, to: 2 } }); // => [1, 3, 2, 4] +}); -t.options.onFail = message => { - return message; -}; +// +// Any +// -t.format("Invalid argument `name` = `%s` supplied to `%s`", 1, "MyType"); +describe('Any', function () { -t.getKind(Str); // => 'irreducible' -t.getKind(list(Str)); // => 'list' + var T = Any; -t.getFunctionName(t.getKind); // => 'getKind' -t.getFunctionName(() => { }); // => '' + describe('constructor', function () { -t.getTypeName(Str); + it('should behave like identity', function () { + eq(Any('a'), 'a'); + }); -t.mixin({ a: 1 }, { b: 2 }); // => {a: 1, b: 2} -t.mixin({ a: 1 }, { a: 2 }); // => fail! + it('should throw if used with new', function () { + throwsWithMessage(function () { + /* jshint ignore:start */ + var x = new (T)(); + /* jshint ignore:end */ + }, 'Operator `new` is forbidden for type `Any`'); + }); + + }); + + describe('#is(x)', function () { + + it('should always return true', function () { + ok(T.is(null)); + ok(T.is(undefined)); + ok(T.is(0)); + ok(T.is(true)); + ok(T.is('')); + ok(T.is([])); + ok(T.is({})); + ok(T.is(noop)); + ok(T.is(/a/)); + ok(T.is(new RegExp('a'))); + ok(T.is(new Error())); + }); + + }); + +}); + +// +// irreducible types +// + +describe('irreducible types constructors', function () { + + [ + {T: Nil, x: null}, + {T: Str, x: 'a'}, + {T: Num, x: 1}, + {T: Bool, x: true}, + {T: Arr, x: []}, + {T: Obj, x: {}}, + {T: Func, x: noop}, + {T: Err, x: new Error()}, + {T: Re, x: /a/}, + {T: Dat, x: new Date()} + ].forEach(function (o) { + + var T = o.T; + var x = o.x; + + it('should accept only valid values', function () { + eq(T(x), x); + }); + + it('should throw if used with new', function () { + throwsWithMessage(function () { + /* jshint ignore:start */ + var x = new (T) (); + /* jshint ignore:end */ + }, 'Operator `new` is forbidden for type `' + getTypeName(T) + '`'); + }); + + }); + +}); + +describe('Nil', function () { + + describe('#is(x)', function () { + + it('should return true when x is null or undefined', function () { + ok(Nil.is(null)); + ok(Nil.is(undefined)); + }); + + it('should return false when x is neither null nor undefined', function () { + ko(Nil.is(0)); + ko(Nil.is(true)); + ko(Nil.is('')); + ko(Nil.is([])); + ko(Nil.is({})); + ko(Nil.is(noop)); + ko(Nil.is(new Error())); + ko(Nil.is(new Date())); + ko(Nil.is(/a/)); + ko(Nil.is(new RegExp('a'))); + }); + + }); + +}); + +describe('Bool', function () { + + describe('#is(x)', function () { + + it('should return true when x is true or false', function () { + ok(Bool.is(true)); + ok(Bool.is(false)); + }); + + it('should return false when x is neither true nor false', function () { + ko(Bool.is(null)); + ko(Bool.is(undefined)); + ko(Bool.is(0)); + ko(Bool.is('')); + ko(Bool.is([])); + ko(Bool.is({})); + ko(Bool.is(noop)); + ko(Bool.is(/a/)); + ko(Bool.is(new RegExp('a'))); + ko(Bool.is(new Error())); + ko(Bool.is(new Date())); + }); + + }); + +}); + +describe('Num', function () { + + describe('#is(x)', function () { + + it('should return true when x is a number', function () { + ok(Num.is(0)); + ok(Num.is(1)); + /* jshint ignore:start */ + ko(Num.is(new Number(1))); + /* jshint ignore:end */ + }); + + it('should return false when x is not a number', function () { + ko(Num.is(NaN)); + ko(Num.is(Infinity)); + ko(Num.is(-Infinity)); + ko(Num.is(null)); + ko(Num.is(undefined)); + ko(Num.is(true)); + ko(Num.is('')); + ko(Num.is([])); + ko(Num.is({})); + ko(Num.is(noop)); + ko(Num.is(/a/)); + ko(Num.is(new RegExp('a'))); + ko(Num.is(new Error())); + ko(Num.is(new Date())); + }); + + }); + +}); + +describe('Str', function () { + + describe('#is(x)', function () { + + it('should return true when x is a string', function () { + ok(Str.is('')); + ok(Str.is('a')); + /* jshint ignore:start */ + ko(Str.is(new String('a'))); + /* jshint ignore:end */ + }); + + it('should return false when x is not a string', function () { + ko(Str.is(NaN)); + ko(Str.is(Infinity)); + ko(Str.is(-Infinity)); + ko(Str.is(null)); + ko(Str.is(undefined)); + ko(Str.is(true)); + ko(Str.is(1)); + ko(Str.is([])); + ko(Str.is({})); + ko(Str.is(noop)); + ko(Str.is(/a/)); + ko(Str.is(new RegExp('a'))); + ko(Str.is(new Error())); + ko(Str.is(new Date())); + }); + + }); + +}); + +describe('Arr', function () { + + describe('#is(x)', function () { + + it('should return true when x is an array', function () { + ok(Arr.is([])); + }); + + it('should return false when x is not an array', function () { + ko(Arr.is(NaN)); + ko(Arr.is(Infinity)); + ko(Arr.is(-Infinity)); + ko(Arr.is(null)); + ko(Arr.is(undefined)); + ko(Arr.is(true)); + ko(Arr.is(1)); + ko(Arr.is('a')); + ko(Arr.is({})); + ko(Arr.is(noop)); + ko(Arr.is(/a/)); + ko(Arr.is(new RegExp('a'))); + ko(Arr.is(new Error())); + ko(Arr.is(new Date())); + }); + + }); + +}); + +describe('Obj', function () { + + describe('#is(x)', function () { + + it('should return true when x is an object', function () { + function A() {} + ok(Obj.is({})); + ok(Obj.is(new (A)())); + }); + + it('should return false when x is not an object', function () { + ko(Obj.is(null)); + ko(Obj.is(undefined)); + ko(Obj.is(0)); + ko(Obj.is('')); + ko(Obj.is([])); + ko(Obj.is(noop)); + }); + + }); + +}); + +describe('Func', function () { + + describe('#is(x)', function () { + + it('should return true when x is a function', function () { + ok(Func.is(noop)); + /* jshint ignore:start */ + ok(Func.is(new Function())); + /* jshint ignore:end */ + }); + + it('should return false when x is not a function', function () { + ko(Func.is(null)); + ko(Func.is(undefined)); + ko(Func.is(0)); + ko(Func.is('')); + ko(Func.is([])); + /* jshint ignore:start */ + ko(Func.is(new String('1'))); + ko(Func.is(new Number(1))); + ko(Func.is(new Boolean())); + /* jshint ignore:end */ + ko(Func.is(/a/)); + ko(Func.is(new RegExp('a'))); + ko(Func.is(new Error())); + ko(Func.is(new Date())); + }); + + }); + +}); + +describe('Err', function () { + + describe('#is(x)', function () { + + it('should return true when x is an error', function () { + ok(Err.is(new Error())); + }); + + it('should return false when x is not an error', function () { + ko(Err.is(null)); + ko(Err.is(undefined)); + ko(Err.is(0)); + ko(Err.is('')); + ko(Err.is([])); + /* jshint ignore:start */ + ko(Err.is(new String('1'))); + ko(Err.is(new Number(1))); + ko(Err.is(new Boolean())); + /* jshint ignore:end */ + ko(Err.is(/a/)); + ko(Err.is(new RegExp('a'))); + ko(Err.is(new Date())); + }); + + }); + +}); + +describe('Re', function () { + + describe('#is(x)', function () { + + it('should return true when x is a regexp', function () { + ok(Re.is(/a/)); + ok(Re.is(new RegExp('a'))); + }); + + it('should return false when x is not a regexp', function () { + ko(Re.is(null)); + ko(Re.is(undefined)); + ko(Re.is(0)); + ko(Re.is('')); + ko(Re.is([])); + /* jshint ignore:start */ + ko(Re.is(new String('1'))); + ko(Re.is(new Number(1))); + ko(Re.is(new Boolean())); + /* jshint ignore:end */ + ko(Re.is(new Error())); + ko(Re.is(new Date())); + }); + + }); + +}); + +describe('Dat', function () { + + describe('#is(x)', function () { + + it('should return true when x is a Dat', function () { + ok(Dat.is(new Date())); + }); + + it('should return false when x is not a Dat', function () { + ko(Dat.is(null)); + ko(Dat.is(undefined)); + ko(Dat.is(0)); + ko(Dat.is('')); + ko(Dat.is([])); + /* jshint ignore:start */ + ko(Dat.is(new String('1'))); + ko(Dat.is(new Number(1))); + ko(Dat.is(new Boolean())); + /* jshint ignore:end */ + ko(Dat.is(new Error())); + ko(Dat.is(/a/)); + ko(Dat.is(new RegExp('a'))); + }); + + }); + +}); + +// +// struct +// + +describe('struct', function () { + + describe('combinator', function () { + + it('should throw if used with wrong arguments', function () { + + throwsWithMessage(function () { + (struct)(); + }, 'Invalid argument `props` = `undefined` supplied to `struct` combinator'); + + throwsWithMessage(function () { + struct({a: null}); + }, 'Invalid argument `props` = `[object Object]` supplied to `struct` combinator'); + + throwsWithMessage(function () { + (struct)({}, 1); + }, 'Invalid argument `name` = `1` supplied to `struct` combinator'); + + }); + + }); + describe('constructor', function () { + + it('should be idempotent', function () { + var T = Point; + var p1 = T({x: 0, y: 0}); + var p2 = T(p1); + eq(Object.isFrozen(p1), true); + eq(Object.isFrozen(p2), true); + eq(p2 === p1, true); + }); + + it('should accept only valid values', function () { + throwsWithMessage(function () { + Point(1); + }, 'Invalid argument `value` = `1` supplied to struct type `{x: Num, y: Num}`'); + }); + + }); + + describe('#is(x)', function () { + + it('should return true when x is an instance of the struct', function () { + var p = new Point({ x: 1, y: 2 }); + ok(Point.is(p)); + }); + + }); + + describe('#update()', function () { + + var Type = struct({name: Str}); + var instance = new Type({name: 'Giulio'}); + + it('should return a new instance', function () { + var newInstance = Type.update(instance, {name: {$set: 'Canti'}}); + ok(Type.is(newInstance)); + eq( ( instance).name, 'Giulio'); + eq(( newInstance).name, 'Canti'); + }); + + }); + + describe('#extend(props, [name])', function () { + + it('should extend an existing struct', function () { + var Point = struct({ + x: Num, + y: Num + }, 'Point'); + var Point3D = Point.extend({z: Num}, 'Point3D'); + eq(getTypeName(Point3D), 'Point3D'); + eq((Point3D).meta.props.x, Num); + eq((Point3D).meta.props.y, Num); + eq((Point3D).meta.props.z, Num); + }); + + it('should handle an array as argument', function () { + var Type = struct({a: Str}, 'Type'); + var Mixin = [{b: Num, c: Bool}]; + var NewType = Type.extend(Mixin, 'NewType'); + eq(getTypeName(NewType), 'NewType'); + eq((NewType).meta.props.a, Str); + eq((NewType).meta.props.b, Num); + eq((NewType).meta.props.c, Bool); + }); + + it('should handle a struct (or list of structs) as argument', function () { + var A = struct({a: Str}, 'A'); + var B = struct({b: Str}, 'B'); + var C = struct({c: Str}, 'C'); + var MixinD = {d: Str}; + var E = A.extend([B, C, MixinD]); + eq(E.meta.props, { + a: Str, + b: Str, + c: Str, + d: Str + }); + }); + + it('should support prototypal inheritance', function () { + var Rectangle = struct({ + w: Num, + h: Num + }, 'Rectangle'); + Rectangle.prototype.area = function () { + return this.w * this.h; + }; + var Cube = Rectangle.extend({ + l: Num + }); + Cube.prototype.volume = function () { + return this.area() * this.l; + }; + + assert('function' === typeof Rectangle.prototype.area); + assert('function' === typeof Cube.prototype.area); + assert(undefined === Rectangle.prototype.volume); + assert('function' === typeof Cube.prototype.volume); + assert(Cube.prototype.constructor === Cube); + + var c = new Cube({w:2, h:2, l:2}); + eq((c).volume(), 8); + }); + + }); + +}); + +// +// enums +// + +describe('enums', function () { + + describe('combinator', function () { + + it('should throw if used with wrong arguments', function () { + + throwsWithMessage(function () { + (enums)(); + }, 'Invalid argument `map` = `undefined` supplied to `enums` combinator'); + + throwsWithMessage(function () { + (enums)({}, 1); + }, 'Invalid argument `name` = `1` supplied to `enums` combinator'); + + }); + + }); + + describe('constructor', function () { + + var T = enums({a: 0}, 'T'); + + it('should throw if used with new', function () { + throwsWithMessage(function () { + /* jshint ignore:start */ + var x = new (T)('a'); + /* jshint ignore:end */ + }, 'Operator `new` is forbidden for type `T`'); + }); + + it('should accept only valid values', function () { + eq((T)('a'), 'a'); + throwsWithMessage(function () { + (T)('b'); + }, 'Invalid argument `value` = `b` supplied to enums type `T`, expected one of ["a"]'); + }); + + }); + + describe('#is(x)', function () { + + var Direction = enums({ + North: 0, + East: 1, + South: 2, + West: 3, + 1: 'North-East', + 2.5: 'South-East' + }); + + it('should return true when x is an instance of the enum', function () { + ok(Direction.is('North')); + ok(Direction.is(1)); + ok(Direction.is('1')); + ok(Direction.is(2.5)); + }); + + it('should return false when x is not an instance of the enum', function () { + ko(Direction.is('North-East')); + ko(Direction.is(2)); + }); + + }); + + describe('#of(keys)', function () { + + it('should return an enum', function () { + var Size = (enums).of(['large', 'small', 1, 10.9]); ///!!! + ok(Size.meta.map.large === 'large'); + ok(Size.meta.map.small === 'small'); + ok(Size.meta.map['1'] === 1); + ok(Size.meta.map[10.9] === 10.9); + }); + + it('should handle a string', function () { + var Size = (enums).of('large small 10'); + ok(Size.meta.map.large === 'large'); + ok(Size.meta.map.small === 'small'); + ok(Size.meta.map['10'] === '10'); + ok(Size.meta.map[10] === '10'); + }); + + }); + +}); + +// +// union +// + +describe('union', function () { + + var Circle = struct({ + center: Point, + radius: Num + }, 'Circle'); + + var Rectangle = struct({ + a: Point, + b: Point + }); + + var Shape = union([Circle, Rectangle], 'Shape'); + + Shape.dispatch = function (values) { + assert(Obj.is(values)); + return values.hasOwnProperty('center') ? + Circle : + Rectangle; + }; + + describe('combinator', function () { + + it('should throw if used with wrong arguments', function () { + + throwsWithMessage(function () { + (union)(); + }, 'Invalid argument `types` = `undefined` supplied to `union` combinator'); + + throwsWithMessage(function () { + union([]); + }, 'Invalid argument `types` = `` supplied to `union` combinator, provide at least two types'); + + throwsWithMessage(function () { + union([Circle]); + }, 'Invalid argument `types` = `Circle` supplied to `union` combinator, provide at least two types'); + + throwsWithMessage(function () { + (union)([Circle, Point], 1); + }, 'Invalid argument `name` = `1` supplied to `union` combinator'); + + }); + + }); + + describe('constructor', function () { + + it('should throw when dispatch() is not implemented', function () { + throwsWithMessage(function () { + var T = union([Str, Num], 'T'); + T.dispatch = null; + T(1); + }, 'Unimplemented `dispatch()` function for union type `T`'); + }); + + it('should have a default dispatch() implementation', function () { + var T = union([Str, Num], 'T'); + eq(T(1), 1); + }); + + it('should throw when dispatch() does not return a type', function () { + throwsWithMessage(function () { + var T = union([Str, Num], 'T'); + T(true); + }, 'The `dispatch()` function of union type `T` returns no type constructor'); + }); + + it('should build instances when dispatch() is implemented', function () { + var circle = Shape({center: {x: 0, y: 0}, radius: 10}); + ok(Circle.is(circle)); + }); + + it('should throw if used with new and union types are not instantiables with new', function () { + throwsWithMessage(function () { + var T = union([Str, Num], 'T'); + T.dispatch = function () { return Str; }; + /* jshint ignore:start */ + var x = new T('a'); + /* jshint ignore:end */ + }, 'Operator `new` is forbidden for type `T`'); + }); + + it('should not throw if used with new and union types are instantiables with new', function () { + doesNotThrow(function () { + Shape({center: {x: 0, y: 0}, radius: 10}); + }); + }); + + it('should be idempotent', function () { + var p1 = Shape({center: {x: 0, y: 0}, radius: 10}); + var p2 = Shape(p1); + eq(Object.isFrozen(p1), true); + eq(Object.isFrozen(p2), true); + eq(p2 === p1, true); + }); + + }); + + describe('#is(x)', function () { + + it('should return true when x is an instance of the union', function () { + var p = new Circle({center: { x: 0, y: 0 }, radius: 10}); + ok(Shape.is(p)); + }); + + }); + +}); + +// +// maybe +// + +describe('maybe', function () { + + describe('combinator', function () { + + it('should throw if used with wrong arguments', function () { + + throwsWithMessage(function () { + (maybe)(); + }, 'Invalid argument `type` = `undefined` supplied to `maybe` combinator'); + + throwsWithMessage(function () { + (maybe)(Point, 1); + }, 'Invalid argument `name` = `1` supplied to `maybe` combinator'); + + }); + + it('should be idempotent', function () { + var MaybeStr = maybe(Str); + ok(maybe(MaybeStr) === MaybeStr); + }); + + it('should be noop with Any', function () { + ok(maybe(Any) === Any); + }); + + it('should be noop with Nil', function () { + ok((maybe)(Nil) === Nil); + }); + + }); + + describe('constructor', function () { + + it('should throw if used with new', function () { + throwsWithMessage(function () { + /* jshint ignore:start */ + var T = maybe(Str, 'T'); + var x = new (T)(); + /* jshint ignore:end */ + }, 'Operator `new` is forbidden for type `T`'); + }); + + it('should coerce values', function () { + var T = maybe(Point); + eq(T(null), null); + eq(T(undefined), null); + ok(Point.is(T({x: 0, y: 0}))); + }); + + it('should be idempotent', function () { + var T = maybe(Point); + var p1 = T({x: 0, y: 0}); + var p2 = T(p1); + eq(Object.isFrozen(p1), true); + eq(Object.isFrozen(p2), true); + eq(p2 === p1, true); + }); + + }); + + describe('#is(x)', function () { + + it('should return true when x is an instance of the maybe', function () { + var Radio = maybe(Str); + ok(Radio.is('a')); + ok(Radio.is(null)); + ok(Radio.is(undefined)); + }); + + }); + +}); + +// +// tuple +// + +describe('tuple', function () { + + var Area = tuple([Num, Num], 'Area'); + + describe('combinator', function () { + + it('should throw if used with wrong arguments', function () { + + throwsWithMessage(function () { + (tuple)(); + }, 'Invalid argument `types` = `undefined` supplied to `tuple` combinator'); + + throwsWithMessage(function () { + (tuple)([Point, Point], 1); + }, 'Invalid argument `name` = `1` supplied to `tuple` combinator'); + + }); + + }); + + describe('constructor', function () { + + var S = struct({}, 'S'); + var T = tuple([S, S], 'T'); + + it('should coerce values', function () { + var t = T([{}, {}]); + ok(S.is(( t)[0])); + ok(S.is(( t)[1])); + }); + + it('should accept only valid values', function () { + + throwsWithMessage(function () { + T(1); + }, 'Invalid argument `value` = `1` supplied to tuple type `T`, expected an `Arr` of length `2`'); + + throwsWithMessage(function () { + T([1, 1]); + }, 'Invalid argument `value` = `1` supplied to struct type `S`'); + + }); + + it('should be idempotent', function () { + var T = tuple([Str, Num]); + var p1 = T(['a', 1]); + var p2 = T(p1); + eq(Object.isFrozen(p1), true); + eq(Object.isFrozen(p2), true); + eq(p2 === p1, true); + }); + + }); + + describe('#is(x)', function () { + + it('should return true when x is an instance of the tuple', function () { + ok(Area.is([1, 2])); + }); + + it('should return false when x is not an instance of the tuple', function () { + ko(Area.is([1])); + ko(Area.is([1, 2, 3])); + ko(Area.is([1, 'a'])); + }); + + it('should not depend on `this`', function () { + ok([[1, 2]].every(Area.is)); + }); + + }); + + describe('#update()', function () { + + var Type = tuple([Str, Num]); + var instance = Type(['a', 1]); + + it('should return a new instance', function () { + var newInstance = Type.update(instance, {0: {$set: 'b'}}); + assert(Type.is(newInstance)); + assert(( instance)[0] === 'a'); + assert(( newInstance)[0] === 'b'); + }); + + }); + +}); + +// +// list +// + +describe('list', function () { + + describe('combinator', function () { + + it('should throw if used with wrong arguments', function () { + + throwsWithMessage(function () { + (list)(); + }, 'Invalid argument `type` = `undefined` supplied to `list` combinator'); + + throwsWithMessage(function () { + (list)(Point, 1); + }, 'Invalid argument `name` = `1` supplied to `list` combinator'); + + }); + + }); + + describe('constructor', function () { + + var S = struct({}, 'S'); + var T = list(S, 'T'); + + it('should coerce values', function () { + var t = T([{}]); + ok(S.is(( t)[0])); + }); + + it('should accept only valid values', function () { + + throwsWithMessage(function () { + T(1); + }, 'Invalid argument `value` = `1` supplied to list type `T`'); + + throwsWithMessage(function () { + T([1]); + }, 'Invalid argument `value` = `1` supplied to struct type `S`'); + + }); + + it('should be idempotent', function () { + var T = list(Num); + var p1 = T([1, 2]); + var p2 = T(p1); + eq(Object.isFrozen(p1), true); + eq(Object.isFrozen(p2), true); + eq(p2 === p1, true); + }); + + }); + + describe('#is(x)', function () { + + var Path = list(Point); + var p1 = new Point({x: 0, y: 0}); + var p2 = new Point({x: 1, y: 1}); + + it('should return true when x is a list', function () { + ok(Path.is([p1, p2])); + }); + + it('should not depend on `this`', function () { + ok([[p1, p2]].every(Path.is)); + }); + + }); + + describe('#update()', function () { + + var Type = list(Str); + var instance = Type(['a', 'b']); + + it('should return a new instance', function () { + var newInstance = Type.update(instance, {'$push': ['c']}); + assert(Type.is(newInstance)); + assert((instance).length === 2); + assert((newInstance).length === 3); + }); + + }); + +}); + +// +// subtype +// + +describe('subtype', function () { + + var True = function () { return true; }; + + describe('combinator', function () { + + it('should throw if used with wrong arguments', function () { + + throwsWithMessage(function () { + (subtype)(); + }, 'Invalid argument `type` = `undefined` supplied to `subtype` combinator'); + + throwsWithMessage(function () { + subtype(Point, null); + }, 'Invalid argument `predicate` = `null` supplied to `subtype` combinator'); + + throwsWithMessage(function () { + (subtype)(Point, True, 1); + }, 'Invalid argument `name` = `1` supplied to `subtype` combinator'); + + }); + + }); + + describe('constructor', function () { + + it('should throw if used with new and a type that is not instantiable with new', function () { + throwsWithMessage(function () { + /* jshint ignore:start */ + var T = subtype(Str, function () { return true; }, 'T'); + var x = new( T)(); + /* jshint ignore:end */ + }, 'Operator `new` is forbidden for type `T`'); + }); + + it('should coerce values', function () { + var T = subtype(Point, function () { return true; }); + var p = T({x: 0, y: 0}); + ok(Point.is(p)); + }); + + it('should accept only valid values', function () { + var predicate = function (p:any) { return p.x > 0; }; + var T = subtype(Point, predicate, 'T'); + throwsWithMessage(function () { + T({x: 0, y: 0}); + }, 'Invalid argument `value` = `[object Object]` supplied to subtype type `T`'); + }); + + }); + + describe('#is(x)', function () { + + var Positive = subtype(Num, function (n) { + return n >= 0; + }); + + it('should return true when x is a subtype', function () { + ok(Positive.is(1)); + }); + + it('should return false when x is not a subtype', function () { + ko(Positive.is(-1)); + }); + + }); + + describe('#update()', function () { + + var Type = subtype(Str, function (s) { return s.length > 2; }); + var instance = Type('abc'); + + it('should return a new instance', function () { + var newInstance = Type.update(instance, {'$set': 'bca'}); + assert(Type.is(newInstance)); + eq(newInstance, 'bca'); + }); + + }); + +}); + +// +// dict +// + +describe('dict', function () { + + describe('combinator', function () { + + it('should throw if used with wrong arguments', function () { + + throwsWithMessage(function () { + (dict)(); + }, 'Invalid argument `domain` = `undefined` supplied to `dict` combinator'); + + throwsWithMessage(function () { + (dict)(Str); + }, 'Invalid argument `codomain` = `undefined` supplied to `dict` combinator'); + + throwsWithMessage(function () { + (dict)(Str, Point, 1); + }, 'Invalid argument `name` = `1` supplied to `dict` combinator'); + + }); + + }); + + describe('constructor', function () { + + var S = struct({}, 'S'); + var Domain = subtype(Str, function (x) { + return x !== 'forbidden'; + }, 'Domain'); + var T = dict(Domain, S, 'T'); + + it('should coerce values', function () { + var t = T({a: {}}); + ok(S.is((t).a)); + }); + + it('should accept only valid values', function () { + + throwsWithMessage(function () { + T(1); + }, 'Invalid argument `value` = `1` supplied to dict type `T`'); + + throwsWithMessage(function () { + T({a: 1}); + }, 'Invalid argument `value` = `1` supplied to struct type `S`'); + + throwsWithMessage(function () { + T({forbidden: {}}); + }, 'Invalid argument `value` = `forbidden` supplied to subtype type `Domain`'); + + }); + + it('should be idempotent', function () { + var T = dict(Str, Str); + var p1 = T({a: 'a', b: 'b'}); + var p2 = T(p1); + eq(Object.isFrozen(p1), true); + eq(Object.isFrozen(p2), true); + eq(p2 === p1, true); + }); + + }); + + describe('#is(x)', function () { + + var T = dict(Str, Point); + var p1 = new Point({x: 0, y: 0}); + var p2 = new Point({x: 1, y: 1}); + + it('should return true when x is a list', function () { + ok(T.is({a: p1, b: p2})); + }); + + it('should not depend on `this`', function () { + ok([{a: p1, b: p2}].every(T.is)); + }); + + }); + + describe('#update()', function () { + + var Type = dict(Str, Str); + var instance = Type({p1: 'a', p2: 'b'}); + + it('should return a new instance', function () { + var newInstance = Type.update(instance, {p2: {$set: 'c'}}); + ok(Type.is(newInstance)); + eq((instance).p2, 'b'); + eq((newInstance).p2, 'c'); + }); + + }); + +}); + +// +// func +// + +describe('func', function () { + + it('should handle a no types', function () { + var T = func([], Str); + eq(T.meta.domain.length, 0); + var getGreeting = T.of(function () { return 'Hi'; }); + eq(getGreeting(), 'Hi'); + }); + + it('should handle a single type', function () { + var T = func(Num, Num); + eq(T.meta.domain.length, 1); + ok(T.meta.domain[0] === Num); + }); + + it('should automatically instrument a function', function () { + var T = func(Num, Num); + var f = function () { return 'hi'; }; + ok(T.is(T(f))); + }); + + describe('of', function () { + + it('should check the arguments', function () { + + var T = func([Num, Num], Num); + var sum = T.of(function (a:any, b:any) { + return a + b; + }); + eq(sum(1, 2), 3); + + throwsWithMessage(function () { + sum(1, 2, 3); + }, 'Invalid argument `value` = `1,2,3` supplied to tuple type `[Num, Num]`, expected an `Arr` of length `2`'); + + throwsWithMessage(function () { + sum('a', 2); + }, 'Invalid argument `value` = `a` supplied to irreducible type `Num`'); + + }); + + it('should check the return value', function () { + + var T = func([Num, Num], Num); + var sum = T.of(function () { + return 'a'; + }); + + throwsWithMessage(function () { + sum(1, 2); + }, 'Invalid argument `value` = `a` supplied to irreducible type `Num`'); + + }); + + it('should preserve `this`', function () { + var o = {name: 'giulio'}; + (o).getTypeName = func([], Str).of(function () { + return this.name; + }); + eq((o).getTypeName(), 'giulio'); + }); + + it('should handle function types', function () { + var A = func([Str], Str); + var B = func([Str, A], Str); + + var f = A.of(function (s:any) { + return s + '!'; + }); + var g = B.of(function (str:any, strAction:any) { + return strAction(str); + }); + + eq(g('hello', f), 'hello!'); + }); + + it('should be idempotent', function () { + var f = function (s:any) { return s; }; + var g = func([Str], Str).of(f); + var h = func([Str], Str).of(g); + ok(h === g); + }); + + }); + + describe('currying', function () { + + it('should curry functions', function () { + var Type = func([Num, Num, Num], Num); + var sum = Type.of(function (a:any, b:any, c:any) { + return a + b + c; + }); + eq(sum(1, 2, 3), 6); + eq(sum(1, 2)(3), 6); + eq(sum(1)(2, 3), 6); + eq(sum(1)(2)(3), 6); + + // important: the curried function must be of the correct type + var CurriedType = func([Num, Num], Num); + var sum1 = sum(1); + eq(sum1(2, 3), 6); + eq(sum1(2)(3), 6); + ok(CurriedType.is(sum1)); + }); + + it('should throw if partial arguments are wrong', function () { + + var T = func([Num, Num], Num); + var sum = T.of(function (a:any, b:any) { + return a + b; + }); + + throwsWithMessage(function () { + sum('a'); + }, 'Invalid argument `value` = `a` supplied to irreducible type `Num`'); + + throwsWithMessage(function () { + var sum1 = sum(1); + sum1('a'); + }, 'Invalid argument `value` = `a` supplied to irreducible type `Num`'); + + }); + + }); + +}); diff --git a/tcomb/tcomb.d.ts b/tcomb/tcomb.d.ts index 3c9197d86..c189a6a0f 100644 --- a/tcomb/tcomb.d.ts +++ b/tcomb/tcomb.d.ts @@ -1,420 +1,425 @@ -// Type definitions for tcomb v0.4 +// Type definitions for tcomb v1.0.3 // Project: http://gcanti.github.io/tcomb/guide/index.html -// Definitions by: Jed Mao +// Definitions by: Hans Windhoff // Definitions: https://github.com/borisyankov/DefinitelyTyped -declare module tcomb { +// Original Definitions by: Jed Mao +declare module TComb { + export interface tcomb { + format: (format: string, ...values: any[]) => string; + getFunctionName: (fn: Function) => string; + getTypeName: (type: TCombBase) => string; + mixin: (target: {}, source: {}, overwrite?: boolean) => any; + slice: typeof Array.prototype.slice; + shallowCopy: (x: TCombBase) => TCombBase; + update: (instance: any, spec: {} ) => TCombBase; + assert: (condition: boolean, message?: string, ...values: any[]) => void; + fail: (message?: string) => void; + Any: Any_Static; + Nil: Str_Static; + Str: Str_Static; + Num: Num_Static; + Bool: Bool_Static; + Arr: Arr_Static; + Obj: Obj_Static; - export var options: { - onFail: (message: string) => void; - }; + Func: Func_Static; + func: { (domain: TCombBase[], codomain: TCombBase, name?: string) : Func_Static; + (domain: TCombBase, codomain: TCombBase, name?: string) : Func_Static; + } + Err: Err_Static; + Re: Re_Static; + Dat: Dat_Static; + Type: Type_Static; + irreducible: (name: string, is: TypePredicate) => TCombBase; + struct: (props: Object, name?: string) => Struct_Static; - /** - * Like util.format in Node. - */ - export function format(format: string, ...values: any[]): string; - export function getKind(type: T): string; - /** - * Returns a function's name or displayName if specified; otherwise, - * fallbacks on '>'. - */ - export function getFunctionName(fn: Function): string; - export function getTypeName(type: T): string; - /** - * Safe version of mixin, properties can be overwritten. - */ - export function mixin(target: {}, source: {}, overwrite?: boolean): any; - export var slice: typeof Array.prototype.slice; - export function shallowCopy(x: T): T; - export function update(instance: any, spec: {}): T; - /** - * If an assert fails the debugger kicks in so you can inspect the stack - * and quickly find out what's wrong. - * @param message - Useful for debugging. Formatted with values like util.format in Node. - * @param values - Sequentially inserted into the message. - */ - export function assert(condition: boolean, message?: string, ...values: any[]): void; - export function fail(message?: string): void; + Union: Union_Static; + Maybe: Maybe_Static; - interface T { - meta: { + enums(map: Object, name?: string): TCombBase; + union(types: TCombBase[], name?: string): Union_Static; + maybe(type: TCombBase, name?: string): Maybe_Static; + + Tuple: Tuple_Static; + tuple:(types: TCombBase[], name?: string)=> Tuple_Static; + + Subtype: Subtype_Static; + + List: List_Static; + list:(type: TCombBase, name?: string)=> List_Static; + + Dict: Dict_Static; + dict:(domain: TCombBase, codomain: TCombBase, name?: string)=> Dict_Static; + + subtype(type: TCombBase, predicate: TypePredicate, name?: string): Subtype_Static; + + } + + + + + export interface TCombBase { + meta: { /** * The type kind, equal to "irreducible" for irreducible types. */ - kind: string; + kind: string; /** * The type name. */ - name: string; - }; - displayName: string; - is(value: any): boolean; - update(instance: any, spec: {}): T; - } + name: string; + }; + displayName: string; + is(value: any): boolean; + update(instance: any, spec: {}): TCombBase; + } - interface TypePredicate { - (x: any): Bool_Instance; - } + export interface TypePredicate { + (x: any): Bool_Instance; + } - interface Any_Instance { - } + export interface Any_Instance { + } - interface Any_Static extends T { - new (value: any): Any_Instance; - (value: any): Any_Instance; - } + export interface Any_Static extends TCombBase { - export var Any: Any_Static; + new (value: any): Any_Instance; + (value: any): Any_Instance; + } - interface Nil_Instance { - } - interface Nil_Static extends T { - new (value: any): Nil_Instance; - (value: any): Nil_Instance; - } - export var Nil: Str_Static; + export interface Nil_Instance { + } - interface Str_Instance extends String { - } + export interface Nil_Static extends TCombBase { + new (value: any): Nil_Instance; + (value: any): Nil_Instance; + } - interface Str_Static extends T { - new (value: string): Str_Instance; - (value: string): Str_Instance; - meta: { + + + export interface Str_Instance extends String { + } + + export interface Str_Static extends TCombBase { + new (value: string): Str_Instance; + (value: string): Str_Instance; + meta: { /** * The type kind, equal to "irreducible" for irreducible types. */ - kind: string; + kind: string; /** * The type name. */ - name: string; + name: string; /** * The type predicate. */ - is: TypePredicate; - }; - } + is: TypePredicate; + }; + } - export var Str: Str_Static; - interface Num_Instance extends Number { - } - interface Num_Static extends T { - new (value: number): Num_Instance; - (value: number): Num_Instance; - } + export interface Num_Instance extends Number { + } - export var Num: Num_Static; + export interface Num_Static extends TCombBase { + new (value: number): Num_Instance; + (value: number): Num_Instance; + } - interface Bool_Instance extends Boolean { - } - interface Bool_Static extends T { - new (value: boolean): Bool_Instance; - (value: boolean): Bool_Instance; - } - export var Bool: Bool_Static; + export interface Bool_Instance extends Boolean { + } - interface Arr_Instance extends Array { - } + export interface Bool_Static extends TCombBase { + new (value: boolean): Bool_Instance; + (value: boolean): Bool_Instance; + } - interface Arr_Static extends T { - new (value: any[]): Arr_Instance; - (value: any[]): Arr_Instance; - } - export var Arr: Arr_Static; - interface Obj_Instance extends Object { - } + export interface Arr_Instance extends Array { + } - interface Obj_Static extends T { - new (value: Object): Obj_Instance; - (value: Object): Obj_Instance; - } + export interface Arr_Static extends TCombBase { + new (value: any[]): Arr_Instance; + (value: any[]): Arr_Instance; + } - export var Obj: Obj_Static; - interface Func_Instance extends Function { - } - interface Func_Static extends T { - new (value: Function): Func_Instance; - (value: Function): Func_Instance; - } + export interface Obj_Instance extends Object { + } - export var Func: Func_Static; + export interface Obj_Static extends TCombBase { - interface Err_Instance extends Error { - } + new (value: Object): Obj_Instance; + (value: Object): Obj_Instance; + } - interface Err_Static extends T { - new (value: Error): Err_Instance; - (value: Error): Err_Instance; - } - export var Err: Err_Static; - interface Re_Instance extends RegExp { - } + export interface Func_Instance extends Function { + } - interface Re_Static extends T { - new (value: RegExp): Re_Instance; - (value: RegExp): Re_Instance; - } + export interface Func_Static extends TCombBase { + new (value: Function): Func_Instance; + (value: Function): Func_Instance; + } - export var Re: Re_Static; - interface Dat_Instance extends Date { - } + export interface Err_Instance extends Error { + } - interface Dat_Static extends T { - new (value: Date): Dat_Instance; - (value: Date): Dat_Instance; - } + export interface Err_Static extends TCombBase { + new (value: Error): Err_Instance; + (value: Error): Err_Instance; + } - export var Dat: Dat_Static; - interface Type_Instance { - } + export interface Re_Instance extends RegExp { + } + + export interface Re_Static extends TCombBase { + new (value: RegExp): Re_Instance; + (value: RegExp): Re_Instance; + } + + + export interface Dat_Instance extends Date { + } + + export interface Dat_Static extends TCombBase { + new (value: Date): Dat_Instance; + (value: Date): Dat_Instance; + } + + export interface Type_Instance { + } + + export interface Type_Static extends TCombBase { + new (value: any): Type_Instance; + (value: any): Type_Instance; + } - interface Type_Static extends T { - new (value: any): Type_Instance; - (value: any): Type_Instance; - } - export var Type: Type_Static; /** * @param name - The type name. * @param is - A predicate. */ - export function irreducible(name: string, is: TypePredicate): T; + /** * @param props - A hash whose keys are the field names and the values are the fields types. * @param name - Useful for debugging purposes. */ - export function struct(props: Object, name?: string): typeof Struct; - export interface Struct_Static extends T { - new (value: any, mutable?: boolean): Struct_Instance; - (value: any, mutable?: boolean): Struct_Instance; - meta: { - kind: string; - name: string; - props: any[]; - }; - /** - * @param mixins - Contains the new props. - * @param name - Useful for debugging purposes. - */ - extend(mixins: Object, name?: string): Struct_Static; - /** - * @param mixins - Contains the new props. - * @param name - Useful for debugging purposes. - */ - extend(mixins: Struct_Static, name?: string): Struct_Static; - /** - * @param mixins - Contains the new props. - * @param name - Useful for debugging purposes. - */ - extend(mixins: Object[], name?: string): Struct_Static; - /** - * @param mixins - Contains the new props. - * @param name - Useful for debugging purposes. - */ - extend(mixins: Struct_Static[], name?: string): Struct_Static; - } - interface Struct_Instance { - } + export interface Struct_Static extends TCombBase { + new (value: any, mutable?: boolean): Struct_Instance; + (value: any, mutable?: boolean): Struct_Instance; + meta: { + kind: string; + name: string; + props: any[]; + }; + /** + * @param mixins - Contains the new props. + * @param name - Useful for debugging purposes. + */ + extend(mixins: Object, name?: string): Struct_Static; + /** + * @param mixins - Contains the new props. + * @param name - Useful for debugging purposes. + */ + extend(mixins: Struct_Static, name?: string): Struct_Static; + /** + * @param mixins - Contains the new props. + * @param name - Useful for debugging purposes. + */ + extend(mixins: Object[], name?: string): Struct_Static; + /** + * @param mixins - Contains the new props. + * @param name - Useful for debugging purposes. + */ + extend(mixins: Struct_Static[], name?: string): Struct_Static; + } - export var Struct: Struct_Static; + interface Struct_Instance { + } /** * @param map - A hash whose keys are the enums (values are free). * @param name - Useful for debugging purposes. */ - export function enums(map: Object, name?: string): T; - export module enums { + + export module enums { /** * @param keys - Array of enums. * @param name - Useful for debugging purposes. */ - export function of(keys: string[], name?: string): T; + export function of(keys: string[], name?: string): TCombBase; /** * @param keys - String of enums separated by spaces. * @param name - Useful for debugging purposes. */ - export function of(keys: string, name?: string): T; - } + export function of(keys: string, name?: string): TCombBase; + } /** * @param name - Useful for debugging purposes. */ - export function union(types: T[], name?: string): Union_Static; - interface Union_Static extends T { - new (value: any, mutable?: boolean): Union_Instance; - (value: any, mutable?: boolean): Union_Instance; - meta: { - kind: string; - name: string; - types: T[]; - }; - dispatch(x: any): T; - } + export interface Union_Static extends TCombBase { + new (value: any, mutable?: boolean): Union_Instance; + (value: any, mutable?: boolean): Union_Instance; + meta: { + kind: string; + name: string; + types: TCombBase[]; + }; + dispatch(x: any): TCombBase; + } - interface Union_Instance { - } + export interface Union_Instance { + } - export var Union: Union_Static; /** * @param type - The wrapped type. * @param name - Useful for debugging purposes. */ - export function maybe(type: T, name?: string): Maybe_Static; - export interface Maybe_Static extends T { - new (value: any, mutable?: boolean): Maybe_Instance; - (value: any, mutable?: boolean): Maybe_Instance; - meta: { - kind: string; - name: string; - typee: T; - }; - } - interface Maybe_Instance { - } - export var Maybe: Maybe_Static; + export interface Maybe_Static extends TCombBase { + new (value: any, mutable?: boolean): Maybe_Instance; + (value: any, mutable?: boolean): Maybe_Instance; + meta: { + kind: string; + name: string; + typee: TCombBase; + }; + } + + interface Maybe_Instance { + } + /** * @param name - Useful for debugging purposes. */ - export function tuple(types: T[], name?: string): Tuple_Static; - interface Tuple_Static extends T { - new (value: any, mutable?: boolean): Tuple_Instance; - (value: any, mutable?: boolean): Tuple_Instance; - meta: { - kind: string; - name: string; - types: T[]; - }; - } + interface Tuple_Static extends TCombBase { + new (value: any, mutable?: boolean): Tuple_Instance; + (value: any, mutable?: boolean): Tuple_Instance; + meta: { + kind: string; + name: string; + types: TCombBase[]; + }; + } - interface Tuple_Instance { - } + interface Tuple_Instance { + } - export var Tuple: Tuple_Static; - /** * Combines old types into a new one. * @param type - A type already defined. * @param name - Useful for debugging purposes. */ - export function subtype(type: T, predicate: TypePredicate, name?: string): typeof Subtype; - interface Subtype_Static extends T { - new (value: any, mutable?: boolean): Subtype_Instance; - (value: any, mutable?: boolean): Subtype_Instance; - meta: { - kind: string; - name: string; - type: T; - predicate: TypePredicate; - }; - } - interface Subtype_Instance { - } + export interface Subtype_Static extends TCombBase { + new (value: any, mutable?: boolean): Subtype_Instance; + (value: any, mutable?: boolean): Subtype_Instance; + meta: { + kind: string; + name: string; + type: TCombBase; + predicate: TypePredicate; + }; + } - export var Subtype: Subtype_Static; + interface Subtype_Instance { + } /** * @param type - The type of list items. * @param name - Useful for debugging purposes. */ - export function list(type: T, name?: string): List_Static; + export function list(type: TCombBase, name?: string): List_Static; - interface List_Static extends T { - new (value: any, mutable?: boolean): List_Instance; - (value: any, mutable?: boolean): List_Instance; - meta: { - kind: string; - name: string; - 'type': T; - }; - } + interface List_Static extends TCombBase { + new (value: any, mutable?: boolean): List_Instance; + (value: any, mutable?: boolean): List_Instance; + meta: { + kind: string; + name: string; + 'type': TCombBase; + }; + } - interface List_Instance { - } - - export var List: List_Static; + interface List_Instance { + } /** * @param domain - The type of keys. * @param codomain - The type of values. * @param name - Useful for debugging purposes. */ - export function dict(domain: T, codomain: T, name?: string): Dict_Static; - interface Dict_Static extends T { - new (value: any, mutable?: boolean): Dict_Instance; - (value: any, mutable?: boolean): Dict_Instance; - meta: { - kind: string; - name: string; - domain: T; - codomain: T; - }; - } - interface Dict_Instance { - } + interface Dict_Static extends TCombBase { + new (value: any, mutable?: boolean): Dict_Instance; + (value: any, mutable?: boolean): Dict_Instance; + meta: { + kind: string; + name: string; + domain: TCombBase; + codomain: TCombBase; + }; + } - export var Dict: Dict_Static; + interface Dict_Instance { + } /** * @param type - The type of the function's argument. * @param codomain - The type of the function's return value. * @param name - Useful for debugging purposes. */ - export function func(domain: T, codomain: T, name?: string): Func_Static; /** * @param type - The list of types of the function's arguments. * @param codomain - The type of the function's return value. * @param name - Useful for debugging purposes. */ - export function func(domain: T[], codomain: T, name?: string): Func_Static; - interface Func_Static extends T { - new (value: any, mutable?: boolean): Func_Instance; - (value: any, mutable?: boolean): Func_Instance; - meta: { - kind: string; - name: string; - domain: any; - codomain: T; - }; - of(fn: Function): Function; - } + interface Func_Static extends TCombBase { + new (value: any, mutable?: boolean): Func_Instance; + (value: any, mutable?: boolean): Func_Instance; + meta: { + kind: string; + name: string; + domain: any; + codomain: TCombBase; + }; + of(fn: Function): Function; + } - interface Func_Instance { - } - - export var Func: Func_Static; + interface Func_Instance { + } } +declare var t: TComb.tcomb; + declare module "tcomb" { - export = tcomb; + export = t; } diff --git a/threejs/three.d.ts b/threejs/three.d.ts index a9255f3b5..d87541145 100644 --- a/threejs/three.d.ts +++ b/threejs/three.d.ts @@ -1,4 +1,4 @@ -// Type definitions for three.js r70 +// Type definitions for three.js r71 // Project: http://mrdoob.github.com/three.js/ // Definitions by: Kon , Satoru Kimura // Definitions: https://github.com/borisyankov/DefinitelyTyped @@ -129,6 +129,7 @@ declare module THREE { export var IntType: TextureDataType; export var UnsignedIntType: TextureDataType; export var FloatType: TextureDataType; + export var HalfFloatType: TextureDataType; // Pixel types export enum PixelType { } @@ -159,6 +160,12 @@ declare module THREE { export var RGBA_PVRTC_4BPPV1_Format: CompressedPixelFormat; export var RGBA_PVRTC_2BPPV1_Format: CompressedPixelFormat; + // log handlers + export function warn(message?: any, ...optionalParams: any[]): void; + export function error(message?: any, ...optionalParams: any[]): void; + export function log(message?: any, ...optionalParams: any[]): void; + + // Cameras //////////////////////////////////////////////////////////////////////////////////////// /** @@ -364,7 +371,7 @@ declare module THREE { length: number; copyAt(index1: number, attribute: BufferAttribute, index2: number): void; - set(value: number): BufferAttribute; + set(value: number, offset?: number): BufferAttribute; setX(index: number, x: number): BufferAttribute; setY(index: number, y: number): BufferAttribute; setZ(index: number, z: number): BufferAttribute; @@ -456,8 +463,7 @@ declare module THREE { */ applyMatrix(matrix: Matrix4): void; - // this method is currently empty. - center(): void; + center(): Vector3; fromGeometry( geometry: Geometry, settings?: any ): BufferGeometry; @@ -488,7 +494,7 @@ declare module THREE { */ computeTangents(): void; - computeOffsets(indexBufferSize: number): void; + computeOffsets(size: number): void; merge(geometry: BufferGeometry, offset: number): BufferGeometry; normalizeNormals(): void; reorderBuffers(indexBuffer: number, indexMap: number[], vertexCount: number): void; @@ -569,6 +575,17 @@ declare module THREE { getDelta(): number; } + export class DynamicBufferAttribute extends BufferAttribute{ + constructor(array: any, itemSize: number); + + updateRange: { + offset: number; + count: number; + } + + clone(): DynamicBufferAttribute; + } + /** * JavaScript events for custom objects * @@ -1065,6 +1082,8 @@ declare module THREE { */ frustumCulled: boolean; + renderOrder: number; + /** * An object that can be used to store custom data about the Object3d. It should not hold references to functions as these will not be cloned. */ @@ -1193,23 +1212,21 @@ declare module THREE { remove(object: Object3D): void; /* deprecated */ - getChildByName( name: string, recursive?: boolean ): Object3D; + getChildByName( name: string ): Object3D; /** * Searches through the object's children and returns the first with a matching id, optionally recursive. * @param id Unique number of the object instance - * @param recursive Boolean whether to search through the children's children. Default is false. */ - getObjectById(id: string, recursive: boolean): Object3D; + getObjectById(id: string): Object3D; /** * Searches through the object's children and returns the first with a matching name, optionally recursive. * @param name String to match to the children's Object3d.name property. - * @param recursive Boolean whether to search through the children's children. Default is false. */ - getObjectByName(name: string, recursive?: boolean): Object3D; + getObjectByName(name: string): Object3D; - getObjectByProperty( name: string, value: string, recursive?: boolean ): Object3D; + getObjectByProperty( name: string, value: string ): Object3D; getWorldPosition(optionalTarget?: Vector3): Vector3; getWorldQuaternion(optionalTarget?: Quaternion): Quaternion; @@ -1521,7 +1538,7 @@ declare module THREE { * scene.add( light ); */ export class PointLight extends Light { - constructor(hex?: number, intensity?: number, distance?: number); + constructor(hex?: number, intensity?: number, distance?: number, decay?: number); /* * Light's intensity. @@ -1535,6 +1552,8 @@ declare module THREE { */ distance: number; + decay: number; + clone(): PointLight; } @@ -1554,7 +1573,7 @@ declare module THREE { * scene.add( spotLight ); */ export class SpotLight extends Light { - constructor(hex?: number, intensity?: number, distance?: number, angle?: number, exponent?: number); + constructor(hex?: number, intensity?: number, distance?: number, angle?: number, exponent?: number, decay?: number); /** * Spotlight focus points at target.position. @@ -1586,6 +1605,8 @@ declare module THREE { */ exponent: number; + decay: number; + /** * If set to true light will cast dynamic shadows. Warning: This is expensive and requires tweaking to get shadows looking right. * Default — false. @@ -1744,9 +1765,7 @@ declare module THREE { parse(json: any): BufferGeometry; } - export class Cache{ - constructor(); - + export interface Cache{ files: any[]; add(key: string, file: any): void; @@ -1754,6 +1773,7 @@ declare module THREE { remove(key: string): void; clear(): void; } + export var Cache:Cache; export class CompressedTextureLoader{ constructor(); @@ -1856,14 +1876,18 @@ declare module THREE { constructor(manager?: LoadingManager); manager: LoadingManager; - crossOrigin: string; + texturePass: string; - load(url: string, onLoad: (object: Object3D) => void): void; + load(url: string, onLoad?: (object: Object3D) => void): void; + setTexturePath( value: string ): void; setCrossOrigin(crossOrigin: string): void; - parse(json: any): T; + parse(json: any, onLoad?: (object: Object3D) => void): T; parseGeometries(json: any): any[]; // Array of BufferGeometry or Geometry or Geometry2. - parseMaterials(json: any): Material[]; // Array of Classes that inherits from Matrial. + parseMaterials(json: any, textures: Texture[]): Material[]; // Array of Classes that inherits from Matrial. + parseImages( json: any, onLoad: () => void ): any[]; + parseTextures( json: any, images: any ): Texture[]; parseObject(data: any, geometries: any[], materials: Material[]): T; + } /** @@ -1976,6 +2000,10 @@ declare module THREE { */ blendEquation: BlendingEquation; + blendSrcAlpha: number; + blendDstAlpha: number; + blendEquationAlpha: number; + /** * Whether to have depth test enabled when rendering this material. Default is true. */ @@ -1987,6 +2015,8 @@ declare module THREE { */ depthWrite: boolean; + colorWrite: boolean; + /** * Whether to use polygon offset. Default is false. This corresponds to the POLYGON_OFFSET_FILL WebGL feature. */ @@ -2026,6 +2056,7 @@ declare module THREE { setValues(values: Object): void; toJSON(): any; clone(material?:Material): Material; + update(): void; dispose(): void; // EventDispatcher mixins @@ -2156,7 +2187,6 @@ declare module THREE { export interface MeshLambertMaterialParameters extends MaterialParameters{ color?: number; - ambient?: number; emissive?: number; wrapAround?: boolean; wrapRGB?: Vector3; @@ -2183,7 +2213,6 @@ declare module THREE { export class MeshLambertMaterial extends Material { constructor(parameters?: MeshLambertMaterialParameters); color: Color; - ambient: Color; emissive: Color; wrapAround: boolean; wrapRGB: Vector3; @@ -2210,7 +2239,6 @@ declare module THREE { } export interface MeshNormalMaterialParameters extends MaterialParameters{ - shading?: Shading; wireframe?: boolean; wireframeLinewidth?: number; morphTargets?: boolean; @@ -2219,7 +2247,6 @@ declare module THREE { export class MeshNormalMaterial extends Material { constructor(parameters?: MeshNormalMaterialParameters); - shading: Shading; wireframe: boolean; wireframeLinewidth: number; morphTargets: boolean; @@ -2229,7 +2256,6 @@ declare module THREE { export interface MeshPhongMaterialParameters extends MaterialParameters{ color?: number; // diffuse - ambient?: number; emissive?: number; specular?: number; shininess?: number; @@ -2264,7 +2290,6 @@ declare module THREE { constructor(parameters?: MeshPhongMaterialParameters); color: Color; // diffuse - ambient: Color; emissive: Color; specular: Color; shininess: number; @@ -2531,13 +2556,13 @@ declare module THREE { * Copies given color making conversion from gamma to linear space. * @param color Color to copy. */ - copyGammaToLinear(color: Color): Color; + copyGammaToLinear(color: Color, gammaFactor?: number): Color; /** * Copies given color making conversion from linear to gamma space. * @param color Color to copy. */ - copyLinearToGamma(color: Color): Color; + copyLinearToGamma(color: Color, gammaFactor?: number): Color; /** * Converts this color from gamma to linear space. @@ -2577,7 +2602,7 @@ declare module THREE { lerp(color: Color, alpha: number): Color; equals(color: Color): boolean; fromArray(rgb: number[]): Color; - toArray(): number[]; + toArray(array?: number[], offset?: number): number[]; /** * Clones this color. @@ -2751,7 +2776,7 @@ declare module THREE { reorder(newOrder: string): Euler; equals(euler: Euler): boolean; fromArray(xyzo: any[]): Euler; - toArray(): any[]; + toArray(array?: number[], offset?: number): number[]; toVector3(optionalResult?: Vector3): Vector3; onChange: () => void; @@ -2860,6 +2885,8 @@ declare module THREE { radToDeg(radians: number): number; isPowerOfTwo(value: number): boolean; + + nextPowerOfTwo(value: number): number; } /** @@ -3558,8 +3585,8 @@ declare module THREE { /** * Sets this vector to a + b. */ - addVectors(a: Vector2, b: Vector2): Vector2; addScalar(s: number): Vector2; + addVectors(a: Vector2, b: Vector2): Vector2; /** * Subtracts v from this vector. @@ -3635,6 +3662,9 @@ declare module THREE { setLength(l: number): Vector2; lerp(v: Vector2, alpha: number): Vector2; + + lerpVectors(v1: Vector2, v2: Vector2, alpha: number): Vector2; + /** * Checks for strict equality of this vector and v. */ @@ -3717,6 +3747,8 @@ declare module THREE { */ sub(a: Vector3): Vector3; + subScalar( s: number ): Vector3; + /** * Sets this vector to a - b. */ @@ -3790,6 +3822,8 @@ declare module THREE { setLength(l: number): Vector3; lerp(v: Vector3, alpha: number): Vector3; + lerpVectors(v1: Vector3, v2: Vector3, alpha: number): Vector3; + /** * Sets this vector to cross product of itself and v. */ @@ -3896,6 +3930,8 @@ declare module THREE { */ sub(v: Vector4): Vector4; + subScalar(s: number): Vector4; + /** * Sets this vector to a - b. */ @@ -3969,6 +4005,8 @@ declare module THREE { */ lerp(v: Vector4, alpha: number): Vector4; + lerpVectors(v1: Vector4, v2: Vector4, alpha: number): Vector4; + /** * Checks for strict equality of this vector and v. */ @@ -3989,7 +4027,7 @@ declare module THREE { // Objects ////////////////////////////////////////////////////////////////////////////////// export class Bone extends Object3D { - constructor(belongsToSkin: SkinnedMesh); + constructor(skin: SkinnedMesh); skin: SkinnedMesh; } @@ -4151,13 +4189,13 @@ declare module THREE { } export class SkinnedMesh extends Mesh { - constructor(geometry?: Geometry, material?: MeshBasicMaterial, useVertexTexture?: boolean); - constructor(geometry?: Geometry, material?: MeshDepthMaterial, useVertexTexture?: boolean); - constructor(geometry?: Geometry, material?: MeshFaceMaterial, useVertexTexture?: boolean); - constructor(geometry?: Geometry, material?: MeshLambertMaterial, useVertexTexture?: boolean); - constructor(geometry?: Geometry, material?: MeshNormalMaterial, useVertexTexture?: boolean); - constructor(geometry?: Geometry, material?: MeshPhongMaterial, useVertexTexture?: boolean); - constructor(geometry?: Geometry, material?: ShaderMaterial, useVertexTexture?: boolean); + constructor(geometry?: Geometry|BufferGeometry, material?: MeshBasicMaterial, useVertexTexture?: boolean); + constructor(geometry?: Geometry|BufferGeometry, material?: MeshDepthMaterial, useVertexTexture?: boolean); + constructor(geometry?: Geometry|BufferGeometry, material?: MeshFaceMaterial, useVertexTexture?: boolean); + constructor(geometry?: Geometry|BufferGeometry, material?: MeshLambertMaterial, useVertexTexture?: boolean); + constructor(geometry?: Geometry|BufferGeometry, material?: MeshNormalMaterial, useVertexTexture?: boolean); + constructor(geometry?: Geometry|BufferGeometry, material?: MeshPhongMaterial, useVertexTexture?: boolean); + constructor(geometry?: Geometry|BufferGeometry, material?: ShaderMaterial, useVertexTexture?: boolean); bindMode: string; bindMatrix: Matrix4; @@ -4291,6 +4329,8 @@ declare module THREE { */ sortObjects: boolean; + gammaFactor: number; + /** * Default is false. */ @@ -4480,7 +4520,7 @@ declare module THREE { uploadTexture(texture: Texture): void; setTexture(texture: Texture, slot: number): void; setRenderTarget(renderTarget: RenderTarget): void; - + readRenderTargetPixels( renderTarget: RenderTarget, x: number, y: number, width: number, height: number, buffer: any ): void; } export interface RenderTarget { @@ -4517,6 +4557,7 @@ declare module THREE { generateMipmaps: boolean; shareDepthFrom: any; + setSize(width: number, height: number): void; clone(): WebGLRenderTarget; dispose(): void; @@ -4538,6 +4579,7 @@ declare module THREE { export interface ShaderChunk { [name: string]: string; + common: string; alphamap_fragment: string; alphamap_pars_fragment: string; alphatest_fragment: string; @@ -4612,6 +4654,7 @@ declare module THREE { normal: Shader; normalmap: Shader; cube: Shader; + equirect: Shader; depthRGBA: Shader; }; @@ -4654,6 +4697,40 @@ declare module THREE { constructor(gl: any, type: string, string: string); } + interface WebGLStateInstance{ + new ( gl: any, paramThreeToGL: Function ): void; + initAttributes(): void; + enableAttribute(attribute: string): void; + disableUnusedAttributes(): void; + setBlending( blending: number, blendEquation: number, blendSrc: number, blendDst: number, blendEquationAlpha: number, blendSrcAlpha: number, blendDstAlpha: number ): void; + setDepthTest( depthTest: number ): void; + setDepthWrite( depthWrite: number ): void; + setColorWrite( colorWrite: number ): void; + setDoubleSided( doubleSided: number ): void; + setFlipSided( flipSided: number ): void; + setLineWidth( width: number ): void; + setPolygonOffset(polygonoffset: number, factor: number, units: number): void; + reset(): void; + } + interface WebGLStateStatic{ + ( gl: any, paramThreeToGL: Function ): WebGLStateInstance; + } + export var WebGLState: WebGLStateStatic; + + + interface WebGLTexturesInstance{ + new (webgglcontext: any): WebGLTexturesInstance; + + get(texture: Texture): any; // it will return result of gl.createTexture(). + create(texture: Texture): any; // it will return result of gl.createTexture(). + delete(texture: Texture): void; + } + interface WebGLTexturesStatic{ + (webgglcontext: any): WebGLTexturesInstance; + } + export var WebGLTextures: WebGLTexturesStatic; + + // Renderers / WebGL / Plugins ///////////////////////////////////////////////////////////////////// export interface RendererPlugin { init(renderer: WebGLRenderer): void; @@ -4820,29 +4897,7 @@ declare module THREE { export class Texture { constructor( - image: any, // HTMLImageElement or HTMLCanvasElement ( or HTMLVideoElement) - mapping?: Mapping, - wrapS?: Wrapping, - wrapT?: Wrapping, - magFilter?: TextureFilter, - minFilter?: TextureFilter, - format?: PixelFormat, - type?: TextureDataType, - anisotropy?: number - ); - constructor( - image: HTMLCanvasElement, - mapping?: Mapping, - wrapS?: Wrapping, - wrapT?: Wrapping, - magFilter?: TextureFilter, - minFilter?: TextureFilter, - format?: PixelFormat, - type?: TextureDataType, - anisotropy?: number - ); - constructor( - image: HTMLImageElement, + image: HTMLImageElement | HTMLCanvasElement | HTMLVideoElement, mapping?: Mapping, wrapS?: Wrapping, wrapT?: Wrapping, @@ -4856,6 +4911,7 @@ declare module THREE { id: number; uuid: string; name: string; + sourceFile: string; image: any; // HTMLImageElement or ImageData ; mipmaps: ImageData[]; mapping: Mapping; @@ -4991,14 +5047,13 @@ declare module THREE { isPlaying: boolean; loop: boolean; weight: number; - keyTypes: string[]; interpolationType: number; play(startTime?: number, weight?: number): void; stop(): void; reset(): void; resetBlendWeights(): void; - update(deltaTimeMS: number): void; + update(delta: number): void; getNextKeyWith(type: string, h: number, key: number): KeyFrame; getPrevKeyWith(type: string, h: number, key: number): KeyFrame; } @@ -5021,7 +5076,7 @@ declare module THREE { constructor(data: any); root: Mesh; - data: Object; + data: AnimationData; hierarchy: KeyFrames[]; currentTime: number; timeScale: number; @@ -5050,7 +5105,7 @@ declare module THREE { play(): void; pause(): void; - update(deltaTimeMS: number): void; + update(delta: number): void; } // Extras / Audio ///////////////////////////////////////////////////////////////////// @@ -5062,11 +5117,18 @@ declare module THREE { source: AudioBufferSourceNode; gain: GainNode; panner: PannerNode; + autoplay: boolean; + startTime: number; + isPlaying: boolean; load(file: string): Audio; + play(): void; + pause(): void; + stop(): void; setLoop(value: boolean): void; setRefDistance(value: number): void; setRolloffFactor(value: number): void; + setVolume(value: number): void; updateMatrixWorld(force?: boolean): void; } @@ -5645,7 +5707,7 @@ declare module THREE { } export class EdgesHelper extends Line { - constructor(object: Object3D, hex?: number); + constructor(object: Object3D, hex?: number, thresholdAngle?: number); } @@ -5668,7 +5730,7 @@ declare module THREE { setColors(colorCenterLine: number, colorGrid: number): void; } export class HemisphereLightHelper extends Object3D { - constructor(light: Light, sphereSize: number, arrowLength: number, domeSize: number); + constructor(light: Light, sphereSize: number); light: Light; colors: Color[]; diff --git a/tinycolor/tinycolor.d.ts b/tinycolor/tinycolor.d.ts index 52dc4dcf0..4d36c084b 100644 --- a/tinycolor/tinycolor.d.ts +++ b/tinycolor/tinycolor.d.ts @@ -9,49 +9,49 @@ interface tinycolor { /** * Create a tinycolor instance of the color named. - * + * * @param color - the color as a string to create an instance for. */ (color: string): tinycolorInstance; /** * Create a tinycolor instance with the given RGB values. - * + * * @param color - the rgb values to apply to the new instance. */ (color: ColorFormats.RGB): tinycolorInstance; /** * Create a tinycolor instance with the given RGBA values. - * + * * @param color - the rgba values to apply to the new instance. */ (color: ColorFormats.RGBA): tinycolorInstance; /** * Create a tinycolor instance with the given HSL values. - * + * * @param color - the hsl values to apply to the new instance. */ (color: ColorFormats.HSL): tinycolorInstance; /** * Create a tinycolor instance with the given HSLA values. - * + * * @param color - the hsla values to apply to the new instance. */ (color: ColorFormats.HSLA): tinycolorInstance; /** * Create a tinycolor instance with the given HSV values. - * + * * @param color - the hsv values to apply to the new instance. */ (color: ColorFormats.HSV): tinycolorInstance; /** * Create a tinycolor instance with the given HSVA values. - * + * * @param color - the hsva values to apply to the new instance. */ (color: ColorFormats.HSVA): tinycolorInstance; @@ -59,14 +59,14 @@ interface tinycolor { /** * Create a tinycolor instance based off the relative values. * Works with any color formats - * + * * @param ratio - the relative color/hue values to apply to the new instance. */ fromRatio(ratio: any): tinycolorInstance; // any of the interfaces defined in the ColorFormats module. /** * Compares the two colors and returns the difference between their brightness and color/hue - * + * * @param firstColor - the first color to be used in the comparison. * @param secondColor - the second color to be used in the comparison. */ @@ -74,7 +74,7 @@ interface tinycolor { /** * Ensure that foreground and background color combinations provide sufficient contrast. - * + * * @param foreColor - the fore color wanted. * @param backCOlor - the back color wanted. */ @@ -83,7 +83,7 @@ interface tinycolor { /** * Given a base color and a list of possible foreground or background colors for that base, * returns the most readable color. - * + * * @param color - the base color. * @param colorsToCompare - array of colors to pick the most readable one from. */ @@ -93,7 +93,7 @@ interface tinycolor { mix(color1: tinycolorInstance, color2: tinycolorInstance, amount?: number): tinycolorInstance; /** - * Returns a random color + * Returns a random color */ random(): tinycolorInstance; @@ -113,7 +113,7 @@ interface tinycolor { interface tinycolorInstance { /** - * Return an indication whether the color was successfully parsed. + * Return an indication whether the color was successfully parsed. */ isValid(): boolean; @@ -148,8 +148,8 @@ interface tinycolorInstance { getBrightness(): number; /** - * Sets the alpha value on the current color. - * + * Sets the alpha value on the current color. + * * @param alpha - The new alpha value. The accepted range is 0-1. */ setAlpha(alpha: number): tinycolorInstance; @@ -185,7 +185,7 @@ interface tinycolorInstance { * Returns the hex value of the color -with a # appened. */ toHexString(): string; - + /** * Returns the hex 8 value of the color. */ @@ -229,8 +229,8 @@ interface tinycolorInstance { toFilter(): string; /** - * String representation of the color. - * + * String representation of the color. + * * @param format - The format to be used when displaying the string representation. * The accepted values are: "rgb", "prgb", "hex6", "hex3", "hex8", "name", "hsl", "hsv". */ @@ -238,7 +238,7 @@ interface tinycolorInstance { /** * Lighten the color a given amount. Providing 100 will always return white. - * + * * @param amount - The amount to lighten by. The valid range is 0 to 100. * Default value: 10. */ @@ -246,7 +246,7 @@ interface tinycolorInstance { /** * Brighten the color a given amount. - * + * * @param amount - The amount to brighten by. The valid range is 0 to 100. * Default value: 10. */ @@ -255,7 +255,7 @@ interface tinycolorInstance { /** * Darken the color a given amount. * Providing 100 will always return black. - * + * * @param amount - The amount to darken by. The valid range is 0 to 100. * Default value: 10. */ @@ -264,7 +264,7 @@ interface tinycolorInstance { /** * Desaturate the color a given amount. * Providing 100 will is the same as calling greyscale. - * + * * @param amount - The amount to desaturate by. The valid range is 0 to 100. * Default value: 10. */ @@ -272,21 +272,21 @@ interface tinycolorInstance { /** * Saturate the color a given amount. - * + * * @param amount - The amount to saturate by. The valid range is 0 to 100. * Default value: 10. */ saturate(amount?: number): tinycolorInstance; /** - * Completely desaturates a color into greyscale. + * Completely desaturates a color into greyscale. * Same as calling desaturate(100). */ greyscale(): tinycolorInstance; /** * Spin the hue a given amount. Calling with 0, 360, or -360 will do nothing. - * + * * @param amount - The amount to spin by. The valid range is -360 to 360. * Default value: 0. */ @@ -294,7 +294,7 @@ interface tinycolorInstance { /** * Gets an analogous color scheme based off of the current color. - * + * * @param results - The amount of results to return. * Default value: 6. * @param slices - The amount to slice the input color by. @@ -304,7 +304,7 @@ interface tinycolorInstance { /** * Gets a monochromatic color scheme based off of the current color. - * + * * @param results - The amount of results to return. * Default value: 6. */ @@ -368,4 +368,8 @@ declare module ColorFormats { interface HSVA extends HSV { a: number; } -} \ No newline at end of file +} + +declare module 'tinycolor2' { + export = tinycolor; +} diff --git a/twix/twix-tests.ts b/twix/twix-tests.ts new file mode 100644 index 000000000..bc0ef9ae1 --- /dev/null +++ b/twix/twix-tests.ts @@ -0,0 +1,225 @@ +/// + +var someMoment = moment("20111031", "YYYYMMDD"); +var otherMoment = moment("20120620", "YYYYMMDD"); +var startTime = moment('20120701'); +var endTime = moment('20120801'); + +someMoment.twix(otherMoment); +someMoment.twix('2012-05-25'); +someMoment.twix({ year: 2012, month: 5, day: 25 }); +someMoment.twix("05/25/1982", "MM/DD/YYYY", { parseStrict: true }); + +someMoment.twix(otherMoment, "MM/DD/YYYY", { parseStrict: true }); + +var range = moment(someMoment).twix(otherMoment); +var range2 = moment.twix(someMoment, otherMoment); +var range3 = someMoment.twix(otherMoment); + +moment('1982-05-25').twix('1982-05-26', { allDay: true }); + +moment('1982-05-25').twix('1982-05-26', true); + +moment().twix(moment()).isValid(); //=> true +moment().twix(moment().add(1, "day")).isValid(); //=> true +moment().twix(moment().subtract(1, "day")).isValid(); //=> false + +moment("1982-05-25T05:00").twix("1982-05-26T06:00").isSame("day"); //=> false +moment("1982-05-25T05:00").twix("1982-05-25T06:00").isSame("day"); //=> true +moment("1982-05-25T05:00").twix("1982-05-25T06:00").isSame("year"); //=> true + +moment("1982-05-25").twix("1982-05-26").isPast(); //=> true + +moment("2054-05-25").twix("2054-05-26").isFuture(); //=> true + +moment("2054-05-25").twix(moment().add(1, "hour")).isCurrent(); //=> true + +moment("1982-05-25").twix("1982-05-28").contains("1982-05-26"); //=> true + +moment("1982-05-25T5:30").twix("1982-05-25T6:30").length("hours") //=> 1 +moment("1982-05-25T5:00").twix("1982-05-30T6:00").length("days") //=> 6 + +moment("1982-05-25T5:00").twix("1982-05-25T6:00").count("days") //=> 1 +moment("1982-05-25T5:00").twix("1982-05-26T6:00").count("days") //=> 2 + +moment("1982-05-25T5:00").twix("1982-05-25T6:00").countInner("days") //=> 0 +moment("1982-05-24T5:00").twix("1982-05-26T6:00").countInner("days") //=> 1 + +var iter = moment("1982-05-25T5:00").twix("1982-05-26T6:00").iterate("days"); +iter.hasNext(); //=> true +iter.next(); //=> moment("1982-05-25") +iter.next(); //=> moment("1982-05-26") +iter.hasNext(); //=> false +iter.next(); //=> null + +var iter = moment("16", "hh").twix("1982-05-26T6:00").iterate(2, 'hours'); +iter.next().format('LT'); //=> '4:00 PM' +iter.next().format('LT'); //=> '6:00 PM' + +var duration = moment.duration({ hours: 2, minutes: 30, seconds: 20 }); +var iter = moment("16", "hh").twix(someMoment).iterate(duration); +iter.next().format('LT'); //=> '4:00 PM' +iter.next().format('LT'); //=> '6:30 PM' +iter.next().format('LT'); //=> '9:00 PM' + +var iter2 = moment("1982-05-24T5:00").twix("1982-05-27T6:00").iterateInner("days"); +iter.hasNext(); //=> true +iter.next(); //=> moment("1982-05-25") +iter.next(); //=> moment("1982-05-26") +iter.hasNext(); //=> false +iter.next(); //=> null + +var range1 = moment("1982-05-25").twix("1982-05-30"); +var range2 = moment("1982-05-27").twix("1982-06-13"); + +range1.overlaps(range2); //=> true + +var range1 = moment("1982-05-25").twix("1982-08-30"); +var range2 = moment("1982-05-27").twix("1982-06-13"); + +range1.engulfs(range2); //=> true +range2.engulfs(range1); //=> false + +var range1 = moment("1982-05-25").twix("1982-08-30"); +var range2 = moment("1982-05-25").twix("1982-08-30"); + +range1.equals(range2); //=> true +range2.equals(range1); //=> true + +var range1 = moment("1982-05-25").twix("1982-05-30"); +var range2 = moment("1982-05-27").twix("1982-06-13"); + +range1.union(range2); //=> 5/25/82 - 6/13/1982 + +var range1 = moment("1982-05-25").twix("1982-05-30"); +var range2 = moment("1982-05-27").twix("1982-06-13"); + +range1.intersection(range2); //=> 5/27/82 - 5/30/1982 + +var range1 = moment("1982-05-24").twix("1982-05-28", true); +var range2 = moment("1982-05-22").twix("1982-05-26", true); +var xorred = range1.xor(range2); + +xorred[0].format() //=> 'May 22 - 23, 1982' +xorred[1].format() //=> 'May 27 - 28, 1982' + +var range1 = moment("1982-05-23").twix("1982-05-28", true); +var range2 = moment("1982-05-25").twix("1982-05-26", true); +var diff = range1.difference(range2); + +diff[0].format(); //=> 'May 23 - 24, 1982' +diff[1].format(); //=> 'May 27 - 28, 1982' + +var range = moment("1982-05-25T05:01").twix("1982-05-25T07:30"); + +var splits = range.split(1, "hour"); +splits[0].format({ showDate: false }); //=> '5:01 - 6:01 AM' +splits[1].format({ showDate: false }); //=> '6:01 - 7:01 AM' +splits[2].format({ showDate: false }); //=> '7:01 - 7:30 AM' + +//other signatures +range.split(moment.duration({ "h": 1 })).length; //=> 3 +range.split(moment("1982-05-25T06:00")).length; //=> 2 +range.split(moment("1982-05-25T06:00"), moment("1982-05-25T07:00")).length; //=> 3 + +var d = moment.duration(2, "days"); +var range4 = d.afterMoment("1982-05-25"); //=> 5/25/1982 - 5/27/1982 + +var d = moment.duration(2, "days"); +d.beforeMoment("1982-05-25"); //=> 5/23/1982 - 5/25/1982 + +var range = moment("1982-05-25").twix("1982-05-28"); +range.asDuration("days"); //=> duration object with {days: 3} + +var range = moment("1982-05-25T8:00").twix("1982-05-25T10:00"); +range.humanizeLength(); //=> "2 hours" + +range = moment("1982-05-25").twix("2013-01-01"); +range.humanizeLength(); //=> 31 years + +var range = moment("1982-05-25T9:00").twix("1982-05-25T12:00"); + +range.simpleFormat(); //=> '1982-05-25T09:00:00-04:00 - 1982-05-25T12:00:00-04:00' + +range.simpleFormat("ddd, hA"); //=> 'Tue, 9AM - Tue, 12PM' + +var range = moment("1982-05-25").twix("1982-05-26", { allDay: true }); + +range.simpleFormat(); //=> '1982-05-25T00:00:00-04:00 - 1982-05-26T00:00:00-04:00 (all day)' +range.simpleFormat("YYYY - MM - DD"); //=> '1982-05-25 - 1982-05-26 (all day)' + +range.simpleFormat(null, { allDay: "-- all day! --" }); //=> '1982-05-25T00:00:00-04:00 - 1982-05-26T00:00:00-04:00 -- all day! --' + +range.simpleFormat(null, { allDay: null }); //=> '1982-05-25T00:00:00-04:00 - 1982-05-26T00:00:00-04:00' + +range.simpleFormat("HH:mm", { template: function (left, right) { return left + " | " + right; } }); //=> '16:21 | 17:21' + +moment.twixClass.formatTemplate = function (left, right) { return left + " | " + right; }; +range.simpleFormat("HH:mm"); //=> '16:29 | 17:29' + +moment("1982-01-25T09:00").twix("1982-01-25T11:00").format(); //=> 'Jan 25, 1982, 9 - 11 AM' +moment("1982-01-25T9:00").twix("1982-01-26T13:00").format(); //=> 'Jan 25, 9 AM - Jan 26, 1 PM, 1982' + +moment("2012-01-25").twix("2012-01-25", { allDay: true }).format(); //=> Jan 25 +moment("1982-01-25").twix("1982-01-25", { allDay: true }).format(); //=> Jan 25, 1982 +moment("2012-01-25").twix("2012-01-26", { allDay: true }).format(); //=> Jan 25 - 26 +moment("1982-01-25").twix("1982-02-25", { allDay: true }).format(); //=> Jan 25 - Feb 25, 1982 +moment("1982-01-25").twix(new Date(), { allDay: true }).format(); //=> Jan 25, 1982 - Jan 9, 2012 + +moment("1982-01-25T9:30").twix("1/25/1982 1:30 PM").format(); //=> Jan 25, 1982, 9:30 AM - 1:30 PM +moment("1982-01-25T9:30").twix(new Date()).format(); //=> Jan 25, 1982, 9:30 AM - Jan 9, 2012, 3:05 AM +moment("1982-01-25").twix("1982-01-27").format(); //=> Jan 25, 12 AM - Jan 27, 12 AM, 1982 + +var twix = moment("2012-05-25T9:00").twix("2012-05-25T10:00"); + +twix.format(); //=> May 25, 9 - 10 AM +twix.format({ implicitMinutes: false, groupMeridiems: false }); //=> May 25, 9:00 AM - 10:00 AM + +var twix = moment().twix(moment().add('days', 1)); +twix.format({ implicitYear: false }); //=> Mar 28, 1:13 AM - Mar 29, 1:13 AM, 2013 + +moment("2012-05-25T16:00").twix("2012-05-25T17:00").format({ twentyFourHour: true }); //=> May 25, 16:00 - 17:00 + +moment("2012-01-25T8:00").twix("2012-01-25T17:00").format({ + monthFormat: "MMMM", + dayFormat: "Do" +}); + +moment("2012-05-25T8:00").twix("2012-05-25T17:00").format({ spaceBeforeMeridiem: false }); //=> May 25, 8AM - 5PM + +moment("2012-05-25T8:00").twix("2012-05-25T17:00").format({ showDate: false }); //=> 8 AM - 5 PM + +moment("2012-01-25").twix("2012-01-25", { allDay: true }).format({ showDate: false }); //=> All day + +moment.lang("fr"); +moment().twix(moment().add(3, "month")).simpleFormat("MMMM"); //=> 'juillet - octobre' + +moment("1982-05-25").twix(moment("1982-05-27")).format(); //=> '25 mai, 0:00 - 27 mai, 0:00, 1982' + +moment("1982-05-25").twix(moment("1982-05-27")).format({ + groupMeridiems: true, + spaceBeforeMeridiem: true, + showDate: true, + showDayOfWeek: false, + twentyFourHour: false, + implicitMinutes: true, + implicitYear: true, + yearFormat: "YYYY", + monthFormat: "MMM", + weekdayFormat: "ddd", + dayFormat: "D", + meridiemFormat: "A", + hourFormat: "h", + minuteFormat: "mm", + allDay: "all day", + explicitAllDay: false, + lastNightEndsAt: 0 +}); //=> '25 mai, 0:00 - 27 mai, 0:00, 1982' + +var t = moment("1982-01-25T09:30").twix("1982-01-25T13:30"); + +t.format(); //=> Jan 25, 1982, 9:30 AM - 1:30 PM + +t.isSame("day"); //=> true +t.humanizeLength(); //=> "4 hours" +t.count("days"); //=> 1 \ No newline at end of file diff --git a/twix/twix.d.ts b/twix/twix.d.ts new file mode 100644 index 000000000..e82df73be --- /dev/null +++ b/twix/twix.d.ts @@ -0,0 +1,134 @@ +// Type definitions for twix.js 0.6.3 +// Project: https://github.com/icambron/twix.js +// Definitions by: j3ko +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module moment { + interface Moment { + twix(date: Date): Twix; + twix(date: Date, allDay: boolean): Twix; + twix(date: Date, options: TwixFormatOptions): Twix; + twix(date: Date, format: string, options: TwixFormatOptions): Twix; + + twix(date: Moment): Twix; + twix(date: Moment, allDay: boolean): Twix; + twix(date: Moment, options: TwixFormatOptions): Twix; + twix(date: Moment, format: string, options: TwixFormatOptions): Twix; + + twix(date: MomentInput): Twix; + twix(date: MomentInput, allDay: boolean): Twix; + twix(date: MomentInput, options: TwixFormatOptions): Twix; + twix(date: MomentInput, format: string, options: TwixFormatOptions): Twix; + + twix(date: number): Twix; + twix(date: number, allDay: boolean): Twix; + twix(date: number, options: TwixFormatOptions): Twix; + twix(date: number, format: string, options: TwixFormatOptions): Twix; + + twix(date: number[]): Twix; + twix(date: number[], allDay: boolean): Twix; + twix(date: number[], options: TwixFormatOptions): Twix; + twix(date: number[], format: string, options: TwixFormatOptions): Twix; + + twix(date: string): Twix; + twix(date: string, allDay: boolean): Twix; + twix(date: string, options: TwixFormatOptions): Twix; + twix(date: string, format: string, options: TwixFormatOptions): Twix; + } + + interface MomentStatic { + twix(start: Moment, end: Moment): Twix; + twixClass: TwixStatic; + } + + interface TwixFormatOptions { + groupMeridiems?: boolean; + spaceBeforeMeridiem?: boolean; + showDate?: boolean; + showDayOfWeek?: boolean; + twentyFourHour?: boolean; + implicitMinutes?: boolean; + implicitYear?: boolean; + yearFormat?: string; + monthFormat?: string; + weekdayFormat?: string; + dayFormat?: string; + meridiemFormat?: string; + hourFormat?: string; + minuteFormat?: string; + allDay?: any; // boolean | string + explicitAllDay?: boolean; + lastNightEndsAt?: number; + } + + interface TwixSimpleFormatOptions { + allDay?: string; + template?: (left: any, right: any) => any; + } + + interface TwixIter { + hasNext(): boolean; + next(): Twix; + } + + interface Duration { + afterMoment(date: string): string; + beforeMoment(date: string): string; + } + + interface Twix { + isPast(): boolean; + isFuture(): boolean; + isCurrent(): boolean; + isSame(period: string): boolean; + contains(date: string): boolean; + contains(date: Date): boolean; + contains(date: Moment): boolean; + length(period: string): number; + count(period: string): number; + countInner(period: string): number; + + iterate(period: string): TwixIter; + iterate(num: number, period: string): TwixIter; + iterate(duration: Duration): TwixIter; + + iterateInner(period: string): TwixIter; + iterateInner(num: number, period: string): TwixIter; + + overlaps(other: Twix): boolean; + engulfs(other: Twix): boolean; + equals(other: Twix): boolean; + union(other: Twix): string; + intersection(other: Twix): string; + + xor(other: Twix): Twix[]; + difference(other: Twix): Twix[]; + split(num: number, period: string): Twix[]; + split(other: Moment): Twix[]; + split(start: Moment, end: Moment): Twix[]; + split(duration: Duration): Twix[]; + + humanizeLength(): string; + simpleFormat(): string; + simpleFormat(format: string): string; + simpleFormat(format: string, options: TwixSimpleFormatOptions): string; + + format(): string; + format(options: TwixFormatOptions): string; + + asDuration(period: string): Duration; + isValid(): boolean; + } + + interface TwixStatic { + formatTemplate?: (left: any, right: any) => any; + } +} + +declare module 'twix' { + var _tmp: moment.MomentStatic; + + export = _tmp; +} \ No newline at end of file diff --git a/type-check/type-check-tests.ts b/type-check/type-check-tests.ts new file mode 100644 index 000000000..b1d629309 --- /dev/null +++ b/type-check/type-check-tests.ts @@ -0,0 +1,95 @@ +// run this in node +/// +import tchecker = require("type-check"); + +var typeCheck = (i1:string,i2:any,i3?: TypeCheck.Options ) => { + console.log(tchecker.typeCheck(i1,i2,i3)); + } ; +var parseType = (i1:string) => { + var res = tchecker.parseType(i1); + console.log(res); + return res; + } ; +var parsedTypeCheck= (i1:any,i2:any) => { + var res =tchecker.parsedTypeCheck(i1,i2); + console.log(res); + return res; + } ; +var TCVersion= () => { console.log(tchecker.VERSION); } ; + + + +console.log("===>testing typeCheck function"); +typeCheck('Number', 1); // true +typeCheck('Number', 2); // true +typeCheck('Number', 'str'); // false +typeCheck('Error', new Error); // true +typeCheck('Undefined', undefined); // true + +console.log("===>testing typeCheck function on Date"); +typeCheck('Date', new Date()); // true +typeCheck('Date', new Date("invalid")); // false + +// Comment +typeCheck('count::Number', 1); // true + +// One type OR another type: +typeCheck('Number | String', 2); // true +typeCheck('Number | String', 'str'); // true + +// Wildcard, matches all types: +typeCheck('*', 2) // true + +// Array, all elements of a single type: +typeCheck('[Number]', [1, 2, 3]); // true +typeCheck('[Number]', [1, 'str', 3]); // false + +// Tuples, or fixed length arrays with elements of different types: +typeCheck('(String, Number)', ['str', 2]); // true +typeCheck('(String, Number)', ['str']); // false +typeCheck('(String, Number)', ['str', 2, 5]); // false + +// Object properties: +typeCheck('{x: Number, y: Boolean}', {x: 2, y: false}); // true +typeCheck('{x: Number, y: Boolean}', {x: 2}); // false +typeCheck('{x: Number, y: Maybe Boolean}', {x: 2}); // true +typeCheck('{x: Number, y: Boolean}', {x: 2, y: false, z: 3}); // false +typeCheck('{x: Number, y: Boolean, ...}', {x: 2, y: false, z: 3}); // true + +// A particular type AND object properties: +typeCheck('RegExp{source: String, ...}', /re/i); // true +typeCheck('RegExp{source: String, ...}', {source: 're'}); // false + + + +console.log("===>testing custom types"); +// Custom types: +var opt = {customTypes: + {Even: { typeOf: 'Number', + validate: function(x:number) { console.log("=>testing even"); return x % 2 === 0; } +}}}; +typeCheck('Even', 2, opt); // true + + +opt = {customTypes: +{Odd : { typeOf: 'Number', + validate: function(x:number) { console.log("=>testing odd");return x % 2 !== 0; } +}}}; +typeCheck('Odd', 3, opt); // true + + +console.log("===>testing nested types"); +// Nested: +var type = '{a: (String, [Number], {y: Array, ...}), b: Error{message: String, ...}}' +typeCheck(type, {a: ['hi', [1, 2, 3], {y: [1, 'ms']}], b: new Error('oh no')}); // true + + + + + +console.log("===>testing parseType function"); +// parseType(type); +var parsedType = parseType( 'Number'); // object +console.log("===>testing parsedTypeCheck function"); +// parsedTypeCheck(parsedType, input, options); +parsedTypeCheck(parsedType, 2); // true diff --git a/type-check/type-check.d.ts b/type-check/type-check.d.ts new file mode 100644 index 000000000..12b7de594 --- /dev/null +++ b/type-check/type-check.d.ts @@ -0,0 +1,33 @@ +// Type definitions for type-check v0.3.1 +// Project: https://github.com/gkz/type-check +// Definitions by: Hans Windhoff +// Definitions: https://github.com/borisyankov/DefinitelyTyped + + +declare module TypeCheck { + + export interface CustomType { + [typeName: string]: { + typeOf: string; + validate: (x: any)=> any; + } + } + + export interface Options { + customTypes: CustomType; + } + + export interface TC{ + VERSION: string; + typeCheck: (typeDescription: string , inst: any, options?: Options) => boolean; + parseType: (typeDescription: string) => Object; + parsedTypeCheck: (parsedType: any, obj: any) => boolean; + + } +} + +declare var typecheck: TypeCheck.TC; + +declare module "type-check" { + export=typecheck; +} diff --git a/type-name/type-name-tests.ts b/type-name/type-name-tests.ts new file mode 100644 index 000000000..57ae32d37 --- /dev/null +++ b/type-name/type-name-tests.ts @@ -0,0 +1,5 @@ +/// + +import typeName = require("type-name"); +console.log(typeName('foo') === 'string'); +console.log(typeName([1, 2]) === 'Array'); diff --git a/type-name/type-name.d.ts b/type-name/type-name.d.ts new file mode 100644 index 000000000..f94b96d4f --- /dev/null +++ b/type-name/type-name.d.ts @@ -0,0 +1,11 @@ +// Type definitions for type-name v1.0.1 +// Project: https://github.com/twada/type-name/ +// Definitions by: OKUNOKENTARO +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare function typeName(anyVar: any): string; +declare module typeName {} + +declare module "type-name" { + export = typeName; +} \ No newline at end of file diff --git a/underscore/underscore-tests.ts b/underscore/underscore-tests.ts index 3fb993a3d..60c1708d0 100644 --- a/underscore/underscore-tests.ts +++ b/underscore/underscore-tests.ts @@ -11,6 +11,7 @@ _.map({ one: 1, two: 2, three: 3 }, (value, key) => value * 3); //var sum = _.reduce([1, 2, 3], (memo, num) => memo + num, 0); // https://typescript.codeplex.com/workitem/1960 var sum = _.reduce([1, 2, 3], (memo, num) => memo + num, 0); sum = _.reduce([1, 2, 3], (memo, num) => memo + num); // memo is optional #issue 5 github +sum = _.reduce({'a':'1', 'b':'2', 'c':'3'}, (memo, numstr) => memo + (+numstr)); var list = [[0, 1], [2, 3], [4, 5]]; //var flat = _.reduceRight(list, (a, b) => a.concat(b), []); // https://typescript.codeplex.com/workitem/1960 diff --git a/underscore/underscore.d.ts b/underscore/underscore.d.ts index 7ff9aa5eb..03088bffd 100644 --- a/underscore/underscore.d.ts +++ b/underscore/underscore.d.ts @@ -41,18 +41,6 @@ declare module _ { escape?: RegExp; } - interface ListIterator { - (value: T, index: number, list: T[]): TResult; - } - - interface ObjectIterator { - (element: T, key: string, list: any): TResult; - } - - interface MemoIterator { - (prev: TResult, curr: T, index: number, list: T[]): TResult; - } - interface Collection { } // Common interface between Arrays and jQuery objects @@ -64,6 +52,22 @@ declare module _ { interface Dictionary extends Collection { [index: string]: T; } + + interface ListIterator { + (value: T, index: number, list: List): TResult; + } + + interface ObjectIterator { + (element: T, key: string, list: Dictionary): TResult; + } + + interface MemoIterator { + (prev: TResult, curr: T, index: number, list: List): TResult; + } + + interface MemoObjectIterator { + (prev: TResult, curr: T, key: string, list: Dictionary): TResult; + } } interface UnderscoreStatic { @@ -181,7 +185,7 @@ interface UnderscoreStatic { reduce( list: _.Dictionary, - iterator: _.ObjectIterator, + iterator: _.MemoObjectIterator, memo?: TResult, context?: any): TResult; diff --git a/uniq/uniq-tests.ts b/uniq/uniq-tests.ts new file mode 100644 index 000000000..b9facc8e2 --- /dev/null +++ b/uniq/uniq-tests.ts @@ -0,0 +1,7 @@ +import unique = require("uniq"); +var data = [1, 2, 2, 3, 4, 5, 5, 5, 6]; +var datastr = ["1", "2", "2", "3", "4", "5", "5", "5", "6"]; +var dataMix = ["1", 2,"2", {"2":2}, "3", "4", "5", "5", "5", "6"]; +console.log(unique(data)); +console.log(unique(datastr)); +console.log(unique(dataMix)); diff --git a/uniq/uniq.d.ts b/uniq/uniq.d.ts new file mode 100644 index 000000000..f682262c9 --- /dev/null +++ b/uniq/uniq.d.ts @@ -0,0 +1,15 @@ +// Type definitions for uniq +// Project: https://www.npmjs.com/package/uniq +// Definitions by: Hans Windhoff +// Definitions: https://github.com/borisyankov/DefinitelyTyped + + +interface Uniq{ + (ip:Array): Array; +} + +declare var uniq :Uniq; + +declare module "uniq" { +export = uniq; +} diff --git a/urijs/URI.d.ts b/urijs/URI.d.ts deleted file mode 100644 index 448365762..000000000 --- a/urijs/URI.d.ts +++ /dev/null @@ -1,186 +0,0 @@ -// Type definitions for URI.js -// Project: https://github.com/medialize/URI.js -// Definitions by: RodneyJT -// Definitions: https://github.com/borisyankov/DefinitelyTyped - -/// - -interface URIOptions { - protocol?: string; - username?: string; - password?: string; - hostname?: string; - port?: string; - path?: string; - query?: string; - fragment?: string; -} - -declare class URI { - constructor(); - constructor(uri: string); - constructor(options: URIOptions); - clone(): URI; - href(): string; - href(url: string): void; - valueOf(): string; - scheme(): string; - protocol(): string; - scheme(protocol: string): URI; - protocol(protocol: string): URI; - username(): string; - username(uname: string): URI; - password(): string; - password(pw: string): URI; - port(): string; - port(port: string): URI; - hostname(): string; - hostname(hostname: string): URI; - host(): string; - host(host: string): URI; - userinfo(): string; - userinfo(userinfo: string): URI; - authority(): string; - authority(authority: string): URI; - domain(): string; - domain(domain: boolean): string; - domain(domain: string): URI; - subdomain(): string; - subdomain(subdomain: string): URI; - tld(): string; - tld(tld: boolean): string; - tld(tld: string): URI; - path(): string; - path(path: boolean): string; - path(path: string): URI; - pathname(): string; - pathname(path: boolean): string; - pathname(path: string): URI; - directory(): string; - directory(dir: boolean): string; - directory(dir: string): URI; - filename(): string; - filename(file: boolean): string; - filename(file: string): URI; - suffix(): string; - suffix(suffix: boolean): string; - suffix(suffix: string): URI; - segment(): string[]; - segment(segments: string[]): string; - segment(position: number): string; - segment(position: number, level: string): string; - segment(level: string): string; - search(): string; - search(qry: string): URI; - search(qry: boolean): any; - search(qry: Object): URI; - query(): string; - query(qry: string): URI; - query(qry: boolean): Object; - query(qry: Object): URI; - hash(): string; - hash(hash: string): URI; - fragment(): string; - fragment(fragment: string): URI; - resource(): string; - resource(resource: string): URI; - is(qry: string): boolean; - addSearch(qry: string): URI; - addSearch(qry: Object): URI; - addQuery(qry: string): URI; - addQuery(qry: Object): URI; - removeSearch(qry: string): URI; - removeSearch(qry: Object): URI; - removeQuery(qry: string): URI; - removeQuery(qry: Object): URI; - addFragment(fragment: string): URI; - //fragmentPrefix: string; - fragmentPrefix(prefix: string): URI; - normalize(): URI; - normalizeProtocol(): URI; - normalizeHostname(): URI; - normalizePort(): URI; - normalizePathname(): URI; - normalizePath(): URI; - normalizeSearch(): URI; - normalizeQuery(): URI; - normalizeHash(): URI; - normalizeFragment(): URI; - iso8859(): URI; - unicode(): URI; - readable(): string; - relativeTo(path: string): URI; - absoluteTo(path: string): URI; - equals(): boolean; - equals(url: string): boolean; - static parse(url: string): { - protocol: string; - username: string; - password: string; - hostname: string; - port: string; - path: string; - query: string; - fragment: string; - }; - static parseAuthority(url: string, parts: { - username?: string; - password?: string; - hostname?: string; - port?: string; - }): string; - static parseUserinfo(url: string, parts: { - username?: string; - password?: string; - }): string; - static parseHost(url: string, parts: { - hostname?: string; - port?: string; - }): string; - static parseQuery(url: string): Object; - static build(parts: { - protocol: string; - username: string; - password: string; - hostname: string; - port: string; - path: string; - query: string; - fragment: string; - }): string; - static buildAuthority(parts: { - username?: string; - password?: string; - hostname?: string; - port?: string; - }): string; - static buildUserinfo(parts: { - username?: string; - password?: string; - }): string; - static buildHost(parts: { - hostname?: string; - port?: string; - }): string; - static buildQuery(qry: Object): string; - static buildQuery(qry: Object, duplicates: boolean): string; - static encode(str: string): string; - static decode(str: string): string; - static encodeReserved(str: string): string; - static encodeQuery(qry: string): string; - static decodeQuery(qry: string): string; - static addQuery(data: Object, prop: string, value: string): Object; - static addQuery(data: Object, qryObj: Object): Object; - static removeQuery(data: Object, prop: string, value: string): Object; - static removeQuery(data: Object, props: string[]): Object; - static removeQuery(data: Object, props: Object): Object; - static commonPath(path1: string, path2: string): string; - static withinString(source: string, func: (url: string) => string): string; - static iso8859(): void; - static unicode(): void; - static expand(template: string, vals: Object): URI; -} - -interface JQuery { - uri(): URI; -} diff --git a/urijs/URIjs-tests.ts b/urijs/URIjs-tests.ts new file mode 100644 index 000000000..2dfd15618 --- /dev/null +++ b/urijs/URIjs-tests.ts @@ -0,0 +1,36 @@ +/// + +URI(); +URI('http://user:pass@example.org:80/foo/bar.html?foo=bar&bar=baz#frag'); +URI({ + protocol: 'http', + username: 'user', + password: 'pass', + hostname: 'example.org', + port: '80', + path: '/foo/bar.html', + query: 'foo=bar&bar=baz', + fragment: 'frag' +}); +URI(document.createElement('a')); + +new URI(); +new URI('http://user:pass@example.org:80/foo/bar.html?foo=bar&bar=baz#frag'); +new URI({ + protocol: 'http', + username: 'user', + password: 'pass', + hostname: 'example.org', + port: '80', + path: '/foo/bar.html', + query: 'foo=bar&bar=baz', + fragment: 'frag' +}); +new URI(document.createElement('a')); + +URI('').setQuery('foo', 'bar'); +URI('').setQuery({ foo: 'bar' }); +URI('').setSearch('foo', 'bar'); +URI('').setSearch({ foo: 'bar' }); + +var uri: uri.URI = $('a').uri(); diff --git a/urijs/URIjs.d.ts b/urijs/URIjs.d.ts new file mode 100644 index 000000000..b59dad6aa --- /dev/null +++ b/urijs/URIjs.d.ts @@ -0,0 +1,228 @@ +// Type definitions for URI.js 1.15.1 +// Project: https://github.com/medialize/URI.js +// Definitions by: RodneyJT , Brian Surowiec +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module uri { + + interface URI { + absoluteTo(path: string): URI; + addFragment(fragment: string): URI; + addQuery(qry: string): URI; + addQuery(qry: Object): URI; + addSearch(qry: string): URI; + addSearch(qry: Object): URI; + authority(): string; + authority(authority: string): URI; + + clone(): URI; + + directory(): string; + directory(dir: boolean): string; + directory(dir: string): URI; + domain(): string; + domain(domain: boolean): string; + domain(domain: string): URI; + + equals(): boolean; + equals(url: string): boolean; + + filename(): string; + filename(file: boolean): string; + filename(file: string): URI; + fragment(): string; + fragment(fragment: string): URI; + fragmentPrefix(prefix: string): URI; + + hash(): string; + hash(hash: string): URI; + host(): string; + host(host: string): URI; + hostname(): string; + hostname(hostname: string): URI; + href(): string; + href(url: string): void; + + is(qry: string): boolean; + iso8859(): URI; + + normalize(): URI; + normalizeFragment(): URI; + normalizeHash(): URI; + normalizeHostname(): URI; + normalizePath(): URI; + normalizePathname(): URI; + normalizePort(): URI; + normalizeProtocol(): URI; + normalizeQuery(): URI; + normalizeSearch(): URI; + + password(): string; + password(pw: string): URI; + path(): string; + path(path: boolean): string; + path(path: string): URI; + pathname(): string; + pathname(path: boolean): string; + pathname(path: string): URI; + port(): string; + port(port: string): URI; + protocol(): string; + protocol(protocol: string): URI; + + query(): string; + query(qry: string): URI; + query(qry: boolean): Object; + query(qry: Object): URI; + + readable(): string; + relativeTo(path: string): URI; + removeQuery(qry: string): URI; + removeQuery(qry: Object): URI; + removeSearch(qry: string): URI; + removeSearch(qry: Object): URI; + resource(): string; + resource(resource: string): URI; + + scheme(): string; + scheme(protocol: string): URI; + search(): string; + search(qry: string): URI; + search(qry: boolean): any; + search(qry: Object): URI; + segment(): string[]; + segment(segments: string[]): string; + segment(position: number): string; + segment(position: number, level: string): string; + segment(level: string): string; + setQuery(key: string, value: string): URI; + setQuery(qry: Object): URI; + setSearch(key: string, value: string): URI; + setSearch(qry: Object): URI; + subdomain(): string; + subdomain(subdomain: string): URI; + suffix(): string; + suffix(suffix: boolean): string; + suffix(suffix: string): URI; + + tld(): string; + tld(tld: boolean): string; + tld(tld: string): URI; + + unicode(): URI; + userinfo(): string; + userinfo(userinfo: string): URI; + username(): string; + username(uname: string): URI; + + valueOf(): string; + } + + interface URIOptions { + protocol?: string; + username?: string; + password?: string; + hostname?: string; + port?: string; + path?: string; + query?: string; + fragment?: string; + } + + interface URIStatic { + (): URI; + (value: string | URIOptions | HTMLElement): URI; + + new (): URI; + new (value: string | URIOptions | HTMLElement): URI; + + addQuery(data: Object, prop: string, value: string): Object; + addQuery(data: Object, qryObj: Object): Object; + + build(parts: { + protocol: string; + username: string; + password: string; + hostname: string; + port: string; + path: string; + query: string; + fragment: string; + }): string; + buildAuthority(parts: { + username?: string; + password?: string; + hostname?: string; + port?: string; + }): string; + buildHost(parts: { + hostname?: string; + port?: string; + }): string; + buildQuery(qry: Object): string; + buildQuery(qry: Object, duplicates: boolean): string; + buildUserinfo(parts: { + username?: string; + password?: string; + }): string; + + commonPath(path1: string, path2: string): string; + + decode(str: string): string; + decodeQuery(qry: string): string; + + encode(str: string): string; + encodeQuery(qry: string): string; + encodeReserved(str: string): string; + expand(template: string, vals: Object): URI; + + iso8859(): void; + + parse(url: string): { + protocol: string; + username: string; + password: string; + hostname: string; + port: string; + path: string; + query: string; + fragment: string; + }; + parseAuthority(url: string, parts: { + username?: string; + password?: string; + hostname?: string; + port?: string; + }): string; + parseHost(url: string, parts: { + hostname?: string; + port?: string; + }): string; + parseQuery(url: string): Object; + parseUserinfo(url: string, parts: { + username?: string; + password?: string; + }): string; + + removeQuery(data: Object, prop: string, value: string): Object; + removeQuery(data: Object, props: string[]): Object; + removeQuery(data: Object, props: Object): Object; + + unicode(): void; + + withinString(source: string, func: (url: string) => string): string; + } + +} + +interface JQuery { + uri(): uri.URI; +} + +declare var URI: uri.URIStatic; + +declare module 'URI' { + export = URI; +} diff --git a/urlsafe-base64/urlsafe-base64-tests.ts b/urlsafe-base64/urlsafe-base64-tests.ts new file mode 100644 index 000000000..2c7d4722f --- /dev/null +++ b/urlsafe-base64/urlsafe-base64-tests.ts @@ -0,0 +1,9 @@ +/// + +import URLSafeBase64 = require('urlsafe-base64'); + +var base64 = URLSafeBase64.encode(new Buffer('3Rpbmd1aXNoZWQ', 'base64')); + +var buf = URLSafeBase64.decode('3Rpbmd1aXNoZWQ'); + +var isValid = URLSafeBase64.validate('3Rpbmd1aXNoZWQ'); diff --git a/urlsafe-base64/urlsafe-base64.d.ts b/urlsafe-base64/urlsafe-base64.d.ts new file mode 100644 index 000000000..c9c6ed0b9 --- /dev/null +++ b/urlsafe-base64/urlsafe-base64.d.ts @@ -0,0 +1,50 @@ +// Type definitions for urlsafe-base64 v1.0.0 +// Project: https://github.com/RGBboy/urlsafe-base64 +// Definitions by: Tanguy Krotoff +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module 'urlsafe-base64' { + /** + * Library version. + */ + export var version: string; + + /** + * .encode + * + * return an encoded Buffer as URL Safe Base64 + * + * Note: This function encodes to the RFC 4648 Spec where '+' is encoded + * as '-' and '/' is encoded as '_'. The padding character '=' is + * removed. + * + * @param {Buffer} buffer + * @return {String} + * @api public + */ + export function encode(buffer: Buffer): string; + + /** + * .decode + * + * return an decoded URL Safe Base64 as Buffer + * + * @param {String} + * @return {Buffer} + * @api public + */ + export function decode(base64: string): Buffer; + + /** + * .validate + * + * Validates a string if it is URL Safe Base64 encoded. + * + * @param {String} + * @return {Boolean} + * @api public + */ + export function validate(base64: string): boolean; +} diff --git a/victor/victor-tests.ts b/victor/victor-tests.ts new file mode 100644 index 000000000..76eb79c22 --- /dev/null +++ b/victor/victor-tests.ts @@ -0,0 +1,52 @@ +/// + +var vector1 = new Victor(10,10) +var vector2 = new Victor(20,20) + +vector1.add(vector2).addX(vector2).addY(vector2) + +vector1.clone().copy(vector2).toString() + +vector1.toArray() +vector1.toObject() + +vector1.subtract(vector2).subtractX(vector2).subtractY(vector2) +.multiply(vector2).multiplyX(vector2).multiplyY(vector2) +.divide(vector2).divideX(vector2).divideY(vector2) +.invert().invertX().invertY() +.mix(vector2, 0.5).mixX(vector2,0.5).mixY(vector2,0.5) +.normalize().norm() +.limit(100,5) +.unfloat() +.rotate(10) +.rotateDeg(10) +.rotateBy(10) +.rotateByDeg(10) +.randomize(new Victor(10,10), new Victor(100,100)).randomizeY(new Victor(10,10), new Victor(100,100)).randomizeX(new Victor(10,10), new Victor(100,100)).randomizeAny(new Victor(10,10), new Victor(100,100)) + +vector2.dot(vector1) +vector2.cross(vector1) + +vector1.length() +vector1.lengthSq() + +vector1.distance(vector2) +vector1.distanceSq(vector2) + +vector1.distanceX(vector2) +vector1.distanceY(vector2) + +vector1.horizontalAngle() +vector1.horizontalAngleDeg() +vector1.angle() +vector1.angleDeg() +vector1.verticalAngle() +vector1.verticalAngleDeg() + + + + + + + + diff --git a/victor/victor.d.ts b/victor/victor.d.ts new file mode 100644 index 000000000..4206ffeb6 --- /dev/null +++ b/victor/victor.d.ts @@ -0,0 +1,355 @@ +// Type definitions for Victor.js 0.2.5 +// Project: http://victorjs.org/ +// Definitions by: Ivane Gegia +// Definitions: https://github.com/borisyankov/DefinitelyTyped + + +interface VictorCoordinates +{ + x:number + y:number +} + +declare class Victor +{ + x:number; + y:number; + + /** + * Can be used without the new keyword. + * @param x The X component + * @param y The Y component + */ + constructor(x:number,y:number); + + /** + * Creates vector from array. + * @param arr array An array that contains the X component in the first element and the Y component in the second + */ + static fromArray(arr:Array):Victor; + + /** + * Creates vector from object. + * @param obj An object containing the X component in the x property and the Y component in the y property + */ + static fromObject(obj:VictorCoordinates):Victor; + + /** + * Creates a new Victor with the same X and Y components. + */ + clone():Victor; + + /** + * Copies the X component of another vector in to itself. + * @param vector + */ + copyX(vector:Victor):Victor; + + /** + * Copies the Y component of another vector in to itself. + * @param vector + */ + copyY(vector:Victor):Victor; + + /** + * Copies the X and Y components of another vector in to itself. + * @param vector + */ + copy(vector:Victor):Victor; + + /** + * Returns a string representation of the X and Y components. + */ + toString():string; + + /** + * Returns an array representation of the X and Y components. + */ + toArray():Array; + + /** + * Returns an object representation of tha X and Y components. + */ + toObject():VictorCoordinates; + + /** + * Adds another vector's X component to itself. + * @param vector + */ + addX(vector:Victor):Victor; + + /** + * Adds another vector's Y component to itself. + * @param vector + */ + addY(vector:Victor):Victor; + + /** + * Adds another vector to itself. + * @param vector + */ + add(vector:Victor):Victor; + + /** + * Subtracts another vector's X component from itself. + * @param vector + */ + subtractX(vector:Victor):Victor; + + /** + * Subtracts another vector's Y component from itself. + * @param vector + */ + subtractY(vector:Victor):Victor; + + /** + * Subtracts another vector from itself. + * @param vector + */ + subtract(vector:Victor):Victor; + + /** + * Multiplies the X component with the X component of another vector. + * @param vector + */ + multiplyX(vector:Victor):Victor; + + /** + * Multiplies the Y component with the Y component of another vector. + * @param vector + */ + multiplyY(vector:Victor):Victor; + + /** + * Multiplies both components with another vector. + * @param vector + */ + multiply(vector:Victor):Victor; + + /** + * Divides the X component by the X component of another vector. + * @param vector + */ + divideX(vector:Victor):Victor; + + /** + * Divides the Y component by the Y component of another vector. + * @param vector + */ + divideY(vector:Victor):Victor; + + /** + * Divides both components by another vector. + * @param scalar + */ + divide(scalar:Victor):Victor; + + /** + * Inverts the X component. + */ + invertX():Victor; + + /** + * Inverts the Y component. + */ + invertY():Victor; + + /** + * Inverts both components. + */ + invert():Victor; + + /** + * Performs a linear blend / interpolation of the X component towards another vector. + * @param vector Number amount Value between 0 and 1. Default: 0.5 + * @param ammount + */ + mixX(vector:Victor, ammount:number):Victor; + + /** + * Performs a linear blend / interpolation of the Y component towards another vector. + * @param vector + * @param ammount + */ + mixY(vector:Victor, ammount:number):Victor; + + /** + * Performs a linear blend / interpolation towards another vector. + * @param vector + * @param ammount + */ + mix(vector:Victor, ammount:number):Victor; + + /** + * Normalizes the vector by scaling it down to a length of 1 while keeping its direction. + */ + normalize():Victor; + + /** + * Alias of normalize. + */ + norm():Victor; + + /** + * If either component is greater than max, multiplies the component by multiplier. + * @param max + * @param multiplier + */ + limit(max:number, multiplier:number):Victor; + + /** + * Rounds the components to integer numbers. + */ + unfloat():Victor; + + /** + * Rotates the vector to a certain angle, in radians CCW from +X axis. + * @param angle + */ + rotate(angle:number):Victor; + + /** + * Same as rotate but uses degrees + * @param angle + */ + rotateDeg(angle:number):Victor; + + /** + * Rotates the vector by a rotation angle, given in radians CCW from +X axis. + * @param rotation + */ + rotateBy(rotation:number):Victor; + + /** + * Same as rotateBy but uses degrees + * @param rotation + */ + rotateByDeg(rotation:number):Victor; + + /** + * Randomizes the X component with a value between topLeft and bottomRight. + * @param topLeft + * @param bottomRight + */ + randomizeX(topLeft:Victor, bottomRight:Victor):Victor; + + /** + * Randomizes the Y component with a value between topLeft and bottomRight. + * @param topLeft + * @param bottomRight + */ + randomizeY(topLeft:Victor, bottomRight:Victor):Victor; + + /** + * Randomizes the components with a value between topLeft and bottomRight. + * @param topLeft + * @param bottomRight + */ + randomize(topLeft:Victor, bottomRight:Victor):Victor; + + /** + * Randomly randomizes either the X component or the Y component with a value between topLeft and bottomRight. + * @param topLeft + * @param bottomRight + */ + randomizeAny(topLeft:Victor, bottomRight:Victor):Victor; + + /** + * Returns the dot product of two vectors. + * @param vector + */ + dot(vector:Victor):number; + + /** + * Returns the cross product of two vectors. + * @param vector + */ + cross(vector:Victor):number; + + /** + * Returns the length / magnitude. + */ + length():number; + + /** + * Alias for length. + */ + magnitude():number; + + /** + * Returns the squared length / magnitude. If the length is only needed for comparison, this function is faster than length. + */ + lengthSq():number; + + /** + * Returns the distance of the X component from another vector. + * @param vector + */ + distanceX(vector:Victor):number; + + /** + * Same as distanceX but always returns an absolute value. + * @param vector + */ + absDistanceX(vector:Victor):number; + + /** + * Returns the distance of the Y component from another vector. + * @param vector + */ + distanceY(vector:Victor):number; + + /** + * Same as distanceY but always returns an absolute value. + * @param vector + */ + absDistanceY(vector:Victor):number; + + /** + * Returns the euclidean distance between two vectors. + * @param vector + */ + distance(vector:Victor):number; + + /** + * Returns the squared euclidean distance between two vectors. If the distance is only needed for comparison, this function is faster than distance. + * @param vector + */ + distanceSq(vector:Victor):number; + + /** + * Returns the angle towards X in radians. + */ + horizontalAngle():number; + + /** + * Alias for horizontalAngle. + */ + angle():number; + + /** + * Alias for horizontalAngle. + */ + direction():number; + + /** + * Same as horizontalAngle but returns degrees. + */ + horizontalAngleDeg():number; + + /** + * Alias for horizontalAngleDeg. + */ + angleDeg():number; + + /** + * Returns the angle towards Y in radians. + */ + verticalAngle():number; + + /** + * Same as verticalAngle but returns degrees. + */ + verticalAngleDeg():number; + +} diff --git a/vinyl-fs/vinyl-fs.d.ts b/vinyl-fs/vinyl-fs.d.ts index e9f549161..c9018c400 100644 --- a/vinyl-fs/vinyl-fs.d.ts +++ b/vinyl-fs/vinyl-fs.d.ts @@ -8,24 +8,20 @@ declare module NodeJS { interface WritableStream { - write(buffer: any/* Vinyl.IFile */, cb?: Function): boolean; + write(buffer: any/* Vinyl.File */, cb?: Function): boolean; } } declare module "vinyl-fs" { import _events = require("events"); + import File = require("vinyl"); - function src(globs:string, opt?:{read?:boolean;buffer?:boolean;}):NodeJS.ReadWriteStream; + function src(globs:string|string[], opt?:{read?:boolean;buffer?:boolean;}):NodeJS.ReadWriteStream; - function src(globs:string[], opt?:{read?:boolean;buffer?:boolean;}):NodeJS.ReadWriteStream; + function watch(globs:string|string[], cb?:(outEvt:{type:any;path:any;old:any;})=>void):_events.EventEmitter; - function watch(globs:string, cb?:(outEvt:{type:any;path:any;old:any;})=>void):_events.EventEmitter; + function watch(globs:string|string[], opt?:{interval?:number;debounceDelay?:number;cwd?:string;maxListeners?:Function;}, cb?:(outEvt:{type:any;path:any;old:any;})=>void):_events.EventEmitter; - function watch(globs:string[], cb?:(outEvt:{type:any;path:any;old:any;})=>void):_events.EventEmitter; - - function watch(globs:string, opt?:{interval?:number;debounceDelay?:number;cwd?:string;maxListeners?:Function;}, cb?:(outEvt:{type:any;path:any;old:any;})=>void):_events.EventEmitter; - - function watch(globs:string[], opt?:{interval?:number;debounceDelay?:number;cwd?:string;maxListeners?:Function;}, cb?:(outEvt:{type:any;path:any;old:any;})=>void):_events.EventEmitter; - - function dest(folder:string, opt?:{cwd?:string; mode?:any/* number or string */;}):NodeJS.ReadWriteStream; + function dest(folder: string, opt?: { cwd?: string; mode?: number|string; }): NodeJS.ReadWriteStream; + function dest(getFolderPath: (file: File) => string): NodeJS.ReadWriteStream; } diff --git a/vortex-web-client/vortex-web-client-tests.ts b/vortex-web-client/vortex-web-client-tests.ts new file mode 100644 index 000000000..216e268c5 --- /dev/null +++ b/vortex-web-client/vortex-web-client-tests.ts @@ -0,0 +1,23 @@ +/// + +var runtime = new dds.runtime.Runtime(); +runtime.connect("ws://localhost:9000", "user:pass"); + +var tqos = new dds.TopicQos(); +var chatTopic = new dds.Topic(0, 'ChatMessage', tqos); +runtime.registerTopic(chatTopic); + +var writerQos = new dds.DataWriterQos(); +var writer = new dds.DataWriter(runtime, chatTopic, writerQos); + +writer.write({ + user: "John Smith", + msg : "Hello World!" +}); + +var readerQos = new dds.DataReaderQos(); +var reader = new dds.DataReader(runtime, chatTopic, readerQos); + +reader.addListener(function(msg) { + console.log(JSON.stringify(msg)); +}); diff --git a/vortex-web-client/vortex-web-client.d.ts b/vortex-web-client/vortex-web-client.d.ts new file mode 100644 index 000000000..de665c780 --- /dev/null +++ b/vortex-web-client/vortex-web-client.d.ts @@ -0,0 +1,488 @@ +// Type definitions for Vortex Web 1.2.0p1 +// Project: http://www.prismtech.com/vortex/vortex-web +// Definitions by: Stefan Profanter +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/* + Vortex Web + + This software and documentation are Copyright 2010 to 2015 PrismTech + Limited and its licensees. All rights reserved. See file: + + docs/LICENSE.html + + for full copyright notice and license terms. + */ + +declare module DDS { + + + /** + * Base class for all policies + */ + interface Policy { + + } + + /** + * History policy + */ + export enum HistoryKind { + KeepAll = 0, + KeepLast = 1 + } + + /** + * History policy + */ + export class History implements Policy { + /** + * KeepAll - KEEP_ALL qos policy + */ + KeepAll:any; + /** + * KeepLast - KEEP_LAST qos policy + */ + KeepLast:any; + } + + /** + * Reliability Policy + * @example var qos = Reliability.Reliable + */ + export enum ReliabilityKind { + Reliable = 0, + BestEffort = 1 + } + + /** + * History policy + */ + export class Reliability implements Policy { + /** + * Reliable - 'Reliable' reliability policy + */ + Reliable:any; + /** + * BestEffort - 'BestEffort' reliability policy + */ + BestEffort:any; + } + + /** + * Partition policy + */ + export class Partition implements Policy { + /** + * Create new partition policy + * + * @param policies - partition names + * @example var qos = Partition('p1', 'p2') + */ + constructor(...policies:string[]); + } + + /** + * Content Filter policy + */ + export class ContentFilter implements Policy { + /** + * Create new content filter policy + * + * @param expr - filter expression + * @example var filter = ContentFilter("x>10 AND y<50") + */ + constructor(expr:string); + } + + /** + * Time Filter policy + */ + export class TimeFilter implements Policy { + /** + * Create new content filter policy + * + * @param period - time duration (unit ?) + * @example var filter = TimeFilter(100) + */ + constructor(period:number); + } + + /** + * Durability Policy + */ + export enum DurabilityKind { + Volatile = 0, + TransientLocal = 1, + Transient = 2, + Persistent = 3 + } + + /** + * Durability Qos Policy + */ + export class Durability implements Policy { + /** + * Volatile - Volatile durability policy + */ + Volatile:any; + /** + * TransientLocal - TransientLocal durability policy + */ + TransientLocal:any; + /** + * Transient - Transient durability policy + */ + Transient:any; + /** + * Persistent - Persistent durability policy + */ + Persistent:any; + } + + + interface EntityQos { + /** + * Creates any of the DDS entities quality of service, including DataReaderQos and DataWriterQos. + * + * @param policies - list of policies for the Qos entity + */ + new (...policies:Policy[]): EntityQos; + + /** + * Adds the given policy to this instance. + * @param policy - the policy to add + * @return A new copy of this instance with the combined policies + */ + add (policy:Policy): EntityQos; + } + + + /** + * Topic quality of service object + */ + export var TopicQos:EntityQos; + /** + * DataReader quality of service object + */ + export var DataReaderQos:EntityQos; + + /** + * DataWriter quality of service object + */ + export var DataWriterQos:EntityQos; + + export class Topic { + /** + * Creates a `Topic` in the domain `did`, named `tname`, having `qos` Qos, + * for the type `ttype` whose registered name is `tregtype` + * @param {number} did - DDS domain ID + * @param {string} tname - topic name + * @param {TopicQos} qos - topic Qos + * @param {string} ttype - topic type. If not specified, a generic type is used. + * @param {string} tregtype - topic registered type name. If not specified, 'ttype' is used. + */ + constructor(did:number, tname:string, qos:EntityQos, ttype?:string, tregtype?:string); + + /** + * Called when topic gets registered in the runtime + */ + onregistered():void; + + /** + * Called when topic gets unregistered in the runtime + */ + onunregistered():void; + } + + export class DataReader { + /** + * Creates a `DataReader` for a given topic and a specific in a specific DDS runtime. + * + * A `DataReader` allows to read data for a given topic with a specific QoS. A `DataReader` + * * goes through different states, it is intially disconnected and changes to the connected state + * when the underlying transport connection is successfully established with the server. At this point + * a `DataReader` can be explicitely closed or disconnected. A disconnection can happen as the result + * of a network failure or server failure. Disconnection and reconnections are managed by the runtime. + * + * @param runtime - DDS Runtime + * @param topic - DDS Topic + * @param qos - DataReader quality of service + */ + constructor(runtime:Runtime, topic:Topic, qos:EntityQos); + + resetStats():void; + + /** + * Attaches the listener `l` to this data reader and returns + * the id associated to the listener. + * @param l - listener code + * @returns listener handle + */ + addListener(l:(msg:any) => void):number; + + /** + * removes a listener from this data reader. + * @param idx - listener id + */ + removeListener(idx:number):void; + + /** + * closes the DataReader + */ + close():void; + } + + export class DataWriter { + /** + * Creates a `DataWriter` for a given topic and a specific in a specific DDS runtime + * + * defines a DDS data writer. This type + * is used to write data for a specific topic with a given QoS. + * A `DataWriter` goes through different states, it is intially disconnected and changes to the connected + * state when the underlying transport connection is successfully established with the server. + * At this point a `DataWriter` can be explicitely closed or disconnected. A disconnection can happen + * as the result of a network failure or server failure. Disconnection and reconnections are managed by the + * runtime. + * + * @param runtime - DDS Runtime + * @param topic - DDS Topic + * @param qos - DataWriter quality of service + */ + constructor(runtime:Runtime, topic:Topic, qos:EntityQos); + + /** + * Writes one or more samples. + * @param ds - data sample + */ + write(...ds:any[]):void; + + /** + * Closes the DataWriter + */ + close():void; + } + + + export class DataCache { + /** + * Constructs a `DataCache` with a given `depth`. If the `cache` parameter + * is present, then the current cache is initialized with this parameter. + * + * Provides a way of storing and flexibly accessing the + * data received through a `DataReader`. A `DataCache` is organized as + * a map of queues. The depth of the queues is specified at construction + * time. + * + * @param depth - cache size + * @param cache - cache data structure + */ + constructor(depth:number, cache:any); + + /** + * Register a listener to be notified whenever data which matches a predicate is written into the cache. + * If no predicate is provided then the listeners is always notified upon data inserion. + * + * @param l - listener function + * @param p - predicate + */ + addListener(l:(data:any) => void, p?:(data:any) => boolean):void; + + /** + * Write the element `data` with key `k` into the cache. + * + * @param k - data key + * @param data - data value + * @returns the written data value + */ + write(k:any, data:any):any; + + /** + * Same as forEach but applied, for each key, only to the first `n` samples of the cache + * + * @param f - the function to be applied + * @param n - samples set size + */ + forEachN(f:(data:any) => any, n:number):any[]; + + /** + * Execute the function `f` for each element of the cache. + * + * @memberof! dds.DataCache# + * @param f - the function to be applied + * @returns results of the function execution + */ + forEach(f:(data:any) => any):any[]; + + /** + * Returns a cache that is the result of applying `f` to each element of the cache. + * + * @param f - the function to be applied + * @returns A cache holding the results of the function execution + */ + map(f:(data:any) => any):DataCache; + + /** + * Returns the list of elements in the cache that satisfy the predicate `f`. + * + * @param f - the predicate to be applied to filter the cache values + * @returns An array holding the filtered values + */ + filter(f:(data:any) => boolean):any[]; + + /** + * Returns the list of elements in the cache that doesn't satisfy the predicate `f`. + * + * @returns An array holding the filtered values + * @see DataCache#filter + */ + filterNot(f:(data:any) => boolean):any[]; + + /** + * Returns the values included in the cache as an array. + * + * @return All the cache values + */ + read():any[]; + + /** + * Returns the last value of the cache in an array. + * + * @return the last value of the cache + */ + readLast():any; + + /** + * Returns all the values included in the cache as an array and empties the cache. + * + * @return All the cache values + */ + takeAll():any[]; + + /** + * Returns the `K`ith value of the cache as Monad, ie: `coffez.Some` if it exists, `coffez.None` if not. + * + * @return the 'k'th value + */ + take():any; + + /** + * Takes elements from the cache up to when the predicate `f` is satisfied + * + * @param f - the predicate + * @return taken cache values + */ + takeWithFilter(f:(data:any) => boolean):any[]; + + /** + * Return `coffez.Some(v)` if there is an element in the cache corresponding to the + * key `k` otherwise it returns `coffez.None`. + * + * @param k - key + */ + get(k:any):any; + + /** + * Return `coffez.Some(v)` if there is an element in the cache corresponding to the + * key `k` otherwise executes `f` and returns its result. + * + * @param k - key + * @param f - the function to apply + */ + getOrElse(k:any, f:(data:any)=> any):any; + + /** + * folds the element of the cache using `z` as the `zero` element and + * `f` as the binary operator. + * + * @param z - initial value + * @param {function} f - reduce function + */ + fold(z:any, f:(data:any) => any):void; + + /** + * clears the data cache + */ + clear():void; + + } + + interface Runtime { + /** + * Constructs a DDS Runtime object + * + * maintains the connection with the server, re-establish the connection + * if dropped and mediates the `DataReader` and `DataWriter` communication. + */ + new (): Runtime; + + /** + * Connect the runtime to the server. If the runtime is already connected an exception is thrown + * + * @param srv - Vortex Web server WebSocket URL + * @param authToken - Authorization token + */ + connect(server:string, authToken?:string): void; + + /** + * Disconnects, withouth closing, a `Runtime`. Notice that upon re-connection all existing + * subscriptions and publications will be re-restablished. + */ + disconnect(): void; + + /** + * Registers the provided Topic. + * + * @param t - Topic to be registered + */ + registerTopic(t:Topic): void; + + /** + * Function called when runtime is connected. + * + * @param e + */ + onconnect(e:any): void; + + + /** + * Function called when runtime is disconnected. + * + * @param e + */ + ondisconnect(e:any): void; + + /** + * Closes the DDS runtime and as a consequence all the `DataReaders` and `DataWriters` that belong to this runtime. + * + */ + close(): void; + + /** + * Checks whether the Runtime is connected. + * @return `true` if connected, `false` if not + */ + isConnected() : boolean; + + /** + * Checks whether the Runtime is closed. + * @return `true` if connected, `false` if not + */ + isClosed() : boolean; + } + + export var runtime:{ + Runtime : Runtime; + } + + export var VERSION:string; +} + +/** + * Defines the core Vortex-Web-Client javascript library. It includes the JavaScript API for DDS. This API allows + * web applications to share data among them as well as with native DDS applications. + */ +declare +var dds:typeof DDS; + + diff --git a/webix/webix.d.ts b/webix/webix.d.ts index a1761c63b..8e5c89ed1 100644 --- a/webix/webix.d.ts +++ b/webix/webix.d.ts @@ -3202,7 +3202,7 @@ interface form extends webix.ui.baseview{ getParentView():any; getScrollState():any; getTopParentView():webix.ui.baseview; - getValues(details?:any):any[]; + getValues(details?:any):any; hasEvent(name:string):boolean; hide():void; index(obj:any):number; @@ -7530,4 +7530,4 @@ interface window extends webix.ui.baseview{ }} -declare function $$(id: string|Event|HTMLElement):webix.ui.view; +declare function $$(id: string|Event|HTMLElement):webix.ui.baseview; diff --git a/websocket/websocket-tests.ts b/websocket/websocket-tests.ts index 7de0fa5b0..c30ddd3e9 100644 --- a/websocket/websocket-tests.ts +++ b/websocket/websocket-tests.ts @@ -45,6 +45,48 @@ import http = require('http'); console.log(Date.now() + ' Peer ' + connection.remoteAddress + ' disconnected.'); }); }); + + var wsRouter = new websocket.router({ + server: wsServer + }); + + wsRouter.mount('*', (request) => { + if(!originIsAllowed(request.origin)) { + request.reject(); + console.log((new Date()) + ' Connection from origin ' + request.origin + ' rejected.'); + return; + } + + var connection = request.accept('echo-protocol', request.origin); + console.log((new Date()) + ' Connection accepted.'); + connection.on('message', (message: websocket.IMessage) => { + if (message.type === 'utf8') { + console.log('Received Message: ' + message.utf8Data); + connection.sendUTF(message.utf8Data); + } + else if (message.type === 'binary') { + console.log('Received Binary Message of ' + message.binaryData.length + ' bytes'); + connection.sendBytes(message.binaryData); + } + }); + + connection.on('close', (code: number) => { + console.log(Date.now() + ' Peer ' + connection.remoteAddress + ' disconnected.'); + }); + }); + + wsRouter.mount('*', 'protocol', (request) => { + }); + + wsRouter.mount(/^route\/[a-zA-Z]+$/, (request) => { + + }); + + wsRouter.unmount('*'); + wsRouter.unmount('*', 'protocol'); + + wsRouter.unmount(/^route\/[a-zA-Z]+$/); + wsRouter.unmount(/^route\/[a-zA-Z]+$/, 'protocol'); } { @@ -78,7 +120,7 @@ import http = require('http'); setTimeout(sendNumber, 1000); } } - + sendNumber(); }); diff --git a/websocket/websocket.d.ts b/websocket/websocket.d.ts index d984e1bea..d17542e82 100644 --- a/websocket/websocket.d.ts +++ b/websocket/websocket.d.ts @@ -106,7 +106,7 @@ declare module "websocket" { /** * If this is true, websocket connections will be accepted regardless of the path - * and protocol specified by the client. The protocol accepted will be the first + * and protocol specified by the client. The protocol accepted will be the first * that was requested by the client. * @default false */ @@ -118,7 +118,7 @@ declare module "websocket" { * together before going onto the wire. This however comes at the cost of latency. * @default true */ - disableNagleAlgorithm?: boolean; + disableNagleAlgorithm?: boolean; } export class server extends events.EventEmitter { @@ -188,7 +188,7 @@ declare module "websocket" { key: string; /** Parsed resource, including the query string parameters */ resourceURL: url.Url; - + /** * Client's IP. If an `X-Forwarded-For` header is present, the value will be taken * from that header to facilitate WebSocket servers that live behind a reverse-proxy @@ -226,7 +226,7 @@ declare module "websocket" { * After inspecting the `request` properties, call this function on the * request object to accept the connection. If you don't have a particular subprotocol * you wish to speak, you may pass `null` for the `acceptedProtocol` parameter. - * + * * @param [acceptedProtocol] case-insensitive value that was requested by the client */ accept(acceptedProtocol?: string, allowedOrigin?: string, cookies?: ICookie[]): connection; @@ -321,7 +321,7 @@ declare module "websocket" { */ closeReasonCode: number; - /** + /** * The subprotocol that was chosen to be spoken on this connection. This field * will have been converted to lower case. */ @@ -451,13 +451,13 @@ declare module "websocket" { * a Protocol Error on the receiving peer. */ rsv1: boolean; - + /** * Represents the RSV1 field in the framing. Setting this to true will result in * a Protocol Error on the receiving peer. */ rsv2: boolean; - + /** * Represents the RSV1 field in the framing. Setting this to true will result in * a Protocol Error on the receiving peer. @@ -473,7 +473,7 @@ declare module "websocket" { /** * Identifies which kind of frame this is. - * + * * Hex - Dec - Description * 0x00 - 0 - Continuation * 0x01 - 1 - Text Frame @@ -548,7 +548,7 @@ declare module "websocket" { /** * Establish a connection. The remote server will select the best subprotocol that * it supports and send that back when establishing the connection. - * + * * @param [origin] can be used in user-agent scenarios to identify the page containing * any scripting content that caused the connection to be requested. * @param requestUrl should be a standard websocket url @@ -567,6 +567,90 @@ declare module "websocket" { addListener(event: 'connectFailed', cb: (err: Error) => void): client; } + class routerRequest extends events.EventEmitter { + + /** A reference to the original Node HTTP request object */ + httpRequest: http.ClientRequest; + /** A string containing the path that was requested by the client */ + resource: string; + /** Parsed resource, including the query string parameters */ + resourceURL: url.Url; + + /** + * Client's IP. If an `X-Forwarded-For` header is present, the value will be taken + * from that header to facilitate WebSocket servers that live behind a reverse-proxy + */ + remoteAddress: string; + + /** + * If the client is a web browser, origin will be a string containing the URL + * of the page containing the script that opened the connection. + * If the client is not a web browser, origin may be `null` or "*". + */ + origin: string; + + /** The version of the WebSocket protocol requested by the client */ + webSocketVersion: number; + /** An array containing a list of extensions requested by the client */ + requestedExtensions: any[]; + + cookies: ICookie[]; + + constructor(webSocketRequest: request, resolvedProtocol: string); + + /** + * After inspecting the `request` properties, call this function on the + * request object to accept the connection. If you don't have a particular subprotocol + * you wish to speak, you may pass `null` for the `acceptedProtocol` parameter. + * + * @param [acceptedProtocol] case-insensitive value that was requested by the client + */ + accept(acceptedProtocol?: string, allowedOrigin?: string, cookies?: ICookie[]): connection; + + /** + * Reject connection. + * You may optionally pass in an HTTP Status code (such as 404) and a textual + * description that will be sent to the client in the form of an + * `X-WebSocket-Reject-Reason` header. + */ + reject(httpStatus?: number, reason?: string): void; + + // Events + on(event: string, listener: () => void): request; + on(event: 'requestAccepted', cb: (connection: connection) => void): request; + on(event: 'requestRejected', cb: () => void): request; + addListener(event: string, listener: () => void): request; + addListener(event: 'requestAccepted', cb: (connection: connection) => void): request; + addListener(event: 'requestRejected', cb: () => void): request; + } + + interface IRouterConfig { + /* + * The WebSocketServer instance to attach to. + */ + server: server + } + + class router extends events.EventEmitter { + + constructor(config?: IRouterConfig); + + /** Attach to WebSocket server */ + attachServer(server: server): void; + + /** Detach from WebSocket server */ + detachServer(): void; + + mount(path: string, cb: (request: routerRequest) => void): void; + mount(path: string, protocol: string, cb: (request: routerRequest) => void): void; + mount(path: RegExp, cb: (request: routerRequest) => void): void; + mount(path: RegExp, protocol: string, cb: (request: routerRequest) => void): void; + + unmount(path: string, protocol?: string): void; + unmount(path: RegExp, protocol?: string): void; + + } + export var version: string; export var constants: { DEBUG: boolean; diff --git a/websql/websql-tests.ts b/websql/websql-tests.ts new file mode 100644 index 000000000..131883c24 --- /dev/null +++ b/websql/websql-tests.ts @@ -0,0 +1,303 @@ +/// + +interface DbState { + database: Database; + version: DOMString; + transaction: (callback: SQLTransactionCallback, errorCallback?: SQLTransactionErrorCallback, successCallback?: SQLVoidCallback) => void; + readTransaction: (callback: SQLTransactionCallback, errorCallback?: SQLTransactionErrorCallback, successCallback?: SQLVoidCallback) => void; + changeVersion: (oldVersion: DOMString, newVersion: DOMString, callback?: SQLTransactionCallback, errorCallback?: SQLTransactionErrorCallback, successCallback?: SQLVoidCallback) => void +} + +interface SqlQuery { + sql: DOMString; + args?: ObjectArray; +} + +interface Results { + data: any[]; + sqlResultSet: SQLResultSet; +} + + +(function () { + var dbName: string = "websql-tests"; + + // run the test + createDatabase(dbName); + + + function log(...msg: any[]) { + if (console && console.log) { + console.log.apply(console, msg); + } + } + + + function createDatabase(name: string) { + var tableOne = { + name: "tableOne", + columns: ["i_id", "s_name", "d_last"], + }; + var tableTwo = { + name: "tableTwo", + columns: ["i_thing", "s_description", "d_decimal"], + }; + + openDatabase(dbName, "1", dbName, 1024 * 1024, function (dbState) { + createTables(dbState, [ + { name: tableOne.name, columns: tableOne.columns }, + { name: tableTwo.name, columns: tableTwo.columns }, + ], function (res) { + writeRecords(dbState, [ + { name: tableOne.name, data: createMockRecord(tableOne.columns) }, + { name: tableOne.name, data: createMockRecord(tableOne.columns) }, + { name: tableTwo.name, data: createMockRecord(tableTwo.columns) }, + { name: tableTwo.name, data: createMockRecord(tableTwo.columns) }, + { name: tableTwo.name, data: createMockRecord(tableTwo.columns) }, + ], function (ress) { + log(ress); + readRecords(dbState, [tableOne.name, tableTwo.name], function (resss) { + log(resss); + }); + }); + }); + }); + } + + + function initDb(db: Database): DbState { + return { + database: db, + version: db.version, + transaction: db.transaction.bind(db), + readTransaction: db.readTransaction.bind(db), + changeVersion: db.changeVersion.bind(db) + }; + } + + + function openDatabase(name: string, version: string, displayName: string, estimatedSize: number, callback: (dbState: DbState) => void) { + estimatedSize = estimatedSize || (5 * 1024 * 1024); + + try { + if (!window.openDatabase) { + log("WebSQL not implemented"); + } else { + // seems to synchronously open WebSQL, even though window.openDatabase is async + var db: Database = window.openDatabase(name, version, displayName, estimatedSize); + var dbState = initDb(db); + if (db) { + callback(dbState); + } else { + log("Failed to open database"); + } + } + } catch (ex) { + log("Failed to open database '" + name + "': " + (JSON && JSON.stringify ? JSON.stringify(ex) : ex)); + } + } + + + function createTables(dbState: DbState, tableDefs: { name: string; columns: string[]; }[], callback: (rec: SQLResultSet[][]) => void) { + var res: SQLResultSet[][] = []; + var resI = 0, count = tableDefs.length; + for (var i = 0; i < count; i++) { + createTable(dbState, tableDefs[i].name, tableDefs[i].columns, function (rec: SQLResultSet[]) { + res.push(rec); + resI++; + if (resI == count) { + callback(res); + } + }); + } + } + + + function createTable(dbState: DbState, name: string, columns: string[], callback: (rec: SQLResultSet[]) => void) { + var sqls: SqlQuery[] = []; + var colDefs = columns.map((col) => { + var colType: string = null; + var type = col.charAt(0); + switch (type) { + case 'i': + case 'l': + colType = "INTEGER"; + break; + case 'f': + case 'd': + colType = "REAL"; + break; + case 'b': + case 'z': + colType = "INTEGER"; + break; + case 's': + colType = "TEXT"; + break; + default: + colType = "TEXT"; + } + return col + " " + colType; + }); + sqls.push({ sql: "CREATE TABLE IF NOT EXISTS " + name + " (" + colDefs.join(",") + ")", args: [] }); + execSqlStatements(dbState.transaction, sqls, callback); + } + + + /** column name prefixes + * 'i', 'l' - integer + * 'f', 'd' - float + * 'b', 'z' - boolean + * 's' - string + * other - null + */ + function createMockRecord(columns: string[]): any { + var rec: { [id: string]: any } = {}; + for (var i = 0, size = columns.length; i < size; i++) { + var col = columns[i]; + var type = col.charAt(0); + switch (type) { + case 'i': + case 'l': + rec[col] = parseInt((Math.random() * 1000000).toString()); + break; + case 'f': + case 'd': + rec[col] = (Math.random() - 0.5) * 2000000; + break; + case 'b': + case 'z': + rec[col] = Math.random() > 0.5; + break; + case 's': + rec[col] = String.fromCharCode.apply(String, new Array(Math.round(Math.random() * 21)).join(".").split("").map((k) => 65 + Math.round(Math.random() * 25))); + break; + default: + rec[col] = null; + } + } + return rec; + } + + + function writeRecords(dbState: DbState, tableDefs: { name: string; data: any; }[], callback: (rec: SQLResultSet[][]) => void) { + var res: SQLResultSet[][] = []; + var resI = 0, count = tableDefs.length; + for (var i = 0; i < count; i++) { + writeRecord(dbState, tableDefs[i].name, tableDefs[i].data, function (rec: SQLResultSet[]) { + res.push(rec); + resI++; + if (resI == count) { + callback(res); + } + }); + } + } + + + function writeRecord(dbState: DbState, tableName: string, record: any, callback: (rec: SQLResultSet[]) => void) { + var props = Object.keys(record); + var propCount = props.length; + var args: ObjectArray = []; + var sqlStatement = { + sql: "INSERT INTO " + tableName + " values(" + (new Array(propCount + 1).join("?").split("").join(",")) + ")", + args: args + }; + for (var i = 0; i < propCount; i++) { + var prop = props[i]; + args.push(record[prop]); + } + + execSqlStatements(dbState.transaction, [sqlStatement], callback); + } + + + function readRecords(dbState: DbState, tableNames: string[], callback: (rec: Results[]) => void) { + var res: Results[] = []; + var resI = 0, count = tableNames.length; + for (var i = 0; i < count; i++) { + readRecord(dbState, tableNames[i], function (rec: Results) { + res.push(rec); + resI++; + if (resI == count) { + callback(res); + } + }); + } + } + + + function readRecord(dbState: DbState, tableName: string, callback: (rec: Results) => void) { + var args: ObjectArray = []; + var sqlStatement = { + sql: "SELECT * FROM " + tableName, + args: args + }; + + execSqlStatements(dbState.transaction, [sqlStatement], function (rec: SQLResultSet[]) { + var resObjs: Results[] = resultSetToResults(rec); + callback(resObjs[0]); + }); + } + + + function resultSetToResults(results: SQLResultSet[]) { + var resObjs: Results[] = []; + for (var i = 0, count = results.length; i < count; i++) { + var resAry: any[] = []; + var sqlRsI = results[i]; + var resObj = { + data: resAry, + sqlResultSet: sqlRsI + }; + resObjs.push(resObj); + var rows = sqlRsI.rows; + var rI = 0; + for (var rI = 0, rCount = sqlRsI.rows.length; rI < rCount; rI++) { + var r = rows.item(rI); + resAry.push(r); + } + } + return resObjs; + } + + + function compareRecords(rec1: any, rec2: any): boolean { + var props = Object.keys(rec1); + for (var i = 0, size = props.length; i < size; i++) { + var prop = props[i]; + if (rec1[prop] !== rec2[prop]) { + return false; + } + } + return true; + } + + + function execSqlStatements(xactMethod: (callback: SQLTransactionCallback) => void, sqlStatement: SqlQuery[], + callback: (rs: SQLResultSet[]) => void) { + var results: SQLResultSet[] = []; + var sqlCount = sqlStatement.length; + var resI = 0; + + function execCommand(xact: SQLTransaction, sql: DOMString, args: ObjectArray) { + xact.executeSql(sql, args || [], function (xact: SQLTransaction, rs: SQLResultSet): void { + results.push(rs); + resI++; + if (resI === sqlCount) { + callback(results); + } + }, function (transaction, err) { + log(err, transaction); + return false; + }); + } + + xactMethod(function (xact: SQLTransaction): void { + for (var i = 0; i < sqlCount; i++) { + execCommand(xact, sqlStatement[i].sql, sqlStatement[i].args); + } + }); + } + +} ()); diff --git a/websql/websql.d.ts b/websql/websql.d.ts new file mode 100644 index 000000000..7a9a248ea --- /dev/null +++ b/websql/websql.d.ts @@ -0,0 +1,216 @@ +// Type definitions for websql +// Project: http://www.w3.org/TR/webdatabase/ +// Definitions by: TeamworkGuy2 +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +// W3C spec: http://www.w3.org/TR/webdatabase/#database +// Spec revision: 2010-11-18 +// NOTE: the W3C websql spec has been deprecated + +// uncomment to integrate with Window global object +interface Window extends WindowDatabase { } +interface WorkerUtils extends WorkerUtilsDatabase { } + +// util interfaces +interface DOMString extends String { } +interface ObjectArray extends Array { } + + +//[Supplemental, NoInterfaceObject] +interface WindowDatabase { + openDatabase(name: DOMString, version: DOMString, displayName: DOMString, estimatedSize: number, + creationCallback?: DatabaseCallback): Database; +} + +//[Supplemental, NoInterfaceObject] +interface WorkerUtilsDatabase { + openDatabase(name: DOMString, version: DOMString, displayName: DOMString, estimatedSize: number, + creationCallback?: DatabaseCallback): Database; + + openDatabaseSync(name: DOMString, version: DOMString, displayName: DOMString, estimatedSize: number, + creationCallback?: DatabaseCallback): DatabaseSync; +} + +//[Callback = FunctionOnly, NoInterfaceObject] +interface DatabaseCallback { + /*handleEvent*/(database: Database): void; +} + + +/** 4.3 Asynchronous database API - The transaction() and readTransaction() methods takes + * one to three arguments. When called, these methods must immediately return and then + * asynchronously run the transaction steps with the transaction callback being the + * first argument, the error callback being the second argument, if any, the success + * callback being the third argument, if any, and with no preflight operation or + * postflight operation + */ +interface Database { + /*readonly/const*/version: DOMString; + + transaction(callback: SQLTransactionCallback, errorCallback?: SQLTransactionErrorCallback, + successCallback?: SQLVoidCallback): void; + + readTransaction(callback: SQLTransactionCallback, errorCallback?: SQLTransactionErrorCallback, + successCallback?: SQLVoidCallback): void; + + /** The changeVersion() method allows scripts to atomically verify the version number and change + * it at the same time as doing a schema update. When the method is invoked, it must immediately + * return, and then asynchronously run the transaction steps with the transaction callback being + * the third argument, the error callback being the fourth argument, the success callback being + * the fifth argument + */ + changeVersion(oldVersion: DOMString, newVersion: DOMString, callback?: SQLTransactionCallback, + errorCallback?: SQLTransactionErrorCallback, successCallback?: SQLVoidCallback): void; +} + +//[Callback = FunctionOnly, NoInterfaceObject] +interface SQLVoidCallback { + /*handleEvent*/(): void; +} + +//[Callback = FunctionOnly, NoInterfaceObject] +interface SQLTransactionCallback { + /*handleEvent*/(transaction: SQLTransaction): void; +} + +//[Callback = FunctionOnly, NoInterfaceObject] +interface SQLTransactionErrorCallback { + /*handleEvent*/(error: SQLError): void; +} + +/** 4.3.1 Executing SQL statements + */ +interface SQLTransaction { + executeSql(sqlStatement: DOMString, arguments?: ObjectArray, callback?: SQLStatementCallback, + errorCallback?: SQLStatementErrorCallback): void; +} + +//[Callback = FunctionOnly, NoInterfaceObject] +interface SQLStatementCallback { + /*handleEvent*/(transaction: SQLTransaction, resultSet: SQLResultSet): void; +} + +//[Callback = FunctionOnly, NoInterfaceObject] +interface SQLStatementErrorCallback { + /*handleEvent*/(transaction: SQLTransaction, error: SQLError): boolean; +} + + +/** 4.4 Synchronous database API + */ +interface DatabaseSync { + /*readonly/const*/version: DOMString; + + transaction(callback: SQLTransactionSyncCallback): void; + + readTransaction(callback: SQLTransactionSyncCallback): void; + + changeVersion(oldVersion: DOMString, newVersion: DOMString, callback: SQLTransactionSyncCallback): void; +} + +//[Callback = FunctionOnly, NoInterfaceObject] +interface SQLTransactionSyncCallback { + /*handleEvent*/(transaction: SQLTransactionSync): void; +} + +/** 4.4.1 Executing SQL statements + */ +interface SQLTransactionSync { + executeSql(sqlStatement: DOMString, arguments?: ObjectArray): SQLResultSet; +} + + +/** 4.5 Database query results + * The insertId attribute must return the row ID of the row that the SQLResultSet + * object's SQL statement inserted into the database, if the statement inserted a row. + * If the statement inserted multiple rows, the ID of the last row must be the one returned. + * If the statement did not insert a row, then the attribute must instead raise an INVALID_ACCESS_ERR exception. + * + * The rowsAffected attribute must return the number of rows that were changed by the SQL statement. + * If the statement did not affected any rows, then the attribute must return zero. + * For "SELECT" statements, this returns zero (querying the database doesn't affect any rows). + * + * The rows attribute must return a SQLResultSetRowList representing the rows returned, + * in the order returned by the database. The same object must be returned each time. + * If no rows were returned, then the object will be empty (its length will be zero) + */ +interface SQLResultSet { + insertId: number; + rowsAffected: number; + rows: SQLResultSetRowList; +} + +/** SQLResultSetRowList objects have a length attribute that must return the number of + * rows it represents (the number of rows returned by the database). This is the length. + * Fetching the length might be expensive, and authors are thus encouraged to avoid using + * it (or enumerating over the object, which implicitly uses it) where possible. + * The object's supported property indices are the numbers in the range zero to length-1, + * unless the length is zero, in which case there are no supported property indices. + * The item(index) attribute must return the row with the given index index. + * If there is no such row, then the method must return null. + * + * Each row must be represented by a native ordered dictionary data type. In the + * JavaScript binding, this must be Object. Each row object must have one property + * (or dictionary entry) per column, with those properties enumerating in the order + * that these columns were returned by the database. Each property must have the + * name of the column and the value of the cell, as they were returned by the database + */ +interface SQLResultSetRowList { + length: number; + item(index: number): any; +} + + +/** 4.6 Errors and exceptions - asynchronous database API error + */ +declare class SQLError { + static UNKNOWN_ERR: number; // = 0; + static DATABASE_ERR: number; // = 1; + static VERSION_ERR: number; // = 2; + static TOO_LARGE_ERR: number; // = 3; + static QUOTA_ERR: number; // = 4; + static SYNTAX_ERR: number; // = 5; + static CONSTRAINT_ERR: number; // = 6; + static TIMEOUT_ERR: number; // = 7; + + code: number; + message: DOMString; +} + +// synchronous database API error +declare class SQLException { + /** Code 0 - The transaction failed for reasons unrelated to the database itself + * and not covered by any other error code. + */ + static UNKNOWN_ERR: number; // = 0; + /** Code 1 - The statement failed for database reasons not covered by any other error code. */ + static DATABASE_ERR: number; // = 1; + /** Code 2 - The operation failed because the actual database version was not what it should be. + * For example, a statement found that the actual database version no longer matched the + * expected version of the Database or DatabaseSync object, or the Database.changeVersion() + * or DatabaseSync.changeVersion() methods were passed a version that doesn't match the actual database version. + */ + static VERSION_ERR: number; // = 2; + /** Code 3 - The statement failed because the data returned from the database was too large. + * The SQL "LIMIT" modifier might be useful to reduce the size of the result set. + */ + static TOO_LARGE_ERR: number; // = 3; + /** Code 4 - The statement failed because there was not enough remaining storage space, + * or the storage quota was reached and the user declined to give more space to the database. + */ + static QUOTA_ERR: number; // = 4; + /** Code 5 - The statement failed because of a syntax error, or the number of arguments did + * not match the number of ? placeholders in the statement, or the statement tried to use a + * statement that is not allowed, such as BEGIN, COMMIT, or ROLLBACK, or the statement tried + * to use a verb that could modify the database but the transaction was read-only. */ + static SYNTAX_ERR: number; // = 5; + /** Code 6 - An INSERT, UPDATE, or REPLACE statement failed due to a constraint failure. + * For example, because a row was being inserted and the value given for the primary + * key column duplicated the value of an existing row. */ + static CONSTRAINT_ERR: number; // = 6; + /** Code 7 - A lock for the transaction could not be obtained in a reasonable time. */ + static TIMEOUT_ERR: number; // = 7; + + code: number; + message: DOMString; +} diff --git a/whatwg-fetch/whatwg-fetch.d.ts b/whatwg-fetch/whatwg-fetch.d.ts index 4a4a9612c..9efd039b4 100644 --- a/whatwg-fetch/whatwg-fetch.d.ts +++ b/whatwg-fetch/whatwg-fetch.d.ts @@ -51,7 +51,7 @@ declare class Body { arrayBuffer(): Promise; blob(): Promise; formData(): Promise; - json(): Promise; + json(): Promise; text(): Promise; } declare class Response extends Body { diff --git a/winrt/winrt.d.ts b/winrt/winrt.d.ts index 883860b00..ed4f33e77 100644 --- a/winrt/winrt.d.ts +++ b/winrt/winrt.d.ts @@ -9268,7 +9268,8 @@ declare module Windows { unconsumedBufferLength: number; unicodeEncoding: Windows.Storage.Streams.UnicodeEncoding; readByte(): number; - readBytes(): Uint8Array; + readBytes(value: number[]): void; + readBytes(value: Uint8Array): void; readBuffer(length: number): Windows.Storage.Streams.IBuffer; readBoolean(): boolean; readGuid(): string; @@ -9297,7 +9298,8 @@ declare module Windows { unconsumedBufferLength: number; unicodeEncoding: Windows.Storage.Streams.UnicodeEncoding; readByte(): number; - readBytes(): Uint8Array; + readBytes(value: number[]): void; + readBytes(value: Uint8Array): void; readBuffer(length: number): Windows.Storage.Streams.IBuffer; readBoolean(): boolean; readGuid(): string; @@ -9345,6 +9347,7 @@ declare module Windows { unicodeEncoding: Windows.Storage.Streams.UnicodeEncoding; unstoredBufferLength: number; writeByte(value: number): void; + writeBytes(value: number[]): void; writeBytes(value: Uint8Array): void; writeBuffer(buffer: Windows.Storage.Streams.IBuffer): void; writeBuffer(buffer: Windows.Storage.Streams.IBuffer, start: number, count: number): void; @@ -9377,6 +9380,7 @@ declare module Windows { unicodeEncoding: Windows.Storage.Streams.UnicodeEncoding; unstoredBufferLength: number; writeByte(value: number): void; + writeBytes(value: number[]): void; writeBytes(value: Uint8Array): void; writeBuffer(buffer: Windows.Storage.Streams.IBuffer): void; writeBuffer(buffer: Windows.Storage.Streams.IBuffer, start: number, count: number): void; diff --git a/winston/winston-tests.ts b/winston/winston-tests.ts index 0fa3cb442..3bfd0d5a5 100644 --- a/winston/winston-tests.ts +++ b/winston/winston-tests.ts @@ -8,6 +8,8 @@ var num: number; var metadata: any; var obj: any = {}; +winston.level = 'debug'; + var queryOptions: winston.QueryOptions; var transportOptions: winston.TransportOptions; var loggerOptions: winston.LoggerOptions = { @@ -218,4 +220,4 @@ var logger: winston.LoggerInstance = new (winston.Logger)({ ssl: {}, }), ] -}); \ No newline at end of file +}); diff --git a/winston/winston.d.ts b/winston/winston.d.ts index 983f7cbbc..954e3358b 100644 --- a/winston/winston.d.ts +++ b/winston/winston.d.ts @@ -17,7 +17,7 @@ declare module "winston" { export var defaultLogger: LoggerInstance; export var exitOnError: boolean; - + export var level: string; export function log(level: string, msg: string, meta: any, callback?: (err: Error, level: string, msg: string, meta: any) => void): LoggerInstance; export function log(level: string, msg: string, callback?: (err: Error, level: string, msg: string, meta: any) => void): LoggerInstance; diff --git a/xdate/xdate-tests.ts b/xdate/xdate-tests.ts new file mode 100644 index 000000000..dad175104 --- /dev/null +++ b/xdate/xdate-tests.ts @@ -0,0 +1,1320 @@ +/// + +//Those classes were tested by compile time only! + +module XDate_Test +{ + + class test_base + { + public assert( ref : boolean ) + { + if( true == ref) + { + console.info("OK"); + } + else + { + console.warn("NG"); + } + } + } + + //based on xdate/test/adding.js + class adding extends test_base + { + + private addYears() : boolean + { + + var d1 = new XDate(2011, 2, 1); + d1.addYears(10); + var d2 = new XDate(2011, 2, 1); + d2.addYears(-2); + return d1.getFullYear() == 2021 && + d1.getMonth() == 2 && + d1.getDate() == 1 && + d2.getFullYear() == 2009 && + d2.getMonth() == 2 && + d2.getDate() == 1; + + } + + private addMonths() : boolean + { + + var d1 = new XDate(2012, 2, 6); + d1.addMonths(3); + var d2 = new XDate(2012, 2, 6); + d2.addMonths(-3); + return d1.getFullYear() == 2012 && + d1.getMonth() == 5 && + d1.getDate() == 6 && + d2.getFullYear() == 2011 && + d2.getMonth() == 11 && + d2.getDate() == 6; + } + + private addMonths_prevent_overflow() : boolean + { + + var d1 = new XDate(2010, 11, 30); // dec 30 + d1.addMonths(2, true); + var d2 = new XDate(2011, 5, 30); // jun 30 + d2.addMonths(-4, true); + return d1.getFullYear() == 2011 && + d1.getMonth() == 1 && + d1.getDate() == 28 && + d2.getFullYear() == 2011 && + d2.getMonth() == 1 && + d2.getDate() == 28; + + } + + private addMonths_prevent_overflow_backwards_january_bug() : boolean { + var d1 = new XDate(2013, 0, 28); // Jan 28 + var d2 = new XDate(2013, 0, 14); // Jan 14 + return d1.addMonths(-1, true).toString('yyyy-MM-dd') == '2012-12-28' && // Dec 28 + d2.addMonths(-1, true).toString('yyyy-MM-dd') == '2012-12-14'; // Dec 14 + } + + + private addDays() : boolean { + var d1 = new XDate(2009, 5, 8); + d1.addDays(30); + var d2 = new XDate(2009, 5, 8); + d2.addDays(-4); + return d1.getFullYear() == 2009 && + d1.getMonth() == 6 && + d1.getDate() == 8 && + d2.getFullYear() == 2009 && + d2.getMonth() == 5 && + d2.getDate() == 4; + } + + + private addHours_addMinutes_addSeconds_addMilliseconds() : boolean { + var d = new XDate(2010, 0, 1, 5, 30, 24, 500); + d.addHours(2); + d.addMinutes(15); + d.addSeconds(6); + d.addMilliseconds(50); + return d.getHours() == 7 && + d.getMinutes() == 45 && + d.getSeconds() == 30 && + d.getMilliseconds() == 550; + } + + + private addWeeks() : boolean { + return new XDate(2011, 7, 12).addWeeks(2).getDate() == 26 && + new XDate(2011, 7, 12).addWeeks(-2).getDate() == 29; + } + + public constructor() + { + super(); + super.assert( this.addYears() ); + super.assert( this.addMonths_prevent_overflow() ); + super.assert( this.addMonths_prevent_overflow_backwards_january_bug() ); + super.assert( this.addDays() ); + super.assert( this.addHours_addMinutes_addSeconds_addMilliseconds() ); + super.assert( this.addWeeks() ); + } + + } + + + class constructors extends test_base + { + + public no_args() : boolean { + var xdate = new XDate(); + var time = +new Date(); + return Math.abs(xdate.getTime() - time) < 1000 && !xdate.getUTCMode(); + } + + public only_utcMode_false(): boolean { + var xdate = new XDate(false); + var time = +new Date(); + return Math.abs(xdate.getTime() - time) < 1000 && !xdate.getUTCMode(); + } + + public only_utcMode_true() : boolean { + var xdate = new XDate(true); + var time = +new Date(); + return Math.abs(xdate.getTime() - time) < 1000 && xdate.getUTCMode(); + } + + public from_XDate_XDate() : boolean { + var xdate1 = new XDate(); + var xdate2 = new XDate(xdate1); + return xdate1.getTime() == xdate2.getTime() && + !xdate1.getUTCMode() && !xdate2.getUTCMode(); + } + + public from_XDate_XDate_with_utcMode_true() : boolean { + var xdate1 = new XDate().setUTCMode(true); + var xdate2 = new XDate(xdate1); + //return xdate1.getTime() == xdate2.getTime() && + //xdate1.getUTCMode() && xdate2.getUTCMode(); + return true; + } + + public from_XDate_XDate_override_with_utcMode_true() : boolean { + var xdate1 = new XDate(); + var xdate2 = new XDate(xdate1, true); + return xdate1.getTime() == xdate2.getTime() && + !xdate1.getUTCMode() && xdate2.getUTCMode(); + } + + public from_XDate_XDate_override_with_utcMode_false() : boolean { + var xdate1 = new XDate().setUTCMode(true); + var xdate2 = new XDate(xdate1, false); + return xdate1.getTime() == xdate2.getTime() && + xdate1.getUTCMode() && !xdate2.getUTCMode(); + } + + public from_native_Date_utcMode_false() : boolean { + var date = new Date(); + var xdate1 = new XDate(date); + var xdate2 = new XDate(date, false); + return date.getTime() == xdate1.getTime() && + date.getTime() == xdate2.getTime() && + !xdate1.getUTCMode() && !xdate2.getUTCMode(); + } + + public from_native_Date_utcMode_true(): boolean { + var date = new Date(); + var xdate = new XDate(date, true); + return date.getTime() == xdate.getTime() && + xdate.getUTCMode(); + } + + public from_milliseconds_time_utcMode_false() : boolean { + var MS = 933490800000; + var xdate1 = new XDate(MS); + var xdate2 = new XDate(MS, false); + return !xdate1.getUTCMode() && + !xdate2.getUTCMode() && + xdate1.getTime() == MS && + xdate2.getTime() == MS; + } + + public from_milliseconds_time_utcMode_true() : boolean { + var MS = 933490800000; + var xdate = new XDate(MS, true); + return xdate.getUTCMode() && xdate.getTime() == MS; + } + + public year_month_date_utcMode_false() : boolean { + var YEAR = 2011; + var MONTH = 5; + var DATE = 4; + var xdate1 = new XDate(YEAR, MONTH, DATE); + //var xdate2 = new XDate(YEAR, MONTH, DATE, false); + var xdate2 = new XDate(YEAR, MONTH, DATE); + xdate2.setUTCMode(false); + return !xdate1.getUTCMode() && !xdate2.getUTCMode() && + xdate1.getTime() == xdate2.getTime() && + xdate1.getFullYear() == YEAR && + xdate1.getMonth() == MONTH && + xdate1.getDate() == DATE && + !xdate1.getHours() && + !xdate1.getMinutes() && + !xdate1.getSeconds() && + !xdate1.getMilliseconds(); + } + + public toString_utcMode_undefined_true() : boolean { + var xdate1 = new XDate('2012-09-21'); + var xdate2 = new XDate('2012-09-21', true); + return xdate1.toString('yyyy-MM-dd HH-mm-ss') == '2012-09-21 00-00-00' && + xdate2.toString('yyyy-MM-dd HH-mm-ss') == '2012-09-21 00-00-00'; + } + + public year_month_date_minutes_seconds_milliseconds_utcMode_false() : boolean { + var YEAR = 2011; + var MONTH = 5; + var DATE = 4; + var HOURS = 13; + var MINUTES = 45; + var SECONDS = 20; + var MILLISECONDS = 750; + var xdate1 = new XDate(YEAR, MONTH, DATE, HOURS, MINUTES, SECONDS, MILLISECONDS); + var xdate2 = new XDate(YEAR, MONTH, DATE, HOURS, MINUTES, SECONDS, MILLISECONDS, false); + return !xdate1.getUTCMode() && !xdate2.getUTCMode() && + xdate1.getTime() == xdate2.getTime() && + xdate1.getFullYear() == YEAR && + xdate1.getMonth() == MONTH && + xdate1.getDate() == DATE && + xdate1.getHours() == HOURS && + xdate1.getMinutes() == MINUTES && + xdate1.getSeconds() == SECONDS && + xdate1.getMilliseconds() == MILLISECONDS; + } + + public year_month_date_utcMode_true() : boolean { + var YEAR = 2011; + var MONTH = 5; + var DATE = 4; + //var xdate = new XDate(YEAR, MONTH, DATE, true); + var xdate = new XDate(YEAR, MONTH, DATE); + xdate.setUTCMode(true); + return xdate.getUTCMode() + xdate.getFullYear() == YEAR && + xdate.getMonth() == MONTH && + xdate.getDate() == DATE && + !xdate.getHours() && + !xdate.getMinutes() && + !xdate.getSeconds() && + !xdate.getMilliseconds(); + } + + public year_month_date_minutes_seconds_milliseconds_utcMode_true() : boolean { + var YEAR = 2011; + var MONTH = 5; + var DATE = 4; + var HOURS = 13; + var MINUTES = 45; + var SECONDS = 20; + var MILLISECONDS = 750; + var xdate = new XDate(YEAR, MONTH, DATE, HOURS, MINUTES, SECONDS, MILLISECONDS, true); + return xdate.getUTCMode() && + xdate.getFullYear() == YEAR && + xdate.getMonth() == MONTH && + xdate.getDate() == DATE && + xdate.getHours() == HOURS && + xdate.getMinutes() == MINUTES && + xdate.getSeconds() == SECONDS && + xdate.getMilliseconds() == MILLISECONDS; + } + + /* + public without_new_operator() : boolean { + return XDate("Sun Aug 14 2011 00:28:53 GMT-0700 (PDT)") && + !XDate("asdf").valid(); + } + */ + + + public constructor() + { + super(); + super.assert( this.no_args() ); + super.assert( this.only_utcMode_false() ); + super.assert( this.only_utcMode_true() ); + super.assert( this.from_XDate_XDate() ); + + super.assert(this.from_XDate_XDate_with_utcMode_true()); + super.assert(this.from_XDate_XDate_override_with_utcMode_true()); + super.assert(this.from_XDate_XDate_override_with_utcMode_false()); + super.assert(this.from_native_Date_utcMode_false()); + super.assert(this.from_native_Date_utcMode_true()); + super.assert(this.from_milliseconds_time_utcMode_false()); + super.assert(this.from_milliseconds_time_utcMode_true()); + super.assert(this.year_month_date_utcMode_false()); + super.assert(this.toString_utcMode_undefined_true()); + super.assert(this.year_month_date_minutes_seconds_milliseconds_utcMode_false()); + super.assert(this.year_month_date_utcMode_true()); + super.assert(this.year_month_date_minutes_seconds_milliseconds_utcMode_true()); + } + } + + + // based on xdate/test/diffing.js + class diffing extends test_base + { + + + public diffWeeks() : boolean{ + return Math.floor(new XDate(2011, 4, 18).diffWeeks(new XDate(2011, 4, 26))) == 1 && + //Math.abs(new XDate(2011, 4, 18).diffWeeks(new XDate(2011, 4, 26), true) - (1+1/7)) < .001 && + Math.floor(new XDate(2011, 4, 18).diffWeeks(new XDate(2011, 4, 24))) == 0 && + //Math.abs(new XDate(2011, 4, 18).diffWeeks(new XDate(2011, 4, 24), true) - (1-1/7)) < .001 && + Math.floor(new XDate(2011, 4, 18).diffWeeks(new XDate('2011-05-26'))) == 1; + } + + + public diffYears() :boolean { + return new XDate('2011-04-10').diffYears('2013-04-10') == 2 && + new XDate('2011-01-01T06:06:06').diffYears('2013-07-01T06:06:06') == 2.5; + } + + + public diffMonths() :boolean { + return new XDate('2011-06-05').diffMonths('2012-07-05') == 13 && + new XDate('2012-07-05').diffMonths('2011-06-05') == -13; + } + + + public diffDays() :boolean { + return new XDate('2012-12-25').diffDays('2012-12-30') == 5; + } + + + public diffHours() :boolean { + return new XDate('2012-05-05T06:30:00').diffHours('2012-05-05T04:00:00') == -2.5; + } + + + public diffMinutes() :boolean { + return new XDate('2012-05-01T05:50').diffMinutes('2012-05-01T06:10:30') == 20.5; + } + + + public diffSeconds() :boolean { + return new XDate('2012-03-01T00:00:45').diffSeconds('2012-03-01T00:01:15') == 30; + } + + + public diffMilliseconds() :boolean { + return new XDate('2011-06-06T05:05:05').diffMilliseconds('2011-06-06T05:05:08.100') == 3100; + } + + + + public constructor() + { + super(); + super.assert( this.diffWeeks() ); + super.assert( this.diffYears() ); + super.assert( this.diffMonths() ); + super.assert( this.diffDays() ); + super.assert( this.diffHours() ); + super.assert( this.diffMinutes() ); + super.assert( this.diffSeconds() ); + super.assert( this.diffMilliseconds() ); + } + + } + + // based on xdate/test/formatting.js + class formatting extends test_base + { + + public numbers_am() : boolean { + return new XDate(1986, 5, 8, 4, 3, 2) + .toString('MM/dd/yyyy hh:mm:ss tt') == "06/08/1986 04:03:02 am"; + } + + + public numbers_am_uppercase() : boolean { + return new XDate(1986, 5, 8, 4, 3, 2) + .toString('MM/dd/yyyy hh:mm:ss TT') == "06/08/1986 04:03:02 AM"; + } + + + public numbers_am_mini() : boolean { + return new XDate(1986, 5, 8, 4, 3, 2) + .toString('M/d/yy h:m:s t') == "6/8/86 4:3:2 a"; + } + + + public numbers_pm() : boolean { + return new XDate(1986, 5, 8, 14, 3, 2) + .toString('MM/dd/yyyy hh:mm:ss tt') == "06/08/1986 02:03:02 pm"; + } + + + public numbers_pm_uppercase() : boolean { + return new XDate(1986, 5, 8, 14, 3, 2) + .toString('MM/dd/yyyy hh:mm:ss TT') == "06/08/1986 02:03:02 PM"; + } + + + public numbers_pm_mini() : boolean { + return new XDate(1986, 5, 8, 14, 3, 2) + .toString('M/d/yy h:m:s t') == "6/8/86 2:3:2 p"; + } + + + public no_am_pm_confusion() : boolean { + return new XDate(2012, 5, 8).toString('tt') == 'am' && + new XDate(2012, 5, 8, 12).toString('tt') == 'pm'; + } + + + public numbers_24_hour_clock() : boolean { + return new XDate(1986, 5, 8, 14, 3, 2) + .toString('dd/MM/yyyy HH:mm:ss') == "08/06/1986 14:03:02"; + } + + + public short_names() : boolean { + return new XDate(2011, 10, 5) + .toString('ddd, MMM dd, yyyy') == "Sat, Nov 05, 2011"; + } + + + public long_namesu() : boolean { + return new XDate(2011, 10, 5) + .toString('dddd, MMMM dd, yyyy') == "Saturday, November 05, 2011"; + } + + + public ordinals() : boolean { + return new XDate(2011, 1, 1).toString('dS') == "1st" && + new XDate(2011, 1, 2).toString('dS') == "2nd" && + new XDate(2011, 1, 3).toString('dS') == "3rd" && + new XDate(2011, 1, 4).toString('dS') == "4th" && + new XDate(2011, 1, 23).toString('dS') == "23rd" && + new XDate(2011, 1, 11).toString('dS') == "11th"; + } + + + public fff_milliseconds() : boolean { + var d = new XDate(); + var s = d.toString('fff'); + return d.getMilliseconds() === parseInt(s, 10) && s.length==3; + } + + + public timezone() : boolean { + var d1 = new XDate(); + d1.getTimezoneOffset = function() { return 7 * 60 + 15 }; + var d2 = new XDate(); + d2.getTimezoneOffset = function() { return -(7 * 60 + 15) }; + return d1.toString('z') == '-7' && + d1.toString('zz') == '-07' && + d1.toString('zzz') == '-07:15' && + d2.toString('z') == '+7' && + d2.toString('zz') == '+07' && + d2.toString('zzz') == '+07:15'; + } + + + public toString_i() : boolean { + var d = new XDate(2011, 5, 8, 14, 35, 21); + return d.toString('i') == '2011-06-08T14:35:21'; + } + + public toString_i_utcMode_true() : boolean { + var d = new XDate(2011, 5, 8, 14, 35, 21); + d.setUTCMode(true); + return d.toString('i') == '2011-06-08T14:35:21'; + } + + public toString_u() : boolean { + var d = new XDate(2011, 5, 8, 14, 35, 21); + return d.toString('u').indexOf('2011-06-08T14:35:21') == 0; + } + + public toString_u_utcMode_true() : boolean { + var d = new XDate(2011, 5, 8, 14, 35, 21); + d.setUTCMode(true); + return d.toString('u') == '2011-06-08T14:35:21Z'; + } + + public toUTCString_i() : boolean { + var d = new XDate(Date.UTC(2011, 5, 8, 14, 35, 21)); + return d.toUTCString('i') == '2011-06-08T14:35:21'; + } + + public toUTCString_i_utcMode_true() : boolean { + var d = new XDate(Date.UTC(2011, 5, 8, 14, 35, 21), true); + return d.toUTCString('i') == '2011-06-08T14:35:21'; + } + + public toUTCString_u() : boolean { + var d = new XDate(Date.UTC(2011, 5, 8, 14, 35, 21)); + return d.toUTCString('u') == '2011-06-08T14:35:21Z'; + } + + public toUTCString_u_utcMode_true() : boolean { + var d = new XDate(Date.UTC(2011, 5, 8, 14, 35, 21), true); + return d.toUTCString('u') == '2011-06-08T14:35:21Z'; + } + + + public non_zero_parenthesis() : boolean { + var d1 = new XDate(2010, 5, 8, 1); + var d2 = new XDate(2010, 5, 8, 14, 30); + return d1.toString('M/d/yyyy h(:mm)tt') == "6/8/2010 1am" && + d2.toString('M/d/yyyy h(:mm)tt') == "6/8/2010 2:30pm"; + } + + public non_zero_parenthesis_nested() : boolean { + return new XDate(2011, 5, 8).toString("(h(:mm)tt)") == "12am" && + new XDate(2011, 5, 8, 6).toString("(h(:mm)tt)") == "6am" && + new XDate(2011, 5, 8, 6, 30).toString("(h(:mm)tt)") == "6:30am"; + } + + + public non_zero_parenthesis_crazy_quotes() : boolean { + return new XDate(2010, 5, 8, 14, 30) + .toString("M/d/yyyy h(:mm')')tt") == "6/8/2010 2:30)pm"; + } + + + public string_literal() : boolean { + var d = new XDate(2011, 5, 8); + return d.toString("MMM dS 'yyyy!mm'") == "Jun 8th yyyy!mm"; + } + + + public escaped_single_quote() : boolean { + var d = new XDate(2011, 5, 8); + return d.toString("''MMM dS yyyy''") == "'Jun 8th 2011'"; + } + + + public toString_toUTCString_settings_param() : boolean { + var settings = { + dayNames: ['Sunday', 'Benduday', 'Zhellday', 'Taungsday', 'Centaxday', 'Primeday', 'Saturday'] + }; + return new XDate(2011, 3, 29).toString('dddd yyyy', settings) == 'Primeday 2011' && + new XDate(2011, 3, 4, 12).toUTCString('dddd yyyy', settings) == 'Benduday 2011'; + } + + + public iso_week_correct_digits() : boolean { + return new XDate(2011, 2, 1).toString('w') == '9' && + new XDate(2011, 2, 1).toUTCString('w') == '9' && + new XDate(2011, 2, 1).toString('ww') == '09' && + new XDate(2011, 2, 1).toUTCString('ww') == '09'; + } + + + public toString_toUTCString_different_locale() : boolean { + XDate.locales['starwars'] = { + dayNames: ['Sunday', 'Benduday', 'Zhellday', 'Taungsday', 'Centaxday', 'Primeday', 'Saturday'] + }; + return new XDate(2011, 3, 29).toString('dddd yyyy', 'starwars') == 'Primeday 2011' && + new XDate(2011, 3, 4, 12).toUTCString('dddd yyyy', 'starwars') == 'Benduday 2011'; + } + + + public toString_toUTCString_new_default_locale() : boolean { + XDate.locales['starwars'] = { + dayNames: ['Sunday', 'Benduday', 'Zhellday', 'Taungsday', 'Centaxday', 'Primeday', 'Saturday'] + }; + XDate.defaultLocale = 'starwars'; + var good = + new XDate(2011, 3, 29).toString('dddd yyyy') == 'Primeday 2011' && + new XDate(2011, 3, 4, 12).toUTCString('dddd yyyy') == 'Benduday 2011'; + XDate.defaultLocale = ''; + return good; + } + + + public custom_formatter_string() : boolean { + XDate.formatters.xxx = 'yyyyMMdd'; + var d = new XDate('2012-11-01'); + return d.toString('xxx') == '20121101'; + } + + + public custom_formatter_function() : boolean { + XDate.formatters.vvv = function(xdate, useUTC) { + return "cool/" + useUTC + "/" + xdate.getDate(); + }; + var d = new XDate('2012-10-05'); + return d.toString('vvv') == "cool/false/5" && + d.toUTCString('vvv') == "cool/true/5"; + } + + + public toString_methods_hasLocalTimezone_yes() : boolean { + var realDate = new Date(2011, 3, 20, 12, 30); + var xdate = new XDate(2011, 3, 20, 12, 30); + return realDate.toString() == xdate.toString() && + realDate.toDateString() == xdate.toDateString() && + realDate.toTimeString() == xdate.toTimeString() && + realDate.toLocaleString() == xdate.toLocaleString() && + realDate.toLocaleDateString() == xdate.toLocaleDateString() && + realDate.toLocaleTimeString() == xdate.toLocaleTimeString() && + realDate.toUTCString() == xdate.toUTCString(); + //toGMTString() was abolition + //&& + //realDate.toGMTString() == xdate.toGMTString(); + } + + public toString_methods_hasLocalTimezone_no() : boolean { + var realDate = new Date(2011, 3, 20, 12, 30); + var xdate = new XDate(2011, 3, 20, 12, 30); + xdate.setUTCMode(false); + return realDate.toString().indexOf(xdate.toString()) == 0 && + realDate.toTimeString().indexOf(xdate.toTimeString()) == 0 && + realDate.toLocaleString().indexOf(xdate.toLocaleString()) == 0 && + realDate.toLocaleDateString().indexOf(xdate.toLocaleDateString()) == 0 && + realDate.toLocaleTimeString().indexOf(xdate.toLocaleTimeString()) == 0; + } + + public toGMTString() : boolean { + var xdate = new XDate(); + return xdate.toUTCString() == xdate.toGMTString(); + } + + } + + //based on xdate/test/getters.js + class getters extends test_base + { + + public getTime_valueOf() : boolean { + var MS = 933490800000; + var xdate1 = new XDate(MS); + var xdate2 = new XDate(MS, false); + // return xdate1.getTime() == MS && xdate1.valueOf() == MS && +xdate1 == MS && + // xdate2.getTime() == MS && xdate2.valueOf() == MS && xdate2 == MS; + + return xdate1.getTime() == MS && xdate1.valueOf() == MS && + xdate2.getTime() == MS && xdate2.valueOf() == MS; + + } + + public getUTC() : boolean { + var YEAR = 2011; + var MONTH = 5; + var DATE = 4; + var HOURS = 13; + var MINUTES = 45; + var SECONDS = 20; + var MILLISECONDS = 750; + var xdate = new XDate(Date.UTC(YEAR, MONTH, DATE, HOURS, MINUTES, SECONDS, MILLISECONDS)); + return xdate.getUTCFullYear() == YEAR && + xdate.getUTCMonth() == MONTH && + xdate.getUTCDate() == DATE && + xdate.getUTCHours() == HOURS && + xdate.getUTCMinutes() == MINUTES && + xdate.getUTCSeconds() == SECONDS && + xdate.getUTCMilliseconds() == MILLISECONDS; + } + + //Deprecated + // public getYear() : boolean { + // var xdate = new XDate(1999, 0, 1); + // return xdate.getYear() == 99; + // } + + public getWeek() : boolean { + return new XDate(2011, 2, 1).getWeek() == 9; + } + + public getUTCWeek() : boolean { + return new XDate(2011, 2, 1, 12, 30).getUTCWeek() == 9; + } + + //Non-standard + /* + public getWeek_getUTCWeek_mega_test() : boolean { + if (!Date.prototype.toLocaleFormat) { + return "need Mozilla toLocaleFormat"; + } + var realDate = new Date(2011, 0, 1, 12, 0); + var xdate = new XDate(2011, 0, 1, 12, 0); + while (xdate.getFullYear() != 2014) { + var w1 = parseInt(realDate.toLocaleFormat('%V'), 10); + var w2 = xdate.getWeek(); + if (w1 != w2) { + return [ + false, + realDate.toString() + '=' + w1 + ' ' + xdate.toString() + '=' + w2 + ]; + } + var realDateUTC = XDate(realDate).setUTCMode(true, true).toDate(); + w1 = parseInt(realDateUTC.toLocaleFormat('%V'), 10); + w2 = xdate.getUTCWeek(); + if (w1 != w2) { + return [ + false, + realDateUTC.toUTCString() + '=' + w1 + ' ' + xdate.toUTCString() + '=' + w2 + ' (UTC!)' + ]; + } + realDate.setDate(realDate.getDate() + 1); + xdate.setDate(xdate.getDate() + 1); + } + return true; + } + */ + + } + + // based on xdate/test/parsing.js + class parsing extends test_base + { + + public IETF() : boolean { + var s = "Sat Apr 23 2011 13:44:12 GMT"; + var d = new XDate(s); + return d.getUTCFullYear() == 2011 && + d.getUTCMonth() == 3 && + d.getUTCDate() == 23 && + d.getUTCHours() == 13 && + d.getUTCMinutes() == 44 && + d.getUTCSeconds() == 12 && + !d.getUTCMode() && + +d == +new Date(s); + } + + + public ISO_no_time() : boolean + { + var s = "2010-06-08"; + var d = new XDate(s); + return d.getFullYear() == 2010 && + d.getMonth() == 5 && + d.getDate() == 8 && + !d.getHours() && + !d.getMinutes() && + !d.getSeconds() && + !d.getMilliseconds() && + !d.getUTCMode(); + } + + + public ISO_T() : boolean { + var s = "2010-06-08T14:45:30"; + var d = new XDate(s); + return d.getFullYear() == 2010 && + d.getMonth() == 5 && + d.getDate() == 8 && + d.getHours() == 14 && + d.getMinutes() == 45 && + d.getSeconds() == 30 && + !d.getMilliseconds() && + !d.getUTCMode(); + } + + + public ISO_space() : boolean { + var s = "2010-06-08 14:45:30"; + var d = new XDate(s); + return d.getFullYear() == 2010 && + d.getMonth() == 5 && + d.getDate() == 8 && + d.getHours() == 14 && + d.getMinutes() == 45 && + d.getSeconds() == 30 && + !d.getMilliseconds() && + !d.getUTCMode(); + } + + + public ISO_no_seconds() : boolean { + var s = "2010-06-08T14:45"; + var d = new XDate(s); + return d.getFullYear() == 2010 && + d.getMonth() == 5 && + d.getDate() == 8 && + d.getHours() == 14 && + d.getMinutes() == 45 && + !d.getSeconds() && + !d.getMilliseconds() && + !d.getUTCMode(); + } + + + public ISO_milliseconds() : boolean { + var s = "2010-06-08T14:45:30.500"; + var d = new XDate(s); + return d.getFullYear() == 2010 && + d.getMonth() == 5 && + d.getDate() == 8 && + d.getHours() == 14 && + d.getMinutes() == 45 && + d.getSeconds() == 30 && + d.getMilliseconds() == 500 && + !d.getUTCMode(); + } + + + public ISO_timezone_colon() : boolean { + var s = "2010-06-08T14:00:28-02:30"; + var d = new XDate(s); + return d.getUTCHours() == 16 && + d.getUTCMinutes() == 30 && + d.getUTCSeconds() == 28 && + !d.getUTCMode(); + } + + + public ISO_timezone_no_colon() : boolean { + var s = "2010-06-08T14:00:28-0230"; + var d = new XDate(s); + return d.getUTCHours() == 16 && + d.getUTCMinutes() == 30 && + d.getUTCSeconds() == 28 && + !d.getUTCMode(); + } + + + public ISO_timezone_hour_only() : boolean { + var s = "2010-06-08T14:45:34-02"; + var d = new XDate(s); + return d.getUTCHours() == 16 && + d.getUTCMinutes() == 45 && + d.getUTCSeconds() == 34 && + !d.getUTCMode(); + } + + + public ISO_timezone_positive() : boolean { + var s = "2010-06-08T14:00:28+02:30"; + var d = new XDate(s); + return d.getUTCHours() == 11 && + d.getUTCMinutes() == 30 && + d.getUTCSeconds() == 28 && + !d.getUTCMode(); + } + + + public ISO_with_Z() : boolean { + var d = new XDate('2011-06-08T00:00:00Z'); + return d.getUTCFullYear() == 2011 && + d.getUTCMonth() == 5 && + d.getUTCDate() == 8 && + !d.getUTCHours() && !d.getUTCMinutes() && + !d.getUTCMode(); + } + + + public ISO_no_timezone_utcMode_true() : boolean { + var s = "2010-06-08T14:30:28"; + var d = new XDate(s, true); + return d.getFullYear() == 2010 && d.getUTCFullYear() == 2010 && + d.getMonth() == 5 && d.getUTCMonth() == 5 && + d.getDate() == 8 && d.getUTCDate() == 8 && + d.getHours() == 14 && d.getUTCHours() == 14 && + d.getMinutes() == 30 && d.getUTCMinutes() == 30 && + d.getSeconds() == 28 && d.getUTCSeconds() == 28; + } + + + public in_and_out() : boolean { + var d = new XDate(); + return +new XDate(d.toISOString()) == +d; + } + + } + + // based on xdate/test/setters.js + class setters extends test_base + { + + public set_when_utcMode_false(): boolean{ + var xdate = new XDate(2012, 0, 1); + var YEAR = 2011; + var MONTH = 5; + var DATE = 4; + var HOURS = 13; + var MINUTES = 45; + var SECONDS = 20; + var MILLISECONDS = 750; + xdate.setFullYear(YEAR) + .setMonth(MONTH) + .setDate(DATE) + .setHours(HOURS) + .setMinutes(MINUTES) + .setSeconds(SECONDS) + .setMilliseconds(MILLISECONDS); + return xdate.getFullYear() == YEAR && + xdate.getMonth() == MONTH && + xdate.getDate() == DATE && + xdate.getHours() == HOURS && + xdate.getMinutes() == MINUTES && + xdate.getSeconds() == SECONDS && + xdate.getMilliseconds() == MILLISECONDS; + } + + public set_when_utcMode_true() : boolean{ + var xdate = new XDate(2012, 0, 1, 0,0,0,0, true); + var YEAR = 2011; + var MONTH = 5; + var DATE = 4; + var HOURS = 13; + var MINUTES = 45; + var SECONDS = 20; + var MILLISECONDS = 750; + xdate.setFullYear(YEAR) + .setMonth(MONTH) + .setDate(DATE) + .setHours(HOURS) + .setMinutes(MINUTES) + .setSeconds(SECONDS) + .setMilliseconds(MILLISECONDS); + return xdate.getFullYear() == YEAR && + xdate.getMonth() == MONTH && + xdate.getDate() == DATE && + xdate.getHours() == HOURS && + xdate.getMinutes() == MINUTES && + xdate.getSeconds() == SECONDS && + xdate.getMilliseconds() == MILLISECONDS; + } + + public setTime() : boolean { + var MS = 933490800000; + var xdate1 = new XDate(); + var xdate2 = new XDate().setUTCMode(true); + xdate1.setTime(MS); + xdate2.setTime(MS); + return xdate1.getTime() == MS && xdate2.getTime() == MS; + } + + public setFullYear_allow_overflow() : boolean { + var xdate1 = new XDate(2012, 1, 29); + var xdate2 = new XDate(2012, 1, 29); + xdate1.setFullYear(2013); + xdate2.setFullYear(2013, false); + return xdate1.getMonth() == 2 && xdate1.getDate() == 1 && + xdate2.getMonth() == 2 && xdate2.getDate() == 1; + } + + public setYear_prevent_overflow() : boolean { + var xdate = new XDate(2012, 1, 29); + xdate.setFullYear(2013, true); + return xdate.getMonth() == 1 && xdate.getDate() == 28; + } + + public setMonth_allow_overflow() : boolean { + var xdate1 = new XDate(2010, 2, 31, 12); + var xdate2 = new XDate(2010, 2, 31, 12); + xdate1.setMonth(1); + xdate2.setMonth(1, false); + return xdate1.getMonth() == 2 && xdate1.getDate() == 3 && + xdate2.getMonth() == 2 && xdate2.getDate() == 3 + } + + public setMonth_prevent_overflow() : boolean { + var d = new XDate(2010, 2, 31, 12); + d.setMonth(1, true); + return d.getMonth() == 1 && d.getDate() == 28; + } + + public setUTC_with_utcMode_false() : boolean { + var xdate = new XDate(2012, 0, 1); + var YEAR = 2011; + var MONTH = 5; + var DATE = 4; + var HOURS = 13; + var MINUTES = 45; + var SECONDS = 20; + var MILLISECONDS = 750; + xdate.setUTCFullYear(YEAR) + .setUTCMonth(MONTH) + .setUTCDate(DATE) + .setUTCHours(HOURS) + .setUTCMinutes(MINUTES) + .setUTCSeconds(SECONDS) + .setUTCMilliseconds(MILLISECONDS); + return xdate.getUTCFullYear() == YEAR && + xdate.getUTCMonth() == MONTH && + xdate.getUTCDate() == DATE && + xdate.getUTCHours() == HOURS && + xdate.getUTCMinutes() == MINUTES && + xdate.getUTCSeconds() == SECONDS && + xdate.getUTCMilliseconds() == MILLISECONDS; + } + + public setUTC_with_utcMode_true() : boolean { + var xdate = new XDate(2012, 0, 1,0,0,0,0, true); + var YEAR = 2011; + var MONTH = 5; + var DATE = 4; + var HOURS = 13; + var MINUTES = 45; + var SECONDS = 20; + var MILLISECONDS = 750; + xdate.setUTCFullYear(YEAR) + .setUTCMonth(MONTH) + .setUTCDate(DATE) + .setUTCHours(HOURS) + .setUTCMinutes(MINUTES) + .setUTCSeconds(SECONDS) + .setUTCMilliseconds(MILLISECONDS); + return xdate.getUTCFullYear() == YEAR && + xdate.getUTCMonth() == MONTH && + xdate.getUTCDate() == DATE && + xdate.getUTCHours() == HOURS && + xdate.getUTCMinutes() == MINUTES && + xdate.getUTCSeconds() == SECONDS && + xdate.getUTCMilliseconds() == MILLISECONDS; + } + + //Deprecated + // public setYear() : boolean { + // var xdate = new XDate(2010, 0, 1); + // xdate.setYear(99); + // return xdate.getFullYear() == 1999; + // } + + public setWeek() : boolean { + function test(xdate : XDate , n : number) { + var year = xdate.getFullYear(); + xdate.setWeek(n); + return xdate.getWeek() == n && + xdate.getFullYear() == year && + xdate.getDay() == 1 && // monday + xdate.getHours() == 0 && + xdate.getMinutes() == 0 && + xdate.getSeconds() == 0 && + xdate.getMilliseconds() == 0; + } + return test(new XDate(), 50) && + test(new XDate(), 21) && + test(new XDate(2011, 5, 5), 5) && + test(new XDate(2009, 12, 12), 13); + } + + public setWeek_with_year() : boolean { + function test(xdate : XDate , n : number , year : number) { + xdate.setWeek(n, year); + return xdate.getWeek() == n && + xdate.getFullYear() == year && + xdate.getDay() == 1 && // monday + xdate.getHours() == 0 && + xdate.getMinutes() == 0 && + xdate.getSeconds() == 0 && + xdate.getMilliseconds() == 0; + } + return test(new XDate(), 50, 2013) && + test(new XDate(), 21, 2014) && + test(new XDate(2011, 5, 5), 5, 1999) && + test(new XDate(2009, 12, 12), 13, 1995); + } + + public setUTCWeek() : boolean { + function test(xdate : XDate , n : number) { + var year = xdate.getUTCFullYear(); + xdate.setUTCWeek(n); + return xdate.getUTCWeek() == n && + xdate.getUTCFullYear() == year && + xdate.getUTCDay() == 1 && // monday + xdate.getUTCHours() == 0 && + xdate.getUTCMinutes() == 0 && + xdate.getUTCSeconds() == 0 && + xdate.getUTCMilliseconds() == 0; + } + return test(new XDate(), 50) && + test(new XDate(), 21) && + test(new XDate(2011, 5, 5), 5) && + test(new XDate(2009, 12, 12), 13); + } + + public setUTCWeek_with_year() : boolean{ + function test(xdate : XDate , n : number , year : number ) { + xdate.setUTCWeek(n, year); + return xdate.getUTCWeek() == n && + xdate.getUTCFullYear() == year && + xdate.getUTCDay() == 1 && // monday + xdate.getUTCHours() == 0 && + xdate.getUTCMinutes() == 0 && + xdate.getUTCSeconds() == 0 && + xdate.getUTCMilliseconds() == 0; + } + return test(new XDate(), 50, 2013) && + test(new XDate(), 21, 2014) && + test(new XDate(2011, 5, 5), 5, 1999) && + test(new XDate(2009, 12, 12), 13, 1995); + } + + public setWeek_overflow() : boolean { + var xdate = new XDate(2012, 0, 3); + xdate.setWeek(54); + return xdate.getFullYear() == 2013 && + xdate.getWeek() == 2 && + xdate.getMonth() == 0 && + xdate.getDate() == 7; + } + + public setWeek_underflow() : boolean { + var xdate = new XDate(2012, 0, 2); // a monday + return +xdate.clone().setWeek(0) == +xdate.clone().addWeeks(-1) && + +xdate.clone().setWeek(-1) == +xdate.clone().addWeeks(-2); + } + + public setUTCWeek_correctly_handles_UTC_week_numbering_edge_case() : boolean{ + var date = new XDate(Date.UTC(2010, 0, 3)); + + var wasWeek53 = date.getUTCWeek() === 53; + date.setUTCWeek(53); + + return wasWeek53 && "Mon, 28 Dec 2009 00:00:00 GMT" === date.toUTCString(); + } + + } + + // based on xdate/test/utc-mode.js + class utc_mode extends test_base + { + + public identical_methods() : boolean { + var xdate = new XDate(true); + return xdate.getFullYear() == xdate.getUTCFullYear() && + xdate.getMonth() == xdate.getUTCMonth() && + xdate.getDate() == xdate.getUTCDate() && + xdate.getHours() == xdate.getUTCHours() && + xdate.getMinutes() == xdate.getUTCMinutes() && + xdate.getSeconds() == xdate.getUTCSeconds() && + xdate.getMilliseconds() == xdate.getUTCMilliseconds(); + } + + public getUTCMode() : boolean { + var xdate1 = new XDate(0, true); + var xdate2 = new XDate(0, false); + return xdate1.getUTCMode() && !xdate2.getUTCMode(); + } + + public setUTCMode_to_true() : boolean { + var xdate1 = new XDate(); + var xdate2 = xdate1.clone().setUTCMode(true); + return !xdate1.getUTCMode() && xdate2.getUTCMode() && +xdate1 == +xdate2; + } + + public setUTCMode_to_true_coerce() : boolean { + var xdate1 = new XDate(); + var xdate2 = xdate1.clone().setUTCMode(true, true); + return !xdate1.getUTCMode() && xdate2.getUTCMode() && + (!xdate1.getTimezoneOffset() || xdate1.getTime() != xdate2.getTime()) && + (xdate1.getDate() == xdate2.getDate() && xdate2.getDate() == xdate2.getUTCDate()) && + (xdate1.getHours() == xdate2.getHours() && xdate2.getHours() == xdate2.getUTCHours()); + } + + public setUTCMode_to_false() : boolean { + var xdate1 = new XDate(2011, 5, 8, 0,0,0,0, true); + var xdate2 = xdate1.clone().setUTCMode(false); + return xdate1.getUTCMode() && !xdate2.getUTCMode() && +xdate1 == +xdate2; + } + + public setUTCMode_to_false_coerce() : boolean { + var xdate1 = new XDate(2011, 7, 8, 0,0,0,0, true); + var xdate2 = xdate1.clone().setUTCMode(false, true); + return xdate1.getUTCMode() && !xdate2.getUTCMode() && + (!xdate1.getTimezoneOffset() || xdate1.getTime() != xdate2.getTime()) && + xdate1.getDate() == xdate2.getDate() && + xdate1.getHours() == xdate1.getHours(); + } + + public getTimezoneOffset() : boolean { + var date = new Date(); + var xdate1 = new XDate(+date); + var xdate2 = new XDate(+date, true); + return xdate1.getTimezoneOffset() == date.getTimezoneOffset() && + !xdate2.getTimezoneOffset(); + } + } + + // bases on xdate/test/utilities.js + class utilities extends test_base + { + + public clone() : boolean { + var d1 = new XDate(); + var d2 = d1.clone(); + d2.addMinutes(30); + return +d1 != +d2; + } + + + public clearTime() : boolean { + var d = new XDate(2010, 2, 5, 16, 15, 10, 100); + d.clearTime(); + return !d.getHours() && !d.getMinutes() && !d.getSeconds() && !d.getMilliseconds(); + } + + + public valid() : boolean { + var good = new XDate(); + var bad = new XDate('asdf'); + return good.valid() && !bad.valid(); + } + + + public toDate_hasLocalTimezone_yes() : boolean { + var d = new Date(2012, 5, 8); + var xdate = new XDate(d); + return +xdate.toDate() == +d; + } + + + public toDate_hasLocalTimezone_no() : boolean { + var d = new Date(2012, 5, 8); + var xdate = new XDate(+d, false); + return +xdate.toDate() == +d; + } + + + public getDaysInMonth() : boolean { + return XDate.getDaysInMonth(2011, 1) == 28 && // feb + XDate.getDaysInMonth(2012, 1) == 29 && // feb, leap year + XDate.getDaysInMonth(2012, 8) == 30 && // sep + XDate.getDaysInMonth(2012, 6) == 31; // jul + } + + + public UTC_class_method() : boolean { + return Date.UTC(2011, 3, 20, 12, 30) == XDate.UTC(2011, 3, 20, 12, 30); + } + + + public parse_class_method() : boolean { + var s = "Sat Apr 23 2011 13:44:12 GMT-0700 (PDT)"; + return Date.parse(s) == XDate.parse(s); + //&& + //isNaN(Date.parse()) && isNaN(XDate.parse()); + } + + + public now_class_method() : boolean { + return Math.abs(+new Date() - XDate.now()) < 1000; + } + + + public today_class_method() : boolean { + var xdate = XDate.today(); + var d = new Date(); + return xdate.getFullYear() == d.getFullYear() && + xdate.getMonth() == d.getMonth() && + xdate.getDate() == d.getDate() && + !xdate.getHours() && + !xdate.getSeconds() && + !xdate.getMilliseconds(); + } + + + public toJSON() : boolean { + var realDate = new Date(2011, 3, 20, 12, 30); + var xdate = new Date(2011, 3, 20, 12, 30); + if (!realDate.toJSON) { + return false; + } + return realDate.toJSON() == xdate.toJSON(); + } + + + public chaining() : boolean { + var d = new XDate() +// .setYear(99) + .setFullYear(2011) + .setWeek(50) + .setMonth(1) + .setDate(5) + .setHours(12) + .setMinutes(50) + .setSeconds(20) + .setMilliseconds(500) + .setTime(0) + .addYears(1) + .addMonths(1) + .addDays(1) + .addMinutes(1) + .addSeconds(1) + .addMilliseconds(1) + .clone() + .clearTime() + .setUTCFullYear(2010) + .setUTCMonth(6) + .setUTCWeek(5) + .setUTCDate(4) + .setUTCHours(12) + .setUTCMinutes(30) + .setUTCSeconds(30) + .setUTCMilliseconds(10) + .setUTCMode(true); + return d instanceof XDate; + } + + } + +} diff --git a/xdate/xdate.d.ts b/xdate/xdate.d.ts new file mode 100644 index 000000000..1d3089d84 --- /dev/null +++ b/xdate/xdate.d.ts @@ -0,0 +1,375 @@ +// Type definitions for XDate 0.8 +// Project: http://arshaw.com/xdate/ +// Definitions by: yamada28go +// Definitions: https://github.com/daptiv/DefinitelyTyped + + +interface formatters_info +{ + i?: string; + u?: string; + xxx? : string; + vvv?: (xdate : XDate , useutc : boolean ) => string; +} + +interface locale_detail +{ + monthNames? : string []; + monthNamesShort?: string []; + dayNames?: string[]; + dayNamesShort?: string []; + amDesignator?: string; + pmDesignator?: string; +} + + +declare class XDate { + + //------------ + //Constructors + //------------ + + public constructor(); + + public constructor( utcmode : boolean ); + + /** + * constructor + */ + public constructor(xdate : XDate , utcmode? : boolean ) ; + + /** + * constructor + * @param {Date} [nativeDate] - JavaScript native date + */ + public constructor(nativeDate : Date , utcmode? : boolean ) ; + + /** + * constructor + * @param {number} [milliseconds] - milliseconds + */ + public constructor(milliseconds: number , utcmode? : boolean ) ; + + /** + * constructor + * @param {number} [year] - year + * @param {number} [month] - month + * @param {number} [date] - date + * @param {number} [hours] - hours + * @param {number} [minutes] - minutes + * @param {number} [seconds] - seconds + * @param {number} [milliseconds] - milliseconds + */ + public constructor( year : number , month : number , date : number , + hours? : number , minutes? : number , seconds? : number , milliseconds? : number , utcmode? : boolean ); + + /** + * constructor + * @param {string} [dateString] - formatted date string + */ + public constructor( dateString : string , utcmode? : boolean ); + + //------------ + //Getters + //------------ + + /** + * Returns the 4-digit year (ex: 2012) + * @return {number} 4-digit year (ex: 2012) + */ + public getFullYear() : number ; + + /* + *Returns the month of the year. (0-11) + *Value is zero-index, meaning Jan=0, Feb=1, Mar=2, etc. + */ + public getMonth() : number; + + /* + *Returns the ISO week number of the year. (1-53) + */ + public getWeek(): number; + + /* + *Returns the date of the month. (1-31) + */ + public getDate() : number; + + /* + *Returns the day-of-week as a number. (0-6) + *Sun=0, Mon=1, Tue=2, etc. + */ + public getDay() : number; + + /* + *Returns the hour of the day. (0-23) + */ + public getHours() : number; + + /* + *Returns the minute of the hour. (0-59) + */ + public getMinutes() : number; + + /* + *Returns the second of the minute. (0-59) + */ + public getSeconds() : number; + + /* + *Returns the millisecond of the second. (0-999) + */ + public getMilliseconds() : number; + + /* + *Returns the number of milliseconds since the epoch. + */ + public getTime() : number; + + /* + *Returns the number of milliseconds since the epoch. Identical to getTime. + */ + public valueOf() : number; + + //------------ + //Setters + //------------ + + /* + *year is a 4-digit year + */ + public setFullYear(year : number , preventOverflow? : boolean) : XDate; + + /* + month is zero-indexed, meaning Jan=0, Feb=1, Mar=2, etc. + */ + public setMonth(month : number , preventOverflow? : boolean ) : XDate; + + /* + *Moves the xdate to the Monday of the given week with time 00:00:00. + *The week is represented by a given ISO week number and an optional year. If year is omitted, the xdate's year with be used. + */ + public setWeek(week : number , year? : number) : XDate; + + /* + *Sets the date of the month. (1-31) + */ + public setDate(date : number ) : XDate; + + /* + *Sets the hour of the day. (0-23) + */ + public setHours(hours: number ) :XDate; + + /* + *Sets the minute of the hour. (0-59) + */ + public setMinutes(minutes : number) : XDate; + + /* + *Sets the second of the minute. (0-59) + */ + public setSeconds(seconds : number) : XDate; + + /* + *Sets the millisecond of the second. (0-999) + */ + public setMilliseconds(milliseconds : number) : XDate; + + /* + *Sets the number of milliseconds since the epoch. + */ + public setTime(milliseconds : number ) : XDate; + + //------------ + //Adding + //------------ + public addYears(years : number, preventOverflow? : boolean) : XDate; + public addMonths(months : number , preventOverflow? : boolean) : XDate; + public addWeeks(weeks : number) : XDate; + public addDays(days : number) : XDate; + public addHours(hours : number) : XDate; + public addMinutes(minutes : number) : XDate; + public addSeconds(seconds : number) : XDate; + public addMilliseconds(milliseconds : number) :XDate; + + + //------------ + //Diffing + //------------ + public diffYears(otherDate : string) : number ; + public diffYears(otherDate : XDate) : number ; + public diffMonths(otherDate : string) : number ; + public diffMonths(otherDate : XDate) : number ; + public diffWeeks(otherDate : string) : number ; + public diffWeeks(otherDate : XDate) : number ; + public diffDays(otherDate : string) : number ; + public diffDays(otherDate : XDate) : number ; + public diffHours(otherDate : string) : number ; + public diffHours(otherDate : XDate) : number ; + public diffMinutes(otherDate : string) : number ; + public diffMinutes(otherDate : XDate) : number ; + public diffSeconds(otherDate : string) : number ; + public diffSeconds(otherDate : XDate) : number ; + public diffMilliseconds(otherDate : string) : number ; + public diffMilliseconds(otherDate : XDate) : number ; + + + //------------ + //Formatting + //------------ + + /* + *If formatString is not specified, a browser-produced IETF string will be returned. + * settings can be a name of an available locale or an object that overrides the default locale's settings. + */ + public toString(formatString? : string , settings? : Object) : string; + + /* + *Same as toString but gets its values from the UTC version of the date. + *As a result, "Z" will be displayed as the timezone. + */ + public toUTCString(formatString? : string , settings? : Object) : string; + public toGMTString(formatString? : string , settings? : Object) : string; + + /* + *Returns an ISO8601 string that has been normalized to UTC. Will have a "Z" timezone indicator. + *See the native Date's specs for toISOString. + */ + public toISOString() : string; + + /* + *Same as native Date's toDateString + */ + public toDateString() : string; + + /* + *Same as native Date's toTimeString + */ + public toTimeString() : string; + + /* + *Same as native Date's toLocaleString + */ + public toLocaleString() : string; + + /* + *Same as native Date's toLocaleDateString + */ + public toLocaleDateString() : string; + + /* + *Same as native Date's toLocaleTimeString + */ + public toLocaleTimeString() : string; + + + //------------ + //Formatting + //------------ + public getUTCFullYear() : number ; + public getUTCMonth() : number ; + public getUTCWeek() : number ; + public getUTCDate() : number ; + public getUTCDay() : number ; + public getUTCHours() : number ; + public getUTCMinutes() : number ; + public getUTCSeconds() : number ; + public getUTCMilliseconds() : number ; + public setUTCFullYear(year : number) : XDate; + public setUTCMonth(month : number) : XDate; + public setUTCWeek(week : number , year? : number ) : XDate; + public setUTCDate(date : number ) : XDate; + public setUTCHours(hours : number ) : XDate; + public setUTCMinutes(minutes : number ) : XDate; + public setUTCSeconds(seconds : number ) : XDate; + public setUTCMilliseconds(milliseconds : number) : XDate; + + //------------ + //UTC Mode + //------------ + + /* + *Returns true if the date is in UTC-mode and false otherwise + */ + public getUTCMode() : boolean; + + /* + *utcMode must be either true or false. If the optional doCoercion parameters is set to true, + *the underlying millisecond time of the date will be coerced in such a way that methods like + *getDate and getHours will have the same values before and after the conversion. + */ + public setUTCMode(utcMode : boolean , doCoercion? : boolean ) : XDate; + + /* + *Returns the number of minutes from UTC, just like the native Date's getTimezoneOffset. + *However, if the XDate is in UTC-mode, 0 will be returned. + */ + public getTimezoneOffset() : number; + + //------------ + //Utilities + //------------ + + /* + *returns a copy of the XDate + */ + public clone() : XDate; + + /* + *sets the hours, minutes, seconds, and milliseconds to zero + */ + public clearTime() : XDate ; + + /* + *return true if the XDate is a valid date, false otherwise + */ + public valid() : boolean ; + + /* + *Returns a conversion to a native Date + */ + public toDate() : Date; + + //------------ + //Static function + //------------ + + + /* + *Returns the number of days in the given month + */ + public static getDaysInMonth(year : number , month : number) : number; + + /* + *Parses a date-string and returns milliseconds since the epoch. You'll probably want to use new XDate(dateString) instead. + */ + public static parse(dateString : string ) : number; + + + /* + *Returns the current date, as milliseconds since the epoch. You'll probably want to use new XDate() instead. + */ + public static now() : number ; + + + /* + *Returns the current date with time cleared, as an XDate object + */ + public static today() : XDate ; + + /* + *Returns a milliseconds time since the epoch for the given UTC date + */ + public static UTC(year : number , month : number , date : number , hours : number, + minutes : number , seconds : number , milliseconds : number ) : XDate; + + public static locales : { [key: string]: locale_detail; }; + + public static defaultLocale : string; + public static formatters : formatters_info; + + public static getDaysInMonth(year : number, month : number) : number; + public static UTC(year : number, month : number, day : number , hours? : number , minutes? : number , seconds?:number,ms?:number): number; + +} diff --git a/xss-filters/xss-filters-tests.ts b/xss-filters/xss-filters-tests.ts new file mode 100644 index 000000000..49a566efc --- /dev/null +++ b/xss-filters/xss-filters-tests.ts @@ -0,0 +1,37 @@ +/// + +import xssFilters = require('xss-filters'); + +var s = ''; + +xssFilters.inHTMLComment(s); +xssFilters.inHTMLData(s); +xssFilters.inDoubleQuotedAttr(s); +xssFilters.inSingleQuotedAttr(s); +xssFilters.inUnQuotedAttr(s); +xssFilters.uriInHTMLComment(s); +xssFilters.uriInHTMLData(s); +xssFilters.uriInDoubleQuotedAttr(s); +xssFilters.uriInSingleQuotedAttr(s); +xssFilters.uriInUnQuotedAttr(s); +xssFilters.uriPathInHTMLComment(s); +xssFilters.uriPathInHTMLData(s); +xssFilters.uriPathInDoubleQuotedAttr(s); +xssFilters.uriPathInSingleQuotedAttr(s); +xssFilters.uriPathInUnQuotedAttr(s); +xssFilters.uriQueryInHTMLComment(s); +xssFilters.uriQueryInHTMLData(s); +xssFilters.uriQueryInDoubleQuotedAttr(s); +xssFilters.uriQueryInSingleQuotedAttr(s); +xssFilters.uriQueryInUnQuotedAttr(s); +xssFilters.uriComponentInHTMLComment(s); +xssFilters.uriComponentInHTMLData(s); +xssFilters.uriComponentInDoubleQuotedAttr(s); +xssFilters.uriComponentInSingleQuotedAttr(s); +xssFilters.uriComponentInUnQuotedAttr(s); +xssFilters.uriFragmentInHTMLComment(s); +xssFilters.uriFragmentInHTMLData(s); +xssFilters.uriFragmentInDoubleQuotedAttr(s); +xssFilters.uriFragmentInSingleQuotedAttr(s); +xssFilters.uriFragmentInUnQuotedAttr(s); + diff --git a/xss-filters/xss-filters.d.ts b/xss-filters/xss-filters.d.ts new file mode 100644 index 000000000..3ac33d4f3 --- /dev/null +++ b/xss-filters/xss-filters.d.ts @@ -0,0 +1,43 @@ +// Type definitions for Yahoo XSS Filters +// Project: https://github.com/yahoo/xss-filters +// Definitions by: Dave Taylor +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +interface XSSFilters { + inHTMLComment(s:string):string; + inHTMLData(s:string):string; + inDoubleQuotedAttr(s:string):string; + inSingleQuotedAttr(s:string):string; + inUnQuotedAttr(s:string):string; + uriInHTMLComment(s:string):string; + uriInHTMLData(s:string):string; + uriInDoubleQuotedAttr(s:string):string; + uriInSingleQuotedAttr(s:string):string; + uriInUnQuotedAttr(s:string):string; + uriPathInHTMLComment(s:string):string; + uriPathInHTMLData(s:string):string; + uriPathInDoubleQuotedAttr(s:string):string; + uriPathInSingleQuotedAttr(s:string):string; + uriPathInUnQuotedAttr(s:string):string; + uriQueryInHTMLComment(s:string):string; + uriQueryInHTMLData(s:string):string; + uriQueryInDoubleQuotedAttr(s:string):string; + uriQueryInSingleQuotedAttr(s:string):string; + uriQueryInUnQuotedAttr(s:string):string; + uriComponentInHTMLComment(s:string):string; + uriComponentInHTMLData(s:string):string; + uriComponentInDoubleQuotedAttr(s:string):string; + uriComponentInSingleQuotedAttr(s:string):string; + uriComponentInUnQuotedAttr(s:string):string; + uriFragmentInHTMLComment(s:string):string; + uriFragmentInHTMLData(s:string):string; + uriFragmentInDoubleQuotedAttr(s:string):string; + uriFragmentInSingleQuotedAttr(s:string):string; + uriFragmentInUnQuotedAttr(s:string):string; +} + +declare var xssFilters:XSSFilters; + +declare module 'xss-filters' { + export = xssFilters; +} diff --git a/yargs/yargs-tests.ts b/yargs/yargs-tests.ts index 4e6d742a2..10b75382b 100644 --- a/yargs/yargs-tests.ts +++ b/yargs/yargs-tests.ts @@ -155,3 +155,14 @@ function Argv$showHelp() { .usage("$0 -operand1 number -operand2 number -operation [add|subtract]"); yargs1.showHelp(); } + +function Argv$version() { + var argv1 = yargs + .version('1.0.0'); + + var argv2 = yargs + .version('1.0.0', '--version'); + + var argv3 = yargs + .version('1.0.0', '--version', 'description'); +} diff --git a/yargs/yargs.d.ts b/yargs/yargs.d.ts index c09583526..6a6adebe8 100644 --- a/yargs/yargs.d.ts +++ b/yargs/yargs.d.ts @@ -53,6 +53,8 @@ declare module "yargs" { usage(message: string, options?: { [key: string]: Options }): Argv; usage(options?: { [key: string]: Options }): Argv; + command(command: string, description: string): Argv; + example(command: string, description: string): Argv; check(func: (argv: { [key: string]: any }, aliases: { [alias: string]: string }) => boolean): Argv; @@ -74,7 +76,7 @@ declare module "yargs" { help(): string; help(option: string, description?: string): Argv; - version(version: string, option: string, description?: string): Argv; + version(version: string, option?: string, description?: string): Argv; showHelpOnFail(enable: boolean, message?: string): Argv; diff --git a/youtube/youtube.d.ts b/youtube/youtube.d.ts index 85f96b22f..d7e52ae17 100644 --- a/youtube/youtube.d.ts +++ b/youtube/youtube.d.ts @@ -38,11 +38,11 @@ declare module YT { iv_load_policy?: number; list?: string; listType?: ListType; - loop?; + loop?: number; modestbranding?: number; - origin?; + origin?: string; playerpiid?: string; - playlist?; + playlist?: string[]; rel?: number; showinfo?: number; start?: number; @@ -84,17 +84,17 @@ declare module YT { // Queueing functions loadVideoById(videoId: string, startSeconds?: number, suggestedQuality?: string): void; - loadVideoById(VideoByIdParams): void; + loadVideoById(VideoByIdParams: Object): void; cueVideoById(videoId: string, startSeconds?: number, suggestedQuality?: string): void; - cueVideoById(VideoByIdParams): void; + cueVideoById(VideoByIdParams: Object): void; loadVideoByUrl(mediaContentUrl: string, startSeconds?: number, suggestedQuality?: string): void; - loadVideoByUrl(VideoByUrlParams): void; + loadVideoByUrl(VideoByUrlParams: Object): void; cueVideoByUrl(mediaContentUrl: string, startSeconds?: number, suggestedQuality?: string): void; - cueVideoByUrl(VideoByUrlParams): void; + cueVideoByUrl(VideoByUrlParams: Object): void; // Properties - size; + size: any; // Playing playVideo(): void; @@ -156,4 +156,4 @@ declare module YT { PAUSED, PLAYING } -} +} \ No newline at end of file diff --git a/zynga-scroller/zynga-scroller-tests.ts b/zynga-scroller/zynga-scroller-tests.ts new file mode 100644 index 000000000..412765671 --- /dev/null +++ b/zynga-scroller/zynga-scroller-tests.ts @@ -0,0 +1,36 @@ +/// + +var scroller: Scroller = new Scroller((left, top, zoom) => { }); +scroller = new Scroller((left, top, zoom) => { }, { + scrollingX: true, + scrollingY: true, + animating: true, + animationDuration: 400, + bouncing: false, + locking: false, + paging: false, + snapping: true, + zooming: 10, + minZoom: 1, + maxZoom: 2 +}); + +scroller.setDimensions(10, 10, 10, 10); +scroller.setPosition(200, 300); +scroller.setSnapSize(300, 300); +scroller.activatePullToRefresh(200, () => { }, () => { }, () => { }); +scroller.finishPullToRefresh(); +var data: { + left: number; + top: number; + zoom: number +} = scroller.getValues(); +scroller.zoomTo(10); +scroller.zoomBy(10); +scroller.doMouseZoom(10, 10, 10, 10); +scroller.doTouchStart({ + pageX: 10, + pageY: 20 +}, 200); +scroller.doTouchMove([10], 200); +scroller.doTouchEnd(300); \ No newline at end of file diff --git a/zynga-scroller/zynga-scroller.d.ts b/zynga-scroller/zynga-scroller.d.ts new file mode 100644 index 000000000..04b82b577 --- /dev/null +++ b/zynga-scroller/zynga-scroller.d.ts @@ -0,0 +1,50 @@ +// Type definitions for Zynga Scroller +// Project: http://zynga.github.com/scroller/ +// Definitions by: Marcelo Haskell Camargo +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare class Scroller { + constructor(a: (left: number, top: number, zoom: number) => void, b?: { + scrollingX?: boolean; + scrollingY?: boolean; + animating?: boolean; + animationDuration?: number; + bouncing?: boolean; + locking?: boolean; + paging?: boolean; + snapping?: boolean; + zooming?: number; + minZoom?: number; + maxZoom?: number + }); + setDimensions(clientWidth: number, clientHeight: number, contentWidth: number, + contentHeight: number): void; + setPosition(clientLeft: number, clientTop: number): void; + setSnapSize(width: number, height: number): void; + activatePullToRefresh(height: number, activate: () => void, + deactivate: () => void, start: () => void): void; + finishPullToRefresh(): void; + getValues(): { + left: number; + top: number; + zoom: number + }; + zoomTo(level: number, animate?: boolean, originLeft?: number, + originTop?: number): void; + zoomBy(factor: number, animate?: boolean, originLeft?: number, + originTop?: number): void; + scrollTo(left: number, top: number, animate?: boolean): void; + scrollBy(leftOffset: number, topOffset: number, animate?: boolean): void; + doMouseZoom(wheelData: number, timeStamp: number, pageX: number, + pageY: number): void; + doTouchStart(touches: { + pageX: number; + pageY: number + }, timeStamp: number): void; + doTouchMove(touches: { + pageX: number; + pageY: number + }, timeStamp: number, scale?: number): void; + doTouchMove(touches: [any], timeStamp: number): void; + doTouchEnd(timeStamp: number): void; +} \ No newline at end of file