diff --git a/.gitignore b/.gitignore index b09429865..d4bc5dd91 100644 --- a/.gitignore +++ b/.gitignore @@ -23,12 +23,7 @@ Properties *~ # test folder -!_infrastructure/*.js -!_infrastructure/tests/* -!_infrastructure/tests/*.js -!_infrastructure/tests/*/*.js -!_infrastructure/tests/*/*/*.js -!_infrastructure/tests/*/*/*/*.js +_infrastructure/tests/build .idea *.iml diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 532e0404e..c01d01147 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -49,6 +49,7 @@ All definitions files include a header with the author and editors, so at some p * [Commander](http://github.com/visionmedia/commander.js) (by [Marcelo Dezem](https://github.com/mdezem)) * [configstore](http://github.com/yeoman/configstore) (by [Bart van der Schoor](https://github.com/Bartvds)) * [Cordova](http://cordova.apache.org) (by [Microsoft Open Technologies, Inc.](http://msopentech.com/)) +* [Cordovarduino](https://github.com/stereolux/cordovarduino) (by [Hendrik Maus](https://github.com/hendrikmaus)) * [Couchbase / Couchnode](https://github.com/couchbase/couchnode) (by [Basarat Ali Syed](https://github.com/basarat)) * [Crossfilter](https://github.com/square/crossfilter) (by [Schmulik Raskin](https://github.com/schmuli)) * [crypto-js](https://code.google.com/p/crypto-js/) (by [Gia Bảo @ Sân Đình](https://github.com/giabao)). @see [cryptojs.d.ts repo](https://github.com/giabao/cryptojs.d.ts) @@ -83,10 +84,12 @@ All definitions files include a header with the author and editors, so at some p * [Firefox](https://developer.mozilla.org/en-US/docs/Web/API) (by [vvakame](https://github.com/vvakame)) * [FlexSlider](http://www.woothemes.com/flexslider/) (by [Diullei Gomes](https://github.com/Diullei)) * [Flight by Twitter](http://flightjs.github.com/flight/) (by [Jonathan Hedrén](https://github.com/jonathanhedren)) +* [flipsnap.js](http://pxgrid.github.io/js-flipsnap/) (by [kubosho_](https://github.com/kubosho), [gsino](https://github.com/gsino), [Mayuki Sawatari](https://github.com/mayuki)) * [Foundation](http://foundation.zurb.com/) (by [Boris Yankov](https://github.com/borisyankov)) * [FPSMeter](http://darsa.in/fpsmeter/) (by [Aaron Lampros](https://github.com/alampros)) * [fs-extra](https://github.com/jprichardson/node-fs-extra) (by [midknight41](https://github.com/midknight41)) * [FullCalendar](http://arshaw.com/fullcalendar/) (by [Neil Stalker](https://github.com/nestalk)) +* [Fuse.js](https://github.com/krisk/Fuse) (by [Greg Smith](https://github.com/smrq)) * [Gamepad](http://www.w3.org/TR/gamepad/) (by [Kon](http://phyzkit.net/)) * [GeoJSON](http://geojson.org/) (by [Jake Bruun](https://github.com/cobster)) * [Giraffe](https://github.com/barc/backbone.giraffe) (by [Matt McCray](https://github.com/darthapo)) @@ -120,6 +123,8 @@ All definitions files include a header with the author and editors, so at some p * [iCheck](http://damirfoy.com/iCheck/) (by [Dániel Tar](https://github.com/qcz)) * [Impress.js](https://github.com/bartaz/impress.js) (by [Boris Yankov](https://github.com/borisyankov)) * [Imagemagick](http://github.com/rsms/node-imagemagick) (by [Carlos Ballesteros Velasco](https://github.com/soywiz)) +* [interact.js](http://github.com/taye/interact.js) (by [Douglas Eichelberger](https://github.com/dduugg)) +* [Ionic-Cordova](https://github.com/driftyco/) (by [Hendrik Maus](https://github.com/hendrikmaus)) * [iScroll](http://cubiq.org/iscroll-4) (by [Boris Yankov](https://github.com/borisyankov) and [Christiaan Rakowski](https://github.com/csrakowski)) * [IxJS (Interactive extensions)](https://github.com/Reactive-Extensions/IxJS) (by [Igor Oleinikov](https://github.com/Igorbek)) * [jake](https://github.com/mde/jake) (by [Kon](http://phyzkit.net/)) @@ -131,7 +136,7 @@ All definitions files include a header with the author and editors, so at some p * [jQuery](http://jquery.com/) (from TypeScript samples) * [jQuery Mobile](http://jquerymobile.com) (by [Boris Yankov](https://github.com/borisyankov)) * [jQuery UI](http://jqueryui.com/) (by [Boris Yankov](https://github.com/borisyankov)) -* [jQuery.Address](https://github.com/asual/jquery-address) (by [Martin Duparc](https://github.com/martinduparc/)) +* [jQuery.Address](https://github.com/asual/jquery-address) (by [Martin Duparc](https://github.com/martinduparc/) and [Tim Klingeleers](https://github.com/mardaneus86/)) * [jQuery.areYouSure](https://github.com/codedance/jquery.AreYouSure) (by [Jon Egerton](https://github.com/jonegerton)) * [jQuery.autosize](http://www.jacklmoore.com/autosize/) (by [Jack Moore](http://www.jacklmoore.com/)) * [jQuery.BBQ](http://benalman.com/projects/jquery-bbq-plugin/) (by [Adam R. Smith](https://github.com/sunetos)) @@ -154,10 +159,15 @@ All definitions files include a header with the author and editors, so at some p * [jQuery.jNotify](http://jnotify.codeplex.com) (by [James Curran](https://github.com/jamescurran/)) * [jQuery.joyride](http://zurb.com/playground/jquery-joyride-feature-tour-plugin) (by [Vincent Bortone](https://github.com/vbortone)) * [jQuery.jSignature](https://github.com/willowsystems/jSignature) (by [Patrick Magee](https://github.com/pjmagee)) +* [jQuery.notifyBar](http://www.whoop.ee/posts/2013-04-05-the-resurrection-of-jquery-notify-bar/) (by [Shunsuke Ohtani](https://github.com/zaneli)) * [jQuery.noty](http://needim.github.io/noty/) (by [Aaron King](https://github.com/kingdango/)) -* [jQuery.pickadate](https://github.com/amsul/pickadate.js) (by [Theodore Brown](https://github.com/theodorejb)) * [jQuery.payment](http://needim.github.io/noty/) (by [Eric J. Smith](https://github.com/ejsmith/)) +* [jQuery.pickadate](https://github.com/amsul/pickadate.js) (by [Theodore Brown](https://github.com/theodorejb)) +* [jQuery.pjax](https://github.com/defunkt/jquery-pjax) (by [Junle Li](https://github.com/lijunle)) +* [jQuery.pjax.falsandtru](https://github.com/falsandtru/jquery.pjax.js/) (by [NewNotMoon](http://new.not-moon.net/)) * [jQuery.pnotify](http://sciactive.github.io/pnotify/) (by [David Sichau](https://github.com/DavidSichau/)) +* [jQuery.postMessage](http://benalman.com/projects/jquery-postmessage-plugin/) (by [Junle Li](https://github.com/lijunle)) +* [jQuery.prettyphoto](https://github.com/scaron/prettyphoto) (by [Paul Gaske](https://github.com/pgaske)) * [jQuery.scrollTo](https://github.com/flesler/jquery.scrollTo) (by [Neil Stalker](https://github.com/nestalk/)) * [jQuery.simplePagination](https://github.com/flaviusmatis/simplePagination.js) (by [Natan Vivo](https://github.com/nvivo/)) * [jquery.superLink](http://james.padolsey.com/demos/plugins/jQuery/superLink/superlink.jquery.js) (by [Blake Niemyjski](https://github.com/niemyjski)) @@ -185,9 +195,11 @@ All definitions files include a header with the author and editors, so at some p * [jsTree](http://www.jstree.com/) (by [Adam Pluciński](https://github.com/adaskothebeast)) * [JWPlayer](http://developer.longtailvideo.com/trac/) (by [Martin Duparc](https://github.com/martinduparc/)) * [KeyboardJS](https://github.com/RobertWHurst/KeyboardJS) (by [Vincent Bortone](https://github.com/vbortone/)) +* [keymaster.js](https://github.com/madrobby/keymaster) (by [Marting W. Kirst](https://github.com/nitram509/)) * [KineticJS](http://kineticjs.com/) (by [Basarat Ali Syed](https://github.com/basarat)) * [Knockback](http://kmalakoff.github.com/knockback/) (by [Marcel Binot](https://github.com/docgit)) * [Knockout.js](http://knockoutjs.com/) (by [Boris Yankov](https://github.com/borisyankov)) +* [Knockout.Amd.Helpers](https://github.com/rniemeyer/knockout-amd-helpers) (by [David Sichau](https://github.com/DavidSichau/)) * [Knockout.DeferredUpdates](https://github.com/mbest/knockout-deferred-updates) (by [Sebastián Galiano](https://github.com/sgaliano)) * [Knockout.ES5](https://github.com/SteveSanderson/knockout-es5) (by [Sebastián Galiano](https://github.com/sgaliano)) * [Knockout.Mapper](https://github.com/LucasLorentz/knockout.mapper) (by [Brandon Meyer](https://github.com/BMeyerKC)) @@ -210,6 +222,7 @@ All definitions files include a header with the author and editors, so at some p * [Logg](https://github.com/dpup/node-logg) (by [Bret Little](https://github.com/blittle)) * [Long.js](https://github.com/dcodeIO/Long.js) (by [Toshihide Hara](https://github.com/kerug)) * [lz-string](https://github.com/pieroxy/lz-string) (by [Roman Nikitin](https://github.com/M0ns1gn0r)) +* [Mapbox](https://github.com/mapbox/mapbox.js/) (by [Maxime Fabre](https://github.com/anahkiasen)) * [Marked](https://github.com/chjj/marked) (by [William Orr](https://github.com/worr)) * [MathJax](https://github.com/mathjax/MathJax) (by [Roland Zwaga](https://github.com/rolandzwaga)) * [mCustomScrollbar](https://github.com/malihu/malihu-custom-scrollbar-plugin) (by [Sarah Williams](https://github.com/flurg)) @@ -218,6 +231,7 @@ All definitions files include a header with the author and editors, so at some p * [Microsoft Live Connect](http://msdn.microsoft.com/en-us/library/live/hh243643.aspx) (by [John Vilk](https://github.com/jvilk)) * [Minimatch](https://github.com/isaacs/minimatch) (by [vvakame](https://github.com/vvakame)) * [minimist](https://github.com/substack/minimist) (by [Bart van der Schoor](https://github.com/Bartvds)) +* [Mixpanel](https://github.com/mixpanel/mixpanel-js) (by [Knut Eirik Leira Hjelle](https://github.com/hjellek)) * [mixto](https://github.com/atom/mixto) (by [vvakame](https://github.com/vvakame)) * [Modernizr](http://modernizr.com/) (by [Boris Yankov](https://github.com/borisyankov) and [Theodore Brown](https://github.com/theodorejb/)) * [Moment.js](https://github.com/timrwood/moment) (by [Michael Lakerveld](https://github.com/Lakerfield)) @@ -244,6 +258,7 @@ All definitions files include a header with the author and editors, so at some p * [OpenLayers](https://github.com/openlayers/openlayers) (by [Ilya Bolkhovsky](https://github.com/bolhovsky/)) * [Optimist](https://github.com/substack/node-optimist) (by [Carlos Ballesteros Velasco](https://github.com/soywiz)) * [Passport](http://passportjs.org/) (by [Hiroki Horiuchi](https://github.com/horiuchi/)) +* [passport-strategy](https://github.com/jaredhanson/passport-strategy) (by [Lior Mualem](https://github.com/liorm)) * [pathwatcher](http://atom.github.io/node-pathwatcher/) (by [vvakame](https://github.com/vvakame)) * [Parallel.js](https://github.com/adambom/parallel.js) (by [Josh Baldwin](https://github.com/jbaldwin)) * [Parsimmon](https://github.com/jayferd/parsimmon) (by [Bart van der Schoor](https://github.com/Bartvds)) @@ -270,6 +285,7 @@ All definitions files include a header with the author and editors, so at some p * [Raphael](http://raphaeljs.com/) (by [CheCoxshall](https://github.com/CheCoxshall)) * [Restangular](https://github.com/mgonto/restangular/) (by [Boris Yankov](https://github.com/borisyankov)) * [require.js](http://requirejs.org/) (by [Josh Baldwin](https://github.com/jbaldwin/)) +* [rtree.js] (https://github.com/leaflet-extras/RTree) (by [Omede Firouz](https://github.com/oefirouz)) * [Sammy.js](http://sammyjs.org/) (by [Boris Yankov](https://github.com/borisyankov)) * [Select2](http://ivaynberg.github.com/select2/) (by [Boris Yankov](https://github.com/borisyankov)) * [Selenium WebDriverJS](https://code.google.com/p/selenium/) (by [Bill Armstrong](https://github.com/BillArmstrong)) @@ -284,6 +300,7 @@ All definitions files include a header with the author and editors, so at some p * [socket.io](http://socket.io) (by [William Orr](https://github.com/worr)) * [socket.io-client](http://socket.io) (by [Maido Kaara](https://github.com/v3rm0n)) * [SockJS](https://github.com/sockjs/sockjs-client) (by [Emil Ivanov](https://github.com/vladev)) +* [sockjs-node](https://github.com/sockjs/sockjs-node) (by [Phil McCloghry-Laing](https://github.com/pmccloghrylaing)) * [SoundJS](http://www.createjs.com/#!/SoundJS) (by [Pedro Ferreira](https://bitbucket.org/drk4)) * [Spin](http://fgnass.github.com/spin.js/) (by [Boris Yankov](https://github.com/borisyankov)) * [sqlite3](https://github.com/mapbox/node-sqlite3) (by [Nick Malaguti](https://github.com/nmalaguti)) @@ -299,6 +316,8 @@ All definitions files include a header with the author and editors, so at some p * [Teechart](http://www.steema.com) (by [Steema](http://www.steema.com)) * [text-buffer](https://github.com/atom/text-buffer) (by [vvakame](https://github.com/vvakame)) * [three.js](http://mrdoob.github.com/three.js/) (by [Kon](http://phyzkit.net/)) +* [TimelineJS](https://github.com/NUKnightLab/TimelineJS) (by [Roland Zwaga](https://github.com/rolandzwaga)) +* [timezonecomplete](https://github.com/SpiritIT/timezonecomplete) (by [Rogier Schouten](https://github.com/rogierschouten)) * [Toastr](https://github.com/CodeSeven/toastr) (by [Boris Yankov](https://github.com/borisyankov)) * [trunk8](https://github.com/rviscomi/trunk8) (by [Blake Niemyjski](https://github.com/niemyjski)) * [TweenJS](http://www.createjs.com/#!/TweenJS) (by [Pedro Ferreira](https://bitbucket.org/drk4)) @@ -315,6 +334,7 @@ All definitions files include a header with the author and editors, so at some p * [urlrouter](https://github.com/fengmk2/urlrouter) (by [Carlos Ballesteros Velasco](https://github.com/soywiz)) * [UUID.js](https://github.com/LiosK/UUID.js) (by [Jason Jarrett](https://github.com/staxmanade)) * [Valerie](https://github.com/davewatts/valerie) (by [Howard Richards](https://github.com/conficient)) +* [Velocity](http://velocityjs.org/) (by [Greg Smith](https://github.com/smrq)) * [Viewporter](https://github.com/zynga/viewporter) (by [Boris Yankov](https://github.com/borisyankov)) * [Vimeo](http://developer.vimeo.com/player/js-api) (by [Daz Wilkin](https://github.com/DazWilkin/)) * [vinyl](https://github.com/wearefractal/vinyl) (by [vvakame](https://github.com/vvakame/)) @@ -325,6 +345,7 @@ All definitions files include a header with the author and editors, so at some p * [WinRT](http://msdn.microsoft.com/en-us/library/windows/apps/br211377.aspx) (from TypeScript samples) * [ws](http://einaros.github.io/ws/) (by [Paul Loyd](https://github.com/loyd)) * [x2js](https://code.google.com/p/x2js/) (by [Hiroki Horiuchi](https://github.com/horiuchi/)) +* [xml2js](https://github.com/Leonidas-from-XIV/node-xml2js) (by [Michel Salib](https://github.com/michelsalib)) * [XRegExp](http://xregexp.com/) (by [Bart van der Schoor](https://github.com/Bartvds)) * [YouTube](https://developers.google.com/youtube/) (by [Daz Wilkin](https://github.com/DazWilkin/)) * [YouTube Analytics API](https://developers.google.com/youtube/analytics/) (by [Frank M](https://github.com/sgtfrankieboy)) diff --git a/Finch/Finch.d.ts b/Finch/Finch.d.ts index e23e97ef5..e3dd86c70 100644 --- a/Finch/Finch.d.ts +++ b/Finch/Finch.d.ts @@ -1,6 +1,6 @@ // Type definitions for Finch 0.5.13 -// Project: https://github.com/stoodder/finchjs -// Definitions by: https://github.com/DavidSichau +// Project: https://github.com/stoodder/finchjs +// Definitions by: David Sichau // Definitions: https://github.com/borisyankov/DefinitelyTyped diff --git a/JSONStream/JSONStream-tests.ts b/JSONStream/JSONStream-tests.ts new file mode 100644 index 000000000..ea7eb64ff --- /dev/null +++ b/JSONStream/JSONStream-tests.ts @@ -0,0 +1,15 @@ +/// + +import json = require('JSONStream'); + +var read: NodeJS.ReadableStream; +var write: NodeJS.WritableStream; + +read = read.pipe(json.parse('*')); +read = read.pipe(json.parse(['foo/*', 'bar/*'])); + +read = json.stringify(); +read = json.stringify('{', ',', '}'); + +read = json.stringifyObject(); +read = json.stringifyObject('{', ',', '}'); diff --git a/JSONStream/JSONStream.d.ts b/JSONStream/JSONStream.d.ts new file mode 100644 index 000000000..869f965f4 --- /dev/null +++ b/JSONStream/JSONStream.d.ts @@ -0,0 +1,22 @@ +// Type definitions for JSONStream v0.8.0 +// Project: http://github.com/dominictarr/JSONStream +// Definitions by: Bart van der Schoor +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module 'JSONStream' { + + export interface Options { + recurse: boolean; + } + + export function parse(pattern: any): NodeJS.ReadWriteStream; + export function parse(patterns: any[]): NodeJS.ReadWriteStream; + + export function stringify(): NodeJS.ReadWriteStream; + export function stringify(open: string, sep: string, close: string): NodeJS.ReadWriteStream; + + export function stringifyObject(): NodeJS.ReadWriteStream; + export function stringifyObject(open: string, sep: string, close: string): NodeJS.ReadWriteStream; +} diff --git a/_infrastructure/runner.js b/_infrastructure/runner.js new file mode 100644 index 000000000..b9b9446ec --- /dev/null +++ b/_infrastructure/runner.js @@ -0,0 +1 @@ +require('definition-tester'); diff --git a/_infrastructure/tests/_ref.d.ts b/_infrastructure/tests/_ref.d.ts deleted file mode 100644 index 5a0809f3b..000000000 --- a/_infrastructure/tests/_ref.d.ts +++ /dev/null @@ -1 +0,0 @@ -/// diff --git a/_infrastructure/tests/compile-runner.bat b/_infrastructure/tests/compile-runner.bat deleted file mode 100644 index 49f737c5d..000000000 --- a/_infrastructure/tests/compile-runner.bat +++ /dev/null @@ -1 +0,0 @@ -tsc runner.ts --target ES5 --out runner.js --module commonjs --sourcemap diff --git a/_infrastructure/tests/runner.js b/_infrastructure/tests/runner.js deleted file mode 100644 index 171efe87d..000000000 --- a/_infrastructure/tests/runner.js +++ /dev/null @@ -1,1321 +0,0 @@ -var DT; -(function (DT) { - 'use strict'; - - var Promise = require('bluebird'); - var nodeExec = require('child_process').exec; - - var ExecResult = (function () { - function ExecResult() { - this.stdout = ''; - this.stderr = ''; - } - return ExecResult; - })(); - DT.ExecResult = ExecResult; - - function exec(filename, cmdLineArgs) { - return new Promise(function (resolve) { - var result = new ExecResult(); - result.exitCode = null; - - var cmdLine = filename + ' ' + cmdLineArgs.join(' '); - - nodeExec(cmdLine, { maxBuffer: 1 * 1024 * 1024 }, function (error, stdout, stderr) { - result.error = error; - result.stdout = stdout; - result.stderr = stderr; - result.exitCode = error ? error.code : 0; - resolve(result); - }); - }); - } - DT.exec = exec; -})(DT || (DT = {})); -/// -var DT; -(function (DT) { - 'use strict'; - - var path = require('path'); - - ///////////////////////////////// - // Given a document root + ts file pattern this class returns: - // all the TS files OR just tests OR just definition files - ///////////////////////////////// - var File = (function () { - function File(baseDir, filePathWithName) { - this.references = []; - // why choose? - this.baseDir = baseDir; - this.filePathWithName = filePathWithName; - this.ext = path.extname(this.filePathWithName); - this.file = path.basename(this.filePathWithName, this.ext); - this.dir = path.dirname(this.filePathWithName); - this.fullPath = path.join(this.baseDir, this.dir, this.file + this.ext); - // lock it (shallow) (needs `use strict` in each file to work) - // Object.freeze(this); - } - File.prototype.toString = function () { - return '[File ' + this.filePathWithName + ']'; - }; - return File; - })(); - DT.File = File; -})(DT || (DT = {})); -/// -/// -/// -var DT; -(function (DT) { - 'use strict'; - - var fs = require('fs'); - - var Promise = require('bluebird'); - - var Tsc = (function () { - function Tsc() { - } - Tsc.run = function (tsfile, options) { - var tscPath; - return new Promise.attempt(function () { - options = options || {}; - options.tscVersion = options.tscVersion || DT.DEFAULT_TSC_VERSION; - if (typeof options.checkNoImplicitAny === 'undefined') { - options.checkNoImplicitAny = true; - } - if (typeof options.useTscParams === 'undefined') { - options.useTscParams = true; - } - return DT.fileExists(tsfile); - }).then(function (exists) { - if (!exists) { - throw new Error(tsfile + ' not exists'); - } - tscPath = './_infrastructure/tests/typescript/' + options.tscVersion + '/tsc.js'; - return DT.fileExists(tscPath); - }).then(function (exists) { - if (!exists) { - throw new Error(tscPath + ' is not exists'); - } - return DT.fileExists(tsfile + '.tscparams'); - }).then(function (exists) { - var command = 'node ' + tscPath + ' --module commonjs '; - if (options.useTscParams && exists) { - command += '@' + tsfile + '.tscparams'; - } else if (options.checkNoImplicitAny) { - command += '--noImplicitAny'; - } - return DT.exec(command, [tsfile]); - }); - }; - return Tsc; - })(); - DT.Tsc = Tsc; -})(DT || (DT = {})); -/// -/// -var DT; -(function (DT) { - 'use strict'; - - ///////////////////////////////// - // Timer.start starts a timer - // Timer.end stops the timer and sets asString to the pretty print value - ///////////////////////////////// - var Timer = (function () { - function Timer() { - this.time = 0; - this.asString = ''; - } - Timer.prototype.start = function () { - this.time = 0; - this.startTime = this.now(); - this.asString = ''; - }; - - Timer.prototype.now = function () { - return Date.now(); - }; - - Timer.prototype.end = function () { - this.time = (this.now() - this.startTime) / 1000; - this.asString = Timer.prettyDate(this.startTime, this.now()); - }; - - Timer.prettyDate = function (date1, date2) { - var diff = ((date2 - date1) / 1000); - var day_diff = Math.floor(diff / 86400); - - if (isNaN(day_diff) || day_diff < 0 || day_diff >= 31) { - return null; - } - - return (day_diff == 0 && (diff < 60 && (diff + ' seconds') || diff < 120 && '1 minute' || diff < 3600 && Math.floor(diff / 60) + ' minutes' || diff < 7200 && '1 hour' || diff < 86400 && Math.floor(diff / 3600) + ' hours') || day_diff == 1 && 'Yesterday' || day_diff < 7 && day_diff + ' days' || day_diff < 31 && Math.ceil(day_diff / 7) + ' weeks'); - }; - return Timer; - })(); - DT.Timer = Timer; -})(DT || (DT = {})); -/// -var DT; -(function (DT) { - 'use strict'; - - var fs = require('fs'); - var Lazy = require('lazy.js'); - var Promise = require('bluebird'); - - var referenceTagExp = //g; - - function endsWith(str, suffix) { - return str.indexOf(suffix, str.length - suffix.length) !== -1; - } - DT.endsWith = endsWith; - - function extractReferenceTags(source) { - var ret = []; - var match; - - if (!referenceTagExp.global) { - throw new Error('referenceTagExp RegExp must have global flag'); - } - referenceTagExp.lastIndex = 0; - - while ((match = referenceTagExp.exec(source))) { - if (match.length > 0 && match[1].length > 0) { - ret.push(match[1]); - } - } - return ret; - } - DT.extractReferenceTags = extractReferenceTags; - - function fileExists(target) { - return new Promise(function (resolve, reject) { - fs.exists(target, function (bool) { - resolve(bool); - }); - }); - } - DT.fileExists = fileExists; -})(DT || (DT = {})); -/// -/// -/// -var DT; -(function (DT) { - 'use strict'; - - var fs = require('fs'); - var path = require('path'); - var glob = require('glob'); - var Lazy = require('lazy.js'); - var Promise = require('bluebird'); - - var readFile = Promise.promisify(fs.readFile); - - ///////////////////////////////// - // Track all files in the repo: map full path to File objects - ///////////////////////////////// - var FileIndex = (function () { - function FileIndex(runner, options) { - this.runner = runner; - this.options = options; - } - FileIndex.prototype.hasFile = function (target) { - return target in this.fileMap; - }; - - FileIndex.prototype.getFile = function (target) { - if (target in this.fileMap) { - return this.fileMap[target]; - } - return null; - }; - - FileIndex.prototype.setFile = function (file) { - if (file.fullPath in this.fileMap) { - throw new Error('cannot overwrite file'); - } - this.fileMap[file.fullPath] = file; - }; - - FileIndex.prototype.readIndex = function () { - var _this = this; - this.fileMap = Object.create(null); - - return Promise.promisify(glob).call(glob, '**/*.ts', { - cwd: this.runner.dtPath - }).then(function (filesNames) { - _this.files = Lazy(filesNames).filter(function (fileName) { - return _this.runner.checkAcceptFile(fileName); - }).map(function (fileName) { - var file = new DT.File(_this.runner.dtPath, fileName); - _this.fileMap[file.fullPath] = file; - return file; - }).toArray(); - }); - }; - - FileIndex.prototype.collectDiff = function (changes) { - var _this = this; - return new Promise(function (resolve) { - // filter changes and bake map for easy lookup - _this.changed = Object.create(null); - _this.removed = Object.create(null); - - Lazy(changes).filter(function (full) { - return _this.runner.checkAcceptFile(full); - }).uniq().each(function (local) { - var full = path.resolve(_this.runner.dtPath, local); - var file = _this.getFile(full); - if (!file) { - // TODO figure out what to do here - // what does it mean? deleted?ss - file = new DT.File(_this.runner.dtPath, local); - _this.setFile(file); - _this.removed[full] = file; - // console.log('not in index? %', file.fullPath); - } else { - _this.changed[full] = file; - } - }); - - // console.log('changed:\n' + Object.keys(this.changed).join('\n')); - // console.log('removed:\n' + Object.keys(this.removed).join('\n')); - resolve(); - }); - }; - - FileIndex.prototype.parseFiles = function () { - var _this = this; - return this.loadReferences(this.files).then(function () { - return _this.getMissingReferences(); - }); - }; - - FileIndex.prototype.getMissingReferences = function () { - var _this = this; - return Promise.attempt(function () { - _this.missing = Object.create(null); - Lazy(_this.removed).keys().each(function (removed) { - if (removed in _this.refMap) { - _this.missing[removed] = _this.refMap[removed]; - } - }); - }); - }; - - FileIndex.prototype.loadReferences = function (files) { - var _this = this; - return new Promise(function (resolve, reject) { - var queue = files.slice(0); - var active = []; - var max = 50; - var next = function () { - if (queue.length === 0 && active.length === 0) { - resolve(); - return; - } - - while (queue.length > 0 && active.length < max) { - var file = queue.pop(); - active.push(file); - _this.parseFile(file).then(function (file) { - active.splice(active.indexOf(file), 1); - next(); - }).catch(function (err) { - queue = []; - active = []; - reject(err); - }); - } - }; - next(); - }).then(function () { - // bake reverse reference map (referenced to referrers) - _this.refMap = Object.create(null); - - Lazy(files).each(function (file) { - Lazy(file.references).each(function (ref) { - if (ref.fullPath in _this.refMap) { - _this.refMap[ref.fullPath].push(file); - } else { - _this.refMap[ref.fullPath] = [file]; - } - }); - }); - }); - }; - - // TODO replace with a stream? - FileIndex.prototype.parseFile = function (file) { - var _this = this; - return readFile(file.filePathWithName, { - encoding: 'utf8', - flag: 'r' - }).then(function (content) { - file.references = Lazy(DT.extractReferenceTags(content)).map(function (ref) { - return path.resolve(path.dirname(file.fullPath), ref); - }).reduce(function (memo, ref) { - if (ref in _this.fileMap) { - memo.push(_this.fileMap[ref]); - } else { - console.log('not mapped? -> ' + ref); - } - return memo; - }, []); - - // return the object - return file; - }); - }; - - FileIndex.prototype.collectTargets = function () { - var _this = this; - return new Promise(function (resolve) { - // map out files linked to changes - // - queue holds files touched by a change - // - pre-fill with actually changed files - // - loop queue, if current not seen: - // - add to result - // - from refMap queue all files referring to current - var result = Object.create(null); - var queue = Lazy(_this.changed).values().toArray(); - - while (queue.length > 0) { - var next = queue.shift(); - var fp = next.fullPath; - if (result[fp]) { - continue; - } - result[fp] = next; - if (fp in _this.refMap) { - var arr = _this.refMap[fp]; - for (var i = 0, ii = arr.length; i < ii; i++) { - // just add it and skip expensive checks - queue.push(arr[i]); - } - } - } - resolve(Lazy(result).values().toArray()); - }); - }; - return FileIndex; - })(); - DT.FileIndex = FileIndex; -})(DT || (DT = {})); -/// -/// -var DT; -(function (DT) { - 'use strict'; - - var fs = require('fs'); - var path = require('path'); - var Git = require('git-wrapper'); - var Promise = require('bluebird'); - - var GitChanges = (function () { - function GitChanges(runner) { - this.runner = runner; - this.options = {}; - var dir = path.join(this.runner.dtPath, '.git'); - if (!fs.existsSync(dir)) { - throw new Error('cannot locate git-dir: ' + dir); - } - this.options['git-dir'] = dir; - - this.git = new Git(this.options); - this.git.exec = Promise.promisify(this.git.exec); - } - GitChanges.prototype.readChanges = function () { - var opts = {}; - var args = ['--name-only HEAD~1']; - return this.git.exec('diff', opts, args).then(function (msg) { - return msg.replace(/^\s+/, '').replace(/\s+$/, '').split(/\r?\n/g); - }); - }; - return GitChanges; - })(); - DT.GitChanges = GitChanges; -})(DT || (DT = {})); -/// -/// -var DT; -(function (DT) { - var os = require('os'); - - ///////////////////////////////// - // All the common things that we print are functions of this class - ///////////////////////////////// - var Print = (function () { - function Print(version) { - this.version = version; - this.WIDTH = 77; - } - Print.prototype.init = function (typings, tests, tsFiles) { - this.typings = typings; - this.tests = tests; - this.tsFiles = tsFiles; - }; - - Print.prototype.out = function (s) { - process.stdout.write(s); - return this; - }; - - Print.prototype.repeat = function (s, times) { - return new Array(times + 1).join(s); - }; - - Print.prototype.printChangeHeader = function () { - this.out('=============================================================================\n'); - this.out(' \33[36m\33[1mDefinitelyTyped Diff Detector 0.1.0\33[0m \n'); - this.out('=============================================================================\n'); - }; - - Print.prototype.printHeader = function (options) { - var totalMem = Math.round(os.totalmem() / 1024 / 1024) + ' mb'; - var freemem = Math.round(os.freemem() / 1024 / 1024) + ' mb'; - - this.out('=============================================================================\n'); - this.out(' \33[36m\33[1mDefinitelyTyped Test Runner 0.5.0\33[0m\n'); - this.out('=============================================================================\n'); - this.out(' \33[36m\33[1mTypescript version:\33[0m ' + this.version + '\n'); - this.out(' \33[36m\33[1mTypings :\33[0m ' + this.typings + '\n'); - this.out(' \33[36m\33[1mTests :\33[0m ' + this.tests + '\n'); - this.out(' \33[36m\33[1mTypeScript files :\33[0m ' + this.tsFiles + '\n'); - this.out(' \33[36m\33[1mTotal Memory :\33[0m ' + totalMem + '\n'); - this.out(' \33[36m\33[1mFree Memory :\33[0m ' + freemem + '\n'); - this.out(' \33[36m\33[1mCores :\33[0m ' + os.cpus().length + '\n'); - this.out(' \33[36m\33[1mConcurrent :\33[0m ' + options.concurrent + '\n'); - }; - - Print.prototype.printSuiteHeader = function (title) { - var left = Math.floor((this.WIDTH - title.length) / 2) - 1; - var right = Math.ceil((this.WIDTH - title.length) / 2) - 1; - this.out(this.repeat('=', left)).out(' \33[34m\33[1m'); - this.out(title); - this.out('\33[0m ').out(this.repeat('=', right)).printBreak(); - }; - - Print.prototype.printDiv = function () { - this.out('-----------------------------------------------------------------------------\n'); - }; - - Print.prototype.printBoldDiv = function () { - this.out('=============================================================================\n'); - }; - - Print.prototype.printErrorsHeader = function () { - this.out('=============================================================================\n'); - this.out(' \33[34m\33[1mErrors in files\33[0m \n'); - this.out('=============================================================================\n'); - }; - - Print.prototype.printErrorsForFile = function (testResult) { - this.out('----------------- For file:' + testResult.targetFile.filePathWithName); - this.printBreak().out(testResult.stderr).printBreak(); - }; - - Print.prototype.printBreak = function () { - this.out('\n'); - return this; - }; - - Print.prototype.clearCurrentLine = function () { - this.out('\r\33[K'); - return this; - }; - - Print.prototype.printSuccessCount = function (current, total) { - var arb = (total === 0) ? 0 : (current / total); - this.out(' \33[36m\33[1mSuccessful :\33[0m \33[32m\33[1m' + (arb * 100).toFixed(2) + '% (' + current + '/' + total + ')\33[0m\n'); - }; - - Print.prototype.printFailedCount = function (current, total) { - var arb = (total === 0) ? 0 : (current / total); - this.out(' \33[36m\33[1mFailure :\33[0m \33[31m\33[1m' + (arb * 100).toFixed(2) + '% (' + current + '/' + total + ')\33[0m\n'); - }; - - Print.prototype.printTypingsWithoutTestsMessage = function () { - this.out(' \33[36m\33[1mTyping without tests\33[0m\n'); - }; - - Print.prototype.printTotalMessage = function () { - this.out(' \33[36m\33[1mTotal\33[0m\n'); - }; - - Print.prototype.printElapsedTime = function (time, s) { - this.out(' \33[36m\33[1mElapsed time :\33[0m ~' + time + ' (' + s + 's)\n'); - }; - - Print.prototype.printSuiteErrorCount = function (errorHeadline, current, total, warn) { - if (typeof warn === "undefined") { warn = false; } - var arb = (total === 0) ? 0 : (current / total); - this.out(' \33[36m\33[1m').out(errorHeadline).out(this.repeat(' ', 16 - errorHeadline.length)); - if (warn) { - this.out(': \33[31m\33[1m' + (arb * 100).toFixed(2) + '% (' + current + '/' + total + ')\33[0m\n'); - } else { - this.out(': \33[33m\33[1m' + (arb * 100).toFixed(2) + '% (' + current + '/' + total + ')\33[0m\n'); - } - }; - - Print.prototype.printSubHeader = function (file) { - this.out(' \33[36m\33[1m' + file + '\33[0m\n'); - }; - - Print.prototype.printWarnCode = function (str) { - this.out(' \33[31m\33[1m<' + str.toLowerCase().replace(/ +/g, '-') + '>\33[0m\n'); - }; - - Print.prototype.printLine = function (file) { - this.out(file + '\n'); - }; - - Print.prototype.printElement = function (file) { - this.out(' - ' + file + '\n'); - }; - - Print.prototype.printElement2 = function (file) { - this.out(' - ' + file + '\n'); - }; - - Print.prototype.printTypingsWithoutTestName = function (file) { - this.out(' - \33[33m\33[1m' + file + '\33[0m\n'); - }; - - Print.prototype.printTypingsWithoutTest = function (withoutTestTypings) { - var _this = this; - if (withoutTestTypings.length > 0) { - this.printTypingsWithoutTestsMessage(); - - this.printDiv(); - withoutTestTypings.forEach(function (t) { - _this.printTypingsWithoutTestName(t); - }); - } - }; - - Print.prototype.printTestComplete = function (testResult) { - var reporter = testResult.hostedBy.testReporter; - if (testResult.success) { - reporter.printPositiveCharacter(testResult); - } else { - reporter.printNegativeCharacter(testResult); - } - }; - - Print.prototype.printSuiteComplete = function (suite) { - this.printBreak(); - - this.printDiv(); - this.printElapsedTime(suite.timer.asString, suite.timer.time); - this.printSuccessCount(suite.okTests.length, suite.testResults.length); - this.printFailedCount(suite.ngTests.length, suite.testResults.length); - }; - - Print.prototype.printTests = function (adding) { - var _this = this; - this.printDiv(); - this.printSubHeader('Testing'); - this.printDiv(); - - Object.keys(adding).sort().map(function (src) { - _this.printLine(adding[src].filePathWithName); - return adding[src]; - }); - }; - - Print.prototype.printQueue = function (files) { - var _this = this; - this.printDiv(); - this.printSubHeader('Queued for testing'); - this.printDiv(); - - files.forEach(function (file) { - _this.printLine(file.filePathWithName); - }); - }; - - Print.prototype.printTestAll = function () { - this.printDiv(); - this.printSubHeader('Ignoring changes, testing all files'); - }; - - Print.prototype.printFiles = function (files) { - var _this = this; - this.printDiv(); - this.printSubHeader('Files'); - this.printDiv(); - - files.forEach(function (file) { - _this.printLine(file.filePathWithName); - file.references.forEach(function (file) { - _this.printElement(file.filePathWithName); - }); - }); - }; - - Print.prototype.printMissing = function (index, refMap) { - var _this = this; - this.printDiv(); - this.printSubHeader('Missing references'); - this.printDiv(); - - Object.keys(refMap).sort().forEach(function (src) { - var ref = index.getFile(src); - _this.printLine('\33[31m\33[1m' + ref.filePathWithName + '\33[0m'); - refMap[src].forEach(function (file) { - _this.printElement(file.filePathWithName); - }); - }); - }; - - Print.prototype.printAllChanges = function (paths) { - var _this = this; - this.printSubHeader('All changes'); - this.printDiv(); - - paths.sort().forEach(function (line) { - _this.printLine(line); - }); - }; - - Print.prototype.printRelChanges = function (changeMap) { - var _this = this; - this.printDiv(); - this.printSubHeader('Interesting files'); - this.printDiv(); - - Object.keys(changeMap).sort().forEach(function (src) { - _this.printLine(changeMap[src].filePathWithName); - }); - }; - - Print.prototype.printRemovals = function (changeMap) { - var _this = this; - this.printDiv(); - this.printSubHeader('Removed files'); - this.printDiv(); - - Object.keys(changeMap).sort().forEach(function (src) { - _this.printLine(changeMap[src].filePathWithName); - }); - }; - - Print.prototype.printRefMap = function (index, refMap) { - var _this = this; - this.printDiv(); - this.printSubHeader('Referring'); - this.printDiv(); - - Object.keys(refMap).sort().forEach(function (src) { - var ref = index.getFile(src); - _this.printLine(ref.filePathWithName); - refMap[src].forEach(function (file) { - _this.printLine(' - ' + file.filePathWithName); - }); - }); - }; - return Print; - })(); - DT.Print = Print; -})(DT || (DT = {})); -/// -/// -var DT; -(function (DT) { - - - ///////////////////////////////// - // Default test reporter - ///////////////////////////////// - var DefaultTestReporter = (function () { - function DefaultTestReporter(print) { - this.print = print; - this.index = 0; - } - DefaultTestReporter.prototype.printPositiveCharacter = function (testResult) { - this.print.out('\33[36m\33[1m' + '.' + '\33[0m'); - this.index++; - this.printBreakIfNeeded(this.index); - }; - - DefaultTestReporter.prototype.printNegativeCharacter = function (testResult) { - this.print.out('x'); - this.index++; - this.printBreakIfNeeded(this.index); - }; - - DefaultTestReporter.prototype.printBreakIfNeeded = function (index) { - if (index % this.print.WIDTH === 0) { - this.print.printBreak(); - } - }; - return DefaultTestReporter; - })(); - DT.DefaultTestReporter = DefaultTestReporter; -})(DT || (DT = {})); -/// -var DT; -(function (DT) { - 'use strict'; - - var Promise = require('bluebird'); - - - - ///////////////////////////////// - // Base class for test suite - ///////////////////////////////// - var TestSuiteBase = (function () { - function TestSuiteBase(options, testSuiteName, errorHeadline) { - this.options = options; - this.testSuiteName = testSuiteName; - this.errorHeadline = errorHeadline; - this.timer = new DT.Timer(); - this.testResults = []; - this.printErrorCount = true; - this.queue = new DT.TestQueue(options.concurrent); - } - TestSuiteBase.prototype.filterTargetFiles = function (files) { - throw new Error('please implement this method'); - }; - - TestSuiteBase.prototype.start = function (targetFiles, testCallback) { - var _this = this; - this.timer.start(); - - return this.filterTargetFiles(targetFiles).then(function (targetFiles) { - // tests get queued for multi-threading - return Promise.all(targetFiles.map(function (targetFile) { - return _this.runTest(targetFile).then(function (result) { - testCallback(result); - }); - })); - }).then(function () { - _this.timer.end(); - return _this; - }); - }; - - TestSuiteBase.prototype.runTest = function (targetFile) { - var _this = this; - return this.queue.run(new DT.Test(this, targetFile, { - tscVersion: this.options.tscVersion - })).then(function (result) { - _this.testResults.push(result); - return result; - }); - }; - - Object.defineProperty(TestSuiteBase.prototype, "okTests", { - get: function () { - return this.testResults.filter(function (r) { - return r.success; - }); - }, - enumerable: true, - configurable: true - }); - - Object.defineProperty(TestSuiteBase.prototype, "ngTests", { - get: function () { - return this.testResults.filter(function (r) { - return !r.success; - }); - }, - enumerable: true, - configurable: true - }); - return TestSuiteBase; - })(); - DT.TestSuiteBase = TestSuiteBase; -})(DT || (DT = {})); -/// -/// -var __extends = this.__extends || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - __.prototype = b.prototype; - d.prototype = new __(); -}; -var DT; -(function (DT) { - 'use strict'; - - var Promise = require('bluebird'); - - var endDts = /\w\.d\.ts$/i; - - ///////////////////////////////// - // .d.ts syntax inspection - ///////////////////////////////// - var SyntaxChecking = (function (_super) { - __extends(SyntaxChecking, _super); - function SyntaxChecking(options) { - _super.call(this, options, 'Syntax checking', 'Syntax error'); - } - SyntaxChecking.prototype.filterTargetFiles = function (files) { - return Promise.cast(files.filter(function (file) { - return endDts.test(file.filePathWithName); - })); - }; - return SyntaxChecking; - })(DT.TestSuiteBase); - DT.SyntaxChecking = SyntaxChecking; -})(DT || (DT = {})); -/// -/// -var DT; -(function (DT) { - 'use strict'; - - var Promise = require('bluebird'); - - var endTestDts = /\w-tests?\.ts$/i; - - ///////////////////////////////// - // Compile with *-tests.ts - ///////////////////////////////// - var TestEval = (function (_super) { - __extends(TestEval, _super); - function TestEval(options) { - _super.call(this, options, 'Typing tests', 'Failed tests'); - } - TestEval.prototype.filterTargetFiles = function (files) { - return Promise.cast(files.filter(function (file) { - return endTestDts.test(file.filePathWithName); - })); - }; - return TestEval; - })(DT.TestSuiteBase); - DT.TestEval = TestEval; -})(DT || (DT = {})); -/// -/// -var DT; -(function (DT) { - 'use strict'; - - var fs = require('fs'); - var Promise = require('bluebird'); - - ///////////////////////////////// - // Try compile without .tscparams - // It may indicate that it is compatible with --noImplicitAny maybe... - ///////////////////////////////// - var FindNotRequiredTscparams = (function (_super) { - __extends(FindNotRequiredTscparams, _super); - function FindNotRequiredTscparams(options, print) { - var _this = this; - _super.call(this, options, 'Find not required .tscparams files', 'New arrival!'); - this.print = print; - this.printErrorCount = false; - - this.testReporter = { - printPositiveCharacter: function (testResult) { - _this.print.clearCurrentLine().printTypingsWithoutTestName(testResult.targetFile.filePathWithName); - }, - printNegativeCharacter: function (testResult) { - } - }; - } - FindNotRequiredTscparams.prototype.filterTargetFiles = function (files) { - return Promise.filter(files, function (file) { - return new Promise(function (resolve) { - fs.exists(file.filePathWithName + '.tscparams', resolve); - }); - }); - }; - - FindNotRequiredTscparams.prototype.runTest = function (targetFile) { - var _this = this; - this.print.clearCurrentLine().out(targetFile.filePathWithName); - - return this.queue.run(new DT.Test(this, targetFile, { - tscVersion: this.options.tscVersion, - useTscParams: false, - checkNoImplicitAny: true - })).then(function (result) { - _this.testResults.push(result); - _this.print.clearCurrentLine(); - return result; - }); - }; - - Object.defineProperty(FindNotRequiredTscparams.prototype, "ngTests", { - get: function () { - // Do not show ng test results - return []; - }, - enumerable: true, - configurable: true - }); - return FindNotRequiredTscparams; - })(DT.TestSuiteBase); - DT.FindNotRequiredTscparams = FindNotRequiredTscparams; -})(DT || (DT = {})); -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -var DT; -(function (DT) { - require('source-map-support').install(); - - // hacky typing - var Lazy = require('lazy.js'); - var Promise = require('bluebird'); - - var os = require('os'); - var fs = require('fs'); - var path = require('path'); - var assert = require('assert'); - - var tsExp = /\.ts$/; - - DT.DEFAULT_TSC_VERSION = '0.9.7'; - - ///////////////////////////////// - // Single test - ///////////////////////////////// - var Test = (function () { - function Test(suite, tsfile, options) { - this.suite = suite; - this.tsfile = tsfile; - this.options = options; - } - Test.prototype.run = function () { - var _this = this; - return DT.Tsc.run(this.tsfile.filePathWithName, this.options).then(function (execResult) { - var testResult = new TestResult(); - testResult.hostedBy = _this.suite; - testResult.targetFile = _this.tsfile; - testResult.options = _this.options; - - testResult.stdout = execResult.stdout; - testResult.stderr = execResult.stderr; - testResult.exitCode = execResult.exitCode; - - return testResult; - }); - }; - return Test; - })(); - DT.Test = Test; - - ///////////////////////////////// - // Parallel execute Tests - ///////////////////////////////// - var TestQueue = (function () { - function TestQueue(concurrent) { - this.queue = []; - this.active = []; - this.concurrent = Math.max(1, concurrent); - } - // add to queue and return a promise - TestQueue.prototype.run = function (test) { - var _this = this; - var defer = Promise.defer(); - - // add a closure to queue - this.queue.push(function () { - // run it - var p = test.run(); - p.then(defer.resolve.bind(defer), defer.reject.bind(defer)); - p.finally(function () { - var i = _this.active.indexOf(test); - if (i > -1) { - _this.active.splice(i, 1); - } - _this.step(); - }); - - // return it - return test; - }); - this.step(); - - // defer it - return defer.promise; - }; - - TestQueue.prototype.step = function () { - while (this.queue.length > 0 && this.active.length < this.concurrent) { - this.active.push(this.queue.pop().call(null)); - } - }; - return TestQueue; - })(); - DT.TestQueue = TestQueue; - - ///////////////////////////////// - // Test results - ///////////////////////////////// - var TestResult = (function () { - function TestResult() { - } - Object.defineProperty(TestResult.prototype, "success", { - get: function () { - return this.exitCode === 0; - }, - enumerable: true, - configurable: true - }); - return TestResult; - })(); - DT.TestResult = TestResult; - - ///////////////////////////////// - // The main class to kick things off - ///////////////////////////////// - var TestRunner = (function () { - function TestRunner(dtPath, options) { - if (typeof options === "undefined") { options = { tscVersion: DT.DEFAULT_TSC_VERSION }; } - this.dtPath = dtPath; - this.options = options; - this.suites = []; - this.options.findNotRequiredTscparams = !!this.options.findNotRequiredTscparams; - - this.index = new DT.FileIndex(this, this.options); - this.changes = new DT.GitChanges(this); - - this.print = new DT.Print(this.options.tscVersion); - } - TestRunner.prototype.addSuite = function (suite) { - this.suites.push(suite); - }; - - TestRunner.prototype.checkAcceptFile = function (fileName) { - var ok = tsExp.test(fileName); - ok = ok && fileName.indexOf('_infrastructure') < 0; - ok = ok && fileName.indexOf('node_modules/') < 0; - ok = ok && /^[a-z]/i.test(fileName); - return ok; - }; - - TestRunner.prototype.run = function () { - var _this = this; - this.timer = new DT.Timer(); - this.timer.start(); - - this.print.printChangeHeader(); - - // only includes .d.ts or -tests.ts or -test.ts or .ts - return this.index.readIndex().then(function () { - return _this.changes.readChanges(); - }).then(function (changes) { - _this.print.printAllChanges(changes); - return _this.index.collectDiff(changes); - }).then(function () { - _this.print.printRemovals(_this.index.removed); - _this.print.printRelChanges(_this.index.changed); - return _this.index.parseFiles(); - }).then(function () { - if (_this.options.printRefMap) { - _this.print.printRefMap(_this.index, _this.index.refMap); - } - if (Lazy(_this.index.missing).some(function (arr) { - return arr.length > 0; - })) { - _this.print.printMissing(_this.index, _this.index.missing); - _this.print.printBoldDiv(); - - // bail - return Promise.cast(false); - } - if (_this.options.printFiles) { - _this.print.printFiles(_this.index.files); - } - return _this.index.collectTargets().then(function (files) { - if (_this.options.testChanges) { - _this.print.printQueue(files); - return _this.runTests(files); - } else { - _this.print.printTestAll(); - return _this.runTests(_this.index.files); - } - }).then(function () { - return !_this.suites.some(function (suite) { - return suite.ngTests.length !== 0; - }); - }); - }); - }; - - TestRunner.prototype.runTests = function (files) { - var _this = this; - return Promise.attempt(function () { - assert(Array.isArray(files), 'files must be array'); - - var syntaxChecking = new DT.SyntaxChecking(_this.options); - var testEval = new DT.TestEval(_this.options); - - if (!_this.options.findNotRequiredTscparams) { - _this.addSuite(syntaxChecking); - _this.addSuite(testEval); - } - - return Promise.all([ - syntaxChecking.filterTargetFiles(files), - testEval.filterTargetFiles(files) - ]); - }).spread(function (syntaxFiles, testFiles) { - _this.print.init(syntaxFiles.length, testFiles.length, files.length); - _this.print.printHeader(_this.options); - - if (_this.options.findNotRequiredTscparams) { - _this.addSuite(new DT.FindNotRequiredTscparams(_this.options, _this.print)); - } - - return Promise.reduce(_this.suites, function (count, suite) { - suite.testReporter = suite.testReporter || new DT.DefaultTestReporter(_this.print); - - _this.print.printSuiteHeader(suite.testSuiteName); - - if (_this.options.skipTests) { - _this.print.printWarnCode('skipped test'); - return Promise.cast(count++); - } - - return suite.start(files, function (testResult) { - _this.print.printTestComplete(testResult); - }).then(function (suite) { - _this.print.printSuiteComplete(suite); - return count++; - }); - }, 0); - }).then(function (count) { - _this.timer.end(); - _this.finaliseTests(files); - }); - }; - - TestRunner.prototype.finaliseTests = function (files) { - var _this = this; - var testEval = Lazy(this.suites).filter(function (suite) { - return suite instanceof DT.TestEval; - }).first(); - - if (testEval) { - var existsTestTypings = Lazy(testEval.testResults).map(function (testResult) { - return testResult.targetFile.dir; - }).reduce(function (a, b) { - return a.indexOf(b) < 0 ? a.concat([b]) : a; - }, []); - - var typings = Lazy(files).map(function (file) { - return file.dir; - }).reduce(function (a, b) { - return a.indexOf(b) < 0 ? a.concat([b]) : a; - }, []); - - var withoutTestTypings = typings.filter(function (typing) { - return existsTestTypings.indexOf(typing) < 0; - }); - - this.print.printDiv(); - this.print.printTypingsWithoutTest(withoutTestTypings); - } - - this.print.printDiv(); - this.print.printTotalMessage(); - - this.print.printDiv(); - this.print.printElapsedTime(this.timer.asString, this.timer.time); - - this.suites.filter(function (suite) { - return suite.printErrorCount; - }).forEach(function (suite) { - _this.print.printSuiteErrorCount(suite.errorHeadline, suite.ngTests.length, suite.testResults.length); - }); - if (testEval) { - this.print.printSuiteErrorCount('Without tests', withoutTestTypings.length, typings.length, true); - } - - this.print.printDiv(); - - if (this.suites.some(function (suite) { - return suite.ngTests.length !== 0; - })) { - this.print.printErrorsHeader(); - - this.suites.filter(function (suite) { - return suite.ngTests.length !== 0; - }).forEach(function (suite) { - suite.ngTests.forEach(function (testResult) { - _this.print.printErrorsForFile(testResult); - }); - _this.print.printBoldDiv(); - }); - } - }; - return TestRunner; - })(); - DT.TestRunner = TestRunner; - - var optimist = require('optimist')(process.argv); - optimist.default('try-without-tscparams', false); - optimist.default('single-thread', false); - optimist.default('tsc-version', DT.DEFAULT_TSC_VERSION); - - optimist.default('test-changes', false); - optimist.default('skip-tests', false); - optimist.default('print-files', false); - optimist.default('print-refmap', false); - - optimist.boolean('help'); - optimist.describe('help', 'print help'); - optimist.alias('h', 'help'); - - var argv = optimist.argv; - - var dtPath = path.resolve(path.dirname((module).filename), '..', '..'); - var cpuCores = os.cpus().length; - - if (argv.help) { - optimist.showHelp(); - var pkg = require('../../package.json'); - console.log('Scripts:'); - console.log(''); - Lazy(pkg.scripts).keys().each(function (key) { - console.log(' $ npm run ' + key); - }); - process.exit(0); - } - - var testFull = process.env['TRAVIS_BRANCH'] ? /\w\/full$/.test(process.env['TRAVIS_BRANCH']) : false; - - new TestRunner(dtPath, { - concurrent: argv['single-thread'] ? 1 : Math.max(Math.min(24, cpuCores), 2), - tscVersion: argv['tsc-version'], - testChanges: testFull ? false : argv['test-changes'], - skipTests: argv['skip-tests'], - printFiles: argv['print-files'], - printRefMap: argv['print-refmap'], - findNotRequiredTscparams: argv['try-without-tscparam'] - }).run().then(function (success) { - if (!success) { - process.exit(1); - } - }).catch(function (err) { - throw err; - process.exit(2); - }); -})(DT || (DT = {})); -//# sourceMappingURL=runner.js.map diff --git a/_infrastructure/tests/runner.ts b/_infrastructure/tests/runner.ts deleted file mode 100644 index 1f75aca7a..000000000 --- a/_infrastructure/tests/runner.ts +++ /dev/null @@ -1,367 +0,0 @@ -/// - -/// - -/// -/// -/// -/// - -/// -/// - -/// -/// - -/// -/// -/// -/// - -module DT { - require('source-map-support').install(); - - // hacky typing - var Lazy: LazyJS.LazyStatic = require('lazy.js'); - var Promise: typeof Promise = require('bluebird'); - - var os = require('os'); - var fs = require('fs'); - var path = require('path'); - var assert = require('assert'); - - var tsExp = /\.ts$/; - - export var DEFAULT_TSC_VERSION = '0.9.7'; - - interface PackageJSON { - scripts: {[key:string]: string}; - } - - ///////////////////////////////// - // Single test - ///////////////////////////////// - export class Test { - constructor(public suite: ITestSuite, public tsfile: File, public options?: TscExecOptions) { - } - - public run(): Promise { - return Tsc.run(this.tsfile.filePathWithName, this.options).then((execResult: ExecResult) => { - var testResult = new TestResult(); - testResult.hostedBy = this.suite; - testResult.targetFile = this.tsfile; - testResult.options = this.options; - - testResult.stdout = execResult.stdout; - testResult.stderr = execResult.stderr; - testResult.exitCode = execResult.exitCode; - - return testResult; - }); - } - } - - ///////////////////////////////// - // Parallel execute Tests - ///////////////////////////////// - export class TestQueue { - - private queue: Function[] = []; - private active: Test[] = []; - private concurrent: number; - - constructor(concurrent: number) { - this.concurrent = Math.max(1, concurrent); - } - - // add to queue and return a promise - run(test: Test): Promise { - var defer = Promise.defer(); - // add a closure to queue - this.queue.push(() => { - // run it - var p = test.run(); - p.then(defer.resolve.bind(defer), defer.reject.bind(defer)); - p.finally(() => { - var i = this.active.indexOf(test); - if (i > -1) { - this.active.splice(i, 1); - } - this.step(); - }); - // return it - return test; - }); - this.step(); - // defer it - return defer.promise; - } - - private step(): void { - while (this.queue.length > 0 && this.active.length < this.concurrent) { - this.active.push(this.queue.pop().call(null)); - } - } - } - - ///////////////////////////////// - // Test results - ///////////////////////////////// - export class TestResult { - hostedBy: ITestSuite; - targetFile: File; - options: TscExecOptions; - - stdout: string; - stderr: string; - exitCode: number; - - public get success(): boolean { - return this.exitCode === 0; - } - } - - export interface ITestRunnerOptions { - tscVersion:string; - concurrent?:number; - testChanges?:boolean; - skipTests?:boolean; - printFiles?:boolean; - printRefMap?:boolean; - findNotRequiredTscparams?:boolean; - } - - ///////////////////////////////// - // The main class to kick things off - ///////////////////////////////// - export class TestRunner { - private timer: Timer; - private suites: ITestSuite[] = []; - - public changes: GitChanges; - public index: FileIndex; - public print: Print; - - constructor(public dtPath: string, public options: ITestRunnerOptions = {tscVersion: DT.DEFAULT_TSC_VERSION}) { - this.options.findNotRequiredTscparams = !!this.options.findNotRequiredTscparams; - - this.index = new FileIndex(this, this.options); - this.changes = new GitChanges(this); - - this.print = new Print(this.options.tscVersion); - } - - public addSuite(suite: ITestSuite): void { - this.suites.push(suite); - } - - public checkAcceptFile(fileName: string): boolean { - var ok = tsExp.test(fileName); - ok = ok && fileName.indexOf('_infrastructure') < 0; - ok = ok && fileName.indexOf('node_modules/') < 0; - ok = ok && /^[a-z]/i.test(fileName); - return ok; - } - - public run(): Promise { - this.timer = new Timer(); - this.timer.start(); - - this.print.printChangeHeader(); - - // only includes .d.ts or -tests.ts or -test.ts or .ts - return this.index.readIndex().then(() => { - return this.changes.readChanges(); - }).then((changes: string[]) => { - this.print.printAllChanges(changes); - return this.index.collectDiff(changes); - }).then(() => { - this.print.printRemovals(this.index.removed); - this.print.printRelChanges(this.index.changed); - return this.index.parseFiles(); - }).then(() => { - if (this.options.printRefMap) { - this.print.printRefMap(this.index, this.index.refMap); - } - if (Lazy(this.index.missing).some((arr: any[]) => arr.length > 0)) { - this.print.printMissing(this.index, this.index.missing); - this.print.printBoldDiv(); - // bail - return Promise.cast(false); - } - if (this.options.printFiles) { - this.print.printFiles(this.index.files); - } - return this.index.collectTargets().then((files) => { - if (this.options.testChanges) { - this.print.printQueue(files); - return this.runTests(files); - } - else { - this.print.printTestAll(); - return this.runTests(this.index.files) - } - }).then(() => { - return !this.suites.some((suite) => { - return suite.ngTests.length !== 0 - }); - }); - }); - } - - private runTests(files: File[]): Promise { - return Promise.attempt(() => { - assert(Array.isArray(files), 'files must be array'); - - var syntaxChecking = new SyntaxChecking(this.options); - var testEval = new TestEval(this.options); - - if (!this.options.findNotRequiredTscparams) { - this.addSuite(syntaxChecking); - this.addSuite(testEval); - } - - return Promise.all([ - syntaxChecking.filterTargetFiles(files), - testEval.filterTargetFiles(files) - ]); - }).spread((syntaxFiles, testFiles) => { - this.print.init(syntaxFiles.length, testFiles.length, files.length); - this.print.printHeader(this.options); - - if (this.options.findNotRequiredTscparams) { - this.addSuite(new FindNotRequiredTscparams(this.options, this.print)); - } - - return Promise.reduce(this.suites, (count, suite: ITestSuite) => { - suite.testReporter = suite.testReporter || new DefaultTestReporter(this.print); - - this.print.printSuiteHeader(suite.testSuiteName); - - if (this.options.skipTests) { - this.print.printWarnCode('skipped test'); - return Promise.cast(count++); - } - - return suite.start(files, (testResult) => { - this.print.printTestComplete(testResult); - }).then((suite) => { - this.print.printSuiteComplete(suite); - return count++; - }); - }, 0); - }).then((count) => { - this.timer.end(); - this.finaliseTests(files); - }); - } - - private finaliseTests(files: File[]): void { - var testEval: TestEval = Lazy(this.suites).filter((suite) => { - return suite instanceof TestEval; - }).first(); - - if (testEval) { - var existsTestTypings: string[] = Lazy(testEval.testResults).map((testResult) => { - return testResult.targetFile.dir; - }).reduce((a: string[], b: string) => { - return a.indexOf(b) < 0 ? a.concat([b]) : a; - }, []); - - var typings: string[] = Lazy(files).map((file) => { - return file.dir; - }).reduce((a: string[], b: string) => { - return a.indexOf(b) < 0 ? a.concat([b]) : a; - }, []); - - var withoutTestTypings: string[] = typings.filter((typing) => { - return existsTestTypings.indexOf(typing) < 0; - }); - - this.print.printDiv(); - this.print.printTypingsWithoutTest(withoutTestTypings); - } - - this.print.printDiv(); - this.print.printTotalMessage(); - - this.print.printDiv(); - this.print.printElapsedTime(this.timer.asString, this.timer.time); - - this.suites.filter((suite: ITestSuite) => { - return suite.printErrorCount; - }).forEach((suite: ITestSuite) => { - this.print.printSuiteErrorCount(suite.errorHeadline, suite.ngTests.length, suite.testResults.length); - }); - if (testEval) { - this.print.printSuiteErrorCount('Without tests', withoutTestTypings.length, typings.length, true); - } - - this.print.printDiv(); - - if (this.suites.some((suite) => { - return suite.ngTests.length !== 0 - })) { - this.print.printErrorsHeader(); - - this.suites.filter((suite) => { - return suite.ngTests.length !== 0; - }).forEach((suite) => { - suite.ngTests.forEach((testResult) => { - this.print.printErrorsForFile(testResult); - }); - this.print.printBoldDiv(); - }); - } - } - } - - var optimist: Optimist = require('optimist')(process.argv); - optimist.default('try-without-tscparams', false); - optimist.default('single-thread', false); - optimist.default('tsc-version', DEFAULT_TSC_VERSION); - - optimist.default('test-changes', false); - optimist.default('skip-tests', false); - optimist.default('print-files', false); - optimist.default('print-refmap', false); - - optimist.boolean('help'); - optimist.describe('help', 'print help'); - optimist.alias('h', 'help'); - - var argv: any = optimist.argv; - - var dtPath = path.resolve(path.dirname((module).filename), '..', '..'); - var cpuCores = os.cpus().length; - - if (argv.help) { - optimist.showHelp(); - var pkg: PackageJSON = require('../../package.json'); - console.log('Scripts:'); - console.log(''); - Lazy(pkg.scripts).keys().each((key) => { - console.log(' $ npm run ' + key); - }); - process.exit(0); - } - - var testFull = process.env['TRAVIS_BRANCH'] ? /\w\/full$/.test(process.env['TRAVIS_BRANCH']) : false; - - new TestRunner(dtPath, { - concurrent: argv['single-thread'] ? 1 : Math.max(Math.min(24, cpuCores), 2), - tscVersion: argv['tsc-version'], - testChanges: testFull ? false : argv['test-changes'], // allow magic branch - skipTests: argv['skip-tests'], - printFiles: argv['print-files'], - printRefMap: argv['print-refmap'], - findNotRequiredTscparams: argv['try-without-tscparam'] - }).run().then((success) => { - if (!success) { - process.exit(1); - } - }).catch((err) => { - throw err; - process.exit(2); - }); -} diff --git a/_infrastructure/tests/src/changes.ts b/_infrastructure/tests/src/changes.ts deleted file mode 100644 index a56c4029e..000000000 --- a/_infrastructure/tests/src/changes.ts +++ /dev/null @@ -1,36 +0,0 @@ -/// -/// - -module DT { - 'use strict'; - - var fs = require('fs'); - var path = require('path'); - var Git = require('git-wrapper'); - var Promise: typeof Promise = require('bluebird'); - - export class GitChanges { - - git; - options = {}; - - constructor(private runner: TestRunner) { - var dir = path.join(this.runner.dtPath, '.git'); - if (!fs.existsSync(dir)) { - throw new Error('cannot locate git-dir: ' + dir); - } - this.options['git-dir'] = dir; - - this.git = new Git(this.options); - this.git.exec = Promise.promisify(this.git.exec); - } - - public readChanges(): Promise { - var opts = {}; - var args = ['--name-only HEAD~1']; - return this.git.exec('diff', opts, args).then((msg: string) => { - return msg.replace(/^\s+/, '').replace(/\s+$/, '').split(/\r?\n/g); - }); - } - } -} diff --git a/_infrastructure/tests/src/exec.ts b/_infrastructure/tests/src/exec.ts deleted file mode 100644 index 3c3f3c0e0..000000000 --- a/_infrastructure/tests/src/exec.ts +++ /dev/null @@ -1,30 +0,0 @@ -module DT { - 'use strict'; - - var Promise: typeof Promise = require('bluebird'); - var nodeExec = require('child_process').exec; - - export class ExecResult { - error; - stdout = ''; - stderr = ''; - exitCode: number; - } - - export function exec(filename: string, cmdLineArgs: string[]): Promise { - return new Promise((resolve) => { - var result = new ExecResult(); - result.exitCode = null; - - var cmdLine = filename + ' ' + cmdLineArgs.join(' '); - - nodeExec(cmdLine, {maxBuffer: 1 * 1024 * 1024}, (error, stdout, stderr) => { - result.error = error; - result.stdout = stdout; - result.stderr = stderr; - result.exitCode = error ? error.code : 0; - resolve(result); - }); - }); - } -} diff --git a/_infrastructure/tests/src/file.ts b/_infrastructure/tests/src/file.ts deleted file mode 100644 index 2c69f8f88..000000000 --- a/_infrastructure/tests/src/file.ts +++ /dev/null @@ -1,46 +0,0 @@ -/// - -module DT { - 'use strict'; - - var path = require('path'); - - export interface FileDict { - [fullPath:string]: File; - } - - export interface FileArrDict { - [fullPath:string]: File[]; - } - - ///////////////////////////////// - // Given a document root + ts file pattern this class returns: - // all the TS files OR just tests OR just definition files - ///////////////////////////////// - export class File { - baseDir: string; - filePathWithName: string; - dir: string; - file: string; - ext: string; - fullPath: string; - references: File[] = []; - - constructor(baseDir: string, filePathWithName: string) { - // why choose? - this.baseDir = baseDir; - this.filePathWithName = filePathWithName; - this.ext = path.extname(this.filePathWithName); - this.file = path.basename(this.filePathWithName, this.ext); - this.dir = path.dirname(this.filePathWithName); - this.fullPath = path.join(this.baseDir, this.dir, this.file + this.ext); - - // lock it (shallow) (needs `use strict` in each file to work) - // Object.freeze(this); - } - - toString(): string { - return '[File ' + this.filePathWithName + ']'; - } - } -} diff --git a/_infrastructure/tests/src/index.ts b/_infrastructure/tests/src/index.ts deleted file mode 100644 index 7f5878dcb..000000000 --- a/_infrastructure/tests/src/index.ts +++ /dev/null @@ -1,208 +0,0 @@ -/// -/// -/// - -module DT { - 'use strict'; - - var fs = require('fs'); - var path = require('path'); - var glob = require('glob'); - var Lazy: LazyJS.LazyStatic = require('lazy.js'); - var Promise: typeof Promise = require('bluebird'); - - var readFile = Promise.promisify(fs.readFile); - - ///////////////////////////////// - // Track all files in the repo: map full path to File objects - ///////////////////////////////// - export class FileIndex { - - files: File[]; - fileMap: FileDict; - refMap: FileArrDict; - options: ITestRunnerOptions; - changed: FileDict; - removed: FileDict; - missing: FileArrDict; - - constructor(private runner: TestRunner, options: ITestRunnerOptions) { - this.options = options; - } - - public hasFile(target: string): boolean { - return target in this.fileMap; - } - - public getFile(target: string): File { - if (target in this.fileMap) { - return this.fileMap[target]; - } - return null; - } - - public setFile(file: File): void { - if (file.fullPath in this.fileMap) { - throw new Error('cannot overwrite file'); - } - this.fileMap[file.fullPath] = file; - } - - public readIndex(): Promise { - this.fileMap = Object.create(null); - - return Promise.promisify(glob).call(glob, '**/*.ts', { - cwd: this.runner.dtPath - }).then((filesNames: string[]) => { - this.files = Lazy(filesNames).filter((fileName) => { - return this.runner.checkAcceptFile(fileName); - }).map((fileName: string) => { - var file = new File(this.runner.dtPath, fileName); - this.fileMap[file.fullPath] = file; - return file; - }).toArray(); - }); - } - - public collectDiff(changes: string[]): Promise { - return new Promise((resolve) => { - // filter changes and bake map for easy lookup - this.changed = Object.create(null); - this.removed = Object.create(null); - - Lazy(changes).filter((full) => { - return this.runner.checkAcceptFile(full); - }).uniq().each((local) => { - var full = path.resolve(this.runner.dtPath, local); - var file = this.getFile(full); - if (!file) { - // TODO figure out what to do here - // what does it mean? deleted?ss - file = new File(this.runner.dtPath, local); - this.setFile(file); - this.removed[full] = file; - // console.log('not in index? %', file.fullPath); - } - else { - this.changed[full] = file; - } - }); - // console.log('changed:\n' + Object.keys(this.changed).join('\n')); - // console.log('removed:\n' + Object.keys(this.removed).join('\n')); - resolve(); - }); - } - - public parseFiles(): Promise { - return this.loadReferences(this.files).then(() => { - return this.getMissingReferences(); - }); - } - - private getMissingReferences(): Promise { - return Promise.attempt(() => { - this.missing = Object.create(null); - Lazy(this.removed).keys().each((removed) => { - if (removed in this.refMap) { - this.missing[removed] = this.refMap[removed]; - } - }); - }); - } - - private loadReferences(files: File[]): Promise { - return new Promise((resolve, reject) => { - var queue = files.slice(0); - var active = []; - var max = 50; - var next = () => { - if (queue.length === 0 && active.length === 0) { - resolve(); - return; - } - // queue paralel - while (queue.length > 0 && active.length < max) { - var file = queue.pop(); - active.push(file); - this.parseFile(file).then((file) => { - active.splice(active.indexOf(file), 1); - next(); - }).catch((err) => { - queue = []; - active = []; - reject(err); - }); - } - }; - next(); - }).then(() => { - // bake reverse reference map (referenced to referrers) - this.refMap = Object.create(null); - - Lazy(files).each((file) => { - Lazy(file.references).each((ref) => { - if (ref.fullPath in this.refMap) { - this.refMap[ref.fullPath].push(file); - } - else { - this.refMap[ref.fullPath] = [file]; - } - }); - }); - }); - } - - // TODO replace with a stream? - private parseFile(file: File): Promise { - return readFile(file.filePathWithName, { - encoding: 'utf8', - flag: 'r' - }).then((content) => { - file.references = Lazy(extractReferenceTags(content)).map((ref) => { - return path.resolve(path.dirname(file.fullPath), ref); - }).reduce((memo: File[], ref) => { - if (ref in this.fileMap) { - memo.push(this.fileMap[ref]); - } - else { - console.log('not mapped? -> ' + ref); - } - return memo; - }, []); - // return the object - return file; - }); - } - - public collectTargets(): Promise { - return new Promise((resolve) => { - // map out files linked to changes - // - queue holds files touched by a change - // - pre-fill with actually changed files - // - loop queue, if current not seen: - // - add to result - // - from refMap queue all files referring to current - - var result: FileDict = Object.create(null); - var queue = Lazy(this.changed).values().toArray(); - - while (queue.length > 0) { - var next = queue.shift(); - var fp = next.fullPath; - if (result[fp]) { - continue; - } - result[fp] = next; - if (fp in this.refMap) { - var arr = this.refMap[fp]; - for (var i = 0, ii = arr.length; i < ii; i++) { - // just add it and skip expensive checks - queue.push(arr[i]); - } - } - } - resolve(Lazy(result).values().toArray()); - }); - } - } -} diff --git a/_infrastructure/tests/src/printer.ts b/_infrastructure/tests/src/printer.ts deleted file mode 100644 index 9ee01f3c6..000000000 --- a/_infrastructure/tests/src/printer.ts +++ /dev/null @@ -1,281 +0,0 @@ -/// -/// - -module DT { - - var os = require('os'); - - ///////////////////////////////// - // All the common things that we print are functions of this class - ///////////////////////////////// - export class Print { - - WIDTH = 77; - - typings: number; - tests: number; - tsFiles: number - - constructor(public version: string){ - - } - - public init(typings: number, tests: number, tsFiles: number) { - this.typings = typings; - this.tests = tests; - this.tsFiles = tsFiles; - } - - public out(s: any): Print { - process.stdout.write(s); - return this; - } - - public repeat(s: string, times: number): string { - return new Array(times + 1).join(s); - } - - public printChangeHeader() { - this.out('=============================================================================\n'); - this.out(' \33[36m\33[1mDefinitelyTyped Diff Detector 0.1.0\33[0m \n'); - this.out('=============================================================================\n'); - } - - public printHeader(options: ITestRunnerOptions) { - var totalMem = Math.round(os.totalmem() / 1024 / 1024) + ' mb'; - var freemem = Math.round(os.freemem() / 1024 / 1024) + ' mb'; - - this.out('=============================================================================\n'); - this.out(' \33[36m\33[1mDefinitelyTyped Test Runner 0.5.0\33[0m\n'); - this.out('=============================================================================\n'); - this.out(' \33[36m\33[1mTypescript version:\33[0m ' + this.version + '\n'); - this.out(' \33[36m\33[1mTypings :\33[0m ' + this.typings + '\n'); - this.out(' \33[36m\33[1mTests :\33[0m ' + this.tests + '\n'); - this.out(' \33[36m\33[1mTypeScript files :\33[0m ' + this.tsFiles + '\n'); - this.out(' \33[36m\33[1mTotal Memory :\33[0m ' + totalMem + '\n'); - this.out(' \33[36m\33[1mFree Memory :\33[0m ' + freemem + '\n'); - this.out(' \33[36m\33[1mCores :\33[0m ' + os.cpus().length + '\n'); - this.out(' \33[36m\33[1mConcurrent :\33[0m ' + options.concurrent + '\n'); - } - - public printSuiteHeader(title: string) { - var left = Math.floor((this.WIDTH - title.length ) / 2) - 1; - var right = Math.ceil((this.WIDTH - title.length ) / 2) - 1; - this.out(this.repeat('=', left)).out(' \33[34m\33[1m'); - this.out(title); - this.out('\33[0m ').out(this.repeat('=', right)).printBreak(); - } - - public printDiv() { - this.out('-----------------------------------------------------------------------------\n'); - } - - public printBoldDiv() { - this.out('=============================================================================\n'); - } - - public printErrorsHeader() { - this.out('=============================================================================\n'); - this.out(' \33[34m\33[1mErrors in files\33[0m \n'); - this.out('=============================================================================\n'); - } - - public printErrorsForFile(testResult: TestResult) { - this.out('----------------- For file:' + testResult.targetFile.filePathWithName); - this.printBreak().out(testResult.stderr).printBreak(); - } - - public printBreak(): Print { - this.out('\n'); - return this; - } - - public clearCurrentLine(): Print { - this.out('\r\33[K'); - return this; - } - - public printSuccessCount(current: number, total: number) { - var arb = (total === 0) ? 0 : (current / total); - this.out(' \33[36m\33[1mSuccessful :\33[0m \33[32m\33[1m' + (arb * 100).toFixed(2) + '% (' + current + '/' + total + ')\33[0m\n'); - } - - public printFailedCount(current: number, total: number) { - var arb = (total === 0) ? 0 : (current / total); - this.out(' \33[36m\33[1mFailure :\33[0m \33[31m\33[1m' + (arb * 100).toFixed(2) + '% (' + current + '/' + total + ')\33[0m\n'); - } - - public printTypingsWithoutTestsMessage() { - this.out(' \33[36m\33[1mTyping without tests\33[0m\n'); - } - - public printTotalMessage() { - this.out(' \33[36m\33[1mTotal\33[0m\n'); - } - - public printElapsedTime(time: string, s: number) { - this.out(' \33[36m\33[1mElapsed time :\33[0m ~' + time + ' (' + s + 's)\n'); - } - - public printSuiteErrorCount(errorHeadline: string, current: number, total: number, warn: boolean = false) { - var arb = (total === 0) ? 0 : (current / total); - this.out(' \33[36m\33[1m').out(errorHeadline).out(this.repeat(' ', 16 - errorHeadline.length)); - if (warn) { - this.out(': \33[31m\33[1m' + (arb * 100).toFixed(2) + '% (' + current + '/' + total + ')\33[0m\n'); - } - else { - this.out(': \33[33m\33[1m' + (arb * 100).toFixed(2) + '% (' + current + '/' + total + ')\33[0m\n'); - } - } - - public printSubHeader(file: string) { - this.out(' \33[36m\33[1m' + file + '\33[0m\n'); - } - - public printWarnCode(str: string) { - this.out(' \33[31m\33[1m<' + str.toLowerCase().replace(/ +/g, '-') + '>\33[0m\n'); - } - - public printLine(file: string) { - this.out(file + '\n'); - } - - public printElement(file: string) { - this.out(' - ' + file + '\n'); - } - - public printElement2(file: string) { - this.out(' - ' + file + '\n'); - } - - public printTypingsWithoutTestName(file: string) { - this.out(' - \33[33m\33[1m' + file + '\33[0m\n'); - } - - public printTypingsWithoutTest(withoutTestTypings: string[]) { - if (withoutTestTypings.length > 0) { - this.printTypingsWithoutTestsMessage(); - - this.printDiv(); - withoutTestTypings.forEach((t) => { - this.printTypingsWithoutTestName(t); - }); - } - } - - public printTestComplete(testResult: TestResult): void { - var reporter = testResult.hostedBy.testReporter; - if (testResult.success) { - reporter.printPositiveCharacter(testResult); - } - else { - reporter.printNegativeCharacter(testResult); - } - } - - public printSuiteComplete(suite: ITestSuite): void { - this.printBreak(); - - this.printDiv(); - this.printElapsedTime(suite.timer.asString, suite.timer.time); - this.printSuccessCount(suite.okTests.length, suite.testResults.length); - this.printFailedCount(suite.ngTests.length, suite.testResults.length); - } - - public printTests(adding: FileDict): void { - this.printDiv(); - this.printSubHeader('Testing'); - this.printDiv(); - - Object.keys(adding).sort().map((src) => { - this.printLine(adding[src].filePathWithName); - return adding[src]; - }); - } - - public printQueue(files: File[]): void { - this.printDiv(); - this.printSubHeader('Queued for testing'); - this.printDiv(); - - files.forEach((file) => { - this.printLine(file.filePathWithName); - }); - } - - public printTestAll(): void { - this.printDiv(); - this.printSubHeader('Ignoring changes, testing all files'); - } - - public printFiles(files: File[]): void { - this.printDiv(); - this.printSubHeader('Files'); - this.printDiv(); - - files.forEach((file) => { - this.printLine(file.filePathWithName); - file.references.forEach((file) => { - this.printElement(file.filePathWithName); - }); - }); - } - - public printMissing(index: FileIndex, refMap: FileArrDict): void { - this.printDiv(); - this.printSubHeader('Missing references'); - this.printDiv(); - - Object.keys(refMap).sort().forEach((src) => { - var ref = index.getFile(src); - this.printLine('\33[31m\33[1m' + ref.filePathWithName + '\33[0m'); - refMap[src].forEach((file) => { - this.printElement(file.filePathWithName); - }); - }); - } - - public printAllChanges(paths: string[]): void { - this.printSubHeader('All changes'); - this.printDiv(); - - paths.sort().forEach((line) => { - this.printLine(line); - }); - } - - public printRelChanges(changeMap: FileDict): void { - this.printDiv(); - this.printSubHeader('Interesting files'); - this.printDiv(); - - Object.keys(changeMap).sort().forEach((src) => { - this.printLine(changeMap[src].filePathWithName); - }); - } - - public printRemovals(changeMap: FileDict): void { - this.printDiv(); - this.printSubHeader('Removed files'); - this.printDiv(); - - Object.keys(changeMap).sort().forEach((src) => { - this.printLine(changeMap[src].filePathWithName); - }); - } - - public printRefMap(index: FileIndex, refMap: FileArrDict): void { - this.printDiv(); - this.printSubHeader('Referring'); - this.printDiv(); - - Object.keys(refMap).sort().forEach((src) => { - var ref = index.getFile(src); - this.printLine(ref.filePathWithName); - refMap[src].forEach((file) => { - this.printLine(' - ' + file.filePathWithName); - }); - }); - } - } -} diff --git a/_infrastructure/tests/src/reporter/reporter.ts b/_infrastructure/tests/src/reporter/reporter.ts deleted file mode 100644 index 736ac413c..000000000 --- a/_infrastructure/tests/src/reporter/reporter.ts +++ /dev/null @@ -1,42 +0,0 @@ -/// -/// - -module DT { - ///////////////////////////////// - // Test reporter interface - // for example, . and x - ///////////////////////////////// - export interface ITestReporter { - printPositiveCharacter(testResult: TestResult):void; - printNegativeCharacter(testResult: TestResult):void; - } - - ///////////////////////////////// - // Default test reporter - ///////////////////////////////// - export class DefaultTestReporter implements ITestReporter { - - index = 0; - - constructor(public print: Print) { - } - - public printPositiveCharacter(testResult: TestResult) { - this.print.out('\33[36m\33[1m' + '.' + '\33[0m'); - this.index++; - this.printBreakIfNeeded(this.index); - } - - public printNegativeCharacter( testResult: TestResult) { - this.print.out('x'); - this.index++; - this.printBreakIfNeeded(this.index); - } - - private printBreakIfNeeded(index: number) { - if (index % this.print.WIDTH === 0) { - this.print.printBreak(); - } - } - } -} diff --git a/_infrastructure/tests/src/suite/suite.ts b/_infrastructure/tests/src/suite/suite.ts deleted file mode 100644 index 8624da0d3..000000000 --- a/_infrastructure/tests/src/suite/suite.ts +++ /dev/null @@ -1,82 +0,0 @@ -/// - -module DT { - 'use strict'; - - var Promise: typeof Promise = require('bluebird'); - - ///////////////////////////////// - // The interface for test suite - ///////////////////////////////// - export interface ITestSuite { - testSuiteName:string; - errorHeadline:string; - filterTargetFiles(files: File[]): Promise; - - start(targetFiles: File[], testCallback: (result: TestResult, index: number) => void): Promise; - - testResults:TestResult[]; - okTests:TestResult[]; - ngTests:TestResult[]; - timer:Timer; - - testReporter:ITestReporter; - printErrorCount:boolean; - } - - ///////////////////////////////// - // Base class for test suite - ///////////////////////////////// - export class TestSuiteBase implements ITestSuite { - timer: Timer = new Timer(); - testResults: TestResult[] = []; - testReporter: ITestReporter; - printErrorCount = true; - queue: TestQueue; - - constructor(public options: ITestRunnerOptions, public testSuiteName: string, public errorHeadline: string) { - this.queue = new TestQueue(options.concurrent); - } - - public filterTargetFiles(files: File[]): Promise { - throw new Error('please implement this method'); - } - - public start(targetFiles: File[], testCallback: (result: TestResult) => void): Promise { - this.timer.start(); - - return this.filterTargetFiles(targetFiles).then((targetFiles) => { - // tests get queued for multi-threading - return Promise.all(targetFiles.map((targetFile) => { - return this.runTest(targetFile).then((result) => { - testCallback(result); - }); - })); - }).then(() => { - this.timer.end(); - return this; - }); - } - - public runTest(targetFile: File): Promise { - return this.queue.run(new Test(this, targetFile, { - tscVersion: this.options.tscVersion - })).then((result) => { - this.testResults.push(result); - return result; - }); - } - - public get okTests(): TestResult[] { - return this.testResults.filter((r) => { - return r.success; - }); - } - - public get ngTests(): TestResult[] { - return this.testResults.filter((r) => { - return !r.success - }); - } - } -} diff --git a/_infrastructure/tests/src/suite/syntax.ts b/_infrastructure/tests/src/suite/syntax.ts deleted file mode 100644 index 915fd18d0..000000000 --- a/_infrastructure/tests/src/suite/syntax.ts +++ /dev/null @@ -1,26 +0,0 @@ -/// -/// - -module DT { - 'use strict'; - - var Promise: typeof Promise = require('bluebird'); - - var endDts = /\w\.d\.ts$/i; - - ///////////////////////////////// - // .d.ts syntax inspection - ///////////////////////////////// - export class SyntaxChecking extends TestSuiteBase { - - constructor(options: ITestRunnerOptions) { - super(options, 'Syntax checking', 'Syntax error'); - } - - public filterTargetFiles(files: File[]): Promise { - return Promise.cast(files.filter((file) => { - return endDts.test(file.filePathWithName); - })); - } - } -} diff --git a/_infrastructure/tests/src/suite/testEval.ts b/_infrastructure/tests/src/suite/testEval.ts deleted file mode 100644 index abc4d5093..000000000 --- a/_infrastructure/tests/src/suite/testEval.ts +++ /dev/null @@ -1,26 +0,0 @@ -/// -/// - -module DT { - 'use strict'; - - var Promise: typeof Promise = require('bluebird'); - - var endTestDts = /\w-tests?\.ts$/i; - - ///////////////////////////////// - // Compile with *-tests.ts - ///////////////////////////////// - export class TestEval extends TestSuiteBase { - - constructor(options) { - super(options, 'Typing tests', 'Failed tests'); - } - - public filterTargetFiles(files: File[]): Promise { - return Promise.cast(files.filter((file) => { - return endTestDts.test(file.filePathWithName); - })); - } - } -} diff --git a/_infrastructure/tests/src/suite/tscParams.ts b/_infrastructure/tests/src/suite/tscParams.ts deleted file mode 100644 index 12e3f4601..000000000 --- a/_infrastructure/tests/src/suite/tscParams.ts +++ /dev/null @@ -1,59 +0,0 @@ -/// -/// - -module DT { - 'use strict'; - - var fs = require('fs'); - var Promise: typeof Promise = require('bluebird'); - - ///////////////////////////////// - // Try compile without .tscparams - // It may indicate that it is compatible with --noImplicitAny maybe... - ///////////////////////////////// - export class FindNotRequiredTscparams extends TestSuiteBase { - testReporter: ITestReporter; - printErrorCount = false; - - constructor(options: ITestRunnerOptions, private print: Print) { - super(options, 'Find not required .tscparams files', 'New arrival!'); - - this.testReporter = { - printPositiveCharacter: (testResult: TestResult) => { - this.print - .clearCurrentLine() - .printTypingsWithoutTestName(testResult.targetFile.filePathWithName); - }, - printNegativeCharacter: (testResult: TestResult) => { - } - } - } - - public filterTargetFiles(files: File[]): Promise { - return Promise.filter(files, (file) => { - return new Promise((resolve) => { - fs.exists(file.filePathWithName + '.tscparams', resolve); - }); - }); - } - - public runTest(targetFile: File): Promise { - this.print.clearCurrentLine().out(targetFile.filePathWithName); - - return this.queue.run(new Test(this, targetFile, { - tscVersion: this.options.tscVersion, - useTscParams: false, - checkNoImplicitAny: true - })).then((result) => { - this.testResults.push(result); - this.print.clearCurrentLine(); - return result - }); - } - - public get ngTests(): TestResult[] { - // Do not show ng test results - return []; - } - } -} diff --git a/_infrastructure/tests/src/timer.ts b/_infrastructure/tests/src/timer.ts deleted file mode 100644 index 0f7474347..000000000 --- a/_infrastructure/tests/src/timer.ts +++ /dev/null @@ -1,50 +0,0 @@ -/// -/// - -module DT { - 'use strict'; - - ///////////////////////////////// - // Timer.start starts a timer - // Timer.end stops the timer and sets asString to the pretty print value - ///////////////////////////////// - export class Timer { - startTime: number; - time = 0; - asString: string = '' - - public start() { - this.time = 0; - this.startTime = this.now(); - this.asString = ''; - } - - public now(): number { - return Date.now(); - } - - public end() { - this.time = (this.now() - this.startTime) / 1000; - this.asString = Timer.prettyDate(this.startTime, this.now()); - } - - public static prettyDate(date1: number, date2: number): string { - var diff = ((date2 - date1) / 1000); - var day_diff = Math.floor(diff / 86400); - - if (isNaN(day_diff) || day_diff < 0 || day_diff >= 31) { - return null; - } - - return ( (day_diff == 0 && ( - diff < 60 && (diff + ' seconds') || - diff < 120 && '1 minute' || - diff < 3600 && Math.floor(diff / 60) + ' minutes' || - diff < 7200 && '1 hour' || - diff < 86400 && Math.floor(diff / 3600) + ' hours') || - day_diff == 1 && 'Yesterday' || - day_diff < 7 && day_diff + ' days' || - day_diff < 31 && Math.ceil(day_diff / 7) + ' weeks')); - } - } -} diff --git a/_infrastructure/tests/src/tsc.ts b/_infrastructure/tests/src/tsc.ts deleted file mode 100644 index 61c833528..000000000 --- a/_infrastructure/tests/src/tsc.ts +++ /dev/null @@ -1,60 +0,0 @@ -/// -/// -/// - -module DT { - 'use strict'; - - var fs = require('fs'); - - var Promise: typeof Promise = require('bluebird'); - - export interface TscExecOptions { - tscVersion?: string; - useTscParams?: boolean; - checkNoImplicitAny?: boolean; - } - - export class Tsc { - public static run(tsfile: string, options: TscExecOptions): Promise { - var tscPath; - return new Promise.attempt(() => { - options = options || {}; - options.tscVersion = options.tscVersion || DEFAULT_TSC_VERSION; - if (typeof options.checkNoImplicitAny === 'undefined') { - options.checkNoImplicitAny = true; - } - if (typeof options.useTscParams === 'undefined') { - options.useTscParams = true; - } - return fileExists(tsfile); - }).then((exists) => { - if (!exists) { - throw new Error(tsfile + ' does not exist'); - } - tscPath = './_infrastructure/tests/typescript/' + options.tscVersion + '/tsc.js'; - return fileExists(tscPath); - }).then((exists) => { - if (!exists) { - throw new Error(tscPath + ' does not exist'); - } - return fileExists(tsfile + '.tscparams'); - }).then(exists => { - if (exists) { - return readFile(tsfile + '.tscparams'); - } else { - return new Promise(''); - } - }).then((paramContents: string) => { - var command = 'node ' + tscPath + ' --module commonjs '; - if (options.useTscParams && paramContents.trim() !== '' && paramContents.trim() !== '""') { - command += '@' + tsfile + '.tscparams'; - } - else if (options.checkNoImplicitAny) { - command += '--noImplicitAny'; - } - return exec(command, [tsfile]); - }); - } - } -} diff --git a/_infrastructure/tests/src/util.ts b/_infrastructure/tests/src/util.ts deleted file mode 100644 index a77583eda..000000000 --- a/_infrastructure/tests/src/util.ts +++ /dev/null @@ -1,52 +0,0 @@ -/// - -module DT { - 'use strict'; - - var fs = require('fs'); - var Lazy: LazyJS.LazyStatic = require('lazy.js'); - var Promise: typeof Promise = require('bluebird'); - - var referenceTagExp = //g; - - export function endsWith(str: string, suffix: string) { - return str.indexOf(suffix, str.length - suffix.length) !== -1; - } - - export function extractReferenceTags(source: string): string[] { - var ret: string[] = []; - var match: RegExpExecArray; - - if (!referenceTagExp.global) { - throw new Error('referenceTagExp RegExp must have global flag'); - } - referenceTagExp.lastIndex = 0; - - while ((match = referenceTagExp.exec(source))) { - if (match.length > 0 && match[1].length > 0) { - ret.push(match[1]); - } - } - return ret; - } - - export function fileExists(target: string): Promise { - return new Promise((resolve, reject) => { - fs.exists(target, (bool: boolean) => { - resolve(bool); - }); - }); - } - - export function readFile(target: string): Promise { - return new Promise((resolve, reject) => { - fs.readFile(target, 'utf-8', (err, contents: string) => { - if (err) { - reject(err); - } else { - resolve(contents); - } - }); - }); - } -} diff --git a/_infrastructure/tests/typings/bluebird/bluebird.d.ts b/_infrastructure/tests/typings/bluebird/bluebird.d.ts deleted file mode 100644 index 45db9d86a..000000000 --- a/_infrastructure/tests/typings/bluebird/bluebird.d.ts +++ /dev/null @@ -1,656 +0,0 @@ -// Type definitions for bluebird 1.0.0 -// Project: https://github.com/petkaantonov/bluebird -// Definitions by: Bart van der Schoor -// Definitions: https://github.com/borisyankov/DefinitelyTyped - -// ES6 model with generics overload was sourced and trans-multiplied from es6-promises.d.ts -// By: Campredon - -// Warning: recommended to use `tsc > v1.0.0` (critical bugs in generic code: -// - https://github.com/borisyankov/DefinitelyTyped/issues/1563 -// - https://github.com/borisyankov/DefinitelyTyped/tree/def/bluebird - -// Note: replicate changes to all overloads in both definition and test file -// Note: keep both static and instance members inline (so similar) - -// TODO fix remaining TODO annotations in both definition and test - -// TODO verify support to have no return statement in handlers to get a Promise (more overloads?) - -declare class Promise implements Promise.Thenable { - /** - * Create a new promise. The passed in function will receive functions `resolve` and `reject` as its arguments which can be called to seal the fate of the created promise. - */ - constructor(callback: (resolve: (thenable: Promise.Thenable) => void, reject: (error: any) => void) => void); - constructor(callback: (resolve: (result: R) => void, reject: (error: any) => void) => void); - - /** - * Promises/A+ `.then()` with progress handler. Returns a new promise chained from this promise. The new promise will be rejected or resolved dedefer on the passed `fulfilledHandler`, `rejectedHandler` and the state of this promise. - */ - then(onFulfill: (value: R) => Promise.Thenable, onReject: (error: any) => Promise.Thenable, onProgress?: (note: any) => any): Promise; - then(onFulfill: (value: R) => Promise.Thenable, onReject?: (error: any) => U, onProgress?: (note: any) => any): Promise; - then(onFulfill: (value: R) => U, onReject: (error: any) => Promise.Thenable, onProgress?: (note: any) => any): Promise; - then(onFulfill?: (value: R) => U, onReject?: (error: any) => U, onProgress?: (note: any) => any): Promise; - - /** - * This is a catch-all exception handler, shortcut for calling `.then(null, handler)` on this promise. Any exception happening in a `.then`-chain will propagate to nearest `.catch` handler. - * - * Alias `.caught();` for compatibility with earlier ECMAScript version. - */ - catch(onReject?: (error: any) => Promise.Thenable): Promise; - caught(onReject?: (error: any) => Promise.Thenable): Promise; - - catch(onReject?: (error: any) => U): Promise; - caught(onReject?: (error: any) => U): Promise; - - /** - * This extends `.catch` to work more like catch-clauses in languages like Java or C#. Instead of manually checking `instanceof` or `.name === "SomeError"`, you may specify a number of error constructors which are eligible for this catch handler. The catch handler that is first met that has eligible constructors specified, is the one that will be called. - * - * This method also supports predicate-based filters. If you pass a predicate function instead of an error constructor, the predicate will receive the error as an argument. The return result of the predicate will be used determine whether the error handler should be called. - * - * Alias `.caught();` for compatibility with earlier ECMAScript version. - */ - catch(predicate: (error: any) => boolean, onReject: (error: any) => Promise.Thenable): Promise; - caught(predicate: (error: any) => boolean, onReject: (error: any) => Promise.Thenable): Promise; - - catch(predicate: (error: any) => boolean, onReject: (error: any) => U): Promise; - caught(predicate: (error: any) => boolean, onReject: (error: any) => U): Promise; - - catch(ErrorClass: Function, onReject: (error: any) => Promise.Thenable): Promise; - caught(ErrorClass: Function, onReject: (error: any) => Promise.Thenable): Promise; - - catch(ErrorClass: Function, onReject: (error: any) => U): Promise; - caught(ErrorClass: Function, onReject: (error: any) => U): Promise; - - /** - * Like `.catch` but instead of catching all types of exceptions, it only catches those that don't originate from thrown errors but rather from explicit rejections. - */ - error(onReject: (reason: any) => Promise.Thenable): Promise; - error(onReject: (reason: any) => U): Promise; - - /** - * Pass a handler that will be called regardless of this promise's fate. Returns a new promise chained from this promise. There are special semantics for `.finally()` in that the final value cannot be modified from the handler. - * - * Alias `.lastly();` for compatibility with earlier ECMAScript version. - */ - finally(handler: (value: R) => Promise.Thenable): Promise; - finally(handler: (value: R) => R): Promise; - finally(handler: (value: R) => void): Promise; - - lastly(handler: (value: R) => Promise.Thenable): Promise; - lastly(handler: (value: R) => R): Promise; - - /** - * Create a promise that follows this promise, but is bound to the given `thisArg` value. A bound promise will call its handlers with the bound value set to `this`. Additionally promises derived from a bound promise will also be bound promises with the same `thisArg` binding as the original promise. - */ - bind(thisArg: any): Promise; - - /** - * Like `.then()`, but any unhandled rejection that ends up here will be thrown as an error. - */ - done(onFulfilled: (value: R) => Promise.Thenable, onRejected: (error: any) => Promise.Thenable, onProgress?: (note: any) => any): Promise; - done(onFulfilled: (value: R) => Promise.Thenable, onRejected?: (error: any) => U, onProgress?: (note: any) => any): Promise; - done(onFulfilled: (value: R) => U, onRejected: (error: any) => Promise.Thenable, onProgress?: (note: any) => any): Promise; - done(onFulfilled?: (value: R) => U, onRejected?: (error: any) => U, onProgress?: (note: any) => any): Promise; - - /** - * Shorthand for `.then(null, null, handler);`. Attach a progress handler that will be called if this promise is progressed. Returns a new promise chained from this promise. - */ - progressed(handler: (note: any) => any): Promise; - - /** - * Same as calling `Promise.delay(this, ms)`. With the exception that if this promise is bound to a value, the returned promise is bound to that value too. - */ - delay(ms: number): Promise; - - /** - * Returns a promise that will be fulfilled with this promise's fulfillment value or rejection reason. However, if this promise is not fulfilled or rejected within `ms` milliseconds, the returned promise is rejected with a `Promise.TimeoutError` instance. - * - * You may specify a custom error message with the `message` parameter. - */ - timeout(ms: number, message?: string): Promise; - - /** - * Register a node-style callback on this promise. When this promise is is either fulfilled or rejected, the node callback will be called back with the node.js convention where error reason is the first argument and success value is the second argument. The error argument will be `null` in case of success. - * Returns back this promise instead of creating a new one. If the `callback` argument is not a function, this method does not do anything. - */ - nodeify(callback: (err: any, value?: R) => void): Promise; - nodeify(...sink: any[]): void; - - /** - * Marks this promise as cancellable. Promises by default are not cancellable after v0.11 and must be marked as such for `.cancel()` to have any effect. Marking a promise as cancellable is infectious and you don't need to remark any descendant promise. - */ - cancellable(): Promise; - - /** - * Cancel this promise. The cancellation will propagate to farthest cancellable ancestor promise which is still pending. - * - * That ancestor will then be rejected with a `CancellationError` (get a reference from `Promise.CancellationError`) object as the rejection reason. - * - * In a promise rejection handler you may check for a cancellation by seeing if the reason object has `.name === "Cancel"`. - * - * Promises are by default not cancellable. Use `.cancellable()` to mark a promise as cancellable. - */ - // TODO what to do with this? - cancel(): Promise; - - /** - * Like `.then()`, but cancellation of the the returned promise or any of its descendant will not propagate cancellation to this promise or this promise's ancestors. - */ - fork(onFulfilled: (value: R) => Promise.Thenable, onRejected: (error: any) => Promise.Thenable, onProgress?: (note: any) => any): Promise; - fork(onFulfilled: (value: R) => Promise.Thenable, onRejected?: (error: any) => U, onProgress?: (note: any) => any): Promise; - fork(onFulfilled: (value: R) => U, onRejected: (error: any) => Promise.Thenable, onProgress?: (note: any) => any): Promise; - fork(onFulfilled?: (value: R) => U, onRejected?: (error: any) => U, onProgress?: (note: any) => any): Promise; - - /** - * Create an uncancellable promise based on this promise. - */ - uncancellable(): Promise; - - /** - * See if this promise can be cancelled. - */ - isCancellable(): boolean; - - /** - * See if this `promise` has been fulfilled. - */ - isFulfilled(): boolean; - - /** - * See if this `promise` has been rejected. - */ - isRejected(): boolean; - - /** - * See if this `promise` is still defer. - */ - isPending(): boolean; - - /** - * See if this `promise` is resolved -> either fulfilled or rejected. - */ - isResolved(): boolean; - - /** - * Synchronously inspect the state of this `promise`. The `PromiseInspection` will represent the state of the promise as snapshotted at the time of calling `.inspect()`. - */ - inspect(): Promise.Inspection; - - /** - * This is a convenience method for doing: - * - * - * promise.then(function(obj){ - * return obj[propertyName].call(obj, arg...); - * }); - * - */ - call(propertyName: string, ...args: any[]): Promise; - - /** - * This is a convenience method for doing: - * - * - * promise.then(function(obj){ - * return obj[propertyName]; - * }); - * - */ - // TODO find way to fix get() - // get(propertyName: string): Promise; - - /** - * Convenience method for: - * - * - * .then(function() { - * return value; - * }); - * - * - * in the case where `value` doesn't change its value. That means `value` is bound at the time of calling `.return()` - * - * Alias `.thenReturn();` for compatibility with earlier ECMAScript version. - */ - return(value: U): Promise; - thenReturn(value: U): Promise; - return(): Promise; - thenReturn(): Promise; - - /** - * Convenience method for: - * - * - * .then(function() { - * throw reason; - * }); - * - * Same limitations apply as with `.return()`. - * - * Alias `.thenThrow();` for compatibility with earlier ECMAScript version. - */ - throw(reason: Error): Promise; - thenThrow(reason: Error): Promise; - - /** - * Convert to String. - */ - toString(): string; - - /** - * This is implicitly called by `JSON.stringify` when serializing the object. Returns a serialized representation of the `Promise`. - */ - toJSON(): Object; - - /** - * Like calling `.then`, but the fulfillment value or rejection reason is assumed to be an array, which is flattened to the formal parameters of the handlers. - */ - // TODO how to model instance.spread()? like Q? - spread(onFulfill: Function, onReject?: (reason: any) => Promise.Thenable): Promise; - spread(onFulfill: Function, onReject?: (reason: any) => U): Promise; - /* - // TODO or something like this? - spread(onFulfill: (...values: W[]) => Promise.Thenable, onReject?: (reason: any) => Promise.Thenable): Promise; - spread(onFulfill: (...values: W[]) => Promise.Thenable, onReject?: (reason: any) => U): Promise; - spread(onFulfill: (...values: W[]) => U, onReject?: (reason: any) => Promise.Thenable): Promise; - spread(onFulfill: (...values: W[]) => U, onReject?: (reason: any) => U): Promise; - */ - /** - * Same as calling `Promise.all(thisPromise)`. With the exception that if this promise is bound to a value, the returned promise is bound to that value too. - */ - // TODO type inference from array-resolving promise? - all(): Promise; - - /** - * Same as calling `Promise.props(thisPromise)`. With the exception that if this promise is bound to a value, the returned promise is bound to that value too. - */ - // TODO how to model instance.props()? - props(): Promise; - - /** - * Same as calling `Promise.settle(thisPromise)`. With the exception that if this promise is bound to a value, the returned promise is bound to that value too. - */ - // TODO type inference from array-resolving promise? - settle(): Promise[]>; - - /** - * Same as calling `Promise.any(thisPromise)`. With the exception that if this promise is bound to a value, the returned promise is bound to that value too. - */ - // TODO type inference from array-resolving promise? - any(): Promise; - - /** - * Same as calling `Promise.some(thisPromise)`. With the exception that if this promise is bound to a value, the returned promise is bound to that value too. - */ - // TODO type inference from array-resolving promise? - some(count: number): Promise; - - /** - * Same as calling `Promise.race(thisPromise, count)`. With the exception that if this promise is bound to a value, the returned promise is bound to that value too. - */ - // TODO type inference from array-resolving promise? - race(): Promise; - - /** - * Same as calling `Promise.map(thisPromise, mapper)`. With the exception that if this promise is bound to a value, the returned promise is bound to that value too. - */ - // TODO type inference from array-resolving promise? - map(mapper: (item: Q, index: number, arrayLength: number) => Promise.Thenable): Promise; - map(mapper: (item: Q, index: number, arrayLength: number) => U): Promise; - - /** - * Same as calling `Promise.reduce(thisPromise, Function reducer, initialValue)`. With the exception that if this promise is bound to a value, the returned promise is bound to that value too. - */ - // TODO type inference from array-resolving promise? - reduce(reducer: (memo: U, item: Q, index: number, arrayLength: number) => Promise.Thenable, initialValue?: U): Promise; - reduce(reducer: (memo: U, item: Q, index: number, arrayLength: number) => U, initialValue?: U): Promise; - - /** - * Same as calling ``Promise.filter(thisPromise, filterer)``. With the exception that if this promise is bound to a value, the returned promise is bound to that value too. - */ - // TODO type inference from array-resolving promise? - filter(filterer: (item: U, index: number, arrayLength: number) => Promise.Thenable): Promise; - filter(filterer: (item: U, index: number, arrayLength: number) => boolean): Promise; -} - -declare module Promise { - - export 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; - } - - export interface Resolver { - /** - * Resolve the underlying promise with `value` as the resolution value. If `value` is a thenable or a promise, the underlying promise will assume its state. - */ - resolve(value: R): void; - - /** - * Reject the underlying promise with `reason` as the rejection reason. - */ - reject(reason: any): void; - - /** - * Progress the underlying promise with `value` as the progression value. - */ - progress(value: any): void; - - /** - * Gives you a callback representation of the `PromiseResolver`. Note that this is not a method but a property. The callback accepts error object in first argument and success values on the 2nd parameter and the rest, I.E. node js conventions. - * - * If the the callback is called with multiple success values, the resolver fullfills its promise with an array of the values. - */ - // TODO specify resolver callback - callback: Function; - } - - export interface Inspection { - /** - * See if the underlying promise was fulfilled at the creation time of this inspection object. - */ - isFulfilled(): boolean; - - /** - * See if the underlying promise was rejected at the creation time of this inspection object. - */ - isRejected(): boolean; - - /** - * See if the underlying promise was defer at the creation time of this inspection object. - */ - isPending(): boolean; - - /** - * Get the fulfillment value of the underlying promise. Throws if the promise wasn't fulfilled at the creation time of this inspection object. - * - * throws `TypeError` - */ - value(): R; - - /** - * Get the rejection reason for the underlying promise. Throws if the promise wasn't rejected at the creation time of this inspection object. - * - * throws `TypeError` - */ - error(): any; - } - - /** - * Start the chain of promises with `Promise.try`. Any synchronous exceptions will be turned into rejections on the returned promise. - * - * Note about second argument: if it's specifically a true array, its values become respective arguments for the function call. Otherwise it is passed as is as the first argument for the function call. - * - * Alias for `attempt();` for compatibility with earlier ECMAScript version. - */ - // TODO find way to enable try() without tsc borking - // see also: https://typescript.codeplex.com/workitem/2194 - /* - export function try(fn: () => Promise.Thenable, args?: any[], ctx?: any): Promise; - export function try(fn: () => R, args?: any[], ctx?: any): Promise; - */ - - export function attempt(fn: () => Promise.Thenable, args?: any[], ctx?: any): Promise; - export function attempt(fn: () => R, args?: any[], ctx?: any): Promise; - - /** - * Returns a new function that wraps the given function `fn`. The new function will always return a promise that is fulfilled with the original functions return values or rejected with thrown exceptions from the original function. - * This method is convenient when a function can sometimes return synchronously or throw synchronously. - */ - export function method(fn: Function): Function; - - /** - * Create a promise that is resolved with the given `value`. If `value` is a thenable or promise, the returned promise will assume its state. - */ - export function resolve(value: Promise.Thenable): Promise; - export function resolve(value: R): Promise; - - /** - * Create a promise that is rejected with the given `reason`. - */ - export function reject(reason: any): Promise; - - /** - * Create a promise with undecided fate and return a `PromiseResolver` to control it. See resolution?: Promise(#promise-resolution). - */ - export function defer(): Promise.Resolver; - - /** - * Cast the given `value` to a trusted promise. If `value` is already a trusted `Promise`, it is returned as is. If `value` is not a thenable, a fulfilled is: Promise returned with `value` as its fulfillment value. If `value` is a thenable (Promise-like object, like those returned by jQuery's `$.ajax`), returns a trusted that: Promise assimilates the state of the thenable. - */ - export function cast(value: Promise.Thenable): Promise; - export function cast(value: R): Promise; - - /** - * Sugar for `Promise.resolve(undefined).bind(thisArg);`. See `.bind()`. - */ - export function bind(thisArg: any): Promise; - - /** - * See if `value` is a trusted Promise. - */ - export function is(value: any): boolean; - - /** - * Call this right after the library is loaded to enabled long stack traces. Long stack traces cannot be disabled after being enabled, and cannot be enabled after promises have alread been created. Long stack traces imply a substantial performance penalty, around 4-5x for throughput and 0.5x for latency. - */ - export function longStackTraces(): void; - - /** - * Returns a promise that will be fulfilled with `value` (or `undefined`) after given `ms` milliseconds. If `value` is a promise, the delay will start counting down when it is fulfilled and the returned promise will be fulfilled with the fulfillment value of the `value` promise. - */ - // TODO enable more overloads - export function delay(value: Promise.Thenable, ms: number): Promise; - export function delay(value: R, ms: number): Promise; - export function delay(ms: number): Promise; - - /** - * Returns a function that will wrap the given `nodeFunction`. Instead of taking a callback, the returned function will return a promise whose fate is decided by the callback behavior of the given node function. The node function should conform to node.js convention of accepting a callback as last argument and calling that callback with error as the first argument and success value on the second argument. - * - * If the `nodeFunction` calls its callback with multiple success values, the fulfillment value will be an array of them. - * - * If you pass a `receiver`, the `nodeFunction` will be called as a method on the `receiver`. - */ - // TODO how to model promisify? - export function promisify(nodeFunction: Function, receiver?: any): Function; - - /** - * Promisifies the entire object by going through the object's properties and creating an async equivalent of each function on the object and its prototype chain. The promisified method name will be the original method name postfixed with `Async`. Returns the input object. - * - * Note that the original methods on the object are not overwritten but new methods are created with the `Async`-postfix. For example, if you `promisifyAll()` the node.js `fs` object use `fs.statAsync()` to call the promisified `stat` method. - */ - // TODO how to model promisifyAll? - export function promisifyAll(target: Object): Object; - - /** - * Returns a function that can use `yield` to run asynchronous code synchronously. This feature requires the support of generators which are drafted in the next version of the language. Node version greater than `0.11.2` is required and needs to be executed with the `--harmony-generators` (or `--harmony`) command-line switch. - */ - // TODO fix coroutine GeneratorFunction - export function coroutine(generatorFunction: Function): Function; - - /** - * Spawn a coroutine which may yield promises to run asynchronous code synchronously. This feature requires the support of generators which are drafted in the next version of the language. Node version greater than `0.11.2` is required and needs to be executed with the `--harmony-generators` (or `--harmony`) command-line switch. - */ - // TODO fix spawn GeneratorFunction - export function spawn(generatorFunction: Function): Promise; - - /** - * This is relevant to browser environments with no module loader. - * - * Release control of the `Promise` namespace to whatever it was before this library was loaded. Returns a reference to the library namespace so you can attach it to something else. - */ - export function noConflict(): typeof Promise; - - /** - * Add `handler` as the handler to call when there is a possibly unhandled rejection. The default handler logs the error stack to stderr or `console.error` in browsers. - * - * Passing no value or a non-function will have the effect of removing any kind of handling for possibly unhandled rejections. - */ - export function onPossiblyUnhandledRejection(handler: (reason: any) => any): void; - - /** - * Given an array, or a promise of an array, which contains promises (or a mix of promises and values) return a promise that is fulfilled when all the items in the array are fulfilled. The promise's fulfillment value is an array with fulfillment values at respective positions to the original array. If any promise in the array rejects, the returned promise is rejected with the rejection reason. - */ - // TODO enable more overloads - // promise of array with promises of value - export function all(values: Thenable[]>): Promise; - // promise of array with values - export function all(values: Thenable): Promise; - // array with promises of value - export function all(values: Thenable[]): Promise; - // array with values - export function all(values: R[]): Promise; - - /** - * Like ``Promise.all`` but for object properties instead of array items. Returns a promise that is fulfilled when all the properties of the object are fulfilled. The promise's fulfillment value is an object with fulfillment values at respective keys to the original object. If any promise in the object rejects, the returned promise is rejected with the rejection reason. - * - * If `object` is a trusted `Promise`, then it will be treated as a promise for object rather than for its properties. All other objects are treated for their properties as is returned by `Object.keys` - the object's own enumerable properties. - * - * *The original object is not modified.* - */ - // TODO verify this is correct - // trusted promise for object - export function props(object: Promise): Promise; - // object - export function props(object: Object): Promise; - - /** - * Given an array, or a promise of an array, which contains promises (or a mix of promises and values) return a promise that is fulfilled when all the items in the array are either fulfilled or rejected. The fulfillment value is an array of ``PromiseInspection`` instances at respective positions in relation to the input array. - * - * *original: The array is not modified. The input array sparsity is retained in the resulting array.* - */ - // promise of array with promises of value - export function settle(values: Thenable[]>): Promise[]>; - // promise of array with values - export function settle(values: Thenable): Promise[]>; - // array with promises of value - export function settle(values: Thenable[]): Promise[]>; - // array with values - export function settle(values: R[]): Promise[]>; - - /** - * Like `Promise.some()`, with 1 as `count`. However, if the promise fulfills, the fulfillment value is not an array of 1 but the value directly. - */ - // promise of array with promises of value - export function any(values: Thenable[]>): Promise; - // promise of array with values - export function any(values: Thenable): Promise; - // array with promises of value - export function any(values: Thenable[]): Promise; - // array with values - export function any(values: R[]): Promise; - - /** - * Given an array, or a promise of an array, which contains promises (or a mix of promises and values) return a promise that is fulfilled or rejected as soon as a promise in the array is fulfilled or rejected with the respective rejection reason or fulfillment value. - * - * **Note** If you pass empty array or a sparse array with no values, or a promise/thenable for such, it will be forever pending. - */ - // promise of array with promises of value - export function race(values: Thenable[]>): Promise; - // promise of array with values - export function race(values: Thenable): Promise; - // array with promises of value - export function race(values: Thenable[]): Promise; - // array with values - export function race(values: R[]): Promise; - - /** - * Initiate a competetive race between multiple promises or values (values will become immediately fulfilled promises). When `count` amount of promises have been fulfilled, the returned promise is fulfilled with an array that contains the fulfillment values of the winners in order of resolution. - * - * If too many promises are rejected so that the promise can never become fulfilled, it will be immediately rejected with an array of rejection reasons in the order they were thrown in. - * - * *The original array is not modified.* - */ - // promise of array with promises of value - export function some(values: Thenable[]>, count: number): Promise; - // promise of array with values - export function some(values: Thenable, count: number): Promise; - // array with promises of value - export function some(values: Thenable[], count: number): Promise; - // array with values - export function some(values: R[], count: number): Promise; - - /** - * Like `Promise.all()` but instead of having to pass an array, the array is generated from the passed variadic arguments. - */ - // variadic array with promises of value - export function join(...values: Thenable[]): Promise; - // variadic array with values - export function join(...values: R[]): Promise; - - /** - * Map an array, or a promise of an array, which contains a promises (or a mix of promises and values) with the given `mapper` function with the signature `(item, index, arrayLength)` where `item` is the resolved value of a respective promise in the input array. If any promise in the input array is rejected the returned promise is rejected as well. - * - * If the `mapper` function returns promises or thenables, the returned promise will wait for all the mapped results to be resolved as well. - * - * *The original array is not modified.* - */ - // promise of array with promises of value - export function map(values: Thenable[]>, mapper: (item: R, index: number, arrayLength: number) => Thenable): Promise; - export function map(values: Thenable[]>, mapper: (item: R, index: number, arrayLength: number) => U): Promise; - - // promise of array with values - export function map(values: Thenable, mapper: (item: R, index: number, arrayLength: number) => Thenable): Promise; - export function map(values: Thenable, mapper: (item: R, index: number, arrayLength: number) => U): Promise; - - // array with promises of value - export function map(values: Thenable[], mapper: (item: R, index: number, arrayLength: number) => Thenable): Promise; - export function map(values: Thenable[], mapper: (item: R, index: number, arrayLength: number) => U): Promise; - - // array with values - export function map(values: R[], mapper: (item: R, index: number, arrayLength: number) => Thenable): Promise; - export function map(values: R[], mapper: (item: R, index: number, arrayLength: number) => U): Promise; - - /** - * Reduce an array, or a promise of an array, which contains a promises (or a mix of promises and values) with the given `reducer` function with the signature `(total, current, index, arrayLength)` where `item` is the resolved value of a respective promise in the input array. If any promise in the input array is rejected the returned promise is rejected as well. - * - * If the reducer function returns a promise or a thenable, the result for the promise is awaited for before continuing with next iteration. - * - * *The original array is not modified. If no `intialValue` is given and the array doesn't contain at least 2 items, the callback will not be called and `undefined` is returned. If `initialValue` is given and the array doesn't have at least 1 item, `initialValue` is returned.* - */ - // promise of array with promises of value - export function reduce(values: Thenable[]>, reducer: (total: U, current: R, index: number, arrayLength: number) => Thenable, initialValue?: U): Promise; - export function reduce(values: Thenable[]>, reducer: (total: U, current: R, index: number, arrayLength: number) => U, initialValue?: U): Promise; - - // promise of array with values - export function reduce(values: Thenable, reducer: (total: U, current: R, index: number, arrayLength: number) => Thenable, initialValue?: U): Promise; - export function reduce(values: Thenable, reducer: (total: U, current: R, index: number, arrayLength: number) => U, initialValue?: U): Promise; - - // array with promises of value - export function reduce(values: Thenable[], reducer: (total: U, current: R, index: number, arrayLength: number) => Thenable, initialValue?: U): Promise; - export function reduce(values: Thenable[], reducer: (total: U, current: R, index: number, arrayLength: number) => U, initialValue?: U): Promise; - - // array with values - export function reduce(values: R[], reducer: (total: U, current: R, index: number, arrayLength: number) => Thenable, initialValue?: U): Promise; - export function reduce(values: R[], reducer: (total: U, current: R, index: number, arrayLength: number) => U, initialValue?: U): Promise; - - /** - * Filter an array, or a promise of an array, which contains a promises (or a mix of promises and values) with the given `filterer` function with the signature `(item, index, arrayLength)` where `item` is the resolved value of a respective promise in the input array. If any promise in the input array is rejected the returned promise is rejected as well. - * - * The return values from the filtered functions are coerced to booleans, with the exception of promises and thenables which are awaited for their eventual result. - * - * *The original array is not modified. - */ - // promise of array with promises of value - export function filter(values: Thenable[]>, filterer: (item: R, index: number, arrayLength: number) => Thenable): Promise; - export function filter(values: Thenable[]>, filterer: (item: R, index: number, arrayLength: number) => boolean): Promise; - - // promise of array with values - export function filter(values: Thenable, filterer: (item: R, index: number, arrayLength: number) => Thenable): Promise; - export function filter(values: Thenable, filterer: (item: R, index: number, arrayLength: number) => boolean): Promise; - - // array with promises of value - export function filter(values: Thenable[], filterer: (item: R, index: number, arrayLength: number) => Thenable): Promise; - export function filter(values: Thenable[], filterer: (item: R, index: number, arrayLength: number) => boolean): Promise; - - // array with values - export function filter(values: R[], filterer: (item: R, index: number, arrayLength: number) => Thenable): Promise; - export function filter(values: R[], filterer: (item: R, index: number, arrayLength: number) => boolean): Promise; -} - -declare module 'bluebird' { -export = Promise; -} diff --git a/_infrastructure/tests/typings/lazy.js/lazy.js.d.ts b/_infrastructure/tests/typings/lazy.js/lazy.js.d.ts deleted file mode 100644 index b2909dfce..000000000 --- a/_infrastructure/tests/typings/lazy.js/lazy.js.d.ts +++ /dev/null @@ -1,252 +0,0 @@ -// Type definitions for Lazy.js 0.3.2 -// Project: https://github.com/dtao/lazy.js/ -// Definitions by: Bart van der Schoor -// Definitions: https://github.com/borisyankov/DefinitelyTyped - -declare module LazyJS { - - interface LazyStatic { - - (value: T[]):ArrayLikeSequence; - (value: any[]):ArrayLikeSequence; - (value: Object):ObjectLikeSequence; - (value: Object):ObjectLikeSequence; - (value: string):StringLikeSequence; - - strict():LazyStatic; - - generate(generatorFn: GeneratorCallback, length?: number):GeneratedSequence; - - range(to: number):GeneratedSequence; - range(from: number, to: number, step?: number):GeneratedSequence; - - repeat(value: T, count?: number):GeneratedSequence; - - on(eventType: string):Sequence; - - readFile(path: string):StringLikeSequence; - makeHttpRequest(path: string):StringLikeSequence; - } - - interface ArrayLike { - length:number; - [index:number]:T; - } - - interface Callback { - ():void; - } - - interface ErrorCallback { - (error: any):void; - } - - interface ValueCallback { - (value: T):void; - } - - interface GetKeyCallback { - (value: T):string; - } - - interface TestCallback { - (value: T):boolean; - } - - interface MapCallback { - (value: T):U; - } - - interface MapStringCallback { - (value: string):string; - } - - interface NumberCallback { - (value: T):number; - } - - interface MemoCallback { - (memo: U, value: T):U; - } - - interface GeneratorCallback { - (index: number):T; - } - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - interface Iterator { - new (sequence: Sequence):Iterator; - current():T; - moveNext():boolean; - } - - interface GeneratedSequence extends Sequence { - new(generatorFn: GeneratorCallback, length: number):GeneratedSequence; - length():number; - } - - interface AsyncSequence extends SequenceBase { - each(callback: ValueCallback):AsyncHandle; - } - - interface AsyncHandle { - cancel():void; - onComplete(callback: Callback):void; - onError(callback: ErrorCallback):void; - } - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - module Sequence { - function define(methodName: string[], overrides: Object): Function; - } - - interface Sequence extends SequenceBase { - each(eachFn: ValueCallback):Sequence; - } - - interface SequenceBase extends SequenceBaser { - first():any; - first(count: number):Sequence; - indexOf(value: any, startIndex?: number):Sequence; - - last():any; - last(count: number):Sequence; - lastIndexOf(value: any):Sequence; - - reverse():Sequence; - } - - interface SequenceBaser { - // TODO improve define() (needs ugly overload) - async(interval: number):AsyncSequence; - chunk(size: number):Sequence; - compact():Sequence; - concat(var_args: T[]):Sequence; - consecutive(length: number):Sequence; - contains(value: T):boolean; - countBy(keyFn: GetKeyCallback): ObjectLikeSequence; - countBy(propertyName: string): ObjectLikeSequence; - dropWhile(predicateFn: TestCallback): Sequence; - every(predicateFn: TestCallback): boolean; - filter(predicateFn: TestCallback): Sequence; - find(predicateFn: TestCallback): Sequence; - findWhere(properties: Object): Sequence; - - flatten(): Sequence; - groupBy(keyFn: GetKeyCallback): ObjectLikeSequence; - initial(count?: number): Sequence; - intersection(var_args: T[]): Sequence; - invoke(methodName: string): Sequence; - isEmpty(): boolean; - join(delimiter?: string): string; - map(mapFn: MapCallback): Sequence; - - max(valueFn?: NumberCallback): T; - min(valueFn?: NumberCallback): T; - pluck(propertyName: string): Sequence; - reduce(aggregatorFn: MemoCallback, memo?: U): U; - reduceRight(aggregatorFn: MemoCallback, memo: U): U; - reject(predicateFn: TestCallback): Sequence; - rest(count?: number): Sequence; - shuffle(): Sequence; - some(predicateFn?: TestCallback): boolean; - sortBy(sortFn: NumberCallback): Sequence; - sortedIndex(value: T): Sequence; - sum(valueFn?: NumberCallback): Sequence; - takeWhile(predicateFn: TestCallback): Sequence; - union(var_args: T[]): Sequence; - uniq(): Sequence; - where(properties: Object): Sequence; - without(var_args: T[]): Sequence; - zip(var_args: T[]): Sequence; - - toArray(): T[]; - toObject(): Object; - } - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - module ArrayLikeSequence { - function define(methodName: string[], overrides: Object): Function; - } - - interface ArrayLikeSequence extends Sequence { - // define()X; - concat(): ArrayLikeSequence; - first(count?: number): ArrayLikeSequence; - get(index: number): T; - length(): number; - map(mapFn: MapCallback): ArrayLikeSequence; - pop(): ArrayLikeSequence; - rest(count?: number): ArrayLikeSequence; - reverse(): ArrayLikeSequence; - shift(): ArrayLikeSequence; - slice(begin: number, end?: number): ArrayLikeSequence; - } - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - module ObjectLikeSequence { - function define(methodName: string[], overrides: Object): Function; - } - - interface ObjectLikeSequence extends Sequence { - assign(other: Object): ObjectLikeSequence; - // throws error - //async(): X; - defaults(defaults: Object): ObjectLikeSequence; - functions(): Sequence; - get(property: string): ObjectLikeSequence; - invert(): ObjectLikeSequence; - keys(): Sequence; - omit(properties: string[]): ObjectLikeSequence; - pairs(): Sequence; - pick(properties: string[]): ObjectLikeSequence; - toArray(): T[]; - toObject(): Object; - values(): Sequence; - } - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - module StringLikeSequence { - function define(methodName: string[], overrides: Object): Function; - } - - interface StringLikeSequence extends SequenceBaser { - charAt(index: number): string; - charCodeAt(index: number): number; - contains(value: string): boolean; - endsWith(suffix: string): boolean; - - first(): string; - first(count: number): StringLikeSequence; - - indexOf(substring: string, startIndex?: number): number; - - last(): string; - last(count: number): StringLikeSequence; - - lastIndexOf(substring: string, startIndex?: number): number; - mapString(mapFn: MapStringCallback): StringLikeSequence; - match(pattern: RegExp): StringLikeSequence; - reverse(): StringLikeSequence; - - split(delimiter: string): StringLikeSequence; - split(delimiter: RegExp): StringLikeSequence; - - startsWith(prefix: string): boolean; - substring(start: number, stop?: number): StringLikeSequence; - toLowerCase(): StringLikeSequence; - toUpperCase(): StringLikeSequence; - } -} - -declare var Lazy: LazyJS.LazyStatic; - -declare module 'lazy.js' { -export = Lazy; -} - diff --git a/_infrastructure/tests/typings/node/node.d.ts b/_infrastructure/tests/typings/node/node.d.ts deleted file mode 100644 index dca0164b0..000000000 --- a/_infrastructure/tests/typings/node/node.d.ts +++ /dev/null @@ -1,1258 +0,0 @@ -// Type definitions for Node.js v0.10.1 -// Project: http://nodejs.org/ -// Definitions: https://github.com/borisyankov/DefinitelyTyped - -/************************************************ -* * -* Node.js v0.10.1 API * -* * -************************************************/ - -/************************************************ -* * -* GLOBAL * -* * -************************************************/ -declare var process: NodeProcess; -declare var global: any; - -declare var __filename: string; -declare var __dirname: string; - -declare function setTimeout(callback: (...args: any[]) => void , ms: number , ...args: any[]): NodeTimer; -declare function clearTimeout(timeoutId: NodeTimer): void; -declare function setInterval(callback: (...args: any[]) => void , ms: number , ...args: any[]): NodeTimer; -declare function clearInterval(intervalId: NodeTimer): void; -declare function setImmediate(callback: (...args: any[]) => void , ...args: any[]): any; -declare function clearImmediate(immediateId: any): void; - -declare var require: { - (id: string): any; - resolve(id:string): string; - cache: any; - extensions: any; - main: any; -} - -declare var module: { - exports: any; - require(id: string): any; - id: string; - filename: string; - loaded: boolean; - parent: any; - children: any[]; -} - -// Same as module.exports -declare var exports: any; -declare var SlowBuffer: { - new (str: string, encoding?: string): NodeBuffer; - new (size: number): NodeBuffer; - new (array: any[]): NodeBuffer; - prototype: NodeBuffer; - isBuffer(obj: any): boolean; - byteLength(string: string, encoding?: string): number; - concat(list: NodeBuffer[], totalLength?: number): NodeBuffer; -}; -declare var Buffer: { - new (str: string, encoding?: string): NodeBuffer; - new (size: number): NodeBuffer; - new (array: any[]): NodeBuffer; - prototype: NodeBuffer; - isBuffer(obj: any): boolean; - byteLength(string: string, encoding?: string): number; - concat(list: NodeBuffer[], totalLength?: number): NodeBuffer; -} - -/************************************************ -* * -* INTERFACES * -* * -************************************************/ - -interface ErrnoException extends Error { - errno?: any; - code?: string; - path?: string; - syscall?: string; -} - -interface NodeEventEmitter { - addListener(event: string, listener: Function): NodeEventEmitter; - on(event: string, listener: Function): NodeEventEmitter; - once(event: string, listener: Function): NodeEventEmitter; - removeListener(event: string, listener: Function): NodeEventEmitter; - removeAllListeners(event?: string): NodeEventEmitter; - setMaxListeners(n: number): void; - listeners(event: string): Function[]; - emit(event: string, ...args: any[]): boolean; -} - -interface ReadableStream extends NodeEventEmitter { - readable: boolean; - read(size?: number): any; - setEncoding(encoding: string): void; - pause(): void; - resume(): void; - pipe(destination: T, options?: { end?: boolean; }): T; - unpipe(destination?: T): void; - unshift(chunk: string): void; - unshift(chunk: NodeBuffer): void; - wrap(oldStream: ReadableStream): ReadableStream; -} - -interface WritableStream extends NodeEventEmitter { - writable: boolean; - write(buffer: NodeBuffer, cb?: Function): boolean; - write(str: string, cb?: Function): boolean; - write(str: string, encoding?: string, cb?: Function): boolean; - end(): void; - end(buffer: NodeBuffer, cb?: Function): void; - end(str: string, cb?: Function): void; - end(str: string, encoding?: string, cb?: Function): void; -} - -interface ReadWriteStream extends ReadableStream, WritableStream { } - -interface NodeProcess extends NodeEventEmitter { - stdout: WritableStream; - stderr: WritableStream; - stdin: ReadableStream; - argv: string[]; - execPath: string; - abort(): void; - chdir(directory: string): void; - cwd(): string; - env: any; - exit(code?: number): void; - getgid(): number; - setgid(id: number): void; - setgid(id: string): void; - getuid(): number; - setuid(id: number): void; - setuid(id: string): void; - version: string; - versions: { http_parser: string; node: string; v8: string; ares: string; uv: string; zlib: string; openssl: string; }; - config: { - target_defaults: { - cflags: any[]; - default_configuration: string; - defines: string[]; - include_dirs: string[]; - libraries: string[]; - }; - variables: { - clang: number; - host_arch: string; - node_install_npm: boolean; - node_install_waf: boolean; - node_prefix: string; - node_shared_openssl: boolean; - node_shared_v8: boolean; - node_shared_zlib: boolean; - node_use_dtrace: boolean; - node_use_etw: boolean; - node_use_openssl: boolean; - target_arch: string; - v8_no_strict_aliasing: number; - v8_use_snapshot: boolean; - visibility: string; - }; - }; - kill(pid: number, signal?: string): void; - pid: number; - title: string; - arch: string; - platform: string; - memoryUsage(): { rss: number; heapTotal: number; heapUsed: number; }; - nextTick(callback: Function): void; - umask(mask?: number): number; - uptime(): number; - hrtime(time?:number[]): number[]; - - // Worker - send?(message: any, sendHandle?: any): void; -} - -// Buffer class -interface NodeBuffer { - [index: number]: number; - write(string: string, offset?: number, length?: number, encoding?: string): number; - toString(encoding?: string, start?: number, end?: number): string; - length: number; - copy(targetBuffer: NodeBuffer, targetStart?: number, sourceStart?: number, sourceEnd?: number): number; - slice(start?: number, end?: number): NodeBuffer; - readUInt8(offset: number, noAsset?: boolean): number; - readUInt16LE(offset: number, noAssert?: boolean): number; - readUInt16BE(offset: number, noAssert?: boolean): number; - readUInt32LE(offset: number, noAssert?: boolean): number; - readUInt32BE(offset: number, noAssert?: boolean): number; - readInt8(offset: number, noAssert?: boolean): number; - readInt16LE(offset: number, noAssert?: boolean): number; - readInt16BE(offset: number, noAssert?: boolean): number; - readInt32LE(offset: number, noAssert?: boolean): number; - readInt32BE(offset: number, noAssert?: boolean): number; - readFloatLE(offset: number, noAssert?: boolean): number; - readFloatBE(offset: number, noAssert?: boolean): number; - readDoubleLE(offset: number, noAssert?: boolean): number; - readDoubleBE(offset: number, noAssert?: boolean): number; - writeUInt8(value: number, offset: number, noAssert?: boolean): void; - writeUInt16LE(value: number, offset: number, noAssert?: boolean): void; - writeUInt16BE(value: number, offset: number, noAssert?: boolean): void; - writeUInt32LE(value: number, offset: number, noAssert?: boolean): void; - writeUInt32BE(value: number, offset: number, noAssert?: boolean): void; - writeInt8(value: number, offset: number, noAssert?: boolean): void; - writeInt16LE(value: number, offset: number, noAssert?: boolean): void; - writeInt16BE(value: number, offset: number, noAssert?: boolean): void; - writeInt32LE(value: number, offset: number, noAssert?: boolean): void; - writeInt32BE(value: number, offset: number, noAssert?: boolean): void; - writeFloatLE(value: number, offset: number, noAssert?: boolean): void; - writeFloatBE(value: number, offset: number, noAssert?: boolean): void; - writeDoubleLE(value: number, offset: number, noAssert?: boolean): void; - writeDoubleBE(value: number, offset: number, noAssert?: boolean): void; - fill(value: any, offset?: number, end?: number): void; -} - -interface NodeTimer { - ref() : void; - unref() : void; -} - -/************************************************ -* * -* MODULES * -* * -************************************************/ -declare module "querystring" { - export function stringify(obj: any, sep?: string, eq?: string): string; - export function parse(str: string, sep?: string, eq?: string, options?: { maxKeys?: number; }): any; - export function escape(): any; - export function unescape(): any; -} - -declare module "events" { - export class EventEmitter implements NodeEventEmitter { - static listenerCount(emitter: EventEmitter, event: string): number; - - addListener(event: string, listener: Function): EventEmitter; - on(event: string, listener: Function): EventEmitter; - once(event: string, listener: Function): EventEmitter; - removeListener(event: string, listener: Function): EventEmitter; - removeAllListeners(event?: string): EventEmitter; - setMaxListeners(n: number): void; - listeners(event: string): Function[]; - emit(event: string, ...args: any[]): boolean; - } -} - -declare module "http" { - import events = require("events"); - import net = require("net"); - import stream = require("stream"); - - export interface Server extends NodeEventEmitter { - listen(port: number, hostname?: string, backlog?: number, callback?: Function): void; - listen(path: string, callback?: Function): void; - listen(handle: any, listeningListener?: Function): void; - close(cb?: any): void; - maxHeadersCount: number; - } - export interface ServerRequest extends NodeEventEmitter, ReadableStream { - method: string; - url: string; - headers: any; - trailers: string; - httpVersion: string; - setEncoding(encoding?: string): void; - pause(): void; - resume(): void; - connection: net.NodeSocket; - } - export interface ServerResponse extends NodeEventEmitter, WritableStream { - // Extended base methods - write(buffer: NodeBuffer): boolean; - write(buffer: NodeBuffer, cb?: Function): boolean; - write(str: string, cb?: Function): boolean; - write(str: string, encoding?: string, cb?: Function): boolean; - write(str: string, encoding?: string, fd?: string): boolean; - - writeContinue(): void; - writeHead(statusCode: number, reasonPhrase?: string, headers?: any): void; - writeHead(statusCode: number, headers?: any): void; - statusCode: number; - setHeader(name: string, value: string): void; - sendDate: boolean; - getHeader(name: string): string; - removeHeader(name: string): void; - write(chunk: any, encoding?: string): any; - addTrailers(headers: any): void; - - // Extended base methods - end(): void; - end(buffer: NodeBuffer, cb?: Function): void; - end(str: string, cb?: Function): void; - end(str: string, encoding?: string, cb?: Function): void; - end(data?: any, encoding?: string): void; - } - export interface ClientRequest extends NodeEventEmitter, WritableStream { - // Extended base methods - write(buffer: NodeBuffer): boolean; - write(buffer: NodeBuffer, cb?: Function): boolean; - write(str: string, cb?: Function): boolean; - write(str: string, encoding?: string, cb?: Function): boolean; - write(str: string, encoding?: string, fd?: string): boolean; - - write(chunk: any, encoding?: string): void; - abort(): void; - setTimeout(timeout: number, callback?: Function): void; - setNoDelay(noDelay?: Function): void; - setSocketKeepAlive(enable?: boolean, initialDelay?: number): void; - - // Extended base methods - end(): void; - end(buffer: NodeBuffer, cb?: Function): void; - end(str: string, cb?: Function): void; - end(str: string, encoding?: string, cb?: Function): void; - end(data?: any, encoding?: string): void; - } - export interface ClientResponse extends NodeEventEmitter, ReadableStream { - statusCode: number; - httpVersion: string; - headers: any; - trailers: any; - setEncoding(encoding?: string): void; - pause(): void; - resume(): void; - } - export interface Agent { maxSockets: number; sockets: any; requests: any; } - - export var STATUS_CODES: any; - export function createServer(requestListener?: (request: ServerRequest, response: ServerResponse) =>void ): Server; - export function createClient(port?: number, host?: string): any; - export function request(options: any, callback?: Function): ClientRequest; - export function get(options: any, callback?: Function): ClientRequest; - export var globalAgent: Agent; -} - -declare module "cluster" { - import child = require("child_process"); - import events = require("events"); - - export interface ClusterSettings { - exec?: string; - args?: string[]; - silent?: boolean; - } - - export class Worker extends events.EventEmitter { - id: string; - process: child.ChildProcess; - suicide: boolean; - send(message: any, sendHandle?: any): void; - kill(signal?: string): void; - destroy(signal?: string): void; - disconnect(): void; - } - - export var settings: ClusterSettings; - export var isMaster: boolean; - export var isWorker: boolean; - export function setupMaster(settings?: ClusterSettings): void; - export function fork(env?: any): Worker; - export function disconnect(callback?: Function): void; - export var worker: Worker; - export var workers: Worker[]; - - // Event emitter - export function addListener(event: string, listener: Function): void; - export function on(event: string, listener: Function): any; - export function once(event: string, listener: Function): void; - export function removeListener(event: string, listener: Function): void; - export function removeAllListeners(event?: string): void; - export function setMaxListeners(n: number): void; - export function listeners(event: string): Function[]; - export function emit(event: string, ...args: any[]): boolean; -} - -declare module "zlib" { - import stream = require("stream"); - export interface ZlibOptions { chunkSize?: number; windowBits?: number; level?: number; memLevel?: number; strategy?: number; dictionary?: any; } - - export interface Gzip extends ReadWriteStream { } - export interface Gunzip extends ReadWriteStream { } - export interface Deflate extends ReadWriteStream { } - export interface Inflate extends ReadWriteStream { } - export interface DeflateRaw extends ReadWriteStream { } - export interface InflateRaw extends ReadWriteStream { } - export interface Unzip extends ReadWriteStream { } - - export function createGzip(options?: ZlibOptions): Gzip; - export function createGunzip(options?: ZlibOptions): Gunzip; - export function createDeflate(options?: ZlibOptions): Deflate; - export function createInflate(options?: ZlibOptions): Inflate; - export function createDeflateRaw(options?: ZlibOptions): DeflateRaw; - export function createInflateRaw(options?: ZlibOptions): InflateRaw; - export function createUnzip(options?: ZlibOptions): Unzip; - - export function deflate(buf: NodeBuffer, callback: (error: Error, result: any) =>void ): void; - export function deflateRaw(buf: NodeBuffer, callback: (error: Error, result: any) =>void ): void; - export function gzip(buf: NodeBuffer, callback: (error: Error, result: any) =>void ): void; - export function gunzip(buf: NodeBuffer, callback: (error: Error, result: any) =>void ): void; - export function inflate(buf: NodeBuffer, callback: (error: Error, result: any) =>void ): void; - export function inflateRaw(buf: NodeBuffer, callback: (error: Error, result: any) =>void ): void; - export function unzip(buf: NodeBuffer, callback: (error: Error, result: any) =>void ): void; - - // Constants - export var Z_NO_FLUSH: number; - export var Z_PARTIAL_FLUSH: number; - export var Z_SYNC_FLUSH: number; - export var Z_FULL_FLUSH: number; - export var Z_FINISH: number; - export var Z_BLOCK: number; - export var Z_TREES: number; - export var Z_OK: number; - export var Z_STREAM_END: number; - export var Z_NEED_DICT: number; - export var Z_ERRNO: number; - export var Z_STREAM_ERROR: number; - export var Z_DATA_ERROR: number; - export var Z_MEM_ERROR: number; - export var Z_BUF_ERROR: number; - export var Z_VERSION_ERROR: number; - export var Z_NO_COMPRESSION: number; - export var Z_BEST_SPEED: number; - export var Z_BEST_COMPRESSION: number; - export var Z_DEFAULT_COMPRESSION: number; - export var Z_FILTERED: number; - export var Z_HUFFMAN_ONLY: number; - export var Z_RLE: number; - export var Z_FIXED: number; - export var Z_DEFAULT_STRATEGY: number; - export var Z_BINARY: number; - export var Z_TEXT: number; - export var Z_ASCII: number; - export var Z_UNKNOWN: number; - export var Z_DEFLATED: number; - export var Z_NULL: number; -} - -declare module "os" { - export function tmpDir(): string; - export function hostname(): string; - export function type(): string; - export function platform(): string; - export function arch(): string; - export function release(): string; - export function uptime(): number; - export function loadavg(): number[]; - export function totalmem(): number; - export function freemem(): number; - export function cpus(): { model: string; speed: number; times: { user: number; nice: number; sys: number; idle: number; irq: number; }; }[]; - export function networkInterfaces(): any; - export var EOL: string; -} - -declare module "https" { - import tls = require("tls"); - import events = require("events"); - import http = require("http"); - - export interface ServerOptions { - pfx?: any; - key?: any; - passphrase?: string; - cert?: any; - ca?: any; - crl?: any; - ciphers?: string; - honorCipherOrder?: boolean; - requestCert?: boolean; - rejectUnauthorized?: boolean; - NPNProtocols?: any; - SNICallback?: (servername: string) => any; - } - - export interface RequestOptions { - host?: string; - hostname?: string; - port?: number; - path?: string; - method?: string; - headers?: any; - auth?: string; - agent?: any; - pfx?: any; - key?: any; - passphrase?: string; - cert?: any; - ca?: any; - ciphers?: string; - rejectUnauthorized?: boolean; - } - - export interface NodeAgent { - maxSockets: number; - sockets: any; - requests: any; - } - export var Agent: { - new (options?: RequestOptions): NodeAgent; - }; - export interface Server extends tls.Server { } - export function createServer(options: ServerOptions, requestListener?: Function): Server; - export function request(options: RequestOptions, callback?: (res: NodeEventEmitter) =>void ): http.ClientRequest; - export function get(options: RequestOptions, callback?: (res: NodeEventEmitter) =>void ): http.ClientRequest; - export var globalAgent: NodeAgent; -} - -declare module "punycode" { - export function decode(string: string): string; - export function encode(string: string): string; - export function toUnicode(domain: string): string; - export function toASCII(domain: string): string; - export var ucs2: ucs2; - interface ucs2 { - decode(string: string): string; - encode(codePoints: number[]): string; - } - export var version: any; -} - -declare module "repl" { - import stream = require("stream"); - import events = require("events"); - - export interface ReplOptions { - prompt?: string; - input?: ReadableStream; - output?: WritableStream; - terminal?: boolean; - eval?: Function; - useColors?: boolean; - useGlobal?: boolean; - ignoreUndefined?: boolean; - writer?: Function; - } - export function start(options: ReplOptions): NodeEventEmitter; -} - -declare module "readline" { - import events = require("events"); - import stream = require("stream"); - - export interface ReadLine extends NodeEventEmitter { - setPrompt(prompt: string, length: number): void; - prompt(preserveCursor?: boolean): void; - question(query: string, callback: Function): void; - pause(): void; - resume(): void; - close(): void; - write(data: any, key?: any): void; - } - export interface ReadLineOptions { - input: ReadableStream; - output: WritableStream; - completer?: Function; - terminal?: boolean; - } - export function createInterface(options: ReadLineOptions): ReadLine; -} - -declare module "vm" { - export interface Context { } - export interface Script { - runInThisContext(): void; - runInNewContext(sandbox?: Context): void; - } - export function runInThisContext(code: string, filename?: string): void; - export function runInNewContext(code: string, sandbox?: Context, filename?: string): void; - export function runInContext(code: string, context: Context, filename?: string): void; - export function createContext(initSandbox?: Context): Context; - export function createScript(code: string, filename?: string): Script; -} - -declare module "child_process" { - import events = require("events"); - import stream = require("stream"); - - export interface ChildProcess extends NodeEventEmitter { - stdin: WritableStream; - stdout: ReadableStream; - stderr: ReadableStream; - pid: number; - kill(signal?: string): void; - send(message: any, sendHandle: any): void; - disconnect(): void; - } - - export function spawn(command: string, args?: string[], options?: { - cwd?: string; - stdio?: any; - custom?: any; - env?: any; - detached?: boolean; - }): ChildProcess; - export function exec(command: string, options: { - cwd?: string; - stdio?: any; - customFds?: any; - env?: any; - encoding?: string; - timeout?: number; - maxBuffer?: number; - killSignal?: string; - }, callback: (error: Error, stdout: NodeBuffer, stderr: NodeBuffer) =>void ): ChildProcess; - export function exec(command: string, callback: (error: Error, stdout: NodeBuffer, stderr: NodeBuffer) =>void ): ChildProcess; - export function execFile(file: string, args: string[], options: { - cwd?: string; - stdio?: any; - customFds?: any; - env?: any; - encoding?: string; - timeout?: number; - maxBuffer?: string; - killSignal?: string; - }, callback: (error: Error, stdout: NodeBuffer, stderr: NodeBuffer) =>void ): ChildProcess; - export function fork(modulePath: string, args?: string[], options?: { - cwd?: string; - env?: any; - encoding?: string; - }): ChildProcess; -} - -declare module "url" { - export interface Url { - href: string; - protocol: string; - auth: string; - hostname: string; - port: string; - host: string; - pathname: string; - search: string; - query: string; - slashes: boolean; - } - - export interface UrlOptions { - protocol?: string; - auth?: string; - hostname?: string; - port?: string; - host?: string; - pathname?: string; - search?: string; - query?: any; - } - - export function parse(urlStr: string, parseQueryString?: boolean , slashesDenoteHost?: boolean ): Url; - export function format(url: UrlOptions): string; - export function resolve(from: string, to: string): string; -} - -declare module "dns" { - export function lookup(domain: string, family: number, callback: (err: Error, address: string, family: number) =>void ): string; - export function lookup(domain: string, callback: (err: Error, address: string, family: number) =>void ): string; - export function resolve(domain: string, rrtype: string, callback: (err: Error, addresses: string[]) =>void ): string[]; - export function resolve(domain: string, callback: (err: Error, addresses: string[]) =>void ): string[]; - export function resolve4(domain: string, callback: (err: Error, addresses: string[]) =>void ): string[]; - export function resolve6(domain: string, callback: (err: Error, addresses: string[]) =>void ): string[]; - export function resolveMx(domain: string, callback: (err: Error, addresses: string[]) =>void ): string[]; - export function resolveTxt(domain: string, callback: (err: Error, addresses: string[]) =>void ): string[]; - export function resolveSrv(domain: string, callback: (err: Error, addresses: string[]) =>void ): string[]; - export function resolveNs(domain: string, callback: (err: Error, addresses: string[]) =>void ): string[]; - export function resolveCname(domain: string, callback: (err: Error, addresses: string[]) =>void ): string[]; - export function reverse(ip: string, callback: (err: Error, domains: string[]) =>void ): string[]; -} - -declare module "net" { - import stream = require("stream"); - - export interface NodeSocket extends ReadWriteStream { - // Extended base methods - write(buffer: NodeBuffer): boolean; - write(buffer: NodeBuffer, cb?: Function): boolean; - write(str: string, cb?: Function): boolean; - write(str: string, encoding?: string, cb?: Function): boolean; - write(str: string, encoding?: string, fd?: string): boolean; - - connect(port: number, host?: string, connectionListener?: Function): void; - connect(path: string, connectionListener?: Function): void; - bufferSize: number; - setEncoding(encoding?: string): void; - write(data: any, encoding?: string, callback?: Function): void; - destroy(): void; - pause(): void; - resume(): void; - setTimeout(timeout: number, callback?: Function): void; - setNoDelay(noDelay?: boolean): void; - setKeepAlive(enable?: boolean, initialDelay?: number): void; - address(): { port: number; family: string; address: string; }; - remoteAddress: string; - remotePort: number; - bytesRead: number; - bytesWritten: number; - - // Extended base methods - end(): void; - end(buffer: NodeBuffer, cb?: Function): void; - end(str: string, cb?: Function): void; - end(str: string, encoding?: string, cb?: Function): void; - end(data?: any, encoding?: string): void; - } - - export var Socket: { - new (options?: { fd?: string; type?: string; allowHalfOpen?: boolean; }): NodeSocket; - }; - - export interface Server extends NodeSocket { - listen(port: number, host?: string, backlog?: number, listeningListener?: Function): void; - listen(path: string, listeningListener?: Function): void; - listen(handle: any, listeningListener?: Function): void; - close(callback?: Function): void; - address(): { port: number; family: string; address: string; }; - maxConnections: number; - connections: number; - } - export function createServer(connectionListener?: (socket: NodeSocket) =>void ): Server; - export function createServer(options?: { allowHalfOpen?: boolean; }, connectionListener?: (socket: NodeSocket) =>void ): Server; - export function connect(options: { allowHalfOpen?: boolean; }, connectionListener?: Function): NodeSocket; - export function connect(port: number, host?: string, connectionListener?: Function): NodeSocket; - export function connect(path: string, connectionListener?: Function): NodeSocket; - export function createConnection(options: { allowHalfOpen?: boolean; }, connectionListener?: Function): NodeSocket; - export function createConnection(port: number, host?: string, connectionListener?: Function): NodeSocket; - export function createConnection(path: string, connectionListener?: Function): NodeSocket; - export function isIP(input: string): number; - export function isIPv4(input: string): boolean; - export function isIPv6(input: string): boolean; -} - -declare module "dgram" { - import events = require("events"); - - export function createSocket(type: string, callback?: Function): Socket; - - interface Socket extends NodeEventEmitter { - send(buf: NodeBuffer, offset: number, length: number, port: number, address: string, callback?: Function): void; - bind(port: number, address?: string): void; - close(): void; - address: { address: string; family: string; port: number; }; - setBroadcast(flag: boolean): void; - setMulticastTTL(ttl: number): void; - setMulticastLoopback(flag: boolean): void; - addMembership(multicastAddress: string, multicastInterface?: string): void; - dropMembership(multicastAddress: string, multicastInterface?: string): void; - } -} - -declare module "fs" { - import stream = require("stream"); - - interface Stats { - isFile(): boolean; - isDirectory(): boolean; - isBlockDevice(): boolean; - isCharacterDevice(): boolean; - isSymbolicLink(): boolean; - isFIFO(): boolean; - isSocket(): boolean; - dev: number; - ino: number; - mode: number; - nlink: number; - uid: number; - gid: number; - rdev: number; - size: number; - blksize: number; - blocks: number; - atime: Date; - mtime: Date; - ctime: Date; - } - - interface FSWatcher extends NodeEventEmitter { - close(): void; - } - - export interface ReadStream extends ReadableStream { } - export interface WriteStream extends WritableStream { } - - export function rename(oldPath: string, newPath: string, callback?: (err?: ErrnoException) => void): void; - export function renameSync(oldPath: string, newPath: string): void; - export function truncate(path: string, callback?: (err?: ErrnoException) => void): void; - export function truncate(path: string, len: number, callback?: (err?: ErrnoException) => void): void; - export function truncateSync(path: string, len?: number): void; - export function ftruncate(fd: number, callback?: (err?: ErrnoException) => void): void; - export function ftruncate(fd: number, len: number, callback?: (err?: ErrnoException) => void): void; - export function ftruncateSync(fd: number, len?: number): void; - export function chown(path: string, uid: number, gid: number, callback?: (err?: ErrnoException) => void): void; - export function chownSync(path: string, uid: number, gid: number): void; - export function fchown(fd: number, uid: number, gid: number, callback?: (err?: ErrnoException) => void): void; - export function fchownSync(fd: number, uid: number, gid: number): void; - export function lchown(path: string, uid: number, gid: number, callback?: (err?: ErrnoException) => void): void; - export function lchownSync(path: string, uid: number, gid: number): void; - export function chmod(path: string, mode: number, callback?: (err?: ErrnoException) => void): void; - export function chmod(path: string, mode: string, callback?: (err?: ErrnoException) => void): void; - export function chmodSync(path: string, mode: number): void; - export function chmodSync(path: string, mode: string): void; - export function fchmod(fd: number, mode: number, callback?: (err?: ErrnoException) => void): void; - export function fchmod(fd: number, mode: string, callback?: (err?: ErrnoException) => void): void; - export function fchmodSync(fd: number, mode: number): void; - export function fchmodSync(fd: number, mode: string): void; - export function lchmod(path: string, mode: number, callback?: (err?: ErrnoException) => void): void; - export function lchmod(path: string, mode: string, callback?: (err?: ErrnoException) => void): void; - export function lchmodSync(path: string, mode: number): void; - export function lchmodSync(path: string, mode: string): void; - export function stat(path: string, callback?: (err: ErrnoException, stats: Stats) => any): void; - export function lstat(path: string, callback?: (err: ErrnoException, stats: Stats) => any): void; - export function fstat(fd: number, callback?: (err: ErrnoException, stats: Stats) => any): void; - export function statSync(path: string): Stats; - export function lstatSync(path: string): Stats; - export function fstatSync(fd: number): Stats; - export function link(srcpath: string, dstpath: string, callback?: (err?: ErrnoException) => void): void; - export function linkSync(srcpath: string, dstpath: string): void; - export function symlink(srcpath: string, dstpath: string, type?: string, callback?: (err?: ErrnoException) => void): void; - export function symlinkSync(srcpath: string, dstpath: string, type?: string): void; - export function readlink(path: string, callback?: (err: ErrnoException, linkString: string) => any): void; - export function readlinkSync(path: string): string; - export function realpath(path: string, callback?: (err: ErrnoException, resolvedPath: string) => any): void; - export function realpath(path: string, cache: {[path: string]: string}, callback: (err: ErrnoException, resolvedPath: string) =>any): void; - export function realpathSync(path: string, cache?: {[path: string]: string}): void; - export function unlink(path: string, callback?: (err?: ErrnoException) => void): void; - export function unlinkSync(path: string): void; - export function rmdir(path: string, callback?: (err?: ErrnoException) => void): void; - export function rmdirSync(path: string): void; - export function mkdir(path: string, callback?: (err?: ErrnoException) => void): void; - export function mkdir(path: string, mode: number, callback?: (err?: ErrnoException) => void): void; - export function mkdir(path: string, mode: string, callback?: (err?: ErrnoException) => void): void; - export function mkdirSync(path: string, mode?: number): void; - export function mkdirSync(path: string, mode?: string): void; - export function readdir(path: string, callback?: (err: ErrnoException, files: string[]) => void): void; - export function readdirSync(path: string): string[]; - export function close(fd: number, callback?: (err?: ErrnoException) => void): void; - export function closeSync(fd: number): void; - export function open(path: string, flags: string, callback?: (err: ErrnoException, fd: number) => any): void; - export function open(path: string, flags: string, mode: number, callback?: (err: ErrnoException, fd: number) => any): void; - export function open(path: string, flags: string, mode: string, callback?: (err: ErrnoException, fd: number) => any): void; - export function openSync(path: string, flags: string, mode?: number): number; - export function openSync(path: string, flags: string, mode?: string): number; - export function utimes(path: string, atime: number, mtime: number, callback?: (err?: ErrnoException) => void): void; - export function utimesSync(path: string, atime: number, mtime: number): void; - export function futimes(fd: number, atime: number, mtime: number, callback?: (err?: ErrnoException) => void): void; - export function futimesSync(fd: number, atime: number, mtime: number): void; - export function fsync(fd: number, callback?: (err?: ErrnoException) => void): void; - export function fsyncSync(fd: number): void; - export function write(fd: number, buffer: NodeBuffer, offset: number, length: number, position: number, callback?: (err: ErrnoException, written: number, buffer: NodeBuffer) => void): void; - export function writeSync(fd: number, buffer: NodeBuffer, offset: number, length: number, position: number): number; - export function read(fd: number, buffer: NodeBuffer, offset: number, length: number, position: number, callback?: (err: ErrnoException, bytesRead: number, buffer: NodeBuffer) => void): void; - export function readSync(fd: number, buffer: NodeBuffer, offset: number, length: number, position: number): number; - export function readFile(filename: string, options: { encoding?: string; flag?: string; }, callback: (err: ErrnoException, data: any) => void): void; - export function readFile(filename: string, callback: (err: ErrnoException, data: NodeBuffer) => void ): void; - export function readFileSync(filename: string, options?: { flag?: string; }): NodeBuffer; - export function readFileSync(filename: string, options: { encoding: string; flag?: string; }): string; - export function writeFile(filename: string, data: any, callback?: (err: ErrnoException) => void): void; - export function writeFile(filename: string, data: any, options: { encoding?: string; mode?: number; flag?: string; }, callback?: (err: ErrnoException) => void): void; - export function writeFile(filename: string, data: any, options: { encoding?: string; mode?: string; flag?: string; }, callback?: (err: ErrnoException) => void): void; - export function writeFileSync(filename: string, data: any, options?: { encoding?: string; mode?: number; flag?: string; }): void; - export function writeFileSync(filename: string, data: any, options?: { encoding?: string; mode?: string; flag?: string; }): void; - export function appendFile(filename: string, data: any, options: { encoding?: string; mode?: number; flag?: string; }, callback?: (err: ErrnoException) => void): void; - export function appendFile(filename: string, data: any, options: { encoding?: string; mode?: string; flag?: string; }, callback?: (err: ErrnoException) => void): void; - export function appendFile(filename: string, data: any, callback?: (err: ErrnoException) => void): void; - export function appendFileSync(filename: string, data: any, options?: { encoding?: string; mode?: number; flag?: string; }): void; - export function appendFileSync(filename: string, data: any, options?: { encoding?: string; mode?: string; flag?: string; }): void; - export function watchFile(filename: string, listener: (curr: Stats, prev: Stats) => void): void; - export function watchFile(filename: string, options: { persistent?: boolean; interval?: number; }, listener: (curr: Stats, prev: Stats) => void): void; - export function unwatchFile(filename: string, listener?: (curr: Stats, prev: Stats) => void): void; - export function watch(filename: string, listener?: (event: string, filename: string) => any): FSWatcher; - export function watch(filename: string, options: { persistent?: boolean; }, listener?: (event: string, filename: string) => any): FSWatcher; - export function exists(path: string, callback?: (exists: boolean) => void): void; - export function existsSync(path: string): boolean; - export function createReadStream(path: string, options?: { - flags?: string; - encoding?: string; - fd?: string; - mode?: number; - bufferSize?: number; - }): ReadStream; - export function createReadStream(path: string, options?: { - flags?: string; - encoding?: string; - fd?: string; - mode?: string; - bufferSize?: number; - }): ReadStream; - export function createWriteStream(path: string, options?: { - flags?: string; - encoding?: string; - string?: string; - }): WriteStream; -} - -declare module "path" { - export function normalize(p: string): string; - export function join(...paths: any[]): string; - export function resolve(...pathSegments: any[]): string; - export function relative(from: string, to: string): string; - export function dirname(p: string): string; - export function basename(p: string, ext?: string): string; - export function extname(p: string): string; - export var sep: string; -} - -declare module "string_decoder" { - export interface NodeStringDecoder { - write(buffer: NodeBuffer): string; - detectIncompleteChar(buffer: NodeBuffer): number; - } - export var StringDecoder: { - new (encoding: string): NodeStringDecoder; - }; -} - -declare module "tls" { - import crypto = require("crypto"); - import net = require("net"); - import stream = require("stream"); - - var CLIENT_RENEG_LIMIT: number; - var CLIENT_RENEG_WINDOW: number; - - export interface TlsOptions { - pfx?: any; //string or buffer - key?: any; //string or buffer - passphrase?: string; - cert?: any; - ca?: any; //string or buffer - crl?: any; //string or string array - ciphers?: string; - honorCipherOrder?: any; - requestCert?: boolean; - rejectUnauthorized?: boolean; - NPNProtocols?: any; //array or Buffer; - SNICallback?: (servername: string) => any; - } - - export interface ConnectionOptions { - host?: string; - port?: number; - socket?: net.NodeSocket; - pfx?: any; //string | Buffer - key?: any; //string | Buffer - passphrase?: string; - cert?: any; //string | Buffer - ca?: any; //Array of string | Buffer - rejectUnauthorized?: boolean; - NPNProtocols?: any; //Array of string | Buffer - servername?: string; - } - - export interface Server extends net.Server { - // Extended base methods - listen(port: number, host?: string, backlog?: number, listeningListener?: Function): void; - listen(path: string, listeningListener?: Function): void; - listen(handle: any, listeningListener?: Function): void; - - listen(port: number, host?: string, callback?: Function): void; - close(): void; - address(): { port: number; family: string; address: string; }; - addContext(hostName: string, credentials: { - key: string; - cert: string; - ca: string; - }): void; - maxConnections: number; - connections: number; - } - - export interface ClearTextStream extends ReadWriteStream { - authorized: boolean; - authorizationError: Error; - getPeerCertificate(): any; - getCipher: { - name: string; - version: string; - }; - address: { - port: number; - family: string; - address: string; - }; - remoteAddress: string; - remotePort: number; - } - - export interface SecurePair { - encrypted: any; - cleartext: any; - } - - export function createServer(options: TlsOptions, secureConnectionListener?: (cleartextStream: ClearTextStream) =>void ): Server; - export function connect(options: TlsOptions, secureConnectionListener?: () =>void ): ClearTextStream; - export function connect(port: number, host?: string, options?: ConnectionOptions, secureConnectListener?: () =>void ): ClearTextStream; - export function connect(port: number, options?: ConnectionOptions, secureConnectListener?: () =>void ): ClearTextStream; - export function createSecurePair(credentials?: crypto.Credentials, isServer?: boolean, requestCert?: boolean, rejectUnauthorized?: boolean): SecurePair; -} - -declare module "crypto" { - export interface CredentialDetails { - pfx: string; - key: string; - passphrase: string; - cert: string; - ca: any; //string | string array - crl: any; //string | string array - ciphers: string; - } - export interface Credentials { context?: any; } - export function createCredentials(details: CredentialDetails): Credentials; - export function createHash(algorithm: string): Hash; - export function createHmac(algorithm: string, key: string): Hmac; - interface Hash { - update(data: any, input_encoding?: string): Hash; - digest(encoding?: string): string; - } - interface Hmac { - update(data: any): void; - digest(encoding?: string): void; - } - export function createCipher(algorithm: string, password: any): Cipher; - export function createCipheriv(algorithm: string, key: any, iv: any): Cipher; - interface Cipher { - update(data: any, input_encoding?: string, output_encoding?: string): string; - final(output_encoding?: string): string; - setAutoPadding(auto_padding: boolean): void; - createDecipher(algorithm: string, password: any): Decipher; - createDecipheriv(algorithm: string, key: any, iv: any): Decipher; - } - interface Decipher { - update(data: any, input_encoding?: string, output_encoding?: string): void; - final(output_encoding?: string): string; - setAutoPadding(auto_padding: boolean): void; - } - export function createSign(algorithm: string): Signer; - interface Signer { - update(data: any): void; - sign(private_key: string, output_format: string): string; - } - export function createVerify(algorith: string): Verify; - interface Verify { - update(data: any): void; - verify(object: string, signature: string, signature_format?: string): boolean; - } - export function createDiffieHellman(prime_length: number): DiffieHellman; - export function createDiffieHellman(prime: number, encoding?: string): DiffieHellman; - interface DiffieHellman { - generateKeys(encoding?: string): string; - computeSecret(other_public_key: string, input_encoding?: string, output_encoding?: string): string; - getPrime(encoding?: string): string; - getGenerator(encoding: string): string; - getPublicKey(encoding?: string): string; - getPrivateKey(encoding?: string): string; - setPublicKey(public_key: string, encoding?: string): void; - setPrivateKey(public_key: string, encoding?: string): void; - } - export function getDiffieHellman(group_name: string): DiffieHellman; - export function pbkdf2(password: string, salt: string, iterations: number, keylen: number, callback: (err: Error, derivedKey: string) => any): void; - export function randomBytes(size: number): NodeBuffer; - export function randomBytes(size: number, callback: (err: Error, buf: NodeBuffer) =>void ): void; - export function pseudoRandomBytes(size: number): NodeBuffer; - export function pseudoRandomBytes(size: number, callback: (err: Error, buf: NodeBuffer) =>void ): void; -} - -declare module "stream" { - import events = require("events"); - - export interface ReadableOptions { - highWaterMark?: number; - encoding?: string; - objectMode?: boolean; - } - - export class Readable extends events.EventEmitter implements ReadableStream { - readable: boolean; - constructor(opts?: ReadableOptions); - _read(size: number): void; - read(size?: number): any; - setEncoding(encoding: string): void; - pause(): void; - resume(): void; - pipe(destination: T, options?: { end?: boolean; }): T; - unpipe(destination?: T): void; - unshift(chunk: string): void; - unshift(chunk: NodeBuffer): void; - wrap(oldStream: ReadableStream): ReadableStream; - push(chunk: any, encoding?: string): boolean; - } - - export interface WritableOptions { - highWaterMark?: number; - decodeStrings?: boolean; - } - - export class Writable extends events.EventEmitter implements WritableStream { - writable: boolean; - constructor(opts?: WritableOptions); - _write(data: NodeBuffer, encoding: string, callback: Function): void; - _write(data: string, encoding: string, callback: Function): void; - write(buffer: NodeBuffer, cb?: Function): boolean; - write(str: string, cb?: Function): boolean; - write(str: string, encoding?: string, cb?: Function): boolean; - end(): void; - end(buffer: NodeBuffer, cb?: Function): void; - end(str: string, cb?: Function): void; - end(str: string, encoding?: string, cb?: Function): void; - } - - export interface DuplexOptions extends ReadableOptions, WritableOptions { - allowHalfOpen?: boolean; - } - - // Note: Duplex extends both Readable and Writable. - export class Duplex extends Readable implements ReadWriteStream { - writable: boolean; - constructor(opts?: DuplexOptions); - _write(data: NodeBuffer, encoding: string, callback: Function): void; - _write(data: string, encoding: string, callback: Function): void; - write(buffer: NodeBuffer, cb?: Function): boolean; - write(str: string, cb?: Function): boolean; - write(str: string, encoding?: string, cb?: Function): boolean; - end(): void; - end(buffer: NodeBuffer, cb?: Function): void; - end(str: string, cb?: Function): void; - end(str: string, encoding?: string, cb?: Function): void; - } - - export interface TransformOptions extends ReadableOptions, WritableOptions {} - - // Note: Transform lacks the _read and _write methods of Readable/Writable. - export class Transform extends events.EventEmitter implements ReadWriteStream { - readable: boolean; - writable: boolean; - constructor(opts?: TransformOptions); - _transform(chunk: NodeBuffer, encoding: string, callback: Function): void; - _transform(chunk: string, encoding: string, callback: Function): void; - _flush(callback: Function): void; - read(size?: number): any; - setEncoding(encoding: string): void; - pause(): void; - resume(): void; - pipe(destination: T, options?: { end?: boolean; }): T; - unpipe(destination?: T): void; - unshift(chunk: string): void; - unshift(chunk: NodeBuffer): void; - wrap(oldStream: ReadableStream): ReadableStream; - push(chunk: any, encoding?: string): boolean; - write(buffer: NodeBuffer, cb?: Function): boolean; - write(str: string, cb?: Function): boolean; - write(str: string, encoding?: string, cb?: Function): boolean; - end(): void; - end(buffer: NodeBuffer, cb?: Function): void; - end(str: string, cb?: Function): void; - end(str: string, encoding?: string, cb?: Function): void; - } - - export class PassThrough extends Transform {} -} - -declare module "util" { - export interface InspectOptions { - showHidden?: boolean; - depth?: number; - colors?: boolean; - customInspect?: boolean; - } - - export function format(format: any, ...param: any[]): string; - export function debug(string: string): void; - export function error(...param: any[]): void; - export function puts(...param: any[]): void; - export function print(...param: any[]): void; - export function log(string: string): void; - export function inspect(object: any, showHidden?: boolean, depth?: number, color?: boolean): string; - export function inspect(object: any, options: InspectOptions): string; - export function isArray(object: any): boolean; - export function isRegExp(object: any): boolean; - export function isDate(object: any): boolean; - export function isError(object: any): boolean; - export function inherits(constructor: any, superConstructor: any): void; -} - -declare module "assert" { - function internal (value: any, message?: string): void; - module internal { - export class AssertionError implements Error { - name: string; - message: string; - actual: any; - expected: any; - operator: string; - generatedMessage: boolean; - - constructor(options?: {message?: string; actual?: any; expected?: any; - operator?: string; stackStartFunction?: Function}); - } - - export function fail(actual?: any, expected?: any, message?: string, operator?: string): void; - export function ok(value: any, message?: string): void; - export function equal(actual: any, expected: any, message?: string): void; - export function notEqual(actual: any, expected: any, message?: string): void; - export function deepEqual(actual: any, expected: any, message?: string): void; - export function notDeepEqual(acutal: any, expected: any, message?: string): void; - export function strictEqual(actual: any, expected: any, message?: string): void; - export function notStrictEqual(actual: any, expected: any, message?: string): void; - export var throws: { - (block: Function, message?: string): void; - (block: Function, error: Function, message?: string): void; - (block: Function, error: RegExp, message?: string): void; - (block: Function, error: (err: any) => boolean, message?: string): void; - } - - export var doesNotThrow: { - (block: Function, message?: string): void; - (block: Function, error: Function, message?: string): void; - (block: Function, error: RegExp, message?: string): void; - (block: Function, error: (err: any) => boolean, message?: string): void; - } - - export function ifError(value: any): void; - } - - export = internal; -} - -declare module "tty" { - import net = require("net"); - - export function isatty(fd: number): boolean; - export interface ReadStream extends net.NodeSocket { - isRaw: boolean; - setRawMode(mode: boolean): void; - } - export interface WriteStream extends net.NodeSocket { - columns: number; - rows: number; - } -} - -declare module "domain" { - import events = require("events"); - - export class Domain extends events.EventEmitter { - run(fn: Function): void; - add(emitter: NodeEventEmitter): void; - remove(emitter: NodeEventEmitter): void; - bind(cb: (err: Error, data: any) => any): any; - intercept(cb: (data: any) => any): any; - dispose(): void; - - addListener(event: string, listener: Function): Domain; - on(event: string, listener: Function): Domain; - once(event: string, listener: Function): Domain; - removeListener(event: string, listener: Function): Domain; - removeAllListeners(event?: string): Domain; - } - - export function create(): Domain; -} diff --git a/_infrastructure/tests/typings/optimist/optimist.d.ts b/_infrastructure/tests/typings/optimist/optimist.d.ts deleted file mode 100644 index d79dcfaf0..000000000 --- a/_infrastructure/tests/typings/optimist/optimist.d.ts +++ /dev/null @@ -1,48 +0,0 @@ -// https://github.com/substack/node-optimist -// sourced from https://github.com/soywiz/typescript-node-definitions/blob/master/optimist.d.ts -// rehacked by @Bartvds - -declare module Optimist { - export interface Argv { - _: string[]; - } - export interface Optimist { - default(name: string, value: any): Optimist; - default(args: any): Optimist; - - boolean(name: string): Optimist; - boolean(names: string[]): Optimist; - - string(name: string): Optimist; - string(names: string[]): Optimist; - - wrap(columns): Optimist; - - help(): Optimist; - showHelp(fn?: Function): Optimist; - - usage(message: string): Optimist; - - demand(key: string): Optimist; - demand(key: number): Optimist; - demand(key: string[]): Optimist; - - alias(key: string, alias: string): Optimist; - - describe(key: string, desc: string): Optimist; - - options(key: string, opt: any): Optimist; - - check(fn: Function); - - parse(args: string[]): Optimist; - - argv: Argv; - } -} -interface Optimist extends Optimist.Optimist { - (args: string[]): Optimist.Optimist; -} -declare module 'optimist' { - export = Optimist; -} diff --git a/_infrastructure/tests/typings/tsd.d.ts b/_infrastructure/tests/typings/tsd.d.ts deleted file mode 100644 index 371833438..000000000 --- a/_infrastructure/tests/typings/tsd.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -/// -/// -/// -/// diff --git a/alertify/alertify-tests.ts b/alertify/alertify-tests.ts new file mode 100644 index 000000000..9f6c0cd86 --- /dev/null +++ b/alertify/alertify-tests.ts @@ -0,0 +1,32 @@ +/// + +alertify.init(); + +alertify.alert("This is an alert"); +alertify.alert("This is an alert with a callback", () => { + alertify.success("Alert finished"); +}, "myCustomClass"); + + +alertify.confirm("This is a confirm request"); +alertify.confirm("This is a confirm request with a callback", () => { + alertify.success("Confirm finished"); +}, "myCustomClass"); + +var custom = alertify.extend("custom"); + +alertify.log("log message 1"); +alertify.log("log message 2", "success", 3000); + +alertify.prompt("prompt message 1"); +alertify.prompt("prompt message 2", () => { console.log("callback"); }, "ok", "myClass"); + +alertify.set({ delay: 1000 }); +alertify.set({ labels: { ok: "OK", cancel: "Cancel" }}); +alertify.set({ buttonFocus: "ok" }); +alertify.set({ buttonReverse: true }); + +alertify.success("This is a success message"); +alertify.error("This is an error message"); + +alertify.debug(); diff --git a/alertify/alertify.d.ts b/alertify/alertify.d.ts new file mode 100644 index 000000000..79ff53ec3 --- /dev/null +++ b/alertify/alertify.d.ts @@ -0,0 +1,124 @@ +// Type definitions for alertify 0.3.11 +// Project: http://fabien-d.github.io/alertify.js/ +// Definitions by: John Jeffery +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare var alertify: alertify.IAlertifyStatic; + +declare module alertify { + interface IAlertifyStatic { + /** + * Create an alert dialog box + * @param message The message passed from the callee + * @param fn Callback function + * @param cssClass Class(es) to append to dialog box + * @return alertify (ie this) + * @since 0.0.1 + */ + alert(message: string, fn?: Function, cssClass?: string): IAlertifyStatic; + + /** + * Create a confirm dialog box + * @param message The message passed from the callee + * @param fn Callback function + * @param cssClass Class(es) to append to dialog box + * @return alertify (ie this) + * @since 0.0.1 + */ + confirm(message: string, fn?: Function, cssClass?: string): IAlertifyStatic; + + /** + * Extend the log method to create custom methods + * @param type Custom method name + * @return function for logging + * @since 0.0.1 + */ + extend(type: string): (message: string, wait?: number) => IAlertifyStatic; + + /** + * Initialize Alertify and create the 2 main elements. + * Initialization will happen automatically on the first + * use of alert, confirm, prompt or log. + * @since 0.0.1 + */ + init(): void; + + /** + * Show a new log message box + * @param message The message passed from the callee + * @param type Optional type of log message + * @param wait Optional time (in ms) to wait before auto-hiding + * @return alertify (ie this) + * @since 0.0.1 + */ + log(message: string, type?: string, wait?: number): IAlertifyStatic; + + /** + * Create a prompt dialog box + * @param message The message passed from the callee + * @param fn Callback function + * @param placeholder Default value for prompt input + * @param cssClass Class(es) to append to dialog + * @return alertify (ie this) + * @since 0.0.1 + */ + prompt(message: string, fn?: Function, placeholder?: string, cssClass?: string): IAlertifyStatic; + + /** + * Shorthand for log messages + * @param message The message passed from the callee + * @return alertify (ie this) + * @since 0.0.1 + */ + success(message: string): IAlertifyStatic; + + /** + * Shorthand for log messages + * @param message The message passed from the callee + * @return alertify (ie this) + * @since 0.0.1 + */ + error(message: string): IAlertifyStatic; + + /** + * Used to set alertify properties + * @param Properties + * @since 0.2.11 + */ + set(args: IProperties): void; + + /** + * The labels used for dialog buttons + */ + labels: ILabels; + + /** + * Attaches alertify.error to window.onerror method + * @since 0.3.8 + */ + debug(): void; + } + + /** + * Properties for alertify.set function + */ + interface IProperties { + /** Default value for milliseconds display of log messages */ + delay?: number; + + /** Default values for display of labels */ + labels?: ILabels; + + /** Default button for focus */ + buttonFocus?: string; + + /** Should buttons be displayed in reverse order */ + buttonReverse?: boolean; + } + + /** Labels for altertify.set function */ + interface ILabels { + ok?: string; + cancel?: string; + } +} \ No newline at end of file diff --git a/amplifyjs/amplifyjs-tests.ts b/amplifyjs/amplifyjs-tests.ts index c26955348..a104d4a7c 100644 --- a/amplifyjs/amplifyjs-tests.ts +++ b/amplifyjs/amplifyjs-tests.ts @@ -176,8 +176,7 @@ amplify.request("twitter-mentions", { user: "amplifyjs" }); //Example: -amplify.request.decoders.appEnvelope = -function (data, status, xhr, success, error) { +var appEnvelopeDecoder: amplifyDecoder = function (data, status, xhr, success, error) { if (data.status === "success") { success(data.data); } else if (data.status === "fail" || data.status === "error") { @@ -187,6 +186,17 @@ function (data, status, xhr, success, error) { } }; +//a new decoder can be added to the amplifyDecoders interface +interface amplifyDecoders { + appEnvelope: amplifyDecoder; +} + +amplify.request.decoders.appEnvelope = appEnvelopeDecoder; + +//but you can also just add it via an index +amplify.request.decoders['appEnvelopeStr'] = appEnvelopeDecoder; + + amplify.request.define("decoderExample", "ajax", { url: "/myAjaxUrl", type: "POST", diff --git a/amplifyjs/amplifyjs.d.ts b/amplifyjs/amplifyjs.d.ts index c8de7260a..364845f3c 100644 --- a/amplifyjs/amplifyjs.d.ts +++ b/amplifyjs/amplifyjs.d.ts @@ -3,11 +3,33 @@ // Definitions by: Jonas Eriksson // Definitions: https://github.com/borisyankov/DefinitelyTyped +/// + interface amplifyRequestSettings { resourceId: string; data?: any; - success?: Function; - error?: Function; + success?: (...args: any[]) => void; + error?: (...args: any[]) => void; +} + +interface amplifyDecoder { + ( + data?: any, + status?: string, + xhr?: JQueryXHR, + success?: (...args: any[]) => void, + error?: (...args: any[]) => void + ): void +} + +interface amplifyDecoders { + [decoderName: string]: amplifyDecoder; + jsSend: amplifyDecoder; +} + +interface amplifyAjaxSettings extends JQueryAjaxSettings { + cache?: any; + decoder?: any /* string or amplifyDecoder */; } interface amplifyRequest { @@ -39,7 +61,7 @@ interface amplifyRequest { * cache: See the cache section for more details. * decoder: See the decoder section for more details. */ - define(resourceId: string, requestType: string, settings?: any): void; + define(resourceId: string, requestType: string, settings?: amplifyAjaxSettings): void; /*** * Define a custom request. @@ -50,9 +72,9 @@ interface amplifyRequest { * success: Callback to invoke on success. * error: Callback to invoke on error. */ - define(resourceId: string, resource: Function): void; - - decoders: any; + define(resourceId: string, resource: (settings: amplifyRequestSettings) => void): void; + + decoders: amplifyDecoders; cache: any; } diff --git a/angular-translate/angular-translate.d.ts b/angular-translate/angular-translate.d.ts index 6b6071102..313ef8635 100644 --- a/angular-translate/angular-translate.d.ts +++ b/angular-translate/angular-translate.d.ts @@ -1,11 +1,18 @@ // Type definitions for Angular Translate (pascalprecht.translate module) // Project: https://github.com/PascalPrecht/angular-translate -// Definitions by: Michel Salib +// Definitions by: Michel Salib // Definitions: https://github.com/borisyankov/DefinitelyTyped /// declare module ng.translate { + + interface ITranslatePartialLoaderService { + addPart(name: string): ITranslatePartialLoaderService; + deletePart(name: string, removeData?: boolean): ITranslatePartialLoaderService; + isPartAvailable(name: string): boolean; + } + interface ITranslationTable { [key: string]: string; } @@ -13,7 +20,7 @@ declare module ng.translate { interface ILanguageKeyAlias { [key: string]: string; } - + interface IStorage { get(name: string): string; set(name: string, value: string): void; @@ -28,6 +35,7 @@ declare module ng.translate { interface ITranslateService { (key: string, ...params: string[]): ng.IPromise; cloakClassName(): string; + cloakClassName(name: string): ITranslateProvider; fallbackLanguage(langKey?: string): string; fallbackLanguage(langKey?: string[]): string; instant(translationId: string, interpolateParams?: any, interpolationId?: string): string; @@ -79,6 +87,6 @@ declare module ng.translate { usePostCompiling(value: boolean): ITranslateProvider; determinePreferredLanguage(fn?: () => void): ITranslateProvider; registerAvailableLanguageKeys(): string[]; - registerAvailableLanguageKeys(languageKeys: string[], aliases?: ILanguageKeyAlias[]): ITranslateProvider; + registerAvailableLanguageKeys(languageKeys: string[], aliases?: ILanguageKeyAlias): ITranslateProvider; } } diff --git a/angular-ui/angular-ui-router-tests.ts b/angular-ui/angular-ui-router-tests.ts index 4804ad297..971a47cd2 100644 --- a/angular-ui/angular-ui-router-tests.ts +++ b/angular-ui/angular-ui-router-tests.ts @@ -13,6 +13,10 @@ myApp.config(( $urlMatcherFactory: ng.ui.IUrlMatcherFactory) => { var matcher: ng.ui.IUrlMatcher = $urlMatcherFactory.compile("/foo/:bar?param1"); + var obj: Object = matcher.exec('/user/bob', { x:'1', q:'hello' }); + var concat: ng.ui.IUrlMatcher = matcher.concat('/test'); + var str: string = matcher.format({ id:'bob', q:'yes' }); + var arr: string[] = matcher.parameters(); $urlRouterProvider .when('/test', '/list') @@ -78,12 +82,13 @@ interface IUrlLocatorTestService { // Service for determining who the currently logged on user is. class UrlLocatorTestService implements IUrlLocatorTestService { - static $inject = ["$http", "$rootScope", "$urlRouter"]; + static $inject = ["$http", "$rootScope", "$urlRouter", "$state"]; constructor( private $http: ng.IHttpService, private $rootScope: ng.IRootScopeService, - private $urlRouter: ng.ui.IUrlRouterService + private $urlRouter: ng.ui.IUrlRouterService, + private $state: ng.ui.IStateService ) { $rootScope.$on("$locationChangeSuccess", (event: ng.IAngularEvent) => this.onLocationChangeSuccess(event)); } @@ -107,6 +112,23 @@ class UrlLocatorTestService implements IUrlLocatorTestService { }); } } + + private stateServiceTest() { + this.$state.go("myState"); + this.$state.transitionTo("myState"); + if (this.$state.includes("myState") === true) { + // + } + if (this.$state.is("myState") === true) { + // + } + if (this.$state.href("myState") === "/myState") { + // + } + this.$state.get("myState"); + this.$state.get(); + this.$state.reload(); + } } myApp.service("urlLocatorTest", UrlLocatorTestService); @@ -124,4 +146,3 @@ module UiViewScrollProviderTests { $uiViewScrollProvider.useAnchorScroll(); }]); } - diff --git a/angular-ui/angular-ui-router.d.ts b/angular-ui/angular-ui-router.d.ts index 499f1c474..081d35723 100644 --- a/angular-ui/angular-ui-router.d.ts +++ b/angular-ui/angular-ui-router.d.ts @@ -1,6 +1,6 @@ // Type definitions for Angular JS 1.1.5+ (ui.router module) // Project: https://github.com/angular-ui/ui-router -// Definitions by: Michel Salib +// Definitions by: Michel Salib // Definitions: https://github.com/borisyankov/DefinitelyTyped /// @@ -33,13 +33,13 @@ declare module ng.ui { interface IUrlMatcher { concat(pattern: string): IUrlMatcher; exec(path: string, searchParams: {}): {}; + parameters(): string[]; + format(values: {}): string; } interface IUrlMatcherFactory { compile(pattern: string): IUrlMatcher; isMatcher(o: any): boolean; - parameters(): string[]; - format(values: {}): string; } interface IUrlRouterProvider extends IServiceProvider { @@ -86,6 +86,7 @@ declare module ng.ui { get(): IState[]; current: IState; params: IStateParamsService; + reload(): void; } interface IStateParamsService { diff --git a/angularjs/angular-animate.d.ts b/angularjs/angular-animate.d.ts index 696e6f834..9503e36d7 100644 --- a/angularjs/angular-animate.d.ts +++ b/angularjs/angular-animate.d.ts @@ -1,6 +1,6 @@ // Type definitions for Angular JS 1.2+ (ngAnimate module) // Project: http://angularjs.org -// Definitions by: Michel Salib +// Definitions by: Michel Salib // Definitions: https://github.com/borisyankov/DefinitelyTyped /// diff --git a/angularjs/angular-cookies.d.ts b/angularjs/angular-cookies.d.ts index 60eebbacb..622221675 100644 --- a/angularjs/angular-cookies.d.ts +++ b/angularjs/angular-cookies.d.ts @@ -1,4 +1,4 @@ -/// Type definitions for Angular JS 1.2 (ngCookies module) +// Type definitions for Angular JS 1.2 (ngCookies module) // Project: http://angularjs.org // Definitions by: Diego Vilar // Definitions: https://github.com/borisyankov/DefinitelyTyped diff --git a/angularjs/angular-mocks-tests.ts b/angularjs/angular-mocks-tests.ts index 64df49d8a..e9cd21642 100644 --- a/angularjs/angular-mocks-tests.ts +++ b/angularjs/angular-mocks-tests.ts @@ -50,7 +50,7 @@ exceptionHandlerProvider.mode('log'); /////////////////////////////////////// -// IExceptionHandlerProvider +// ITimeoutService /////////////////////////////////////// var timeoutService: ng.ITimeoutService; @@ -60,6 +60,14 @@ timeoutService.flushNext(); timeoutService.flushNext(1234); timeoutService.verifyNoPendingTasks(); +//////////////////////////////////////// +// IIntervalService +//////////////////////////////////////// +var intervalService: ng.IIntervalService; +var intervalServiceTimeActuallyAdvanced: number; + +intervalServiceTimeActuallyAdvanced = intervalService.flush(); +intervalServiceTimeActuallyAdvanced = intervalService.flush(1234); /////////////////////////////////////// // ILogService, ILogCall diff --git a/angularjs/angular-mocks.d.ts b/angularjs/angular-mocks.d.ts index 34b534a5e..6db753e1f 100644 --- a/angularjs/angular-mocks.d.ts +++ b/angularjs/angular-mocks.d.ts @@ -61,6 +61,15 @@ declare module ng { flushNext(expectedDelay?: number): void; verifyNoPendingTasks(): void; } + + /////////////////////////////////////////////////////////////////////////// + // IntervalService + // see http://docs.angularjs.org/api/ngMock.$interval + // Augments the original service + /////////////////////////////////////////////////////////////////////////// + interface IIntervalService { + flush(millis?: number): number; + } /////////////////////////////////////////////////////////////////////////// // LogService diff --git a/angularjs/angular-resource.d.ts b/angularjs/angular-resource.d.ts index 51b93091f..597a58e40 100644 --- a/angularjs/angular-resource.d.ts +++ b/angularjs/angular-resource.d.ts @@ -1,6 +1,6 @@ // Type definitions for Angular JS 1.2 (ngResource module) // Project: http://angularjs.org -// Definitions by: Diego Vilar , Michael Jess (minor enhancements) +// Definitions by: Diego Vilar , Michael Jess // Definitions: https://github.com/daptiv/DefinitelyTyped /// diff --git a/angularjs/angular-route-tests.ts b/angularjs/angular-route-tests.ts index 2ebe16a21..3b35a97bb 100644 --- a/angularjs/angular-route-tests.ts +++ b/angularjs/angular-route-tests.ts @@ -9,6 +9,9 @@ declare var $routeProvider: ng.route.IRouteProvider; $routeProvider .when('/projects/:projectId/dashboard',{ - controller: '' + controller: '', + templateUrl: '', + caseInsensitiveMatch: true, + reloadOnSearch: false }) .otherwise({redirectTo: '/'}); diff --git a/angularjs/angular-route.d.ts b/angularjs/angular-route.d.ts index 025c5da22..ba6d0aac9 100644 --- a/angularjs/angular-route.d.ts +++ b/angularjs/angular-route.d.ts @@ -1,6 +1,6 @@ // Type definitions for Angular JS 1.2 (ngRoute module) // Project: http://angularjs.org -// Definitions by: Jonathan Park +// Definitions by: Jonathan Park // Definitions: https://github.com/borisyankov/DefinitelyTyped /// @@ -15,7 +15,9 @@ declare module ng.route { // RouteParamsService // see http://docs.angularjs.org/api/ngRoute.$routeParams /////////////////////////////////////////////////////////////////////////// - interface IRouteParamsService {} + interface IRouteParamsService { + [key: string]: any; + } /////////////////////////////////////////////////////////////////////////// // RouteService @@ -30,17 +32,73 @@ declare module ng.route { // to a controller that was not initialized as a result of a route maching. current?: ICurrentRoute; } - - // see http://docs.angularjs.org/api/ngRoute.$routeProvider#when for options explanations + + + /** + * see http://docs.angularjs.org/api/ngRoute/provider/$routeProvider#when for API documentation + */ interface IRoute { + /** + * {(string|function()=} + * Controller fn that should be associated with newly created scope or the name of a registered controller if passed as a string. + */ controller?: any; - controllerAs?: any; + /** + * A controller alias name. If present the controller will be published to scope under the controllerAs name. + */ + controllerAs?: string; + /** + * Undocumented? + */ name?: string; + /** + * {string=|function()=} + * Html template as a string or a function that returns an html template as a string which should be used by ngView or ngInclude directives. This property takes precedence over templateUrl. + * + * If template is a function, it will be called with the following parameters: + * + * {Array.} - route parameters extracted from the current $location.path() by applying the current route + */ template?: string; + /** + * {string=|function()=} + * Path or function that returns a path to an html template that should be used by ngView. + * + * If templateUrl is a function, it will be called with the following parameters: + * + * {Array.} - route parameters extracted from the current $location.path() by applying the current route + */ templateUrl?: any; + /** + * {Object.=} - An optional map of dependencies which should be injected into the controller. If any of these dependencies are promises, the router will wait for them all to be resolved or one to be rejected before the controller is instantiated. If all the promises are resolved successfully, the values of the resolved promises are injected and $routeChangeSuccess event is fired. If any of the promises are rejected the $routeChangeError event is fired. The map object is: + * + * - key - {string}: a name of a dependency to be injected into the controller. + * - factory - {string|function}: If string then it is an alias for a service. Otherwise if function, then it is injected and the return value is treated as the dependency. If the result is a promise, it is resolved before its value is injected into the controller. Be aware that ngRoute.$routeParams will still refer to the previous route within these resolve functions. Use $route.current.params to access the new route parameters, instead. + */ resolve?: any; + /** + * {(string|function())=} + * Value to update $location path with and trigger route redirection. + * + * If redirectTo is a function, it will be called with the following parameters: + * + * - {Object.} - route parameters extracted from the current $location.path() by applying the current route templateUrl. + * - {string} - current $location.path() + * - {Object} - current $location.search() + * - The custom redirectTo function is expected to return a string which will be used to update $location.path() and $location.search(). + */ redirectTo?: any; + /** + * Reload route when only $location.search() or $location.hash() changes. + * + * This option defaults to true. If the option is set to false and url in the browser changes, then $routeUpdate event is broadcasted on the root scope. + */ reloadOnSearch?: boolean; + /** + * Match routes without being case sensitive + * + * This option defaults to false. If the option is set to true, then the particular route can be matched without being case sensitive + */ caseInsensitiveMatch?: boolean; } @@ -55,10 +113,24 @@ declare module ng.route { } interface IRouteProvider extends IServiceProvider { + /** + * Sets route definition that will be used on route change when no other route definition is matched. + * + * @params Mapping information to be assigned to $route.current. + */ otherwise(params: IRoute): IRouteProvider; /** - * This is a description + * Adds a new route definition to the $route service. + * + * @param path Route path (matched against $location.path). If $location.path contains redundant trailing slash or is missing one, the route will still match and the $location.path will be updated to add or drop the trailing slash to exactly match the route definition. + * + * - path can contain named groups starting with a colon: e.g. :name. All characters up to the next slash are matched and stored in $routeParams under the given name when the route matches. + * - path can contain named groups starting with a colon and ending with a star: e.g.:name*. All characters are eagerly stored in $routeParams under the given name when the route matches. + * - path can contain optional named groups with a question mark: e.g.:name?. * + * For example, routes like /color/:color/largecode/:largecode*\/edit will match /color/brown/largecode/code/with/slashes/edit and extract: color: brown and largecode: code/with/slashes. + * + * @param route Mapping information to be assigned to $route.current on route match. */ when(path: string, route: IRoute): IRouteProvider; } diff --git a/angularjs/angular-scenario.d.ts b/angularjs/angular-scenario.d.ts index ec3efd9f9..ee71ffbea 100644 --- a/angularjs/angular-scenario.d.ts +++ b/angularjs/angular-scenario.d.ts @@ -1,6 +1,6 @@ // Type definitions for Angular Scenario Testing // Project: http://angularjs.org -// Definitions by: RomanoLindano +// Definitions by: RomanoLindano // Definitions: https://github.com/borisyankov/DefinitelyTyped /// diff --git a/angularjs/angular-tests.ts b/angularjs/angular-tests.ts index 419bed0d6..37dae22f4 100644 --- a/angularjs/angular-tests.ts +++ b/angularjs/angular-tests.ts @@ -220,9 +220,21 @@ foo.then((x) => { }); +var httpFoo: ng.IHttpPromise; +httpFoo.then((x) => { + // When returning a promise the generic type must be inferred. + var innerPromise : ng.IPromise; + return innerPromise; +}).then((x) => { + // must still be number. + x.toFixed(); +}); + + // angular.element() tests var element = angular.element("div.myApp"); var scope: ng.IScope = element.scope(); +var isolateScope: ng.IScope = element.isolateScope(); diff --git a/angularjs/angular.d.ts b/angularjs/angular.d.ts index 9d5074945..d6b649a33 100755 --- a/angularjs/angular.d.ts +++ b/angularjs/angular.d.ts @@ -51,16 +51,21 @@ declare module ng { isString(value: any): boolean; isUndefined(value: any): boolean; lowercase(str: string): string; - /** construct your angular application - official docs: Interface for configuring angular modules. - see: http://docs.angularjs.org/api/angular.Module - */ + + /** + * The angular.module is a global place for creating, registering and retrieving Angular modules. All modules (angular core or 3rd party) that should be available to an application must be registered using this mechanism. + * + * When passed two or more arguments, a new module is created. If passed only one argument, an existing module (the name passed as the first argument to module) is retrieved. + * + * @param name The name of the module to create or retrieve. + * @param requires The names of modules this module depends on. If specified then new module is being created. If unspecified then the module is being retrieved for further configuration. + * @param configFn Optional configuration function for the module. + */ module( - /** name of your module you want to create */ name: string, - /** name of modules yours depends on */ requires?: string[], - configFunction?: any): IModule; + configFn?: Function): IModule; + noop(...args: any[]): void; toJson(obj: any, pretty?: boolean): string; uppercase(str: string): string; @@ -81,23 +86,61 @@ declare module ng { animation(name: string, animationFactory: Function): IModule; animation(name: string, inlineAnnotatedFunction: any[]): IModule; animation(object: Object): IModule; - /** configure existing services. - Use this method to register work which needs to be performed on module loading + /** + * Use this method to register work which needs to be performed on module loading. + * + * @param configFn Execute this function on module load. Useful for service configuration. */ config(configFn: Function): IModule; - /** configure existing services. - Use this method to register work which needs to be performed on module loading + /** + * Use this method to register work which needs to be performed on module loading. + * + * @param inlineAnnotatedFunction Execute this function on module load. Useful for service configuration. */ config(inlineAnnotatedFunction: any[]): IModule; + /** + * Register a constant service, such as a string, a number, an array, an object or a function, with the $injector. Unlike value it can be injected into a module configuration function (see config) and it cannot be overridden by an Angular decorator. + * + * @param name The name of the constant. + * @param value The constant value. + */ constant(name: string, value: any): IModule; constant(object: Object): IModule; + /** + * The $controller service is used by Angular to create new controllers. + * + * This provider allows controller registration via the register method. + * + * @param name Controller name, or an object map of controllers where the keys are the names and the values are the constructors. + * @param controllerConstructor Controller constructor fn (optionally decorated with DI annotations in the array notation). + */ controller(name: string, controllerConstructor: Function): IModule; + /** + * The $controller service is used by Angular to create new controllers. + * + * This provider allows controller registration via the register method. + * + * @param name Controller name, or an object map of controllers where the keys are the names and the values are the constructors. + * @param controllerConstructor Controller constructor fn (optionally decorated with DI annotations in the array notation). + */ controller(name: string, inlineAnnotatedConstructor: any[]): IModule; controller(object : Object): IModule; directive(name: string, directiveFactory: Function): IModule; directive(name: string, inlineAnnotatedFunction: any[]): IModule; directive(object: Object): IModule; - factory(name: string, serviceFactoryFunction: Function): IModule; + /** + * Register a service factory, which will be called to return the service instance. This is short for registering a service where its provider consists of only a $get property, which is the given service factory function. You should use $provide.factory(getFn) if you do not need to configure your service in a provider. + * + * @param name The name of the instance. + * @param $getFn The $getFn for the instance creation. Internally this is a short hand for $provide.provider(name, {$get: $getFn}). + */ + factory(name: string, $getFn: Function): IModule; + /** + * Register a service factory, which will be called to return the service instance. This is short for registering a service where its provider consists of only a $get property, which is the given service factory function. You should use $provide.factory(getFn) if you do not need to configure your service in a provider. + * + * @param name The name of the instance. + * @param inlineAnnotatedFunction The $getFn for the instance creation. Internally this is a short hand for $provide.provider(name, {$get: $getFn}). + */ factory(name: string, inlineAnnotatedFunction: any[]): IModule; factory(object: Object): IModule; filter(name: string, filterFactoryFunction: Function): IModule; @@ -107,11 +150,25 @@ declare module ng { provider(name: string, inlineAnnotatedConstructor: any[]): IModule; provider(name: string, providerObject: auto.IProvider): IModule; provider(object: Object): IModule; + /** + * Run blocks are the closest thing in Angular to the main method. A run block is the code which needs to run to kickstart the application. It is executed after all of the service have been configured and the injector has been created. Run blocks typically contain code which is hard to unit-test, and for this reason should be declared in isolated modules, so that they can be ignored in the unit-tests. + */ run(initializationFunction: Function): IModule; + /** + * Run blocks are the closest thing in Angular to the main method. A run block is the code which needs to run to kickstart the application. It is executed after all of the service have been configured and the injector has been created. Run blocks typically contain code which is hard to unit-test, and for this reason should be declared in isolated modules, so that they can be ignored in the unit-tests. + */ run(inlineAnnotatedFunction: any[]): IModule; service(name: string, serviceConstructor: Function): IModule; service(name: string, inlineAnnotatedConstructor: any[]): IModule; service(object: Object): IModule; + /** + * Register a value service with the $injector, such as a string, a number, an array, an object or a function. This is short for registering a service where its provider's $get property is a factory function that takes no arguments and returns the value service. + + Value services are similar to constant services, except that they cannot be injected into a module configuration function (see config) but they can be overridden by an Angular decorator. + * + * @param name The name of the instance. + * @param value The value. + */ value(name: string, value: any): IModule; value(object: Object): IModule; @@ -166,6 +223,7 @@ declare module ng { $error: any; $addControl(control: ng.INgModelController): void; $removeControl(control: ng.INgModelController): void; + $setValidity(validationErrorKey: string, isValid: boolean, control: ng.INgModelController): void; $setDirty(): void; $setPristine(): void; } @@ -241,6 +299,8 @@ declare module ng { $parent: IScope; + $root: IRootScopeService; + $id: string; // Hidden members @@ -263,13 +323,17 @@ declare module ng { // WindowService // see http://docs.angularjs.org/api/ng.$window /////////////////////////////////////////////////////////////////////////// - interface IWindowService extends Window {} + interface IWindowService extends Window { + [key: string]: any; + } /////////////////////////////////////////////////////////////////////////// // BrowserService // TODO undocumented, so we need to get it from the source code /////////////////////////////////////////////////////////////////////////// - interface IBrowserService {} + interface IBrowserService { + [key: string]: any; + } /////////////////////////////////////////////////////////////////////////// // TimeoutService @@ -455,16 +519,51 @@ declare module ng { /////////////////////////////////////////////////////////////////////////// interface IRootElementService extends JQuery {} - /////////////////////////////////////////////////////////////////////////// - // QService - // see http://docs.angularjs.org/api/ng.$q - /////////////////////////////////////////////////////////////////////////// + /** + * $q - service in module ng + * A promise/deferred implementation inspired by Kris Kowal's Q. + * See http://docs.angularjs.org/api/ng/service/$q + */ interface IQService { + /** + * Combines multiple promises into a single promise that is resolved when all of the input promises are resolved. + * + * Returns a single promise that will be resolved with an array/hash of values, each value corresponding to the promise at the same index/key in the promises array/hash. If any of the promises is resolved with a rejection, this resulting promise will be rejected with the same rejection value. + * + * @param promises An array or hash of promises. + */ all(promises: IPromise[]): IPromise; - all(promises: {[id: string]: IPromise;}): IPromise<{[id: string]: any}>; + /** + * Combines multiple promises into a single promise that is resolved when all of the input promises are resolved. + * + * Returns a single promise that will be resolved with an array/hash of values, each value corresponding to the promise at the same index/key in the promises array/hash. If any of the promises is resolved with a rejection, this resulting promise will be rejected with the same rejection value. + * + * @param promises An array or hash of promises. + */ + all(promises: { [id: string]: IPromise; }): IPromise<{ [id: string]: any }>; + /** + * Creates a Deferred object which represents a task which will finish in the future. + */ defer(): IDeferred; + /** + * Creates a promise that is resolved as rejected with the specified reason. This api should be used to forward rejection in a chain of promises. If you are dealing with the last promise in a promise chain, you don't need to worry about it. + * + * When comparing deferreds/promises to the familiar behavior of try/catch/throw, think of reject as the throw keyword in JavaScript. This also means that if you "catch" an error via a promise error callback and you want to forward the error to the promise derived from the current promise, you have to "rethrow" the error by returning a rejection constructed via reject. + * + * @param reason Constant, message, exception or an object representing the rejection reason. + */ reject(reason?: any): IPromise; + /** + * Wraps an object that might be a value or a (3rd party) then-able promise into a $q promise. This is useful when you are dealing with an object that might or might not be a promise, or if the promise comes from a source that can't be trusted. + * + * @param value Value or a promise + */ when(value: IPromise): IPromise; + /** + * Wraps an object that might be a value or a (3rd party) then-able promise into a $q promise. This is useful when you are dealing with an object that might or might not be a promise, or if the promise comes from a source that can't be trusted. + * + * @param value Value or a promise + */ when(value: T): IPromise; } @@ -756,9 +855,9 @@ declare module ng { interface IHttpPromise extends IPromise { success(callback: IHttpPromiseCallback): IHttpPromise; - error(callback: IHttpPromiseCallback): IHttpPromise; - then(successCallback: (response: IHttpPromiseCallbackArg) => TResult, errorCallback?: (response: IHttpPromiseCallbackArg) => any): IPromise; - then(successCallback: (response: IHttpPromiseCallbackArg) => IPromise, errorCallback?: (response: IHttpPromiseCallbackArg) => any): IPromise; + error(callback: IHttpPromiseCallback): IHttpPromise; + then(successCallback: (response: IHttpPromiseCallbackArg) => IPromise, errorCallback?: (response: IHttpPromiseCallbackArg) => any): IPromise; + then(successCallback: (response: IHttpPromiseCallbackArg) => TResult, errorCallback?: (response: IHttpPromiseCallbackArg) => any): IPromise; } interface IHttpProvider extends IServiceProvider { @@ -925,6 +1024,7 @@ declare module ng { controller(name: string): any; injector(): any; scope(): IScope; + isolateScope(): IScope; inheritedData(key: string, value: any): JQuery; inheritedData(obj: { [key: string]: any; }): JQuery; @@ -973,10 +1073,32 @@ declare module ng { // Documentation says it returns the registered instance, but actual // implementation does not return anything. // constant(name: string, value: any): any; + /** + * Register a constant service, such as a string, a number, an array, an object or a function, with the $injector. Unlike value it can be injected into a module configuration function (see config) and it cannot be overridden by an Angular decorator. + * + * @param name The name of the constant. + * @param value The constant value. + */ constant(name: string, value: any): void; + /** + * Register a service decorator with the $injector. A service decorator intercepts the creation of a service, allowing it to override or modify the behaviour of the service. The object returned by the decorator may be the original service, or a new service object which replaces or wraps and delegates to the original service. + * + * @param name The name of the service to decorate. + * @param decorator This function will be invoked when the service needs to be instantiated and should return the decorated service instance. The function is called using the injector.invoke method and is therefore fully injectable. Local injection arguments: + * + * $delegate - The original service instance, which can be monkey patched, configured, decorated or delegated to. + */ decorator(name: string, decorator: Function): void; - decorator(name: string, decoratorInline: any[]): void; + /** + * Register a service decorator with the $injector. A service decorator intercepts the creation of a service, allowing it to override or modify the behaviour of the service. The object returned by the decorator may be the original service, or a new service object which replaces or wraps and delegates to the original service. + * + * @param name The name of the service to decorate. + * @param inlineAnnotatedFunction This function will be invoked when the service needs to be instantiated and should return the decorated service instance. The function is called using the injector.invoke method and is therefore fully injectable. Local injection arguments: + * + * $delegate - The original service instance, which can be monkey patched, configured, decorated or delegated to. + */ + decorator(name: string, inlineAnnotatedFunction: any[]): void; factory(name: string, serviceFactoryFunction: Function): ng.IServiceProvider; factory(name: string, inlineAnnotatedFunction: any[]): ng.IServiceProvider; provider(name: string, provider: ng.IServiceProvider): ng.IServiceProvider; diff --git a/ansicolors/ansicolors.d.ts b/ansicolors/ansicolors.d.ts new file mode 100644 index 000000000..2f61b0435 --- /dev/null +++ b/ansicolors/ansicolors.d.ts @@ -0,0 +1,9 @@ +// Type definitions for ansicolors +// Project: https://github.com/thlorenz/ansicolors +// Definitions by: rogierschouten +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module "ansicolors" { + var colors: {[index: string]: (s: string) => string;}; + export = colors; +} diff --git a/arbiter/Arbiter-tests.ts.tscparams b/arbiter/Arbiter-tests.ts.tscparams deleted file mode 100644 index e16c76dff..000000000 --- a/arbiter/Arbiter-tests.ts.tscparams +++ /dev/null @@ -1 +0,0 @@ -"" diff --git a/arbiter/Arbiter.d.ts b/arbiter/Arbiter.d.ts index cb35f9c58..b5bededed 100644 --- a/arbiter/Arbiter.d.ts +++ b/arbiter/Arbiter.d.ts @@ -121,12 +121,12 @@ declare module ArbiterDef { /** * Unsubscribing simply sets a flag which prevents the subscriber from executing, in case you want to re-subscribe later. */ - unsubscribe(subscription_id: number); + unsubscribe(subscription_id: number): boolean; /** * After unsubscribing, you can later re-subscribe to begin receiving messages again. */ - resubscribe(subscription_id: number); + resubscribe(subscription_id: number): boolean; } } diff --git a/arbiter/Arbiter.d.ts.tscparams b/arbiter/Arbiter.d.ts.tscparams deleted file mode 100644 index e16c76dff..000000000 --- a/arbiter/Arbiter.d.ts.tscparams +++ /dev/null @@ -1 +0,0 @@ -"" diff --git a/asciify/asciify.d.ts b/asciify/asciify.d.ts index 4dc47cd3a..33f82019b 100644 --- a/asciify/asciify.d.ts +++ b/asciify/asciify.d.ts @@ -1,6 +1,6 @@ // Type definitions for asciify 1.3.5 // Project: https://www.npmjs.org/package/asciify -// Definitions by: Alan Norbauer http://alan.norbauer.com +// Definitions by: Alan Norbauer // Definitions: https://github.com/borisyankov/DefinitelyTyped /// @@ -26,4 +26,4 @@ declare module "asciify" { } export = asciify -} \ No newline at end of file +} diff --git a/async/async-tests.ts b/async/async-tests.ts index ae92bbff9..9b0c8e7ee 100644 --- a/async/async-tests.ts +++ b/async/async-tests.ts @@ -145,9 +145,8 @@ q.drain = function () { console.log('all items have been processed'); } -q.push({ name: 'foo' }, function (err) { - console.log('finished processing foo'); -}); +q.push({ name: 'foo' }); + q.push({ name: 'bar' }, function (err) { console.log('finished processing bar'); }); @@ -156,6 +155,64 @@ q.push([{ name: 'baz' }, { name: 'bay' }, { name: 'bax' }], function (err) { console.log('finished processing bar'); }); +q.unshift({ name: 'foo' }); + +q.unshift({ name: 'bar' }, function (err) { + console.log('finished processing bar'); +}); + +q.unshift([{ name: 'baz' }, { name: 'bay' }, { name: 'bax' }], function (err) { + console.log('finished processing bar'); +}); + +var qLength : number = q.length(); +var qStarted : boolean = q.started; +var qPaused : boolean = q.paused; +var qProcessingCount : number = q.running(); +var qIsIdle : boolean = q.idle(); + +q.saturated = function() { + console.log('queue is saturated.'); +} + +q.empty = function() { + console.log('queue is empty.'); +} + +q.drain = function() { + console.log('queue was drained.'); +} + +q.pause(); +q.resume(); +q.kill(); + +// tests for strongly typed tasks +var q2 = async.queue(function (task: string, callback) { + console.log('Task: ' + task); + callback(); +}, 1); + +q2.push('task1'); + +q2.push('task2', function (error, results: string[]) { + console.log('Finished tasks: ' + results.join(', ')); +}); + +q2.push(['task3', 'task4', 'task5'], function (error, results: string[]) { + console.log('Finished tasks: ' + results.join(', ')); +}); + +q2.unshift('task1'); + +q2.unshift('task2', function (error, results: string[]) { + console.log('Finished tasks: ' + results.join(', ')); +}); + +q2.unshift(['task3', 'task4', 'task5'], function (error, results: string[]) { + console.log('Finished tasks: ' + results.join(', ')); +}); + var filename = ''; async.auto({ get_data: function (callback) { }, diff --git a/async/async.d.ts b/async/async.d.ts index b8666febf..d1d592629 100644 --- a/async/async.d.ts +++ b/async/async.d.ts @@ -3,8 +3,8 @@ // Definitions by: Boris Yankov // Definitions: https://github.com/borisyankov/DefinitelyTyped -interface AsyncMultipleResultsCallback { (err: string, results: T[]): any; } -interface AsyncSingleResultCallback { (err: string, result: T): void; } +interface AsyncMultipleResultsCallback { (err: Error, results: T[]): any; } +interface AsyncSingleResultCallback { (err: Error, result: T): void; } interface AsyncTimesCallback { (n: number, callback: AsyncMultipleResultsCallback): void; } interface AsyncIterator { (item: T, callback: AsyncSingleResultCallback): void; } @@ -15,10 +15,20 @@ interface AsyncWorker { (task: T, callback: Function): void; } interface AsyncQueue { length(): number; concurrency: number; + started: boolean; + paused: boolean; push(task: T, callback?: AsyncMultipleResultsCallback): void; - saturated: AsyncMultipleResultsCallback; - empty: AsyncMultipleResultsCallback; - drain: AsyncMultipleResultsCallback; + push(task: T[], callback?: AsyncMultipleResultsCallback): void; + unshift(task: T, callback?: AsyncMultipleResultsCallback): void; + unshift(task: T[], callback?: AsyncMultipleResultsCallback): void; + saturated: () => any; + empty: () => any; + drain: () => any; + running(): number; + idle(): boolean; + pause(): void; + resume(): void; + kill(): void; } interface Async { @@ -27,28 +37,28 @@ interface Async { forEach(arr: T[], iterator: AsyncIterator, callback: AsyncMultipleResultsCallback): void; forEachSeries(arr: T[], iterator: AsyncIterator, callback: AsyncMultipleResultsCallback): void; forEachLimit(arr: T[], limit: number, iterator: AsyncIterator, callback: AsyncMultipleResultsCallback): void; - map(arr: T[], iterator: AsyncIterator, callback: AsyncMultipleResultsCallback); - mapSeries(arr: T[], iterator: AsyncIterator, callback: AsyncMultipleResultsCallback); - filter(arr: T[], iterator: AsyncIterator, callback: AsyncMultipleResultsCallback); - select(arr: T[], iterator: AsyncIterator, callback: AsyncMultipleResultsCallback); - filterSeries(arr: T[], iterator: AsyncIterator, callback: AsyncMultipleResultsCallback); - selectSeries(arr: T[], iterator: AsyncIterator, callback: AsyncMultipleResultsCallback); - reject(arr: T[], iterator: AsyncIterator, callback: AsyncMultipleResultsCallback); - rejectSeries(arr: T[], iterator: AsyncIterator, callback: AsyncMultipleResultsCallback); - reduce(arr: T[], memo: R, iterator: AsyncMemoIterator, callback: AsyncSingleResultCallback); - inject(arr: T[], memo: R, iterator: AsyncMemoIterator, callback: AsyncSingleResultCallback); - foldl(arr: T[], memo: R, iterator: AsyncMemoIterator, callback: AsyncSingleResultCallback); - reduceRight(arr: T[], memo: R, iterator: AsyncMemoIterator, callback: AsyncSingleResultCallback); - foldr(arr: T[], memo: R, iterator: AsyncMemoIterator, callback: AsyncSingleResultCallback); - detect(arr: T[], iterator: AsyncIterator, callback: AsyncMultipleResultsCallback); - detectSeries(arr: T[], iterator: AsyncIterator, callback: AsyncMultipleResultsCallback); - sortBy(arr: T[], iterator: AsyncIterator, callback: AsyncMultipleResultsCallback); - some(arr: T[], iterator: AsyncIterator, callback: AsyncMultipleResultsCallback); - any(arr: T[], iterator: AsyncIterator, callback: AsyncMultipleResultsCallback); - every(arr: T[], iterator: AsyncIterator, callback: (result: boolean) => any); - all(arr: T[], iterator: AsyncIterator, callback: (result: boolean) => any); - concat(arr: T[], iterator: AsyncIterator, callback: AsyncMultipleResultsCallback); - concatSeries(arr: T[], iterator: AsyncIterator, callback: AsyncMultipleResultsCallback); + map(arr: T[], iterator: AsyncIterator, callback: AsyncMultipleResultsCallback): any; + mapSeries(arr: T[], iterator: AsyncIterator, callback: AsyncMultipleResultsCallback): any; + filter(arr: T[], iterator: AsyncIterator, callback: AsyncMultipleResultsCallback): any; + select(arr: T[], iterator: AsyncIterator, callback: AsyncMultipleResultsCallback): any; + filterSeries(arr: T[], iterator: AsyncIterator, callback: AsyncMultipleResultsCallback): any; + selectSeries(arr: T[], iterator: AsyncIterator, callback: AsyncMultipleResultsCallback): any; + reject(arr: T[], iterator: AsyncIterator, callback: AsyncMultipleResultsCallback): any; + rejectSeries(arr: T[], iterator: AsyncIterator, callback: AsyncMultipleResultsCallback): any; + reduce(arr: T[], memo: R, iterator: AsyncMemoIterator, callback: AsyncSingleResultCallback): any; + inject(arr: T[], memo: R, iterator: AsyncMemoIterator, callback: AsyncSingleResultCallback): any; + foldl(arr: T[], memo: R, iterator: AsyncMemoIterator, callback: AsyncSingleResultCallback): any; + reduceRight(arr: T[], memo: R, iterator: AsyncMemoIterator, callback: AsyncSingleResultCallback): any; + foldr(arr: T[], memo: R, iterator: AsyncMemoIterator, callback: AsyncSingleResultCallback): any; + detect(arr: T[], iterator: AsyncIterator, callback: AsyncMultipleResultsCallback): any; + detectSeries(arr: T[], iterator: AsyncIterator, callback: AsyncMultipleResultsCallback): any; + sortBy(arr: T[], iterator: AsyncIterator, callback: AsyncMultipleResultsCallback): any; + some(arr: T[], iterator: AsyncIterator, callback: AsyncMultipleResultsCallback): any; + any(arr: T[], iterator: AsyncIterator, callback: AsyncMultipleResultsCallback): any; + every(arr: T[], iterator: AsyncIterator, callback: (result: boolean) => any): any; + all(arr: T[], iterator: AsyncIterator, callback: (result: boolean) => any): any; + concat(arr: T[], iterator: AsyncIterator, callback: AsyncMultipleResultsCallback): any; + concatSeries(arr: T[], iterator: AsyncIterator, callback: AsyncMultipleResultsCallback): any; // Control Flow series(tasks: T[], callback?: AsyncMultipleResultsCallback): void; diff --git a/async/async.d.ts.tscparams b/async/async.d.ts.tscparams deleted file mode 100644 index e16c76dff..000000000 --- a/async/async.d.ts.tscparams +++ /dev/null @@ -1 +0,0 @@ -"" diff --git a/async/asyncamd-tests.ts.tscparams b/async/asyncamd-tests.ts.tscparams deleted file mode 100644 index e16c76dff..000000000 --- a/async/asyncamd-tests.ts.tscparams +++ /dev/null @@ -1 +0,0 @@ -"" diff --git a/atom/atom.d.ts b/atom/atom.d.ts index 8cbde4d55..00f55ef02 100644 --- a/atom/atom.d.ts +++ b/atom/atom.d.ts @@ -15,7 +15,7 @@ // if js file include to another npm package (e.g. "space-pen", "mixto" and "emissary"). // you should create a separate file. -// NOTE Document? You should use DevTools hehe... +// API documentation : https://atom.io/docs/api/v0.106.0/api/docs/README.md.html interface Window { atom: AtomCore.IAtom; @@ -941,6 +941,21 @@ declare module AtomCore { // TBD } + interface IPackage { + mainModulePath: string; + mainModule: any; + enable(): void; + disable(): void; + isTheme(): boolean; + getType(): string; + getStylesheetType(): string; + load(): IPackage; + reset(): void; + activate(): Q.Promise; + activateNow(): void; + // TBD + } + interface IPackageManager extends Emissary.IEmitter { packageDirPaths:string[]; loadedPackages:any; @@ -957,7 +972,7 @@ declare module AtomCore { activate():void; registerPackageActivator(activator:any, types:any):void; activatePackages(packages:any):void; - activatePackage(name:string):void; + activatePackage(name:string):Q.Promise; deactivatePackages():void; deactivatePackage(name:string):void; getActivePackages():any; @@ -1010,7 +1025,14 @@ declare module AtomCore { interface IAtomStatic extends ISerializationStatic { version: number; loadSettings: IAtomSettings; + + /* Load or create the Atom environment in the given mode */ + loadOrCreate(mode:'editor'):IAtom; + /* Load or create the Atom environment in the given mode */ + loadOrCreate(mode:'spec'):IAtom; + /* Load or create the Atom environment in the given mode */ loadOrCreate(mode:string):IAtom; + loadState(mode:any):void; getStatePath(mode:any):string; getConfigDirPath():string; @@ -1023,6 +1045,8 @@ declare module AtomCore { new(state:IAtomState):IAtom; } + // https://atom.io/docs/api/v0.106.0/api/classes/Atom.html + /* Global Atom class : instance members */ interface IAtom { constructor:IAtomStatic; diff --git a/auth0.widget/auth0.widget.d.ts b/auth0.widget/auth0.widget.d.ts index 932d79c94..d45c3a212 100644 --- a/auth0.widget/auth0.widget.d.ts +++ b/auth0.widget/auth0.widget.d.ts @@ -1,5 +1,5 @@ // Type definitions for Auth0Widget.js -// Project: Auth0.com +// Project: http://auth0.com // Definitions by: Robert McLaws // Definitions: https://github.com/borisyankov/DefinitelyTyped @@ -45,4 +45,4 @@ declare var Auth0Widget: Auth0WidgetStatic; declare module "Auth0Widget" { export = Auth0Widget -} \ No newline at end of file +} diff --git a/auth0/auth0.d.ts b/auth0/auth0.d.ts index 02b8e0196..5d3149ead 100644 --- a/auth0/auth0.d.ts +++ b/auth0/auth0.d.ts @@ -1,5 +1,5 @@ // Type definitions for Auth0.js -// Project: Auth0.com +// Project: http://auth0.com // Definitions by: Robert McLaws // Definitions: https://github.com/borisyankov/DefinitelyTyped @@ -130,4 +130,4 @@ declare var Auth0: Auth0Static; declare module "Auth0" { export = Auth0 -} \ No newline at end of file +} diff --git a/azure-mobile-services-client/AzureMobileServicesClient.d.ts b/azure-mobile-services-client/AzureMobileServicesClient.d.ts index 3b2b8fc16..2aec11114 100644 --- a/azure-mobile-services-client/AzureMobileServicesClient.d.ts +++ b/azure-mobile-services-client/AzureMobileServicesClient.d.ts @@ -42,21 +42,21 @@ declare module Microsoft.WindowsAzure { getTableName(): string; getMobileServiceClient(): MobileServiceClient; - insert(istance: any, paramsQS: Object, callback: (error: any, retInserted: any) => any): void; - insert(istance: any, paramsQS: Object): asyncPromise; - insert(istance: any): asyncPromise; + insert(instance: any, paramsQS: Object, callback: (error: any, retInserted: any) => any): void; + insert(instance: any, paramsQS: Object): asyncPromise; + insert(instance: any): asyncPromise; - update(istance: any, paramsQS: Object, callback: (error: any, retUpdated: any) => any): void; - update(istance: any, paramsQS: Object): asyncPromise; - update(istance: any): asyncPromise; + update(instance: any, paramsQS: Object, callback: (error: any, retUpdated: any) => any): void; + update(instance: any, paramsQS: Object): asyncPromise; + update(instance: any): asyncPromise; lookup(id: number, paramsQS: Object, callback: (error: any, retValue: any) => any): void; lookup(id: number, paramsQS: Object): asyncPromise; lookup(id: number): asyncPromise; - del(istance: any, paramsQS: Object, callback: (error?: any) => void ): void; - del(istance: any, paramsQS: Object): asyncPromise; - del(istance: any): asyncPromise; + del(instance: any, paramsQS: Object, callback: (error?: any) => void ): void; + del(instance: any, paramsQS: Object): asyncPromise; + del(instance: any): asyncPromise; read(query: IQuery, paramsQS: Object, callback: (error: any, retValues: any) => any): void; diff --git a/backbone/backbone-tests.ts b/backbone/backbone-tests.ts index bf44c56f7..506fd7bb6 100644 --- a/backbone/backbone-tests.ts +++ b/backbone/backbone-tests.ts @@ -113,9 +113,12 @@ class EmployeeCollection extends Backbone.Collection { class Book extends Backbone.Model { title: string; author: string; + published: boolean; } class Library extends Backbone.Collection { + // This model definition is here only to test type compatibility of the model, but it + // is not necessary in working code as it is automatically inferred through generics. model: typeof Book; } @@ -123,23 +126,31 @@ class Books extends Backbone.Collection { } function test_collection() { - var books = new Library(); + var books = new Books(); - books.each(book => { - book.get("title"); - }); + var book1: Book = new Book({ title: "Title 1", author: "Mike" }); + books.add(book1); - var titles = books.map(book => { - return book.get("title"); - }); + // Objects can be added to collection by casting to model type. + // Compiler will check if object properties are valid for the cast. + // This gives better type checking than declaring an `any` overload. + books.add({ title: "Title 2", author: "Mikey" }); - var publishedBooks = books.filter(book => { - return book.get("published") === true; - }); + var model: Book = book1.collection.first(); + if (model !== book1) { + throw new Error("Error"); + } - var alphabetical = books.sortBy((book: Book): number => { - return null; - }); + books.each(book => + book.get("title")); + + var titles = books.map(book => + book.get("title")); + + var publishedBooks = books.filter(book => + book.get("published") === true); + + var alphabetical = books.sortBy((book: Book): number => null); } ////////// diff --git a/backbone/backbone.d.ts b/backbone/backbone.d.ts index 6fa7e6d60..d8bdc71c9 100644 --- a/backbone/backbone.d.ts +++ b/backbone/backbone.d.ts @@ -1,10 +1,8 @@ // Type definitions for Backbone 1.0.0 // Project: http://backbonejs.org/ -// Definitions by: Boris Yankov -// Definitions by: Natan Vivo +// Definitions by: Boris Yankov , Natan Vivo // Definitions: https://github.com/borisyankov/DefinitelyTyped - /// /// @@ -97,6 +95,8 @@ declare module Backbone { attributes: any; changed: any[]; cid: string; + collection: Collection; + /** * Default attributes for the model. It can be an object hash or a method returning an object hash. * For assigning an object hash, do it like this: this.defaults = { attribute: value, ... }; @@ -113,8 +113,23 @@ declare module Backbone { fetch(options?: ModelFetchOptions): JQueryXHR; - get(attributeName: string): any; - set(attributeName: string, value: any, options?: ModelSetOptions): Model; + /** + * For strongly-typed access to attributes, use the `get` method only privately in public getter properties. + * @example + * get name(): string { + * return super.get("name"); + * } + **/ + /*private*/ get(attributeName: string): any; + + /** + * For strongly-typed assignment of attributes, use the `set` method only privately in public setter properties. + * @example + * set name(value: string) { + * super.set("name", value); + * } + **/ + /*private*/ set(attributeName: string, value: any, options?: ModelSetOptions): Model; set(obj: any, options?: ModelSetOptions): Model; change(): any; @@ -158,7 +173,6 @@ declare module Backbone { //model: typeof TModel; model: { new(): TModel; }; // workaround models: TModel[]; - collection: TModel; length: number; constructor(models?: TModel[], options?: any); @@ -171,7 +185,12 @@ declare module Backbone { add(model: TModel, options?: AddOptions): Collection; add(models: TModel[], options?: AddOptions): Collection; at(index: number): TModel; + /** + * Get a model from a collection, specified by an id, a cid, or by passing in a model. + **/ + get(id: number): TModel; get(id: string): TModel; + get(id: Model): TModel; create(attributes: any, options?: ModelSaveOptions): TModel; pluck(attribute: string): any[]; push(model: TModel, options?: AddOptions): TModel; @@ -360,7 +379,7 @@ declare module Backbone { // Utility function noConflict(): typeof Backbone; - function setDomLibrary(jQueryNew: any): any; + var $: JQueryStatic; } declare module "backbone" { diff --git a/bl/bl-tests.ts b/bl/bl-tests.ts index 96bfb8e3b..b8435911d 100644 --- a/bl/bl-tests.ts +++ b/bl/bl-tests.ts @@ -38,31 +38,31 @@ str = bl.toString(); num = bl.length; -buffer = bl.readDoubleBE(offset, noAssert); -buffer = bl.readDoubleBE(offset); -buffer = bl.readDoubleLE(offset, noAssert); -buffer = bl.readDoubleLE(offset); -buffer = bl.readFloatBE(offset, noAssert); -buffer = bl.readFloatBE(offset); -buffer = bl.readFloatLE(offset, noAssert); -buffer = bl.readFloatLE(offset); -buffer = bl.readInt32BE(offset, noAssert); -buffer = bl.readInt32BE(offset); -buffer = bl.readInt32LE(offset, noAssert); -buffer = bl.readInt32LE(offset); -buffer = bl.readUInt32BE(offset, noAssert); -buffer = bl.readUInt32BE(offset); -buffer = bl.readUInt32LE(offset, noAssert); -buffer = bl.readUInt32LE(offset); -buffer = bl.readInt16BE(offset, noAssert); -buffer = bl.readInt16BE(offset); -buffer = bl.readInt16LE(offset, noAssert); -buffer = bl.readInt16LE(offset); -buffer = bl.readUInt16BE(offset, noAssert); -buffer = bl.readUInt16BE(offset); -buffer = bl.readUInt16LE(offset, noAssert); -buffer = bl.readUInt16LE(offset); -buffer = bl.readInt8(offset, noAssert); -buffer = bl.readInt8(offset); -buffer = bl.readUInt8(offset, noAssert); -buffer = bl.readUInt8(offset); +num = bl.readDoubleBE(offset, noAssert); +num = bl.readDoubleBE(offset); +num = bl.readDoubleLE(offset, noAssert); +num = bl.readDoubleLE(offset); +num = bl.readFloatBE(offset, noAssert); +num = bl.readFloatBE(offset); +num = bl.readFloatLE(offset, noAssert); +num = bl.readFloatLE(offset); +num = bl.readInt32BE(offset, noAssert); +num = bl.readInt32BE(offset); +num = bl.readInt32LE(offset, noAssert); +num = bl.readInt32LE(offset); +num = bl.readUInt32BE(offset, noAssert); +num = bl.readUInt32BE(offset); +num = bl.readUInt32LE(offset, noAssert); +num = bl.readUInt32LE(offset); +num = bl.readInt16BE(offset, noAssert); +num = bl.readInt16BE(offset); +num = bl.readInt16LE(offset, noAssert); +num = bl.readInt16LE(offset); +num = bl.readUInt16BE(offset, noAssert); +num = bl.readUInt16BE(offset); +num = bl.readUInt16LE(offset, noAssert); +num = bl.readUInt16LE(offset); +num = bl.readInt8(offset, noAssert); +num = bl.readInt8(offset); +num = bl.readUInt8(offset, noAssert); +num = bl.readUInt8(offset); diff --git a/bl/bl.d.ts b/bl/bl.d.ts index c277ea44b..6e8c3b4a8 100644 --- a/bl/bl.d.ts +++ b/bl/bl.d.ts @@ -20,20 +20,20 @@ declare module 'bl' { toString(encoding?: string, start?: number, end?: number): string; length: number; - readDoubleBE(offset: number, noAssert?: boolean): Buffer; - readDoubleLE(offset: number, noAssert?: boolean): Buffer; - readFloatBE(offset: number, noAssert?: boolean): Buffer; - readFloatLE(offset: number, noAssert?: boolean): Buffer; - readInt32BE(offset: number, noAssert?: boolean): Buffer; - readInt32LE(offset: number, noAssert?: boolean): Buffer; - readUInt32BE(offset: number, noAssert?: boolean): Buffer; - readUInt32LE(offset: number, noAssert?: boolean): Buffer; - readInt16BE(offset: number, noAssert?: boolean): Buffer; - readInt16LE(offset: number, noAssert?: boolean): Buffer; - readUInt16BE(offset: number, noAssert?: boolean): Buffer; - readUInt16LE(offset: number, noAssert?: boolean): Buffer; - readInt8(offset: number, noAssert?: boolean): Buffer; - readUInt8(offset: number, noAssert?: boolean): Buffer; + readDoubleBE(offset: number, noAssert?: boolean): number; + readDoubleLE(offset: number, noAssert?: boolean): number; + readFloatBE(offset: number, noAssert?: boolean): number; + readFloatLE(offset: number, noAssert?: boolean): number; + readInt32BE(offset: number, noAssert?: boolean): number; + readInt32LE(offset: number, noAssert?: boolean): number; + readUInt32BE(offset: number, noAssert?: boolean): number; + readUInt32LE(offset: number, noAssert?: boolean): number; + readInt16BE(offset: number, noAssert?: boolean): number; + readInt16LE(offset: number, noAssert?: boolean): number; + readUInt16BE(offset: number, noAssert?: boolean): number; + readUInt16LE(offset: number, noAssert?: boolean): number; + readInt8(offset: number, noAssert?: boolean): number; + readUInt8(offset: number, noAssert?: boolean): number; } export = BufferList; diff --git a/bootstrap.datepicker/bootstrap.datepicker.d.ts b/bootstrap.datepicker/bootstrap.datepicker.d.ts index 41f2fcd25..da0ec1ab3 100644 --- a/bootstrap.datepicker/bootstrap.datepicker.d.ts +++ b/bootstrap.datepicker/bootstrap.datepicker.d.ts @@ -5,6 +5,15 @@ /// +/** + * All options that take a “Date” can handle a Date object; a String + * formatted according to the given format; or a timedelta relative + * to today, eg “-1d”, “+6m +1y”, etc, where valid units are “d” (day), + * “w” (week), “m” (month), and “y” (year). + * + * See online docs for more info: + * http://bootstrap-datepicker.readthedocs.org/en/release/options.html + */ interface DatepickerOptions { format?: string; weekStart?: number; @@ -16,11 +25,21 @@ interface DatepickerOptions { todayHighlight?: boolean; keyboardNavigation?: boolean; language?: string; + beforeShowDay?: (date: any) => any; + calendarWeeks?: boolean; + clearBtn?: boolean; + daysOfWeekDisabled?: number[]; + forceParse?: boolean; + inputs?: any[]; + minViewMode?: any; + multidate?: any; + multidateSeparator?: string; + orientation?: string; } interface DatepickerEventObject extends JQueryEventObject { - date: Date; - format(format?: string): string; + date: Date; + format(format?: string): string; } interface JQuery { @@ -29,10 +48,10 @@ interface JQuery { datepicker(methodName: string, params: any): JQuery; datepicker(options: DatepickerOptions): JQuery; - off(events: "changeDate", selector?: string, handler?: (eventObject: DatepickerEventObject) => any): JQuery; - off(events: "changeDate", handler: (eventObject: DatepickerEventObject) => any): JQuery; + off(events: "changeDate", selector?: string, handler?: (eventObject: DatepickerEventObject) => any): JQuery; + off(events: "changeDate", handler: (eventObject: DatepickerEventObject) => any): JQuery; - on(events: "changeDate", selector: string, data: any, handler?: (eventObject: DatepickerEventObject) => any): JQuery; - on(events: "changeDate", selector: string, handler: (eventObject: DatepickerEventObject) => any): JQuery; - on(events: 'changeDate', handler: (eventObject: DatepickerEventObject) => any): JQuery; + on(events: "changeDate", selector: string, data: any, handler?: (eventObject: DatepickerEventObject) => any): JQuery; + on(events: "changeDate", selector: string, handler: (eventObject: DatepickerEventObject) => any): JQuery; + on(events: 'changeDate', handler: (eventObject: DatepickerEventObject) => any): JQuery; } diff --git a/bootstrap.v3.datetimepicker/boostrap.v3.datetimepicker-tests.ts b/bootstrap.v3.datetimepicker/boostrap.v3.datetimepicker-tests.ts new file mode 100644 index 000000000..6abf38f94 --- /dev/null +++ b/bootstrap.v3.datetimepicker/boostrap.v3.datetimepicker-tests.ts @@ -0,0 +1,31 @@ +/// +/// + +function test_cases() { + $('#datetimepicker').datetimepicker(); + $('#datetimepicker').datetimepicker({ + pickDate: false + }); + $('#datetimepicker').datetimepicker({ + pickTime: false + }); + $('#datetimepicker').datetimepicker({ + minDate: '2012-12-31' + }); + + $('#datetimepicker').data("DateTimePicker").setMaxDate('2012-12-31'); + + var startDate = new Date(2012, 1, 20); + var endDate = new Date(2012, 1, 25); + $('#datetimepicker2') + .datetimepicker() + .on("dp.change", function (ev) { + if (ev.date.valueOf() > endDate.valueOf()) { + $('#alert').show().find('strong').text('The start date must be before the end date.'); + } else { + $('#alert').hide(); + startDate = ev.date; + $('#date-start-display').text($('#date-start').data('date')); + } + }); +} \ No newline at end of file diff --git a/bootstrap.v3.datetimepicker/bootstrap.v3.datetimepicker.d.ts b/bootstrap.v3.datetimepicker/bootstrap.v3.datetimepicker.d.ts new file mode 100644 index 000000000..6f1147cc1 --- /dev/null +++ b/bootstrap.v3.datetimepicker/bootstrap.v3.datetimepicker.d.ts @@ -0,0 +1,100 @@ +// Type definitions for Bootstrap datetimepicker v3 +// Project: http://eonasdan.github.io/bootstrap-datetimepicker +// Definitions by: Jesica N. Fera +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/** + * bootstrap-datetimepicker.js 3.0.0 Copyright (c) 2014 Jonathan Peterson + * Available via the MIT license. + * see: http://eonasdan.github.io/bootstrap-datetimepicker or https://github.com/Eonasdan/bootstrap-datetimepicker for details. + */ + +/// + +declare module BootstrapV3DatetimePicker { + interface DatetimepickerChangeEventObject extends JQueryEventObject { + date: any; + oldDate: any; + } + + interface DatetimepickerEventObject extends JQueryEventObject { + date: any; + } + + interface DatetimepickerIcons { + time?: string; + date?: string; + up?: string; + down?: string; + } + + interface DatetimepickerOptions { + pickDate?: boolean; + pickTime?: boolean; + useMinutes?: boolean; + useSeconds?: boolean; + useCurrent?: boolean; + minuteStepping?: number; + minDate?: any; + maxDate?: any; + showToday?: boolean; + collapse?: boolean; + language?: string; + defaultDate?: string; + disabledDates?: Array; + enabledDates?: Array; + icons?: DatetimepickerIcons; + useStrict?: boolean; + direction?: string; + sideBySide?: boolean; + daysOfWeekDisabled?: Array; + } + + interface Datetimepicker { + setDate(date: any): void; + setMinDate(date: any): void; + setMaxDate(date: any): void; + show(): void; + disable(): void; + enable(): void; + getDate(): void; + } + +} + + +interface JQuery { + + datetimepicker(): JQuery; + datetimepicker(options: BootstrapV3DatetimePicker.DatetimepickerOptions): JQuery; + + off(events: "dp.change", selector?: string, handler?: (eventobject: BootstrapV3DatetimePicker.DatetimepickerChangeEventObject) => any): JQuery; + off(events: "dp.change", handler: (eventobject: BootstrapV3DatetimePicker.DatetimepickerChangeEventObject) => any): JQuery; + + on(events: "dp.change", selector: string, data: any, handler?: (eventobject: BootstrapV3DatetimePicker.DatetimepickerChangeEventObject) => any): JQuery; + on(events: "dp.change", selector: string, handler: (eventobject: BootstrapV3DatetimePicker.DatetimepickerChangeEventObject) => any): JQuery; + on(events: 'dp.change', handler: (eventObject: BootstrapV3DatetimePicker.DatetimepickerChangeEventObject) => any): JQuery; + + off(events: "dp.show", selector?: string, handler?: (eventobject: BootstrapV3DatetimePicker.DatetimepickerEventObject) => any): JQuery; + off(events: "dp.show", handler: (eventobject: BootstrapV3DatetimePicker.DatetimepickerEventObject) => any): JQuery; + + on(events: "dp.show", selector: string, data: any, handler?: (eventobject: BootstrapV3DatetimePicker.DatetimepickerEventObject) => any): JQuery; + on(events: "dp.show", selector: string, handler: (eventobject: BootstrapV3DatetimePicker.DatetimepickerEventObject) => any): JQuery; + on(events: 'dp.show', handler: (eventObject: BootstrapV3DatetimePicker.DatetimepickerEventObject) => any): JQuery; + + off(events: "dp.hide", selector?: string, handler?: (eventobject: BootstrapV3DatetimePicker.DatetimepickerEventObject) => any): JQuery; + off(events: "dp.hide", handler: (eventobject: BootstrapV3DatetimePicker.DatetimepickerEventObject) => any): JQuery; + + on(events: "dp.hide", selector: string, data: any, handler?: (eventobject: BootstrapV3DatetimePicker.DatetimepickerEventObject) => any): JQuery; + on(events: "dp.hide", selector: string, handler: (eventobject: BootstrapV3DatetimePicker.DatetimepickerEventObject) => any): JQuery; + on(events: 'dp.hide', handler: (eventObject: BootstrapV3DatetimePicker.DatetimepickerEventObject) => any): JQuery; + + off(events: "dp.error", selector?: string, handler?: (eventobject: BootstrapV3DatetimePicker.DatetimepickerEventObject) => any): JQuery; + off(events: "dp.error", handler: (eventobject: BootstrapV3DatetimePicker.DatetimepickerEventObject) => any): JQuery; + + on(events: "dp.error", selector: string, data: any, handler?: (eventobject: BootstrapV3DatetimePicker.DatetimepickerEventObject) => any): JQuery; + on(events: "dp.error", selector: string, handler: (eventobject: BootstrapV3DatetimePicker.DatetimepickerEventObject) => any): JQuery; + on(events: 'dp.error', handler: (eventObject: BootstrapV3DatetimePicker.DatetimepickerEventObject) => any): JQuery; + + data(key: 'DateTimePicker'): BootstrapV3DatetimePicker.Datetimepicker; +} \ No newline at end of file diff --git a/buffer-equal/buffer-equal.d.ts b/buffer-equal/buffer-equal.d.ts index 5f671662d..a3597c684 100644 --- a/buffer-equal/buffer-equal.d.ts +++ b/buffer-equal/buffer-equal.d.ts @@ -1,5 +1,5 @@ // Type definitions for buffer-equal 1.0 0 -// Project: https://github.com/chaijs/assertion-error +// Project: https://github.com/substack/node-buffer-equal // Definitions by: Bart van der Schoor // Definitions: https://github.com/borisyankov/DefinitelyTyped diff --git a/bufferstream/bufferstream-tests.ts b/bufferstream/bufferstream-tests.ts new file mode 100644 index 000000000..fe1ea70aa --- /dev/null +++ b/bufferstream/bufferstream-tests.ts @@ -0,0 +1,14 @@ +/// + +import BufferStream = require('bufferstream') + +var stream = new BufferStream({encoding:'utf8', size:'flexible'}); +stream.enable(); +stream.disable(); +stream.split('//', ':'); +stream.on('split', (chunk: any, token: any) => { + console.log("got '%s' by '%s'", chunk.toString(), token.toString()) +}); +stream.write("buffer:stream//23"); +console.log(stream.toString()); + diff --git a/bufferstream/bufferstream.d.ts b/bufferstream/bufferstream.d.ts new file mode 100644 index 000000000..5323103e2 --- /dev/null +++ b/bufferstream/bufferstream.d.ts @@ -0,0 +1,119 @@ +// Type definitions for bufferstream v0.6.2 +// Project: https://github.com/dodo/node-bufferstream +// Definitions by: Bart van der Schoor +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module 'bufferstream' { + import stream = require('stream'); + + export = BufferStream; + + class BufferStream extends stream.Duplex { + constructor(options?: BufferStream.Opts); + + /* + different buffer behaviors can be triggered by size: + + none when output drains, bufferstream drains too + flexible buffers everthing that it gets and not piping out + TODO buffer has given size. buffers everthing until buffer is full. when buffer is full then the stream will drain + */ + setSize(size: string): void; // can be one of ['none', 'flexible', ] + setSize(size: number): void; // can be one of ['none', 'flexible', ] + /* + enables stream buffering default + */ + enable(): void; + /* + flushes buffer and disables stream buffering. BufferStream now pipes all data as long as the output accepting data. when the output is draining BufferStream will buffer all input temporary. + + token[s] buffer splitters (should be String or Buffer) + + disables given tokens. wont flush until no splitter tokens are left. + */ + disable(): void; + disable(token: string, ...tokens: string[]): void; + disable(tokens: string[]): void; // Array + disable(token: Buffer, ...tokens: Buffer[]): void; + disable(tokens: Buffer[]): void; // Array + /* + each time BufferStream finds a splitter token in the input data it will emit a split event. this also works for binary data. + + token[s] buffer splitters (should be String or Buffer) + */ + split(token: string, ...tokens: string[]): void; + split(tokens: string[]): void; // Array + split(token: Buffer, ...tokens: Buffer[]): void; + split(tokens: Buffer[]): void; // Array + /* + returns Buffer. + */ + getBuffer(): Buffer; + /* + returns Buffer. + */ + buffer: Buffer; + /* + shortcut for buffer.toString() + */ + toString(): string; + /* + shortcut for buffer.length + */ + length: number; + } + module BufferStream { + + export interface Opts { + /* + default encoding for writing strings + */ + encoding?: string; + /* + if true and the source is a child_process the stream will block the entire process (timeouts wont work anymore, but splitting and listening on data still works, because they work sync) + */ + blocking?: boolean; + /* + defines buffer level or sets buffer to given size (see ↓setSize for more) + */ + size?: any; + /* + immediately call disable + */ + disabled?: boolean; + /* + short form for: + split(token, function (chunk) {emit('data', chunk)}) + */ + // String or Buffer + split?: any; + } + export var fn: {warn: boolean}; + } +} + +declare module 'bufferstream/postbuffer' { + import http = require('http'); + import BufferStream = require('bufferstream'); + + class PostBuffer extends BufferStream { + /* + for if you want to get all the post data from a http server request and do some db reqeust before. + + http client buffer + */ + constructor(req: http.ServerRequest); + /* + set a callback to get all post data from a http server request + */ + onEnd(callback: (data: any) => void): void; + /* + pumps data into another stream to allow incoming streams given options will be passed to Stream.pipe + */ + pipe(stream: NodeJS.WritableStream, options?: BufferStream.Opts): NodeJS.ReadableStream; + } + + export = PostBuffer; +} diff --git a/camljs/camljs.d.ts b/camljs/camljs.d.ts index 7cfba8a40..0127b3e1d 100644 --- a/camljs/camljs.d.ts +++ b/camljs/camljs.d.ts @@ -102,6 +102,10 @@ declare module CamlBuilder { All(...conditions: IExpression[]): IExpression; /** Adds Or clauses to the query. Use for creating bracket-expressions in conjuction with CamlBuilder.Expression(). */ Any(...conditions: IExpression[]): IExpression; + /** Adds And clauses to the query. Use for creating bracket-expressions in conjuction with CamlBuilder.Expression(). */ + All(conditions: IExpression[]): IExpression; + /** Adds Or clauses to the query. Use for creating bracket-expressions in conjuction with CamlBuilder.Expression(). */ + Any(conditions: IExpression[]): IExpression; /** Specifies that a condition will be tested against the field with the specified internal name, and the type of this field is Text */ TextField(internalName: string): ITextFieldExpression; /** Specifies that a condition will be tested against the field with the specified internal name, and the type of this field is Boolean */ diff --git a/chai-datetime/chai-datetime.d.ts b/chai-datetime/chai-datetime.d.ts index 263034361..bce063443 100644 --- a/chai-datetime/chai-datetime.d.ts +++ b/chai-datetime/chai-datetime.d.ts @@ -1,7 +1,7 @@ // Type definitions for chai-datetime // Project: https://github.com/gaslight/chai-datetime.git // Definitions by: Cliff Burger -// DefinitelyTyped: https://github.com/borisyankov/DefinitelyTyped +// Definitions: https://github.com/borisyankov/DefinitelyTyped /// diff --git a/chai-jquery/chai-jquery.d.ts b/chai-jquery/chai-jquery.d.ts index 52fd4f3f5..826e66579 100644 --- a/chai-jquery/chai-jquery.d.ts +++ b/chai-jquery/chai-jquery.d.ts @@ -1,7 +1,7 @@ // Type definitions for chai-jquery 1.1.1 // Project: https://github.com/chaijs/chai-jquery // Definitions by: Kazi Manzur Rashid -// DefinitelyTyped: https://github.com/borisyankov/DefinitelyTyped +// Definitions: https://github.com/borisyankov/DefinitelyTyped /// diff --git a/chai/chai-assert-tests.ts.tscparams b/chai/chai-assert-tests.ts.tscparams deleted file mode 100644 index e16c76dff..000000000 --- a/chai/chai-assert-tests.ts.tscparams +++ /dev/null @@ -1 +0,0 @@ -"" diff --git a/chai/chai-assert.d.ts b/chai/chai-assert.d.ts index 0790cb17f..30ae2deb7 100644 --- a/chai/chai-assert.d.ts +++ b/chai/chai-assert.d.ts @@ -129,7 +129,3 @@ declare module chai { //browser global declare var assert:chai.Assert; - -declare module 'chai' { -export = chai; -} diff --git a/chai/chai.d.ts b/chai/chai.d.ts index d840aba96..058d55196 100644 --- a/chai/chai.d.ts +++ b/chai/chai.d.ts @@ -1,8 +1,7 @@ // Type definitions for chai 1.7.2 // Project: http://chaijs.com/ // Definitions by: Jed Hunsaker -// DefinitelyTyped: https://github.com/borisyankov/DefinitelyTyped - +// Definitions: https://github.com/borisyankov/DefinitelyTyped declare module chai { @@ -163,3 +162,7 @@ declare module chai { (constructor: Function, expected?: RegExp, message?: string): Expect; } } + +declare module "chai" { + export = chai; +} diff --git a/chalk/chalk-tests.ts b/chalk/chalk-tests.ts new file mode 100644 index 000000000..208709e5b --- /dev/null +++ b/chalk/chalk-tests.ts @@ -0,0 +1,30 @@ +/// + +import chalk = require('chalk'); + +var str: string; +var bool: boolean; + +chalk.enabled = bool; +str = chalk.stripColor(str); + +bool = chalk.supportsColor; +bool = chalk.hasColor(str); + +// style a string +console.log( chalk.blue('Hello world!') ); + +// combine styled and normal strings +console.log( chalk.blue('Hello'), 'World' + chalk.red('!') ); + +// compose multiple styles using the chainable API +console.log( chalk.blue.bgRed.bold('Hello world!') ); + +// pass in multiple arguments +console.log( chalk.blue('Hello', 'World!', 'Foo', 'bar', 'biz', 'baz') ); + +// nest styles +console.log( chalk.red('Hello', chalk.underline.bgBlue('world') + '!') ); + +// nest styles of the same type even (color, underline, background) +console.log( chalk.green('I am a green line ' + chalk.blue('with a blue substring') + ' that becomes green again!') ); diff --git a/chalk/chalk.d.ts b/chalk/chalk.d.ts new file mode 100644 index 000000000..5cceb9514 --- /dev/null +++ b/chalk/chalk.d.ts @@ -0,0 +1,92 @@ +// Type definitions for chalk v0.4.0 +// Project: https://github.com/sindresorhus/chalk +// Definitions by: Diullei Gomes , Bart van der Schoor +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module Chalk { + export interface ChalkModule extends ChalkStyle { + enabled: boolean; + supportsColor: boolean; + styles: ChalkStyleMap; + + stripColor(value: string): any; + hasColor(str: string): boolean; + } + + export interface ChalkChain extends ChalkStyle { + (...text: string[]): ChalkChain; + } + + export interface ChalkStyleElement { + open: string; + close: string; + } + + export interface ChalkStyle { + // General + reset: ChalkChain; + bold: ChalkChain; + italic: ChalkChain; + underline: ChalkChain; + inverse: ChalkChain; + strikethrough: ChalkChain; + + // Text colors + black: ChalkChain; + red: ChalkChain; + green: ChalkChain; + yellow: ChalkChain; + blue: ChalkChain; + magenta: ChalkChain; + cyan: ChalkChain; + white: ChalkChain; + gray: ChalkChain; + + // Background colors + bgBlack: ChalkChain; + bgRed: ChalkChain; + bgGreen: ChalkChain; + bgYellow: ChalkChain; + bgBlue: ChalkChain; + bgMagenta: ChalkChain; + bgCyan: ChalkChain; + bgWhite: ChalkChain; + } + + export interface ChalkStyleMap { + // General + reset: ChalkStyleElement; + bold: ChalkStyleElement; + italic: ChalkStyleElement; + underline: ChalkStyleElement; + inverse: ChalkStyleElement; + strikethrough: ChalkStyleElement; + + // Text colors + black: ChalkStyleElement; + red: ChalkStyleElement; + green: ChalkStyleElement; + yellow: ChalkStyleElement; + blue: ChalkStyleElement; + magenta: ChalkStyleElement; + cyan: ChalkStyleElement; + white: ChalkStyleElement; + gray: ChalkStyleElement; + + // Background colors + bgBlack: ChalkStyleElement; + bgRed: ChalkStyleElement; + bgGreen: ChalkStyleElement; + bgYellow: ChalkStyleElement; + bgBlue: ChalkStyleElement; + bgMagenta: ChalkStyleElement; + bgCyan: ChalkStyleElement; + bgWhite: ChalkStyleElement; + } +} + +declare module "chalk" { + var ch: Chalk.ChalkModule; + export = ch; +} + diff --git a/cheerio/cheerio-tests.ts b/cheerio/cheerio-tests.ts index 71d54c557..af671cd00 100644 --- a/cheerio/cheerio-tests.ts +++ b/cheerio/cheerio-tests.ts @@ -33,7 +33,7 @@ $el.children().map((index, element) => { }); $el.children().filter((index) => { - return $el.children().eq(index).find('t'); + return $el.children().eq(index).find('t').length >= 0; }); $el.filter('span').filter('li'); @@ -60,6 +60,6 @@ $el.text('some text'); $el.toArray(); $el.clone().find('a').parent(); -$el.root().find('a'); +$.root().find('a'); -$el.dom(); +$el.data(); diff --git a/cheerio/cheerio-tests.ts.tscparams b/cheerio/cheerio-tests.ts.tscparams deleted file mode 100644 index e16c76dff..000000000 --- a/cheerio/cheerio-tests.ts.tscparams +++ /dev/null @@ -1 +0,0 @@ -"" diff --git a/cheerio/cheerio.d.ts b/cheerio/cheerio.d.ts index b0e09b778..df5058f20 100644 --- a/cheerio/cheerio.d.ts +++ b/cheerio/cheerio.d.ts @@ -1,81 +1,211 @@ -// Type definitions for Cheerio -// Project: https://github.com/MatthewMueller/cheerio +// Type definitions for Cheerio v0.17.0 +// Project: https://github.com/cheeriojs/cheerio // Definitions by: Bret Little +// Definitions by: VILIC VANE // Definitions: https://github.com/borisyankov/DefinitelyTyped - interface Cheerio { - - addClass(classNames: string): Cheerio; - hasClass(className: string): boolean; - removeClass(className?: any): Cheerio; + // Document References + // Cheerio https://github.com/cheeriojs/cheerio + // JQuery http://api.jquery.com - attr(attributeName: string, value: any): Cheerio; - attr(attributeName: string): string; - removeAttr(attributeName: any): Cheerio; + [index: number]: CheerioElement; + length: number; + + // Attributes + + attr(name: string): string; + attr(name: string, value: any): Cheerio; + + data(): any; + + val(): string; + val(value: string): Cheerio; + + removeAttr(name: string): Cheerio; + + hasClass(className: string): boolean; + addClass(classNames: string): Cheerio; + + removeClass(): Cheerio; + removeClass(className: string): Cheerio; + removeClass(func: (index: number, className: string) => string): Cheerio; + + toggleClass(className: string): Cheerio; + toggleClass(className: string, toggleSwitch: boolean): Cheerio; + toggleClass(toggleSwitch?: boolean): Cheerio; + toggleClass(func: (index: number, className: string, toggleSwitch: boolean) => string, toggleSwitch?: boolean): Cheerio; + + is(selector: string): boolean; + is(element: CheerioElement): boolean; + is(element: CheerioElement[]): boolean; + is(selection: Cheerio): boolean; + is(func: (index: number, element: CheerioElement) => boolean): boolean; + + // Traversing find(selector: string): Cheerio; - parent(): Cheerio; + parent(selector?: string): Cheerio; + parents(selector?: string): Cheerio; + parentsUntil(selector?: string, filter?: string): Cheerio; + parentsUntil(element: CheerioElement, filter?: string): Cheerio; + parentsUntil(element: Cheerio, filter?: string): Cheerio; - next(): Cheerio; - prev(): Cheerio; + closest(selector: string): Cheerio; - siblings(): Cheerio; + next(selector?: string): Cheerio; + nextAll(): Cheerio; - children(selector?: any): Cheerio; + nextUntil(selector?: string, filter?: string): Cheerio; + nextUntil(element: CheerioElement, filter?: string): Cheerio; + nextUntil(element: Cheerio, filter?: string): Cheerio; - each(func: (index: any, elem: any) => Cheerio); + prev(selector?: string): Cheerio; + prevAll(): Cheerio; - map(callback: (index: any, domElement: Element) =>any): Cheerio; + prevUntil(selector?: string, filter?: string): Cheerio; + prevUntil(element: CheerioElement, filter?: string): Cheerio; + prevUntil(element: Cheerio, filter?: string): Cheerio; + + slice(start: number, end?: number): Cheerio; + + siblings(selector?: string): Cheerio; + + children(selector?: string): Cheerio; + + each(func: (index: number, element: CheerioElement) => any): Cheerio; + map(func: (index: number, element: CheerioElement) => any): Cheerio; filter(selector: string): Cheerio; - filter(func: (index: any) =>any): Cheerio; + filter(selection: Cheerio): Cheerio; + filter(element: CheerioElement): Cheerio; + filter(elements: CheerioElement[]): Cheerio; + filter(func: (index: number) => boolean): Cheerio; first(): Cheerio; last(): Cheerio; eq(index: number): Cheerio; - append(...content: any[]): Cheerio; - prepend(...content: any[]): Cheerio; - after(...content: any[]): Cheerio; - before(...content: any[]): Cheerio; - remove(selector: string): Cheerio; + get(): Document[]; + get(index: number): Document; + + end(): Cheerio; + + add(selectorOrHtml: string): Cheerio; + add(selector: string, context: Document): Cheerio; + add(element: CheerioElement): Cheerio; + add(elements: CheerioElement[]): Cheerio; + add(selection: Cheerio): Cheerio; + + // Manipulation + + append(content: string, ...contents: any[]): Cheerio; + append(content: Document, ...contents: any[]): Cheerio; + append(content: Document[], ...contents: any[]): Cheerio; + append(content: Cheerio, ...contents: any[]): Cheerio; + + prepend(content: string, ...contents: any[]): Cheerio; + prepend(content: Document, ...contents: any[]): Cheerio; + prepend(content: Document[], ...contents: any[]): Cheerio; + prepend(content: Cheerio, ...contents: any[]): Cheerio; + + after(content: string, ...contents: any[]): Cheerio; + after(content: Document, ...contents: any[]): Cheerio; + after(content: Document[], ...contents: any[]): Cheerio; + after(content: Cheerio, ...contents: any[]): Cheerio; + + before(content: string, ...contents: any[]): Cheerio; + before(content: Document, ...contents: any[]): Cheerio; + before(content: Document[], ...contents: any[]): Cheerio; + before(content: Cheerio, ...contents: any[]): Cheerio; + + remove(selector?: string): Cheerio; + replaceWith(content: string): Cheerio; + replaceWith(content: CheerioElement): Cheerio; + replaceWith(content: CheerioElement[]): Cheerio; + replaceWith(content: Cheerio): Cheerio; + empty(): Cheerio; - html(htmlString: string): Cheerio; html(): string; + html(html: string): Cheerio; - text(textString: string): Cheerio; text(): string; + text(text: string): Cheerio; - toArray(): any[]; + css(propertyName: string): string; + css(propertyNames: string[]): string[]; + css(propertyName: string, value: string): Cheerio; + css(propertyName: string, value: number): Cheerio; + css(propertyName: string, func: (index: number, value: string) => string): Cheerio; + css(propertyName: string, func: (index: number, value: string) => number): Cheerio; + css(properties: Object): Cheerio; - clone() : Cheerio; - root() : Cheerio; - dom(): any; + // Rendering - contains(container: Element, contained: Element): boolean; - isArray(obj: any): boolean; - inArray(value: any, array: any[], fromIndex?: number): number; - merge(first: any[], second: any[]): any[]; + // Miscellaneous + clone(): Cheerio; + // Not Documented + + toArray(): CheerioElement[]; } interface CheerioOptionsInterface { - ignoreWhitespace?: boolean; + // Document References + // Cheerio https://github.com/cheeriojs/cheerio + // HTMLParser2 https://github.com/fb55/htmlparser2/wiki/Parser-options + // DomHandler https://github.com/fb55/DomHandler + xmlMode?: boolean; + decodeEntities?: boolean; lowerCaseTags?: boolean; + lowerCaseAttributeNames?: boolean; + recognizeCDATA?: boolean; + recognizeSelfClosing?: boolean; + normalizeWhitespace?: boolean; } interface CheerioStatic { - (...selectors: any[]): Cheerio; - (): Cheerio; + // Document References + // Cheerio https://github.com/cheeriojs/cheerio + // JQuery http://api.jquery.com + + (selector: string): Cheerio; + (selector: string, context: string): Cheerio; + (selector: string, context: CheerioElement): Cheerio; + (selector: string, context: CheerioElement[]): Cheerio; + (selector: string, context: Cheerio): Cheerio; + (selector: string, context: string, root: string): Cheerio; + (selector: string, context: CheerioElement, root: string): Cheerio; + (selector: string, context: CheerioElement[], root: string): Cheerio; + (selector: string, context: Cheerio, root: string): Cheerio; + (selector: any): Cheerio; + + xml(): string; + root(): Cheerio; + contains(container: CheerioElement, contained: CheerioElement): boolean; + parseHTML(data: string, context?: Document, keepScripts?: boolean): Document[]; +} + +interface CheerioElement { + // Document References + // Node Console + + type: string; + name: string; + attribs: Object; + children: CheerioElement[]; + next: CheerioElement; + prev: CheerioElement; + parent: CheerioElement; + root: CheerioElement; } declare module "cheerio" { - export function load (html : string, options?: CheerioOptionsInterface) : CheerioStatic; + export function load(html: string, options?: CheerioOptionsInterface): CheerioStatic; } diff --git a/cheerio/cheerio.d.ts.tscparams b/cheerio/cheerio.d.ts.tscparams deleted file mode 100644 index e16c76dff..000000000 --- a/cheerio/cheerio.d.ts.tscparams +++ /dev/null @@ -1 +0,0 @@ -"" diff --git a/chrome/chrome-app.d.ts b/chrome/chrome-app.d.ts index c8dd2e6d4..ad319394f 100644 --- a/chrome/chrome-app.d.ts +++ b/chrome/chrome-app.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Chrome packaged application development. +// Type definitions for Chrome packaged application development // Project: http://developer.chrome.com/apps/ // Definitions by: Adam Lay // Definitions: https://github.com/borisyankov/DefinitelyTyped @@ -92,4 +92,4 @@ declare module chrome.app.window { var onMaximized: WindowEvent; var onMinimized: WindowEvent; var onRestored: WindowEvent; -} \ No newline at end of file +} diff --git a/chrome/chrome.d.ts b/chrome/chrome.d.ts index e8e0f0639..796635c27 100755 --- a/chrome/chrome.d.ts +++ b/chrome/chrome.d.ts @@ -1,6 +1,6 @@ -// Type definitions for Chrome extension development. +// Type definitions for Chrome extension development // Project: http://developer.chrome.com/extensions/ -// Definitions by: Matthew Kimber and otiai10 +// Definitions by: Matthew Kimber , otiai10 // Definitions: https://github.com/borisyankov/DefinitelyTyped //////////////////// @@ -1232,6 +1232,68 @@ declare module chrome.management { var onEnabled: ManagementEnabledEvent; } +//////////////////// +// Notifications +// https://developer.chrome.com/extensions/notifications +//////////////////// +declare module chrome.notifications { + interface ButtonOptions { + title: string; + iconUrl?: string; + } + + interface ItemOptions { + title: string; + message: string; + } + + interface NotificationOptions { + type?: string; + iconUrl?: string; + title?: string; + message?: string; + contextMessage?: string; + priority?: number; + eventTime?: number; + buttons?: Array; + items?: Array; + progress?: number; + isClickable?: boolean; + } + + interface OnClosed { + addListener(callback: (notificationId: string, byUser: boolean) => void): void; + } + + interface OnClicked { + addListener(callback: (notificationId: string) => void): void; + } + + interface OnButtonClicked { + addListener(callback: (notificationId: string, buttonIndex: number) => void): void; + } + + interface OnPermissionLevelChanged { + addListener(callback: (level: string) => void): void; + } + + interface OnShowSettings { + addListener(callback: Function): void; + } + + export var onClosed: OnClosed; + export var onClicked: OnClicked; + export var onButtonClicked: OnButtonClicked; + export var onPermissionLevelChanged: OnPermissionLevelChanged; + export var onShowSettings: OnShowSettings; + + export function create(notificationId: string, options: NotificationOptions, callback: (notificationId: string) => void): void; + export function update(notificationId: string, options: NotificationOptions, callback: (wasUpdated: boolean) => void): void; + export function clear(notificationId: string, callback: (wasCleared: boolean) => void): void; + export function getAll(callback: (notifications: any) => void): void; + export function getPermissionLevel(callback: (level: string) => void): void; +} + //////////////////// // Omnibox //////////////////// diff --git a/cordova-ionic/cordova-ionic-tests.ts b/cordova-ionic/cordova-ionic-tests.ts new file mode 100644 index 000000000..69d1a3d82 --- /dev/null +++ b/cordova-ionic/cordova-ionic-tests.ts @@ -0,0 +1,10 @@ +/// +/// + +// Keyboard +cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true); +cordova.plugins.Keyboard.hideKeyboardAccessoryBar(false); +cordova.plugins.Keyboard.close(); +cordova.plugins.Keyboard.disableScroll(true); +cordova.plugins.Keyboard.disableScroll(false); +console.log(cordova.plugins.Keyboard.isVisible); diff --git a/cordova-ionic/cordova-ionic.d.ts b/cordova-ionic/cordova-ionic.d.ts new file mode 100644 index 000000000..c9b1e635b --- /dev/null +++ b/cordova-ionic/cordova-ionic.d.ts @@ -0,0 +1,14 @@ +// Type definitions for Ionic Cordova plugins +// Project: https://github.com/driftyco +// Definitions by: Hendrik Maus +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +interface Cordova { + plugins:Plugins; +} + +interface Plugins { + Keyboard:Ionic.Keyboard; +} diff --git a/cordova-ionic/plugins/keyboard.d.ts b/cordova-ionic/plugins/keyboard.d.ts new file mode 100644 index 000000000..4ff9e293d --- /dev/null +++ b/cordova-ionic/plugins/keyboard.d.ts @@ -0,0 +1,33 @@ +// Type definitions for Cordova Keyboard plugin +// Project: https://github.com/driftyco/ionic-plugins-keyboard +// Definitions by: Hendrik Maus +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module Ionic { + interface Keyboard { + + /** + * Hide the keyboard accessory bar with the next, previous and done buttons. + * + * @param hide + */ + hideKeyboardAccessoryBar(hide:boolean): void; + + /** + * Close the keyboard if it is open. + */ + close(): void; + + /** + * Disable native scrolling, useful if you are using JavaScript to scroll + * + * @param disbale + */ + disableScroll(disbale:boolean): void; + + /** + * Whether or not the keyboard is currently visible. + */ + isVisible: boolean; + } +} diff --git a/cordova/cordova.d.ts b/cordova/cordova.d.ts index 95be38882..9377912b0 100644 --- a/cordova/cordova.d.ts +++ b/cordova/cordova.d.ts @@ -1,6 +1,6 @@ -// Type definitions for Apache Cordova. +// Type definitions for Apache Cordova // Project: http://cordova.apache.org -// Definitions by: Microsoft Open Technologies, Inc. +// Definitions by: Microsoft Open Technologies Inc. // Definitions: https://github.com/borisyankov/DefinitelyTyped // // Copyright (c) Microsoft Open Technologies, Inc. @@ -57,4 +57,4 @@ interface UrlUtil { } /** Apache Cordova instance */ -declare var cordova: Cordova; \ No newline at end of file +declare var cordova: Cordova; diff --git a/cordovarduino/cordovarduino-tests.ts b/cordovarduino/cordovarduino-tests.ts new file mode 100644 index 000000000..a4fd60878 --- /dev/null +++ b/cordovarduino/cordovarduino-tests.ts @@ -0,0 +1,38 @@ +/// + +serial.requestPermission(function success() {}, function error() {}); +serial.open({}, function success() {}, function error() {}); +serial.write('data_string', function success() {}, function error() {}); +serial.read(function success() {}, function error() {}); +serial.registerReadCallback( + function success(data:any) { + var view = new Uint8Array(data); + console.log(view); + }, + function error() { + new Error("Failed to register read callback"); + }); +serial.close(function success() {}, function error() {}); + +var errorCallback = function (message:string) { + alert('Error: ' + message); +}; + +serial.requestPermission( + function (successMessage:string) { + serial.open( + {baudRate: 9600}, + function (successMessage:string) { + serial.write( + '1', + function (successMessage:string) { + alert(successMessage); + }, + errorCallback + ); + }, + errorCallback + ); + }, + errorCallback +); diff --git a/cordovarduino/cordovarduino.d.ts b/cordovarduino/cordovarduino.d.ts new file mode 100644 index 000000000..0fccff2ad --- /dev/null +++ b/cordovarduino/cordovarduino.d.ts @@ -0,0 +1,84 @@ +// Type definitions for Cordovarduino plugin +// Project: https://github.com/stereolux/cordovarduino +// Definitions by: Hendrik Maus +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module Cordovardunio { + interface Serial { + /** + * Request permission to interact with the serial port. + * + * @param successCallback Function to call on success + * @param errorCallback Function to call on error + */ + requestPermission(successCallback:Function, errorCallback:Function): void; + + /** + * Open a connection. + * + * @param opts SerialOptions object + * @param successCallback Function to call on success + * @param errorCallback Function to call on error + */ + open(opts:SerialOptions, successCallback:Function, errorCallback:Function): void + + /** + * Write to the serial port. + * + * @param data String data to write to serial port + * @param successCallback Function to call on success + * @param errorCallback Function to call on error + */ + write(data:string, successCallback:Function, errorCallback:Function): void; + + /** + * Read from the serial port. + * + * @param successCallback Function to call on success + * @param errorCallback Function to call on error + */ + read(successCallback:Function, errorCallback:Function): void; + + /** + * Close connection. + * + * @param successCallback Function to call on success + * @param errorCallback Function to call on error + */ + close(successCallback:Function, errorCallback:Function): void; + + /** + * Register a callback for the driver reading incoming data from the serial device + * + * @param successCallback Function to call on success + * @param errorCallback Function to call on error + */ + registerReadCallback(successCallback:Function, errorCallback:Function): void; + } + + interface SerialOptions { + /** + * @defaultValue 9600 + */ + baudRate?: number; + + /** + * @defaultValue 8 + */ + dataBits?: number; + + /** + * @defaultValue 1 + */ + stopBits?: number; + + /** + * @defaultValue 0 + */ + parity?: number; + } +} + + +// Plugin will be surfaced as window.serial +declare var serial:Cordovardunio.Serial; diff --git a/createjs-lib/createjs-lib.d.ts b/createjs-lib/createjs-lib.d.ts index 048fde92d..a61679aa7 100644 --- a/createjs-lib/createjs-lib.d.ts +++ b/createjs-lib/createjs-lib.d.ts @@ -1,5 +1,5 @@ -// Type definitions for EaselJS 0.7.1, TweenJS 0.5.1, SoundJS 0.5.2, PreloadJS 0.4.1 -// Project: http://www.createjs.com/#!/EaselJS +// Type definitions for CreateJS +// Project: http://www.createjs.com/ // Definitions by: Pedro Ferreira , Chris Smith , Satoru Kimura // Definitions: https://github.com/borisyankov/DefinitelyTyped diff --git a/createjs/createjs.d.ts b/createjs/createjs.d.ts index 7be29abbe..f064d07f6 100644 --- a/createjs/createjs.d.ts +++ b/createjs/createjs.d.ts @@ -1,5 +1,5 @@ -// Type definitions for EaselJS 0.7.1, TweenJS 0.5.1, SoundJS 0.5.2, PreloadJS 0.4.1 -// Project: http://www.createjs.com/#!/EaselJS +// Type definitions for CreateJS +// Project: http://www.createjs.com/ // Definitions by: Pedro Ferreira , Chris Smith , Satoru Kimura // Definitions: https://github.com/borisyankov/DefinitelyTyped diff --git a/crossroads/crossroads.d.ts b/crossroads/crossroads.d.ts index 76fad217a..e86e3154d 100644 --- a/crossroads/crossroads.d.ts +++ b/crossroads/crossroads.d.ts @@ -1,7 +1,7 @@ // Type definitions for Crossroads.js // Project: http://millermedeiros.github.io/crossroads.js/ // Definitions by: Diullei Gomes -// DefinitelyTyped: https://github.com/borisyankov/DefinitelyTyped +// Definitions: https://github.com/borisyankov/DefinitelyTyped /// diff --git a/d3/d3-tests.ts b/d3/d3-tests.ts index 1a1acc324..1a2b5f1c5 100644 --- a/d3/d3-tests.ts +++ b/d3/d3-tests.ts @@ -2587,4 +2587,42 @@ function extentTest() { d3.extent(["20", 3], (d) => { return d; }); d3.extent([3, "20"], (d) => { return d; }); d3.extent(["3", 20], (d) => { return d; }); +} + +// Tests for d3.time.format.multi +// Adopted from http://bl.ocks.org/mbostock/4149176 +function multiTest() { + var customTimeFormat = d3.time.format.multi([ + [".%L", function(d) { return d.getMilliseconds(); }], + [":%S", function(d) { return d.getSeconds(); }], + ["%I:%M", function(d) { return d.getMinutes(); }], + ["%I %p", function(d) { return d.getHours(); }], + ["%a %d", function(d) { return d.getDay() && d.getDate() != 1; }], + ["%b %d", function(d) { return d.getDate() != 1; }], + ["%B", function(d) { return d.getMonth(); }], + ["%Y", function() { return true; }] + ]); + + var margin = {top: 250, right: 40, bottom: 250, left: 40}, + width = 960 - margin.left - margin.right, + height = 500 - margin.top - margin.bottom; + + var x = d3.time.scale() + .domain([new Date(2012, 0, 1), new Date(2013, 0, 1)]) + .range([0, width]); + + var xAxis = d3.svg.axis() + .scale(x) + .tickFormat(customTimeFormat); + + var svg = d3.select("body").append("svg") + .attr("width", width + margin.left + margin.right) + .attr("height", height + margin.top + margin.bottom) + .append("g") + .attr("transform", "translate(" + margin.left + "," + margin.top + ")"); + + svg.append("g") + .attr("class", "x axis") + .attr("transform", "translate(0," + height + ")") + .call(xAxis); } \ No newline at end of file diff --git a/d3/d3.d.ts b/d3/d3.d.ts old mode 100644 new mode 100755 index 2225db5fc..598cd9f34 --- a/d3/d3.d.ts +++ b/d3/d3.d.ts @@ -42,14 +42,14 @@ declare module D3 { }; } - export interface Event { + export interface D3Event extends Event{ dx: number; dy: number; clientX: number; clientY: number; translate: number[]; scale: number; - sourceEvent: Event; + sourceEvent: D3Event; x: number; y: number; keyCode: number; @@ -65,7 +65,7 @@ declare module D3 { /** * Access the current user event for interaction */ - event: Event; + event: D3Event; /** * Compare two values for sorting. @@ -751,8 +751,8 @@ declare module D3 { empty: () => boolean; data: { - (values: (data: any, index?: number) => any[], key?: (data: any, index?: number) => string): UpdateSelection; - (values: any[], key?: (data: any, index?: number) => string): UpdateSelection; + (values: (data: any, index?: number) => any[], key?: (data: any, index?: number) => any): UpdateSelection; + (values: any[], key?: (data: any, index?: number) => any): UpdateSelection; (): any[]; }; @@ -1003,9 +1003,29 @@ declare module D3 { fridays: Range; saturdays: Range; format: { - + /** + * Constructs a new local time formatter using the given specifier. + */ (specifier: string): TimeFormat; - utc: (specifier: string) => TimeFormat; + /** + * Returns a new multi-resolution time format given the specified array of predicated formats. + */ + multi: (formats: any[][]) => TimeFormat; + + utc: { + /** + * Constructs a new local time formatter using the given specifier. + */ + (specifier: string): TimeFormat; + /** + * Returns a new multi-resolution UTC time format given the specified array of predicated formats. + */ + multi: (formats: any[][]) => TimeFormat; + }; + + /** + * The full ISO 8601 UTC time format: "%Y-%m-%dT%H:%M:%S.%LZ". + */ iso: TimeFormat; }; @@ -1600,6 +1620,7 @@ declare module D3 { export interface Symbol { type: (string:string) => Symbol; size: (number:number) => Symbol; + (datum:any, index:number): string; } export interface Brush { @@ -2743,7 +2764,7 @@ declare module D3 { clamp(clamp: boolean): TimeScale; ticks: { (count: number): any[]; - (range: Range, count: number): any[]; + (range: D3.Time.Range, count: number): any[]; }; tickFormat(count: number): (n: number) => string; copy(): TimeScale; diff --git a/date.format.js/date.format-tests.ts b/date.format.js/date.format-tests.ts new file mode 100644 index 000000000..d06e78cb7 --- /dev/null +++ b/date.format.js/date.format-tests.ts @@ -0,0 +1,10 @@ +/// + +// test dateFormat +var now : string = dateFormat(); +var nowFullDate : string = dateFormat( dateFormat.masks.fullDate ); + +// test format() (on the prototype of Date) +var then : Date = new Date( 2014, 1, 1 ); +var thenDefaultFormat : string = then.format(); +var thenCustomFormat : string = then.format('yyyy/m/d HH:MM'); diff --git a/date.format.js/date.format.d.ts b/date.format.js/date.format.d.ts new file mode 100644 index 000000000..6e4ef4ea6 --- /dev/null +++ b/date.format.js/date.format.d.ts @@ -0,0 +1,244 @@ +// Type definitions for Date Format 1.2.3 +// Project: http://blog.stevenlevithan.com/archives/date-time-format +// Definitions by: Rob Stutton +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/***************************************************************************** + Portions Copyright (c) Microsoft Corporation. All rights reserved. + Licensed under the Apache License, Version 2.0 (the "License"); you may not use + this file except in compliance with the License. You may obtain a copy of the + License at http://www.apache.org/licenses/LICENSE-2.0 + + THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED + WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, + MERCHANTABLITY OR NON-INFRINGEMENT. + + See the Apache Version 2.0 License for specific language governing permissions + and limitations under the License. + ***************************************************************************** */ + +/** Enables basic storage and retrieval of dates and times. */ +interface Date { + /** Returns a string representation of a date. The format of the string depends on the locale. */ + toString(): string; + /** Returns a date as a string value. */ + toDateString(): string; + /** Returns a time as a string value. */ + toTimeString(): string; + /** Returns a value as a string value appropriate to the host environment's current locale. */ + toLocaleString(): string; + /** Returns a date as a string value appropriate to the host environment's current locale. */ + toLocaleDateString(): string; + /** Returns a time as a string value appropriate to the host environment's current locale. */ + toLocaleTimeString(): string; + /** Returns the stored time value in milliseconds since midnight, January 1, 1970 UTC. */ + valueOf(): number; + /** Gets the time value in milliseconds. */ + getTime(): number; + /** Gets the year, using local time. */ + getFullYear(): number; + /** Gets the year using Universal Coordinated Time (UTC). */ + getUTCFullYear(): number; + /** Gets the month, using local time. */ + getMonth(): number; + /** Gets the month of a Date object using Universal Coordinated Time (UTC). */ + getUTCMonth(): number; + /** Gets the day-of-the-month, using local time. */ + getDate(): number; + /** Gets the day-of-the-month, using Universal Coordinated Time (UTC). */ + getUTCDate(): number; + /** Gets the day of the week, using local time. */ + getDay(): number; + /** Gets the day of the week using Universal Coordinated Time (UTC). */ + getUTCDay(): number; + /** Gets the hours in a date, using local time. */ + getHours(): number; + /** Gets the hours value in a Date object using Universal Coordinated Time (UTC). */ + getUTCHours(): number; + /** Gets the minutes of a Date object, using local time. */ + getMinutes(): number; + /** Gets the minutes of a Date object using Universal Coordinated Time (UTC). */ + getUTCMinutes(): number; + /** Gets the seconds of a Date object, using local time. */ + getSeconds(): number; + /** Gets the seconds of a Date object using Universal Coordinated Time (UTC). */ + getUTCSeconds(): number; + /** Gets the milliseconds of a Date, using local time. */ + getMilliseconds(): number; + /** Gets the milliseconds of a Date object using Universal Coordinated Time (UTC). */ + getUTCMilliseconds(): number; + /** Gets the difference in minutes between the time on the local computer and Universal Coordinated Time (UTC). */ + getTimezoneOffset(): number; + /** + * Sets the date and time value in the Date object. + * @param time A numeric value representing the number of elapsed milliseconds since midnight, January 1, 1970 GMT. + */ + setTime(time: number): void; + /** + * Sets the milliseconds value in the Date object using local time. + * @param ms A numeric value equal to the millisecond value. + */ + setMilliseconds(ms: number): void; + /** + * Sets the milliseconds value in the Date object using Universal Coordinated Time (UTC). + * @param ms A numeric value equal to the millisecond value. + */ + setUTCMilliseconds(ms: number): void; + + /** + * Sets the seconds value in the Date object using local time. + * @param sec A numeric value equal to the seconds value. + * @param ms A numeric value equal to the milliseconds value. + */ + setSeconds(sec: number, ms?: number): void; + /** + * Sets the seconds value in the Date object using Universal Coordinated Time (UTC). + * @param sec A numeric value equal to the seconds value. + * @param ms A numeric value equal to the milliseconds value. + */ + setUTCSeconds(sec: number, ms?: number): void; + /** + * Sets the minutes value in the Date object using local time. + * @param min A numeric value equal to the minutes value. + * @param sec A numeric value equal to the seconds value. + * @param ms A numeric value equal to the milliseconds value. + */ + setMinutes(min: number, sec?: number, ms?: number): void; + /** + * Sets the minutes value in the Date object using Universal Coordinated Time (UTC). + * @param min A numeric value equal to the minutes value. + * @param sec A numeric value equal to the seconds value. + * @param ms A numeric value equal to the milliseconds value. + */ + setUTCMinutes(min: number, sec?: number, ms?: number): void; + /** + * Sets the hour value in the Date object using local time. + * @param hours A numeric value equal to the hours value. + * @param min A numeric value equal to the minutes value. + * @param sec A numeric value equal to the seconds value. + * @param ms A numeric value equal to the milliseconds value. + */ + setHours(hours: number, min?: number, sec?: number, ms?: number): void; + /** + * Sets the hours value in the Date object using Universal Coordinated Time (UTC). + * @param hours A numeric value equal to the hours value. + * @param min A numeric value equal to the minutes value. + * @param sec A numeric value equal to the seconds value. + * @param ms A numeric value equal to the milliseconds value. + */ + setUTCHours(hours: number, min?: number, sec?: number, ms?: number): void; + /** + * Sets the numeric day-of-the-month value of the Date object using local time. + * @param date A numeric value equal to the day of the month. + */ + setDate(date: number): void; + /** + * Sets the numeric day of the month in the Date object using Universal Coordinated Time (UTC). + * @param date A numeric value equal to the day of the month. + */ + setUTCDate(date: number): void; + /** + * Sets the month value in the Date object using local time. + * @param month A numeric value equal to the month. The value for January is 0, and other month values follow consecutively. + * @param date A numeric value representing the day of the month. If this value is not supplied, the value from a call to the getDate method is used. + */ + setMonth(month: number, date?: number): void; + /** + * Sets the month value in the Date object using Universal Coordinated Time (UTC). + * @param month A numeric value equal to the month. The value for January is 0, and other month values follow consecutively. + * @param date A numeric value representing the day of the month. If it is not supplied, the value from a call to the getUTCDate method is used. + */ + setUTCMonth(month: number, date?: number): void; + /** + * Sets the year of the Date object using local time. + * @param year A numeric value for the year. + * @param month A zero-based numeric value for the month (0 for January, 11 for December). Must be specified if numDate is specified. + * @param date A numeric value equal for the day of the month. + */ + setFullYear(year: number, month?: number, date?: number): void; + /** + * Sets the year value in the Date object using Universal Coordinated Time (UTC). + * @param year A numeric value equal to the year. + * @param month A numeric value equal to the month. The value for January is 0, and other month values follow consecutively. Must be supplied if numDate is supplied. + * @param date A numeric value equal to the day of the month. + */ + setUTCFullYear(year: number, month?: number, date?: number): void; + /** Returns a date converted to a string using Universal Coordinated Time (UTC). */ + toUTCString(): string; + /** Returns a date as a string value in ISO format. */ + toISOString(): string; + /** Used by the JSON.stringify method to enable the transformation of an object's data for JavaScript Object Notation (JSON) serialization. */ + toJSON(key?: any): string; + /** + * This is a convenience addition to the Date prototype + * Returns a formatted version of the date. + * The mask defaults to dateFormat.masks.default. + * @param {string=} mask + * @param {boolean=} utc + */ + format(mask?: string, utc?: boolean) : string; +} + +declare var Date: { + new (): Date; + new (value: number): Date; + new (value: string): Date; + new (year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date; + (): string; + prototype: Date; + /** + * Parses a string containing a date, and returns the number of milliseconds between that date and midnight, January 1, 1970. + * @param s A date string + */ + parse(s: string): number; + /** + * Returns the number of milliseconds between midnight, January 1, 1970 Universal Coordinated Time (UTC) (or GMT) and the specified date. + * @param year The full year designation is required for cross-century date accuracy. If year is between 0 and 99 is used, then year is assumed to be 1900 + year. + * @param month The month as an number between 0 and 11 (January to December). + * @param date The date as an number between 1 and 31. + * @param hours Must be supplied if minutes is supplied. An number from 0 to 23 (midnight to 11pm) that specifies the hour. + * @param minutes Must be supplied if seconds is supplied. An number from 0 to 59 that specifies the minutes. + * @param seconds Must be supplied if milliseconds is supplied. An number from 0 to 59 that specifies the seconds. + * @param ms An number from 0 to 999 that specifies the milliseconds. + */ + UTC(year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): number; + now(): number; +}; + +// Some common format strings +interface DateFormatMasks { + "default": string; + shortDate: string; + mediumDate: string; + longDate: string; + fullDate: string; + shortTime: string; + mediumTime: string; + longTime: string; + isoDate: string; + isoTime: string; + isoDateTime: string; + isoUtcDateTime: string; +} + +// Internationalization strings +interface DateFormatI18n { + dayNames: string[]; + monthNames: string[]; +} + +/** + * Accepts a date, a mask, or a date and a mask. + * Returns a formatted version of the given date. + * The date defaults to the current date/time. + * The mask defaults to dateFormat.masks.default. + * @param {Date=} date + * @param {string=} mask + * @param {boolean=} utc + */ +declare var dateFormat: { + (date?: any, mask?: string, utc?: boolean ): string; + masks : DateFormatMasks; + i18n : DateFormatI18n; +}; diff --git a/dcjs/dc.d.ts b/dcjs/dc.d.ts index 0391d2502..2b06c34dd 100644 --- a/dcjs/dc.d.ts +++ b/dcjs/dc.d.ts @@ -1,7 +1,8 @@ // Type definitions for DCJS // Project: https://github.com/dc-js -// Definitions by: hans windhoff +// Definitions by: hans windhoff // Definitions: https://github.com/borisyankov/DefinitelyTyped + // this makes only sense together with d3 and crossfilter so you need the d3.d.ts and crossfilter.d.ts files /// @@ -195,4 +196,4 @@ export interface ILegendwidget { export function rowChart(cssSel: string): IRowchart; -} \ No newline at end of file +} diff --git a/deep-freeze/deep-freeze-tests.ts b/deep-freeze/deep-freeze-tests.ts new file mode 100644 index 000000000..8369d3087 --- /dev/null +++ b/deep-freeze/deep-freeze-tests.ts @@ -0,0 +1,8 @@ +/// + +import df = require('deep-freeze'); + +class Foo { + foo: string; +} +var foo:Foo = df(new Foo()); diff --git a/deep-freeze/deep-freeze.d.ts b/deep-freeze/deep-freeze.d.ts new file mode 100644 index 000000000..3d7ede8ad --- /dev/null +++ b/deep-freeze/deep-freeze.d.ts @@ -0,0 +1,9 @@ +// Type definitions for deep-freeze +// Project: https://github.com/substack/deep-freeze +// Definitions by: Bart van der Schoor +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module 'deep-freeze' { + function df(obj: T): T; + export = df; +} diff --git a/dojo/README.md b/dojo/README.md new file mode 100644 index 000000000..1fa593757 --- /dev/null +++ b/dojo/README.md @@ -0,0 +1,298 @@ +# Dojo Definitions Usage Notes + +## Overview +Anyone that has used Dojo for any length of time has probably discovered three things: +* Dojo is very powerful +* Dojo can be challenging to learn +* Dojo doesn't always play well with other + +Having said that, there are ways that Dojo can be coerced out of its shell to work with other JavaScript technologies. This README is intended to describe some techniques for getting the full power of Dojo to work in an environment where almost everything can take advantage of TypeScript. + +*Disclaimer*: Dojo is VERY big framework and, as such the type definitions are generated by a [tool](https://github.com/vansimke/DojoTypeDescriptionGenerator) from dojo's [API](dojotoolkit.org/api) docs. The generated files were then hand-polished to eliminate any import errors and clean up some obvious errors. This is all to say that the generated type definitions are not flawless and are not guaranteed to reflect the actual implementations. + +## Basic Usage +A normal dojo module might look something like this: + +```js + define(['dojo/request', 'dojo/request/xhr'], + function (request, xhr) { + ... + } + ); +``` + +When using the TypeScript, you can write the following: + +```ts + define(['dojo/request', 'dojo/request/xhr'], + function (request: dojo.request, + xhr: dojo.request.xhr) { + ... + } + ); + ``` + + Inside of the define variable, both `request` and `xhr` will work as the functions that come from Dojo, only they are strongly typed. + +## Advanced Usage + Dojo and TypeScript both use different and conflicting class semantics. This causes some issues when trying to create custom class modules that are strongly typed in other modules. The following technique is presented as **A** solution to the problem, but not necessarily the best one. Other ideas a welcomed! + + Using pure JavaScript, a class that has a base class and mixins can be defined in Dojo as follows: + + ```js + define(['dojo/_base/declare', 'dijit/_WidgetBase', 'dijit/_TemplatedMixin', 'dojo/request'], + function(dojoDeclare, _WidgetBase, _TemplatedMixin, request) { + var Foo = dojoDeclare([_WidgetBase, _TemplatedMixin], { + templateString: '
Hello TypeScript { + console.log(data); + }); + } + + } + } +``` + +This class is identical to the standard Dojo method, except that it is declared inside of a TypeScript module and it is declared using TypeScript instead of Dojo's `declare` method. Two problems arise however: +1. `Foo` has an error because it doesn't honor the interface declared by dijit._TemplatedMixin +2. `request` is undefined + +The first problem can be solved by adding the missing properties and methods, but this will only serve to clutter the code base over time. Instead, we are creating another base class that hides this requirement like so: + +```ts + module App { + export class Foo extends WidgetBaseWithTemplatedMixin { + constructor(public templateString= "
Hello TypeScript
", + public message= "") { + super(); + } + + sayMessage() { + alert(this.message); + } + + getServerInfo() { + request.get("http://dojoAndTypeScriptTogetherAtLast.html", (data: string) => { + console.log(data); + }); + } + + } + + export class WidgetBaseWithTemplatedMixin extends dijit._WidgetBase implements dijit._TemplatedMixin { + "attachScope": Object; + "searchContainerNode": boolean; + "templatePath": string; + "templateString": string; + buildRendering(): {} + destroyRendering(): {} + getCachedTemplate(templateString: String, alwaysUseString: boolean, doc: HTMLDocument): {} + + } + } +``` + +Now the base class meets TypeScript's requirements so it is happy. This class could easily be moved out to a general add-in file so that it can be created and forgotten since it is only here to make TypeScript happy. + +The second problem that we had as that `request` is undefined. This is going to take a bit more trickery as shown below: + +```ts + module App { + export class Foo extends WidgetBaseWithTemplatedMixin { + constructor(public templateString= "
Hello TypeScript
", + public message= "") { + super(); + } + + public request: dojo.request; + + sayMessage() { + alert(this.message); + } + + getServerInfo() { + this.request.get("http://dojoAndTypeScriptTogetherAtLast.html").then((data: string) => { + console.log(data); + }); + } + + } + + export class WidgetBaseWithTemplatedMixin extends dijit._WidgetBase implements dijit._TemplatedMixin { + public static getPrototype(deps: Object) { + if (deps) { + for (var i in deps) { + this.prototype[i] = deps[i]; + } + + return this.prototype; + } + } + + "attachScope": Object; + "searchContainerNode": boolean; + "templatePath": string; + "templateString": string; + buildRendering(): {} + destroyRendering(): {} + getCachedTemplate(templateString: String, alwaysUseString: boolean, doc: HTMLDocument): {} + + } + } + + + define(['dojo/_base/declare', 'dijit/_WidgetBase', 'dijit/_TemplatedMixin', 'dojo/request'], + function (dojoDeclare, _WidgetBase, _TemplatedMixin, request) { + var deps = { + request: request + }; + + var Foo = dojoDeclare([_WidgetBase, _TemplatedMixin], App.Foo.getPrototype(deps)); + + return Foo; + } + ); +``` + +Yes, I know - pretty crazy right. But, we're getting close... + +In the Dojo module, we are building an object that contains references to each of the dependencies. We are then passing that object into the static method `getPrototype` that we have added to the base class. This method takes an object literal and mixes it into the class's prototype. In this way, the module dependencies are made available to the TypeScript class via its prototype. The last thing we need to do is change the `getServerInfo()`'s call to `request` to be a `this.request` call since it is calling through its prototype instead of the ambient object that is used in Dojo. + +Okay, great. TypeScript is happy. Everything should be working right? Wrong. + +We have two more problems that are not apparent until the code is actually executed. They are both related to our usage of the `extends` keyword that we used to show that our `Foo` class extends from `dijit._WidgetBase`. + +The first problem is that, as stated previously, TypeScript has its own implementation of a class system in JavaScript. When one class extends another, TypeScript injects the following snippet into the module: + +```js + var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); + }; +``` + +This method is called in a closure that wraps the class definition and mixes the parent's prototype and owned properties into the child class. However, this won't work in our case, because our base class is `dijit._WidgetBase` which doesn't actually exist in the global namespace (where TypeScript expects it). This is because we are still using Dojo's class system (via `declare`). This is an important, and confusing, point. Our class is actually being constructed by Dojo using declare. However, we are working with the class as if it was created in the way the TypeScript expects. In short, this means that we don't actually need the `__extends` function to work, but something needs to be there so that the constructor function doesn't die. The solve is actually relatively easy: In the main HTML page, add this function before the tag that includes `dojo.js`: + +```js +var __extends = function (d, b) { + if (d && b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { + this.constructor = d; + } + + __.prototype = b.prototype; + d.prototype = new __(); + } +}; +``` + +All this does is check to see if `d` and `b` are defined before running. Since TypeScript won't override __extends, it will allow us to override the default implementation. + +Okay, only one more thing to deal with: the call to super. This issue is also related to TypeScript's method for handling inheritance. After calling `__extends`, the generated constructor function will call the parent's constructor function. Once again, we are hit by the fact that our base class (`dijit._WidgetBase`) doesn't actually exist where TypeScript is expecting it. The only way around this is to give TypeScript something to call. This simplest thing to do is to add a no-op function for TypeScript to call. In short add this: + +```js + var dijit = dijit || {}; + dijit._WidgetBase = function() {} +``` + +Into the page after Dojo bootstraps, but before our module loads. The simplest way to do this is to create a little module that does this and added it to the array of modules loaded in the `define()` call of the module. + +Okay, so things look pretty messy right now. There are several hacks and tricks that we have to play in order to allow TypeScript and Dojo to work together. The nice thing about most of this is that it can all be shoved into a single helper module and never thought of again. Here is an example of what that module would look like: + +```ts + "use strict"; + + define([], function () { }); + + var __extends = function (d, b) { + if (d && b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { + this.constructor = d; + } + + __.prototype = b.prototype; + d.prototype = new __(); + } + }; + + window['dojo'] = {}; + window['dijit'] = { + _WidgetBase: function () { + + } + }; + + module Base { + function getPrototype(type: Function, deps: Object): Object { + if (deps) { + for (var i in deps) { + type.prototype[i] = deps[i]; + } + + return this.prototype; + } + } + export class WidgetBaseWithTemplatedMixin extends dijit._WidgetBase implements dijit._TemplatedMixin { + public static getPrototype(deps: Object): Object { + return getPrototype(this, deps); + } + + "attachScope": Object; + "searchContainerNode": boolean; + "templatePath": string; + "templateString": string; + buildRendering() { } + destroyRendering() { } + getCachedTemplate(templateString: String, alwaysUseString: boolean, doc: HTMLDocument) { } + + } + } +``` + +This module can then be added to whenever we have another base class / mix-in combination (e.g. dijit/_WidgetBase, dijit/_TemplatedMixin, and dijit/_WidgetsInTemplateMixin). When done this way, the only regularly visible changes that we have to do is to compose the hash of dependencies and call the `getPrototype` as the last argument to `declare`. + +## Appendix + +Examples: +* https://github.com/craigstjean/typescript-dojo-sample + diff --git a/dojo/dijit.d.ts b/dojo/dijit.d.ts new file mode 100644 index 000000000..f95d636c0 --- /dev/null +++ b/dojo/dijit.d.ts @@ -0,0 +1,104749 @@ +// Type definitions for Dojo v1.9 +// Project: http://dojotoolkit.org +// Definitions by: Michael Van Sickle +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module dijit { + /** + * Permalink: http://dojotoolkit.org/api/1.9/dijit/_BidiSupport.html + * + * Deprecated module for enabling textdir support in the dijit widgets. New code should just define + * has("dojo-bidi") to return true, rather than manually requiring this module. + * + */ + interface _BidiSupport{(): void} + /** + * Permalink: http://dojotoolkit.org/api/1.9/dijit/BackgroundIframe.html + * + * For IE/FF z-index shenanigans. id attribute is required. + * new dijit.BackgroundIframe(node). + * + * Makes a background iframe as a child of node, that fills + * area (and position) of node + * + * @param node + */ + interface BackgroundIframe{(node: HTMLElement): void} + module BackgroundIframe { + /** + * destroy the iframe + * + */ + interface destroy{(): void} + /** + * Resize the iframe so it's the same size as node. + * Needed on IE6 and IE/quirks because height:100% doesn't work right. + * + * @param node + */ + interface resize{(node: any): void} + } + + /** + * Permalink: http://dojotoolkit.org/api/1.9/dijit/hccss.html + * + * Test if computer is in high contrast mode, and sets dijit_a11y flag on if it is. + * Deprecated, use dojo/hccss instead. + * + */ + interface hccss{(): void} + /** + * Permalink: http://dojotoolkit.org/api/1.9/dijit/_AttachMixin.html + * + * Mixin for widgets to attach to dom nodes and setup events via + * convenient data-dojo-attach-point and data-dojo-attach-event DOM attributes. + * + * Superclass of _TemplatedMixin, and can also be used standalone when templates are pre-rendered on the + * server. + * + * Does not [yet] handle widgets like ContentPane with this.containerNode set. It should skip + * scanning for data-dojo-attach-point and data-dojo-attach-event inside this.containerNode, but it + * doesn't. + * + * @param params Hash of initialization parameters for widget, including scalar values (like title, duration etc.)and functions, typically callbacks like onClick.The hash can contain any of the widget's properties, excluding read-only properties. + * @param srcNodeRef OptionalIf a srcNodeRef (DOM node) is specified, replace srcNodeRef with my generated DOM tree. + */ + class _AttachMixin { + constructor(params?: Object, srcNodeRef?: HTMLElement); + /** + * Object to which attach points and events will be scoped. Defaults + * to 'this'. + * + */ + "attachScope": Object; + /** + * Search descendants of this.containerNode for data-dojo-attach-point and data-dojo-attach-event. + * Should generally be left false (the default value) both for performance and to avoid failures when + * this.containerNode holds other _AttachMixin instances with their own attach points and events. + * + */ + "searchContainerNode": boolean; + /** + * Attach to DOM nodes marked with special attributes. + * + */ + buildRendering(): void; + /** + * + */ + destroyRendering(): void; + } + /** + * Permalink: http://dojotoolkit.org/api/1.9/dijit/_Container.html + * + * Mixin for widgets that contain HTML and/or a set of widget children. + * + */ + class _Container { + constructor(); + /** + * Makes the given widget a child of this widget. + * Inserts specified child widget's dom node as a child of this widget's + * container node, and possibly does other processing (such as layout). + * + * @param widget + * @param insertIndex Optional + */ + addChild(widget: dijit._WidgetBase, insertIndex: number): void; + /** + * + */ + buildRendering(): void; + /** + * Gets the index of the child in this container or -1 if not found + * + * @param child + */ + getIndexOfChild(child: dijit._WidgetBase): any; + /** + * Returns true if widget has child widgets, i.e. if this.containerNode contains widgets. + * + */ + hasChildren(): boolean; + /** + * Removes the passed widget instance from this widget but does + * not destroy it. You can also pass in an integer indicating + * the index within the container to remove (ie, removeChild(5) removes the sixth widget). + * + * @param widget + */ + removeChild(widget: dijit._WidgetBase): void; + /** + * Removes the passed widget instance from this widget but does + * not destroy it. You can also pass in an integer indicating + * the index within the container to remove (ie, removeChild(5) removes the sixth widget). + * + * @param widget + */ + removeChild(widget: number): void; + + } + /** + * Permalink: http://dojotoolkit.org/api/1.9/dijit/_Contained.html + * + * Mixin for widgets that are children of a container widget + * + */ + class _Contained { + constructor(); + /** + * Returns the index of this widget within its container parent. + * It returns -1 if the parent does not exist, or if the parent + * is not a dijit/_Container + * + */ + getIndexInParent(): any; + /** + * Returns null if this is the last child of the parent, + * otherwise returns the next element sibling to the "right". + * + */ + getNextSibling(): any; + /** + * Returns null if this is the first child of the parent, + * otherwise returns the next element sibling to the "left". + * + */ + getPreviousSibling(): any; + } + /** + * Permalink: http://dojotoolkit.org/api/1.9/dijit/_DialogMixin.html + * + * This provides functions useful to Dialog and TooltipDialog + * + */ + class _DialogMixin { + constructor(); + /** + * Callback when the user hits the submit button. + * Override this method to handle Dialog execution. + * After the user has pressed the submit button, the Dialog + * first calls onExecute() to notify the container to hide the + * dialog and restore focus to wherever it used to be. + * + * Then this method is called. + * + * @param formContents + */ + execute(formContents: Object): void; + /** + * Called when user has pressed the Dialog's cancel button, to notify container. + * Developer shouldn't override or connect to this method; + * it's a private communication device between the TooltipDialog + * and the thing that opened it (ex: dijit/form/DropDownButton) + * + */ + onCancel(): void; + /** + * Called when user has pressed the dialog's OK button, to notify container. + * Developer shouldn't override or connect to this method; + * it's a private communication device between the TooltipDialog + * and the thing that opened it (ex: dijit/form/DropDownButton) + * + */ + onExecute(): void; + } + /** + * Permalink: http://dojotoolkit.org/api/1.9/dijit/_CssStateMixin.html + * + * Mixin for widgets to set CSS classes on the widget DOM nodes depending on hover/mouse press/focus + * state changes, and also higher-level state changes such becoming disabled or selected. + * By mixing this class into your widget, and setting the this.baseClass attribute, it will automatically + * maintain CSS classes on the widget root node (this.domNode) depending on hover, + * active, focus, etc. state. Ex: with a baseClass of dijitButton, it will apply the classes + * dijitButtonHovered and dijitButtonActive, as the user moves the mouse over the widget and clicks it. + * + * It also sets CSS like dijitButtonDisabled based on widget semantic state. + * + * By setting the cssStateNodes attribute, a widget can also track events on subnodes (like buttons + * within the widget). + * + */ + class _CssStateMixin { + constructor(); + /** + * True if mouse was pressed while over this widget, and hasn't been released yet + * + */ + "active": boolean; + /** + * Subclasses may define a cssStateNodes property that lists sub-nodes within the widget that + * need CSS classes applied on mouse hover/press and focus. + * + * Each entry in this optional hash is a an attach-point name (like "upArrowButton") mapped to a CSS class name + * (like "dijitUpArrowButton"). Example: + * + * { + * "upArrowButton": "dijitUpArrowButton", + * "downArrowButton": "dijitDownArrowButton" + * } + * The above will set the CSS class dijitUpArrowButton to the this.upArrowButton DOMNode when it + * + * is hovered, etc. + * + */ + "cssStateNodes": Object; + /** + * True if cursor is over this widget + * + */ + "hovering": boolean; + } + /** + * Permalink: http://dojotoolkit.org/api/1.9/dijit/_FocusMixin.html + * + * Mixin to widget to provide _onFocus() and _onBlur() methods that + * fire when a widget or its descendants get/lose focus + * + */ + class _FocusMixin { + constructor(); + } + /** + * Permalink: http://dojotoolkit.org/api/1.9/dijit/_HasDropDown.html + * + * Mixin for widgets that need drop down ability. + * + */ + class _HasDropDown extends dijit._FocusMixin { + constructor(); + /** + * Set to true to make the drop down at least as wide as this + * widget. Set to false if the drop down should just be its + * default width. + * + */ + "autoWidth": boolean; + /** + * The widget to display as a popup. This widget must be + * defined before the startup function is called. + * + */ + "dropDown": Object; + /** + * This variable controls the position of the drop down. + * It's an array of strings with the following values: + * + * before: places drop down to the left of the target node/widget, or to the right in + * the case of RTL scripts like Hebrew and Arabic + * after: places drop down to the right of the target node/widget, or to the left in + * the case of RTL scripts like Hebrew and Arabic + * above: drop down goes above target node + * below: drop down goes below target node + * The list is positions is tried, in order, until a position is found where the drop down fits + * within the viewport. + * + */ + "dropDownPosition": Object; + /** + * Set to true to make the drop down exactly as wide as this + * widget. Overrides autoWidth. + * + */ + "forceWidth": boolean; + /** + * The max height for our dropdown. + * Any dropdown taller than this will have scrollbars. + * Set to 0 for no max height, or -1 to limit height to available space in viewport + * + */ + "maxHeight": number; + /** + * + */ + buildRendering(): void; + /** + * Closes the drop down on this widget + * + * @param focus If true, refocuses the button widget + */ + closeDropDown(focus: boolean): void; + /** + * + */ + destroy(): void; + /** + * Returns true if the dropdown exists and it's data is loaded. This can + * be overridden in order to force a call to loadDropDown(). + * + */ + isLoaded(): boolean; + /** + * Creates the drop down if it doesn't exist, loads the data + * if there's an href and it hasn't been loaded yet, and + * then opens the drop down. This is basically a callback when the + * user presses the down arrow button to open the drop down. + * + */ + loadAndOpenDropDown(): any; + /** + * Creates the drop down if it doesn't exist, loads the data + * if there's an href and it hasn't been loaded yet, and then calls + * the given callback. + * + * @param loadCallback + */ + loadDropDown(loadCallback: Function): void; + /** + * Opens the dropdown for this widget. To be called only when this.dropDown + * has been created and is ready to display (ie, it's data is loaded). + * + */ + openDropDown(): any; + /** + * set up nodes and connect our mouse and keyboard events + * + */ + postCreate(): void; + /** + * Callback when the user presses the down arrow button or presses + * the down arrow key to open/close the drop down. + * Toggle the drop-down widget; if it is up, close it, if not, open it + * + */ + toggleDropDown(): void; + } + /** + * Permalink: http://dojotoolkit.org/api/1.9/dijit/_KeyNavMixin.html + * + * A mixin to allow arrow key and letter key navigation of child or descendant widgets. + * It can be used by dijit/_Container based widgets with a flat list of children, + * or more complex widgets like dijit/Tree. + * + * To use this mixin, the subclass must: + * + * - Implement _getNext(), _getFirst(), _getLast(), _onLeftArrow(), _onRightArrow() + * _onDownArrow(), _onUpArrow() methods to handle home/end/left/right/up/down keystrokes. + * Next and previous in this context refer to a linear ordering of the descendants used + * by letter key search. + * - Set all descendants' initial tabIndex to "-1"; both initial descendants and any + * descendants added later, by for example addChild() + * - Define childSelector to a function or string that identifies focusable descendant widgets + * Also, child widgets must implement a focus() method. + * + */ + class _KeyNavMixin extends dijit._FocusMixin { + constructor(); + /** + * Selector (passed to on.selector()) used to identify what to treat as a child widget. Used to monitor + * focus events and set this.focusedChild. Must be set by implementing class. If this is a string + * (ex: "> *") then the implementing class must require dojo/query. + * + */ + "childSelector": any; + /** + * The currently focused child widget, or null if there isn't one + * + */ + "focusedChild": Object; + /** + * If multiple characters are typed where each keystroke happens within + * multiCharSearchDuration of the previous keystroke, + * search for nodes matching all the keystrokes. + * + * For example, typing "ab" will search for entries starting with + * "ab" unless the delay between "a" and "b" is greater than multiCharSearchDuration. + * + */ + "multiCharSearchDuration": number; + /** + * Tab index of the container; same as HTML tabIndex attribute. + * Note then when user tabs into the container, focus is immediately + * moved to the first item in the container. + * + */ + "tabIndex": string; + /** + * Default focus() implementation: focus the first child. + * + */ + focus(): void; + /** + * Focus specified child widget. + * + * @param widget Reference to container's child widget + * @param last If true and if widget has multiple focusable nodes, focus thelast one instead of the first one + */ + focusChild(widget: dijit._WidgetBase, last: boolean): void; + /** + * Focus the first focusable child in the container. + * + */ + focusFirstChild(): void; + /** + * Focus the last focusable child in the container. + * + */ + focusLastChild(): void; + /** + * + */ + postCreate(): void; + /** + * When a key is pressed that matches a child item, + * this method is called so that a widget can take appropriate action is necessary. + * + * @param item + * @param evt + * @param searchString + * @param numMatches + */ + onKeyboardSearch(item: dijit._WidgetBase, evt: Event, searchString: String, numMatches: number): void; + } + /** + * Permalink: http://dojotoolkit.org/api/1.9/dijit/_KeyNavContainer.html + * + * A _Container with keyboard navigation of its children. + * Provides normalized keyboard and focusing code for Container widgets. + * To use this mixin, call connectKeyNavHandlers() in postCreate(). + * Also, child widgets must implement a focus() method. + * + */ + class _KeyNavContainer extends dijit._FocusMixin implements dijit._KeyNavMixin, dijit._Container { + constructor(); + /** + * The currently focused child widget, or null if there isn't one + * + */ + "focusedChild": Object; + /** + * If multiple characters are typed where each keystroke happens within + * multiCharSearchDuration of the previous keystroke, + * search for nodes matching all the keystrokes. + * + * For example, typing "ab" will search for entries starting with + * "ab" unless the delay between "a" and "b" is greater than multiCharSearchDuration. + * + */ + "multiCharSearchDuration": number; + /** + * Tab index of the container; same as HTML tabIndex attribute. + * Note then when user tabs into the container, focus is immediately + * moved to the first item in the container. + * + */ + "tabIndex": string; + /** + * + * @param widget + * @param insertIndex Optional + */ + addChild(widget: dijit._WidgetBase, insertIndex: number): void; + /** + * + */ + buildRendering(): void; + /** + * + * @param node + */ + childSelector(node: HTMLElement): any; + /** + * Deprecated. You can call this in postCreate() to attach the keyboard handlers to the container, + * but the preferred method is to override _onLeftArrow() and _onRightArrow(), or + * _onUpArrow() and _onDownArrow(), to call focusPrev() and focusNext(). + * + * @param prevKeyCodes Key codes for navigating to the previous child. + * @param nextKeyCodes Key codes for navigating to the next child. + */ + connectKeyNavHandlers(prevKeyCodes: dojo.keys, nextKeyCodes: dojo.keys): void; + /** + * Default focus() implementation: focus the first child. + * + */ + focus(): void; + /** + * Focus specified child widget. + * + * @param widget Reference to container's child widget + * @param last If true and if widget has multiple focusable nodes, focus thelast one instead of the first one + */ + focusChild(widget: dijit._WidgetBase, last: boolean): void; + /** + * Focus the first focusable child in the container. + * + */ + focusFirstChild(): void; + /** + * Focus the last focusable child in the container. + * + */ + focusLastChild(): void; + /** + * Focus the next widget + * + */ + focusNext(): void; + /** + * Focus the last focusable node in the previous widget + * (ex: go to the ComboButton icon section rather than button section) + * + */ + focusPrev(): void; + /** + * Gets the index of the child in this container or -1 if not found + * + * @param child + */ + getIndexOfChild(child: dijit._WidgetBase): any; + /** + * Returns true if widget has child widgets, i.e. if this.containerNode contains widgets. + * + */ + hasChildren(): boolean; + /** + * + */ + postCreate(): void; + /** + * Removes the passed widget instance from this widget but does + * not destroy it. You can also pass in an integer indicating + * the index within the container to remove (ie, removeChild(5) removes the sixth widget). + * + * @param widget + */ + removeChild(widget: dijit._WidgetBase): void; + /** + * Removes the passed widget instance from this widget but does + * not destroy it. You can also pass in an integer indicating + * the index within the container to remove (ie, removeChild(5) removes the sixth widget). + * + * @param widget + */ + removeChild(widget: number): void; + /** + * + */ + startup(): void; + /** + * + */ + startupKeyNavChildren(): void; + /** + * When a key is pressed that matches a child item, + * this method is called so that a widget can take appropriate action is necessary. + * + * @param item + * @param evt + * @param searchString + * @param numMatches + */ + onKeyboardSearch(item: dijit._WidgetBase, evt: Event, searchString: String, numMatches: number): void; + } + /** + * Permalink: http://dojotoolkit.org/api/1.9/dijit/_OnDijitClickMixin.html + * + * Deprecated. New code should access the dijit/a11yclick event directly, ex: + * + * this.own(on(node, a11yclick, function(){ ... })); + * Mixing in this class will make _WidgetBase.connect(node, "ondijitclick", ...) work. + * It also used to be necessary to make templates with ondijitclick work, but now you can just require + * dijit/a11yclick. + * + */ + class _OnDijitClickMixin { + constructor(); + /** + * Custom press, release, and click synthetic events + * which trigger on a left mouse click, touch, or space/enter keyup. + * + */ + "a11yclick": Object; + /** + * + * @param obj + * @param event + * @param method + */ + connect(obj: any, event: any, method: any): any; + } + module _OnDijitClickMixin { + /** + * Permalink: http://dojotoolkit.org/api/1.9/dijit/_OnDijitClickMixin.a11yclick.html + * + * Custom press, release, and click synthetic events + * which trigger on a left mouse click, touch, or space/enter keyup. + * + */ + interface a11yclick { + /** + * Logical click operation for mouse, touch, or keyboard (space/enter key) + * + * @param node + * @param listener + */ + click(node: any, listener: any): void; + /** + * Mouse cursor or a finger is dragged over the given node. + * + * @param node + * @param listener + */ + move(node: any, listener: any): void; + /** + * Mousedown (left button), touchstart, or keydown (space or enter) corresponding to logical click operation. + * + * @param node + * @param listener + */ + press(node: any, listener: any): void; + /** + * Mouseup (left button), touchend, or keyup (space or enter) corresponding to logical click operation. + * + * @param node + * @param listener + */ + release(node: any, listener: any): void; + } + } + + /** + * Permalink: http://dojotoolkit.org/api/1.9/dijit/_PaletteMixin.html + * + * A keyboard accessible palette, for picking a color/emoticon/etc. + * A mixin for a grid showing various entities, so the user can pick a certain entity. + * + */ + class _PaletteMixin extends dijit._CssStateMixin { + constructor(); + /** + * True if mouse was pressed while over this widget, and hasn't been released yet + * + */ + "active": boolean; + /** + * CSS class applied to each cell in the palette + * + */ + "cellClass": string; + /** + * Subclasses may define a cssStateNodes property that lists sub-nodes within the widget that + * need CSS classes applied on mouse hover/press and focus. + * + * Each entry in this optional hash is a an attach-point name (like "upArrowButton") mapped to a CSS class name + * (like "dijitUpArrowButton"). Example: + * + * { + * "upArrowButton": "dijitUpArrowButton", + * "downArrowButton": "dijitDownArrowButton" + * } + * The above will set the CSS class dijitUpArrowButton to the this.upArrowButton DOMNode when it + * + * is hovered, etc. + * + */ + "cssStateNodes": Object; + /** + * Number of milliseconds before a held key or button becomes typematic + * + */ + "defaultTimeout": number; + /** + * Constructor for Object created for each cell of the palette. + * dyeClass should implement the dijit/_PaletteMixin.__Dye interface. + * + */ + "dyeClass": Object; + /** + * True if cursor is over this widget + * + */ + "hovering": boolean; + /** + * Widget tab index. + * + */ + "tabIndex": string; + /** + * Fraction of time used to change the typematic timer between events + * 1.0 means that each typematic event fires at defaultTimeout intervals + * Less than 1.0 means that each typematic event fires at an increasing faster rate + * + */ + "timeoutChangeRate": number; + /** + * Currently selected color/emoticon/etc. + * + */ + "value": string; + /** + * Focus this widget. Puts focus on the most recently focused cell. + * + */ + focus(): void; + /** + * + */ + postCreate(): void; + /** + * Callback when a cell is selected. + * + * @param value Value corresponding to cell. + */ + onChange(value: String): void; + } + module _PaletteMixin { + /** + * Permalink: http://dojotoolkit.org/api/1.9/dijit/_PaletteMixin.__Dye.html + * + * Interface for the JS Object associated with a palette cell (i.e. DOMNode) + * + * @param alias + * @param row + * @param col + */ + class __Dye { + constructor(alias: String, row: any, col: any); + /** + * Add cell DOMNode inner structure + * + * @param cell The surrounding cell + * @param blankGif URL for blank cell image + */ + fillCell(cell: HTMLElement, blankGif: String): void; + /** + * Return "value" of cell; meaning of "value" varies by subclass. + * For example color hex value, emoticon ascii value etc, entity hex value. + * + */ + getValue(): void; + } + } + + /** + * Permalink: http://dojotoolkit.org/api/1.9/dijit/_TemplatedMixin.html + * + * Mixin for widgets that are instantiated from a template + * + * @param params Hash of initialization parameters for widget, including scalar values (like title, duration etc.)and functions, typically callbacks like onClick.The hash can contain any of the widget's properties, excluding read-only properties. + * @param srcNodeRef OptionalIf a srcNodeRef (DOM node) is specified, replace srcNodeRef with my generated DOM tree. + */ + class _TemplatedMixin extends dijit._AttachMixin { + constructor(params?: Object, srcNodeRef?: HTMLElement); + /** + * Object to which attach points and events will be scoped. Defaults + * to 'this'. + * + */ + "attachScope": Object; + /** + * + */ + "searchContainerNode": boolean; + /** + * Path to template (HTML file) for this widget relative to dojo.baseUrl. + * Deprecated: use templateString with require([... "dojo/text!..."], ...) instead + * + */ + "templatePath": string; + /** + * A string that represents the widget template. + * Use in conjunction with dojo.cache() to load from a file. + * + */ + "templateString": string; + /** + * Construct the UI for this widget from a template, setting this.domNode. + * + */ + buildRendering(): void; + /** + * + */ + destroyRendering(): void; + /** + * Static method to get a template based on the templatePath or + * templateString key + * + * @param templateString The template + * @param alwaysUseString Don't cache the DOM tree for this template, even if it doesn't have any variables + * @param doc OptionalThe target document. Defaults to document global if unspecified. + */ + getCachedTemplate(templateString: String, alwaysUseString: boolean, doc: HTMLDocument): any; + } + module _TemplatedMixin { + /** + * Permalink: http://dojotoolkit.org/api/1.9/dijit/_TemplatedMixin._templateCache.html + * + * + */ + interface _templateCache { + } + } + + /** + * Permalink: http://dojotoolkit.org/api/1.9/dijit/_Templated.html + * + * Deprecated mixin for widgets that are instantiated from a template. + * Widgets should use _TemplatedMixin plus if necessary _WidgetsInTemplateMixin instead. + * + */ + class _Templated extends dijit._TemplatedMixin implements dijit._WidgetsInTemplateMixin { + constructor(); + /** + * Object to which attach points and events will be scoped. Defaults + * to 'this'. + * + */ + "attachScope": Object; + /** + * Used to provide a context require to the dojo/parser in order to be + * able to use relative MIDs (e.g. ./Widget) in the widget's template. + * + */ + "contextRequire": Function; + /** + * + */ + "searchContainerNode": boolean; + /** + * Path to template (HTML file) for this widget relative to dojo.baseUrl. + * Deprecated: use templateString with require([... "dojo/text!..."], ...) instead + * + */ + "templatePath": string; + /** + * A string that represents the widget template. + * Use in conjunction with dojo.cache() to load from a file. + * + */ + "templateString": string; + /** + * Should we parse the template to find widgets that might be + * declared in markup inside it? False by default. + * + */ + "widgetsInTemplate": boolean; + /** + * Construct the UI for this widget from a template, setting this.domNode. + * + */ + buildRendering(): void; + /** + * + */ + destroyRendering(): void; + /** + * + */ + startup(): void; + /** + * Static method to get a template based on the templatePath or + * templateString key + */ + getCachedTemplate(): any; + } + /** + * Permalink: http://dojotoolkit.org/api/1.9/dijit/_MenuBase.html + * + * Abstract base class for Menu and MenuBar. + * Subclass should implement _onUpArrow(), _onDownArrow(), _onLeftArrow(), and _onRightArrow(). + * + * @param params Hash of initialization parameters for widget, including scalar values (like title, duration etc.)and functions, typically callbacks like onClick.The hash can contain any of the widget's properties, excluding read-only properties. + * @param srcNodeRef OptionalIf a srcNodeRef (DOM node) is specified:use srcNodeRef.innerHTML as my contentsif this is a behavioral widget then apply behavior to that srcNodeRefotherwise, replace srcNodeRef with my generated DOM tree + */ + class _MenuBase extends dijit._Widget implements dijit._TemplatedMixin, dijit._KeyNavContainer, dijit._CssStateMixin { + constructor(params?: Object, srcNodeRef?: HTMLElement); + /** + * This Menu has been clicked (mouse or via space/arrow key) or opened as a submenu, + * so mere mouseover will open submenus. Focusing a menu via TAB does NOT automatically make it active + * since TAB is a navigation operation and not a selection one. + * For Windows apps, pressing the ALT key focuses the menubar menus (similar to TAB navigation) but the + * menu is not active (ie no dropdown) until an item is clicked. + * + */ + "activated": boolean; + set(property:"activated", value: boolean): void; + get(property:"activated"): boolean; + watch(property:"activated", callback:{(property?:string, oldValue?:boolean, newValue?: boolean):void}) :{unwatch():void} + /** + * True if mouse was pressed while over this widget, and hasn't been released yet + * + */ + "active": boolean; + set(property:"active", value: boolean): void; + get(property:"active"): boolean; + watch(property:"active", callback:{(property?:string, oldValue?:boolean, newValue?: boolean):void}) :{unwatch():void} + /** + * Object to which attach points and events will be scoped. Defaults + * to 'this'. + * + */ + "attachScope": Object; + set(property:"attachScope", value: Object): void; + get(property:"attachScope"): Object; + watch(property:"attachScope", callback:{(property?:string, oldValue?:Object, newValue?: Object):void}) :{unwatch():void} + /** + * Deprecated. Instead of attributeMap, widget should have a _setXXXAttr attribute + * for each XXX attribute to be mapped to the DOM. + * + * attributeMap sets up a "binding" between attributes (aka properties) + * of the widget and the widget's DOM. + * Changes to widget attributes listed in attributeMap will be + * reflected into the DOM. + * + * For example, calling set('title', 'hello') + * on a TitlePane will automatically cause the TitlePane's DOM to update + * with the new title. + * + * attributeMap is a hash where the key is an attribute of the widget, + * and the value reflects a binding to a: + * + * DOM node attribute + * focus: {node: "focusNode", type: "attribute"} + * Maps this.focus to this.focusNode.focus + * + * DOM node innerHTML + * title: { node: "titleNode", type: "innerHTML" } + * Maps this.title to this.titleNode.innerHTML + * + * DOM node innerText + * title: { node: "titleNode", type: "innerText" } + * Maps this.title to this.titleNode.innerText + * + * DOM node CSS class + * myClass: { node: "domNode", type: "class" } + * Maps this.myClass to this.domNode.className + * + * If the value is an array, then each element in the array matches one of the + * formats of the above list. + * + * There are also some shorthands for backwards compatibility: + * + * string --> { node: string, type: "attribute" }, for example: + * "focusNode" ---> { node: "focusNode", type: "attribute" } + * "" --> { node: "domNode", type: "attribute" } + * + */ + "attributeMap": Object; + set(property:"attributeMap", value: Object): void; + get(property:"attributeMap"): Object; + watch(property:"attributeMap", callback:{(property?:string, oldValue?:Object, newValue?: Object):void}) :{unwatch():void} + /** + * A toggle to control whether or not a Menu gets focused when opened as a drop down from a MenuBar + * or DropDownButton/ComboButton. Note though that it always get focused when opened via the keyboard. + * + */ + "autoFocus": boolean; + set(property:"autoFocus", value: boolean): void; + get(property:"autoFocus"): boolean; + watch(property:"autoFocus", callback:{(property?:string, oldValue?:boolean, newValue?: boolean):void}) :{unwatch():void} + /** + * Root CSS class of the widget (ex: dijitTextBox), used to construct CSS classes to indicate + * widget state. + * + */ + "baseClass": string; + set(property:"baseClass", value: string): void; + get(property:"baseClass"): string; + watch(property:"baseClass", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * + */ + "class": string; + set(property:"class", value: string): void; + get(property:"class"): string; + watch(property:"class", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * Designates where children of the source DOM node will be placed. + * "Children" in this case refers to both DOM nodes and widgets. + * For example, for myWidget: + * + *
+ * here's a plain DOM node + * and a widget + * and another plain DOM node + *
+ * containerNode would point to: + * + * here's a plain DOM node + * and a widget + * and another plain DOM node + * In templated widgets, "containerNode" is set via a + * data-dojo-attach-point assignment. + * + * containerNode must be defined for any widget that accepts innerHTML + * (like ContentPane or BorderContainer or even Button), and conversely + * is null for widgets that don't, like TextBox. + * + */ + "containerNode": HTMLElement; + set(property:"containerNode", value: HTMLElement): void; + get(property:"containerNode"): HTMLElement; + watch(property:"containerNode", callback:{(property?:string, oldValue?:HTMLElement, newValue?: HTMLElement):void}) :{unwatch():void} + /** + * Subclasses may define a cssStateNodes property that lists sub-nodes within the widget that + * need CSS classes applied on mouse hover/press and focus. + * + * Each entry in this optional hash is a an attach-point name (like "upArrowButton") mapped to a CSS class name + * (like "dijitUpArrowButton"). Example: + * + * { + * "upArrowButton": "dijitUpArrowButton", + * "downArrowButton": "dijitDownArrowButton" + * } + * The above will set the CSS class dijitUpArrowButton to the this.upArrowButton DOMNode when it + * + * is hovered, etc. + * + */ + "cssStateNodes": Object; + set(property:"cssStateNodes", value: Object): void; + get(property:"cssStateNodes"): Object; + watch(property:"cssStateNodes", callback:{(property?:string, oldValue?:Object, newValue?: Object):void}) :{unwatch():void} + /** + * Bi-directional support, as defined by the HTML DIR + * attribute. Either left-to-right "ltr" or right-to-left "rtl". If undefined, widgets renders in page's + * default direction. + * + */ + "dir": string; + set(property:"dir", value: string): void; + get(property:"dir"): string; + watch(property:"dir", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * This is our visible representation of the widget! Other DOM + * Nodes may by assigned to other properties, usually through the + * template system's data-dojo-attach-point syntax, but the domNode + * property is the canonical "top level" node in widget UI. + * + */ + "domNode": HTMLElement; + set(property:"domNode", value: HTMLElement): void; + get(property:"domNode"): HTMLElement; + watch(property:"domNode", callback:{(property?:string, oldValue?:HTMLElement, newValue?: HTMLElement):void}) :{unwatch():void} + /** + * This widget or a widget it contains has focus, or is "active" because + * it was recently clicked. + * + */ + "focused": boolean; + set(property:"focused", value: boolean): void; + get(property:"focused"): boolean; + watch(property:"focused", callback:{(property?:string, oldValue?:boolean, newValue?: boolean):void}) :{unwatch():void} + /** + * The currently focused child widget, or null if there isn't one + * + */ + "focusedChild": Object; + set(property:"focusedChild", value: Object): void; + get(property:"focusedChild"): Object; + watch(property:"focusedChild", callback:{(property?:string, oldValue?:Object, newValue?: Object):void}) :{unwatch():void} + /** + * True if cursor is over this widget + * + */ + "hovering": boolean; + set(property:"hovering", value: boolean): void; + get(property:"hovering"): boolean; + watch(property:"hovering", callback:{(property?:string, oldValue?:boolean, newValue?: boolean):void}) :{unwatch():void} + /** + * A unique, opaque ID string that can be assigned by users or by the + * system. If the developer passes an ID which is known not to be + * unique, the specified ID is ignored and the system-generated ID is + * used instead. + * + */ + "id": string; + set(property:"id", value: string): void; + get(property:"id"): string; + watch(property:"id", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * Rarely used. Overrides the default Dojo locale used to render this widget, + * as defined by the HTML LANG attribute. + * Value must be among the list of locales specified during by the Dojo bootstrap, + * formatted according to RFC 3066 (like en-us). + * + */ + "lang": string; + set(property:"lang", value: string): void; + get(property:"lang"): string; + watch(property:"lang", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * If multiple characters are typed where each keystroke happens within + * multiCharSearchDuration of the previous keystroke, + * search for nodes matching all the keystrokes. + * + * For example, typing "ab" will search for entries starting with + * "ab" unless the delay between "a" and "b" is greater than multiCharSearchDuration. + * + */ + "multiCharSearchDuration": number; + set(property:"multiCharSearchDuration", value: number): void; + get(property:"multiCharSearchDuration"): number; + watch(property:"multiCharSearchDuration", callback:{(property?:string, oldValue?:number, newValue?: number):void}) :{unwatch():void} + /** + * The document this widget belongs to. If not specified to constructor, will default to + * srcNodeRef.ownerDocument, or if no sourceRef specified, then to the document global + * + */ + "ownerDocument": Object; + set(property:"ownerDocument", value: Object): void; + get(property:"ownerDocument"): Object; + watch(property:"ownerDocument", callback:{(property?:string, oldValue?:Object, newValue?: Object):void}) :{unwatch():void} + /** + * pointer to menu that displayed me + * + */ + "parentMenu": Object; + set(property:"parentMenu", value: Object): void; + get(property:"parentMenu"): Object; + watch(property:"parentMenu", callback:{(property?:string, oldValue?:Object, newValue?: Object):void}) :{unwatch():void} + /** + * For a passive (unclicked) Menu, number of milliseconds before hovering (without clicking) will cause + * the popup to open. Default is Infinity, meaning you need to click the menu to open it. + * + */ + "passivePopupDelay": number; + set(property:"passivePopupDelay", value: number): void; + get(property:"passivePopupDelay"): number; + watch(property:"passivePopupDelay", callback:{(property?:string, oldValue?:number, newValue?: number):void}) :{unwatch():void} + /** + * After a menu has been activated (by clicking on it etc.), number of milliseconds before hovering + * (without clicking) another MenuItem causes that MenuItem's popup to automatically open. + * + */ + "popupDelay": number; + set(property:"popupDelay", value: number): void; + get(property:"popupDelay"): number; + watch(property:"popupDelay", callback:{(property?:string, oldValue?:number, newValue?: number):void}) :{unwatch():void} + /** + * + */ + "searchContainerNode": boolean; + set(property:"searchContainerNode", value: boolean): void; + get(property:"searchContainerNode"): boolean; + watch(property:"searchContainerNode", callback:{(property?:string, oldValue?:boolean, newValue?: boolean):void}) :{unwatch():void} + /** + * Currently selected (a.k.a. highlighted) MenuItem, or null if no MenuItem is selected. + * If a submenu is open, will be set to MenuItem that displayed the submenu. OTOH, if + * this Menu is in passive mode (i.e. hasn't been clicked yet), will be null, because + * "selected" is not merely "hovered". + * + */ + "selected": Object; + set(property:"selected", value: Object): void; + get(property:"selected"): Object; + watch(property:"selected", callback:{(property?:string, oldValue?:Object, newValue?: Object):void}) :{unwatch():void} + /** + * pointer to original DOM node + * + */ + "srcNodeRef": HTMLElement; + set(property:"srcNodeRef", value: HTMLElement): void; + get(property:"srcNodeRef"): HTMLElement; + watch(property:"srcNodeRef", callback:{(property?:string, oldValue?:HTMLElement, newValue?: HTMLElement):void}) :{unwatch():void} + /** + * HTML style attributes as cssText string or name/value hash + * + */ + "style": string; + set(property:"style", value: string): void; + get(property:"style"): string; + watch(property:"style", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * Tab index of the container; same as HTML tabIndex attribute. + * Note then when user tabs into the container, focus is immediately + * moved to the first item in the container. + * + */ + "tabIndex": string; + set(property:"tabIndex", value: string): void; + get(property:"tabIndex"): string; + watch(property:"tabIndex", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * Path to template (HTML file) for this widget relative to dojo.baseUrl. + * Deprecated: use templateString with require([... "dojo/text!..."], ...) instead + * + */ + "templatePath": string; + set(property:"templatePath", value: string): void; + get(property:"templatePath"): string; + watch(property:"templatePath", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * A string that represents the widget template. + * Use in conjunction with dojo.cache() to load from a file. + * + */ + "templateString": string; + set(property:"templateString", value: string): void; + get(property:"templateString"): string; + watch(property:"templateString", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * HTML title attribute. + * + * For form widgets this specifies a tooltip to display when hovering over + * the widget (just like the native HTML title attribute). + * + * For TitlePane or for when this widget is a child of a TabContainer, AccordionContainer, + * etc., it's used to specify the tab label, accordion pane title, etc. In this case it's + * interpreted as HTML. + * + */ + "title": string; + set(property:"title", value: string): void; + get(property:"title"): string; + watch(property:"title", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * When this widget's title attribute is used to for a tab label, accordion pane title, etc., + * this specifies the tooltip to appear when the mouse is hovered over that text. + * + */ + "tooltip": string; + set(property:"tooltip", value: string): void; + get(property:"tooltip"): string; + watch(property:"tooltip", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * + * @param widget + * @param insertIndex Optional + */ + addChild(widget: dijit._WidgetBase, insertIndex: number): void; + /** + * This method is deprecated, use get() or set() directly. + * + * @param name The property to get or set. If an object is passed here and nota string, its keys are used as names of attributes to be setand the value of the object as values to set in the widget. + * @param value OptionalOptional. If provided, attr() operates as a setter. If omitted,the current value of the named property is returned. + */ + attr(name: String, value: Object): any; + /** + * This method is deprecated, use get() or set() directly. + * + * @param name The property to get or set. If an object is passed here and nota string, its keys are used as names of attributes to be setand the value of the object as values to set in the widget. + * @param value OptionalOptional. If provided, attr() operates as a setter. If omitted,the current value of the named property is returned. + */ + attr(name: Object, value: Object): any; + /** + * Construct the UI for this widget, setting this.domNode. + * Most widgets will mixin dijit._TemplatedMixin, which implements this method. + * + */ + buildRendering(): void; + /** + * Selector (passed to on.selector()) used to identify MenuItem child widgets, but exclude inert children + * like MenuSeparator. If subclass overrides to a string (ex: "> *"), the subclass must require dojo/query. + * + * @param node + */ + childSelector(node: HTMLElement): any; + /** + * Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead. + * + * Connects specified obj/event to specified method of this object + * and registers for disconnect() on widget destroy. + * + * Provide widget-specific analog to dojo.connect, except with the + * implicit use of this widget as the target object. + * Events connected with this.connect are disconnected upon + * destruction. + * + * @param obj + * @param event + * @param method + */ + connect(obj: Object, event: String, method: String): any; + /** + * Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead. + * + * Connects specified obj/event to specified method of this object + * and registers for disconnect() on widget destroy. + * + * Provide widget-specific analog to dojo.connect, except with the + * implicit use of this widget as the target object. + * Events connected with this.connect are disconnected upon + * destruction. + * + * @param obj + * @param event + * @param method + */ + connect(obj: any, event: String, method: String): any; + /** + * Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead. + * + * Connects specified obj/event to specified method of this object + * and registers for disconnect() on widget destroy. + * + * Provide widget-specific analog to dojo.connect, except with the + * implicit use of this widget as the target object. + * Events connected with this.connect are disconnected upon + * destruction. + * + * @param obj + * @param event + * @param method + */ + connect(obj: Object, event: Function, method: String): any; + /** + * Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead. + * + * Connects specified obj/event to specified method of this object + * and registers for disconnect() on widget destroy. + * + * Provide widget-specific analog to dojo.connect, except with the + * implicit use of this widget as the target object. + * Events connected with this.connect are disconnected upon + * destruction. + * + * @param obj + * @param event + * @param method + */ + connect(obj: any, event: Function, method: String): any; + /** + * Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead. + * + * Connects specified obj/event to specified method of this object + * and registers for disconnect() on widget destroy. + * + * Provide widget-specific analog to dojo.connect, except with the + * implicit use of this widget as the target object. + * Events connected with this.connect are disconnected upon + * destruction. + * + * @param obj + * @param event + * @param method + */ + connect(obj: Object, event: String, method: Function): any; + /** + * Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead. + * + * Connects specified obj/event to specified method of this object + * and registers for disconnect() on widget destroy. + * + * Provide widget-specific analog to dojo.connect, except with the + * implicit use of this widget as the target object. + * Events connected with this.connect are disconnected upon + * destruction. + * + * @param obj + * @param event + * @param method + */ + connect(obj: any, event: String, method: Function): any; + /** + * Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead. + * + * Connects specified obj/event to specified method of this object + * and registers for disconnect() on widget destroy. + * + * Provide widget-specific analog to dojo.connect, except with the + * implicit use of this widget as the target object. + * Events connected with this.connect are disconnected upon + * destruction. + * + * @param obj + * @param event + * @param method + */ + connect(obj: Object, event: Function, method: Function): any; + /** + * Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead. + * + * Connects specified obj/event to specified method of this object + * and registers for disconnect() on widget destroy. + * + * Provide widget-specific analog to dojo.connect, except with the + * implicit use of this widget as the target object. + * Events connected with this.connect are disconnected upon + * destruction. + * + * @param obj + * @param event + * @param method + */ + connect(obj: any, event: Function, method: Function): any; + /** + * Deprecated. You can call this in postCreate() to attach the keyboard handlers to the container, + * but the preferred method is to override _onLeftArrow() and _onRightArrow(), or + * _onUpArrow() and _onDownArrow(), to call focusPrev() and focusNext(). + * + * @param prevKeyCodes Key codes for navigating to the previous child. + * @param nextKeyCodes Key codes for navigating to the next child. + */ + connectKeyNavHandlers(prevKeyCodes: dojo.keys, nextKeyCodes: dojo.keys): void; + /** + * Wrapper to setTimeout to avoid deferred functions executing + * after the originating widget has been destroyed. + * Returns an object handle with a remove method (that returns null) (replaces clearTimeout). + * + * @param fcn Function reference. + * @param delay OptionalDelay, defaults to 0. + */ + defer(fcn: Function, delay: number): Object; + /** + * Destroy this widget, but not its descendants. Descendants means widgets inside of + * this.containerNode. Will also destroy any resources (including widgets) registered via this.own(). + * + * This method will also destroy internal widgets such as those created from a template, + * assuming those widgets exist inside of this.domNode but outside of this.containerNode. + * + * For 2.0 it's planned that this method will also destroy descendant widgets, so apps should not + * depend on the current ability to destroy a widget without destroying its descendants. Generally + * they should use destroyRecursive() for widgets with children. + * + * @param preserveDom If true, this method will leave the original DOM structure alone.Note: This will not yet work with _TemplatedMixin widgets + */ + destroy(preserveDom?: boolean): void; + /** + * Recursively destroy the children of this widget and their + * descendants. + * + * @param preserveDom OptionalIf true, the preserveDom attribute is passed to all descendantwidget's .destroy() method. Not for use with _Templatedwidgets. + */ + destroyDescendants(preserveDom?: boolean): void; + /** + * Destroy this widget and its descendants + * This is the generic "destructor" function that all widget users + * should call to cleanly discard with a widget. Once a widget is + * destroyed, it is removed from the manager object. + * + * @param preserveDom OptionalIf true, this method will leave the original DOM structurealone of descendant Widgets. Note: This will NOT work withdijit._TemplatedMixin widgets. + */ + destroyRecursive(preserveDom?: boolean): void; + /** + * Destroys the DOM nodes associated with this widget. + * + * @param preserveDom OptionalIf true, this method will leave the original DOM structure aloneduring tear-down. Note: this will not work with _Templatedwidgets yet. + */ + destroyRendering(preserveDom?: boolean): void; + /** + * Deprecated, will be removed in 2.0, use handle.remove() instead. + * + * Disconnects handle created by connect. + * + * @param handle + */ + disconnect(handle: any): void; + /** + * Used by widgets to signal that a synthetic event occurred, ex: + * + * myWidget.emit("attrmodified-selectedChildWidget", {}). + * Emits an event on this.domNode named type.toLowerCase(), based on eventObj. + * Also calls onType() method, if present, and returns value from that method. + * By default passes eventObj to callback, but will pass callbackArgs instead, if specified. + * Modifies eventObj by adding missing parameters (bubbles, cancelable, widget). + * + * @param type + * @param eventObj Optional + * @param callbackArgs Optional + */ + emit(type: String, eventObj: Object, callbackArgs: any[]): any; + /** + * Default focus() implementation: focus the first child. + * + */ + focus(): void; + /** + * Focus specified child widget. + * + * @param widget Reference to container's child widget + * @param last If true and if widget has multiple focusable nodes, focus thelast one instead of the first one + */ + focusChild(widget: dijit._WidgetBase, last: boolean): void; + /** + * Focus the first focusable child in the container. + * + */ + focusFirstChild(): void; + /** + * Focus the last focusable child in the container. + * + */ + focusLastChild(): void; + /** + * Focus the next widget + * + */ + focusNext(): void; + /** + * Focus the last focusable node in the previous widget + * (ex: go to the ComboButton icon section rather than button section) + * + */ + focusPrev(): void; + /** + * Get a property from a widget. + * Get a named property from a widget. The property may + * potentially be retrieved via a getter method. If no getter is defined, this + * just retrieves the object's property. + * + * For example, if the widget has properties foo and bar + * and a method named _getFooAttr(), calling: + * myWidget.get("foo") would be equivalent to calling + * widget._getFooAttr() and myWidget.get("bar") + * would be equivalent to the expression + * widget.bar2 + * + * @param name The property to get. + */ + get(name: any): any; + /** + * Returns all direct children of this widget, i.e. all widgets underneath this.containerNode whose parent + * is this widget. Note that it does not return all descendants, but rather just direct children. + * Analogous to Node.childNodes, + * except containing widgets rather than DOMNodes. + * + * The result intentionally excludes internally created widgets (a.k.a. supporting widgets) + * outside of this.containerNode. + * + * Note that the array returned is a simple array. Application code should not assume + * existence of methods like forEach(). + * + */ + getChildren(): any[]; + /** + * Returns all the widgets contained by this, i.e., all widgets underneath this.containerNode. + * This method should generally be avoided as it returns widgets declared in templates, which are + * supposed to be internal/hidden, but it's left here for back-compat reasons. + * + */ + getDescendants(): any[]; + /** + * Gets the index of the child in this container or -1 if not found + * + * @param child + */ + getIndexOfChild(child: dijit._WidgetBase): any; + /** + * Returns the parent widget of this widget. + * + */ + getParent(): any; + /** + * Returns true if widget has child widgets, i.e. if this.containerNode contains widgets. + * + */ + hasChildren(): boolean; + /** + * Return true if this widget can currently be focused + * and false if not + * + */ + isFocusable(): any; + /** + * Return this widget's explicit or implicit orientation (true for LTR, false for RTL) + * + */ + isLeftToRight(): any; + /** + * + * @param type protected + * @param func + */ + on(type: String, func: Function): any; + /** + * + * @param type protected + * @param func + */ + on(type: Function, func: Function): any; + /** + * Track specified handles and remove/destroy them when this instance is destroyed, unless they were + * already removed/destroyed manually. + * + */ + own(): any; + /** + * Place this widget somewhere in the DOM based + * on standard domConstruct.place() conventions. + * A convenience function provided in all _Widgets, providing a simple + * shorthand mechanism to put an existing (or newly created) Widget + * somewhere in the dom, and allow chaining. + * + * @param reference Widget, DOMNode, or id of widget or DOMNode + * @param position OptionalIf reference is a widget (or id of widget), and that widget has an ".addChild" method,it will be called passing this widget instance into that method, supplying the optionalposition index passed. In this case position (if specified) should be an integer.If reference is a DOMNode (or id matching a DOMNode but not a widget),the position argument can be a numeric index or a string"first", "last", "before", or "after", same as dojo/dom-construct::place(). + */ + placeAt(reference: String, position: String): any; + /** + * Place this widget somewhere in the DOM based + * on standard domConstruct.place() conventions. + * A convenience function provided in all _Widgets, providing a simple + * shorthand mechanism to put an existing (or newly created) Widget + * somewhere in the dom, and allow chaining. + * + * @param reference Widget, DOMNode, or id of widget or DOMNode + * @param position OptionalIf reference is a widget (or id of widget), and that widget has an ".addChild" method,it will be called passing this widget instance into that method, supplying the optionalposition index passed. In this case position (if specified) should be an integer.If reference is a DOMNode (or id matching a DOMNode but not a widget),the position argument can be a numeric index or a string"first", "last", "before", or "after", same as dojo/dom-construct::place(). + */ + placeAt(reference: HTMLElement, position: String): any; + /** + * Place this widget somewhere in the DOM based + * on standard domConstruct.place() conventions. + * A convenience function provided in all _Widgets, providing a simple + * shorthand mechanism to put an existing (or newly created) Widget + * somewhere in the dom, and allow chaining. + * + * @param reference Widget, DOMNode, or id of widget or DOMNode + * @param position OptionalIf reference is a widget (or id of widget), and that widget has an ".addChild" method,it will be called passing this widget instance into that method, supplying the optionalposition index passed. In this case position (if specified) should be an integer.If reference is a DOMNode (or id matching a DOMNode but not a widget),the position argument can be a numeric index or a string"first", "last", "before", or "after", same as dojo/dom-construct::place(). + */ + placeAt(reference: dijit._WidgetBase, position: String): any; + /** + * Place this widget somewhere in the DOM based + * on standard domConstruct.place() conventions. + * A convenience function provided in all _Widgets, providing a simple + * shorthand mechanism to put an existing (or newly created) Widget + * somewhere in the dom, and allow chaining. + * + * @param reference Widget, DOMNode, or id of widget or DOMNode + * @param position OptionalIf reference is a widget (or id of widget), and that widget has an ".addChild" method,it will be called passing this widget instance into that method, supplying the optionalposition index passed. In this case position (if specified) should be an integer.If reference is a DOMNode (or id matching a DOMNode but not a widget),the position argument can be a numeric index or a string"first", "last", "before", or "after", same as dojo/dom-construct::place(). + */ + placeAt(reference: String, position: number): any; + /** + * Place this widget somewhere in the DOM based + * on standard domConstruct.place() conventions. + * A convenience function provided in all _Widgets, providing a simple + * shorthand mechanism to put an existing (or newly created) Widget + * somewhere in the dom, and allow chaining. + * + * @param reference Widget, DOMNode, or id of widget or DOMNode + * @param position OptionalIf reference is a widget (or id of widget), and that widget has an ".addChild" method,it will be called passing this widget instance into that method, supplying the optionalposition index passed. In this case position (if specified) should be an integer.If reference is a DOMNode (or id matching a DOMNode but not a widget),the position argument can be a numeric index or a string"first", "last", "before", or "after", same as dojo/dom-construct::place(). + */ + placeAt(reference: HTMLElement, position: number): any; + /** + * Place this widget somewhere in the DOM based + * on standard domConstruct.place() conventions. + * A convenience function provided in all _Widgets, providing a simple + * shorthand mechanism to put an existing (or newly created) Widget + * somewhere in the dom, and allow chaining. + * + * @param reference Widget, DOMNode, or id of widget or DOMNode + * @param position OptionalIf reference is a widget (or id of widget), and that widget has an ".addChild" method,it will be called passing this widget instance into that method, supplying the optionalposition index passed. In this case position (if specified) should be an integer.If reference is a DOMNode (or id matching a DOMNode but not a widget),the position argument can be a numeric index or a string"first", "last", "before", or "after", same as dojo/dom-construct::place(). + */ + placeAt(reference: dijit._WidgetBase, position: number): any; + /** + * + */ + postCreate(): void; + /** + * Called after the parameters to the widget have been read-in, + * but before the widget template is instantiated. Especially + * useful to set properties that are referenced in the widget + * template. + * + */ + postMixInProperties(): void; + /** + * Removes the passed widget instance from this widget but does + * not destroy it. You can also pass in an integer indicating + * the index within the container to remove (ie, removeChild(5) removes the sixth widget). + * + * @param widget + */ + removeChild(widget: dijit._WidgetBase): void; + /** + * Removes the passed widget instance from this widget but does + * not destroy it. You can also pass in an integer indicating + * the index within the container to remove (ie, removeChild(5) removes the sixth widget). + * + * @param widget + */ + removeChild(widget: number): void; + /** + * Set a property on a widget + * Sets named properties on a widget which may potentially be handled by a + * setter in the widget. + * + * For example, if the widget has properties foo and bar + * and a method named _setFooAttr(), calling + * myWidget.set("foo", "Howdy!") would be equivalent to calling + * widget._setFooAttr("Howdy!") and myWidget.set("bar", 3) + * would be equivalent to the statement widget.bar = 3; + * + * set() may also be called with a hash of name/value pairs, ex: + * + * myWidget.set({ + * foo: "Howdy", + * bar: 3 + * }); + * This is equivalent to calling set(foo, "Howdy") and set(bar, 3) + * + * @param name The property to set. + * @param value The value to set in the property. + */ + set(name: any, value: any): any; + /** + * Deprecated. Use set() instead. + * + * @param attr + * @param value + */ + setAttribute(attr: String, value: any): void; + /** + * Processing after the DOM fragment is added to the document + * Called after a widget and its children have been created and added to the page, + * and all related widgets have finished their create() cycle, up through postCreate(). + * + * Note that startup() may be called while the widget is still hidden, for example if the widget is + * inside a hidden dijit/Dialog or an unselected tab of a dijit/layout/TabContainer. + * For widgets that need to do layout, it's best to put that layout code inside resize(), and then + * extend dijit/layout/_LayoutWidget so that resize() is called when the widget is visible. + * + */ + startup(): void; + /** + * + */ + startupKeyNavChildren(): void; + /** + * Deprecated, will be removed in 2.0, use this.own(topic.subscribe()) instead. + * + * Subscribes to the specified topic and calls the specified method + * of this object and registers for unsubscribe() on widget destroy. + * + * Provide widget-specific analog to dojo.subscribe, except with the + * implicit use of this widget as the target object. + * + * @param t The topic + * @param method The callback + */ + subscribe(t: String, method: Function): any; + /** + * Returns a string that represents the widget. + * When a widget is cast to a string, this method will be used to generate the + * output. Currently, it does not implement any sort of reversible + * serialization. + * + */ + toString(): String; + /** + * Deprecated. Override destroy() instead to implement custom widget tear-down + * behavior. + * + */ + uninitialize(): boolean; + /** + * Deprecated, will be removed in 2.0, use handle.remove() instead. + * + * Unsubscribes handle created by this.subscribe. + * Also removes handle from this widget's list of subscriptions + * + * @param handle + */ + unsubscribe(handle: Object): void; + /** + * Watches a property for changes + * + * @param name OptionalIndicates the property to watch. This is optional (the callback may be theonly parameter), and if omitted, all the properties will be watched + * @param callback The function to execute when the property changes. This will be called afterthe property has been changed. The callback will be called with the |this|set to the instance, the first argument as the name of the property, thesecond argument as the old value and the third argument as the new value. + */ + watch(property: string, callback:{(property?:string, oldValue?:any, newValue?: any):void}) :{unwatch():void}; + /** + * Static method to get a template based on the templatePath or + * templateString key + */ + getCachedTemplate(): any; + /** + * Called when the widget stops being "active" because + * focus moved to something outside of it, or the user + * clicked somewhere outside of it, or the widget was + * hidden. + * + */ + onBlur(): void; + /** + * Attach point for notification about when the user cancels the current menu + * This is an internal mechanism used for Menus to signal to their parent to + * close them. In general developers should not attach to or override this method. + * + * @param closeAll + */ + onCancel(closeAll: boolean): void; + /** + * Connect to this function to receive notifications of mouse click events. + * + * @param event mouse Event + */ + onClick(event: any): void; + /** + * Connect to this function to receive notifications of mouse double click events. + * + * @param event mouse Event + */ + onDblClick(event: any): void; + /** + * Attach point for notification about when a menu item has been executed. + * This is an internal mechanism used for Menus to signal to their parent to + * close them, because they are about to execute the onClick handler. In + * general developers should not attach to or override this method. + * + */ + onExecute(): void; + /** + * Called when the widget becomes "active" because + * it or a widget inside of it either has focus, or has recently + * been clicked. + * + */ + onFocus(): void; + /** + * Called when another widget becomes the selected pane in a + * dijit/layout/TabContainer, dijit/layout/StackContainer, + * dijit/layout/AccordionContainer, etc. + * + * Also called to indicate hide of a dijit.Dialog, dijit.TooltipDialog, or dijit.TitlePane. + * + */ + onHide(): void; + /** + * Called when cursor is over a MenuItem. + * + * @param item + */ + onItemHover(item: dijit.MenuItem): void; + /** + * Callback fires when mouse exits a MenuItem + * + * @param item + */ + onItemUnhover(item: dijit.MenuItem): void; + /** + * Attach point for notification about when a menu item has been searched for + * via the keyboard search mechanism. + * + * @param item + * @param evt + * @param searchString + * @param numMatches + */ + onKeyboardSearch(item: dijit.MenuItem, evt: Event, searchString: String, numMatches: number): void; + /** + * Connect to this function to receive notifications of keys being pressed down. + * + * @param event key Event + */ + onKeyDown(event: any): void; + /** + * Connect to this function to receive notifications of printable keys being typed. + * + * @param event key Event + */ + onKeyPress(event: any): void; + /** + * Connect to this function to receive notifications of keys being released. + * + * @param event key Event + */ + onKeyUp(event: any): void; + /** + * Connect to this function to receive notifications of when the mouse button is pressed down. + * + * @param event mouse Event + */ + onMouseDown(event: any): void; + /** + * Connect to this function to receive notifications of when the mouse moves onto this widget. + * + * @param event mouse Event + */ + onMouseEnter(event: any): void; + /** + * Connect to this function to receive notifications of when the mouse moves off of this widget. + * + * @param event mouse Event + */ + onMouseLeave(event: any): void; + /** + * Connect to this function to receive notifications of when the mouse moves over nodes contained within this widget. + * + * @param event mouse Event + */ + onMouseMove(event: any): void; + /** + * Connect to this function to receive notifications of when the mouse moves off of nodes contained within this widget. + * + * @param event mouse Event + */ + onMouseOut(event: any): void; + /** + * Connect to this function to receive notifications of when the mouse moves onto nodes contained within this widget. + * + * @param event mouse Event + */ + onMouseOver(event: any): void; + /** + * Connect to this function to receive notifications of when the mouse button is released. + * + * @param event mouse Event + */ + onMouseUp(event: any): void; + /** + * Called when this widget becomes the selected pane in a + * dijit/layout/TabContainer, dijit/layout/StackContainer, + * dijit/layout/AccordionContainer, etc. + * + * Also called to indicate display of a dijit.Dialog, dijit.TooltipDialog, or dijit.TitlePane. + * + */ + onShow(): void; + } + /** + * Permalink: http://dojotoolkit.org/api/1.9/dijit/_WidgetsInTemplateMixin.html + * + * Mixin to supplement _TemplatedMixin when template contains widgets + * + */ + class _WidgetsInTemplateMixin { + constructor(); + /** + * Used to provide a context require to the dojo/parser in order to be + * able to use relative MIDs (e.g. ./Widget) in the widget's template. + * + */ + "contextRequire": Function; + /** + * Should we parse the template to find widgets that might be + * declared in markup inside it? (Remove for 2.0 and assume true) + * + */ + "widgetsInTemplate": boolean; + /** + * + */ + startup(): void; + } + /** + * Permalink: http://dojotoolkit.org/api/1.9/dijit/_WidgetBase.html + * + * Future base class for all Dijit widgets. + * Future base class for all Dijit widgets. + * _Widget extends this class adding support for various features needed by desktop. + * + * Provides stubs for widget lifecycle methods for subclasses to extend, like postMixInProperties(), buildRendering(), + * postCreate(), startup(), and destroy(), and also public API methods like set(), get(), and watch(). + * + * Widgets can provide custom setters/getters for widget attributes, which are called automatically by set(name, value). + * For an attribute XXX, define methods _setXXXAttr() and/or _getXXXAttr(). + * + * _setXXXAttr can also be a string/hash/array mapping from a widget attribute XXX to the widget's DOMNodes: + * + * DOM node attribute + * _setFocusAttr: {node: "focusNode", type: "attribute"} + * _setFocusAttr: "focusNode" (shorthand) + * _setFocusAttr: "" (shorthand, maps to this.domNode) + * Maps this.focus to this.focusNode.focus, or (last example) this.domNode.focus + * + * DOM node innerHTML + * _setTitleAttr: { node: "titleNode", type: "innerHTML" } + * Maps this.title to this.titleNode.innerHTML + * + * DOM node innerText + * _setTitleAttr: { node: "titleNode", type: "innerText" } + * Maps this.title to this.titleNode.innerText + * + * DOM node CSS class + * _setMyClassAttr: { node: "domNode", type: "class" } + * Maps this.myClass to this.domNode.className + * + * If the value of _setXXXAttr is an array, then each element in the array matches one of the + * formats of the above list. + * + * If the custom setter is null, no action is performed other than saving the new value + * in the widget (in this). + * + * If no custom setter is defined for an attribute, then it will be copied + * to this.focusNode (if the widget defines a focusNode), or this.domNode otherwise. + * That's only done though for attributes that match DOMNode attributes (title, + * alt, aria-labelledby, etc.) + * + * @param params Hash of initialization parameters for widget, including scalar values (like title, duration etc.)and functions, typically callbacks like onClick.The hash can contain any of the widget's properties, excluding read-only properties. + * @param srcNodeRef OptionalIf a srcNodeRef (DOM node) is specified:use srcNodeRef.innerHTML as my contentsif this is a behavioral widget then apply behavior to that srcNodeRefotherwise, replace srcNodeRef with my generated DOM tree + */ + class _WidgetBase extends dojo.Stateful implements dijit.Destroyable { + constructor(params?: Object, srcNodeRef?: HTMLElement); + /** + * Deprecated. Instead of attributeMap, widget should have a _setXXXAttr attribute + * for each XXX attribute to be mapped to the DOM. + * + * attributeMap sets up a "binding" between attributes (aka properties) + * of the widget and the widget's DOM. + * Changes to widget attributes listed in attributeMap will be + * reflected into the DOM. + * + * For example, calling set('title', 'hello') + * on a TitlePane will automatically cause the TitlePane's DOM to update + * with the new title. + * + * attributeMap is a hash where the key is an attribute of the widget, + * and the value reflects a binding to a: + * + * DOM node attribute + * focus: {node: "focusNode", type: "attribute"} + * Maps this.focus to this.focusNode.focus + * + * DOM node innerHTML + * title: { node: "titleNode", type: "innerHTML" } + * Maps this.title to this.titleNode.innerHTML + * + * DOM node innerText + * title: { node: "titleNode", type: "innerText" } + * Maps this.title to this.titleNode.innerText + * + * DOM node CSS class + * myClass: { node: "domNode", type: "class" } + * Maps this.myClass to this.domNode.className + * + * If the value is an array, then each element in the array matches one of the + * formats of the above list. + * + * There are also some shorthands for backwards compatibility: + * + * string --> { node: string, type: "attribute" }, for example: + * "focusNode" ---> { node: "focusNode", type: "attribute" } + * "" --> { node: "domNode", type: "attribute" } + * + */ + "attributeMap": Object; + set(property:"attributeMap", value: Object): void; + get(property:"attributeMap"): Object; + watch(property:"attributeMap", callback:{(property?:string, oldValue?:Object, newValue?: Object):void}) :{unwatch():void} + /** + * Root CSS class of the widget (ex: dijitTextBox), used to construct CSS classes to indicate + * widget state. + * + */ + "baseClass": string; + set(property:"baseClass", value: string): void; + get(property:"baseClass"): string; + watch(property:"baseClass", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * + */ + "class": string; + set(property:"class", value: string): void; + get(property:"class"): string; + watch(property:"class", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * Designates where children of the source DOM node will be placed. + * "Children" in this case refers to both DOM nodes and widgets. + * For example, for myWidget: + * + *
+ * here's a plain DOM node + * and a widget + * and another plain DOM node + *
+ * containerNode would point to: + * + * here's a plain DOM node + * and a widget + * and another plain DOM node + * In templated widgets, "containerNode" is set via a + * data-dojo-attach-point assignment. + * + * containerNode must be defined for any widget that accepts innerHTML + * (like ContentPane or BorderContainer or even Button), and conversely + * is null for widgets that don't, like TextBox. + * + */ + "containerNode": HTMLElement; + set(property:"containerNode", value: HTMLElement): void; + get(property:"containerNode"): HTMLElement; + watch(property:"containerNode", callback:{(property?:string, oldValue?:HTMLElement, newValue?: HTMLElement):void}) :{unwatch():void} + /** + * Bi-directional support, as defined by the HTML DIR + * attribute. Either left-to-right "ltr" or right-to-left "rtl". If undefined, widgets renders in page's + * default direction. + * + */ + "dir": string; + set(property:"dir", value: string): void; + get(property:"dir"): string; + watch(property:"dir", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * This is our visible representation of the widget! Other DOM + * Nodes may by assigned to other properties, usually through the + * template system's data-dojo-attach-point syntax, but the domNode + * property is the canonical "top level" node in widget UI. + * + */ + "domNode": HTMLElement; + set(property:"domNode", value: HTMLElement): void; + get(property:"domNode"): HTMLElement; + watch(property:"domNode", callback:{(property?:string, oldValue?:HTMLElement, newValue?: HTMLElement):void}) :{unwatch():void} + /** + * This widget or a widget it contains has focus, or is "active" because + * it was recently clicked. + * + */ + "focused": boolean; + set(property:"focused", value: boolean): void; + get(property:"focused"): boolean; + watch(property:"focused", callback:{(property?:string, oldValue?:boolean, newValue?: boolean):void}) :{unwatch():void} + /** + * A unique, opaque ID string that can be assigned by users or by the + * system. If the developer passes an ID which is known not to be + * unique, the specified ID is ignored and the system-generated ID is + * used instead. + * + */ + "id": string; + set(property:"id", value: string): void; + get(property:"id"): string; + watch(property:"id", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * Rarely used. Overrides the default Dojo locale used to render this widget, + * as defined by the HTML LANG attribute. + * Value must be among the list of locales specified during by the Dojo bootstrap, + * formatted according to RFC 3066 (like en-us). + * + */ + "lang": string; + set(property:"lang", value: string): void; + get(property:"lang"): string; + watch(property:"lang", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * The document this widget belongs to. If not specified to constructor, will default to + * srcNodeRef.ownerDocument, or if no sourceRef specified, then to the document global + * + */ + "ownerDocument": Object; + set(property:"ownerDocument", value: Object): void; + get(property:"ownerDocument"): Object; + watch(property:"ownerDocument", callback:{(property?:string, oldValue?:Object, newValue?: Object):void}) :{unwatch():void} + /** + * pointer to original DOM node + * + */ + "srcNodeRef": HTMLElement; + set(property:"srcNodeRef", value: HTMLElement): void; + get(property:"srcNodeRef"): HTMLElement; + watch(property:"srcNodeRef", callback:{(property?:string, oldValue?:HTMLElement, newValue?: HTMLElement):void}) :{unwatch():void} + /** + * HTML style attributes as cssText string or name/value hash + * + */ + "style": Object; + set(property:"style", value: Object): void; + get(property:"style"): Object; + watch(property:"style", callback:{(property?:string, oldValue?:Object, newValue?: Object):void}) :{unwatch():void} + /** + * HTML title attribute. + * + * For form widgets this specifies a tooltip to display when hovering over + * the widget (just like the native HTML title attribute). + * + * For TitlePane or for when this widget is a child of a TabContainer, AccordionContainer, + * etc., it's used to specify the tab label, accordion pane title, etc. In this case it's + * interpreted as HTML. + * + */ + "title": string; + set(property:"title", value: string): void; + get(property:"title"): string; + watch(property:"title", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * When this widget's title attribute is used to for a tab label, accordion pane title, etc., + * this specifies the tooltip to appear when the mouse is hovered over that text. + * + */ + "tooltip": string; + set(property:"tooltip", value: string): void; + get(property:"tooltip"): string; + watch(property:"tooltip", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * Construct the UI for this widget, setting this.domNode. + * Most widgets will mixin dijit._TemplatedMixin, which implements this method. + * + */ + buildRendering(): void; + /** + * Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead. + * + * Connects specified obj/event to specified method of this object + * and registers for disconnect() on widget destroy. + * + * Provide widget-specific analog to dojo.connect, except with the + * implicit use of this widget as the target object. + * Events connected with this.connect are disconnected upon + * destruction. + * + * @param obj + * @param event + * @param method + */ + connect(obj: Object, event: String, method: String): any; + /** + * Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead. + * + * Connects specified obj/event to specified method of this object + * and registers for disconnect() on widget destroy. + * + * Provide widget-specific analog to dojo.connect, except with the + * implicit use of this widget as the target object. + * Events connected with this.connect are disconnected upon + * destruction. + * + * @param obj + * @param event + * @param method + */ + connect(obj: any, event: String, method: String): any; + /** + * Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead. + * + * Connects specified obj/event to specified method of this object + * and registers for disconnect() on widget destroy. + * + * Provide widget-specific analog to dojo.connect, except with the + * implicit use of this widget as the target object. + * Events connected with this.connect are disconnected upon + * destruction. + * + * @param obj + * @param event + * @param method + */ + connect(obj: Object, event: Function, method: String): any; + /** + * Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead. + * + * Connects specified obj/event to specified method of this object + * and registers for disconnect() on widget destroy. + * + * Provide widget-specific analog to dojo.connect, except with the + * implicit use of this widget as the target object. + * Events connected with this.connect are disconnected upon + * destruction. + * + * @param obj + * @param event + * @param method + */ + connect(obj: any, event: Function, method: String): any; + /** + * Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead. + * + * Connects specified obj/event to specified method of this object + * and registers for disconnect() on widget destroy. + * + * Provide widget-specific analog to dojo.connect, except with the + * implicit use of this widget as the target object. + * Events connected with this.connect are disconnected upon + * destruction. + * + * @param obj + * @param event + * @param method + */ + connect(obj: Object, event: String, method: Function): any; + /** + * Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead. + * + * Connects specified obj/event to specified method of this object + * and registers for disconnect() on widget destroy. + * + * Provide widget-specific analog to dojo.connect, except with the + * implicit use of this widget as the target object. + * Events connected with this.connect are disconnected upon + * destruction. + * + * @param obj + * @param event + * @param method + */ + connect(obj: any, event: String, method: Function): any; + /** + * Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead. + * + * Connects specified obj/event to specified method of this object + * and registers for disconnect() on widget destroy. + * + * Provide widget-specific analog to dojo.connect, except with the + * implicit use of this widget as the target object. + * Events connected with this.connect are disconnected upon + * destruction. + * + * @param obj + * @param event + * @param method + */ + connect(obj: Object, event: Function, method: Function): any; + /** + * Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead. + * + * Connects specified obj/event to specified method of this object + * and registers for disconnect() on widget destroy. + * + * Provide widget-specific analog to dojo.connect, except with the + * implicit use of this widget as the target object. + * Events connected with this.connect are disconnected upon + * destruction. + * + * @param obj + * @param event + * @param method + */ + connect(obj: any, event: Function, method: Function): any; + /** + * Wrapper to setTimeout to avoid deferred functions executing + * after the originating widget has been destroyed. + * Returns an object handle with a remove method (that returns null) (replaces clearTimeout). + * + * @param fcn Function reference. + * @param delay OptionalDelay, defaults to 0. + */ + defer(fcn: Function, delay: number): Object; + /** + * Destroy this widget, but not its descendants. Descendants means widgets inside of + * this.containerNode. Will also destroy any resources (including widgets) registered via this.own(). + * + * This method will also destroy internal widgets such as those created from a template, + * assuming those widgets exist inside of this.domNode but outside of this.containerNode. + * + * For 2.0 it's planned that this method will also destroy descendant widgets, so apps should not + * depend on the current ability to destroy a widget without destroying its descendants. Generally + * they should use destroyRecursive() for widgets with children. + * + * @param preserveDom If true, this method will leave the original DOM structure alone.Note: This will not yet work with _TemplatedMixin widgets + */ + destroy(preserveDom?: boolean): void; + /** + * Recursively destroy the children of this widget and their + * descendants. + * + * @param preserveDom OptionalIf true, the preserveDom attribute is passed to all descendantwidget's .destroy() method. Not for use with _Templatedwidgets. + */ + destroyDescendants(preserveDom?: boolean): void; + /** + * Destroy this widget and its descendants + * This is the generic "destructor" function that all widget users + * should call to cleanly discard with a widget. Once a widget is + * destroyed, it is removed from the manager object. + * + * @param preserveDom OptionalIf true, this method will leave the original DOM structurealone of descendant Widgets. Note: This will NOT work withdijit._TemplatedMixin widgets. + */ + destroyRecursive(preserveDom?: boolean): void; + /** + * Destroys the DOM nodes associated with this widget. + * + * @param preserveDom OptionalIf true, this method will leave the original DOM structure aloneduring tear-down. Note: this will not work with _Templatedwidgets yet. + */ + destroyRendering(preserveDom?: boolean): void; + /** + * Deprecated, will be removed in 2.0, use handle.remove() instead. + * + * Disconnects handle created by connect. + * + * @param handle + */ + disconnect(handle: any): void; + /** + * Used by widgets to signal that a synthetic event occurred, ex: + * + * myWidget.emit("attrmodified-selectedChildWidget", {}). + * Emits an event on this.domNode named type.toLowerCase(), based on eventObj. + * Also calls onType() method, if present, and returns value from that method. + * By default passes eventObj to callback, but will pass callbackArgs instead, if specified. + * Modifies eventObj by adding missing parameters (bubbles, cancelable, widget). + * + * @param type + * @param eventObj Optional + * @param callbackArgs Optional + */ + emit(type: String, eventObj: Object, callbackArgs: any[]): any; + /** + * Get a property from a widget. + * Get a named property from a widget. The property may + * potentially be retrieved via a getter method. If no getter is defined, this + * just retrieves the object's property. + * + * For example, if the widget has properties foo and bar + * and a method named _getFooAttr(), calling: + * myWidget.get("foo") would be equivalent to calling + * widget._getFooAttr() and myWidget.get("bar") + * would be equivalent to the expression + * widget.bar2 + * + * @param name The property to get. + */ + get(name: any): any; + /** + * Returns all direct children of this widget, i.e. all widgets underneath this.containerNode whose parent + * is this widget. Note that it does not return all descendants, but rather just direct children. + * Analogous to Node.childNodes, + * except containing widgets rather than DOMNodes. + * + * The result intentionally excludes internally created widgets (a.k.a. supporting widgets) + * outside of this.containerNode. + * + * Note that the array returned is a simple array. Application code should not assume + * existence of methods like forEach(). + * + */ + getChildren(): any[]; + /** + * Returns the parent widget of this widget. + * + */ + getParent(): any; + /** + * Return true if this widget can currently be focused + * and false if not + * + */ + isFocusable(): any; + /** + * Return this widget's explicit or implicit orientation (true for LTR, false for RTL) + * + */ + isLeftToRight(): any; + /** + * + */ + isValid: any; + /** + * Call specified function when event occurs, ex: myWidget.on("click", function(){ ... }). + * Call specified function when event type occurs, ex: myWidget.on("click", function(){ ... }). + * Note that the function is not run in any particular scope, so if (for example) you want it to run in the + * widget's scope you must do myWidget.on("click", lang.hitch(myWidget, func)). + * + * @param type Name of event (ex: "click") or extension event like touch.press. + * @param func + */ + on(type: String, func: Function): any; + /** + * Call specified function when event occurs, ex: myWidget.on("click", function(){ ... }). + * Call specified function when event type occurs, ex: myWidget.on("click", function(){ ... }). + * Note that the function is not run in any particular scope, so if (for example) you want it to run in the + * widget's scope you must do myWidget.on("click", lang.hitch(myWidget, func)). + * + * @param type Name of event (ex: "click") or extension event like touch.press. + * @param func + */ + on(type: Function, func: Function): any; + /** + * Track specified handles and remove/destroy them when this instance is destroyed, unless they were + * already removed/destroyed manually. + * + */ + own(): any; + /** + * Place this widget somewhere in the DOM based + * on standard domConstruct.place() conventions. + * A convenience function provided in all _Widgets, providing a simple + * shorthand mechanism to put an existing (or newly created) Widget + * somewhere in the dom, and allow chaining. + * + * @param reference Widget, DOMNode, or id of widget or DOMNode + * @param position OptionalIf reference is a widget (or id of widget), and that widget has an ".addChild" method,it will be called passing this widget instance into that method, supplying the optionalposition index passed. In this case position (if specified) should be an integer.If reference is a DOMNode (or id matching a DOMNode but not a widget),the position argument can be a numeric index or a string"first", "last", "before", or "after", same as dojo/dom-construct::place(). + */ + placeAt(reference: String, position: String): any; + /** + * Place this widget somewhere in the DOM based + * on standard domConstruct.place() conventions. + * A convenience function provided in all _Widgets, providing a simple + * shorthand mechanism to put an existing (or newly created) Widget + * somewhere in the dom, and allow chaining. + * + * @param reference Widget, DOMNode, or id of widget or DOMNode + * @param position OptionalIf reference is a widget (or id of widget), and that widget has an ".addChild" method,it will be called passing this widget instance into that method, supplying the optionalposition index passed. In this case position (if specified) should be an integer.If reference is a DOMNode (or id matching a DOMNode but not a widget),the position argument can be a numeric index or a string"first", "last", "before", or "after", same as dojo/dom-construct::place(). + */ + placeAt(reference: HTMLElement, position: String): any; + /** + * Place this widget somewhere in the DOM based + * on standard domConstruct.place() conventions. + * A convenience function provided in all _Widgets, providing a simple + * shorthand mechanism to put an existing (or newly created) Widget + * somewhere in the dom, and allow chaining. + * + * @param reference Widget, DOMNode, or id of widget or DOMNode + * @param position OptionalIf reference is a widget (or id of widget), and that widget has an ".addChild" method,it will be called passing this widget instance into that method, supplying the optionalposition index passed. In this case position (if specified) should be an integer.If reference is a DOMNode (or id matching a DOMNode but not a widget),the position argument can be a numeric index or a string"first", "last", "before", or "after", same as dojo/dom-construct::place(). + */ + placeAt(reference: dijit._WidgetBase, position: String): any; + /** + * Place this widget somewhere in the DOM based + * on standard domConstruct.place() conventions. + * A convenience function provided in all _Widgets, providing a simple + * shorthand mechanism to put an existing (or newly created) Widget + * somewhere in the dom, and allow chaining. + * + * @param reference Widget, DOMNode, or id of widget or DOMNode + * @param position OptionalIf reference is a widget (or id of widget), and that widget has an ".addChild" method,it will be called passing this widget instance into that method, supplying the optionalposition index passed. In this case position (if specified) should be an integer.If reference is a DOMNode (or id matching a DOMNode but not a widget),the position argument can be a numeric index or a string"first", "last", "before", or "after", same as dojo/dom-construct::place(). + */ + placeAt(reference: String, position: number): any; + /** + * Place this widget somewhere in the DOM based + * on standard domConstruct.place() conventions. + * A convenience function provided in all _Widgets, providing a simple + * shorthand mechanism to put an existing (or newly created) Widget + * somewhere in the dom, and allow chaining. + * + * @param reference Widget, DOMNode, or id of widget or DOMNode + * @param position OptionalIf reference is a widget (or id of widget), and that widget has an ".addChild" method,it will be called passing this widget instance into that method, supplying the optionalposition index passed. In this case position (if specified) should be an integer.If reference is a DOMNode (or id matching a DOMNode but not a widget),the position argument can be a numeric index or a string"first", "last", "before", or "after", same as dojo/dom-construct::place(). + */ + placeAt(reference: HTMLElement, position: number): any; + /** + * Place this widget somewhere in the DOM based + * on standard domConstruct.place() conventions. + * A convenience function provided in all _Widgets, providing a simple + * shorthand mechanism to put an existing (or newly created) Widget + * somewhere in the dom, and allow chaining. + * + * @param reference Widget, DOMNode, or id of widget or DOMNode + * @param position OptionalIf reference is a widget (or id of widget), and that widget has an ".addChild" method,it will be called passing this widget instance into that method, supplying the optionalposition index passed. In this case position (if specified) should be an integer.If reference is a DOMNode (or id matching a DOMNode but not a widget),the position argument can be a numeric index or a string"first", "last", "before", or "after", same as dojo/dom-construct::place(). + */ + placeAt(reference: dijit._WidgetBase, position: number): any; + /** + * Processing after the DOM fragment is created + * Called after the DOM fragment has been created, but not necessarily + * added to the document. Do not include any operations which rely on + * node dimensions or placement. + * + */ + postCreate(): void; + /** + * Called after the parameters to the widget have been read-in, + * but before the widget template is instantiated. Especially + * useful to set properties that are referenced in the widget + * template. + * + */ + postMixInProperties(): void; + /** + * Set a property on a widget + * Sets named properties on a widget which may potentially be handled by a + * setter in the widget. + * + * For example, if the widget has properties foo and bar + * and a method named _setFooAttr(), calling + * myWidget.set("foo", "Howdy!") would be equivalent to calling + * widget._setFooAttr("Howdy!") and myWidget.set("bar", 3) + * would be equivalent to the statement widget.bar = 3; + * + * set() may also be called with a hash of name/value pairs, ex: + * + * myWidget.set({ + * foo: "Howdy", + * bar: 3 + * }); + * This is equivalent to calling set(foo, "Howdy") and set(bar, 3) + * + * @param name The property to set. + * @param value The value to set in the property. + */ + set(name: any, value: any): any; + /** + * Processing after the DOM fragment is added to the document + * Called after a widget and its children have been created and added to the page, + * and all related widgets have finished their create() cycle, up through postCreate(). + * + * Note that startup() may be called while the widget is still hidden, for example if the widget is + * inside a hidden dijit/Dialog or an unselected tab of a dijit/layout/TabContainer. + * For widgets that need to do layout, it's best to put that layout code inside resize(), and then + * extend dijit/layout/_LayoutWidget so that resize() is called when the widget is visible. + * + */ + startup(): void; + /** + * Deprecated, will be removed in 2.0, use this.own(topic.subscribe()) instead. + * + * Subscribes to the specified topic and calls the specified method + * of this object and registers for unsubscribe() on widget destroy. + * + * Provide widget-specific analog to dojo.subscribe, except with the + * implicit use of this widget as the target object. + * + * @param t The topic + * @param method The callback + */ + subscribe(t: String, method: Function): any; + /** + * Returns a string that represents the widget. + * When a widget is cast to a string, this method will be used to generate the + * output. Currently, it does not implement any sort of reversible + * serialization. + * + */ + toString(): String; + /** + * Deprecated. Override destroy() instead to implement custom widget tear-down + * behavior. + * + */ + uninitialize(): boolean; + /** + * Deprecated, will be removed in 2.0, use handle.remove() instead. + * + * Unsubscribes handle created by this.subscribe. + * Also removes handle from this widget's list of subscriptions + * + * @param handle + */ + unsubscribe(handle: Object): void; + /** + * Watches a property for changes + * + * @param name OptionalIndicates the property to watch. This is optional (the callback may be theonly parameter), and if omitted, all the properties will be watched + * @param callback The function to execute when the property changes. This will be called afterthe property has been changed. The callback will be called with the |this|set to the instance, the first argument as the name of the property, thesecond argument as the old value and the third argument as the new value. + */ + watch(property: string, callback:{(property?:string, oldValue?:any, newValue?: any):void}) :{unwatch():void}; + /** + * Called when the widget stops being "active" because + * focus moved to something outside of it, or the user + * clicked somewhere outside of it, or the widget was + * hidden. + * + */ + onBlur(): void; + /** + * Called when the widget becomes "active" because + * it or a widget inside of it either has focus, or has recently + * been clicked. + * + */ + onFocus(): void; + } + /** + * Permalink: http://dojotoolkit.org/api/1.9/dijit/_Widget.html + * + * Old base class for widgets. New widgets should extend dijit/_WidgetBase instead + * Old Base class for Dijit widgets. + * + * Extends _WidgetBase, adding support for: + * + * declaratively/programatically specifying widget initialization parameters like + * onMouseMove="foo" that call foo when this.domNode gets a mousemove event + * ondijitclick: + * Support new data-dojo-attach-event="ondijitclick: ..." that is triggered by a mouse click or a SPACE/ENTER keypress + * focus related functions: + * In particular, the onFocus()/onBlur() callbacks. Driven internally by + * dijit/_base/focus.js. + * deprecated methods + * onShow(), onHide(), onClose() + * Also, by loading code in dijit/_base, turns on: + * + * browser sniffing (putting browser class like dj_ie on node) + * high contrast mode sniffing (add dijit_a11y class to if machine is in high contrast mode) + * + * @param params Hash of initialization parameters for widget, including scalar values (like title, duration etc.)and functions, typically callbacks like onClick.The hash can contain any of the widget's properties, excluding read-only properties. + * @param srcNodeRef OptionalIf a srcNodeRef (DOM node) is specified:use srcNodeRef.innerHTML as my contentsif this is a behavioral widget then apply behavior to that srcNodeRefotherwise, replace srcNodeRef with my generated DOM tree + */ + class _Widget extends dijit._WidgetBase implements dijit._OnDijitClickMixin, dijit._FocusMixin { + constructor(params?: Object, srcNodeRef?: HTMLElement); + /** + * Custom press, release, and click synthetic events + * which trigger on a left mouse click, touch, or space/enter keyup. + * + */ + "a11yclick": Object; + /** + * Deprecated. Instead of attributeMap, widget should have a _setXXXAttr attribute + * for each XXX attribute to be mapped to the DOM. + * + * attributeMap sets up a "binding" between attributes (aka properties) + * of the widget and the widget's DOM. + * Changes to widget attributes listed in attributeMap will be + * reflected into the DOM. + * + * For example, calling set('title', 'hello') + * on a TitlePane will automatically cause the TitlePane's DOM to update + * with the new title. + * + * attributeMap is a hash where the key is an attribute of the widget, + * and the value reflects a binding to a: + * + * DOM node attribute + * focus: {node: "focusNode", type: "attribute"} + * Maps this.focus to this.focusNode.focus + * + * DOM node innerHTML + * title: { node: "titleNode", type: "innerHTML" } + * Maps this.title to this.titleNode.innerHTML + * + * DOM node innerText + * title: { node: "titleNode", type: "innerText" } + * Maps this.title to this.titleNode.innerText + * + * DOM node CSS class + * myClass: { node: "domNode", type: "class" } + * Maps this.myClass to this.domNode.className + * + * If the value is an array, then each element in the array matches one of the + * formats of the above list. + * + * There are also some shorthands for backwards compatibility: + * + * string --> { node: string, type: "attribute" }, for example: + * "focusNode" ---> { node: "focusNode", type: "attribute" } + * "" --> { node: "domNode", type: "attribute" } + * + */ + "attributeMap": Object; + set(property:"attributeMap", value: Object): void; + get(property:"attributeMap"): Object; + watch(property:"attributeMap", callback:{(property?:string, oldValue?:Object, newValue?: Object):void}) :{unwatch():void} + /** + * Root CSS class of the widget (ex: dijitTextBox), used to construct CSS classes to indicate + * widget state. + * + */ + "baseClass": string; + set(property:"baseClass", value: string): void; + get(property:"baseClass"): string; + watch(property:"baseClass", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * + */ + "class": string; + set(property:"class", value: string): void; + get(property:"class"): string; + watch(property:"class", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * Designates where children of the source DOM node will be placed. + * "Children" in this case refers to both DOM nodes and widgets. + * For example, for myWidget: + * + *
+ * here's a plain DOM node + * and a widget + * and another plain DOM node + *
+ * containerNode would point to: + * + * here's a plain DOM node + * and a widget + * and another plain DOM node + * In templated widgets, "containerNode" is set via a + * data-dojo-attach-point assignment. + * + * containerNode must be defined for any widget that accepts innerHTML + * (like ContentPane or BorderContainer or even Button), and conversely + * is null for widgets that don't, like TextBox. + * + */ + "containerNode": HTMLElement; + set(property:"containerNode", value: HTMLElement): void; + get(property:"containerNode"): HTMLElement; + watch(property:"containerNode", callback:{(property?:string, oldValue?:HTMLElement, newValue?: HTMLElement):void}) :{unwatch():void} + /** + * Bi-directional support, as defined by the HTML DIR + * attribute. Either left-to-right "ltr" or right-to-left "rtl". If undefined, widgets renders in page's + * default direction. + * + */ + "dir": string; + set(property:"dir", value: string): void; + get(property:"dir"): string; + watch(property:"dir", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * Defines a type of widget. + * + */ + "dndType": string; + set(property:"dndType", value: string): void; + get(property:"dndType"): string; + watch(property:"dndType", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * This is our visible representation of the widget! Other DOM + * Nodes may by assigned to other properties, usually through the + * template system's data-dojo-attach-point syntax, but the domNode + * property is the canonical "top level" node in widget UI. + * + */ + "domNode": HTMLElement; + set(property:"domNode", value: HTMLElement): void; + get(property:"domNode"): HTMLElement; + watch(property:"domNode", callback:{(property?:string, oldValue?:HTMLElement, newValue?: HTMLElement):void}) :{unwatch():void} + /** + * This widget or a widget it contains has focus, or is "active" because + * it was recently clicked. + * + */ + "focused": boolean; + set(property:"focused", value: boolean): void; + get(property:"focused"): boolean; + watch(property:"focused", callback:{(property?:string, oldValue?:boolean, newValue?: boolean):void}) :{unwatch():void} + /** + * A unique, opaque ID string that can be assigned by users or by the + * system. If the developer passes an ID which is known not to be + * unique, the specified ID is ignored and the system-generated ID is + * used instead. + * + */ + "id": string; + set(property:"id", value: string): void; + get(property:"id"): string; + watch(property:"id", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * Rarely used. Overrides the default Dojo locale used to render this widget, + * as defined by the HTML LANG attribute. + * Value must be among the list of locales specified during by the Dojo bootstrap, + * formatted according to RFC 3066 (like en-us). + * + */ + "lang": string; + set(property:"lang", value: string): void; + get(property:"lang"): string; + watch(property:"lang", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * + */ + "observer": string; + set(property:"observer", value: string): void; + get(property:"observer"): string; + watch(property:"observer", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * The document this widget belongs to. If not specified to constructor, will default to + * srcNodeRef.ownerDocument, or if no sourceRef specified, then to the document global + * + */ + "ownerDocument": Object; + set(property:"ownerDocument", value: Object): void; + get(property:"ownerDocument"): Object; + watch(property:"ownerDocument", callback:{(property?:string, oldValue?:Object, newValue?: Object):void}) :{unwatch():void} + /** + * A parameter needed by RadioGroupSlide only. An optional paramter to force + * the ContentPane to slide in from a set direction. Defaults + * to "random", or specify one of "top", "left", "right", "bottom" + * to slideFrom top, left, right, or bottom. + * + */ + "slideFrom": string; + set(property:"slideFrom", value: string): void; + get(property:"slideFrom"): string; + watch(property:"slideFrom", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * pointer to original DOM node + * + */ + "srcNodeRef": HTMLElement; + set(property:"srcNodeRef", value: HTMLElement): void; + get(property:"srcNodeRef"): HTMLElement; + watch(property:"srcNodeRef", callback:{(property?:string, oldValue?:HTMLElement, newValue?: HTMLElement):void}) :{unwatch():void} + /** + * HTML style attributes as cssText string or name/value hash + * + */ + "style": Object; + set(property:"style", value: Object): void; + get(property:"style"): Object; + watch(property:"style", callback:{(property?:string, oldValue?:Object, newValue?: Object):void}) :{unwatch():void} + /** + * HTML title attribute. + * + * For form widgets this specifies a tooltip to display when hovering over + * the widget (just like the native HTML title attribute). + * + * For TitlePane or for when this widget is a child of a TabContainer, AccordionContainer, + * etc., it's used to specify the tab label, accordion pane title, etc. In this case it's + * interpreted as HTML. + * + */ + "title": string; + set(property:"title", value: string): void; + get(property:"title"): string; + watch(property:"title", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * When this widget's title attribute is used to for a tab label, accordion pane title, etc., + * this specifies the tooltip to appear when the mouse is hovered over that text. + * + */ + "tooltip": string; + set(property:"tooltip", value: string): void; + get(property:"tooltip"): string; + watch(property:"tooltip", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * This method is deprecated, use get() or set() directly. + * + * @param name The property to get or set. If an object is passed here and nota string, its keys are used as names of attributes to be setand the value of the object as values to set in the widget. + * @param value OptionalOptional. If provided, attr() operates as a setter. If omitted,the current value of the named property is returned. + */ + attr(name: String, value: Object): any; + /** + * This method is deprecated, use get() or set() directly. + * + * @param name The property to get or set. If an object is passed here and nota string, its keys are used as names of attributes to be setand the value of the object as values to set in the widget. + * @param value OptionalOptional. If provided, attr() operates as a setter. If omitted,the current value of the named property is returned. + */ + attr(name: Object, value: Object): any; + /** + * Construct the UI for this widget, setting this.domNode. + * Most widgets will mixin dijit._TemplatedMixin, which implements this method. + * + */ + buildRendering(): void; + /** + * Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead. + * + * Connects specified obj/event to specified method of this object + * and registers for disconnect() on widget destroy. + * + * Provide widget-specific analog to dojo.connect, except with the + * implicit use of this widget as the target object. + * Events connected with this.connect are disconnected upon + * destruction. + * + * @param obj + * @param event + * @param method + */ + connect(obj: Object, event: String, method: String): any; + /** + * Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead. + * + * Connects specified obj/event to specified method of this object + * and registers for disconnect() on widget destroy. + * + * Provide widget-specific analog to dojo.connect, except with the + * implicit use of this widget as the target object. + * Events connected with this.connect are disconnected upon + * destruction. + * + * @param obj + * @param event + * @param method + */ + connect(obj: any, event: String, method: String): any; + /** + * Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead. + * + * Connects specified obj/event to specified method of this object + * and registers for disconnect() on widget destroy. + * + * Provide widget-specific analog to dojo.connect, except with the + * implicit use of this widget as the target object. + * Events connected with this.connect are disconnected upon + * destruction. + * + * @param obj + * @param event + * @param method + */ + connect(obj: Object, event: Function, method: String): any; + /** + * Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead. + * + * Connects specified obj/event to specified method of this object + * and registers for disconnect() on widget destroy. + * + * Provide widget-specific analog to dojo.connect, except with the + * implicit use of this widget as the target object. + * Events connected with this.connect are disconnected upon + * destruction. + * + * @param obj + * @param event + * @param method + */ + connect(obj: any, event: Function, method: String): any; + /** + * Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead. + * + * Connects specified obj/event to specified method of this object + * and registers for disconnect() on widget destroy. + * + * Provide widget-specific analog to dojo.connect, except with the + * implicit use of this widget as the target object. + * Events connected with this.connect are disconnected upon + * destruction. + * + * @param obj + * @param event + * @param method + */ + connect(obj: Object, event: String, method: Function): any; + /** + * Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead. + * + * Connects specified obj/event to specified method of this object + * and registers for disconnect() on widget destroy. + * + * Provide widget-specific analog to dojo.connect, except with the + * implicit use of this widget as the target object. + * Events connected with this.connect are disconnected upon + * destruction. + * + * @param obj + * @param event + * @param method + */ + connect(obj: any, event: String, method: Function): any; + /** + * Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead. + * + * Connects specified obj/event to specified method of this object + * and registers for disconnect() on widget destroy. + * + * Provide widget-specific analog to dojo.connect, except with the + * implicit use of this widget as the target object. + * Events connected with this.connect are disconnected upon + * destruction. + * + * @param obj + * @param event + * @param method + */ + connect(obj: Object, event: Function, method: Function): any; + /** + * Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead. + * + * Connects specified obj/event to specified method of this object + * and registers for disconnect() on widget destroy. + * + * Provide widget-specific analog to dojo.connect, except with the + * implicit use of this widget as the target object. + * Events connected with this.connect are disconnected upon + * destruction. + * + * @param obj + * @param event + * @param method + */ + connect(obj: any, event: Function, method: Function): any; + /** + * Wrapper to setTimeout to avoid deferred functions executing + * after the originating widget has been destroyed. + * Returns an object handle with a remove method (that returns null) (replaces clearTimeout). + * + * @param fcn Function reference. + * @param delay OptionalDelay, defaults to 0. + */ + defer(fcn: Function, delay: number): Object; + /** + * Destroy this widget, but not its descendants. Descendants means widgets inside of + * this.containerNode. Will also destroy any resources (including widgets) registered via this.own(). + * + * This method will also destroy internal widgets such as those created from a template, + * assuming those widgets exist inside of this.domNode but outside of this.containerNode. + * + * For 2.0 it's planned that this method will also destroy descendant widgets, so apps should not + * depend on the current ability to destroy a widget without destroying its descendants. Generally + * they should use destroyRecursive() for widgets with children. + * + * @param preserveDom If true, this method will leave the original DOM structure alone.Note: This will not yet work with _TemplatedMixin widgets + */ + destroy(preserveDom?: boolean): void; + /** + * Recursively destroy the children of this widget and their + * descendants. + * + * @param preserveDom OptionalIf true, the preserveDom attribute is passed to all descendantwidget's .destroy() method. Not for use with _Templatedwidgets. + */ + destroyDescendants(preserveDom?: boolean): void; + /** + * Destroy this widget and its descendants + * This is the generic "destructor" function that all widget users + * should call to cleanly discard with a widget. Once a widget is + * destroyed, it is removed from the manager object. + * + * @param preserveDom OptionalIf true, this method will leave the original DOM structurealone of descendant Widgets. Note: This will NOT work withdijit._TemplatedMixin widgets. + */ + destroyRecursive(preserveDom?: boolean): void; + /** + * Destroys the DOM nodes associated with this widget. + * + * @param preserveDom OptionalIf true, this method will leave the original DOM structure aloneduring tear-down. Note: this will not work with _Templatedwidgets yet. + */ + destroyRendering(preserveDom?: boolean): void; + /** + * Deprecated, will be removed in 2.0, use handle.remove() instead. + * + * Disconnects handle created by connect. + * + * @param handle + */ + disconnect(handle: any): void; + /** + * Used by widgets to signal that a synthetic event occurred, ex: + * + * myWidget.emit("attrmodified-selectedChildWidget", {}). + * Emits an event on this.domNode named type.toLowerCase(), based on eventObj. + * Also calls onType() method, if present, and returns value from that method. + * By default passes eventObj to callback, but will pass callbackArgs instead, if specified. + * Modifies eventObj by adding missing parameters (bubbles, cancelable, widget). + * + * @param type + * @param eventObj Optional + * @param callbackArgs Optional + */ + emit(type: String, eventObj: Object, callbackArgs: any[]): any; + /** + * Get a property from a widget. + * Get a named property from a widget. The property may + * potentially be retrieved via a getter method. If no getter is defined, this + * just retrieves the object's property. + * + * For example, if the widget has properties foo and bar + * and a method named _getFooAttr(), calling: + * myWidget.get("foo") would be equivalent to calling + * widget._getFooAttr() and myWidget.get("bar") + * would be equivalent to the expression + * widget.bar2 + * + * @param name The property to get. + */ + get(name: any): any; + /** + * Returns all direct children of this widget, i.e. all widgets underneath this.containerNode whose parent + * is this widget. Note that it does not return all descendants, but rather just direct children. + * Analogous to Node.childNodes, + * except containing widgets rather than DOMNodes. + * + * The result intentionally excludes internally created widgets (a.k.a. supporting widgets) + * outside of this.containerNode. + * + * Note that the array returned is a simple array. Application code should not assume + * existence of methods like forEach(). + * + */ + getChildren(): any[]; + /** + * Returns all the widgets contained by this, i.e., all widgets underneath this.containerNode. + * This method should generally be avoided as it returns widgets declared in templates, which are + * supposed to be internal/hidden, but it's left here for back-compat reasons. + * + */ + getDescendants(): any[]; + /** + * Returns the parent widget of this widget. + * + */ + getParent(): any; + /** + * Return true if this widget can currently be focused + * and false if not + * + */ + isFocusable(): any; + /** + * Return this widget's explicit or implicit orientation (true for LTR, false for RTL) + * + */ + isLeftToRight(): any; + /** + * + * @param type protected + * @param func + */ + on(type: String, func: Function): any; + /** + * + * @param type protected + * @param func + */ + on(type: Function, func: Function): any; + /** + * Track specified handles and remove/destroy them when this instance is destroyed, unless they were + * already removed/destroyed manually. + * + */ + own(): any; + /** + * Place this widget somewhere in the DOM based + * on standard domConstruct.place() conventions. + * A convenience function provided in all _Widgets, providing a simple + * shorthand mechanism to put an existing (or newly created) Widget + * somewhere in the dom, and allow chaining. + * + * @param reference Widget, DOMNode, or id of widget or DOMNode + * @param position OptionalIf reference is a widget (or id of widget), and that widget has an ".addChild" method,it will be called passing this widget instance into that method, supplying the optionalposition index passed. In this case position (if specified) should be an integer.If reference is a DOMNode (or id matching a DOMNode but not a widget),the position argument can be a numeric index or a string"first", "last", "before", or "after", same as dojo/dom-construct::place(). + */ + placeAt(reference: String, position: String): any; + /** + * Place this widget somewhere in the DOM based + * on standard domConstruct.place() conventions. + * A convenience function provided in all _Widgets, providing a simple + * shorthand mechanism to put an existing (or newly created) Widget + * somewhere in the dom, and allow chaining. + * + * @param reference Widget, DOMNode, or id of widget or DOMNode + * @param position OptionalIf reference is a widget (or id of widget), and that widget has an ".addChild" method,it will be called passing this widget instance into that method, supplying the optionalposition index passed. In this case position (if specified) should be an integer.If reference is a DOMNode (or id matching a DOMNode but not a widget),the position argument can be a numeric index or a string"first", "last", "before", or "after", same as dojo/dom-construct::place(). + */ + placeAt(reference: HTMLElement, position: String): any; + /** + * Place this widget somewhere in the DOM based + * on standard domConstruct.place() conventions. + * A convenience function provided in all _Widgets, providing a simple + * shorthand mechanism to put an existing (or newly created) Widget + * somewhere in the dom, and allow chaining. + * + * @param reference Widget, DOMNode, or id of widget or DOMNode + * @param position OptionalIf reference is a widget (or id of widget), and that widget has an ".addChild" method,it will be called passing this widget instance into that method, supplying the optionalposition index passed. In this case position (if specified) should be an integer.If reference is a DOMNode (or id matching a DOMNode but not a widget),the position argument can be a numeric index or a string"first", "last", "before", or "after", same as dojo/dom-construct::place(). + */ + placeAt(reference: dijit._WidgetBase, position: String): any; + /** + * Place this widget somewhere in the DOM based + * on standard domConstruct.place() conventions. + * A convenience function provided in all _Widgets, providing a simple + * shorthand mechanism to put an existing (or newly created) Widget + * somewhere in the dom, and allow chaining. + * + * @param reference Widget, DOMNode, or id of widget or DOMNode + * @param position OptionalIf reference is a widget (or id of widget), and that widget has an ".addChild" method,it will be called passing this widget instance into that method, supplying the optionalposition index passed. In this case position (if specified) should be an integer.If reference is a DOMNode (or id matching a DOMNode but not a widget),the position argument can be a numeric index or a string"first", "last", "before", or "after", same as dojo/dom-construct::place(). + */ + placeAt(reference: String, position: number): any; + /** + * Place this widget somewhere in the DOM based + * on standard domConstruct.place() conventions. + * A convenience function provided in all _Widgets, providing a simple + * shorthand mechanism to put an existing (or newly created) Widget + * somewhere in the dom, and allow chaining. + * + * @param reference Widget, DOMNode, or id of widget or DOMNode + * @param position OptionalIf reference is a widget (or id of widget), and that widget has an ".addChild" method,it will be called passing this widget instance into that method, supplying the optionalposition index passed. In this case position (if specified) should be an integer.If reference is a DOMNode (or id matching a DOMNode but not a widget),the position argument can be a numeric index or a string"first", "last", "before", or "after", same as dojo/dom-construct::place(). + */ + placeAt(reference: HTMLElement, position: number): any; + /** + * Place this widget somewhere in the DOM based + * on standard domConstruct.place() conventions. + * A convenience function provided in all _Widgets, providing a simple + * shorthand mechanism to put an existing (or newly created) Widget + * somewhere in the dom, and allow chaining. + * + * @param reference Widget, DOMNode, or id of widget or DOMNode + * @param position OptionalIf reference is a widget (or id of widget), and that widget has an ".addChild" method,it will be called passing this widget instance into that method, supplying the optionalposition index passed. In this case position (if specified) should be an integer.If reference is a DOMNode (or id matching a DOMNode but not a widget),the position argument can be a numeric index or a string"first", "last", "before", or "after", same as dojo/dom-construct::place(). + */ + placeAt(reference: dijit._WidgetBase, position: number): any; + /** + * + */ + postCreate(): void; + /** + * Called after the parameters to the widget have been read-in, + * but before the widget template is instantiated. Especially + * useful to set properties that are referenced in the widget + * template. + * + */ + postMixInProperties(): void; + /** + * Set a property on a widget + * Sets named properties on a widget which may potentially be handled by a + * setter in the widget. + * + * For example, if the widget has properties foo and bar + * and a method named _setFooAttr(), calling + * myWidget.set("foo", "Howdy!") would be equivalent to calling + * widget._setFooAttr("Howdy!") and myWidget.set("bar", 3) + * would be equivalent to the statement widget.bar = 3; + * + * set() may also be called with a hash of name/value pairs, ex: + * + * myWidget.set({ + * foo: "Howdy", + * bar: 3 + * }); + * This is equivalent to calling set(foo, "Howdy") and set(bar, 3) + * + * @param name The property to set. + * @param value The value to set in the property. + */ + set(name: any, value: any): any; + /** + * Deprecated. Use set() instead. + * + * @param attr + * @param value + */ + setAttribute(attr: String, value: any): void; + /** + * Processing after the DOM fragment is added to the document + * Called after a widget and its children have been created and added to the page, + * and all related widgets have finished their create() cycle, up through postCreate(). + * + * Note that startup() may be called while the widget is still hidden, for example if the widget is + * inside a hidden dijit/Dialog or an unselected tab of a dijit/layout/TabContainer. + * For widgets that need to do layout, it's best to put that layout code inside resize(), and then + * extend dijit/layout/_LayoutWidget so that resize() is called when the widget is visible. + * + */ + startup(): void; + /** + * Deprecated, will be removed in 2.0, use this.own(topic.subscribe()) instead. + * + * Subscribes to the specified topic and calls the specified method + * of this object and registers for unsubscribe() on widget destroy. + * + * Provide widget-specific analog to dojo.subscribe, except with the + * implicit use of this widget as the target object. + * + * @param t The topic + * @param method The callback + */ + subscribe(t: String, method: Function): any; + /** + * Returns a string that represents the widget. + * When a widget is cast to a string, this method will be used to generate the + * output. Currently, it does not implement any sort of reversible + * serialization. + * + */ + toString(): String; + /** + * Deprecated. Override destroy() instead to implement custom widget tear-down + * behavior. + * + */ + uninitialize(): boolean; + /** + * Deprecated, will be removed in 2.0, use handle.remove() instead. + * + * Unsubscribes handle created by this.subscribe. + * Also removes handle from this widget's list of subscriptions + * + * @param handle + */ + unsubscribe(handle: Object): void; + /** + * Watches a property for changes + * + * @param name OptionalIndicates the property to watch. This is optional (the callback may be theonly parameter), and if omitted, all the properties will be watched + * @param callback The function to execute when the property changes. This will be called afterthe property has been changed. The callback will be called with the |this|set to the instance, the first argument as the name of the property, thesecond argument as the old value and the third argument as the new value. + */ + watch(property: string, callback:{(property?:string, oldValue?:any, newValue?: any):void}) :{unwatch():void}; + /** + * Called when the widget stops being "active" because + * focus moved to something outside of it, or the user + * clicked somewhere outside of it, or the widget was + * hidden. + * + */ + onBlur(): void; + /** + * Connect to this function to receive notifications of mouse click events. + * + * @param event mouse Event + */ + onClick(event: any): void; + /** + * Called when this widget is being displayed as a popup (ex: a Calendar popped + * up from a DateTextBox), and it is hidden. + * This is called from the dijit.popup code, and should not be called directly. + * + * Also used as a parameter for children of dijit/layout/StackContainer or subclasses. + * Callback if a user tries to close the child. Child will be closed if this function returns true. + * + */ + onClose(): boolean; + /** + * Connect to this function to receive notifications of mouse double click events. + * + * @param event mouse Event + */ + onDblClick(event: any): void; + /** + * Called when the widget becomes "active" because + * it or a widget inside of it either has focus, or has recently + * been clicked. + * + */ + onFocus(): void; + /** + * Called when another widget becomes the selected pane in a + * dijit/layout/TabContainer, dijit/layout/StackContainer, + * dijit/layout/AccordionContainer, etc. + * + * Also called to indicate hide of a dijit.Dialog, dijit.TooltipDialog, or dijit.TitlePane. + * + */ + onHide(): void; + /** + * Connect to this function to receive notifications of keys being pressed down. + * + * @param event key Event + */ + onKeyDown(event: any): void; + /** + * Connect to this function to receive notifications of printable keys being typed. + * + * @param event key Event + */ + onKeyPress(event: any): void; + /** + * Connect to this function to receive notifications of keys being released. + * + * @param event key Event + */ + onKeyUp(event: any): void; + /** + * Connect to this function to receive notifications of when the mouse button is pressed down. + * + * @param event mouse Event + */ + onMouseDown(event: any): void; + /** + * Connect to this function to receive notifications of when the mouse moves onto this widget. + * + * @param event mouse Event + */ + onMouseEnter(event: any): void; + /** + * Connect to this function to receive notifications of when the mouse moves off of this widget. + * + * @param event mouse Event + */ + onMouseLeave(event: any): void; + /** + * Connect to this function to receive notifications of when the mouse moves over nodes contained within this widget. + * + * @param event mouse Event + */ + onMouseMove(event: any): void; + /** + * Connect to this function to receive notifications of when the mouse moves off of nodes contained within this widget. + * + * @param event mouse Event + */ + onMouseOut(event: any): void; + /** + * Connect to this function to receive notifications of when the mouse moves onto nodes contained within this widget. + * + * @param event mouse Event + */ + onMouseOver(event: any): void; + /** + * Connect to this function to receive notifications of when the mouse button is released. + * + * @param event mouse Event + */ + onMouseUp(event: any): void; + /** + * Called when this widget becomes the selected pane in a + * dijit/layout/TabContainer, dijit/layout/StackContainer, + * dijit/layout/AccordionContainer, etc. + * + * Also called to indicate display of a dijit.Dialog, dijit.TooltipDialog, or dijit.TitlePane. + * + */ + onShow(): void; + } + /** + * Permalink: http://dojotoolkit.org/api/1.9/dijit/_TimePicker.html + * + * A time picker dropdown, used by dijit/form/TimeTextBox. + * This widget is not available as a standalone widget due to lack of accessibility support. + * + * @param params Hash of initialization parameters for widget, including scalar values (like title, duration etc.)and functions, typically callbacks like onClick.The hash can contain any of the widget's properties, excluding read-only properties. + * @param srcNodeRef OptionalIf a srcNodeRef (DOM node) is specified, replace srcNodeRef with my generated DOM tree + */ + class _TimePicker extends dijit._WidgetBase implements dijit.form._ListMouseMixin { + constructor(params?: Object, srcNodeRef?: HTMLElement); + /** + * Deprecated. Instead of attributeMap, widget should have a _setXXXAttr attribute + * for each XXX attribute to be mapped to the DOM. + * + * attributeMap sets up a "binding" between attributes (aka properties) + * of the widget and the widget's DOM. + * Changes to widget attributes listed in attributeMap will be + * reflected into the DOM. + * + * For example, calling set('title', 'hello') + * on a TitlePane will automatically cause the TitlePane's DOM to update + * with the new title. + * + * attributeMap is a hash where the key is an attribute of the widget, + * and the value reflects a binding to a: + * + * DOM node attribute + * focus: {node: "focusNode", type: "attribute"} + * Maps this.focus to this.focusNode.focus + * + * DOM node innerHTML + * title: { node: "titleNode", type: "innerHTML" } + * Maps this.title to this.titleNode.innerHTML + * + * DOM node innerText + * title: { node: "titleNode", type: "innerText" } + * Maps this.title to this.titleNode.innerText + * + * DOM node CSS class + * myClass: { node: "domNode", type: "class" } + * Maps this.myClass to this.domNode.className + * + * If the value is an array, then each element in the array matches one of the + * formats of the above list. + * + * There are also some shorthands for backwards compatibility: + * + * string --> { node: string, type: "attribute" }, for example: + * "focusNode" ---> { node: "focusNode", type: "attribute" } + * "" --> { node: "domNode", type: "attribute" } + * + */ + "attributeMap": Object; + set(property:"attributeMap", value: Object): void; + get(property:"attributeMap"): Object; + watch(property:"attributeMap", callback:{(property?:string, oldValue?:Object, newValue?: Object):void}) :{unwatch():void} + /** + * The root className to use for the various states of this widget + * + */ + "baseClass": string; + set(property:"baseClass", value: string): void; + get(property:"baseClass"): string; + watch(property:"baseClass", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * + */ + "class": string; + set(property:"class", value: string): void; + get(property:"class"): string; + watch(property:"class", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * ISO-8601 string representing the amount by which + * every clickable element in the time picker increases. + * Set in local time, without a time zone. + * Example: T00:15:00 creates 15 minute increments + * Must divide dijit/_TimePicker.visibleIncrement evenly + * + */ + "clickableIncrement": string; + set(property:"clickableIncrement", value: string): void; + get(property:"clickableIncrement"): string; + watch(property:"clickableIncrement", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * Specifies valid range of times (start time, end time) + * + */ + "constraints": Object; + set(property:"constraints", value: Object): void; + get(property:"constraints"): Object; + watch(property:"constraints", callback:{(property?:string, oldValue?:Object, newValue?: Object):void}) :{unwatch():void} + /** + * Designates where children of the source DOM node will be placed. + * "Children" in this case refers to both DOM nodes and widgets. + * For example, for myWidget: + * + *
+ * here's a plain DOM node + * and a widget + * and another plain DOM node + *
+ * containerNode would point to: + * + * here's a plain DOM node + * and a widget + * and another plain DOM node + * In templated widgets, "containerNode" is set via a + * data-dojo-attach-point assignment. + * + * containerNode must be defined for any widget that accepts innerHTML + * (like ContentPane or BorderContainer or even Button), and conversely + * is null for widgets that don't, like TextBox. + * + */ + "containerNode": HTMLElement; + set(property:"containerNode", value: HTMLElement): void; + get(property:"containerNode"): HTMLElement; + watch(property:"containerNode", callback:{(property?:string, oldValue?:HTMLElement, newValue?: HTMLElement):void}) :{unwatch():void} + /** + * Bi-directional support, as defined by the HTML DIR + * attribute. Either left-to-right "ltr" or right-to-left "rtl". If undefined, widgets renders in page's + * default direction. + * + */ + "dir": string; + set(property:"dir", value: string): void; + get(property:"dir"): string; + watch(property:"dir", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * This is our visible representation of the widget! Other DOM + * Nodes may by assigned to other properties, usually through the + * template system's data-dojo-attach-point syntax, but the domNode + * property is the canonical "top level" node in widget UI. + * + */ + "domNode": HTMLElement; + set(property:"domNode", value: HTMLElement): void; + get(property:"domNode"): HTMLElement; + watch(property:"domNode", callback:{(property?:string, oldValue?:HTMLElement, newValue?: HTMLElement):void}) :{unwatch():void} + /** + * The string to filter by + * + */ + "filterString": string; + set(property:"filterString", value: string): void; + get(property:"filterString"): string; + watch(property:"filterString", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * This widget or a widget it contains has focus, or is "active" because + * it was recently clicked. + * + */ + "focused": boolean; + set(property:"focused", value: boolean): void; + get(property:"focused"): boolean; + watch(property:"focused", callback:{(property?:string, oldValue?:boolean, newValue?: boolean):void}) :{unwatch():void} + /** + * A unique, opaque ID string that can be assigned by users or by the + * system. If the developer passes an ID which is known not to be + * unique, the specified ID is ignored and the system-generated ID is + * used instead. + * + */ + "id": string; + set(property:"id", value: string): void; + get(property:"id"): string; + watch(property:"id", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * Rarely used. Overrides the default Dojo locale used to render this widget, + * as defined by the HTML LANG attribute. + * Value must be among the list of locales specified during by the Dojo bootstrap, + * formatted according to RFC 3066 (like en-us). + * + */ + "lang": string; + set(property:"lang", value: string): void; + get(property:"lang"): string; + watch(property:"lang", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * The document this widget belongs to. If not specified to constructor, will default to + * srcNodeRef.ownerDocument, or if no sourceRef specified, then to the document global + * + */ + "ownerDocument": Object; + set(property:"ownerDocument", value: Object): void; + get(property:"ownerDocument"): Object; + watch(property:"ownerDocument", callback:{(property?:string, oldValue?:Object, newValue?: Object):void}) :{unwatch():void} + /** + * currently selected node + * + */ + "selected": HTMLElement; + set(property:"selected", value: HTMLElement): void; + get(property:"selected"): HTMLElement; + watch(property:"selected", callback:{(property?:string, oldValue?:HTMLElement, newValue?: HTMLElement):void}) :{unwatch():void} + /** + * pointer to original DOM node + * + */ + "srcNodeRef": HTMLElement; + set(property:"srcNodeRef", value: HTMLElement): void; + get(property:"srcNodeRef"): HTMLElement; + watch(property:"srcNodeRef", callback:{(property?:string, oldValue?:HTMLElement, newValue?: HTMLElement):void}) :{unwatch():void} + /** + * HTML style attributes as cssText string or name/value hash + * + */ + "style": string; + set(property:"style", value: string): void; + get(property:"style"): string; + watch(property:"style", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * HTML title attribute. + * + * For form widgets this specifies a tooltip to display when hovering over + * the widget (just like the native HTML title attribute). + * + * For TitlePane or for when this widget is a child of a TabContainer, AccordionContainer, + * etc., it's used to specify the tab label, accordion pane title, etc. In this case it's + * interpreted as HTML. + * + */ + "title": string; + set(property:"title", value: string): void; + get(property:"title"): string; + watch(property:"title", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * When this widget's title attribute is used to for a tab label, accordion pane title, etc., + * this specifies the tooltip to appear when the mouse is hovered over that text. + * + */ + "tooltip": string; + set(property:"tooltip", value: string): void; + get(property:"tooltip"): string; + watch(property:"tooltip", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * Date to display. + * Defaults to current time and date. + * Can be a Date object or an ISO-8601 string. + * If you specify the GMT time zone (-01:00), + * the time will be converted to the local time in the local time zone. + * Otherwise, the time is considered to be in the local time zone. + * If you specify the date and isDate is true, the date is used. + * Example: if your local time zone is GMT -05:00, + * T10:00:00 becomes T10:00:00-05:00 (considered to be local time), + * T10:00:00-01:00 becomes T06:00:00-05:00 (4 hour difference), + * T10:00:00Z becomes T05:00:00-05:00 (5 hour difference between Zulu and local time) + * yyyy-mm-ddThh:mm:ss is the format to set the date and time + * Example: 2007-06-01T09:00:00 + * + */ + "value": string; + set(property:"value", value: string): void; + get(property:"value"): string; + watch(property:"value", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * ISO-8601 string representing the amount by which + * every element with a visible time in the time picker increases. + * Set in local time, without a time zone. + * Example: T01:00:00 creates text in every 1 hour increment + * + */ + "visibleIncrement": string; + set(property:"visibleIncrement", value: string): void; + get(property:"visibleIncrement"): string; + watch(property:"visibleIncrement", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * + */ + buildRendering(): void; + /** + * Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead. + * + * Connects specified obj/event to specified method of this object + * and registers for disconnect() on widget destroy. + * + * Provide widget-specific analog to dojo.connect, except with the + * implicit use of this widget as the target object. + * Events connected with this.connect are disconnected upon + * destruction. + * + * @param obj + * @param event + * @param method + */ + connect(obj: Object, event: String, method: String): any; + /** + * Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead. + * + * Connects specified obj/event to specified method of this object + * and registers for disconnect() on widget destroy. + * + * Provide widget-specific analog to dojo.connect, except with the + * implicit use of this widget as the target object. + * Events connected with this.connect are disconnected upon + * destruction. + * + * @param obj + * @param event + * @param method + */ + connect(obj: any, event: String, method: String): any; + /** + * Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead. + * + * Connects specified obj/event to specified method of this object + * and registers for disconnect() on widget destroy. + * + * Provide widget-specific analog to dojo.connect, except with the + * implicit use of this widget as the target object. + * Events connected with this.connect are disconnected upon + * destruction. + * + * @param obj + * @param event + * @param method + */ + connect(obj: Object, event: Function, method: String): any; + /** + * Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead. + * + * Connects specified obj/event to specified method of this object + * and registers for disconnect() on widget destroy. + * + * Provide widget-specific analog to dojo.connect, except with the + * implicit use of this widget as the target object. + * Events connected with this.connect are disconnected upon + * destruction. + * + * @param obj + * @param event + * @param method + */ + connect(obj: any, event: Function, method: String): any; + /** + * Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead. + * + * Connects specified obj/event to specified method of this object + * and registers for disconnect() on widget destroy. + * + * Provide widget-specific analog to dojo.connect, except with the + * implicit use of this widget as the target object. + * Events connected with this.connect are disconnected upon + * destruction. + * + * @param obj + * @param event + * @param method + */ + connect(obj: Object, event: String, method: Function): any; + /** + * Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead. + * + * Connects specified obj/event to specified method of this object + * and registers for disconnect() on widget destroy. + * + * Provide widget-specific analog to dojo.connect, except with the + * implicit use of this widget as the target object. + * Events connected with this.connect are disconnected upon + * destruction. + * + * @param obj + * @param event + * @param method + */ + connect(obj: any, event: String, method: Function): any; + /** + * Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead. + * + * Connects specified obj/event to specified method of this object + * and registers for disconnect() on widget destroy. + * + * Provide widget-specific analog to dojo.connect, except with the + * implicit use of this widget as the target object. + * Events connected with this.connect are disconnected upon + * destruction. + * + * @param obj + * @param event + * @param method + */ + connect(obj: Object, event: Function, method: Function): any; + /** + * Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead. + * + * Connects specified obj/event to specified method of this object + * and registers for disconnect() on widget destroy. + * + * Provide widget-specific analog to dojo.connect, except with the + * implicit use of this widget as the target object. + * Events connected with this.connect are disconnected upon + * destruction. + * + * @param obj + * @param event + * @param method + */ + connect(obj: any, event: Function, method: Function): any; + /** + * Wrapper to setTimeout to avoid deferred functions executing + * after the originating widget has been destroyed. + * Returns an object handle with a remove method (that returns null) (replaces clearTimeout). + * + * @param fcn Function reference. + * @param delay OptionalDelay, defaults to 0. + */ + defer(fcn: Function, delay: number): Object; + /** + * Destroy this widget, but not its descendants. Descendants means widgets inside of + * this.containerNode. Will also destroy any resources (including widgets) registered via this.own(). + * + * This method will also destroy internal widgets such as those created from a template, + * assuming those widgets exist inside of this.domNode but outside of this.containerNode. + * + * For 2.0 it's planned that this method will also destroy descendant widgets, so apps should not + * depend on the current ability to destroy a widget without destroying its descendants. Generally + * they should use destroyRecursive() for widgets with children. + * + * @param preserveDom If true, this method will leave the original DOM structure alone.Note: This will not yet work with _TemplatedMixin widgets + */ + destroy(preserveDom?: boolean): void; + /** + * Recursively destroy the children of this widget and their + * descendants. + * + * @param preserveDom OptionalIf true, the preserveDom attribute is passed to all descendantwidget's .destroy() method. Not for use with _Templatedwidgets. + */ + destroyDescendants(preserveDom?: boolean): void; + /** + * Destroy this widget and its descendants + * This is the generic "destructor" function that all widget users + * should call to cleanly discard with a widget. Once a widget is + * destroyed, it is removed from the manager object. + * + * @param preserveDom OptionalIf true, this method will leave the original DOM structurealone of descendant Widgets. Note: This will NOT work withdijit._TemplatedMixin widgets. + */ + destroyRecursive(preserveDom?: boolean): void; + /** + * Destroys the DOM nodes associated with this widget. + * + * @param preserveDom OptionalIf true, this method will leave the original DOM structure aloneduring tear-down. Note: this will not work with _Templatedwidgets yet. + */ + destroyRendering(preserveDom?: boolean): void; + /** + * Deprecated, will be removed in 2.0, use handle.remove() instead. + * + * Disconnects handle created by connect. + * + * @param handle + */ + disconnect(handle: any): void; + /** + * Used by widgets to signal that a synthetic event occurred, ex: + * + * myWidget.emit("attrmodified-selectedChildWidget", {}). + * Emits an event on this.domNode named type.toLowerCase(), based on eventObj. + * Also calls onType() method, if present, and returns value from that method. + * By default passes eventObj to callback, but will pass callbackArgs instead, if specified. + * Modifies eventObj by adding missing parameters (bubbles, cancelable, widget). + * + * @param type + * @param eventObj Optional + * @param callbackArgs Optional + */ + emit(type: String, eventObj: Object, callbackArgs: any[]): any; + /** + * Get a property from a widget. + * Get a named property from a widget. The property may + * potentially be retrieved via a getter method. If no getter is defined, this + * just retrieves the object's property. + * + * For example, if the widget has properties foo and bar + * and a method named _getFooAttr(), calling: + * myWidget.get("foo") would be equivalent to calling + * widget._getFooAttr() and myWidget.get("bar") + * would be equivalent to the expression + * widget.bar2 + * + * @param name The property to get. + */ + get(name: any): any; + /** + * Returns all direct children of this widget, i.e. all widgets underneath this.containerNode whose parent + * is this widget. Note that it does not return all descendants, but rather just direct children. + * Analogous to Node.childNodes, + * except containing widgets rather than DOMNodes. + * + * The result intentionally excludes internally created widgets (a.k.a. supporting widgets) + * outside of this.containerNode. + * + * Note that the array returned is a simple array. Application code should not assume + * existence of methods like forEach(). + * + */ + getChildren(): any[]; + /** + * Returns the parent widget of this widget. + * + */ + getParent(): any; + /** + * Called from dijit/form/_DateTimeTextBox to pass a keypress event + * from the dijit/form/TimeTextBox to be handled in this widget + * + * @param e + */ + handleKey(e: Event): any; + /** + * May be overridden to disable certain dates in the TimePicker e.g. isDisabledDate=locale.isWeekend + * + * @param dateObject + * @param locale Optional + */ + isDisabledDate(dateObject: Date, locale: String): boolean; + /** + * Return true if this widget can currently be focused + * and false if not + * + */ + isFocusable(): any; + /** + * Return this widget's explicit or implicit orientation (true for LTR, false for RTL) + * + */ + isLeftToRight(): any; + /** + * Call specified function when event occurs, ex: myWidget.on("click", function(){ ... }). + * Call specified function when event type occurs, ex: myWidget.on("click", function(){ ... }). + * Note that the function is not run in any particular scope, so if (for example) you want it to run in the + * widget's scope you must do myWidget.on("click", lang.hitch(myWidget, func)). + * + * @param type Name of event (ex: "click") or extension event like touch.press. + * @param func + */ + on(type: String, func: Function): any; + /** + * Call specified function when event occurs, ex: myWidget.on("click", function(){ ... }). + * Call specified function when event type occurs, ex: myWidget.on("click", function(){ ... }). + * Note that the function is not run in any particular scope, so if (for example) you want it to run in the + * widget's scope you must do myWidget.on("click", lang.hitch(myWidget, func)). + * + * @param type Name of event (ex: "click") or extension event like touch.press. + * @param func + */ + on(type: Function, func: Function): any; + /** + * Track specified handles and remove/destroy them when this instance is destroyed, unless they were + * already removed/destroyed manually. + * + */ + own(): any; + /** + * Place this widget somewhere in the DOM based + * on standard domConstruct.place() conventions. + * A convenience function provided in all _Widgets, providing a simple + * shorthand mechanism to put an existing (or newly created) Widget + * somewhere in the dom, and allow chaining. + * + * @param reference Widget, DOMNode, or id of widget or DOMNode + * @param position OptionalIf reference is a widget (or id of widget), and that widget has an ".addChild" method,it will be called passing this widget instance into that method, supplying the optionalposition index passed. In this case position (if specified) should be an integer.If reference is a DOMNode (or id matching a DOMNode but not a widget),the position argument can be a numeric index or a string"first", "last", "before", or "after", same as dojo/dom-construct::place(). + */ + placeAt(reference: String, position: String): any; + /** + * Place this widget somewhere in the DOM based + * on standard domConstruct.place() conventions. + * A convenience function provided in all _Widgets, providing a simple + * shorthand mechanism to put an existing (or newly created) Widget + * somewhere in the dom, and allow chaining. + * + * @param reference Widget, DOMNode, or id of widget or DOMNode + * @param position OptionalIf reference is a widget (or id of widget), and that widget has an ".addChild" method,it will be called passing this widget instance into that method, supplying the optionalposition index passed. In this case position (if specified) should be an integer.If reference is a DOMNode (or id matching a DOMNode but not a widget),the position argument can be a numeric index or a string"first", "last", "before", or "after", same as dojo/dom-construct::place(). + */ + placeAt(reference: HTMLElement, position: String): any; + /** + * Place this widget somewhere in the DOM based + * on standard domConstruct.place() conventions. + * A convenience function provided in all _Widgets, providing a simple + * shorthand mechanism to put an existing (or newly created) Widget + * somewhere in the dom, and allow chaining. + * + * @param reference Widget, DOMNode, or id of widget or DOMNode + * @param position OptionalIf reference is a widget (or id of widget), and that widget has an ".addChild" method,it will be called passing this widget instance into that method, supplying the optionalposition index passed. In this case position (if specified) should be an integer.If reference is a DOMNode (or id matching a DOMNode but not a widget),the position argument can be a numeric index or a string"first", "last", "before", or "after", same as dojo/dom-construct::place(). + */ + placeAt(reference: dijit._WidgetBase, position: String): any; + /** + * Place this widget somewhere in the DOM based + * on standard domConstruct.place() conventions. + * A convenience function provided in all _Widgets, providing a simple + * shorthand mechanism to put an existing (or newly created) Widget + * somewhere in the dom, and allow chaining. + * + * @param reference Widget, DOMNode, or id of widget or DOMNode + * @param position OptionalIf reference is a widget (or id of widget), and that widget has an ".addChild" method,it will be called passing this widget instance into that method, supplying the optionalposition index passed. In this case position (if specified) should be an integer.If reference is a DOMNode (or id matching a DOMNode but not a widget),the position argument can be a numeric index or a string"first", "last", "before", or "after", same as dojo/dom-construct::place(). + */ + placeAt(reference: String, position: number): any; + /** + * Place this widget somewhere in the DOM based + * on standard domConstruct.place() conventions. + * A convenience function provided in all _Widgets, providing a simple + * shorthand mechanism to put an existing (or newly created) Widget + * somewhere in the dom, and allow chaining. + * + * @param reference Widget, DOMNode, or id of widget or DOMNode + * @param position OptionalIf reference is a widget (or id of widget), and that widget has an ".addChild" method,it will be called passing this widget instance into that method, supplying the optionalposition index passed. In this case position (if specified) should be an integer.If reference is a DOMNode (or id matching a DOMNode but not a widget),the position argument can be a numeric index or a string"first", "last", "before", or "after", same as dojo/dom-construct::place(). + */ + placeAt(reference: HTMLElement, position: number): any; + /** + * Place this widget somewhere in the DOM based + * on standard domConstruct.place() conventions. + * A convenience function provided in all _Widgets, providing a simple + * shorthand mechanism to put an existing (or newly created) Widget + * somewhere in the dom, and allow chaining. + * + * @param reference Widget, DOMNode, or id of widget or DOMNode + * @param position OptionalIf reference is a widget (or id of widget), and that widget has an ".addChild" method,it will be called passing this widget instance into that method, supplying the optionalposition index passed. In this case position (if specified) should be an integer.If reference is a DOMNode (or id matching a DOMNode but not a widget),the position argument can be a numeric index or a string"first", "last", "before", or "after", same as dojo/dom-construct::place(). + */ + placeAt(reference: dijit._WidgetBase, position: number): any; + /** + * Processing after the DOM fragment is created + * Called after the DOM fragment has been created, but not necessarily + * added to the document. Do not include any operations which rely on + * node dimensions or placement. + * + */ + postCreate(): void; + /** + * + */ + postMixInProperties(): void; + /** + * Select the first displayed item in the list. + * + */ + selectFirstNode(): void; + /** + * Select the last displayed item in the list + * + */ + selectLastNode(): void; + /** + * Select the item just below the current selection. + * If nothing selected, select first node. + * + */ + selectNextNode(): void; + /** + * Select the item just above the current selection. + * If nothing selected, select last node (if + * you select Previous and try to keep scrolling up the list). + * + */ + selectPreviousNode(): void; + /** + * Format a Date object as a string according a subset of the ISO-8601 standard + * When options.selector is omitted, output follows RFC3339 + * The local time zone is included as an offset from GMT, except when selector=='time' (time without a date) + * Does not check bounds. Only years between 100 and 9999 are supported. + * + * @param dateObject A Date object + * @param options OptionalAn object with the following properties:selector (String): "date" or "time" for partial formatting of the Date object.Both date and time will be formatted by default.zulu (Boolean): if true, UTC/GMT is used for a timezonemilliseconds (Boolean): if true, output milliseconds + */ + serialize(dateObject: Date, options: Object): any; + /** + * Set a property on a widget + * Sets named properties on a widget which may potentially be handled by a + * setter in the widget. + * + * For example, if the widget has properties foo and bar + * and a method named _setFooAttr(), calling + * myWidget.set("foo", "Howdy!") would be equivalent to calling + * widget._setFooAttr("Howdy!") and myWidget.set("bar", 3) + * would be equivalent to the statement widget.bar = 3; + * + * set() may also be called with a hash of name/value pairs, ex: + * + * myWidget.set({ + * foo: "Howdy", + * bar: 3 + * }); + * This is equivalent to calling set(foo, "Howdy") and set(bar, 3) + * + * @param name The property to set. + * @param value The value to set in the property. + */ + set(name: any, value: any): any; + /** + * Deprecated. Used set('value') instead. + * + * @param value + */ + setValue(value: Date): void; + /** + * Processing after the DOM fragment is added to the document + * Called after a widget and its children have been created and added to the page, + * and all related widgets have finished their create() cycle, up through postCreate(). + * + * Note that startup() may be called while the widget is still hidden, for example if the widget is + * inside a hidden dijit/Dialog or an unselected tab of a dijit/layout/TabContainer. + * For widgets that need to do layout, it's best to put that layout code inside resize(), and then + * extend dijit/layout/_LayoutWidget so that resize() is called when the widget is visible. + * + */ + startup(): void; + /** + * Deprecated, will be removed in 2.0, use this.own(topic.subscribe()) instead. + * + * Subscribes to the specified topic and calls the specified method + * of this object and registers for unsubscribe() on widget destroy. + * + * Provide widget-specific analog to dojo.subscribe, except with the + * implicit use of this widget as the target object. + * + * @param t The topic + * @param method The callback + */ + subscribe(t: String, method: Function): any; + /** + * Returns a string that represents the widget. + * When a widget is cast to a string, this method will be used to generate the + * output. Currently, it does not implement any sort of reversible + * serialization. + * + */ + toString(): String; + /** + * Deprecated. Override destroy() instead to implement custom widget tear-down + * behavior. + * + */ + uninitialize(): boolean; + /** + * Deprecated, will be removed in 2.0, use handle.remove() instead. + * + * Unsubscribes handle created by this.subscribe. + * Also removes handle from this widget's list of subscriptions + * + * @param handle + */ + unsubscribe(handle: Object): void; + /** + * Watches a property for changes + * + * @param name OptionalIndicates the property to watch. This is optional (the callback may be theonly parameter), and if omitted, all the properties will be watched + * @param callback The function to execute when the property changes. This will be called afterthe property has been changed. The callback will be called with the |this|set to the instance, the first argument as the name of the property, thesecond argument as the old value and the third argument as the new value. + */ + watch(property: string, callback:{(property?:string, oldValue?:any, newValue?: any):void}) :{unwatch():void}; + /** + * Called when the widget stops being "active" because + * focus moved to something outside of it, or the user + * clicked somewhere outside of it, or the widget was + * hidden. + * + */ + onBlur(): void; + /** + * Notification that a time was selected. It may be the same as the previous value. + * + * @param time + */ + onChange(time: Date): void; + /** + * + * @param node + */ + onClick(node: HTMLElement): void; + /** + * + * @param node + */ + onDeselect(node: HTMLElement): void; + /** + * Called when the widget becomes "active" because + * it or a widget inside of it either has focus, or has recently + * been clicked. + * + */ + onFocus(): void; + /** + * + * @param node + */ + onHover(node: HTMLElement): void; + /** + * + */ + onOpen(): void; + /** + * + * @param node + */ + onSelect(node: HTMLElement): void; + /** + * + * @param node + */ + onUnhover(node: HTMLElement): void; + } + module _TimePicker { + /** + * Permalink: http://dojotoolkit.org/api/1.9/dijit/_TimePicker.__Constraints.html + * + * + */ + class __Constraints { + constructor(); + /** + * override strings for am in times + * + */ + "am": string; + /** + * See dijit/_TimePicker.clickableIncrement + * + */ + "clickableIncrement": string; + /** + * override pattern with this string + * + */ + "datePattern": string; + /** + * choice of long, short, medium or full (plus any custom additions). Defaults to 'short' + * + */ + "formatLength": string; + /** + * (format only) use 4 digit years whenever 2 digit years are called for + * + */ + "fullYear": boolean; + /** + * override the locale used to determine formatting rules + * + */ + "locale": string; + /** + * override strings for pm in times + * + */ + "pm": string; + /** + * choice of 'time','date' (default: date and time) + * + */ + "selector": string; + /** + * (parse only) strict parsing, off by default + * + */ + "strict": boolean; + /** + * override pattern with this string + * + */ + "timePattern": string; + } + } + + /** + * Permalink: http://dojotoolkit.org/api/1.9/dijit/Destroyable.html + * + * Mixin to track handles and release them when instance is destroyed. + * Call this.own(...) on list of handles (returned from dojo/aspect, dojo/on, + * dojo/Stateful::watch, or any class (including widgets) with a destroyRecursive() or destroy() method. + * Then call destroy() later to destroy this instance and release the resources. + * + */ + class Destroyable { + constructor(); + /** + * Destroy this class, releasing any resources registered via own(). + * + * @param preserveDom + */ + destroy(preserveDom?: boolean): void; + /** + * Track specified handles and remove/destroy them when this instance is destroyed, unless they were + * already removed/destroyed manually. + * + */ + own(): any; + } + /** + * Permalink: http://dojotoolkit.org/api/1.9/dijit/CalendarLite.html + * + * Lightweight version of Calendar widget aimed towards mobile use + * A simple GUI for choosing a date in the context of a monthly calendar. + * This widget can't be used in a form because it doesn't serialize the date to an + * field. For a form element, use dijit/form/DateTextBox instead. + * + * Note that the parser takes all dates attributes passed in the + * RFC 3339 format, e.g. 2005-06-30T08:05:00-07:00 + * so that they are serializable and locale-independent. + * + * Also note that this widget isn't keyboard accessible; use dijit.Calendar for that + * + * @param params Hash of initialization parameters for widget, including scalar values (like title, duration etc.)and functions, typically callbacks like onClick.The hash can contain any of the widget's properties, excluding read-only properties. + * @param srcNodeRef OptionalIf a srcNodeRef (DOM node) is specified, replace srcNodeRef with my generated DOM tree + */ + class CalendarLite extends dijit._WidgetBase implements dijit._TemplatedMixin { + constructor(params?: Object, srcNodeRef?: HTMLElement); + /** + * Object to which attach points and events will be scoped. Defaults + * to 'this'. + * + */ + "attachScope": Object; + set(property:"attachScope", value: Object): void; + get(property:"attachScope"): Object; + watch(property:"attachScope", callback:{(property?:string, oldValue?:Object, newValue?: Object):void}) :{unwatch():void} + /** + * Deprecated. Instead of attributeMap, widget should have a _setXXXAttr attribute + * for each XXX attribute to be mapped to the DOM. + * + * attributeMap sets up a "binding" between attributes (aka properties) + * of the widget and the widget's DOM. + * Changes to widget attributes listed in attributeMap will be + * reflected into the DOM. + * + * For example, calling set('title', 'hello') + * on a TitlePane will automatically cause the TitlePane's DOM to update + * with the new title. + * + * attributeMap is a hash where the key is an attribute of the widget, + * and the value reflects a binding to a: + * + * DOM node attribute + * focus: {node: "focusNode", type: "attribute"} + * Maps this.focus to this.focusNode.focus + * + * DOM node innerHTML + * title: { node: "titleNode", type: "innerHTML" } + * Maps this.title to this.titleNode.innerHTML + * + * DOM node innerText + * title: { node: "titleNode", type: "innerText" } + * Maps this.title to this.titleNode.innerText + * + * DOM node CSS class + * myClass: { node: "domNode", type: "class" } + * Maps this.myClass to this.domNode.className + * + * If the value is an array, then each element in the array matches one of the + * formats of the above list. + * + * There are also some shorthands for backwards compatibility: + * + * string --> { node: string, type: "attribute" }, for example: + * "focusNode" ---> { node: "focusNode", type: "attribute" } + * "" --> { node: "domNode", type: "attribute" } + * + */ + "attributeMap": Object; + set(property:"attributeMap", value: Object): void; + get(property:"attributeMap"): Object; + watch(property:"attributeMap", callback:{(property?:string, oldValue?:Object, newValue?: Object):void}) :{unwatch():void} + /** + * + */ + "baseClass": string; + set(property:"baseClass", value: string): void; + get(property:"baseClass"): string; + watch(property:"baseClass", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * + */ + "class": string; + set(property:"class", value: string): void; + get(property:"class"): string; + watch(property:"class", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * Designates where children of the source DOM node will be placed. + * "Children" in this case refers to both DOM nodes and widgets. + * For example, for myWidget: + * + *
+ * here's a plain DOM node + * and a widget + * and another plain DOM node + *
+ * containerNode would point to: + * + * here's a plain DOM node + * and a widget + * and another plain DOM node + * In templated widgets, "containerNode" is set via a + * data-dojo-attach-point assignment. + * + * containerNode must be defined for any widget that accepts innerHTML + * (like ContentPane or BorderContainer or even Button), and conversely + * is null for widgets that don't, like TextBox. + * + */ + "containerNode": HTMLElement; + set(property:"containerNode", value: HTMLElement): void; + get(property:"containerNode"): HTMLElement; + watch(property:"containerNode", callback:{(property?:string, oldValue?:HTMLElement, newValue?: HTMLElement):void}) :{unwatch():void} + /** + * Date object containing the currently focused date, or the date which would be focused + * if the calendar itself was focused. Also indicates which year and month to display, + * i.e. the current "page" the calendar is on. + * + */ + "currentFocus": Date; + set(property:"currentFocus", value: Date): void; + get(property:"currentFocus"): Date; + watch(property:"currentFocus", callback:{(property?:string, oldValue?:Date, newValue?: Date):void}) :{unwatch():void} + /** + * JavaScript namespace to find calendar routines. If unspecified, uses Gregorian calendar routines + * at dojo/date and dojo/date/locale. + * + */ + "datePackage": string; + set(property:"datePackage", value: string): void; + get(property:"datePackage"): string; + watch(property:"datePackage", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * + */ + "dateTemplateString": string; + set(property:"dateTemplateString", value: string): void; + get(property:"dateTemplateString"): string; + watch(property:"dateTemplateString", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * How to represent the days of the week in the calendar header. See locale + * + */ + "dayWidth": string; + set(property:"dayWidth", value: string): void; + get(property:"dayWidth"): string; + watch(property:"dayWidth", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * Bi-directional support, as defined by the HTML DIR + * attribute. Either left-to-right "ltr" or right-to-left "rtl". If undefined, widgets renders in page's + * default direction. + * + */ + "dir": string; + set(property:"dir", value: string): void; + get(property:"dir"): string; + watch(property:"dir", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * This is our visible representation of the widget! Other DOM + * Nodes may by assigned to other properties, usually through the + * template system's data-dojo-attach-point syntax, but the domNode + * property is the canonical "top level" node in widget UI. + * + */ + "domNode": HTMLElement; + set(property:"domNode", value: HTMLElement): void; + get(property:"domNode"): HTMLElement; + watch(property:"domNode", callback:{(property?:string, oldValue?:HTMLElement, newValue?: HTMLElement):void}) :{unwatch():void} + /** + * + */ + "dowTemplateString": string; + set(property:"dowTemplateString", value: string): void; + get(property:"dowTemplateString"): string; + watch(property:"dowTemplateString", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * A unique, opaque ID string that can be assigned by users or by the + * system. If the developer passes an ID which is known not to be + * unique, the specified ID is ignored and the system-generated ID is + * used instead. + * + */ + "id": string; + set(property:"id", value: string): void; + get(property:"id"): string; + watch(property:"id", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * Rarely used. Overrides the default Dojo locale used to render this widget, + * as defined by the HTML LANG attribute. + * Value must be among the list of locales specified during by the Dojo bootstrap, + * formatted according to RFC 3066 (like en-us). + * + */ + "lang": string; + set(property:"lang", value: string): void; + get(property:"lang"): string; + watch(property:"lang", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * The document this widget belongs to. If not specified to constructor, will default to + * srcNodeRef.ownerDocument, or if no sourceRef specified, then to the document global + * + */ + "ownerDocument": Object; + set(property:"ownerDocument", value: Object): void; + get(property:"ownerDocument"): Object; + watch(property:"ownerDocument", callback:{(property?:string, oldValue?:Object, newValue?: Object):void}) :{unwatch():void} + /** + * + */ + "searchContainerNode": boolean; + set(property:"searchContainerNode", value: boolean): void; + get(property:"searchContainerNode"): boolean; + watch(property:"searchContainerNode", callback:{(property?:string, oldValue?:boolean, newValue?: boolean):void}) :{unwatch():void} + /** + * pointer to original DOM node + * + */ + "srcNodeRef": HTMLElement; + set(property:"srcNodeRef", value: HTMLElement): void; + get(property:"srcNodeRef"): HTMLElement; + watch(property:"srcNodeRef", callback:{(property?:string, oldValue?:HTMLElement, newValue?: HTMLElement):void}) :{unwatch():void} + /** + * HTML style attributes as cssText string or name/value hash + * + */ + "style": string; + set(property:"style", value: string): void; + get(property:"style"): string; + watch(property:"style", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * Order fields are traversed when user hits the tab key + * + */ + "tabIndex": string; + set(property:"tabIndex", value: string): void; + get(property:"tabIndex"): string; + watch(property:"tabIndex", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * Path to template (HTML file) for this widget relative to dojo.baseUrl. + * Deprecated: use templateString with require([... "dojo/text!..."], ...) instead + * + */ + "templatePath": string; + set(property:"templatePath", value: string): void; + get(property:"templatePath"): string; + watch(property:"templatePath", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * + */ + "templateString": string; + set(property:"templateString", value: string): void; + get(property:"templateString"): string; + watch(property:"templateString", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * HTML title attribute. + * + * For form widgets this specifies a tooltip to display when hovering over + * the widget (just like the native HTML title attribute). + * + * For TitlePane or for when this widget is a child of a TabContainer, AccordionContainer, + * etc., it's used to specify the tab label, accordion pane title, etc. In this case it's + * interpreted as HTML. + * + */ + "title": string; + set(property:"title", value: string): void; + get(property:"title"): string; + watch(property:"title", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * When this widget's title attribute is used to for a tab label, accordion pane title, etc., + * this specifies the tooltip to appear when the mouse is hovered over that text. + * + */ + "tooltip": string; + set(property:"tooltip", value: string): void; + get(property:"tooltip"): string; + watch(property:"tooltip", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * The currently selected Date, initially set to invalid date to indicate no selection. + * + */ + "value": Date; + set(property:"value", value: Date): void; + get(property:"value"): Date; + watch(property:"value", callback:{(property?:string, oldValue?:Date, newValue?: Date):void}) :{unwatch():void} + /** + * + */ + "weekTemplateString": string; + set(property:"weekTemplateString", value: string): void; + get(property:"weekTemplateString"): string; + watch(property:"weekTemplateString", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * + */ + buildRendering(): void; + /** + * Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead. + * + * Connects specified obj/event to specified method of this object + * and registers for disconnect() on widget destroy. + * + * Provide widget-specific analog to dojo.connect, except with the + * implicit use of this widget as the target object. + * Events connected with this.connect are disconnected upon + * destruction. + * + * @param obj + * @param event + * @param method + */ + connect(obj: Object, event: String, method: String): any; + /** + * Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead. + * + * Connects specified obj/event to specified method of this object + * and registers for disconnect() on widget destroy. + * + * Provide widget-specific analog to dojo.connect, except with the + * implicit use of this widget as the target object. + * Events connected with this.connect are disconnected upon + * destruction. + * + * @param obj + * @param event + * @param method + */ + connect(obj: any, event: String, method: String): any; + /** + * Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead. + * + * Connects specified obj/event to specified method of this object + * and registers for disconnect() on widget destroy. + * + * Provide widget-specific analog to dojo.connect, except with the + * implicit use of this widget as the target object. + * Events connected with this.connect are disconnected upon + * destruction. + * + * @param obj + * @param event + * @param method + */ + connect(obj: Object, event: Function, method: String): any; + /** + * Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead. + * + * Connects specified obj/event to specified method of this object + * and registers for disconnect() on widget destroy. + * + * Provide widget-specific analog to dojo.connect, except with the + * implicit use of this widget as the target object. + * Events connected with this.connect are disconnected upon + * destruction. + * + * @param obj + * @param event + * @param method + */ + connect(obj: any, event: Function, method: String): any; + /** + * Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead. + * + * Connects specified obj/event to specified method of this object + * and registers for disconnect() on widget destroy. + * + * Provide widget-specific analog to dojo.connect, except with the + * implicit use of this widget as the target object. + * Events connected with this.connect are disconnected upon + * destruction. + * + * @param obj + * @param event + * @param method + */ + connect(obj: Object, event: String, method: Function): any; + /** + * Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead. + * + * Connects specified obj/event to specified method of this object + * and registers for disconnect() on widget destroy. + * + * Provide widget-specific analog to dojo.connect, except with the + * implicit use of this widget as the target object. + * Events connected with this.connect are disconnected upon + * destruction. + * + * @param obj + * @param event + * @param method + */ + connect(obj: any, event: String, method: Function): any; + /** + * Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead. + * + * Connects specified obj/event to specified method of this object + * and registers for disconnect() on widget destroy. + * + * Provide widget-specific analog to dojo.connect, except with the + * implicit use of this widget as the target object. + * Events connected with this.connect are disconnected upon + * destruction. + * + * @param obj + * @param event + * @param method + */ + connect(obj: Object, event: Function, method: Function): any; + /** + * Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead. + * + * Connects specified obj/event to specified method of this object + * and registers for disconnect() on widget destroy. + * + * Provide widget-specific analog to dojo.connect, except with the + * implicit use of this widget as the target object. + * Events connected with this.connect are disconnected upon + * destruction. + * + * @param obj + * @param event + * @param method + */ + connect(obj: any, event: Function, method: Function): any; + /** + * Wrapper to setTimeout to avoid deferred functions executing + * after the originating widget has been destroyed. + * Returns an object handle with a remove method (that returns null) (replaces clearTimeout). + * + * @param fcn Function reference. + * @param delay OptionalDelay, defaults to 0. + */ + defer(fcn: Function, delay: number): Object; + /** + * Destroy this widget, but not its descendants. Descendants means widgets inside of + * this.containerNode. Will also destroy any resources (including widgets) registered via this.own(). + * + * This method will also destroy internal widgets such as those created from a template, + * assuming those widgets exist inside of this.domNode but outside of this.containerNode. + * + * For 2.0 it's planned that this method will also destroy descendant widgets, so apps should not + * depend on the current ability to destroy a widget without destroying its descendants. Generally + * they should use destroyRecursive() for widgets with children. + * + * @param preserveDom If true, this method will leave the original DOM structure alone.Note: This will not yet work with _TemplatedMixin widgets + */ + destroy(preserveDom?: boolean): void; + /** + * Recursively destroy the children of this widget and their + * descendants. + * + * @param preserveDom OptionalIf true, the preserveDom attribute is passed to all descendantwidget's .destroy() method. Not for use with _Templatedwidgets. + */ + destroyDescendants(preserveDom?: boolean): void; + /** + * Destroy this widget and its descendants + * This is the generic "destructor" function that all widget users + * should call to cleanly discard with a widget. Once a widget is + * destroyed, it is removed from the manager object. + * + * @param preserveDom OptionalIf true, this method will leave the original DOM structurealone of descendant Widgets. Note: This will NOT work withdijit._TemplatedMixin widgets. + */ + destroyRecursive(preserveDom?: boolean): void; + /** + * Destroys the DOM nodes associated with this widget. + * + * @param preserveDom OptionalIf true, this method will leave the original DOM structure aloneduring tear-down. Note: this will not work with _Templatedwidgets yet. + */ + destroyRendering(preserveDom?: boolean): void; + /** + * Deprecated, will be removed in 2.0, use handle.remove() instead. + * + * Disconnects handle created by connect. + * + * @param handle + */ + disconnect(handle: any): void; + /** + * Used by widgets to signal that a synthetic event occurred, ex: + * + * myWidget.emit("attrmodified-selectedChildWidget", {}). + * Emits an event on this.domNode named type.toLowerCase(), based on eventObj. + * Also calls onType() method, if present, and returns value from that method. + * By default passes eventObj to callback, but will pass callbackArgs instead, if specified. + * Modifies eventObj by adding missing parameters (bubbles, cancelable, widget). + * + * @param type + * @param eventObj Optional + * @param callbackArgs Optional + */ + emit(type: String, eventObj: Object, callbackArgs: any[]): any; + /** + * Focus the calendar by focusing one of the calendar cells + * + */ + focus(): void; + /** + * Get a property from a widget. + * Get a named property from a widget. The property may + * potentially be retrieved via a getter method. If no getter is defined, this + * just retrieves the object's property. + * + * For example, if the widget has properties foo and bar + * and a method named _getFooAttr(), calling: + * myWidget.get("foo") would be equivalent to calling + * widget._getFooAttr() and myWidget.get("bar") + * would be equivalent to the expression + * widget.bar2 + * + * @param name The property to get. + */ + get(name: any): any; + /** + * Returns all direct children of this widget, i.e. all widgets underneath this.containerNode whose parent + * is this widget. Note that it does not return all descendants, but rather just direct children. + * Analogous to Node.childNodes, + * except containing widgets rather than DOMNodes. + * + * The result intentionally excludes internally created widgets (a.k.a. supporting widgets) + * outside of this.containerNode. + * + * Note that the array returned is a simple array. Application code should not assume + * existence of methods like forEach(). + * + */ + getChildren(): any[]; + /** + * May be overridden to return CSS classes to associate with the date entry for the given dateObject, + * for example to indicate a holiday in specified locale. + * + * @param dateObject + * @param locale Optional + */ + getClassForDate(dateObject: Date, locale: String): String; + /** + * Returns the parent widget of this widget. + * + */ + getParent(): any; + /** + * Sets calendar's value to today's date + * + */ + goToToday(): void; + /** + * May be overridden to disable certain dates in the calendar e.g. isDisabledDate=dojo.date.locale.isWeekend + * + * @param dateObject + * @param locale Optional + */ + isDisabledDate(dateObject: Date, locale: String): boolean; + /** + * Return true if this widget can currently be focused + * and false if not + * + */ + isFocusable(): any; + /** + * Return this widget's explicit or implicit orientation (true for LTR, false for RTL) + * + */ + isLeftToRight(): any; + /** + * Call specified function when event occurs, ex: myWidget.on("click", function(){ ... }). + * Call specified function when event type occurs, ex: myWidget.on("click", function(){ ... }). + * Note that the function is not run in any particular scope, so if (for example) you want it to run in the + * widget's scope you must do myWidget.on("click", lang.hitch(myWidget, func)). + * + * @param type Name of event (ex: "click") or extension event like touch.press. + * @param func + */ + on(type: String, func: Function): any; + /** + * Call specified function when event occurs, ex: myWidget.on("click", function(){ ... }). + * Call specified function when event type occurs, ex: myWidget.on("click", function(){ ... }). + * Note that the function is not run in any particular scope, so if (for example) you want it to run in the + * widget's scope you must do myWidget.on("click", lang.hitch(myWidget, func)). + * + * @param type Name of event (ex: "click") or extension event like touch.press. + * @param func + */ + on(type: Function, func: Function): any; + /** + * Track specified handles and remove/destroy them when this instance is destroyed, unless they were + * already removed/destroyed manually. + * + */ + own(): any; + /** + * Place this widget somewhere in the DOM based + * on standard domConstruct.place() conventions. + * A convenience function provided in all _Widgets, providing a simple + * shorthand mechanism to put an existing (or newly created) Widget + * somewhere in the dom, and allow chaining. + * + * @param reference Widget, DOMNode, or id of widget or DOMNode + * @param position OptionalIf reference is a widget (or id of widget), and that widget has an ".addChild" method,it will be called passing this widget instance into that method, supplying the optionalposition index passed. In this case position (if specified) should be an integer.If reference is a DOMNode (or id matching a DOMNode but not a widget),the position argument can be a numeric index or a string"first", "last", "before", or "after", same as dojo/dom-construct::place(). + */ + placeAt(reference: String, position: String): any; + /** + * Place this widget somewhere in the DOM based + * on standard domConstruct.place() conventions. + * A convenience function provided in all _Widgets, providing a simple + * shorthand mechanism to put an existing (or newly created) Widget + * somewhere in the dom, and allow chaining. + * + * @param reference Widget, DOMNode, or id of widget or DOMNode + * @param position OptionalIf reference is a widget (or id of widget), and that widget has an ".addChild" method,it will be called passing this widget instance into that method, supplying the optionalposition index passed. In this case position (if specified) should be an integer.If reference is a DOMNode (or id matching a DOMNode but not a widget),the position argument can be a numeric index or a string"first", "last", "before", or "after", same as dojo/dom-construct::place(). + */ + placeAt(reference: HTMLElement, position: String): any; + /** + * Place this widget somewhere in the DOM based + * on standard domConstruct.place() conventions. + * A convenience function provided in all _Widgets, providing a simple + * shorthand mechanism to put an existing (or newly created) Widget + * somewhere in the dom, and allow chaining. + * + * @param reference Widget, DOMNode, or id of widget or DOMNode + * @param position OptionalIf reference is a widget (or id of widget), and that widget has an ".addChild" method,it will be called passing this widget instance into that method, supplying the optionalposition index passed. In this case position (if specified) should be an integer.If reference is a DOMNode (or id matching a DOMNode but not a widget),the position argument can be a numeric index or a string"first", "last", "before", or "after", same as dojo/dom-construct::place(). + */ + placeAt(reference: dijit._WidgetBase, position: String): any; + /** + * Place this widget somewhere in the DOM based + * on standard domConstruct.place() conventions. + * A convenience function provided in all _Widgets, providing a simple + * shorthand mechanism to put an existing (or newly created) Widget + * somewhere in the dom, and allow chaining. + * + * @param reference Widget, DOMNode, or id of widget or DOMNode + * @param position OptionalIf reference is a widget (or id of widget), and that widget has an ".addChild" method,it will be called passing this widget instance into that method, supplying the optionalposition index passed. In this case position (if specified) should be an integer.If reference is a DOMNode (or id matching a DOMNode but not a widget),the position argument can be a numeric index or a string"first", "last", "before", or "after", same as dojo/dom-construct::place(). + */ + placeAt(reference: String, position: number): any; + /** + * Place this widget somewhere in the DOM based + * on standard domConstruct.place() conventions. + * A convenience function provided in all _Widgets, providing a simple + * shorthand mechanism to put an existing (or newly created) Widget + * somewhere in the dom, and allow chaining. + * + * @param reference Widget, DOMNode, or id of widget or DOMNode + * @param position OptionalIf reference is a widget (or id of widget), and that widget has an ".addChild" method,it will be called passing this widget instance into that method, supplying the optionalposition index passed. In this case position (if specified) should be an integer.If reference is a DOMNode (or id matching a DOMNode but not a widget),the position argument can be a numeric index or a string"first", "last", "before", or "after", same as dojo/dom-construct::place(). + */ + placeAt(reference: HTMLElement, position: number): any; + /** + * Place this widget somewhere in the DOM based + * on standard domConstruct.place() conventions. + * A convenience function provided in all _Widgets, providing a simple + * shorthand mechanism to put an existing (or newly created) Widget + * somewhere in the dom, and allow chaining. + * + * @param reference Widget, DOMNode, or id of widget or DOMNode + * @param position OptionalIf reference is a widget (or id of widget), and that widget has an ".addChild" method,it will be called passing this widget instance into that method, supplying the optionalposition index passed. In this case position (if specified) should be an integer.If reference is a DOMNode (or id matching a DOMNode but not a widget),the position argument can be a numeric index or a string"first", "last", "before", or "after", same as dojo/dom-construct::place(). + */ + placeAt(reference: dijit._WidgetBase, position: number): any; + /** + * + */ + postCreate(): void; + /** + * Called after the parameters to the widget have been read-in, + * but before the widget template is instantiated. Especially + * useful to set properties that are referenced in the widget + * template. + * + */ + postMixInProperties(): void; + /** + * Set a property on a widget + * Sets named properties on a widget which may potentially be handled by a + * setter in the widget. + * + * For example, if the widget has properties foo and bar + * and a method named _setFooAttr(), calling + * myWidget.set("foo", "Howdy!") would be equivalent to calling + * widget._setFooAttr("Howdy!") and myWidget.set("bar", 3) + * would be equivalent to the statement widget.bar = 3; + * + * set() may also be called with a hash of name/value pairs, ex: + * + * myWidget.set({ + * foo: "Howdy", + * bar: 3 + * }); + * This is equivalent to calling set(foo, "Howdy") and set(bar, 3) + * + * @param name The property to set. + * @param value The value to set in the property. + */ + set(name: any, value: any): any; + /** + * Processing after the DOM fragment is added to the document + * Called after a widget and its children have been created and added to the page, + * and all related widgets have finished their create() cycle, up through postCreate(). + * + * Note that startup() may be called while the widget is still hidden, for example if the widget is + * inside a hidden dijit/Dialog or an unselected tab of a dijit/layout/TabContainer. + * For widgets that need to do layout, it's best to put that layout code inside resize(), and then + * extend dijit/layout/_LayoutWidget so that resize() is called when the widget is visible. + * + */ + startup(): void; + /** + * Deprecated, will be removed in 2.0, use this.own(topic.subscribe()) instead. + * + * Subscribes to the specified topic and calls the specified method + * of this object and registers for unsubscribe() on widget destroy. + * + * Provide widget-specific analog to dojo.subscribe, except with the + * implicit use of this widget as the target object. + * + * @param t The topic + * @param method The callback + */ + subscribe(t: String, method: Function): any; + /** + * Returns a string that represents the widget. + * When a widget is cast to a string, this method will be used to generate the + * output. Currently, it does not implement any sort of reversible + * serialization. + * + */ + toString(): String; + /** + * Deprecated. Override destroy() instead to implement custom widget tear-down + * behavior. + * + */ + uninitialize(): boolean; + /** + * Deprecated, will be removed in 2.0, use handle.remove() instead. + * + * Unsubscribes handle created by this.subscribe. + * Also removes handle from this widget's list of subscriptions + * + * @param handle + */ + unsubscribe(handle: Object): void; + /** + * Watches a property for changes + * + * @param name OptionalIndicates the property to watch. This is optional (the callback may be theonly parameter), and if omitted, all the properties will be watched + * @param callback The function to execute when the property changes. This will be called afterthe property has been changed. The callback will be called with the |this|set to the instance, the first argument as the name of the property, thesecond argument as the old value and the third argument as the new value. + */ + watch(property: string, callback:{(property?:string, oldValue?:any, newValue?: any):void}) :{unwatch():void}; + /** + * Static method to get a template based on the templatePath or + * templateString key + */ + getCachedTemplate(): any; + /** + * Called only when the selected date has changed + * + * @param date + */ + onChange(date: Date): void; + } + module CalendarLite { + /** + * Permalink: http://dojotoolkit.org/api/1.9/dijit/CalendarLite._MonthWidget.html + * + * Displays name of current month padded to the width of the month + * w/the longest name, so that changing months doesn't change width. + * + * Create as: + * + * new Calendar._MonthWidget({ + * lang: ..., + * dateLocaleModule: ... + * }) + * + * @param params Hash of initialization parameters for widget, including scalar values (like title, duration etc.)and functions, typically callbacks like onClick.The hash can contain any of the widget's properties, excluding read-only properties. + * @param srcNodeRef OptionalIf a srcNodeRef (DOM node) is specified:use srcNodeRef.innerHTML as my contentsif this is a behavioral widget then apply behavior to that srcNodeRefotherwise, replace srcNodeRef with my generated DOM tree + */ + class _MonthWidget extends dijit._WidgetBase { + constructor(params?: Object, srcNodeRef?: HTMLElement); + /** + * Deprecated. Instead of attributeMap, widget should have a _setXXXAttr attribute + * for each XXX attribute to be mapped to the DOM. + * + * attributeMap sets up a "binding" between attributes (aka properties) + * of the widget and the widget's DOM. + * Changes to widget attributes listed in attributeMap will be + * reflected into the DOM. + * + * For example, calling set('title', 'hello') + * on a TitlePane will automatically cause the TitlePane's DOM to update + * with the new title. + * + * attributeMap is a hash where the key is an attribute of the widget, + * and the value reflects a binding to a: + * + * DOM node attribute + * focus: {node: "focusNode", type: "attribute"} + * Maps this.focus to this.focusNode.focus + * + * DOM node innerHTML + * title: { node: "titleNode", type: "innerHTML" } + * Maps this.title to this.titleNode.innerHTML + * + * DOM node innerText + * title: { node: "titleNode", type: "innerText" } + * Maps this.title to this.titleNode.innerText + * + * DOM node CSS class + * myClass: { node: "domNode", type: "class" } + * Maps this.myClass to this.domNode.className + * + * If the value is an array, then each element in the array matches one of the + * formats of the above list. + * + * There are also some shorthands for backwards compatibility: + * + * string --> { node: string, type: "attribute" }, for example: + * "focusNode" ---> { node: "focusNode", type: "attribute" } + * "" --> { node: "domNode", type: "attribute" } + * + */ + "attributeMap": Object; + set(property:"attributeMap", value: Object): void; + get(property:"attributeMap"): Object; + watch(property:"attributeMap", callback:{(property?:string, oldValue?:Object, newValue?: Object):void}) :{unwatch():void} + /** + * Root CSS class of the widget (ex: dijitTextBox), used to construct CSS classes to indicate + * widget state. + * + */ + "baseClass": string; + set(property:"baseClass", value: string): void; + get(property:"baseClass"): string; + watch(property:"baseClass", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * + */ + "class": string; + set(property:"class", value: string): void; + get(property:"class"): string; + watch(property:"class", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * Designates where children of the source DOM node will be placed. + * "Children" in this case refers to both DOM nodes and widgets. + * For example, for myWidget: + * + *
+ * here's a plain DOM node + * and a widget + * and another plain DOM node + *
+ * containerNode would point to: + * + * here's a plain DOM node + * and a widget + * and another plain DOM node + * In templated widgets, "containerNode" is set via a + * data-dojo-attach-point assignment. + * + * containerNode must be defined for any widget that accepts innerHTML + * (like ContentPane or BorderContainer or even Button), and conversely + * is null for widgets that don't, like TextBox. + * + */ + "containerNode": HTMLElement; + set(property:"containerNode", value: HTMLElement): void; + get(property:"containerNode"): HTMLElement; + watch(property:"containerNode", callback:{(property?:string, oldValue?:HTMLElement, newValue?: HTMLElement):void}) :{unwatch():void} + /** + * Bi-directional support, as defined by the HTML DIR + * attribute. Either left-to-right "ltr" or right-to-left "rtl". If undefined, widgets renders in page's + * default direction. + * + */ + "dir": string; + set(property:"dir", value: string): void; + get(property:"dir"): string; + watch(property:"dir", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * This is our visible representation of the widget! Other DOM + * Nodes may by assigned to other properties, usually through the + * template system's data-dojo-attach-point syntax, but the domNode + * property is the canonical "top level" node in widget UI. + * + */ + "domNode": HTMLElement; + set(property:"domNode", value: HTMLElement): void; + get(property:"domNode"): HTMLElement; + watch(property:"domNode", callback:{(property?:string, oldValue?:HTMLElement, newValue?: HTMLElement):void}) :{unwatch():void} + /** + * A unique, opaque ID string that can be assigned by users or by the + * system. If the developer passes an ID which is known not to be + * unique, the specified ID is ignored and the system-generated ID is + * used instead. + * + */ + "id": string; + set(property:"id", value: string): void; + get(property:"id"): string; + watch(property:"id", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * Rarely used. Overrides the default Dojo locale used to render this widget, + * as defined by the HTML LANG attribute. + * Value must be among the list of locales specified during by the Dojo bootstrap, + * formatted according to RFC 3066 (like en-us). + * + */ + "lang": string; + set(property:"lang", value: string): void; + get(property:"lang"): string; + watch(property:"lang", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * The document this widget belongs to. If not specified to constructor, will default to + * srcNodeRef.ownerDocument, or if no sourceRef specified, then to the document global + * + */ + "ownerDocument": Object; + set(property:"ownerDocument", value: Object): void; + get(property:"ownerDocument"): Object; + watch(property:"ownerDocument", callback:{(property?:string, oldValue?:Object, newValue?: Object):void}) :{unwatch():void} + /** + * pointer to original DOM node + * + */ + "srcNodeRef": HTMLElement; + set(property:"srcNodeRef", value: HTMLElement): void; + get(property:"srcNodeRef"): HTMLElement; + watch(property:"srcNodeRef", callback:{(property?:string, oldValue?:HTMLElement, newValue?: HTMLElement):void}) :{unwatch():void} + /** + * HTML style attributes as cssText string or name/value hash + * + */ + "style": string; + set(property:"style", value: string): void; + get(property:"style"): string; + watch(property:"style", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * HTML title attribute. + * + * For form widgets this specifies a tooltip to display when hovering over + * the widget (just like the native HTML title attribute). + * + * For TitlePane or for when this widget is a child of a TabContainer, AccordionContainer, + * etc., it's used to specify the tab label, accordion pane title, etc. In this case it's + * interpreted as HTML. + * + */ + "title": string; + set(property:"title", value: string): void; + get(property:"title"): string; + watch(property:"title", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * When this widget's title attribute is used to for a tab label, accordion pane title, etc., + * this specifies the tooltip to appear when the mouse is hovered over that text. + * + */ + "tooltip": string; + set(property:"tooltip", value: string): void; + get(property:"tooltip"): string; + watch(property:"tooltip", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * Construct the UI for this widget, setting this.domNode. + * Most widgets will mixin dijit._TemplatedMixin, which implements this method. + * + */ + buildRendering(): void; + /** + * Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead. + * + * Connects specified obj/event to specified method of this object + * and registers for disconnect() on widget destroy. + * + * Provide widget-specific analog to dojo.connect, except with the + * implicit use of this widget as the target object. + * Events connected with this.connect are disconnected upon + * destruction. + * + * @param obj + * @param event + * @param method + */ + connect(obj: Object, event: String, method: String): any; + /** + * Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead. + * + * Connects specified obj/event to specified method of this object + * and registers for disconnect() on widget destroy. + * + * Provide widget-specific analog to dojo.connect, except with the + * implicit use of this widget as the target object. + * Events connected with this.connect are disconnected upon + * destruction. + * + * @param obj + * @param event + * @param method + */ + connect(obj: any, event: String, method: String): any; + /** + * Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead. + * + * Connects specified obj/event to specified method of this object + * and registers for disconnect() on widget destroy. + * + * Provide widget-specific analog to dojo.connect, except with the + * implicit use of this widget as the target object. + * Events connected with this.connect are disconnected upon + * destruction. + * + * @param obj + * @param event + * @param method + */ + connect(obj: Object, event: Function, method: String): any; + /** + * Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead. + * + * Connects specified obj/event to specified method of this object + * and registers for disconnect() on widget destroy. + * + * Provide widget-specific analog to dojo.connect, except with the + * implicit use of this widget as the target object. + * Events connected with this.connect are disconnected upon + * destruction. + * + * @param obj + * @param event + * @param method + */ + connect(obj: any, event: Function, method: String): any; + /** + * Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead. + * + * Connects specified obj/event to specified method of this object + * and registers for disconnect() on widget destroy. + * + * Provide widget-specific analog to dojo.connect, except with the + * implicit use of this widget as the target object. + * Events connected with this.connect are disconnected upon + * destruction. + * + * @param obj + * @param event + * @param method + */ + connect(obj: Object, event: String, method: Function): any; + /** + * Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead. + * + * Connects specified obj/event to specified method of this object + * and registers for disconnect() on widget destroy. + * + * Provide widget-specific analog to dojo.connect, except with the + * implicit use of this widget as the target object. + * Events connected with this.connect are disconnected upon + * destruction. + * + * @param obj + * @param event + * @param method + */ + connect(obj: any, event: String, method: Function): any; + /** + * Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead. + * + * Connects specified obj/event to specified method of this object + * and registers for disconnect() on widget destroy. + * + * Provide widget-specific analog to dojo.connect, except with the + * implicit use of this widget as the target object. + * Events connected with this.connect are disconnected upon + * destruction. + * + * @param obj + * @param event + * @param method + */ + connect(obj: Object, event: Function, method: Function): any; + /** + * Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead. + * + * Connects specified obj/event to specified method of this object + * and registers for disconnect() on widget destroy. + * + * Provide widget-specific analog to dojo.connect, except with the + * implicit use of this widget as the target object. + * Events connected with this.connect are disconnected upon + * destruction. + * + * @param obj + * @param event + * @param method + */ + connect(obj: any, event: Function, method: Function): any; + /** + * Wrapper to setTimeout to avoid deferred functions executing + * after the originating widget has been destroyed. + * Returns an object handle with a remove method (that returns null) (replaces clearTimeout). + * + * @param fcn Function reference. + * @param delay OptionalDelay, defaults to 0. + */ + defer(fcn: Function, delay: number): Object; + /** + * Destroy this widget, but not its descendants. Descendants means widgets inside of + * this.containerNode. Will also destroy any resources (including widgets) registered via this.own(). + * + * This method will also destroy internal widgets such as those created from a template, + * assuming those widgets exist inside of this.domNode but outside of this.containerNode. + * + * For 2.0 it's planned that this method will also destroy descendant widgets, so apps should not + * depend on the current ability to destroy a widget without destroying its descendants. Generally + * they should use destroyRecursive() for widgets with children. + * + * @param preserveDom If true, this method will leave the original DOM structure alone.Note: This will not yet work with _TemplatedMixin widgets + */ + destroy(preserveDom?: boolean): void; + /** + * Recursively destroy the children of this widget and their + * descendants. + * + * @param preserveDom OptionalIf true, the preserveDom attribute is passed to all descendantwidget's .destroy() method. Not for use with _Templatedwidgets. + */ + destroyDescendants(preserveDom?: boolean): void; + /** + * Destroy this widget and its descendants + * This is the generic "destructor" function that all widget users + * should call to cleanly discard with a widget. Once a widget is + * destroyed, it is removed from the manager object. + * + * @param preserveDom OptionalIf true, this method will leave the original DOM structurealone of descendant Widgets. Note: This will NOT work withdijit._TemplatedMixin widgets. + */ + destroyRecursive(preserveDom?: boolean): void; + /** + * Destroys the DOM nodes associated with this widget. + * + * @param preserveDom OptionalIf true, this method will leave the original DOM structure aloneduring tear-down. Note: this will not work with _Templatedwidgets yet. + */ + destroyRendering(preserveDom?: boolean): void; + /** + * Deprecated, will be removed in 2.0, use handle.remove() instead. + * + * Disconnects handle created by connect. + * + * @param handle + */ + disconnect(handle: any): void; + /** + * Used by widgets to signal that a synthetic event occurred, ex: + * + * myWidget.emit("attrmodified-selectedChildWidget", {}). + * Emits an event on this.domNode named type.toLowerCase(), based on eventObj. + * Also calls onType() method, if present, and returns value from that method. + * By default passes eventObj to callback, but will pass callbackArgs instead, if specified. + * Modifies eventObj by adding missing parameters (bubbles, cancelable, widget). + * + * @param type + * @param eventObj Optional + * @param callbackArgs Optional + */ + emit(type: String, eventObj: Object, callbackArgs: any[]): any; + /** + * Get a property from a widget. + * Get a named property from a widget. The property may + * potentially be retrieved via a getter method. If no getter is defined, this + * just retrieves the object's property. + * + * For example, if the widget has properties foo and bar + * and a method named _getFooAttr(), calling: + * myWidget.get("foo") would be equivalent to calling + * widget._getFooAttr() and myWidget.get("bar") + * would be equivalent to the expression + * widget.bar2 + * + * @param name The property to get. + */ + get(name: any): any; + /** + * Returns all direct children of this widget, i.e. all widgets underneath this.containerNode whose parent + * is this widget. Note that it does not return all descendants, but rather just direct children. + * Analogous to Node.childNodes, + * except containing widgets rather than DOMNodes. + * + * The result intentionally excludes internally created widgets (a.k.a. supporting widgets) + * outside of this.containerNode. + * + * Note that the array returned is a simple array. Application code should not assume + * existence of methods like forEach(). + * + */ + getChildren(): any[]; + /** + * Returns the parent widget of this widget. + * + */ + getParent(): any; + /** + * Return true if this widget can currently be focused + * and false if not + * + */ + isFocusable(): any; + /** + * Return this widget's explicit or implicit orientation (true for LTR, false for RTL) + * + */ + isLeftToRight(): any; + /** + * Call specified function when event occurs, ex: myWidget.on("click", function(){ ... }). + * Call specified function when event type occurs, ex: myWidget.on("click", function(){ ... }). + * Note that the function is not run in any particular scope, so if (for example) you want it to run in the + * widget's scope you must do myWidget.on("click", lang.hitch(myWidget, func)). + * + * @param type Name of event (ex: "click") or extension event like touch.press. + * @param func + */ + on(type: String, func: Function): any; + /** + * Call specified function when event occurs, ex: myWidget.on("click", function(){ ... }). + * Call specified function when event type occurs, ex: myWidget.on("click", function(){ ... }). + * Note that the function is not run in any particular scope, so if (for example) you want it to run in the + * widget's scope you must do myWidget.on("click", lang.hitch(myWidget, func)). + * + * @param type Name of event (ex: "click") or extension event like touch.press. + * @param func + */ + on(type: Function, func: Function): any; + /** + * Track specified handles and remove/destroy them when this instance is destroyed, unless they were + * already removed/destroyed manually. + * + */ + own(): any; + /** + * Place this widget somewhere in the DOM based + * on standard domConstruct.place() conventions. + * A convenience function provided in all _Widgets, providing a simple + * shorthand mechanism to put an existing (or newly created) Widget + * somewhere in the dom, and allow chaining. + * + * @param reference Widget, DOMNode, or id of widget or DOMNode + * @param position OptionalIf reference is a widget (or id of widget), and that widget has an ".addChild" method,it will be called passing this widget instance into that method, supplying the optionalposition index passed. In this case position (if specified) should be an integer.If reference is a DOMNode (or id matching a DOMNode but not a widget),the position argument can be a numeric index or a string"first", "last", "before", or "after", same as dojo/dom-construct::place(). + */ + placeAt(reference: String, position: String): any; + /** + * Place this widget somewhere in the DOM based + * on standard domConstruct.place() conventions. + * A convenience function provided in all _Widgets, providing a simple + * shorthand mechanism to put an existing (or newly created) Widget + * somewhere in the dom, and allow chaining. + * + * @param reference Widget, DOMNode, or id of widget or DOMNode + * @param position OptionalIf reference is a widget (or id of widget), and that widget has an ".addChild" method,it will be called passing this widget instance into that method, supplying the optionalposition index passed. In this case position (if specified) should be an integer.If reference is a DOMNode (or id matching a DOMNode but not a widget),the position argument can be a numeric index or a string"first", "last", "before", or "after", same as dojo/dom-construct::place(). + */ + placeAt(reference: HTMLElement, position: String): any; + /** + * Place this widget somewhere in the DOM based + * on standard domConstruct.place() conventions. + * A convenience function provided in all _Widgets, providing a simple + * shorthand mechanism to put an existing (or newly created) Widget + * somewhere in the dom, and allow chaining. + * + * @param reference Widget, DOMNode, or id of widget or DOMNode + * @param position OptionalIf reference is a widget (or id of widget), and that widget has an ".addChild" method,it will be called passing this widget instance into that method, supplying the optionalposition index passed. In this case position (if specified) should be an integer.If reference is a DOMNode (or id matching a DOMNode but not a widget),the position argument can be a numeric index or a string"first", "last", "before", or "after", same as dojo/dom-construct::place(). + */ + placeAt(reference: dijit._WidgetBase, position: String): any; + /** + * Place this widget somewhere in the DOM based + * on standard domConstruct.place() conventions. + * A convenience function provided in all _Widgets, providing a simple + * shorthand mechanism to put an existing (or newly created) Widget + * somewhere in the dom, and allow chaining. + * + * @param reference Widget, DOMNode, or id of widget or DOMNode + * @param position OptionalIf reference is a widget (or id of widget), and that widget has an ".addChild" method,it will be called passing this widget instance into that method, supplying the optionalposition index passed. In this case position (if specified) should be an integer.If reference is a DOMNode (or id matching a DOMNode but not a widget),the position argument can be a numeric index or a string"first", "last", "before", or "after", same as dojo/dom-construct::place(). + */ + placeAt(reference: String, position: number): any; + /** + * Place this widget somewhere in the DOM based + * on standard domConstruct.place() conventions. + * A convenience function provided in all _Widgets, providing a simple + * shorthand mechanism to put an existing (or newly created) Widget + * somewhere in the dom, and allow chaining. + * + * @param reference Widget, DOMNode, or id of widget or DOMNode + * @param position OptionalIf reference is a widget (or id of widget), and that widget has an ".addChild" method,it will be called passing this widget instance into that method, supplying the optionalposition index passed. In this case position (if specified) should be an integer.If reference is a DOMNode (or id matching a DOMNode but not a widget),the position argument can be a numeric index or a string"first", "last", "before", or "after", same as dojo/dom-construct::place(). + */ + placeAt(reference: HTMLElement, position: number): any; + /** + * Place this widget somewhere in the DOM based + * on standard domConstruct.place() conventions. + * A convenience function provided in all _Widgets, providing a simple + * shorthand mechanism to put an existing (or newly created) Widget + * somewhere in the dom, and allow chaining. + * + * @param reference Widget, DOMNode, or id of widget or DOMNode + * @param position OptionalIf reference is a widget (or id of widget), and that widget has an ".addChild" method,it will be called passing this widget instance into that method, supplying the optionalposition index passed. In this case position (if specified) should be an integer.If reference is a DOMNode (or id matching a DOMNode but not a widget),the position argument can be a numeric index or a string"first", "last", "before", or "after", same as dojo/dom-construct::place(). + */ + placeAt(reference: dijit._WidgetBase, position: number): any; + /** + * Processing after the DOM fragment is created + * Called after the DOM fragment has been created, but not necessarily + * added to the document. Do not include any operations which rely on + * node dimensions or placement. + * + */ + postCreate(): void; + /** + * Called after the parameters to the widget have been read-in, + * but before the widget template is instantiated. Especially + * useful to set properties that are referenced in the widget + * template. + * + */ + postMixInProperties(): void; + /** + * Set a property on a widget + * Sets named properties on a widget which may potentially be handled by a + * setter in the widget. + * + * For example, if the widget has properties foo and bar + * and a method named _setFooAttr(), calling + * myWidget.set("foo", "Howdy!") would be equivalent to calling + * widget._setFooAttr("Howdy!") and myWidget.set("bar", 3) + * would be equivalent to the statement widget.bar = 3; + * + * set() may also be called with a hash of name/value pairs, ex: + * + * myWidget.set({ + * foo: "Howdy", + * bar: 3 + * }); + * This is equivalent to calling set(foo, "Howdy") and set(bar, 3) + * + * @param name The property to set. + * @param value The value to set in the property. + */ + set(name: any, value: any): any; + /** + * Processing after the DOM fragment is added to the document + * Called after a widget and its children have been created and added to the page, + * and all related widgets have finished their create() cycle, up through postCreate(). + * + * Note that startup() may be called while the widget is still hidden, for example if the widget is + * inside a hidden dijit/Dialog or an unselected tab of a dijit/layout/TabContainer. + * For widgets that need to do layout, it's best to put that layout code inside resize(), and then + * extend dijit/layout/_LayoutWidget so that resize() is called when the widget is visible. + * + */ + startup(): void; + /** + * Deprecated, will be removed in 2.0, use this.own(topic.subscribe()) instead. + * + * Subscribes to the specified topic and calls the specified method + * of this object and registers for unsubscribe() on widget destroy. + * + * Provide widget-specific analog to dojo.subscribe, except with the + * implicit use of this widget as the target object. + * + * @param t The topic + * @param method The callback + */ + subscribe(t: String, method: Function): any; + /** + * Returns a string that represents the widget. + * When a widget is cast to a string, this method will be used to generate the + * output. Currently, it does not implement any sort of reversible + * serialization. + * + */ + toString(): String; + /** + * Deprecated. Override destroy() instead to implement custom widget tear-down + * behavior. + * + */ + uninitialize(): boolean; + /** + * Deprecated, will be removed in 2.0, use handle.remove() instead. + * + * Unsubscribes handle created by this.subscribe. + * Also removes handle from this widget's list of subscriptions + * + * @param handle + */ + unsubscribe(handle: Object): void; + /** + * Watches a property for changes + * + * @param name OptionalIndicates the property to watch. This is optional (the callback may be theonly parameter), and if omitted, all the properties will be watched + * @param callback The function to execute when the property changes. This will be called afterthe property has been changed. The callback will be called with the |this|set to the instance, the first argument as the name of the property, thesecond argument as the old value and the third argument as the new value. + */ + watch(property: string, callback:{(property?:string, oldValue?:any, newValue?: any):void}) :{unwatch():void}; + } + } + + /** + * Permalink: http://dojotoolkit.org/api/1.9/dijit/Declaration.html + * + * The Declaration widget allows a developer to declare new widget + * classes directly from a snippet of markup. + * + * @param params Hash of initialization parameters for widget, including scalar values (like title, duration etc.)and functions, typically callbacks like onClick.The hash can contain any of the widget's properties, excluding read-only properties. + * @param srcNodeRef OptionalIf a srcNodeRef (DOM node) is specified:use srcNodeRef.innerHTML as my contentsif this is a behavioral widget then apply behavior to that srcNodeRefotherwise, replace srcNodeRef with my generated DOM tree + */ + class Declaration extends dijit._Widget { + constructor(params?: Object, srcNodeRef?: HTMLElement); + /** + * Deprecated. Instead of attributeMap, widget should have a _setXXXAttr attribute + * for each XXX attribute to be mapped to the DOM. + * + * attributeMap sets up a "binding" between attributes (aka properties) + * of the widget and the widget's DOM. + * Changes to widget attributes listed in attributeMap will be + * reflected into the DOM. + * + * For example, calling set('title', 'hello') + * on a TitlePane will automatically cause the TitlePane's DOM to update + * with the new title. + * + * attributeMap is a hash where the key is an attribute of the widget, + * and the value reflects a binding to a: + * + * DOM node attribute + * focus: {node: "focusNode", type: "attribute"} + * Maps this.focus to this.focusNode.focus + * + * DOM node innerHTML + * title: { node: "titleNode", type: "innerHTML" } + * Maps this.title to this.titleNode.innerHTML + * + * DOM node innerText + * title: { node: "titleNode", type: "innerText" } + * Maps this.title to this.titleNode.innerText + * + * DOM node CSS class + * myClass: { node: "domNode", type: "class" } + * Maps this.myClass to this.domNode.className + * + * If the value is an array, then each element in the array matches one of the + * formats of the above list. + * + * There are also some shorthands for backwards compatibility: + * + * string --> { node: string, type: "attribute" }, for example: + * "focusNode" ---> { node: "focusNode", type: "attribute" } + * "" --> { node: "domNode", type: "attribute" } + * + */ + "attributeMap": Object; + set(property:"attributeMap", value: Object): void; + get(property:"attributeMap"): Object; + watch(property:"attributeMap", callback:{(property?:string, oldValue?:Object, newValue?: Object):void}) :{unwatch():void} + /** + * Root CSS class of the widget (ex: dijitTextBox), used to construct CSS classes to indicate + * widget state. + * + */ + "baseClass": string; + set(property:"baseClass", value: string): void; + get(property:"baseClass"): string; + watch(property:"baseClass", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * + */ + "class": string; + set(property:"class", value: string): void; + get(property:"class"): string; + watch(property:"class", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * Designates where children of the source DOM node will be placed. + * "Children" in this case refers to both DOM nodes and widgets. + * For example, for myWidget: + * + *
+ * here's a plain DOM node + * and a widget + * and another plain DOM node + *
+ * containerNode would point to: + * + * here's a plain DOM node + * and a widget + * and another plain DOM node + * In templated widgets, "containerNode" is set via a + * data-dojo-attach-point assignment. + * + * containerNode must be defined for any widget that accepts innerHTML + * (like ContentPane or BorderContainer or even Button), and conversely + * is null for widgets that don't, like TextBox. + * + */ + "containerNode": HTMLElement; + set(property:"containerNode", value: HTMLElement): void; + get(property:"containerNode"): HTMLElement; + watch(property:"containerNode", callback:{(property?:string, oldValue?:HTMLElement, newValue?: HTMLElement):void}) :{unwatch():void} + /** + * + */ + "defaults": Object; + set(property:"defaults", value: Object): void; + get(property:"defaults"): Object; + watch(property:"defaults", callback:{(property?:string, oldValue?:Object, newValue?: Object):void}) :{unwatch():void} + /** + * Bi-directional support, as defined by the HTML DIR + * attribute. Either left-to-right "ltr" or right-to-left "rtl". If undefined, widgets renders in page's + * default direction. + * + */ + "dir": string; + set(property:"dir", value: string): void; + get(property:"dir"): string; + watch(property:"dir", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * This is our visible representation of the widget! Other DOM + * Nodes may by assigned to other properties, usually through the + * template system's data-dojo-attach-point syntax, but the domNode + * property is the canonical "top level" node in widget UI. + * + */ + "domNode": HTMLElement; + set(property:"domNode", value: HTMLElement): void; + get(property:"domNode"): HTMLElement; + watch(property:"domNode", callback:{(property?:string, oldValue?:HTMLElement, newValue?: HTMLElement):void}) :{unwatch():void} + /** + * This widget or a widget it contains has focus, or is "active" because + * it was recently clicked. + * + */ + "focused": boolean; + set(property:"focused", value: boolean): void; + get(property:"focused"): boolean; + watch(property:"focused", callback:{(property?:string, oldValue?:boolean, newValue?: boolean):void}) :{unwatch():void} + /** + * A unique, opaque ID string that can be assigned by users or by the + * system. If the developer passes an ID which is known not to be + * unique, the specified ID is ignored and the system-generated ID is + * used instead. + * + */ + "id": string; + set(property:"id", value: string): void; + get(property:"id"): string; + watch(property:"id", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * Rarely used. Overrides the default Dojo locale used to render this widget, + * as defined by the HTML LANG attribute. + * Value must be among the list of locales specified during by the Dojo bootstrap, + * formatted according to RFC 3066 (like en-us). + * + */ + "lang": string; + set(property:"lang", value: string): void; + get(property:"lang"): string; + watch(property:"lang", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * List containing the prototype for this widget, and also any mixins, + * ex: ["dijit._Widget", "dijit._Container"] + * + */ + "mixins": Object; + set(property:"mixins", value: Object): void; + get(property:"mixins"): Object; + watch(property:"mixins", callback:{(property?:string, oldValue?:Object, newValue?: Object):void}) :{unwatch():void} + /** + * The document this widget belongs to. If not specified to constructor, will default to + * srcNodeRef.ownerDocument, or if no sourceRef specified, then to the document global + * + */ + "ownerDocument": Object; + set(property:"ownerDocument", value: Object): void; + get(property:"ownerDocument"): Object; + watch(property:"ownerDocument", callback:{(property?:string, oldValue?:Object, newValue?: Object):void}) :{unwatch():void} + /** + * pointer to original DOM node + * + */ + "srcNodeRef": HTMLElement; + set(property:"srcNodeRef", value: HTMLElement): void; + get(property:"srcNodeRef"): HTMLElement; + watch(property:"srcNodeRef", callback:{(property?:string, oldValue?:HTMLElement, newValue?: HTMLElement):void}) :{unwatch():void} + /** + * HTML style attributes as cssText string or name/value hash + * + */ + "style": string; + set(property:"style", value: string): void; + get(property:"style"): string; + watch(property:"style", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * HTML title attribute. + * + * For form widgets this specifies a tooltip to display when hovering over + * the widget (just like the native HTML title attribute). + * + * For TitlePane or for when this widget is a child of a TabContainer, AccordionContainer, + * etc., it's used to specify the tab label, accordion pane title, etc. In this case it's + * interpreted as HTML. + * + */ + "title": string; + set(property:"title", value: string): void; + get(property:"title"): string; + watch(property:"title", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * When this widget's title attribute is used to for a tab label, accordion pane title, etc., + * this specifies the tooltip to appear when the mouse is hovered over that text. + * + */ + "tooltip": string; + set(property:"tooltip", value: string): void; + get(property:"tooltip"): string; + watch(property:"tooltip", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * Name of class being declared, ex: "acme.myWidget" + * + */ + "widgetClass": string; + set(property:"widgetClass", value: string): void; + get(property:"widgetClass"): string; + watch(property:"widgetClass", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * This method is deprecated, use get() or set() directly. + * + * @param name The property to get or set. If an object is passed here and nota string, its keys are used as names of attributes to be setand the value of the object as values to set in the widget. + * @param value OptionalOptional. If provided, attr() operates as a setter. If omitted,the current value of the named property is returned. + */ + attr(name: String, value: Object): any; + /** + * This method is deprecated, use get() or set() directly. + * + * @param name The property to get or set. If an object is passed here and nota string, its keys are used as names of attributes to be setand the value of the object as values to set in the widget. + * @param value OptionalOptional. If provided, attr() operates as a setter. If omitted,the current value of the named property is returned. + */ + attr(name: Object, value: Object): any; + /** + * + */ + buildRendering(): void; + /** + * Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead. + * + * Connects specified obj/event to specified method of this object + * and registers for disconnect() on widget destroy. + * + * Provide widget-specific analog to dojo.connect, except with the + * implicit use of this widget as the target object. + * Events connected with this.connect are disconnected upon + * destruction. + * + * @param obj + * @param event + * @param method + */ + connect(obj: Object, event: String, method: String): any; + /** + * Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead. + * + * Connects specified obj/event to specified method of this object + * and registers for disconnect() on widget destroy. + * + * Provide widget-specific analog to dojo.connect, except with the + * implicit use of this widget as the target object. + * Events connected with this.connect are disconnected upon + * destruction. + * + * @param obj + * @param event + * @param method + */ + connect(obj: any, event: String, method: String): any; + /** + * Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead. + * + * Connects specified obj/event to specified method of this object + * and registers for disconnect() on widget destroy. + * + * Provide widget-specific analog to dojo.connect, except with the + * implicit use of this widget as the target object. + * Events connected with this.connect are disconnected upon + * destruction. + * + * @param obj + * @param event + * @param method + */ + connect(obj: Object, event: Function, method: String): any; + /** + * Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead. + * + * Connects specified obj/event to specified method of this object + * and registers for disconnect() on widget destroy. + * + * Provide widget-specific analog to dojo.connect, except with the + * implicit use of this widget as the target object. + * Events connected with this.connect are disconnected upon + * destruction. + * + * @param obj + * @param event + * @param method + */ + connect(obj: any, event: Function, method: String): any; + /** + * Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead. + * + * Connects specified obj/event to specified method of this object + * and registers for disconnect() on widget destroy. + * + * Provide widget-specific analog to dojo.connect, except with the + * implicit use of this widget as the target object. + * Events connected with this.connect are disconnected upon + * destruction. + * + * @param obj + * @param event + * @param method + */ + connect(obj: Object, event: String, method: Function): any; + /** + * Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead. + * + * Connects specified obj/event to specified method of this object + * and registers for disconnect() on widget destroy. + * + * Provide widget-specific analog to dojo.connect, except with the + * implicit use of this widget as the target object. + * Events connected with this.connect are disconnected upon + * destruction. + * + * @param obj + * @param event + * @param method + */ + connect(obj: any, event: String, method: Function): any; + /** + * Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead. + * + * Connects specified obj/event to specified method of this object + * and registers for disconnect() on widget destroy. + * + * Provide widget-specific analog to dojo.connect, except with the + * implicit use of this widget as the target object. + * Events connected with this.connect are disconnected upon + * destruction. + * + * @param obj + * @param event + * @param method + */ + connect(obj: Object, event: Function, method: Function): any; + /** + * Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead. + * + * Connects specified obj/event to specified method of this object + * and registers for disconnect() on widget destroy. + * + * Provide widget-specific analog to dojo.connect, except with the + * implicit use of this widget as the target object. + * Events connected with this.connect are disconnected upon + * destruction. + * + * @param obj + * @param event + * @param method + */ + connect(obj: any, event: Function, method: Function): any; + /** + * Wrapper to setTimeout to avoid deferred functions executing + * after the originating widget has been destroyed. + * Returns an object handle with a remove method (that returns null) (replaces clearTimeout). + * + * @param fcn Function reference. + * @param delay OptionalDelay, defaults to 0. + */ + defer(fcn: Function, delay: number): Object; + /** + * Destroy this widget, but not its descendants. Descendants means widgets inside of + * this.containerNode. Will also destroy any resources (including widgets) registered via this.own(). + * + * This method will also destroy internal widgets such as those created from a template, + * assuming those widgets exist inside of this.domNode but outside of this.containerNode. + * + * For 2.0 it's planned that this method will also destroy descendant widgets, so apps should not + * depend on the current ability to destroy a widget without destroying its descendants. Generally + * they should use destroyRecursive() for widgets with children. + * + * @param preserveDom If true, this method will leave the original DOM structure alone.Note: This will not yet work with _TemplatedMixin widgets + */ + destroy(preserveDom?: boolean): void; + /** + * Recursively destroy the children of this widget and their + * descendants. + * + * @param preserveDom OptionalIf true, the preserveDom attribute is passed to all descendantwidget's .destroy() method. Not for use with _Templatedwidgets. + */ + destroyDescendants(preserveDom?: boolean): void; + /** + * Destroy this widget and its descendants + * This is the generic "destructor" function that all widget users + * should call to cleanly discard with a widget. Once a widget is + * destroyed, it is removed from the manager object. + * + * @param preserveDom OptionalIf true, this method will leave the original DOM structurealone of descendant Widgets. Note: This will NOT work withdijit._TemplatedMixin widgets. + */ + destroyRecursive(preserveDom?: boolean): void; + /** + * Destroys the DOM nodes associated with this widget. + * + * @param preserveDom OptionalIf true, this method will leave the original DOM structure aloneduring tear-down. Note: this will not work with _Templatedwidgets yet. + */ + destroyRendering(preserveDom?: boolean): void; + /** + * Deprecated, will be removed in 2.0, use handle.remove() instead. + * + * Disconnects handle created by connect. + * + * @param handle + */ + disconnect(handle: any): void; + /** + * Used by widgets to signal that a synthetic event occurred, ex: + * + * myWidget.emit("attrmodified-selectedChildWidget", {}). + * Emits an event on this.domNode named type.toLowerCase(), based on eventObj. + * Also calls onType() method, if present, and returns value from that method. + * By default passes eventObj to callback, but will pass callbackArgs instead, if specified. + * Modifies eventObj by adding missing parameters (bubbles, cancelable, widget). + * + * @param type + * @param eventObj Optional + * @param callbackArgs Optional + */ + emit(type: String, eventObj: Object, callbackArgs: any[]): any; + /** + * Get a property from a widget. + * Get a named property from a widget. The property may + * potentially be retrieved via a getter method. If no getter is defined, this + * just retrieves the object's property. + * + * For example, if the widget has properties foo and bar + * and a method named _getFooAttr(), calling: + * myWidget.get("foo") would be equivalent to calling + * widget._getFooAttr() and myWidget.get("bar") + * would be equivalent to the expression + * widget.bar2 + * + * @param name The property to get. + */ + get(name: any): any; + /** + * Returns all direct children of this widget, i.e. all widgets underneath this.containerNode whose parent + * is this widget. Note that it does not return all descendants, but rather just direct children. + * Analogous to Node.childNodes, + * except containing widgets rather than DOMNodes. + * + * The result intentionally excludes internally created widgets (a.k.a. supporting widgets) + * outside of this.containerNode. + * + * Note that the array returned is a simple array. Application code should not assume + * existence of methods like forEach(). + * + */ + getChildren(): any[]; + /** + * Returns all the widgets contained by this, i.e., all widgets underneath this.containerNode. + * This method should generally be avoided as it returns widgets declared in templates, which are + * supposed to be internal/hidden, but it's left here for back-compat reasons. + * + */ + getDescendants(): any[]; + /** + * Returns the parent widget of this widget. + * + */ + getParent(): any; + /** + * Return true if this widget can currently be focused + * and false if not + * + */ + isFocusable(): any; + /** + * Return this widget's explicit or implicit orientation (true for LTR, false for RTL) + * + */ + isLeftToRight(): any; + /** + * + * @param type protected + * @param func + */ + on(type: String, func: Function): any; + /** + * + * @param type protected + * @param func + */ + on(type: Function, func: Function): any; + /** + * Track specified handles and remove/destroy them when this instance is destroyed, unless they were + * already removed/destroyed manually. + * + */ + own(): any; + /** + * Place this widget somewhere in the DOM based + * on standard domConstruct.place() conventions. + * A convenience function provided in all _Widgets, providing a simple + * shorthand mechanism to put an existing (or newly created) Widget + * somewhere in the dom, and allow chaining. + * + * @param reference Widget, DOMNode, or id of widget or DOMNode + * @param position OptionalIf reference is a widget (or id of widget), and that widget has an ".addChild" method,it will be called passing this widget instance into that method, supplying the optionalposition index passed. In this case position (if specified) should be an integer.If reference is a DOMNode (or id matching a DOMNode but not a widget),the position argument can be a numeric index or a string"first", "last", "before", or "after", same as dojo/dom-construct::place(). + */ + placeAt(reference: String, position: String): any; + /** + * Place this widget somewhere in the DOM based + * on standard domConstruct.place() conventions. + * A convenience function provided in all _Widgets, providing a simple + * shorthand mechanism to put an existing (or newly created) Widget + * somewhere in the dom, and allow chaining. + * + * @param reference Widget, DOMNode, or id of widget or DOMNode + * @param position OptionalIf reference is a widget (or id of widget), and that widget has an ".addChild" method,it will be called passing this widget instance into that method, supplying the optionalposition index passed. In this case position (if specified) should be an integer.If reference is a DOMNode (or id matching a DOMNode but not a widget),the position argument can be a numeric index or a string"first", "last", "before", or "after", same as dojo/dom-construct::place(). + */ + placeAt(reference: HTMLElement, position: String): any; + /** + * Place this widget somewhere in the DOM based + * on standard domConstruct.place() conventions. + * A convenience function provided in all _Widgets, providing a simple + * shorthand mechanism to put an existing (or newly created) Widget + * somewhere in the dom, and allow chaining. + * + * @param reference Widget, DOMNode, or id of widget or DOMNode + * @param position OptionalIf reference is a widget (or id of widget), and that widget has an ".addChild" method,it will be called passing this widget instance into that method, supplying the optionalposition index passed. In this case position (if specified) should be an integer.If reference is a DOMNode (or id matching a DOMNode but not a widget),the position argument can be a numeric index or a string"first", "last", "before", or "after", same as dojo/dom-construct::place(). + */ + placeAt(reference: dijit._WidgetBase, position: String): any; + /** + * Place this widget somewhere in the DOM based + * on standard domConstruct.place() conventions. + * A convenience function provided in all _Widgets, providing a simple + * shorthand mechanism to put an existing (or newly created) Widget + * somewhere in the dom, and allow chaining. + * + * @param reference Widget, DOMNode, or id of widget or DOMNode + * @param position OptionalIf reference is a widget (or id of widget), and that widget has an ".addChild" method,it will be called passing this widget instance into that method, supplying the optionalposition index passed. In this case position (if specified) should be an integer.If reference is a DOMNode (or id matching a DOMNode but not a widget),the position argument can be a numeric index or a string"first", "last", "before", or "after", same as dojo/dom-construct::place(). + */ + placeAt(reference: String, position: number): any; + /** + * Place this widget somewhere in the DOM based + * on standard domConstruct.place() conventions. + * A convenience function provided in all _Widgets, providing a simple + * shorthand mechanism to put an existing (or newly created) Widget + * somewhere in the dom, and allow chaining. + * + * @param reference Widget, DOMNode, or id of widget or DOMNode + * @param position OptionalIf reference is a widget (or id of widget), and that widget has an ".addChild" method,it will be called passing this widget instance into that method, supplying the optionalposition index passed. In this case position (if specified) should be an integer.If reference is a DOMNode (or id matching a DOMNode but not a widget),the position argument can be a numeric index or a string"first", "last", "before", or "after", same as dojo/dom-construct::place(). + */ + placeAt(reference: HTMLElement, position: number): any; + /** + * Place this widget somewhere in the DOM based + * on standard domConstruct.place() conventions. + * A convenience function provided in all _Widgets, providing a simple + * shorthand mechanism to put an existing (or newly created) Widget + * somewhere in the dom, and allow chaining. + * + * @param reference Widget, DOMNode, or id of widget or DOMNode + * @param position OptionalIf reference is a widget (or id of widget), and that widget has an ".addChild" method,it will be called passing this widget instance into that method, supplying the optionalposition index passed. In this case position (if specified) should be an integer.If reference is a DOMNode (or id matching a DOMNode but not a widget),the position argument can be a numeric index or a string"first", "last", "before", or "after", same as dojo/dom-construct::place(). + */ + placeAt(reference: dijit._WidgetBase, position: number): any; + /** + * + */ + postCreate(): void; + /** + * Called after the parameters to the widget have been read-in, + * but before the widget template is instantiated. Especially + * useful to set properties that are referenced in the widget + * template. + * + */ + postMixInProperties(): void; + /** + * Set a property on a widget + * Sets named properties on a widget which may potentially be handled by a + * setter in the widget. + * + * For example, if the widget has properties foo and bar + * and a method named _setFooAttr(), calling + * myWidget.set("foo", "Howdy!") would be equivalent to calling + * widget._setFooAttr("Howdy!") and myWidget.set("bar", 3) + * would be equivalent to the statement widget.bar = 3; + * + * set() may also be called with a hash of name/value pairs, ex: + * + * myWidget.set({ + * foo: "Howdy", + * bar: 3 + * }); + * This is equivalent to calling set(foo, "Howdy") and set(bar, 3) + * + * @param name The property to set. + * @param value The value to set in the property. + */ + set(name: any, value: any): any; + /** + * Deprecated. Use set() instead. + * + * @param attr + * @param value + */ + setAttribute(attr: String, value: any): void; + /** + * Processing after the DOM fragment is added to the document + * Called after a widget and its children have been created and added to the page, + * and all related widgets have finished their create() cycle, up through postCreate(). + * + * Note that startup() may be called while the widget is still hidden, for example if the widget is + * inside a hidden dijit/Dialog or an unselected tab of a dijit/layout/TabContainer. + * For widgets that need to do layout, it's best to put that layout code inside resize(), and then + * extend dijit/layout/_LayoutWidget so that resize() is called when the widget is visible. + * + */ + startup(): void; + /** + * Deprecated, will be removed in 2.0, use this.own(topic.subscribe()) instead. + * + * Subscribes to the specified topic and calls the specified method + * of this object and registers for unsubscribe() on widget destroy. + * + * Provide widget-specific analog to dojo.subscribe, except with the + * implicit use of this widget as the target object. + * + * @param t The topic + * @param method The callback + */ + subscribe(t: String, method: Function): any; + /** + * Returns a string that represents the widget. + * When a widget is cast to a string, this method will be used to generate the + * output. Currently, it does not implement any sort of reversible + * serialization. + * + */ + toString(): String; + /** + * Deprecated. Override destroy() instead to implement custom widget tear-down + * behavior. + * + */ + uninitialize(): boolean; + /** + * Deprecated, will be removed in 2.0, use handle.remove() instead. + * + * Unsubscribes handle created by this.subscribe. + * Also removes handle from this widget's list of subscriptions + * + * @param handle + */ + unsubscribe(handle: Object): void; + /** + * Watches a property for changes + * + * @param name OptionalIndicates the property to watch. This is optional (the callback may be theonly parameter), and if omitted, all the properties will be watched + * @param callback The function to execute when the property changes. This will be called afterthe property has been changed. The callback will be called with the |this|set to the instance, the first argument as the name of the property, thesecond argument as the old value and the third argument as the new value. + */ + watch(property: string, callback:{(property?:string, oldValue?:any, newValue?: any):void}) :{unwatch():void}; + /** + * Called when the widget stops being "active" because + * focus moved to something outside of it, or the user + * clicked somewhere outside of it, or the widget was + * hidden. + * + */ + onBlur(): void; + /** + * Connect to this function to receive notifications of mouse click events. + * + * @param event mouse Event + */ + onClick(event: any): void; + /** + * Called when this widget is being displayed as a popup (ex: a Calendar popped + * up from a DateTextBox), and it is hidden. + * This is called from the dijit.popup code, and should not be called directly. + * + * Also used as a parameter for children of dijit/layout/StackContainer or subclasses. + * Callback if a user tries to close the child. Child will be closed if this function returns true. + * + */ + onClose(): boolean; + /** + * Connect to this function to receive notifications of mouse double click events. + * + * @param event mouse Event + */ + onDblClick(event: any): void; + /** + * Called when the widget becomes "active" because + * it or a widget inside of it either has focus, or has recently + * been clicked. + * + */ + onFocus(): void; + /** + * Called when another widget becomes the selected pane in a + * dijit/layout/TabContainer, dijit/layout/StackContainer, + * dijit/layout/AccordionContainer, etc. + * + * Also called to indicate hide of a dijit.Dialog, dijit.TooltipDialog, or dijit.TitlePane. + * + */ + onHide(): void; + /** + * Connect to this function to receive notifications of keys being pressed down. + * + * @param event key Event + */ + onKeyDown(event: any): void; + /** + * Connect to this function to receive notifications of printable keys being typed. + * + * @param event key Event + */ + onKeyPress(event: any): void; + /** + * Connect to this function to receive notifications of keys being released. + * + * @param event key Event + */ + onKeyUp(event: any): void; + /** + * Connect to this function to receive notifications of when the mouse button is pressed down. + * + * @param event mouse Event + */ + onMouseDown(event: any): void; + /** + * Connect to this function to receive notifications of when the mouse moves onto this widget. + * + * @param event mouse Event + */ + onMouseEnter(event: any): void; + /** + * Connect to this function to receive notifications of when the mouse moves off of this widget. + * + * @param event mouse Event + */ + onMouseLeave(event: any): void; + /** + * Connect to this function to receive notifications of when the mouse moves over nodes contained within this widget. + * + * @param event mouse Event + */ + onMouseMove(event: any): void; + /** + * Connect to this function to receive notifications of when the mouse moves off of nodes contained within this widget. + * + * @param event mouse Event + */ + onMouseOut(event: any): void; + /** + * Connect to this function to receive notifications of when the mouse moves onto nodes contained within this widget. + * + * @param event mouse Event + */ + onMouseOver(event: any): void; + /** + * Connect to this function to receive notifications of when the mouse button is released. + * + * @param event mouse Event + */ + onMouseUp(event: any): void; + /** + * Called when this widget becomes the selected pane in a + * dijit/layout/TabContainer, dijit/layout/StackContainer, + * dijit/layout/AccordionContainer, etc. + * + * Also called to indicate display of a dijit.Dialog, dijit.TooltipDialog, or dijit.TitlePane. + * + */ + onShow(): void; + } + /** + * Permalink: http://dojotoolkit.org/api/1.9/dijit/Calendar.html + * + * A simple GUI for choosing a date in the context of a monthly calendar. + * See CalendarLite for general description. Calendar extends CalendarLite, adding: + * + * month drop down list + * keyboard navigation + * CSS classes for hover/mousepress on date, month, and year nodes + * support of deprecated methods (will be removed in 2.0) + * + * @param params Hash of initialization parameters for widget, including scalar values (like title, duration etc.)and functions, typically callbacks like onClick.The hash can contain any of the widget's properties, excluding read-only properties. + * @param srcNodeRef OptionalIf a srcNodeRef (DOM node) is specified, replace srcNodeRef with my generated DOM tree + */ + class Calendar extends dijit.CalendarLite implements dijit._Widget, dijit._CssStateMixin { + constructor(params?: Object, srcNodeRef?: HTMLElement); + /** + * Custom press, release, and click synthetic events + * which trigger on a left mouse click, touch, or space/enter keyup. + * + */ + "a11yclick": Object; + /** + * True if mouse was pressed while over this widget, and hasn't been released yet + * + */ + "active": boolean; + set(property:"active", value: boolean): void; + get(property:"active"): boolean; + watch(property:"active", callback:{(property?:string, oldValue?:boolean, newValue?: boolean):void}) :{unwatch():void} + /** + * Object to which attach points and events will be scoped. Defaults + * to 'this'. + * + */ + "attachScope": Object; + set(property:"attachScope", value: Object): void; + get(property:"attachScope"): Object; + watch(property:"attachScope", callback:{(property?:string, oldValue?:Object, newValue?: Object):void}) :{unwatch():void} + /** + * Deprecated. Instead of attributeMap, widget should have a _setXXXAttr attribute + * for each XXX attribute to be mapped to the DOM. + * + * attributeMap sets up a "binding" between attributes (aka properties) + * of the widget and the widget's DOM. + * Changes to widget attributes listed in attributeMap will be + * reflected into the DOM. + * + * For example, calling set('title', 'hello') + * on a TitlePane will automatically cause the TitlePane's DOM to update + * with the new title. + * + * attributeMap is a hash where the key is an attribute of the widget, + * and the value reflects a binding to a: + * + * DOM node attribute + * focus: {node: "focusNode", type: "attribute"} + * Maps this.focus to this.focusNode.focus + * + * DOM node innerHTML + * title: { node: "titleNode", type: "innerHTML" } + * Maps this.title to this.titleNode.innerHTML + * + * DOM node innerText + * title: { node: "titleNode", type: "innerText" } + * Maps this.title to this.titleNode.innerText + * + * DOM node CSS class + * myClass: { node: "domNode", type: "class" } + * Maps this.myClass to this.domNode.className + * + * If the value is an array, then each element in the array matches one of the + * formats of the above list. + * + * There are also some shorthands for backwards compatibility: + * + * string --> { node: string, type: "attribute" }, for example: + * "focusNode" ---> { node: "focusNode", type: "attribute" } + * "" --> { node: "domNode", type: "attribute" } + * + */ + "attributeMap": Object; + set(property:"attributeMap", value: Object): void; + get(property:"attributeMap"): Object; + watch(property:"attributeMap", callback:{(property?:string, oldValue?:Object, newValue?: Object):void}) :{unwatch():void} + /** + * + */ + "baseClass": string; + set(property:"baseClass", value: string): void; + get(property:"baseClass"): string; + watch(property:"baseClass", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * + */ + "class": string; + set(property:"class", value: string): void; + get(property:"class"): string; + watch(property:"class", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * Designates where children of the source DOM node will be placed. + * "Children" in this case refers to both DOM nodes and widgets. + * For example, for myWidget: + * + *
+ * here's a plain DOM node + * and a widget + * and another plain DOM node + *
+ * containerNode would point to: + * + * here's a plain DOM node + * and a widget + * and another plain DOM node + * In templated widgets, "containerNode" is set via a + * data-dojo-attach-point assignment. + * + * containerNode must be defined for any widget that accepts innerHTML + * (like ContentPane or BorderContainer or even Button), and conversely + * is null for widgets that don't, like TextBox. + * + */ + "containerNode": HTMLElement; + set(property:"containerNode", value: HTMLElement): void; + get(property:"containerNode"): HTMLElement; + watch(property:"containerNode", callback:{(property?:string, oldValue?:HTMLElement, newValue?: HTMLElement):void}) :{unwatch():void} + /** + * + */ + "cssStateNodes": Object; + set(property:"cssStateNodes", value: Object): void; + get(property:"cssStateNodes"): Object; + watch(property:"cssStateNodes", callback:{(property?:string, oldValue?:Object, newValue?: Object):void}) :{unwatch():void} + /** + * Date object containing the currently focused date, or the date which would be focused + * if the calendar itself was focused. Also indicates which year and month to display, + * i.e. the current "page" the calendar is on. + * + */ + "currentFocus": Date; + set(property:"currentFocus", value: Date): void; + get(property:"currentFocus"): Date; + watch(property:"currentFocus", callback:{(property?:string, oldValue?:Date, newValue?: Date):void}) :{unwatch():void} + /** + * JavaScript namespace to find calendar routines. If unspecified, uses Gregorian calendar routines + * at dojo/date and dojo/date/locale. + * + */ + "datePackage": string; + set(property:"datePackage", value: string): void; + get(property:"datePackage"): string; + watch(property:"datePackage", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * + */ + "dateTemplateString": string; + set(property:"dateTemplateString", value: string): void; + get(property:"dateTemplateString"): string; + watch(property:"dateTemplateString", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * How to represent the days of the week in the calendar header. See locale + * + */ + "dayWidth": string; + set(property:"dayWidth", value: string): void; + get(property:"dayWidth"): string; + watch(property:"dayWidth", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * Bi-directional support, as defined by the HTML DIR + * attribute. Either left-to-right "ltr" or right-to-left "rtl". If undefined, widgets renders in page's + * default direction. + * + */ + "dir": string; + set(property:"dir", value: string): void; + get(property:"dir"): string; + watch(property:"dir", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * This is our visible representation of the widget! Other DOM + * Nodes may by assigned to other properties, usually through the + * template system's data-dojo-attach-point syntax, but the domNode + * property is the canonical "top level" node in widget UI. + * + */ + "domNode": HTMLElement; + set(property:"domNode", value: HTMLElement): void; + get(property:"domNode"): HTMLElement; + watch(property:"domNode", callback:{(property?:string, oldValue?:HTMLElement, newValue?: HTMLElement):void}) :{unwatch():void} + /** + * + */ + "dowTemplateString": string; + set(property:"dowTemplateString", value: string): void; + get(property:"dowTemplateString"): string; + watch(property:"dowTemplateString", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * Defines a type of widget. + * + */ + "dndType": string; + set(property:"dndType", value: string): void; + get(property:"dndType"): string; + watch(property:"dndType", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * This widget or a widget it contains has focus, or is "active" because + * it was recently clicked. + * + */ + "focused": boolean; + set(property:"focused", value: boolean): void; + get(property:"focused"): boolean; + watch(property:"focused", callback:{(property?:string, oldValue?:boolean, newValue?: boolean):void}) :{unwatch():void} + /** + * True if cursor is over this widget + * + */ + "hovering": boolean; + set(property:"hovering", value: boolean): void; + get(property:"hovering"): boolean; + watch(property:"hovering", callback:{(property?:string, oldValue?:boolean, newValue?: boolean):void}) :{unwatch():void} + /** + * A unique, opaque ID string that can be assigned by users or by the + * system. If the developer passes an ID which is known not to be + * unique, the specified ID is ignored and the system-generated ID is + * used instead. + * + */ + "id": string; + set(property:"id", value: string): void; + get(property:"id"): string; + watch(property:"id", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * Rarely used. Overrides the default Dojo locale used to render this widget, + * as defined by the HTML LANG attribute. + * Value must be among the list of locales specified during by the Dojo bootstrap, + * formatted according to RFC 3066 (like en-us). + * + */ + "lang": string; + set(property:"lang", value: string): void; + get(property:"lang"): string; + watch(property:"lang", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * + */ + "observer": string; + set(property:"observer", value: string): void; + get(property:"observer"): string; + watch(property:"observer", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * The document this widget belongs to. If not specified to constructor, will default to + * srcNodeRef.ownerDocument, or if no sourceRef specified, then to the document global + * + */ + "ownerDocument": Object; + set(property:"ownerDocument", value: Object): void; + get(property:"ownerDocument"): Object; + watch(property:"ownerDocument", callback:{(property?:string, oldValue?:Object, newValue?: Object):void}) :{unwatch():void} + /** + * + */ + "searchContainerNode": boolean; + set(property:"searchContainerNode", value: boolean): void; + get(property:"searchContainerNode"): boolean; + watch(property:"searchContainerNode", callback:{(property?:string, oldValue?:boolean, newValue?: boolean):void}) :{unwatch():void} + /** + * A parameter needed by RadioGroupSlide only. An optional paramter to force + * the ContentPane to slide in from a set direction. Defaults + * to "random", or specify one of "top", "left", "right", "bottom" + * to slideFrom top, left, right, or bottom. + * + */ + "slideFrom": string; + set(property:"slideFrom", value: string): void; + get(property:"slideFrom"): string; + watch(property:"slideFrom", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * pointer to original DOM node + * + */ + "srcNodeRef": HTMLElement; + set(property:"srcNodeRef", value: HTMLElement): void; + get(property:"srcNodeRef"): HTMLElement; + watch(property:"srcNodeRef", callback:{(property?:string, oldValue?:HTMLElement, newValue?: HTMLElement):void}) :{unwatch():void} + /** + * HTML style attributes as cssText string or name/value hash + * + */ + "style": string; + set(property:"style", value: string): void; + get(property:"style"): string; + watch(property:"style", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * Order fields are traversed when user hits the tab key + * + */ + "tabIndex": string; + set(property:"tabIndex", value: string): void; + get(property:"tabIndex"): string; + watch(property:"tabIndex", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * Path to template (HTML file) for this widget relative to dojo.baseUrl. + * Deprecated: use templateString with require([... "dojo/text!..."], ...) instead + * + */ + "templatePath": string; + set(property:"templatePath", value: string): void; + get(property:"templatePath"): string; + watch(property:"templatePath", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * + */ + "templateString": string; + set(property:"templateString", value: string): void; + get(property:"templateString"): string; + watch(property:"templateString", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * HTML title attribute. + * + * For form widgets this specifies a tooltip to display when hovering over + * the widget (just like the native HTML title attribute). + * + * For TitlePane or for when this widget is a child of a TabContainer, AccordionContainer, + * etc., it's used to specify the tab label, accordion pane title, etc. In this case it's + * interpreted as HTML. + * + */ + "title": string; + set(property:"title", value: string): void; + get(property:"title"): string; + watch(property:"title", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * When this widget's title attribute is used to for a tab label, accordion pane title, etc., + * this specifies the tooltip to appear when the mouse is hovered over that text. + * + */ + "tooltip": string; + set(property:"tooltip", value: string): void; + get(property:"tooltip"): string; + watch(property:"tooltip", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * The currently selected Date, initially set to invalid date to indicate no selection. + * + */ + "value": Date; + set(property:"value", value: Date): void; + get(property:"value"): Date; + watch(property:"value", callback:{(property?:string, oldValue?:Date, newValue?: Date):void}) :{unwatch():void} + /** + * + */ + "weekTemplateString": string; + set(property:"weekTemplateString", value: string): void; + get(property:"weekTemplateString"): string; + watch(property:"weekTemplateString", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * This method is deprecated, use get() or set() directly. + * + * @param name The property to get or set. If an object is passed here and nota string, its keys are used as names of attributes to be setand the value of the object as values to set in the widget. + * @param value OptionalOptional. If provided, attr() operates as a setter. If omitted,the current value of the named property is returned. + */ + attr(name: String, value: Object): any; + /** + * This method is deprecated, use get() or set() directly. + * + * @param name The property to get or set. If an object is passed here and nota string, its keys are used as names of attributes to be setand the value of the object as values to set in the widget. + * @param value OptionalOptional. If provided, attr() operates as a setter. If omitted,the current value of the named property is returned. + */ + attr(name: Object, value: Object): any; + /** + * + */ + buildRendering(): void; + /** + * Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead. + * + * Connects specified obj/event to specified method of this object + * and registers for disconnect() on widget destroy. + * + * Provide widget-specific analog to dojo.connect, except with the + * implicit use of this widget as the target object. + * Events connected with this.connect are disconnected upon + * destruction. + * + * @param obj + * @param event + * @param method + */ + connect(obj: Object, event: String, method: String): any; + /** + * Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead. + * + * Connects specified obj/event to specified method of this object + * and registers for disconnect() on widget destroy. + * + * Provide widget-specific analog to dojo.connect, except with the + * implicit use of this widget as the target object. + * Events connected with this.connect are disconnected upon + * destruction. + * + * @param obj + * @param event + * @param method + */ + connect(obj: any, event: String, method: String): any; + /** + * Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead. + * + * Connects specified obj/event to specified method of this object + * and registers for disconnect() on widget destroy. + * + * Provide widget-specific analog to dojo.connect, except with the + * implicit use of this widget as the target object. + * Events connected with this.connect are disconnected upon + * destruction. + * + * @param obj + * @param event + * @param method + */ + connect(obj: Object, event: Function, method: String): any; + /** + * Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead. + * + * Connects specified obj/event to specified method of this object + * and registers for disconnect() on widget destroy. + * + * Provide widget-specific analog to dojo.connect, except with the + * implicit use of this widget as the target object. + * Events connected with this.connect are disconnected upon + * destruction. + * + * @param obj + * @param event + * @param method + */ + connect(obj: any, event: Function, method: String): any; + /** + * Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead. + * + * Connects specified obj/event to specified method of this object + * and registers for disconnect() on widget destroy. + * + * Provide widget-specific analog to dojo.connect, except with the + * implicit use of this widget as the target object. + * Events connected with this.connect are disconnected upon + * destruction. + * + * @param obj + * @param event + * @param method + */ + connect(obj: Object, event: String, method: Function): any; + /** + * Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead. + * + * Connects specified obj/event to specified method of this object + * and registers for disconnect() on widget destroy. + * + * Provide widget-specific analog to dojo.connect, except with the + * implicit use of this widget as the target object. + * Events connected with this.connect are disconnected upon + * destruction. + * + * @param obj + * @param event + * @param method + */ + connect(obj: any, event: String, method: Function): any; + /** + * Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead. + * + * Connects specified obj/event to specified method of this object + * and registers for disconnect() on widget destroy. + * + * Provide widget-specific analog to dojo.connect, except with the + * implicit use of this widget as the target object. + * Events connected with this.connect are disconnected upon + * destruction. + * + * @param obj + * @param event + * @param method + */ + connect(obj: Object, event: Function, method: Function): any; + /** + * Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead. + * + * Connects specified obj/event to specified method of this object + * and registers for disconnect() on widget destroy. + * + * Provide widget-specific analog to dojo.connect, except with the + * implicit use of this widget as the target object. + * Events connected with this.connect are disconnected upon + * destruction. + * + * @param obj + * @param event + * @param method + */ + connect(obj: any, event: Function, method: Function): any; + /** + * Wrapper to setTimeout to avoid deferred functions executing + * after the originating widget has been destroyed. + * Returns an object handle with a remove method (that returns null) (replaces clearTimeout). + * + * @param fcn Function reference. + * @param delay OptionalDelay, defaults to 0. + */ + defer(fcn: Function, delay: number): Object; + /** + * Destroy this widget, but not its descendants. Descendants means widgets inside of + * this.containerNode. Will also destroy any resources (including widgets) registered via this.own(). + * + * This method will also destroy internal widgets such as those created from a template, + * assuming those widgets exist inside of this.domNode but outside of this.containerNode. + * + * For 2.0 it's planned that this method will also destroy descendant widgets, so apps should not + * depend on the current ability to destroy a widget without destroying its descendants. Generally + * they should use destroyRecursive() for widgets with children. + * + * @param preserveDom If true, this method will leave the original DOM structure alone.Note: This will not yet work with _TemplatedMixin widgets + */ + destroy(preserveDom?: boolean): void; + /** + * Recursively destroy the children of this widget and their + * descendants. + * + * @param preserveDom OptionalIf true, the preserveDom attribute is passed to all descendantwidget's .destroy() method. Not for use with _Templatedwidgets. + */ + destroyDescendants(preserveDom?: boolean): void; + /** + * Destroy this widget and its descendants + * This is the generic "destructor" function that all widget users + * should call to cleanly discard with a widget. Once a widget is + * destroyed, it is removed from the manager object. + * + * @param preserveDom OptionalIf true, this method will leave the original DOM structurealone of descendant Widgets. Note: This will NOT work withdijit._TemplatedMixin widgets. + */ + destroyRecursive(preserveDom?: boolean): void; + /** + * Destroys the DOM nodes associated with this widget. + * + * @param preserveDom OptionalIf true, this method will leave the original DOM structure aloneduring tear-down. Note: this will not work with _Templatedwidgets yet. + */ + destroyRendering(preserveDom?: boolean): void; + /** + * Deprecated, will be removed in 2.0, use handle.remove() instead. + * + * Disconnects handle created by connect. + * + * @param handle + */ + disconnect(handle: any): void; + /** + * Used by widgets to signal that a synthetic event occurred, ex: + * + * myWidget.emit("attrmodified-selectedChildWidget", {}). + * Emits an event on this.domNode named type.toLowerCase(), based on eventObj. + * Also calls onType() method, if present, and returns value from that method. + * By default passes eventObj to callback, but will pass callbackArgs instead, if specified. + * Modifies eventObj by adding missing parameters (bubbles, cancelable, widget). + * + * @param type + * @param eventObj Optional + * @param callbackArgs Optional + */ + emit(type: String, eventObj: Object, callbackArgs: any[]): any; + /** + * Focus the calendar by focusing one of the calendar cells + * + */ + focus(): void; + /** + * Get a property from a widget. + * Get a named property from a widget. The property may + * potentially be retrieved via a getter method. If no getter is defined, this + * just retrieves the object's property. + * + * For example, if the widget has properties foo and bar + * and a method named _getFooAttr(), calling: + * myWidget.get("foo") would be equivalent to calling + * widget._getFooAttr() and myWidget.get("bar") + * would be equivalent to the expression + * widget.bar2 + * + * @param name The property to get. + */ + get(name: any): any; + /** + * Returns all direct children of this widget, i.e. all widgets underneath this.containerNode whose parent + * is this widget. Note that it does not return all descendants, but rather just direct children. + * Analogous to Node.childNodes, + * except containing widgets rather than DOMNodes. + * + * The result intentionally excludes internally created widgets (a.k.a. supporting widgets) + * outside of this.containerNode. + * + * Note that the array returned is a simple array. Application code should not assume + * existence of methods like forEach(). + * + */ + getChildren(): any[]; + /** + * May be overridden to return CSS classes to associate with the date entry for the given dateObject, + * for example to indicate a holiday in specified locale. + * + * @param dateObject + * @param locale Optional + */ + getClassForDate(dateObject: Date, locale: String): String; + /** + * Returns all the widgets contained by this, i.e., all widgets underneath this.containerNode. + * This method should generally be avoided as it returns widgets declared in templates, which are + * supposed to be internal/hidden, but it's left here for back-compat reasons. + * + */ + getDescendants(): any[]; + /** + * Returns the parent widget of this widget. + * + */ + getParent(): any; + /** + * Sets calendar's value to today's date + * + */ + goToToday(): void; + /** + * Provides keyboard navigation of calendar. + * Called from _onKeyDown() to handle keydown on a stand alone Calendar, + * and also from dijit/form/_DateTimeTextBox to pass a keydown event + * from the dijit/form/DateTextBox to be handled in this widget + * + * @param evt + */ + handleKey(evt: Event): any; + /** + * May be overridden to disable certain dates in the calendar e.g. isDisabledDate=dojo.date.locale.isWeekend + * + * @param dateObject + * @param locale Optional + */ + isDisabledDate(dateObject: Date, locale: String): boolean; + /** + * Return true if this widget can currently be focused + * and false if not + * + */ + isFocusable(): any; + /** + * Return this widget's explicit or implicit orientation (true for LTR, false for RTL) + * + */ + isLeftToRight(): any; + /** + * Call specified function when event occurs, ex: myWidget.on("click", function(){ ... }). + * Call specified function when event type occurs, ex: myWidget.on("click", function(){ ... }). + * Note that the function is not run in any particular scope, so if (for example) you want it to run in the + * widget's scope you must do myWidget.on("click", lang.hitch(myWidget, func)). + * + * @param type Name of event (ex: "click") or extension event like touch.press. + * @param func + */ + on(type: String, func: Function): any; + /** + * Call specified function when event occurs, ex: myWidget.on("click", function(){ ... }). + * Call specified function when event type occurs, ex: myWidget.on("click", function(){ ... }). + * Note that the function is not run in any particular scope, so if (for example) you want it to run in the + * widget's scope you must do myWidget.on("click", lang.hitch(myWidget, func)). + * + * @param type Name of event (ex: "click") or extension event like touch.press. + * @param func + */ + on(type: Function, func: Function): any; + /** + * Track specified handles and remove/destroy them when this instance is destroyed, unless they were + * already removed/destroyed manually. + * + */ + own(): any; + /** + * Place this widget somewhere in the DOM based + * on standard domConstruct.place() conventions. + * A convenience function provided in all _Widgets, providing a simple + * shorthand mechanism to put an existing (or newly created) Widget + * somewhere in the dom, and allow chaining. + * + * @param reference Widget, DOMNode, or id of widget or DOMNode + * @param position OptionalIf reference is a widget (or id of widget), and that widget has an ".addChild" method,it will be called passing this widget instance into that method, supplying the optionalposition index passed. In this case position (if specified) should be an integer.If reference is a DOMNode (or id matching a DOMNode but not a widget),the position argument can be a numeric index or a string"first", "last", "before", or "after", same as dojo/dom-construct::place(). + */ + placeAt(reference: String, position: String): any; + /** + * Place this widget somewhere in the DOM based + * on standard domConstruct.place() conventions. + * A convenience function provided in all _Widgets, providing a simple + * shorthand mechanism to put an existing (or newly created) Widget + * somewhere in the dom, and allow chaining. + * + * @param reference Widget, DOMNode, or id of widget or DOMNode + * @param position OptionalIf reference is a widget (or id of widget), and that widget has an ".addChild" method,it will be called passing this widget instance into that method, supplying the optionalposition index passed. In this case position (if specified) should be an integer.If reference is a DOMNode (or id matching a DOMNode but not a widget),the position argument can be a numeric index or a string"first", "last", "before", or "after", same as dojo/dom-construct::place(). + */ + placeAt(reference: HTMLElement, position: String): any; + /** + * Place this widget somewhere in the DOM based + * on standard domConstruct.place() conventions. + * A convenience function provided in all _Widgets, providing a simple + * shorthand mechanism to put an existing (or newly created) Widget + * somewhere in the dom, and allow chaining. + * + * @param reference Widget, DOMNode, or id of widget or DOMNode + * @param position OptionalIf reference is a widget (or id of widget), and that widget has an ".addChild" method,it will be called passing this widget instance into that method, supplying the optionalposition index passed. In this case position (if specified) should be an integer.If reference is a DOMNode (or id matching a DOMNode but not a widget),the position argument can be a numeric index or a string"first", "last", "before", or "after", same as dojo/dom-construct::place(). + */ + placeAt(reference: dijit._WidgetBase, position: String): any; + /** + * Place this widget somewhere in the DOM based + * on standard domConstruct.place() conventions. + * A convenience function provided in all _Widgets, providing a simple + * shorthand mechanism to put an existing (or newly created) Widget + * somewhere in the dom, and allow chaining. + * + * @param reference Widget, DOMNode, or id of widget or DOMNode + * @param position OptionalIf reference is a widget (or id of widget), and that widget has an ".addChild" method,it will be called passing this widget instance into that method, supplying the optionalposition index passed. In this case position (if specified) should be an integer.If reference is a DOMNode (or id matching a DOMNode but not a widget),the position argument can be a numeric index or a string"first", "last", "before", or "after", same as dojo/dom-construct::place(). + */ + placeAt(reference: String, position: number): any; + /** + * Place this widget somewhere in the DOM based + * on standard domConstruct.place() conventions. + * A convenience function provided in all _Widgets, providing a simple + * shorthand mechanism to put an existing (or newly created) Widget + * somewhere in the dom, and allow chaining. + * + * @param reference Widget, DOMNode, or id of widget or DOMNode + * @param position OptionalIf reference is a widget (or id of widget), and that widget has an ".addChild" method,it will be called passing this widget instance into that method, supplying the optionalposition index passed. In this case position (if specified) should be an integer.If reference is a DOMNode (or id matching a DOMNode but not a widget),the position argument can be a numeric index or a string"first", "last", "before", or "after", same as dojo/dom-construct::place(). + */ + placeAt(reference: HTMLElement, position: number): any; + /** + * Place this widget somewhere in the DOM based + * on standard domConstruct.place() conventions. + * A convenience function provided in all _Widgets, providing a simple + * shorthand mechanism to put an existing (or newly created) Widget + * somewhere in the dom, and allow chaining. + * + * @param reference Widget, DOMNode, or id of widget or DOMNode + * @param position OptionalIf reference is a widget (or id of widget), and that widget has an ".addChild" method,it will be called passing this widget instance into that method, supplying the optionalposition index passed. In this case position (if specified) should be an integer.If reference is a DOMNode (or id matching a DOMNode but not a widget),the position argument can be a numeric index or a string"first", "last", "before", or "after", same as dojo/dom-construct::place(). + */ + placeAt(reference: dijit._WidgetBase, position: number): any; + /** + * + */ + postCreate(): void; + /** + * Called after the parameters to the widget have been read-in, + * but before the widget template is instantiated. Especially + * useful to set properties that are referenced in the widget + * template. + * + */ + postMixInProperties(): void; + /** + * Set a property on a widget + * Sets named properties on a widget which may potentially be handled by a + * setter in the widget. + * + * For example, if the widget has properties foo and bar + * and a method named _setFooAttr(), calling + * myWidget.set("foo", "Howdy!") would be equivalent to calling + * widget._setFooAttr("Howdy!") and myWidget.set("bar", 3) + * would be equivalent to the statement widget.bar = 3; + * + * set() may also be called with a hash of name/value pairs, ex: + * + * myWidget.set({ + * foo: "Howdy", + * bar: 3 + * }); + * This is equivalent to calling set(foo, "Howdy") and set(bar, 3) + * + * @param name The property to set. + * @param value The value to set in the property. + */ + set(name: any, value: any): any; + /** + * Deprecated. Use set() instead. + * + * @param attr + * @param value + */ + setAttribute(attr: String, value: any): void; + /** + * Deprecated. Use set('value', ...) instead. + * + * @param value + */ + setValue(value: Date): void; + /** + * Processing after the DOM fragment is added to the document + * Called after a widget and its children have been created and added to the page, + * and all related widgets have finished their create() cycle, up through postCreate(). + * + * Note that startup() may be called while the widget is still hidden, for example if the widget is + * inside a hidden dijit/Dialog or an unselected tab of a dijit/layout/TabContainer. + * For widgets that need to do layout, it's best to put that layout code inside resize(), and then + * extend dijit/layout/_LayoutWidget so that resize() is called when the widget is visible. + * + */ + startup(): void; + /** + * Deprecated, will be removed in 2.0, use this.own(topic.subscribe()) instead. + * + * Subscribes to the specified topic and calls the specified method + * of this object and registers for unsubscribe() on widget destroy. + * + * Provide widget-specific analog to dojo.subscribe, except with the + * implicit use of this widget as the target object. + * + * @param t The topic + * @param method The callback + */ + subscribe(t: String, method: Function): any; + /** + * Returns a string that represents the widget. + * When a widget is cast to a string, this method will be used to generate the + * output. Currently, it does not implement any sort of reversible + * serialization. + * + */ + toString(): String; + /** + * Deprecated. Override destroy() instead to implement custom widget tear-down + * behavior. + * + */ + uninitialize(): boolean; + /** + * Deprecated, will be removed in 2.0, use handle.remove() instead. + * + * Unsubscribes handle created by this.subscribe. + * Also removes handle from this widget's list of subscriptions + * + * @param handle + */ + unsubscribe(handle: Object): void; + /** + * Watches a property for changes + * + * @param name OptionalIndicates the property to watch. This is optional (the callback may be theonly parameter), and if omitted, all the properties will be watched + * @param callback The function to execute when the property changes. This will be called afterthe property has been changed. The callback will be called with the |this|set to the instance, the first argument as the name of the property, thesecond argument as the old value and the third argument as the new value. + */ + watch(property: string, callback:{(property?:string, oldValue?:any, newValue?: any):void}) :{unwatch():void}; + /** + * Static method to get a template based on the templatePath or + * templateString key + */ + getCachedTemplate(): any; + /** + * Called when the widget stops being "active" because + * focus moved to something outside of it, or the user + * clicked somewhere outside of it, or the widget was + * hidden. + * + */ + onBlur(): void; + /** + * + * @param value + */ + onChange(value: any): void; + /** + * Connect to this function to receive notifications of mouse click events. + * + * @param event mouse Event + */ + onClick(event: any): void; + /** + * Called when this widget is being displayed as a popup (ex: a Calendar popped + * up from a DateTextBox), and it is hidden. + * This is called from the dijit.popup code, and should not be called directly. + * + * Also used as a parameter for children of dijit/layout/StackContainer or subclasses. + * Callback if a user tries to close the child. Child will be closed if this function returns true. + * + */ + onClose(): boolean; + /** + * Connect to this function to receive notifications of mouse double click events. + * + * @param event mouse Event + */ + onDblClick(event: any): void; + /** + * Called when the widget becomes "active" because + * it or a widget inside of it either has focus, or has recently + * been clicked. + * + */ + onFocus(): void; + /** + * Called when another widget becomes the selected pane in a + * dijit/layout/TabContainer, dijit/layout/StackContainer, + * dijit/layout/AccordionContainer, etc. + * + * Also called to indicate hide of a dijit.Dialog, dijit.TooltipDialog, or dijit.TitlePane. + * + */ + onHide(): void; + /** + * Connect to this function to receive notifications of keys being pressed down. + * + * @param event key Event + */ + onKeyDown(event: any): void; + /** + * Connect to this function to receive notifications of printable keys being typed. + * + * @param event key Event + */ + onKeyPress(event: any): void; + /** + * Connect to this function to receive notifications of keys being released. + * + * @param event key Event + */ + onKeyUp(event: any): void; + /** + * Connect to this function to receive notifications of when the mouse button is pressed down. + * + * @param event mouse Event + */ + onMouseDown(event: any): void; + /** + * Connect to this function to receive notifications of when the mouse moves onto this widget. + * + * @param event mouse Event + */ + onMouseEnter(event: any): void; + /** + * Connect to this function to receive notifications of when the mouse moves off of this widget. + * + * @param event mouse Event + */ + onMouseLeave(event: any): void; + /** + * Connect to this function to receive notifications of when the mouse moves over nodes contained within this widget. + * + * @param event mouse Event + */ + onMouseMove(event: any): void; + /** + * Connect to this function to receive notifications of when the mouse moves off of nodes contained within this widget. + * + * @param event mouse Event + */ + onMouseOut(event: any): void; + /** + * Connect to this function to receive notifications of when the mouse moves onto nodes contained within this widget. + * + * @param event mouse Event + */ + onMouseOver(event: any): void; + /** + * Connect to this function to receive notifications of when the mouse button is released. + * + * @param event mouse Event + */ + onMouseUp(event: any): void; + /** + * Called when this widget becomes the selected pane in a + * dijit/layout/TabContainer, dijit/layout/StackContainer, + * dijit/layout/AccordionContainer, etc. + * + * Also called to indicate display of a dijit.Dialog, dijit.TooltipDialog, or dijit.TitlePane. + * + */ + onShow(): void; + /** + * Deprecated. Notification that a date cell was selected. It may be the same as the previous value. + * Formerly used by dijit/form/_DateTimeTextBox (and thus dijit/form/DateTextBox) + * to get notification when the user has clicked a date. Now onExecute() (above) is used. + * + * @param date + */ + onValueSelected(date: Date): void; + } + module Calendar { + /** + * Permalink: http://dojotoolkit.org/api/1.9/dijit/Calendar._MonthDropDown.html + * + * The list-of-months drop down from the MonthDropDownButton + * + * @param params Hash of initialization parameters for widget, including scalar values (like title, duration etc.)and functions, typically callbacks like onClick.The hash can contain any of the widget's properties, excluding read-only properties. + * @param srcNodeRef OptionalIf a srcNodeRef (DOM node) is specified:use srcNodeRef.innerHTML as my contentsif this is a behavioral widget then apply behavior to that srcNodeRefotherwise, replace srcNodeRef with my generated DOM tree + */ + class _MonthDropDown extends dijit._Widget implements dijit._TemplatedMixin { + constructor(params?: Object, srcNodeRef?: HTMLElement); + /** + * Object to which attach points and events will be scoped. Defaults + * to 'this'. + * + */ + "attachScope": Object; + set(property:"attachScope", value: Object): void; + get(property:"attachScope"): Object; + watch(property:"attachScope", callback:{(property?:string, oldValue?:Object, newValue?: Object):void}) :{unwatch():void} + /** + * Deprecated. Instead of attributeMap, widget should have a _setXXXAttr attribute + * for each XXX attribute to be mapped to the DOM. + * + * attributeMap sets up a "binding" between attributes (aka properties) + * of the widget and the widget's DOM. + * Changes to widget attributes listed in attributeMap will be + * reflected into the DOM. + * + * For example, calling set('title', 'hello') + * on a TitlePane will automatically cause the TitlePane's DOM to update + * with the new title. + * + * attributeMap is a hash where the key is an attribute of the widget, + * and the value reflects a binding to a: + * + * DOM node attribute + * focus: {node: "focusNode", type: "attribute"} + * Maps this.focus to this.focusNode.focus + * + * DOM node innerHTML + * title: { node: "titleNode", type: "innerHTML" } + * Maps this.title to this.titleNode.innerHTML + * + * DOM node innerText + * title: { node: "titleNode", type: "innerText" } + * Maps this.title to this.titleNode.innerText + * + * DOM node CSS class + * myClass: { node: "domNode", type: "class" } + * Maps this.myClass to this.domNode.className + * + * If the value is an array, then each element in the array matches one of the + * formats of the above list. + * + * There are also some shorthands for backwards compatibility: + * + * string --> { node: string, type: "attribute" }, for example: + * "focusNode" ---> { node: "focusNode", type: "attribute" } + * "" --> { node: "domNode", type: "attribute" } + * + */ + "attributeMap": Object; + set(property:"attributeMap", value: Object): void; + get(property:"attributeMap"): Object; + watch(property:"attributeMap", callback:{(property?:string, oldValue?:Object, newValue?: Object):void}) :{unwatch():void} + /** + * Root CSS class of the widget (ex: dijitTextBox), used to construct CSS classes to indicate + * widget state. + * + */ + "baseClass": string; + set(property:"baseClass", value: string): void; + get(property:"baseClass"): string; + watch(property:"baseClass", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * + */ + "class": string; + set(property:"class", value: string): void; + get(property:"class"): string; + watch(property:"class", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * Designates where children of the source DOM node will be placed. + * "Children" in this case refers to both DOM nodes and widgets. + * For example, for myWidget: + * + *
+ * here's a plain DOM node + * and a widget + * and another plain DOM node + *
+ * containerNode would point to: + * + * here's a plain DOM node + * and a widget + * and another plain DOM node + * In templated widgets, "containerNode" is set via a + * data-dojo-attach-point assignment. + * + * containerNode must be defined for any widget that accepts innerHTML + * (like ContentPane or BorderContainer or even Button), and conversely + * is null for widgets that don't, like TextBox. + * + */ + "containerNode": HTMLElement; + set(property:"containerNode", value: HTMLElement): void; + get(property:"containerNode"): HTMLElement; + watch(property:"containerNode", callback:{(property?:string, oldValue?:HTMLElement, newValue?: HTMLElement):void}) :{unwatch():void} + /** + * Bi-directional support, as defined by the HTML DIR + * attribute. Either left-to-right "ltr" or right-to-left "rtl". If undefined, widgets renders in page's + * default direction. + * + */ + "dir": string; + set(property:"dir", value: string): void; + get(property:"dir"): string; + watch(property:"dir", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * This is our visible representation of the widget! Other DOM + * Nodes may by assigned to other properties, usually through the + * template system's data-dojo-attach-point syntax, but the domNode + * property is the canonical "top level" node in widget UI. + * + */ + "domNode": HTMLElement; + set(property:"domNode", value: HTMLElement): void; + get(property:"domNode"): HTMLElement; + watch(property:"domNode", callback:{(property?:string, oldValue?:HTMLElement, newValue?: HTMLElement):void}) :{unwatch():void} + /** + * This widget or a widget it contains has focus, or is "active" because + * it was recently clicked. + * + */ + "focused": boolean; + set(property:"focused", value: boolean): void; + get(property:"focused"): boolean; + watch(property:"focused", callback:{(property?:string, oldValue?:boolean, newValue?: boolean):void}) :{unwatch():void} + /** + * A unique, opaque ID string that can be assigned by users or by the + * system. If the developer passes an ID which is known not to be + * unique, the specified ID is ignored and the system-generated ID is + * used instead. + * + */ + "id": string; + set(property:"id", value: string): void; + get(property:"id"): string; + watch(property:"id", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * Rarely used. Overrides the default Dojo locale used to render this widget, + * as defined by the HTML LANG attribute. + * Value must be among the list of locales specified during by the Dojo bootstrap, + * formatted according to RFC 3066 (like en-us). + * + */ + "lang": string; + set(property:"lang", value: string): void; + get(property:"lang"): string; + watch(property:"lang", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * List of names of months, possibly w/some undefined entries for Hebrew leap months + * (ex: ["January", "February", undefined, "April", ...]) + * + */ + "months": Object; + set(property:"months", value: Object): void; + get(property:"months"): Object; + watch(property:"months", callback:{(property?:string, oldValue?:Object, newValue?: Object):void}) :{unwatch():void} + /** + * The document this widget belongs to. If not specified to constructor, will default to + * srcNodeRef.ownerDocument, or if no sourceRef specified, then to the document global + * + */ + "ownerDocument": Object; + set(property:"ownerDocument", value: Object): void; + get(property:"ownerDocument"): Object; + watch(property:"ownerDocument", callback:{(property?:string, oldValue?:Object, newValue?: Object):void}) :{unwatch():void} + /** + * + */ + "searchContainerNode": boolean; + set(property:"searchContainerNode", value: boolean): void; + get(property:"searchContainerNode"): boolean; + watch(property:"searchContainerNode", callback:{(property?:string, oldValue?:boolean, newValue?: boolean):void}) :{unwatch():void} + /** + * pointer to original DOM node + * + */ + "srcNodeRef": HTMLElement; + set(property:"srcNodeRef", value: HTMLElement): void; + get(property:"srcNodeRef"): HTMLElement; + watch(property:"srcNodeRef", callback:{(property?:string, oldValue?:HTMLElement, newValue?: HTMLElement):void}) :{unwatch():void} + /** + * HTML style attributes as cssText string or name/value hash + * + */ + "style": string; + set(property:"style", value: string): void; + get(property:"style"): string; + watch(property:"style", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * Path to template (HTML file) for this widget relative to dojo.baseUrl. + * Deprecated: use templateString with require([... "dojo/text!..."], ...) instead + * + */ + "templatePath": string; + set(property:"templatePath", value: string): void; + get(property:"templatePath"): string; + watch(property:"templatePath", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * + */ + "templateString": string; + set(property:"templateString", value: string): void; + get(property:"templateString"): string; + watch(property:"templateString", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * HTML title attribute. + * + * For form widgets this specifies a tooltip to display when hovering over + * the widget (just like the native HTML title attribute). + * + * For TitlePane or for when this widget is a child of a TabContainer, AccordionContainer, + * etc., it's used to specify the tab label, accordion pane title, etc. In this case it's + * interpreted as HTML. + * + */ + "title": string; + set(property:"title", value: string): void; + get(property:"title"): string; + watch(property:"title", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * When this widget's title attribute is used to for a tab label, accordion pane title, etc., + * this specifies the tooltip to appear when the mouse is hovered over that text. + * + */ + "tooltip": string; + set(property:"tooltip", value: string): void; + get(property:"tooltip"): string; + watch(property:"tooltip", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * This method is deprecated, use get() or set() directly. + * + * @param name The property to get or set. If an object is passed here and nota string, its keys are used as names of attributes to be setand the value of the object as values to set in the widget. + * @param value OptionalOptional. If provided, attr() operates as a setter. If omitted,the current value of the named property is returned. + */ + attr(name: String, value: Object): any; + /** + * This method is deprecated, use get() or set() directly. + * + * @param name The property to get or set. If an object is passed here and nota string, its keys are used as names of attributes to be setand the value of the object as values to set in the widget. + * @param value OptionalOptional. If provided, attr() operates as a setter. If omitted,the current value of the named property is returned. + */ + attr(name: Object, value: Object): any; + /** + * Construct the UI for this widget, setting this.domNode. + * Most widgets will mixin dijit._TemplatedMixin, which implements this method. + * + */ + buildRendering(): void; + /** + * Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead. + * + * Connects specified obj/event to specified method of this object + * and registers for disconnect() on widget destroy. + * + * Provide widget-specific analog to dojo.connect, except with the + * implicit use of this widget as the target object. + * Events connected with this.connect are disconnected upon + * destruction. + * + * @param obj + * @param event + * @param method + */ + connect(obj: Object, event: String, method: String): any; + /** + * Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead. + * + * Connects specified obj/event to specified method of this object + * and registers for disconnect() on widget destroy. + * + * Provide widget-specific analog to dojo.connect, except with the + * implicit use of this widget as the target object. + * Events connected with this.connect are disconnected upon + * destruction. + * + * @param obj + * @param event + * @param method + */ + connect(obj: any, event: String, method: String): any; + /** + * Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead. + * + * Connects specified obj/event to specified method of this object + * and registers for disconnect() on widget destroy. + * + * Provide widget-specific analog to dojo.connect, except with the + * implicit use of this widget as the target object. + * Events connected with this.connect are disconnected upon + * destruction. + * + * @param obj + * @param event + * @param method + */ + connect(obj: Object, event: Function, method: String): any; + /** + * Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead. + * + * Connects specified obj/event to specified method of this object + * and registers for disconnect() on widget destroy. + * + * Provide widget-specific analog to dojo.connect, except with the + * implicit use of this widget as the target object. + * Events connected with this.connect are disconnected upon + * destruction. + * + * @param obj + * @param event + * @param method + */ + connect(obj: any, event: Function, method: String): any; + /** + * Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead. + * + * Connects specified obj/event to specified method of this object + * and registers for disconnect() on widget destroy. + * + * Provide widget-specific analog to dojo.connect, except with the + * implicit use of this widget as the target object. + * Events connected with this.connect are disconnected upon + * destruction. + * + * @param obj + * @param event + * @param method + */ + connect(obj: Object, event: String, method: Function): any; + /** + * Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead. + * + * Connects specified obj/event to specified method of this object + * and registers for disconnect() on widget destroy. + * + * Provide widget-specific analog to dojo.connect, except with the + * implicit use of this widget as the target object. + * Events connected with this.connect are disconnected upon + * destruction. + * + * @param obj + * @param event + * @param method + */ + connect(obj: any, event: String, method: Function): any; + /** + * Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead. + * + * Connects specified obj/event to specified method of this object + * and registers for disconnect() on widget destroy. + * + * Provide widget-specific analog to dojo.connect, except with the + * implicit use of this widget as the target object. + * Events connected with this.connect are disconnected upon + * destruction. + * + * @param obj + * @param event + * @param method + */ + connect(obj: Object, event: Function, method: Function): any; + /** + * Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead. + * + * Connects specified obj/event to specified method of this object + * and registers for disconnect() on widget destroy. + * + * Provide widget-specific analog to dojo.connect, except with the + * implicit use of this widget as the target object. + * Events connected with this.connect are disconnected upon + * destruction. + * + * @param obj + * @param event + * @param method + */ + connect(obj: any, event: Function, method: Function): any; + /** + * Wrapper to setTimeout to avoid deferred functions executing + * after the originating widget has been destroyed. + * Returns an object handle with a remove method (that returns null) (replaces clearTimeout). + * + * @param fcn Function reference. + * @param delay OptionalDelay, defaults to 0. + */ + defer(fcn: Function, delay: number): Object; + /** + * Destroy this widget, but not its descendants. Descendants means widgets inside of + * this.containerNode. Will also destroy any resources (including widgets) registered via this.own(). + * + * This method will also destroy internal widgets such as those created from a template, + * assuming those widgets exist inside of this.domNode but outside of this.containerNode. + * + * For 2.0 it's planned that this method will also destroy descendant widgets, so apps should not + * depend on the current ability to destroy a widget without destroying its descendants. Generally + * they should use destroyRecursive() for widgets with children. + * + * @param preserveDom If true, this method will leave the original DOM structure alone.Note: This will not yet work with _TemplatedMixin widgets + */ + destroy(preserveDom?: boolean): void; + /** + * Recursively destroy the children of this widget and their + * descendants. + * + * @param preserveDom OptionalIf true, the preserveDom attribute is passed to all descendantwidget's .destroy() method. Not for use with _Templatedwidgets. + */ + destroyDescendants(preserveDom?: boolean): void; + /** + * Destroy this widget and its descendants + * This is the generic "destructor" function that all widget users + * should call to cleanly discard with a widget. Once a widget is + * destroyed, it is removed from the manager object. + * + * @param preserveDom OptionalIf true, this method will leave the original DOM structurealone of descendant Widgets. Note: This will NOT work withdijit._TemplatedMixin widgets. + */ + destroyRecursive(preserveDom?: boolean): void; + /** + * Destroys the DOM nodes associated with this widget. + * + * @param preserveDom OptionalIf true, this method will leave the original DOM structure aloneduring tear-down. Note: this will not work with _Templatedwidgets yet. + */ + destroyRendering(preserveDom?: boolean): void; + /** + * Deprecated, will be removed in 2.0, use handle.remove() instead. + * + * Disconnects handle created by connect. + * + * @param handle + */ + disconnect(handle: any): void; + /** + * Used by widgets to signal that a synthetic event occurred, ex: + * + * myWidget.emit("attrmodified-selectedChildWidget", {}). + * Emits an event on this.domNode named type.toLowerCase(), based on eventObj. + * Also calls onType() method, if present, and returns value from that method. + * By default passes eventObj to callback, but will pass callbackArgs instead, if specified. + * Modifies eventObj by adding missing parameters (bubbles, cancelable, widget). + * + * @param type + * @param eventObj Optional + * @param callbackArgs Optional + */ + emit(type: String, eventObj: Object, callbackArgs: any[]): any; + /** + * Get a property from a widget. + * Get a named property from a widget. The property may + * potentially be retrieved via a getter method. If no getter is defined, this + * just retrieves the object's property. + * + * For example, if the widget has properties foo and bar + * and a method named _getFooAttr(), calling: + * myWidget.get("foo") would be equivalent to calling + * widget._getFooAttr() and myWidget.get("bar") + * would be equivalent to the expression + * widget.bar2 + * + * @param name The property to get. + */ + get(name: any): any; + /** + * Returns all direct children of this widget, i.e. all widgets underneath this.containerNode whose parent + * is this widget. Note that it does not return all descendants, but rather just direct children. + * Analogous to Node.childNodes, + * except containing widgets rather than DOMNodes. + * + * The result intentionally excludes internally created widgets (a.k.a. supporting widgets) + * outside of this.containerNode. + * + * Note that the array returned is a simple array. Application code should not assume + * existence of methods like forEach(). + * + */ + getChildren(): any[]; + /** + * Returns all the widgets contained by this, i.e., all widgets underneath this.containerNode. + * This method should generally be avoided as it returns widgets declared in templates, which are + * supposed to be internal/hidden, but it's left here for back-compat reasons. + * + */ + getDescendants(): any[]; + /** + * Returns the parent widget of this widget. + * + */ + getParent(): any; + /** + * Return true if this widget can currently be focused + * and false if not + * + */ + isFocusable(): any; + /** + * Return this widget's explicit or implicit orientation (true for LTR, false for RTL) + * + */ + isLeftToRight(): any; + /** + * + * @param type protected + * @param func + */ + on(type: String, func: Function): any; + /** + * + * @param type protected + * @param func + */ + on(type: Function, func: Function): any; + /** + * Track specified handles and remove/destroy them when this instance is destroyed, unless they were + * already removed/destroyed manually. + * + */ + own(): any; + /** + * Place this widget somewhere in the DOM based + * on standard domConstruct.place() conventions. + * A convenience function provided in all _Widgets, providing a simple + * shorthand mechanism to put an existing (or newly created) Widget + * somewhere in the dom, and allow chaining. + * + * @param reference Widget, DOMNode, or id of widget or DOMNode + * @param position OptionalIf reference is a widget (or id of widget), and that widget has an ".addChild" method,it will be called passing this widget instance into that method, supplying the optionalposition index passed. In this case position (if specified) should be an integer.If reference is a DOMNode (or id matching a DOMNode but not a widget),the position argument can be a numeric index or a string"first", "last", "before", or "after", same as dojo/dom-construct::place(). + */ + placeAt(reference: String, position: String): any; + /** + * Place this widget somewhere in the DOM based + * on standard domConstruct.place() conventions. + * A convenience function provided in all _Widgets, providing a simple + * shorthand mechanism to put an existing (or newly created) Widget + * somewhere in the dom, and allow chaining. + * + * @param reference Widget, DOMNode, or id of widget or DOMNode + * @param position OptionalIf reference is a widget (or id of widget), and that widget has an ".addChild" method,it will be called passing this widget instance into that method, supplying the optionalposition index passed. In this case position (if specified) should be an integer.If reference is a DOMNode (or id matching a DOMNode but not a widget),the position argument can be a numeric index or a string"first", "last", "before", or "after", same as dojo/dom-construct::place(). + */ + placeAt(reference: HTMLElement, position: String): any; + /** + * Place this widget somewhere in the DOM based + * on standard domConstruct.place() conventions. + * A convenience function provided in all _Widgets, providing a simple + * shorthand mechanism to put an existing (or newly created) Widget + * somewhere in the dom, and allow chaining. + * + * @param reference Widget, DOMNode, or id of widget or DOMNode + * @param position OptionalIf reference is a widget (or id of widget), and that widget has an ".addChild" method,it will be called passing this widget instance into that method, supplying the optionalposition index passed. In this case position (if specified) should be an integer.If reference is a DOMNode (or id matching a DOMNode but not a widget),the position argument can be a numeric index or a string"first", "last", "before", or "after", same as dojo/dom-construct::place(). + */ + placeAt(reference: dijit._WidgetBase, position: String): any; + /** + * Place this widget somewhere in the DOM based + * on standard domConstruct.place() conventions. + * A convenience function provided in all _Widgets, providing a simple + * shorthand mechanism to put an existing (or newly created) Widget + * somewhere in the dom, and allow chaining. + * + * @param reference Widget, DOMNode, or id of widget or DOMNode + * @param position OptionalIf reference is a widget (or id of widget), and that widget has an ".addChild" method,it will be called passing this widget instance into that method, supplying the optionalposition index passed. In this case position (if specified) should be an integer.If reference is a DOMNode (or id matching a DOMNode but not a widget),the position argument can be a numeric index or a string"first", "last", "before", or "after", same as dojo/dom-construct::place(). + */ + placeAt(reference: String, position: number): any; + /** + * Place this widget somewhere in the DOM based + * on standard domConstruct.place() conventions. + * A convenience function provided in all _Widgets, providing a simple + * shorthand mechanism to put an existing (or newly created) Widget + * somewhere in the dom, and allow chaining. + * + * @param reference Widget, DOMNode, or id of widget or DOMNode + * @param position OptionalIf reference is a widget (or id of widget), and that widget has an ".addChild" method,it will be called passing this widget instance into that method, supplying the optionalposition index passed. In this case position (if specified) should be an integer.If reference is a DOMNode (or id matching a DOMNode but not a widget),the position argument can be a numeric index or a string"first", "last", "before", or "after", same as dojo/dom-construct::place(). + */ + placeAt(reference: HTMLElement, position: number): any; + /** + * Place this widget somewhere in the DOM based + * on standard domConstruct.place() conventions. + * A convenience function provided in all _Widgets, providing a simple + * shorthand mechanism to put an existing (or newly created) Widget + * somewhere in the dom, and allow chaining. + * + * @param reference Widget, DOMNode, or id of widget or DOMNode + * @param position OptionalIf reference is a widget (or id of widget), and that widget has an ".addChild" method,it will be called passing this widget instance into that method, supplying the optionalposition index passed. In this case position (if specified) should be an integer.If reference is a DOMNode (or id matching a DOMNode but not a widget),the position argument can be a numeric index or a string"first", "last", "before", or "after", same as dojo/dom-construct::place(). + */ + placeAt(reference: dijit._WidgetBase, position: number): any; + /** + * + */ + postCreate(): void; + /** + * Called after the parameters to the widget have been read-in, + * but before the widget template is instantiated. Especially + * useful to set properties that are referenced in the widget + * template. + * + */ + postMixInProperties(): void; + /** + * Set a property on a widget + * Sets named properties on a widget which may potentially be handled by a + * setter in the widget. + * + * For example, if the widget has properties foo and bar + * and a method named _setFooAttr(), calling + * myWidget.set("foo", "Howdy!") would be equivalent to calling + * widget._setFooAttr("Howdy!") and myWidget.set("bar", 3) + * would be equivalent to the statement widget.bar = 3; + * + * set() may also be called with a hash of name/value pairs, ex: + * + * myWidget.set({ + * foo: "Howdy", + * bar: 3 + * }); + * This is equivalent to calling set(foo, "Howdy") and set(bar, 3) + * + * @param name The property to set. + * @param value The value to set in the property. + */ + set(name: any, value: any): any; + /** + * Deprecated. Use set() instead. + * + * @param attr + * @param value + */ + setAttribute(attr: String, value: any): void; + /** + * Processing after the DOM fragment is added to the document + * Called after a widget and its children have been created and added to the page, + * and all related widgets have finished their create() cycle, up through postCreate(). + * + * Note that startup() may be called while the widget is still hidden, for example if the widget is + * inside a hidden dijit/Dialog or an unselected tab of a dijit/layout/TabContainer. + * For widgets that need to do layout, it's best to put that layout code inside resize(), and then + * extend dijit/layout/_LayoutWidget so that resize() is called when the widget is visible. + * + */ + startup(): void; + /** + * Deprecated, will be removed in 2.0, use this.own(topic.subscribe()) instead. + * + * Subscribes to the specified topic and calls the specified method + * of this object and registers for unsubscribe() on widget destroy. + * + * Provide widget-specific analog to dojo.subscribe, except with the + * implicit use of this widget as the target object. + * + * @param t The topic + * @param method The callback + */ + subscribe(t: String, method: Function): any; + /** + * Returns a string that represents the widget. + * When a widget is cast to a string, this method will be used to generate the + * output. Currently, it does not implement any sort of reversible + * serialization. + * + */ + toString(): String; + /** + * Deprecated. Override destroy() instead to implement custom widget tear-down + * behavior. + * + */ + uninitialize(): boolean; + /** + * Deprecated, will be removed in 2.0, use handle.remove() instead. + * + * Unsubscribes handle created by this.subscribe. + * Also removes handle from this widget's list of subscriptions + * + * @param handle + */ + unsubscribe(handle: Object): void; + /** + * Watches a property for changes + * + * @param name OptionalIndicates the property to watch. This is optional (the callback may be theonly parameter), and if omitted, all the properties will be watched + * @param callback The function to execute when the property changes. This will be called afterthe property has been changed. The callback will be called with the |this|set to the instance, the first argument as the name of the property, thesecond argument as the old value and the third argument as the new value. + */ + watch(property: string, callback:{(property?:string, oldValue?:any, newValue?: any):void}) :{unwatch():void}; + /** + * Static method to get a template based on the templatePath or + * templateString key + */ + getCachedTemplate(): any; + /** + * Called when the widget stops being "active" because + * focus moved to something outside of it, or the user + * clicked somewhere outside of it, or the widget was + * hidden. + * + */ + onBlur(): void; + /** + * Callback when month is selected from drop down + * + * @param month + */ + onChange(month: number): void; + /** + * Connect to this function to receive notifications of mouse click events. + * + * @param event mouse Event + */ + onClick(event: any): void; + /** + * Called when this widget is being displayed as a popup (ex: a Calendar popped + * up from a DateTextBox), and it is hidden. + * This is called from the dijit.popup code, and should not be called directly. + * + * Also used as a parameter for children of dijit/layout/StackContainer or subclasses. + * Callback if a user tries to close the child. Child will be closed if this function returns true. + * + */ + onClose(): boolean; + /** + * Connect to this function to receive notifications of mouse double click events. + * + * @param event mouse Event + */ + onDblClick(event: any): void; + /** + * Called when the widget becomes "active" because + * it or a widget inside of it either has focus, or has recently + * been clicked. + * + */ + onFocus(): void; + /** + * Called when another widget becomes the selected pane in a + * dijit/layout/TabContainer, dijit/layout/StackContainer, + * dijit/layout/AccordionContainer, etc. + * + * Also called to indicate hide of a dijit.Dialog, dijit.TooltipDialog, or dijit.TitlePane. + * + */ + onHide(): void; + /** + * Connect to this function to receive notifications of keys being pressed down. + * + * @param event key Event + */ + onKeyDown(event: any): void; + /** + * Connect to this function to receive notifications of printable keys being typed. + * + * @param event key Event + */ + onKeyPress(event: any): void; + /** + * Connect to this function to receive notifications of keys being released. + * + * @param event key Event + */ + onKeyUp(event: any): void; + /** + * Connect to this function to receive notifications of when the mouse button is pressed down. + * + * @param event mouse Event + */ + onMouseDown(event: any): void; + /** + * Connect to this function to receive notifications of when the mouse moves onto this widget. + * + * @param event mouse Event + */ + onMouseEnter(event: any): void; + /** + * Connect to this function to receive notifications of when the mouse moves off of this widget. + * + * @param event mouse Event + */ + onMouseLeave(event: any): void; + /** + * Connect to this function to receive notifications of when the mouse moves over nodes contained within this widget. + * + * @param event mouse Event + */ + onMouseMove(event: any): void; + /** + * Connect to this function to receive notifications of when the mouse moves off of nodes contained within this widget. + * + * @param event mouse Event + */ + onMouseOut(event: any): void; + /** + * Connect to this function to receive notifications of when the mouse moves onto nodes contained within this widget. + * + * @param event mouse Event + */ + onMouseOver(event: any): void; + /** + * Connect to this function to receive notifications of when the mouse button is released. + * + * @param event mouse Event + */ + onMouseUp(event: any): void; + /** + * Called when this widget becomes the selected pane in a + * dijit/layout/TabContainer, dijit/layout/StackContainer, + * dijit/layout/AccordionContainer, etc. + * + * Also called to indicate display of a dijit.Dialog, dijit.TooltipDialog, or dijit.TitlePane. + * + */ + onShow(): void; + } + /** + * Permalink: http://dojotoolkit.org/api/1.9/dijit/Calendar._MonthDropDownButton.html + * + * DropDownButton for the current month. Displays name of current month + * and a list of month names in the drop down + * + * @param params Hash of initialization parameters for widget, including scalar values (like title, duration etc.)and functions, typically callbacks like onClick.The hash can contain any of the widget's properties, excluding read-only properties. + * @param srcNodeRef OptionalIf a srcNodeRef (DOM node) is specified:use srcNodeRef.innerHTML as my contentsif this is a behavioral widget then apply behavior to that srcNodeRefotherwise, replace srcNodeRef with my generated DOM tree + */ + class _MonthDropDownButton extends dijit.form.DropDownButton { + constructor(params?: Object, srcNodeRef?: HTMLElement); + /** + * True if mouse was pressed while over this widget, and hasn't been released yet + * + */ + "active": boolean; + set(property:"active", value: boolean): void; + get(property:"active"): boolean; + watch(property:"active", callback:{(property?:string, oldValue?:boolean, newValue?: boolean):void}) :{unwatch():void} + /** + * Corresponds to the native HTML element's attribute. + * + */ + "alt": string; + set(property:"alt", value: string): void; + get(property:"alt"): string; + watch(property:"alt", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * + */ + "aria-label": string; + set(property:"aria-label", value: string): void; + get(property:"aria-label"): string; + watch(property:"aria-label", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * Object to which attach points and events will be scoped. Defaults + * to 'this'. + * + */ + "attachScope": Object; + set(property:"attachScope", value: Object): void; + get(property:"attachScope"): Object; + watch(property:"attachScope", callback:{(property?:string, oldValue?:Object, newValue?: Object):void}) :{unwatch():void} + /** + * Deprecated. Instead of attributeMap, widget should have a _setXXXAttr attribute + * for each XXX attribute to be mapped to the DOM. + * + * attributeMap sets up a "binding" between attributes (aka properties) + * of the widget and the widget's DOM. + * Changes to widget attributes listed in attributeMap will be + * reflected into the DOM. + * + * For example, calling set('title', 'hello') + * on a TitlePane will automatically cause the TitlePane's DOM to update + * with the new title. + * + * attributeMap is a hash where the key is an attribute of the widget, + * and the value reflects a binding to a: + * + * DOM node attribute + * focus: {node: "focusNode", type: "attribute"} + * Maps this.focus to this.focusNode.focus + * + * DOM node innerHTML + * title: { node: "titleNode", type: "innerHTML" } + * Maps this.title to this.titleNode.innerHTML + * + * DOM node innerText + * title: { node: "titleNode", type: "innerText" } + * Maps this.title to this.titleNode.innerText + * + * DOM node CSS class + * myClass: { node: "domNode", type: "class" } + * Maps this.myClass to this.domNode.className + * + * If the value is an array, then each element in the array matches one of the + * formats of the above list. + * + * There are also some shorthands for backwards compatibility: + * + * string --> { node: string, type: "attribute" }, for example: + * "focusNode" ---> { node: "focusNode", type: "attribute" } + * "" --> { node: "domNode", type: "attribute" } + * + */ + "attributeMap": Object; + set(property:"attributeMap", value: Object): void; + get(property:"attributeMap"): Object; + watch(property:"attributeMap", callback:{(property?:string, oldValue?:Object, newValue?: Object):void}) :{unwatch():void} + /** + * Set to true to make the drop down at least as wide as this + * widget. Set to false if the drop down should just be its + * default width. + * + */ + "autoWidth": boolean; + set(property:"autoWidth", value: boolean): void; + get(property:"autoWidth"): boolean; + watch(property:"autoWidth", callback:{(property?:string, oldValue?:boolean, newValue?: boolean):void}) :{unwatch():void} + /** + * + */ + "baseClass": string; + set(property:"baseClass", value: string): void; + get(property:"baseClass"): string; + watch(property:"baseClass", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * + */ + "class": string; + set(property:"class", value: string): void; + get(property:"class"): string; + watch(property:"class", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * Designates where children of the source DOM node will be placed. + * "Children" in this case refers to both DOM nodes and widgets. + * For example, for myWidget: + * + *
+ * here's a plain DOM node + * and a widget + * and another plain DOM node + *
+ * containerNode would point to: + * + * here's a plain DOM node + * and a widget + * and another plain DOM node + * In templated widgets, "containerNode" is set via a + * data-dojo-attach-point assignment. + * + * containerNode must be defined for any widget that accepts innerHTML + * (like ContentPane or BorderContainer or even Button), and conversely + * is null for widgets that don't, like TextBox. + * + */ + "containerNode": HTMLElement; + set(property:"containerNode", value: HTMLElement): void; + get(property:"containerNode"): HTMLElement; + watch(property:"containerNode", callback:{(property?:string, oldValue?:HTMLElement, newValue?: HTMLElement):void}) :{unwatch():void} + /** + * Subclasses may define a cssStateNodes property that lists sub-nodes within the widget that + * need CSS classes applied on mouse hover/press and focus. + * + * Each entry in this optional hash is a an attach-point name (like "upArrowButton") mapped to a CSS class name + * (like "dijitUpArrowButton"). Example: + * + * { + * "upArrowButton": "dijitUpArrowButton", + * "downArrowButton": "dijitDownArrowButton" + * } + * The above will set the CSS class dijitUpArrowButton to the this.upArrowButton DOMNode when it + * + * is hovered, etc. + * + */ + "cssStateNodes": Object; + set(property:"cssStateNodes", value: Object): void; + get(property:"cssStateNodes"): Object; + watch(property:"cssStateNodes", callback:{(property?:string, oldValue?:Object, newValue?: Object):void}) :{unwatch():void} + /** + * Bi-directional support, as defined by the HTML DIR + * attribute. Either left-to-right "ltr" or right-to-left "rtl". If undefined, widgets renders in page's + * default direction. + * + */ + "dir": string; + set(property:"dir", value: string): void; + get(property:"dir"): string; + watch(property:"dir", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * Should this widget respond to user input? + * In markup, this is specified as "disabled='disabled'", or just "disabled". + * + */ + "disabled": boolean; + set(property:"disabled", value: boolean): void; + get(property:"disabled"): boolean; + watch(property:"disabled", callback:{(property?:string, oldValue?:boolean, newValue?: boolean):void}) :{unwatch():void} + /** + * This is our visible representation of the widget! Other DOM + * Nodes may by assigned to other properties, usually through the + * template system's data-dojo-attach-point syntax, but the domNode + * property is the canonical "top level" node in widget UI. + * + */ + "domNode": HTMLElement; + set(property:"domNode", value: HTMLElement): void; + get(property:"domNode"): HTMLElement; + watch(property:"domNode", callback:{(property?:string, oldValue?:HTMLElement, newValue?: HTMLElement):void}) :{unwatch():void} + /** + * The widget to display as a popup. This widget must be + * defined before the startup function is called. + * + */ + "dropDown": Object; + set(property:"dropDown", value: Object): void; + get(property:"dropDown"): Object; + watch(property:"dropDown", callback:{(property?:string, oldValue?:Object, newValue?: Object):void}) :{unwatch():void} + /** + * This variable controls the position of the drop down. + * It's an array of strings with the following values: + * + * before: places drop down to the left of the target node/widget, or to the right in + * the case of RTL scripts like Hebrew and Arabic + * after: places drop down to the right of the target node/widget, or to the left in + * the case of RTL scripts like Hebrew and Arabic + * above: drop down goes above target node + * below: drop down goes below target node + * The list is positions is tried, in order, until a position is found where the drop down fits + * within the viewport. + * + */ + "dropDownPosition": Object; + set(property:"dropDownPosition", value: Object): void; + get(property:"dropDownPosition"): Object; + watch(property:"dropDownPosition", callback:{(property?:string, oldValue?:Object, newValue?: Object):void}) :{unwatch():void} + /** + * This widget or a widget it contains has focus, or is "active" because + * it was recently clicked. + * + */ + "focused": boolean; + set(property:"focused", value: boolean): void; + get(property:"focused"): boolean; + watch(property:"focused", callback:{(property?:string, oldValue?:boolean, newValue?: boolean):void}) :{unwatch():void} + /** + * Set to true to make the drop down exactly as wide as this + * widget. Overrides autoWidth. + * + */ + "forceWidth": boolean; + set(property:"forceWidth", value: boolean): void; + get(property:"forceWidth"): boolean; + watch(property:"forceWidth", callback:{(property?:string, oldValue?:boolean, newValue?: boolean):void}) :{unwatch():void} + /** + * True if cursor is over this widget + * + */ + "hovering": boolean; + set(property:"hovering", value: boolean): void; + get(property:"hovering"): boolean; + watch(property:"hovering", callback:{(property?:string, oldValue?:boolean, newValue?: boolean):void}) :{unwatch():void} + /** + * Class to apply to DOMNode in button to make it display an icon + * + */ + "iconClass": string; + set(property:"iconClass", value: string): void; + get(property:"iconClass"): string; + watch(property:"iconClass", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * A unique, opaque ID string that can be assigned by users or by the + * system. If the developer passes an ID which is known not to be + * unique, the specified ID is ignored and the system-generated ID is + * used instead. + * + */ + "id": string; + set(property:"id", value: string): void; + get(property:"id"): string; + watch(property:"id", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * Fires onChange for each value change or only on demand + * + */ + "intermediateChanges": boolean; + set(property:"intermediateChanges", value: boolean): void; + get(property:"intermediateChanges"): boolean; + watch(property:"intermediateChanges", callback:{(property?:string, oldValue?:boolean, newValue?: boolean):void}) :{unwatch():void} + /** + * Content to display in button. + * + */ + "label": string; + set(property:"label", value: string): void; + get(property:"label"): string; + watch(property:"label", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * Rarely used. Overrides the default Dojo locale used to render this widget, + * as defined by the HTML LANG attribute. + * Value must be among the list of locales specified during by the Dojo bootstrap, + * formatted according to RFC 3066 (like en-us). + * + */ + "lang": string; + set(property:"lang", value: string): void; + get(property:"lang"): string; + watch(property:"lang", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * The max height for our dropdown. + * Any dropdown taller than this will have scrollbars. + * Set to 0 for no max height, or -1 to limit height to available space in viewport + * + */ + "maxHeight": number; + set(property:"maxHeight", value: number): void; + get(property:"maxHeight"): number; + watch(property:"maxHeight", callback:{(property?:string, oldValue?:number, newValue?: number):void}) :{unwatch():void} + /** + * Name used when submitting form; same as "name" attribute or plain HTML elements + * + */ + "name": string; + set(property:"name", value: string): void; + get(property:"name"): string; + watch(property:"name", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * The document this widget belongs to. If not specified to constructor, will default to + * srcNodeRef.ownerDocument, or if no sourceRef specified, then to the document global + * + */ + "ownerDocument": Object; + set(property:"ownerDocument", value: Object): void; + get(property:"ownerDocument"): Object; + watch(property:"ownerDocument", callback:{(property?:string, oldValue?:Object, newValue?: Object):void}) :{unwatch():void} + /** + * On focus, should this widget scroll into view? + * + */ + "scrollOnFocus": boolean; + set(property:"scrollOnFocus", value: boolean): void; + get(property:"scrollOnFocus"): boolean; + watch(property:"scrollOnFocus", callback:{(property?:string, oldValue?:boolean, newValue?: boolean):void}) :{unwatch():void} + /** + * + */ + "searchContainerNode": boolean; + set(property:"searchContainerNode", value: boolean): void; + get(property:"searchContainerNode"): boolean; + watch(property:"searchContainerNode", callback:{(property?:string, oldValue?:boolean, newValue?: boolean):void}) :{unwatch():void} + /** + * Set this to true to hide the label text and display only the icon. + * (If showLabel=false then iconClass must be specified.) + * Especially useful for toolbars. + * If showLabel=true, the label will become the title (a.k.a. tooltip/hint) of the icon. + * + * The exception case is for computers in high-contrast mode, where the label + * will still be displayed, since the icon doesn't appear. + * + */ + "showLabel": boolean; + set(property:"showLabel", value: boolean): void; + get(property:"showLabel"): boolean; + watch(property:"showLabel", callback:{(property?:string, oldValue?:boolean, newValue?: boolean):void}) :{unwatch():void} + /** + * pointer to original DOM node + * + */ + "srcNodeRef": HTMLElement; + set(property:"srcNodeRef", value: HTMLElement): void; + get(property:"srcNodeRef"): HTMLElement; + watch(property:"srcNodeRef", callback:{(property?:string, oldValue?:HTMLElement, newValue?: HTMLElement):void}) :{unwatch():void} + /** + * HTML style attributes as cssText string or name/value hash + * + */ + "style": string; + set(property:"style", value: string): void; + get(property:"style"): string; + watch(property:"style", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * Order fields are traversed when user hits the tab key + * + */ + "tabIndex": string; + set(property:"tabIndex", value: string): void; + get(property:"tabIndex"): string; + watch(property:"tabIndex", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * Path to template (HTML file) for this widget relative to dojo.baseUrl. + * Deprecated: use templateString with require([... "dojo/text!..."], ...) instead + * + */ + "templatePath": string; + set(property:"templatePath", value: string): void; + get(property:"templatePath"): string; + watch(property:"templatePath", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * + */ + "templateString": string; + set(property:"templateString", value: string): void; + get(property:"templateString"): string; + watch(property:"templateString", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * HTML title attribute. + * + * For form widgets this specifies a tooltip to display when hovering over + * the widget (just like the native HTML title attribute). + * + * For TitlePane or for when this widget is a child of a TabContainer, AccordionContainer, + * etc., it's used to specify the tab label, accordion pane title, etc. In this case it's + * interpreted as HTML. + * + */ + "title": string; + set(property:"title", value: string): void; + get(property:"title"): string; + watch(property:"title", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * When this widget's title attribute is used to for a tab label, accordion pane title, etc., + * this specifies the tooltip to appear when the mouse is hovered over that text. + * + */ + "tooltip": string; + set(property:"tooltip", value: string): void; + get(property:"tooltip"): string; + watch(property:"tooltip", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * Corresponds to the native HTML element's attribute. + * + */ + "type": string; + set(property:"type", value: string): void; + get(property:"type"): string; + watch(property:"type", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * Corresponds to the native HTML element's attribute. + * + */ + "value": string; + set(property:"value", value: string): void; + get(property:"value"): string; + watch(property:"value", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * Makes the given widget a child of this widget. + * Inserts specified child widget's dom node as a child of this widget's + * container node, and possibly does other processing (such as layout). + * + * @param widget + * @param insertIndex Optional + */ + addChild(widget: dijit._WidgetBase, insertIndex: number): void; + /** + * This method is deprecated, use get() or set() directly. + * + * @param name The property to get or set. If an object is passed here and nota string, its keys are used as names of attributes to be setand the value of the object as values to set in the widget. + * @param value OptionalOptional. If provided, attr() operates as a setter. If omitted,the current value of the named property is returned. + */ + attr(name: String, value: Object): any; + /** + * This method is deprecated, use get() or set() directly. + * + * @param name The property to get or set. If an object is passed here and nota string, its keys are used as names of attributes to be setand the value of the object as values to set in the widget. + * @param value OptionalOptional. If provided, attr() operates as a setter. If omitted,the current value of the named property is returned. + */ + attr(name: Object, value: Object): any; + /** + * Construct the UI for this widget, setting this.domNode. + * Most widgets will mixin dijit._TemplatedMixin, which implements this method. + * + */ + buildRendering(): void; + /** + * Closes the drop down on this widget + * + * @param focus If true, refocuses the button widget + */ + closeDropDown(focus: boolean): void; + /** + * Compare 2 values (as returned by get('value') for this widget). + * + * @param val1 + * @param val2 + */ + compare(val1: any, val2: any): number; + /** + * Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead. + * + * Connects specified obj/event to specified method of this object + * and registers for disconnect() on widget destroy. + * + * Provide widget-specific analog to dojo.connect, except with the + * implicit use of this widget as the target object. + * Events connected with this.connect are disconnected upon + * destruction. + * + * @param obj + * @param event + * @param method + */ + connect(obj: Object, event: String, method: String): any; + /** + * Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead. + * + * Connects specified obj/event to specified method of this object + * and registers for disconnect() on widget destroy. + * + * Provide widget-specific analog to dojo.connect, except with the + * implicit use of this widget as the target object. + * Events connected with this.connect are disconnected upon + * destruction. + * + * @param obj + * @param event + * @param method + */ + connect(obj: any, event: String, method: String): any; + /** + * Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead. + * + * Connects specified obj/event to specified method of this object + * and registers for disconnect() on widget destroy. + * + * Provide widget-specific analog to dojo.connect, except with the + * implicit use of this widget as the target object. + * Events connected with this.connect are disconnected upon + * destruction. + * + * @param obj + * @param event + * @param method + */ + connect(obj: Object, event: Function, method: String): any; + /** + * Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead. + * + * Connects specified obj/event to specified method of this object + * and registers for disconnect() on widget destroy. + * + * Provide widget-specific analog to dojo.connect, except with the + * implicit use of this widget as the target object. + * Events connected with this.connect are disconnected upon + * destruction. + * + * @param obj + * @param event + * @param method + */ + connect(obj: any, event: Function, method: String): any; + /** + * Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead. + * + * Connects specified obj/event to specified method of this object + * and registers for disconnect() on widget destroy. + * + * Provide widget-specific analog to dojo.connect, except with the + * implicit use of this widget as the target object. + * Events connected with this.connect are disconnected upon + * destruction. + * + * @param obj + * @param event + * @param method + */ + connect(obj: Object, event: String, method: Function): any; + /** + * Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead. + * + * Connects specified obj/event to specified method of this object + * and registers for disconnect() on widget destroy. + * + * Provide widget-specific analog to dojo.connect, except with the + * implicit use of this widget as the target object. + * Events connected with this.connect are disconnected upon + * destruction. + * + * @param obj + * @param event + * @param method + */ + connect(obj: any, event: String, method: Function): any; + /** + * Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead. + * + * Connects specified obj/event to specified method of this object + * and registers for disconnect() on widget destroy. + * + * Provide widget-specific analog to dojo.connect, except with the + * implicit use of this widget as the target object. + * Events connected with this.connect are disconnected upon + * destruction. + * + * @param obj + * @param event + * @param method + */ + connect(obj: Object, event: Function, method: Function): any; + /** + * Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead. + * + * Connects specified obj/event to specified method of this object + * and registers for disconnect() on widget destroy. + * + * Provide widget-specific analog to dojo.connect, except with the + * implicit use of this widget as the target object. + * Events connected with this.connect are disconnected upon + * destruction. + * + * @param obj + * @param event + * @param method + */ + connect(obj: any, event: Function, method: Function): any; + /** + * Wrapper to setTimeout to avoid deferred functions executing + * after the originating widget has been destroyed. + * Returns an object handle with a remove method (that returns null) (replaces clearTimeout). + * + * @param fcn Function reference. + * @param delay OptionalDelay, defaults to 0. + */ + defer(fcn: Function, delay: number): Object; + /** + * Destroy this widget, but not its descendants. Descendants means widgets inside of + * this.containerNode. Will also destroy any resources (including widgets) registered via this.own(). + * + * This method will also destroy internal widgets such as those created from a template, + * assuming those widgets exist inside of this.domNode but outside of this.containerNode. + * + * For 2.0 it's planned that this method will also destroy descendant widgets, so apps should not + * depend on the current ability to destroy a widget without destroying its descendants. Generally + * they should use destroyRecursive() for widgets with children. + * + * @param preserveDom If true, this method will leave the original DOM structure alone.Note: This will not yet work with _TemplatedMixin widgets + */ + destroy(preserveDom?: boolean): void; + /** + * Recursively destroy the children of this widget and their + * descendants. + * + * @param preserveDom OptionalIf true, the preserveDom attribute is passed to all descendantwidget's .destroy() method. Not for use with _Templatedwidgets. + */ + destroyDescendants(preserveDom?: boolean): void; + /** + * Destroy this widget and its descendants + * This is the generic "destructor" function that all widget users + * should call to cleanly discard with a widget. Once a widget is + * destroyed, it is removed from the manager object. + * + * @param preserveDom OptionalIf true, this method will leave the original DOM structurealone of descendant Widgets. Note: This will NOT work withdijit._TemplatedMixin widgets. + */ + destroyRecursive(preserveDom?: boolean): void; + /** + * Destroys the DOM nodes associated with this widget. + * + * @param preserveDom OptionalIf true, this method will leave the original DOM structure aloneduring tear-down. Note: this will not work with _Templatedwidgets yet. + */ + destroyRendering(preserveDom?: boolean): void; + /** + * Deprecated, will be removed in 2.0, use handle.remove() instead. + * + * Disconnects handle created by connect. + * + * @param handle + */ + disconnect(handle: any): void; + /** + * Used by widgets to signal that a synthetic event occurred, ex: + * + * myWidget.emit("attrmodified-selectedChildWidget", {}). + * Emits an event on this.domNode named type.toLowerCase(), based on eventObj. + * Also calls onType() method, if present, and returns value from that method. + * By default passes eventObj to callback, but will pass callbackArgs instead, if specified. + * Modifies eventObj by adding missing parameters (bubbles, cancelable, widget). + * + * @param type + * @param eventObj Optional + * @param callbackArgs Optional + */ + emit(type: String, eventObj: Object, callbackArgs: any[]): any; + /** + * Put focus on this widget + * + */ + focus(): void; + /** + * Get a property from a widget. + * Get a named property from a widget. The property may + * potentially be retrieved via a getter method. If no getter is defined, this + * just retrieves the object's property. + * + * For example, if the widget has properties foo and bar + * and a method named _getFooAttr(), calling: + * myWidget.get("foo") would be equivalent to calling + * widget._getFooAttr() and myWidget.get("bar") + * would be equivalent to the expression + * widget.bar2 + * + * @param name The property to get. + */ + get(name: any): any; + /** + * Returns all direct children of this widget, i.e. all widgets underneath this.containerNode whose parent + * is this widget. Note that it does not return all descendants, but rather just direct children. + * Analogous to Node.childNodes, + * except containing widgets rather than DOMNodes. + * + * The result intentionally excludes internally created widgets (a.k.a. supporting widgets) + * outside of this.containerNode. + * + * Note that the array returned is a simple array. Application code should not assume + * existence of methods like forEach(). + * + */ + getChildren(): any[]; + /** + * Returns all the widgets contained by this, i.e., all widgets underneath this.containerNode. + * This method should generally be avoided as it returns widgets declared in templates, which are + * supposed to be internal/hidden, but it's left here for back-compat reasons. + * + */ + getDescendants(): any[]; + /** + * Gets the index of the child in this container or -1 if not found + * + * @param child + */ + getIndexOfChild(child: dijit._WidgetBase): any; + /** + * Returns the parent widget of this widget. + * + */ + getParent(): any; + /** + * Deprecated. Use get('value') instead. + * + */ + getValue(): any; + /** + * Returns true if widget has child widgets, i.e. if this.containerNode contains widgets. + * + */ + hasChildren(): boolean; + /** + * + */ + isFocusable(): any; + /** + * Return this widget's explicit or implicit orientation (true for LTR, false for RTL) + * + */ + isLeftToRight(): any; + /** + * + */ + isLoaded(): boolean; + /** + * Creates the drop down if it doesn't exist, loads the data + * if there's an href and it hasn't been loaded yet, and + * then opens the drop down. This is basically a callback when the + * user presses the down arrow button to open the drop down. + * + */ + loadAndOpenDropDown(): any; + /** + * + * @param callback + */ + loadDropDown(callback: Function): void; + /** + * + * @param type protected + * @param func + */ + on(type: String, func: Function): any; + /** + * + * @param type protected + * @param func + */ + on(type: Function, func: Function): any; + /** + * Opens the dropdown for this widget. To be called only when this.dropDown + * has been created and is ready to display (ie, it's data is loaded). + * + */ + openDropDown(): any; + /** + * Track specified handles and remove/destroy them when this instance is destroyed, unless they were + * already removed/destroyed manually. + * + */ + own(): any; + /** + * Place this widget somewhere in the DOM based + * on standard domConstruct.place() conventions. + * A convenience function provided in all _Widgets, providing a simple + * shorthand mechanism to put an existing (or newly created) Widget + * somewhere in the dom, and allow chaining. + * + * @param reference Widget, DOMNode, or id of widget or DOMNode + * @param position OptionalIf reference is a widget (or id of widget), and that widget has an ".addChild" method,it will be called passing this widget instance into that method, supplying the optionalposition index passed. In this case position (if specified) should be an integer.If reference is a DOMNode (or id matching a DOMNode but not a widget),the position argument can be a numeric index or a string"first", "last", "before", or "after", same as dojo/dom-construct::place(). + */ + placeAt(reference: String, position: String): any; + /** + * Place this widget somewhere in the DOM based + * on standard domConstruct.place() conventions. + * A convenience function provided in all _Widgets, providing a simple + * shorthand mechanism to put an existing (or newly created) Widget + * somewhere in the dom, and allow chaining. + * + * @param reference Widget, DOMNode, or id of widget or DOMNode + * @param position OptionalIf reference is a widget (or id of widget), and that widget has an ".addChild" method,it will be called passing this widget instance into that method, supplying the optionalposition index passed. In this case position (if specified) should be an integer.If reference is a DOMNode (or id matching a DOMNode but not a widget),the position argument can be a numeric index or a string"first", "last", "before", or "after", same as dojo/dom-construct::place(). + */ + placeAt(reference: HTMLElement, position: String): any; + /** + * Place this widget somewhere in the DOM based + * on standard domConstruct.place() conventions. + * A convenience function provided in all _Widgets, providing a simple + * shorthand mechanism to put an existing (or newly created) Widget + * somewhere in the dom, and allow chaining. + * + * @param reference Widget, DOMNode, or id of widget or DOMNode + * @param position OptionalIf reference is a widget (or id of widget), and that widget has an ".addChild" method,it will be called passing this widget instance into that method, supplying the optionalposition index passed. In this case position (if specified) should be an integer.If reference is a DOMNode (or id matching a DOMNode but not a widget),the position argument can be a numeric index or a string"first", "last", "before", or "after", same as dojo/dom-construct::place(). + */ + placeAt(reference: dijit._WidgetBase, position: String): any; + /** + * Place this widget somewhere in the DOM based + * on standard domConstruct.place() conventions. + * A convenience function provided in all _Widgets, providing a simple + * shorthand mechanism to put an existing (or newly created) Widget + * somewhere in the dom, and allow chaining. + * + * @param reference Widget, DOMNode, or id of widget or DOMNode + * @param position OptionalIf reference is a widget (or id of widget), and that widget has an ".addChild" method,it will be called passing this widget instance into that method, supplying the optionalposition index passed. In this case position (if specified) should be an integer.If reference is a DOMNode (or id matching a DOMNode but not a widget),the position argument can be a numeric index or a string"first", "last", "before", or "after", same as dojo/dom-construct::place(). + */ + placeAt(reference: String, position: number): any; + /** + * Place this widget somewhere in the DOM based + * on standard domConstruct.place() conventions. + * A convenience function provided in all _Widgets, providing a simple + * shorthand mechanism to put an existing (or newly created) Widget + * somewhere in the dom, and allow chaining. + * + * @param reference Widget, DOMNode, or id of widget or DOMNode + * @param position OptionalIf reference is a widget (or id of widget), and that widget has an ".addChild" method,it will be called passing this widget instance into that method, supplying the optionalposition index passed. In this case position (if specified) should be an integer.If reference is a DOMNode (or id matching a DOMNode but not a widget),the position argument can be a numeric index or a string"first", "last", "before", or "after", same as dojo/dom-construct::place(). + */ + placeAt(reference: HTMLElement, position: number): any; + /** + * Place this widget somewhere in the DOM based + * on standard domConstruct.place() conventions. + * A convenience function provided in all _Widgets, providing a simple + * shorthand mechanism to put an existing (or newly created) Widget + * somewhere in the dom, and allow chaining. + * + * @param reference Widget, DOMNode, or id of widget or DOMNode + * @param position OptionalIf reference is a widget (or id of widget), and that widget has an ".addChild" method,it will be called passing this widget instance into that method, supplying the optionalposition index passed. In this case position (if specified) should be an integer.If reference is a DOMNode (or id matching a DOMNode but not a widget),the position argument can be a numeric index or a string"first", "last", "before", or "after", same as dojo/dom-construct::place(). + */ + placeAt(reference: dijit._WidgetBase, position: number): any; + /** + * + */ + postCreate(): void; + /** + * + */ + postMixInProperties(): void; + /** + * Removes the passed widget instance from this widget but does + * not destroy it. You can also pass in an integer indicating + * the index within the container to remove (ie, removeChild(5) removes the sixth widget). + * + * @param widget + */ + removeChild(widget: dijit._WidgetBase): void; + /** + * Removes the passed widget instance from this widget but does + * not destroy it. You can also pass in an integer indicating + * the index within the container to remove (ie, removeChild(5) removes the sixth widget). + * + * @param widget + */ + removeChild(widget: number): void; + /** + * Set a property on a widget + * Sets named properties on a widget which may potentially be handled by a + * setter in the widget. + * + * For example, if the widget has properties foo and bar + * and a method named _setFooAttr(), calling + * myWidget.set("foo", "Howdy!") would be equivalent to calling + * widget._setFooAttr("Howdy!") and myWidget.set("bar", 3) + * would be equivalent to the statement widget.bar = 3; + * + * set() may also be called with a hash of name/value pairs, ex: + * + * myWidget.set({ + * foo: "Howdy", + * bar: 3 + * }); + * This is equivalent to calling set(foo, "Howdy") and set(bar, 3) + * + * @param name The property to set. + * @param value The value to set in the property. + */ + set(name: any, value: any): any; + /** + * Deprecated. Use set() instead. + * + * @param attr + * @param value + */ + setAttribute(attr: String, value: any): void; + /** + * Deprecated. Use set('disabled', ...) instead. + * + * @param disabled + */ + setDisabled(disabled: boolean): void; + /** + * Deprecated. Use set('label', ...) instead. + * + * @param content + */ + setLabel(content: String): void; + /** + * Deprecated. Use set('value', ...) instead. + * + * @param value + */ + setValue(value: String): void; + /** + * + */ + startup(): void; + /** + * Deprecated, will be removed in 2.0, use this.own(topic.subscribe()) instead. + * + * Subscribes to the specified topic and calls the specified method + * of this object and registers for unsubscribe() on widget destroy. + * + * Provide widget-specific analog to dojo.subscribe, except with the + * implicit use of this widget as the target object. + * + * @param t The topic + * @param method The callback + */ + subscribe(t: String, method: Function): any; + /** + * Callback when the user presses the down arrow button or presses + * the down arrow key to open/close the drop down. + * Toggle the drop-down widget; if it is up, close it, if not, open it + * + */ + toggleDropDown(): void; + /** + * Returns a string that represents the widget. + * When a widget is cast to a string, this method will be used to generate the + * output. Currently, it does not implement any sort of reversible + * serialization. + * + */ + toString(): String; + /** + * Deprecated. Override destroy() instead to implement custom widget tear-down + * behavior. + * + */ + uninitialize(): boolean; + /** + * Deprecated, will be removed in 2.0, use handle.remove() instead. + * + * Unsubscribes handle created by this.subscribe. + * Also removes handle from this widget's list of subscriptions + * + * @param handle + */ + unsubscribe(handle: Object): void; + /** + * Watches a property for changes + * + * @param name OptionalIndicates the property to watch. This is optional (the callback may be theonly parameter), and if omitted, all the properties will be watched + * @param callback The function to execute when the property changes. This will be called afterthe property has been changed. The callback will be called with the |this|set to the instance, the first argument as the name of the property, thesecond argument as the old value and the third argument as the new value. + */ + watch(property: string, callback:{(property?:string, oldValue?:any, newValue?: any):void}) :{unwatch():void}; + /** + * Static method to get a template based on the templatePath or + * templateString key + */ + getCachedTemplate(): any; + /** + * Called when the widget stops being "active" because + * focus moved to something outside of it, or the user + * clicked somewhere outside of it, or the widget was + * hidden. + * + */ + onBlur(): void; + /** + * Callback when this widget's value is changed. + * + * @param newValue + */ + onChange(newValue: any): void; + /** + * Connect to this function to receive notifications of mouse click events. + * + * @param event mouse Event + */ + onClick(event: any): boolean; + /** + * Called when this widget is being displayed as a popup (ex: a Calendar popped + * up from a DateTextBox), and it is hidden. + * This is called from the dijit.popup code, and should not be called directly. + * + * Also used as a parameter for children of dijit/layout/StackContainer or subclasses. + * Callback if a user tries to close the child. Child will be closed if this function returns true. + * + */ + onClose(): boolean; + /** + * Connect to this function to receive notifications of mouse double click events. + * + * @param event mouse Event + */ + onDblClick(event: any): void; + /** + * Called when the widget becomes "active" because + * it or a widget inside of it either has focus, or has recently + * been clicked. + * + */ + onFocus(): void; + /** + * Called when another widget becomes the selected pane in a + * dijit/layout/TabContainer, dijit/layout/StackContainer, + * dijit/layout/AccordionContainer, etc. + * + * Also called to indicate hide of a dijit.Dialog, dijit.TooltipDialog, or dijit.TitlePane. + * + */ + onHide(): void; + /** + * Connect to this function to receive notifications of keys being pressed down. + * + * @param event key Event + */ + onKeyDown(event: any): void; + /** + * Connect to this function to receive notifications of printable keys being typed. + * + * @param event key Event + */ + onKeyPress(event: any): void; + /** + * Connect to this function to receive notifications of keys being released. + * + * @param event key Event + */ + onKeyUp(event: any): void; + /** + * + */ + onMonthSelect(): void; + /** + * Connect to this function to receive notifications of when the mouse button is pressed down. + * + * @param event mouse Event + */ + onMouseDown(event: any): void; + /** + * Connect to this function to receive notifications of when the mouse moves onto this widget. + * + * @param event mouse Event + */ + onMouseEnter(event: any): void; + /** + * Connect to this function to receive notifications of when the mouse moves off of this widget. + * + * @param event mouse Event + */ + onMouseLeave(event: any): void; + /** + * Connect to this function to receive notifications of when the mouse moves over nodes contained within this widget. + * + * @param event mouse Event + */ + onMouseMove(event: any): void; + /** + * Connect to this function to receive notifications of when the mouse moves off of nodes contained within this widget. + * + * @param event mouse Event + */ + onMouseOut(event: any): void; + /** + * Connect to this function to receive notifications of when the mouse moves onto nodes contained within this widget. + * + * @param event mouse Event + */ + onMouseOver(event: any): void; + /** + * Connect to this function to receive notifications of when the mouse button is released. + * + * @param event mouse Event + */ + onMouseUp(event: any): void; + /** + * Called when this widget becomes the selected pane in a + * dijit/layout/TabContainer, dijit/layout/StackContainer, + * dijit/layout/AccordionContainer, etc. + * + * Also called to indicate display of a dijit.Dialog, dijit.TooltipDialog, or dijit.TitlePane. + * + */ + onShow(): void; + } + } + + /** + * Permalink: http://dojotoolkit.org/api/1.9/dijit/CheckedMenuItem.html + * + * A checkbox-like menu item for toggling on and off + * + * @param params Hash of initialization parameters for widget, including scalar values (like title, duration etc.)and functions, typically callbacks like onClick.The hash can contain any of the widget's properties, excluding read-only properties. + * @param srcNodeRef OptionalIf a srcNodeRef (DOM node) is specified:use srcNodeRef.innerHTML as my contentsif this is a behavioral widget then apply behavior to that srcNodeRefotherwise, replace srcNodeRef with my generated DOM tree + */ + class CheckedMenuItem extends dijit.MenuItem { + constructor(params?: Object, srcNodeRef?: HTMLElement); + /** + * Text for the accelerator (shortcut) key combination, a control, alt, etc. modified keystroke meant to + * execute the menu item regardless of where the focus is on the page. + * + * Note that although Menu can display accelerator keys, there is no infrastructure to actually catch and + * execute those accelerators. + * + */ + "accelKey": string; + set(property:"accelKey", value: string): void; + get(property:"accelKey"): string; + watch(property:"accelKey", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * True if mouse was pressed while over this widget, and hasn't been released yet + * + */ + "active": boolean; + set(property:"active", value: boolean): void; + get(property:"active"): boolean; + watch(property:"active", callback:{(property?:string, oldValue?:boolean, newValue?: boolean):void}) :{unwatch():void} + /** + * Object to which attach points and events will be scoped. Defaults + * to 'this'. + * + */ + "attachScope": Object; + set(property:"attachScope", value: Object): void; + get(property:"attachScope"): Object; + watch(property:"attachScope", callback:{(property?:string, oldValue?:Object, newValue?: Object):void}) :{unwatch():void} + /** + * Deprecated. Instead of attributeMap, widget should have a _setXXXAttr attribute + * for each XXX attribute to be mapped to the DOM. + * + * attributeMap sets up a "binding" between attributes (aka properties) + * of the widget and the widget's DOM. + * Changes to widget attributes listed in attributeMap will be + * reflected into the DOM. + * + * For example, calling set('title', 'hello') + * on a TitlePane will automatically cause the TitlePane's DOM to update + * with the new title. + * + * attributeMap is a hash where the key is an attribute of the widget, + * and the value reflects a binding to a: + * + * DOM node attribute + * focus: {node: "focusNode", type: "attribute"} + * Maps this.focus to this.focusNode.focus + * + * DOM node innerHTML + * title: { node: "titleNode", type: "innerHTML" } + * Maps this.title to this.titleNode.innerHTML + * + * DOM node innerText + * title: { node: "titleNode", type: "innerText" } + * Maps this.title to this.titleNode.innerText + * + * DOM node CSS class + * myClass: { node: "domNode", type: "class" } + * Maps this.myClass to this.domNode.className + * + * If the value is an array, then each element in the array matches one of the + * formats of the above list. + * + * There are also some shorthands for backwards compatibility: + * + * string --> { node: string, type: "attribute" }, for example: + * "focusNode" ---> { node: "focusNode", type: "attribute" } + * "" --> { node: "domNode", type: "attribute" } + * + */ + "attributeMap": Object; + set(property:"attributeMap", value: Object): void; + get(property:"attributeMap"): Object; + watch(property:"attributeMap", callback:{(property?:string, oldValue?:Object, newValue?: Object):void}) :{unwatch():void} + /** + * + */ + "baseClass": string; + set(property:"baseClass", value: string): void; + get(property:"baseClass"): string; + watch(property:"baseClass", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * Our checked state + * + */ + "checked": boolean; + set(property:"checked", value: boolean): void; + get(property:"checked"): boolean; + watch(property:"checked", callback:{(property?:string, oldValue?:boolean, newValue?: boolean):void}) :{unwatch():void} + /** + * Character (or string) used in place of checkbox icon when display in high contrast mode + * + */ + "checkedChar": string; + set(property:"checkedChar", value: string): void; + get(property:"checkedChar"): string; + watch(property:"checkedChar", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * + */ + "class": string; + set(property:"class", value: string): void; + get(property:"class"): string; + watch(property:"class", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * Designates where children of the source DOM node will be placed. + * "Children" in this case refers to both DOM nodes and widgets. + * For example, for myWidget: + * + *
+ * here's a plain DOM node + * and a widget + * and another plain DOM node + *
+ * containerNode would point to: + * + * here's a plain DOM node + * and a widget + * and another plain DOM node + * In templated widgets, "containerNode" is set via a + * data-dojo-attach-point assignment. + * + * containerNode must be defined for any widget that accepts innerHTML + * (like ContentPane or BorderContainer or even Button), and conversely + * is null for widgets that don't, like TextBox. + * + */ + "containerNode": HTMLElement; + set(property:"containerNode", value: HTMLElement): void; + get(property:"containerNode"): HTMLElement; + watch(property:"containerNode", callback:{(property?:string, oldValue?:HTMLElement, newValue?: HTMLElement):void}) :{unwatch():void} + /** + * Subclasses may define a cssStateNodes property that lists sub-nodes within the widget that + * need CSS classes applied on mouse hover/press and focus. + * + * Each entry in this optional hash is a an attach-point name (like "upArrowButton") mapped to a CSS class name + * (like "dijitUpArrowButton"). Example: + * + * { + * "upArrowButton": "dijitUpArrowButton", + * "downArrowButton": "dijitDownArrowButton" + * } + * The above will set the CSS class dijitUpArrowButton to the this.upArrowButton DOMNode when it + * + * is hovered, etc. + * + */ + "cssStateNodes": Object; + set(property:"cssStateNodes", value: Object): void; + get(property:"cssStateNodes"): Object; + watch(property:"cssStateNodes", callback:{(property?:string, oldValue?:Object, newValue?: Object):void}) :{unwatch():void} + /** + * Bi-directional support, as defined by the HTML DIR + * attribute. Either left-to-right "ltr" or right-to-left "rtl". If undefined, widgets renders in page's + * default direction. + * + */ + "dir": string; + set(property:"dir", value: string): void; + get(property:"dir"): string; + watch(property:"dir", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * If true, the menu item is disabled. + * If false, the menu item is enabled. + * + */ + "disabled": boolean; + set(property:"disabled", value: boolean): void; + get(property:"disabled"): boolean; + watch(property:"disabled", callback:{(property?:string, oldValue?:boolean, newValue?: boolean):void}) :{unwatch():void} + /** + * This is our visible representation of the widget! Other DOM + * Nodes may by assigned to other properties, usually through the + * template system's data-dojo-attach-point syntax, but the domNode + * property is the canonical "top level" node in widget UI. + * + */ + "domNode": HTMLElement; + set(property:"domNode", value: HTMLElement): void; + get(property:"domNode"): HTMLElement; + watch(property:"domNode", callback:{(property?:string, oldValue?:HTMLElement, newValue?: HTMLElement):void}) :{unwatch():void} + /** + * This widget or a widget it contains has focus, or is "active" because + * it was recently clicked. + * + */ + "focused": boolean; + set(property:"focused", value: boolean): void; + get(property:"focused"): boolean; + watch(property:"focused", callback:{(property?:string, oldValue?:boolean, newValue?: boolean):void}) :{unwatch():void} + /** + * True if cursor is over this widget + * + */ + "hovering": boolean; + set(property:"hovering", value: boolean): void; + get(property:"hovering"): boolean; + watch(property:"hovering", callback:{(property?:string, oldValue?:boolean, newValue?: boolean):void}) :{unwatch():void} + /** + * + */ + "iconClass": string; + set(property:"iconClass", value: string): void; + get(property:"iconClass"): string; + watch(property:"iconClass", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * A unique, opaque ID string that can be assigned by users or by the + * system. If the developer passes an ID which is known not to be + * unique, the specified ID is ignored and the system-generated ID is + * used instead. + * + */ + "id": string; + set(property:"id", value: string): void; + get(property:"id"): string; + watch(property:"id", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * Menu text as HTML + * + */ + "label": string; + set(property:"label", value: string): void; + get(property:"label"): string; + watch(property:"label", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * Rarely used. Overrides the default Dojo locale used to render this widget, + * as defined by the HTML LANG attribute. + * Value must be among the list of locales specified during by the Dojo bootstrap, + * formatted according to RFC 3066 (like en-us). + * + */ + "lang": string; + set(property:"lang", value: string): void; + get(property:"lang"): string; + watch(property:"lang", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * The document this widget belongs to. If not specified to constructor, will default to + * srcNodeRef.ownerDocument, or if no sourceRef specified, then to the document global + * + */ + "ownerDocument": Object; + set(property:"ownerDocument", value: Object): void; + get(property:"ownerDocument"): Object; + watch(property:"ownerDocument", callback:{(property?:string, oldValue?:Object, newValue?: Object):void}) :{unwatch():void} + /** + * + */ + "role": string; + set(property:"role", value: string): void; + get(property:"role"): string; + watch(property:"role", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * + */ + "searchContainerNode": boolean; + set(property:"searchContainerNode", value: boolean): void; + get(property:"searchContainerNode"): boolean; + watch(property:"searchContainerNode", callback:{(property?:string, oldValue?:boolean, newValue?: boolean):void}) :{unwatch():void} + /** + * Single character (underlined when the parent Menu is focused) used to navigate directly to this widget, + * also known as a mnemonic. + * This is denoted in the label by surrounding the single character with {}. + * For example, if label="{F}ile", then shortcutKey="F". + * + */ + "shortcutKey": string; + set(property:"shortcutKey", value: string): void; + get(property:"shortcutKey"): string; + watch(property:"shortcutKey", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * pointer to original DOM node + * + */ + "srcNodeRef": HTMLElement; + set(property:"srcNodeRef", value: HTMLElement): void; + get(property:"srcNodeRef"): HTMLElement; + watch(property:"srcNodeRef", callback:{(property?:string, oldValue?:HTMLElement, newValue?: HTMLElement):void}) :{unwatch():void} + /** + * HTML style attributes as cssText string or name/value hash + * + */ + "style": string; + set(property:"style", value: string): void; + get(property:"style"): string; + watch(property:"style", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * Path to template (HTML file) for this widget relative to dojo.baseUrl. + * Deprecated: use templateString with require([... "dojo/text!..."], ...) instead + * + */ + "templatePath": string; + set(property:"templatePath", value: string): void; + get(property:"templatePath"): string; + watch(property:"templatePath", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * + */ + "templateString": string; + set(property:"templateString", value: string): void; + get(property:"templateString"): string; + watch(property:"templateString", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * HTML title attribute. + * + * For form widgets this specifies a tooltip to display when hovering over + * the widget (just like the native HTML title attribute). + * + * For TitlePane or for when this widget is a child of a TabContainer, AccordionContainer, + * etc., it's used to specify the tab label, accordion pane title, etc. In this case it's + * interpreted as HTML. + * + */ + "title": string; + set(property:"title", value: string): void; + get(property:"title"): string; + watch(property:"title", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * When this widget's title attribute is used to for a tab label, accordion pane title, etc., + * this specifies the tooltip to appear when the mouse is hovered over that text. + * + */ + "tooltip": string; + set(property:"tooltip", value: string): void; + get(property:"tooltip"): string; + watch(property:"tooltip", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * This method is deprecated, use get() or set() directly. + * + * @param name The property to get or set. If an object is passed here and nota string, its keys are used as names of attributes to be setand the value of the object as values to set in the widget. + * @param value OptionalOptional. If provided, attr() operates as a setter. If omitted,the current value of the named property is returned. + */ + attr(name: String, value: Object): any; + /** + * This method is deprecated, use get() or set() directly. + * + * @param name The property to get or set. If an object is passed here and nota string, its keys are used as names of attributes to be setand the value of the object as values to set in the widget. + * @param value OptionalOptional. If provided, attr() operates as a setter. If omitted,the current value of the named property is returned. + */ + attr(name: Object, value: Object): any; + /** + * + */ + buildRendering(): void; + /** + * Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead. + * + * Connects specified obj/event to specified method of this object + * and registers for disconnect() on widget destroy. + * + * Provide widget-specific analog to dojo.connect, except with the + * implicit use of this widget as the target object. + * Events connected with this.connect are disconnected upon + * destruction. + * + * @param obj + * @param event + * @param method + */ + connect(obj: Object, event: String, method: String): any; + /** + * Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead. + * + * Connects specified obj/event to specified method of this object + * and registers for disconnect() on widget destroy. + * + * Provide widget-specific analog to dojo.connect, except with the + * implicit use of this widget as the target object. + * Events connected with this.connect are disconnected upon + * destruction. + * + * @param obj + * @param event + * @param method + */ + connect(obj: any, event: String, method: String): any; + /** + * Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead. + * + * Connects specified obj/event to specified method of this object + * and registers for disconnect() on widget destroy. + * + * Provide widget-specific analog to dojo.connect, except with the + * implicit use of this widget as the target object. + * Events connected with this.connect are disconnected upon + * destruction. + * + * @param obj + * @param event + * @param method + */ + connect(obj: Object, event: Function, method: String): any; + /** + * Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead. + * + * Connects specified obj/event to specified method of this object + * and registers for disconnect() on widget destroy. + * + * Provide widget-specific analog to dojo.connect, except with the + * implicit use of this widget as the target object. + * Events connected with this.connect are disconnected upon + * destruction. + * + * @param obj + * @param event + * @param method + */ + connect(obj: any, event: Function, method: String): any; + /** + * Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead. + * + * Connects specified obj/event to specified method of this object + * and registers for disconnect() on widget destroy. + * + * Provide widget-specific analog to dojo.connect, except with the + * implicit use of this widget as the target object. + * Events connected with this.connect are disconnected upon + * destruction. + * + * @param obj + * @param event + * @param method + */ + connect(obj: Object, event: String, method: Function): any; + /** + * Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead. + * + * Connects specified obj/event to specified method of this object + * and registers for disconnect() on widget destroy. + * + * Provide widget-specific analog to dojo.connect, except with the + * implicit use of this widget as the target object. + * Events connected with this.connect are disconnected upon + * destruction. + * + * @param obj + * @param event + * @param method + */ + connect(obj: any, event: String, method: Function): any; + /** + * Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead. + * + * Connects specified obj/event to specified method of this object + * and registers for disconnect() on widget destroy. + * + * Provide widget-specific analog to dojo.connect, except with the + * implicit use of this widget as the target object. + * Events connected with this.connect are disconnected upon + * destruction. + * + * @param obj + * @param event + * @param method + */ + connect(obj: Object, event: Function, method: Function): any; + /** + * Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead. + * + * Connects specified obj/event to specified method of this object + * and registers for disconnect() on widget destroy. + * + * Provide widget-specific analog to dojo.connect, except with the + * implicit use of this widget as the target object. + * Events connected with this.connect are disconnected upon + * destruction. + * + * @param obj + * @param event + * @param method + */ + connect(obj: any, event: Function, method: Function): any; + /** + * Wrapper to setTimeout to avoid deferred functions executing + * after the originating widget has been destroyed. + * Returns an object handle with a remove method (that returns null) (replaces clearTimeout). + * + * @param fcn Function reference. + * @param delay OptionalDelay, defaults to 0. + */ + defer(fcn: Function, delay: number): Object; + /** + * Destroy this widget, but not its descendants. Descendants means widgets inside of + * this.containerNode. Will also destroy any resources (including widgets) registered via this.own(). + * + * This method will also destroy internal widgets such as those created from a template, + * assuming those widgets exist inside of this.domNode but outside of this.containerNode. + * + * For 2.0 it's planned that this method will also destroy descendant widgets, so apps should not + * depend on the current ability to destroy a widget without destroying its descendants. Generally + * they should use destroyRecursive() for widgets with children. + * + * @param preserveDom If true, this method will leave the original DOM structure alone.Note: This will not yet work with _TemplatedMixin widgets + */ + destroy(preserveDom?: boolean): void; + /** + * Recursively destroy the children of this widget and their + * descendants. + * + * @param preserveDom OptionalIf true, the preserveDom attribute is passed to all descendantwidget's .destroy() method. Not for use with _Templatedwidgets. + */ + destroyDescendants(preserveDom?: boolean): void; + /** + * Destroy this widget and its descendants + * This is the generic "destructor" function that all widget users + * should call to cleanly discard with a widget. Once a widget is + * destroyed, it is removed from the manager object. + * + * @param preserveDom OptionalIf true, this method will leave the original DOM structurealone of descendant Widgets. Note: This will NOT work withdijit._TemplatedMixin widgets. + */ + destroyRecursive(preserveDom?: boolean): void; + /** + * Destroys the DOM nodes associated with this widget. + * + * @param preserveDom OptionalIf true, this method will leave the original DOM structure aloneduring tear-down. Note: this will not work with _Templatedwidgets yet. + */ + destroyRendering(preserveDom?: boolean): void; + /** + * Deprecated, will be removed in 2.0, use handle.remove() instead. + * + * Disconnects handle created by connect. + * + * @param handle + */ + disconnect(handle: any): void; + /** + * Used by widgets to signal that a synthetic event occurred, ex: + * + * myWidget.emit("attrmodified-selectedChildWidget", {}). + * Emits an event on this.domNode named type.toLowerCase(), based on eventObj. + * Also calls onType() method, if present, and returns value from that method. + * By default passes eventObj to callback, but will pass callbackArgs instead, if specified. + * Modifies eventObj by adding missing parameters (bubbles, cancelable, widget). + * + * @param type + * @param eventObj Optional + * @param callbackArgs Optional + */ + emit(type: String, eventObj: Object, callbackArgs: any[]): any; + /** + * Focus on this MenuItem + * + */ + focus(): void; + /** + * Get a property from a widget. + * Get a named property from a widget. The property may + * potentially be retrieved via a getter method. If no getter is defined, this + * just retrieves the object's property. + * + * For example, if the widget has properties foo and bar + * and a method named _getFooAttr(), calling: + * myWidget.get("foo") would be equivalent to calling + * widget._getFooAttr() and myWidget.get("bar") + * would be equivalent to the expression + * widget.bar2 + * + * @param name The property to get. + */ + get(name: any): any; + /** + * Returns all direct children of this widget, i.e. all widgets underneath this.containerNode whose parent + * is this widget. Note that it does not return all descendants, but rather just direct children. + * Analogous to Node.childNodes, + * except containing widgets rather than DOMNodes. + * + * The result intentionally excludes internally created widgets (a.k.a. supporting widgets) + * outside of this.containerNode. + * + * Note that the array returned is a simple array. Application code should not assume + * existence of methods like forEach(). + * + */ + getChildren(): any[]; + /** + * Returns all the widgets contained by this, i.e., all widgets underneath this.containerNode. + * This method should generally be avoided as it returns widgets declared in templates, which are + * supposed to be internal/hidden, but it's left here for back-compat reasons. + * + */ + getDescendants(): any[]; + /** + * Returns the index of this widget within its container parent. + * It returns -1 if the parent does not exist, or if the parent + * is not a dijit/_Container + * + */ + getIndexInParent(): any; + /** + * Returns null if this is the last child of the parent, + * otherwise returns the next element sibling to the "right". + * + */ + getNextSibling(): any; + /** + * Returns the parent widget of this widget. + * + */ + getParent(): any; + /** + * Returns null if this is the first child of the parent, + * otherwise returns the next element sibling to the "left". + * + */ + getPreviousSibling(): any; + /** + * Return true if this widget can currently be focused + * and false if not + * + */ + isFocusable(): any; + /** + * Return this widget's explicit or implicit orientation (true for LTR, false for RTL) + * + */ + isLeftToRight(): any; + /** + * + * @param type protected + * @param func + */ + on(type: String, func: Function): any; + /** + * + * @param type protected + * @param func + */ + on(type: Function, func: Function): any; + /** + * Track specified handles and remove/destroy them when this instance is destroyed, unless they were + * already removed/destroyed manually. + * + */ + own(): any; + /** + * Place this widget somewhere in the DOM based + * on standard domConstruct.place() conventions. + * A convenience function provided in all _Widgets, providing a simple + * shorthand mechanism to put an existing (or newly created) Widget + * somewhere in the dom, and allow chaining. + * + * @param reference Widget, DOMNode, or id of widget or DOMNode + * @param position OptionalIf reference is a widget (or id of widget), and that widget has an ".addChild" method,it will be called passing this widget instance into that method, supplying the optionalposition index passed. In this case position (if specified) should be an integer.If reference is a DOMNode (or id matching a DOMNode but not a widget),the position argument can be a numeric index or a string"first", "last", "before", or "after", same as dojo/dom-construct::place(). + */ + placeAt(reference: String, position: String): any; + /** + * Place this widget somewhere in the DOM based + * on standard domConstruct.place() conventions. + * A convenience function provided in all _Widgets, providing a simple + * shorthand mechanism to put an existing (or newly created) Widget + * somewhere in the dom, and allow chaining. + * + * @param reference Widget, DOMNode, or id of widget or DOMNode + * @param position OptionalIf reference is a widget (or id of widget), and that widget has an ".addChild" method,it will be called passing this widget instance into that method, supplying the optionalposition index passed. In this case position (if specified) should be an integer.If reference is a DOMNode (or id matching a DOMNode but not a widget),the position argument can be a numeric index or a string"first", "last", "before", or "after", same as dojo/dom-construct::place(). + */ + placeAt(reference: HTMLElement, position: String): any; + /** + * Place this widget somewhere in the DOM based + * on standard domConstruct.place() conventions. + * A convenience function provided in all _Widgets, providing a simple + * shorthand mechanism to put an existing (or newly created) Widget + * somewhere in the dom, and allow chaining. + * + * @param reference Widget, DOMNode, or id of widget or DOMNode + * @param position OptionalIf reference is a widget (or id of widget), and that widget has an ".addChild" method,it will be called passing this widget instance into that method, supplying the optionalposition index passed. In this case position (if specified) should be an integer.If reference is a DOMNode (or id matching a DOMNode but not a widget),the position argument can be a numeric index or a string"first", "last", "before", or "after", same as dojo/dom-construct::place(). + */ + placeAt(reference: dijit._WidgetBase, position: String): any; + /** + * Place this widget somewhere in the DOM based + * on standard domConstruct.place() conventions. + * A convenience function provided in all _Widgets, providing a simple + * shorthand mechanism to put an existing (or newly created) Widget + * somewhere in the dom, and allow chaining. + * + * @param reference Widget, DOMNode, or id of widget or DOMNode + * @param position OptionalIf reference is a widget (or id of widget), and that widget has an ".addChild" method,it will be called passing this widget instance into that method, supplying the optionalposition index passed. In this case position (if specified) should be an integer.If reference is a DOMNode (or id matching a DOMNode but not a widget),the position argument can be a numeric index or a string"first", "last", "before", or "after", same as dojo/dom-construct::place(). + */ + placeAt(reference: String, position: number): any; + /** + * Place this widget somewhere in the DOM based + * on standard domConstruct.place() conventions. + * A convenience function provided in all _Widgets, providing a simple + * shorthand mechanism to put an existing (or newly created) Widget + * somewhere in the dom, and allow chaining. + * + * @param reference Widget, DOMNode, or id of widget or DOMNode + * @param position OptionalIf reference is a widget (or id of widget), and that widget has an ".addChild" method,it will be called passing this widget instance into that method, supplying the optionalposition index passed. In this case position (if specified) should be an integer.If reference is a DOMNode (or id matching a DOMNode but not a widget),the position argument can be a numeric index or a string"first", "last", "before", or "after", same as dojo/dom-construct::place(). + */ + placeAt(reference: HTMLElement, position: number): any; + /** + * Place this widget somewhere in the DOM based + * on standard domConstruct.place() conventions. + * A convenience function provided in all _Widgets, providing a simple + * shorthand mechanism to put an existing (or newly created) Widget + * somewhere in the dom, and allow chaining. + * + * @param reference Widget, DOMNode, or id of widget or DOMNode + * @param position OptionalIf reference is a widget (or id of widget), and that widget has an ".addChild" method,it will be called passing this widget instance into that method, supplying the optionalposition index passed. In this case position (if specified) should be an integer.If reference is a DOMNode (or id matching a DOMNode but not a widget),the position argument can be a numeric index or a string"first", "last", "before", or "after", same as dojo/dom-construct::place(). + */ + placeAt(reference: dijit._WidgetBase, position: number): any; + /** + * + */ + postCreate(): void; + /** + * Called after the parameters to the widget have been read-in, + * but before the widget template is instantiated. Especially + * useful to set properties that are referenced in the widget + * template. + * + */ + postMixInProperties(): void; + /** + * Set a property on a widget + * Sets named properties on a widget which may potentially be handled by a + * setter in the widget. + * + * For example, if the widget has properties foo and bar + * and a method named _setFooAttr(), calling + * myWidget.set("foo", "Howdy!") would be equivalent to calling + * widget._setFooAttr("Howdy!") and myWidget.set("bar", 3) + * would be equivalent to the statement widget.bar = 3; + * + * set() may also be called with a hash of name/value pairs, ex: + * + * myWidget.set({ + * foo: "Howdy", + * bar: 3 + * }); + * This is equivalent to calling set(foo, "Howdy") and set(bar, 3) + * + * @param name The property to set. + * @param value The value to set in the property. + */ + set(name: any, value: any): any; + /** + * Deprecated. Use set() instead. + * + * @param attr + * @param value + */ + setAttribute(attr: String, value: any): void; + /** + * Deprecated. Use set('disabled', bool) instead. + * + * @param disabled + */ + setDisabled(disabled: boolean): void; + /** + * Deprecated. Use set('label', ...) instead. + * + * @param content + */ + setLabel(content: String): void; + /** + * Processing after the DOM fragment is added to the document + * Called after a widget and its children have been created and added to the page, + * and all related widgets have finished their create() cycle, up through postCreate(). + * + * Note that startup() may be called while the widget is still hidden, for example if the widget is + * inside a hidden dijit/Dialog or an unselected tab of a dijit/layout/TabContainer. + * For widgets that need to do layout, it's best to put that layout code inside resize(), and then + * extend dijit/layout/_LayoutWidget so that resize() is called when the widget is visible. + * + */ + startup(): void; + /** + * Deprecated, will be removed in 2.0, use this.own(topic.subscribe()) instead. + * + * Subscribes to the specified topic and calls the specified method + * of this object and registers for unsubscribe() on widget destroy. + * + * Provide widget-specific analog to dojo.subscribe, except with the + * implicit use of this widget as the target object. + * + * @param t The topic + * @param method The callback + */ + subscribe(t: String, method: Function): any; + /** + * Returns a string that represents the widget. + * When a widget is cast to a string, this method will be used to generate the + * output. Currently, it does not implement any sort of reversible + * serialization. + * + */ + toString(): String; + /** + * Deprecated. Override destroy() instead to implement custom widget tear-down + * behavior. + * + */ + uninitialize(): boolean; + /** + * Deprecated, will be removed in 2.0, use handle.remove() instead. + * + * Unsubscribes handle created by this.subscribe. + * Also removes handle from this widget's list of subscriptions + * + * @param handle + */ + unsubscribe(handle: Object): void; + /** + * Watches a property for changes + * + * @param name OptionalIndicates the property to watch. This is optional (the callback may be theonly parameter), and if omitted, all the properties will be watched + * @param callback The function to execute when the property changes. This will be called afterthe property has been changed. The callback will be called with the |this|set to the instance, the first argument as the name of the property, thesecond argument as the old value and the third argument as the new value. + */ + watch(property: string, callback:{(property?:string, oldValue?:any, newValue?: any):void}) :{unwatch():void}; + /** + * Static method to get a template based on the templatePath or + * templateString key + */ + getCachedTemplate(): any; + /** + * Called when the widget stops being "active" because + * focus moved to something outside of it, or the user + * clicked somewhere outside of it, or the widget was + * hidden. + * + */ + onBlur(): void; + /** + * User defined function to handle check/uncheck events + * + * @param checked + */ + onChange(checked: boolean): void; + /** + * User defined function to handle clicks + * + */ + onClick(): void; + /** + * Called when this widget is being displayed as a popup (ex: a Calendar popped + * up from a DateTextBox), and it is hidden. + * This is called from the dijit.popup code, and should not be called directly. + * + * Also used as a parameter for children of dijit/layout/StackContainer or subclasses. + * Callback if a user tries to close the child. Child will be closed if this function returns true. + * + */ + onClose(): boolean; + /** + * Connect to this function to receive notifications of mouse double click events. + * + * @param event mouse Event + */ + onDblClick(event: any): void; + /** + * Called when the widget becomes "active" because + * it or a widget inside of it either has focus, or has recently + * been clicked. + * + */ + onFocus(): void; + /** + * Called when another widget becomes the selected pane in a + * dijit/layout/TabContainer, dijit/layout/StackContainer, + * dijit/layout/AccordionContainer, etc. + * + * Also called to indicate hide of a dijit.Dialog, dijit.TooltipDialog, or dijit.TitlePane. + * + */ + onHide(): void; + /** + * Connect to this function to receive notifications of keys being pressed down. + * + * @param event key Event + */ + onKeyDown(event: any): void; + /** + * Connect to this function to receive notifications of printable keys being typed. + * + * @param event key Event + */ + onKeyPress(event: any): void; + /** + * Connect to this function to receive notifications of keys being released. + * + * @param event key Event + */ + onKeyUp(event: any): void; + /** + * Connect to this function to receive notifications of when the mouse button is pressed down. + * + * @param event mouse Event + */ + onMouseDown(event: any): void; + /** + * Connect to this function to receive notifications of when the mouse moves onto this widget. + * + * @param event mouse Event + */ + onMouseEnter(event: any): void; + /** + * Connect to this function to receive notifications of when the mouse moves off of this widget. + * + * @param event mouse Event + */ + onMouseLeave(event: any): void; + /** + * Connect to this function to receive notifications of when the mouse moves over nodes contained within this widget. + * + * @param event mouse Event + */ + onMouseMove(event: any): void; + /** + * Connect to this function to receive notifications of when the mouse moves off of nodes contained within this widget. + * + * @param event mouse Event + */ + onMouseOut(event: any): void; + /** + * Connect to this function to receive notifications of when the mouse moves onto nodes contained within this widget. + * + * @param event mouse Event + */ + onMouseOver(event: any): void; + /** + * Connect to this function to receive notifications of when the mouse button is released. + * + * @param event mouse Event + */ + onMouseUp(event: any): void; + /** + * Called when this widget becomes the selected pane in a + * dijit/layout/TabContainer, dijit/layout/StackContainer, + * dijit/layout/AccordionContainer, etc. + * + * Also called to indicate display of a dijit.Dialog, dijit.TooltipDialog, or dijit.TitlePane. + * + */ + onShow(): void; + } + /** + * Permalink: http://dojotoolkit.org/api/1.9/dijit/DialogUnderlay.html + * + * A component used to block input behind a dijit/Dialog. + * + * Normally this class should not be instantiated directly, but rather shown and hidden via + * DialogUnderlay.show() and DialogUnderlay.hide(). And usually the module is not accessed directly + * at all, since the underlay is shown and hidden by Dialog.DialogLevelManager. + * + * The underlay itself can be styled based on and id: + * + * #myDialog_underlay { background-color:red; } + * In the case of dijit.Dialog, this id is based on the id of the Dialog, + * suffixed with _underlay. + * + * @param params Hash of initialization parameters for widget, including scalar values (like title, duration etc.)and functions, typically callbacks like onClick.The hash can contain any of the widget's properties, excluding read-only properties. + * @param srcNodeRef OptionalIf a srcNodeRef (DOM node) is specified:use srcNodeRef.innerHTML as my contentsif this is a behavioral widget then apply behavior to that srcNodeRefotherwise, replace srcNodeRef with my generated DOM tree + */ + class DialogUnderlay extends dijit._Widget implements dijit._TemplatedMixin { + constructor(params?: Object, srcNodeRef?: HTMLElement); + /** + * Object to which attach points and events will be scoped. Defaults + * to 'this'. + * + */ + "attachScope": Object; + set(property:"attachScope", value: Object): void; + get(property:"attachScope"): Object; + watch(property:"attachScope", callback:{(property?:string, oldValue?:Object, newValue?: Object):void}) :{unwatch():void} + /** + * Deprecated. Instead of attributeMap, widget should have a _setXXXAttr attribute + * for each XXX attribute to be mapped to the DOM. + * + * attributeMap sets up a "binding" between attributes (aka properties) + * of the widget and the widget's DOM. + * Changes to widget attributes listed in attributeMap will be + * reflected into the DOM. + * + * For example, calling set('title', 'hello') + * on a TitlePane will automatically cause the TitlePane's DOM to update + * with the new title. + * + * attributeMap is a hash where the key is an attribute of the widget, + * and the value reflects a binding to a: + * + * DOM node attribute + * focus: {node: "focusNode", type: "attribute"} + * Maps this.focus to this.focusNode.focus + * + * DOM node innerHTML + * title: { node: "titleNode", type: "innerHTML" } + * Maps this.title to this.titleNode.innerHTML + * + * DOM node innerText + * title: { node: "titleNode", type: "innerText" } + * Maps this.title to this.titleNode.innerText + * + * DOM node CSS class + * myClass: { node: "domNode", type: "class" } + * Maps this.myClass to this.domNode.className + * + * If the value is an array, then each element in the array matches one of the + * formats of the above list. + * + * There are also some shorthands for backwards compatibility: + * + * string --> { node: string, type: "attribute" }, for example: + * "focusNode" ---> { node: "focusNode", type: "attribute" } + * "" --> { node: "domNode", type: "attribute" } + * + */ + "attributeMap": Object; + set(property:"attributeMap", value: Object): void; + get(property:"attributeMap"): Object; + watch(property:"attributeMap", callback:{(property?:string, oldValue?:Object, newValue?: Object):void}) :{unwatch():void} + /** + * Root CSS class of the widget (ex: dijitTextBox), used to construct CSS classes to indicate + * widget state. + * + */ + "baseClass": string; + set(property:"baseClass", value: string): void; + get(property:"baseClass"): string; + watch(property:"baseClass", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * + */ + "class": string; + set(property:"class", value: string): void; + get(property:"class"): string; + watch(property:"class", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * Designates where children of the source DOM node will be placed. + * "Children" in this case refers to both DOM nodes and widgets. + * For example, for myWidget: + * + *
+ * here's a plain DOM node + * and a widget + * and another plain DOM node + *
+ * containerNode would point to: + * + * here's a plain DOM node + * and a widget + * and another plain DOM node + * In templated widgets, "containerNode" is set via a + * data-dojo-attach-point assignment. + * + * containerNode must be defined for any widget that accepts innerHTML + * (like ContentPane or BorderContainer or even Button), and conversely + * is null for widgets that don't, like TextBox. + * + */ + "containerNode": HTMLElement; + set(property:"containerNode", value: HTMLElement): void; + get(property:"containerNode"): HTMLElement; + watch(property:"containerNode", callback:{(property?:string, oldValue?:HTMLElement, newValue?: HTMLElement):void}) :{unwatch():void} + /** + * Id of the dialog.... DialogUnderlay's id is based on this id + * + */ + "dialogId": string; + set(property:"dialogId", value: string): void; + get(property:"dialogId"): string; + watch(property:"dialogId", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * Bi-directional support, as defined by the HTML DIR + * attribute. Either left-to-right "ltr" or right-to-left "rtl". If undefined, widgets renders in page's + * default direction. + * + */ + "dir": string; + set(property:"dir", value: string): void; + get(property:"dir"): string; + watch(property:"dir", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * This is our visible representation of the widget! Other DOM + * Nodes may by assigned to other properties, usually through the + * template system's data-dojo-attach-point syntax, but the domNode + * property is the canonical "top level" node in widget UI. + * + */ + "domNode": HTMLElement; + set(property:"domNode", value: HTMLElement): void; + get(property:"domNode"): HTMLElement; + watch(property:"domNode", callback:{(property?:string, oldValue?:HTMLElement, newValue?: HTMLElement):void}) :{unwatch():void} + /** + * This widget or a widget it contains has focus, or is "active" because + * it was recently clicked. + * + */ + "focused": boolean; + set(property:"focused", value: boolean): void; + get(property:"focused"): boolean; + watch(property:"focused", callback:{(property?:string, oldValue?:boolean, newValue?: boolean):void}) :{unwatch():void} + /** + * A unique, opaque ID string that can be assigned by users or by the + * system. If the developer passes an ID which is known not to be + * unique, the specified ID is ignored and the system-generated ID is + * used instead. + * + */ + "id": string; + set(property:"id", value: string): void; + get(property:"id"): string; + watch(property:"id", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * Rarely used. Overrides the default Dojo locale used to render this widget, + * as defined by the HTML LANG attribute. + * Value must be among the list of locales specified during by the Dojo bootstrap, + * formatted according to RFC 3066 (like en-us). + * + */ + "lang": string; + set(property:"lang", value: string): void; + get(property:"lang"): string; + watch(property:"lang", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * The document this widget belongs to. If not specified to constructor, will default to + * srcNodeRef.ownerDocument, or if no sourceRef specified, then to the document global + * + */ + "ownerDocument": Object; + set(property:"ownerDocument", value: Object): void; + get(property:"ownerDocument"): Object; + watch(property:"ownerDocument", callback:{(property?:string, oldValue?:Object, newValue?: Object):void}) :{unwatch():void} + /** + * + */ + "searchContainerNode": boolean; + set(property:"searchContainerNode", value: boolean): void; + get(property:"searchContainerNode"): boolean; + watch(property:"searchContainerNode", callback:{(property?:string, oldValue?:boolean, newValue?: boolean):void}) :{unwatch():void} + /** + * pointer to original DOM node + * + */ + "srcNodeRef": HTMLElement; + set(property:"srcNodeRef", value: HTMLElement): void; + get(property:"srcNodeRef"): HTMLElement; + watch(property:"srcNodeRef", callback:{(property?:string, oldValue?:HTMLElement, newValue?: HTMLElement):void}) :{unwatch():void} + /** + * HTML style attributes as cssText string or name/value hash + * + */ + "style": string; + set(property:"style", value: string): void; + get(property:"style"): string; + watch(property:"style", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * Path to template (HTML file) for this widget relative to dojo.baseUrl. + * Deprecated: use templateString with require([... "dojo/text!..."], ...) instead + * + */ + "templatePath": string; + set(property:"templatePath", value: string): void; + get(property:"templatePath"): string; + watch(property:"templatePath", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * + */ + "templateString": string; + set(property:"templateString", value: string): void; + get(property:"templateString"): string; + watch(property:"templateString", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * HTML title attribute. + * + * For form widgets this specifies a tooltip to display when hovering over + * the widget (just like the native HTML title attribute). + * + * For TitlePane or for when this widget is a child of a TabContainer, AccordionContainer, + * etc., it's used to specify the tab label, accordion pane title, etc. In this case it's + * interpreted as HTML. + * + */ + "title": string; + set(property:"title", value: string): void; + get(property:"title"): string; + watch(property:"title", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * When this widget's title attribute is used to for a tab label, accordion pane title, etc., + * this specifies the tooltip to appear when the mouse is hovered over that text. + * + */ + "tooltip": string; + set(property:"tooltip", value: string): void; + get(property:"tooltip"): string; + watch(property:"tooltip", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * This method is deprecated, use get() or set() directly. + * + * @param name The property to get or set. If an object is passed here and nota string, its keys are used as names of attributes to be setand the value of the object as values to set in the widget. + * @param value OptionalOptional. If provided, attr() operates as a setter. If omitted,the current value of the named property is returned. + */ + attr(name: String, value: Object): any; + /** + * This method is deprecated, use get() or set() directly. + * + * @param name The property to get or set. If an object is passed here and nota string, its keys are used as names of attributes to be setand the value of the object as values to set in the widget. + * @param value OptionalOptional. If provided, attr() operates as a setter. If omitted,the current value of the named property is returned. + */ + attr(name: Object, value: Object): any; + /** + * Construct the UI for this widget, setting this.domNode. + * Most widgets will mixin dijit._TemplatedMixin, which implements this method. + * + */ + buildRendering(): void; + /** + * Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead. + * + * Connects specified obj/event to specified method of this object + * and registers for disconnect() on widget destroy. + * + * Provide widget-specific analog to dojo.connect, except with the + * implicit use of this widget as the target object. + * Events connected with this.connect are disconnected upon + * destruction. + * + * @param obj + * @param event + * @param method + */ + connect(obj: Object, event: String, method: String): any; + /** + * Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead. + * + * Connects specified obj/event to specified method of this object + * and registers for disconnect() on widget destroy. + * + * Provide widget-specific analog to dojo.connect, except with the + * implicit use of this widget as the target object. + * Events connected with this.connect are disconnected upon + * destruction. + * + * @param obj + * @param event + * @param method + */ + connect(obj: any, event: String, method: String): any; + /** + * Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead. + * + * Connects specified obj/event to specified method of this object + * and registers for disconnect() on widget destroy. + * + * Provide widget-specific analog to dojo.connect, except with the + * implicit use of this widget as the target object. + * Events connected with this.connect are disconnected upon + * destruction. + * + * @param obj + * @param event + * @param method + */ + connect(obj: Object, event: Function, method: String): any; + /** + * Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead. + * + * Connects specified obj/event to specified method of this object + * and registers for disconnect() on widget destroy. + * + * Provide widget-specific analog to dojo.connect, except with the + * implicit use of this widget as the target object. + * Events connected with this.connect are disconnected upon + * destruction. + * + * @param obj + * @param event + * @param method + */ + connect(obj: any, event: Function, method: String): any; + /** + * Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead. + * + * Connects specified obj/event to specified method of this object + * and registers for disconnect() on widget destroy. + * + * Provide widget-specific analog to dojo.connect, except with the + * implicit use of this widget as the target object. + * Events connected with this.connect are disconnected upon + * destruction. + * + * @param obj + * @param event + * @param method + */ + connect(obj: Object, event: String, method: Function): any; + /** + * Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead. + * + * Connects specified obj/event to specified method of this object + * and registers for disconnect() on widget destroy. + * + * Provide widget-specific analog to dojo.connect, except with the + * implicit use of this widget as the target object. + * Events connected with this.connect are disconnected upon + * destruction. + * + * @param obj + * @param event + * @param method + */ + connect(obj: any, event: String, method: Function): any; + /** + * Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead. + * + * Connects specified obj/event to specified method of this object + * and registers for disconnect() on widget destroy. + * + * Provide widget-specific analog to dojo.connect, except with the + * implicit use of this widget as the target object. + * Events connected with this.connect are disconnected upon + * destruction. + * + * @param obj + * @param event + * @param method + */ + connect(obj: Object, event: Function, method: Function): any; + /** + * Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead. + * + * Connects specified obj/event to specified method of this object + * and registers for disconnect() on widget destroy. + * + * Provide widget-specific analog to dojo.connect, except with the + * implicit use of this widget as the target object. + * Events connected with this.connect are disconnected upon + * destruction. + * + * @param obj + * @param event + * @param method + */ + connect(obj: any, event: Function, method: Function): any; + /** + * Wrapper to setTimeout to avoid deferred functions executing + * after the originating widget has been destroyed. + * Returns an object handle with a remove method (that returns null) (replaces clearTimeout). + * + * @param fcn Function reference. + * @param delay OptionalDelay, defaults to 0. + */ + defer(fcn: Function, delay: number): Object; + /** + * + */ + destroy(): void; + /** + * Recursively destroy the children of this widget and their + * descendants. + * + * @param preserveDom OptionalIf true, the preserveDom attribute is passed to all descendantwidget's .destroy() method. Not for use with _Templatedwidgets. + */ + destroyDescendants(preserveDom?: boolean): void; + /** + * Destroy this widget and its descendants + * This is the generic "destructor" function that all widget users + * should call to cleanly discard with a widget. Once a widget is + * destroyed, it is removed from the manager object. + * + * @param preserveDom OptionalIf true, this method will leave the original DOM structurealone of descendant Widgets. Note: This will NOT work withdijit._TemplatedMixin widgets. + */ + destroyRecursive(preserveDom?: boolean): void; + /** + * Destroys the DOM nodes associated with this widget. + * + * @param preserveDom OptionalIf true, this method will leave the original DOM structure aloneduring tear-down. Note: this will not work with _Templatedwidgets yet. + */ + destroyRendering(preserveDom?: boolean): void; + /** + * Deprecated, will be removed in 2.0, use handle.remove() instead. + * + * Disconnects handle created by connect. + * + * @param handle + */ + disconnect(handle: any): void; + /** + * Used by widgets to signal that a synthetic event occurred, ex: + * + * myWidget.emit("attrmodified-selectedChildWidget", {}). + * Emits an event on this.domNode named type.toLowerCase(), based on eventObj. + * Also calls onType() method, if present, and returns value from that method. + * By default passes eventObj to callback, but will pass callbackArgs instead, if specified. + * Modifies eventObj by adding missing parameters (bubbles, cancelable, widget). + * + * @param type + * @param eventObj Optional + * @param callbackArgs Optional + */ + emit(type: String, eventObj: Object, callbackArgs: any[]): any; + /** + * Get a property from a widget. + * Get a named property from a widget. The property may + * potentially be retrieved via a getter method. If no getter is defined, this + * just retrieves the object's property. + * + * For example, if the widget has properties foo and bar + * and a method named _getFooAttr(), calling: + * myWidget.get("foo") would be equivalent to calling + * widget._getFooAttr() and myWidget.get("bar") + * would be equivalent to the expression + * widget.bar2 + * + * @param name The property to get. + */ + get(name: any): any; + /** + * Returns all direct children of this widget, i.e. all widgets underneath this.containerNode whose parent + * is this widget. Note that it does not return all descendants, but rather just direct children. + * Analogous to Node.childNodes, + * except containing widgets rather than DOMNodes. + * + * The result intentionally excludes internally created widgets (a.k.a. supporting widgets) + * outside of this.containerNode. + * + * Note that the array returned is a simple array. Application code should not assume + * existence of methods like forEach(). + * + */ + getChildren(): any[]; + /** + * Returns all the widgets contained by this, i.e., all widgets underneath this.containerNode. + * This method should generally be avoided as it returns widgets declared in templates, which are + * supposed to be internal/hidden, but it's left here for back-compat reasons. + * + */ + getDescendants(): any[]; + /** + * Returns the parent widget of this widget. + * + */ + getParent(): any; + /** + * Hide the underlay. + * + */ + hide(): void; + /** + * Return true if this widget can currently be focused + * and false if not + * + */ + isFocusable(): any; + /** + * Return this widget's explicit or implicit orientation (true for LTR, false for RTL) + * + */ + isLeftToRight(): any; + /** + * + * @param type protected + * @param func + */ + on(type: String, func: Function): any; + /** + * + * @param type protected + * @param func + */ + on(type: Function, func: Function): any; + /** + * Track specified handles and remove/destroy them when this instance is destroyed, unless they were + * already removed/destroyed manually. + * + */ + own(): any; + /** + * Place this widget somewhere in the DOM based + * on standard domConstruct.place() conventions. + * A convenience function provided in all _Widgets, providing a simple + * shorthand mechanism to put an existing (or newly created) Widget + * somewhere in the dom, and allow chaining. + * + * @param reference Widget, DOMNode, or id of widget or DOMNode + * @param position OptionalIf reference is a widget (or id of widget), and that widget has an ".addChild" method,it will be called passing this widget instance into that method, supplying the optionalposition index passed. In this case position (if specified) should be an integer.If reference is a DOMNode (or id matching a DOMNode but not a widget),the position argument can be a numeric index or a string"first", "last", "before", or "after", same as dojo/dom-construct::place(). + */ + placeAt(reference: String, position: String): any; + /** + * Place this widget somewhere in the DOM based + * on standard domConstruct.place() conventions. + * A convenience function provided in all _Widgets, providing a simple + * shorthand mechanism to put an existing (or newly created) Widget + * somewhere in the dom, and allow chaining. + * + * @param reference Widget, DOMNode, or id of widget or DOMNode + * @param position OptionalIf reference is a widget (or id of widget), and that widget has an ".addChild" method,it will be called passing this widget instance into that method, supplying the optionalposition index passed. In this case position (if specified) should be an integer.If reference is a DOMNode (or id matching a DOMNode but not a widget),the position argument can be a numeric index or a string"first", "last", "before", or "after", same as dojo/dom-construct::place(). + */ + placeAt(reference: HTMLElement, position: String): any; + /** + * Place this widget somewhere in the DOM based + * on standard domConstruct.place() conventions. + * A convenience function provided in all _Widgets, providing a simple + * shorthand mechanism to put an existing (or newly created) Widget + * somewhere in the dom, and allow chaining. + * + * @param reference Widget, DOMNode, or id of widget or DOMNode + * @param position OptionalIf reference is a widget (or id of widget), and that widget has an ".addChild" method,it will be called passing this widget instance into that method, supplying the optionalposition index passed. In this case position (if specified) should be an integer.If reference is a DOMNode (or id matching a DOMNode but not a widget),the position argument can be a numeric index or a string"first", "last", "before", or "after", same as dojo/dom-construct::place(). + */ + placeAt(reference: dijit._WidgetBase, position: String): any; + /** + * Place this widget somewhere in the DOM based + * on standard domConstruct.place() conventions. + * A convenience function provided in all _Widgets, providing a simple + * shorthand mechanism to put an existing (or newly created) Widget + * somewhere in the dom, and allow chaining. + * + * @param reference Widget, DOMNode, or id of widget or DOMNode + * @param position OptionalIf reference is a widget (or id of widget), and that widget has an ".addChild" method,it will be called passing this widget instance into that method, supplying the optionalposition index passed. In this case position (if specified) should be an integer.If reference is a DOMNode (or id matching a DOMNode but not a widget),the position argument can be a numeric index or a string"first", "last", "before", or "after", same as dojo/dom-construct::place(). + */ + placeAt(reference: String, position: number): any; + /** + * Place this widget somewhere in the DOM based + * on standard domConstruct.place() conventions. + * A convenience function provided in all _Widgets, providing a simple + * shorthand mechanism to put an existing (or newly created) Widget + * somewhere in the dom, and allow chaining. + * + * @param reference Widget, DOMNode, or id of widget or DOMNode + * @param position OptionalIf reference is a widget (or id of widget), and that widget has an ".addChild" method,it will be called passing this widget instance into that method, supplying the optionalposition index passed. In this case position (if specified) should be an integer.If reference is a DOMNode (or id matching a DOMNode but not a widget),the position argument can be a numeric index or a string"first", "last", "before", or "after", same as dojo/dom-construct::place(). + */ + placeAt(reference: HTMLElement, position: number): any; + /** + * Place this widget somewhere in the DOM based + * on standard domConstruct.place() conventions. + * A convenience function provided in all _Widgets, providing a simple + * shorthand mechanism to put an existing (or newly created) Widget + * somewhere in the dom, and allow chaining. + * + * @param reference Widget, DOMNode, or id of widget or DOMNode + * @param position OptionalIf reference is a widget (or id of widget), and that widget has an ".addChild" method,it will be called passing this widget instance into that method, supplying the optionalposition index passed. In this case position (if specified) should be an integer.If reference is a DOMNode (or id matching a DOMNode but not a widget),the position argument can be a numeric index or a string"first", "last", "before", or "after", same as dojo/dom-construct::place(). + */ + placeAt(reference: dijit._WidgetBase, position: number): any; + /** + * + */ + postCreate(): void; + /** + * Called after the parameters to the widget have been read-in, + * but before the widget template is instantiated. Especially + * useful to set properties that are referenced in the widget + * template. + * + */ + postMixInProperties(): void; + /** + * Set a property on a widget + * Sets named properties on a widget which may potentially be handled by a + * setter in the widget. + * + * For example, if the widget has properties foo and bar + * and a method named _setFooAttr(), calling + * myWidget.set("foo", "Howdy!") would be equivalent to calling + * widget._setFooAttr("Howdy!") and myWidget.set("bar", 3) + * would be equivalent to the statement widget.bar = 3; + * + * set() may also be called with a hash of name/value pairs, ex: + * + * myWidget.set({ + * foo: "Howdy", + * bar: 3 + * }); + * This is equivalent to calling set(foo, "Howdy") and set(bar, 3) + * + * @param name The property to set. + * @param value The value to set in the property. + */ + set(name: any, value: any): any; + /** + * Deprecated. Use set() instead. + * + * @param attr + * @param value + */ + setAttribute(attr: String, value: any): void; + /** + * Show the dialog underlay + * + */ + show(): void; + /** + * Display the underlay with the given attributes set. If the underlay is already displayed, + * then adjust it's attributes as specified. + * + * @param attrs The parameters to create DialogUnderlay with. + * @param zIndex zIndex of the underlay + */ + show(attrs: Object, zIndex: number): void; + /** + * Processing after the DOM fragment is added to the document + * Called after a widget and its children have been created and added to the page, + * and all related widgets have finished their create() cycle, up through postCreate(). + * + * Note that startup() may be called while the widget is still hidden, for example if the widget is + * inside a hidden dijit/Dialog or an unselected tab of a dijit/layout/TabContainer. + * For widgets that need to do layout, it's best to put that layout code inside resize(), and then + * extend dijit/layout/_LayoutWidget so that resize() is called when the widget is visible. + * + */ + startup(): void; + /** + * Deprecated, will be removed in 2.0, use this.own(topic.subscribe()) instead. + * + * Subscribes to the specified topic and calls the specified method + * of this object and registers for unsubscribe() on widget destroy. + * + * Provide widget-specific analog to dojo.subscribe, except with the + * implicit use of this widget as the target object. + * + * @param t The topic + * @param method The callback + */ + subscribe(t: String, method: Function): any; + /** + * Returns a string that represents the widget. + * When a widget is cast to a string, this method will be used to generate the + * output. Currently, it does not implement any sort of reversible + * serialization. + * + */ + toString(): String; + /** + * Deprecated. Override destroy() instead to implement custom widget tear-down + * behavior. + * + */ + uninitialize(): boolean; + /** + * Deprecated, will be removed in 2.0, use handle.remove() instead. + * + * Unsubscribes handle created by this.subscribe. + * Also removes handle from this widget's list of subscriptions + * + * @param handle + */ + unsubscribe(handle: Object): void; + /** + * Watches a property for changes + * + * @param name OptionalIndicates the property to watch. This is optional (the callback may be theonly parameter), and if omitted, all the properties will be watched + * @param callback The function to execute when the property changes. This will be called afterthe property has been changed. The callback will be called with the |this|set to the instance, the first argument as the name of the property, thesecond argument as the old value and the third argument as the new value. + */ + watch(property: string, callback:{(property?:string, oldValue?:any, newValue?: any):void}) :{unwatch():void}; + /** + * Static method to get a template based on the templatePath or + * templateString key + */ + getCachedTemplate(): any; + /** + * Called when the widget stops being "active" because + * focus moved to something outside of it, or the user + * clicked somewhere outside of it, or the widget was + * hidden. + * + */ + onBlur(): void; + /** + * Connect to this function to receive notifications of mouse click events. + * + * @param event mouse Event + */ + onClick(event: any): void; + /** + * Called when this widget is being displayed as a popup (ex: a Calendar popped + * up from a DateTextBox), and it is hidden. + * This is called from the dijit.popup code, and should not be called directly. + * + * Also used as a parameter for children of dijit/layout/StackContainer or subclasses. + * Callback if a user tries to close the child. Child will be closed if this function returns true. + * + */ + onClose(): boolean; + /** + * Connect to this function to receive notifications of mouse double click events. + * + * @param event mouse Event + */ + onDblClick(event: any): void; + /** + * Called when the widget becomes "active" because + * it or a widget inside of it either has focus, or has recently + * been clicked. + * + */ + onFocus(): void; + /** + * Called when another widget becomes the selected pane in a + * dijit/layout/TabContainer, dijit/layout/StackContainer, + * dijit/layout/AccordionContainer, etc. + * + * Also called to indicate hide of a dijit.Dialog, dijit.TooltipDialog, or dijit.TitlePane. + * + */ + onHide(): void; + /** + * Connect to this function to receive notifications of keys being pressed down. + * + * @param event key Event + */ + onKeyDown(event: any): void; + /** + * Connect to this function to receive notifications of printable keys being typed. + * + * @param event key Event + */ + onKeyPress(event: any): void; + /** + * Connect to this function to receive notifications of keys being released. + * + * @param event key Event + */ + onKeyUp(event: any): void; + /** + * Connect to this function to receive notifications of when the mouse button is pressed down. + * + * @param event mouse Event + */ + onMouseDown(event: any): void; + /** + * Connect to this function to receive notifications of when the mouse moves onto this widget. + * + * @param event mouse Event + */ + onMouseEnter(event: any): void; + /** + * Connect to this function to receive notifications of when the mouse moves off of this widget. + * + * @param event mouse Event + */ + onMouseLeave(event: any): void; + /** + * Connect to this function to receive notifications of when the mouse moves over nodes contained within this widget. + * + * @param event mouse Event + */ + onMouseMove(event: any): void; + /** + * Connect to this function to receive notifications of when the mouse moves off of nodes contained within this widget. + * + * @param event mouse Event + */ + onMouseOut(event: any): void; + /** + * Connect to this function to receive notifications of when the mouse moves onto nodes contained within this widget. + * + * @param event mouse Event + */ + onMouseOver(event: any): void; + /** + * Connect to this function to receive notifications of when the mouse button is released. + * + * @param event mouse Event + */ + onMouseUp(event: any): void; + /** + * Called when this widget becomes the selected pane in a + * dijit/layout/TabContainer, dijit/layout/StackContainer, + * dijit/layout/AccordionContainer, etc. + * + * Also called to indicate display of a dijit.Dialog, dijit.TooltipDialog, or dijit.TitlePane. + * + */ + onShow(): void; + } + /** + * Permalink: http://dojotoolkit.org/api/1.9/dijit/Dialog.html + * + * A modal dialog Widget. + * Pops up a modal dialog window, blocking access to the screen + * and also graying out the screen Dialog is extended from + * ContentPane so it supports all the same parameters (href, etc.). + * + * @param params Hash of initialization parameters for widget, including scalar values (like title, duration etc.)and functions, typically callbacks like onClick.The hash can contain any of the widget's properties, excluding read-only properties. + * @param srcNodeRef OptionalIf a srcNodeRef (DOM node) is specified:use srcNodeRef.innerHTML as my contentsif this is a behavioral widget then apply behavior to that srcNodeRefotherwise, replace srcNodeRef with my generated DOM tree + */ + class Dialog extends dijit.layout.ContentPane implements dijit._TemplatedMixin, dijit.form._FormMixin, dijit._DialogMixin, dijit._CssStateMixin { + constructor(params?: Object, srcNodeRef?: HTMLElement); + /** + * True if mouse was pressed while over this widget, and hasn't been released yet + * + */ + "active": boolean; + set(property:"active", value: boolean): void; + get(property:"active"): boolean; + watch(property:"active", callback:{(property?:string, oldValue?:boolean, newValue?: boolean):void}) :{unwatch():void} + /** + * Object to which attach points and events will be scoped. Defaults + * to 'this'. + * + */ + "attachScope": Object; + set(property:"attachScope", value: Object): void; + get(property:"attachScope"): Object; + watch(property:"attachScope", callback:{(property?:string, oldValue?:Object, newValue?: Object):void}) :{unwatch():void} + /** + * Deprecated. Instead of attributeMap, widget should have a _setXXXAttr attribute + * for each XXX attribute to be mapped to the DOM. + * + * attributeMap sets up a "binding" between attributes (aka properties) + * of the widget and the widget's DOM. + * Changes to widget attributes listed in attributeMap will be + * reflected into the DOM. + * + * For example, calling set('title', 'hello') + * on a TitlePane will automatically cause the TitlePane's DOM to update + * with the new title. + * + * attributeMap is a hash where the key is an attribute of the widget, + * and the value reflects a binding to a: + * + * DOM node attribute + * focus: {node: "focusNode", type: "attribute"} + * Maps this.focus to this.focusNode.focus + * + * DOM node innerHTML + * title: { node: "titleNode", type: "innerHTML" } + * Maps this.title to this.titleNode.innerHTML + * + * DOM node innerText + * title: { node: "titleNode", type: "innerText" } + * Maps this.title to this.titleNode.innerText + * + * DOM node CSS class + * myClass: { node: "domNode", type: "class" } + * Maps this.myClass to this.domNode.className + * + * If the value is an array, then each element in the array matches one of the + * formats of the above list. + * + * There are also some shorthands for backwards compatibility: + * + * string --> { node: string, type: "attribute" }, for example: + * "focusNode" ---> { node: "focusNode", type: "attribute" } + * "" --> { node: "domNode", type: "attribute" } + * + */ + "attributeMap": Object; + set(property:"attributeMap", value: Object): void; + get(property:"attributeMap"): Object; + watch(property:"attributeMap", callback:{(property?:string, oldValue?:Object, newValue?: Object):void}) :{unwatch():void} + /** + * A Toggle to modify the default focus behavior of a Dialog, which + * is to focus on the first dialog element after opening the dialog. + * False will disable autofocusing. Default: true + * + */ + "autofocus": boolean; + set(property:"autofocus", value: boolean): void; + get(property:"autofocus"): boolean; + watch(property:"autofocus", callback:{(property?:string, oldValue?:boolean, newValue?: boolean):void}) :{unwatch():void} + /** + * + */ + "baseClass": string; + set(property:"baseClass", value: string): void; + get(property:"baseClass"): string; + watch(property:"baseClass", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * + */ + "class": string; + set(property:"class", value: string): void; + get(property:"class"): string; + watch(property:"class", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * Dialog show [x] icon to close itself, and ESC key will close the dialog. + * + */ + "closable": boolean; + set(property:"closable", value: boolean): void; + get(property:"closable"): boolean; + watch(property:"closable", callback:{(property?:string, oldValue?:boolean, newValue?: boolean):void}) :{unwatch():void} + /** + * Designates where children of the source DOM node will be placed. + * "Children" in this case refers to both DOM nodes and widgets. + * For example, for myWidget: + * + *
+ * here's a plain DOM node + * and a widget + * and another plain DOM node + *
+ * containerNode would point to: + * + * here's a plain DOM node + * and a widget + * and another plain DOM node + * In templated widgets, "containerNode" is set via a + * data-dojo-attach-point assignment. + * + * containerNode must be defined for any widget that accepts innerHTML + * (like ContentPane or BorderContainer or even Button), and conversely + * is null for widgets that don't, like TextBox. + * + */ + "containerNode": HTMLElement; + set(property:"containerNode", value: HTMLElement): void; + get(property:"containerNode"): HTMLElement; + watch(property:"containerNode", callback:{(property?:string, oldValue?:HTMLElement, newValue?: HTMLElement):void}) :{unwatch():void} + /** + * The innerHTML of the ContentPane. + * Note that the initialization parameter / argument to set("content", ...) + * can be a String, DomNode, Nodelist, or _Widget. + * + */ + "content": string; + set(property:"content", value: string): void; + get(property:"content"): string; + watch(property:"content", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * + */ + "cssStateNodes": Object; + set(property:"cssStateNodes", value: Object): void; + get(property:"cssStateNodes"): Object; + watch(property:"cssStateNodes", callback:{(property?:string, oldValue?:Object, newValue?: Object):void}) :{unwatch():void} + /** + * Bi-directional support, as defined by the HTML DIR + * attribute. Either left-to-right "ltr" or right-to-left "rtl". If undefined, widgets renders in page's + * default direction. + * + */ + "dir": string; + set(property:"dir", value: string): void; + get(property:"dir"): string; + watch(property:"dir", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * + * false - don't adjust size of children + * true - if there is a single visible child widget, set it's size to however big the ContentPane is + * + */ + "doLayout": boolean; + set(property:"doLayout", value: boolean): void; + get(property:"doLayout"): boolean; + watch(property:"doLayout", callback:{(property?:string, oldValue?:boolean, newValue?: boolean):void}) :{unwatch():void} + /** + * This is our visible representation of the widget! Other DOM + * Nodes may by assigned to other properties, usually through the + * template system's data-dojo-attach-point syntax, but the domNode + * property is the canonical "top level" node in widget UI. + * + */ + "domNode": HTMLElement; + set(property:"domNode", value: HTMLElement): void; + get(property:"domNode"): HTMLElement; + watch(property:"domNode", callback:{(property?:string, oldValue?:HTMLElement, newValue?: HTMLElement):void}) :{unwatch():void} + /** + * Toggles the movable aspect of the Dialog. If true, Dialog + * can be dragged by it's title. If false it will remain centered + * in the viewport. + * + */ + "draggable": boolean; + set(property:"draggable", value: boolean): void; + get(property:"draggable"): boolean; + watch(property:"draggable", callback:{(property?:string, oldValue?:boolean, newValue?: boolean):void}) :{unwatch():void} + /** + * The time in milliseconds it takes the dialog to fade in and out + * + */ + "duration": number; + set(property:"duration", value: number): void; + get(property:"duration"): number; + watch(property:"duration", callback:{(property?:string, oldValue?:number, newValue?: number):void}) :{unwatch():void} + /** + * Message that shows if an error occurs + * + */ + "errorMessage": string; + set(property:"errorMessage", value: string): void; + get(property:"errorMessage"): string; + watch(property:"errorMessage", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * Extract visible content from inside of .... . + * I.e., strip and (and it's contents) from the href + * + */ + "extractContent": boolean; + set(property:"extractContent", value: boolean): void; + get(property:"extractContent"): boolean; + watch(property:"extractContent", callback:{(property?:string, oldValue?:boolean, newValue?: boolean):void}) :{unwatch():void} + /** + * This widget or a widget it contains has focus, or is "active" because + * it was recently clicked. + * + */ + "focused": boolean; + set(property:"focused", value: boolean): void; + get(property:"focused"): boolean; + watch(property:"focused", callback:{(property?:string, oldValue?:boolean, newValue?: boolean):void}) :{unwatch():void} + /** + * True if cursor is over this widget + * + */ + "hovering": boolean; + set(property:"hovering", value: boolean): void; + get(property:"hovering"): boolean; + watch(property:"hovering", callback:{(property?:string, oldValue?:boolean, newValue?: boolean):void}) :{unwatch():void} + /** + * The href of the content that displays now. + * Set this at construction if you want to load data externally when the + * pane is shown. (Set preload=true to load it immediately.) + * Changing href after creation doesn't have any effect; Use set('href', ...); + * + */ + "href": string; + set(property:"href", value: string): void; + get(property:"href"): string; + watch(property:"href", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * A unique, opaque ID string that can be assigned by users or by the + * system. If the developer passes an ID which is known not to be + * unique, the specified ID is ignored and the system-generated ID is + * used instead. + * + */ + "id": string; + set(property:"id", value: string): void; + get(property:"id"): string; + watch(property:"id", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * Parameters to pass to xhrGet() request, for example: + * + *
+ * + */ + "ioArgs": Object; + set(property:"ioArgs", value: Object): void; + get(property:"ioArgs"): Object; + watch(property:"ioArgs", callback:{(property?:string, oldValue?:Object, newValue?: Object):void}) :{unwatch():void} + /** + * Indicates that this widget will call resize() on it's child widgets + * when they become visible. + * + */ + "isLayoutContainer": boolean; + set(property:"isLayoutContainer", value: boolean): void; + get(property:"isLayoutContainer"): boolean; + watch(property:"isLayoutContainer", callback:{(property?:string, oldValue?:boolean, newValue?: boolean):void}) :{unwatch():void} + /** + * True if the ContentPane has data in it, either specified + * during initialization (via href or inline content), or set + * via set('content', ...) / set('href', ...) + * + * False if it doesn't have any content, or if ContentPane is + * still in the process of downloading href. + * + */ + "isLoaded": boolean; + set(property:"isLoaded", value: boolean): void; + get(property:"isLoaded"): boolean; + watch(property:"isLoaded", callback:{(property?:string, oldValue?:boolean, newValue?: boolean):void}) :{unwatch():void} + /** + * Rarely used. Overrides the default Dojo locale used to render this widget, + * as defined by the HTML LANG attribute. + * Value must be among the list of locales specified during by the Dojo bootstrap, + * formatted according to RFC 3066 (like en-us). + * + */ + "lang": string; + set(property:"lang", value: string): void; + get(property:"lang"): string; + watch(property:"lang", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * Message that shows while downloading + * + */ + "loadingMessage": string; + set(property:"loadingMessage", value: string): void; + get(property:"loadingMessage"): string; + watch(property:"loadingMessage", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * Maximum size to allow the dialog to expand to, relative to viewport size + * + */ + "maxRatio": number; + set(property:"maxRatio", value: number): void; + get(property:"maxRatio"): number; + watch(property:"maxRatio", callback:{(property?:string, oldValue?:number, newValue?: number):void}) :{unwatch():void} + /** + * This is the dojo.Deferred returned by set('href', ...) and refresh(). + * Calling onLoadDeferred.then() registers your + * callback to be called only once, when the prior set('href', ...) call or + * the initial href parameter to the constructor finishes loading. + * + * This is different than an onLoad() handler which gets called any time any href + * or content is loaded. + * + */ + "onLoadDeferred": Object; + set(property:"onLoadDeferred", value: Object): void; + get(property:"onLoadDeferred"): Object; + watch(property:"onLoadDeferred", callback:{(property?:string, oldValue?:Object, newValue?: Object):void}) :{unwatch():void} + /** + * True if Dialog is currently displayed on screen. + * + */ + "open": boolean; + set(property:"open", value: boolean): void; + get(property:"open"): boolean; + watch(property:"open", callback:{(property?:string, oldValue?:boolean, newValue?: boolean):void}) :{unwatch():void} + /** + * The document this widget belongs to. If not specified to constructor, will default to + * srcNodeRef.ownerDocument, or if no sourceRef specified, then to the document global + * + */ + "ownerDocument": Object; + set(property:"ownerDocument", value: Object): void; + get(property:"ownerDocument"): Object; + watch(property:"ownerDocument", callback:{(property?:string, oldValue?:Object, newValue?: Object):void}) :{unwatch():void} + /** + * Parse content and create the widgets, if any. + * + */ + "parseOnLoad": boolean; + set(property:"parseOnLoad", value: boolean): void; + get(property:"parseOnLoad"): boolean; + watch(property:"parseOnLoad", callback:{(property?:string, oldValue?:boolean, newValue?: boolean):void}) :{unwatch():void} + /** + * Flag passed to parser. Root for attribute names to search for. If scopeName is dojo, + * will search for data-dojo-type (or dojoType). For backwards compatibility + * reasons defaults to dojo._scopeName (which is "dojo" except when + * multi-version support is used, when it will be something like dojo16, dojo20, etc.) + * + */ + "parserScope": string; + set(property:"parserScope", value: string): void; + get(property:"parserScope"): string; + watch(property:"parserScope", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * Force load of data on initialization even if pane is hidden. + * + */ + "preload": boolean; + set(property:"preload", value: boolean): void; + get(property:"preload"): boolean; + watch(property:"preload", callback:{(property?:string, oldValue?:boolean, newValue?: boolean):void}) :{unwatch():void} + /** + * Prevent caching of data from href's by appending a timestamp to the href. + * + */ + "preventCache": boolean; + set(property:"preventCache", value: boolean): void; + get(property:"preventCache"): boolean; + watch(property:"preventCache", callback:{(property?:string, oldValue?:boolean, newValue?: boolean):void}) :{unwatch():void} + /** + * A Toggle to modify the default focus behavior of a Dialog, which + * is to re-focus the element which had focus before being opened. + * False will disable refocusing. Default: true + * + */ + "refocus": boolean; + set(property:"refocus", value: boolean): void; + get(property:"refocus"): boolean; + watch(property:"refocus", callback:{(property?:string, oldValue?:boolean, newValue?: boolean):void}) :{unwatch():void} + /** + * Refresh (re-download) content when pane goes from hidden to shown + * + */ + "refreshOnShow": boolean; + set(property:"refreshOnShow", value: boolean): void; + get(property:"refreshOnShow"): boolean; + watch(property:"refreshOnShow", callback:{(property?:string, oldValue?:boolean, newValue?: boolean):void}) :{unwatch():void} + /** + * + */ + "searchContainerNode": boolean; + set(property:"searchContainerNode", value: boolean): void; + get(property:"searchContainerNode"): boolean; + watch(property:"searchContainerNode", callback:{(property?:string, oldValue?:boolean, newValue?: boolean):void}) :{unwatch():void} + /** + * pointer to original DOM node + * + */ + "srcNodeRef": HTMLElement; + set(property:"srcNodeRef", value: HTMLElement): void; + get(property:"srcNodeRef"): HTMLElement; + watch(property:"srcNodeRef", callback:{(property?:string, oldValue?:HTMLElement, newValue?: HTMLElement):void}) :{unwatch():void} + /** + * Will be "Error" if one or more of the child widgets has an invalid value, + * "Incomplete" if not all of the required child widgets are filled in. Otherwise, "", + * which indicates that the form is ready to be submitted. + * + */ + "state": string; + set(property:"state", value: string): void; + get(property:"state"): string; + watch(property:"state", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * + */ + "stopParser": boolean; + set(property:"stopParser", value: boolean): void; + get(property:"stopParser"): boolean; + watch(property:"stopParser", callback:{(property?:string, oldValue?:boolean, newValue?: boolean):void}) :{unwatch():void} + /** + * HTML style attributes as cssText string or name/value hash + * + */ + "style": string; + set(property:"style", value: string): void; + get(property:"style"): string; + watch(property:"style", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * Path to template (HTML file) for this widget relative to dojo.baseUrl. + * Deprecated: use templateString with require([... "dojo/text!..."], ...) instead + * + */ + "templatePath": string; + set(property:"templatePath", value: string): void; + get(property:"templatePath"): string; + watch(property:"templatePath", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * + */ + "templateString": string; + set(property:"templateString", value: string): void; + get(property:"templateString"): string; + watch(property:"templateString", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * HTML title attribute. + * + * For form widgets this specifies a tooltip to display when hovering over + * the widget (just like the native HTML title attribute). + * + * For TitlePane or for when this widget is a child of a TabContainer, AccordionContainer, + * etc., it's used to specify the tab label, accordion pane title, etc. In this case it's + * interpreted as HTML. + * + */ + "title": string; + set(property:"title", value: string): void; + get(property:"title"): string; + watch(property:"title", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * When this widget's title attribute is used to for a tab label, accordion pane title, etc., + * this specifies the tooltip to appear when the mouse is hovered over that text. + * + */ + "tooltip": string; + set(property:"tooltip", value: string): void; + get(property:"tooltip"): string; + watch(property:"tooltip", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * Makes the given widget a child of this widget. + * Inserts specified child widget's dom node as a child of this widget's + * container node, and possibly does other processing (such as layout). + * + * @param widget + * @param insertIndex Optional + */ + addChild(widget: dijit._WidgetBase, insertIndex: number): void; + /** + * This method is deprecated, use get() or set() directly. + * + * @param name The property to get or set. If an object is passed here and nota string, its keys are used as names of attributes to be setand the value of the object as values to set in the widget. + * @param value OptionalOptional. If provided, attr() operates as a setter. If omitted,the current value of the named property is returned. + */ + attr(name: String, value: Object): any; + /** + * This method is deprecated, use get() or set() directly. + * + * @param name The property to get or set. If an object is passed here and nota string, its keys are used as names of attributes to be setand the value of the object as values to set in the widget. + * @param value OptionalOptional. If provided, attr() operates as a setter. If omitted,the current value of the named property is returned. + */ + attr(name: Object, value: Object): any; + /** + * + */ + buildRendering(): void; + /** + * Cancels an in-flight download of content + * + */ + cancel(): void; + /** + * Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead. + * + * Connects specified obj/event to specified method of this object + * and registers for disconnect() on widget destroy. + * + * Provide widget-specific analog to dojo.connect, except with the + * implicit use of this widget as the target object. + * Events connected with this.connect are disconnected upon + * destruction. + * + * @param obj + * @param event + * @param method + */ + connect(obj: Object, event: String, method: String): any; + /** + * Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead. + * + * Connects specified obj/event to specified method of this object + * and registers for disconnect() on widget destroy. + * + * Provide widget-specific analog to dojo.connect, except with the + * implicit use of this widget as the target object. + * Events connected with this.connect are disconnected upon + * destruction. + * + * @param obj + * @param event + * @param method + */ + connect(obj: any, event: String, method: String): any; + /** + * Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead. + * + * Connects specified obj/event to specified method of this object + * and registers for disconnect() on widget destroy. + * + * Provide widget-specific analog to dojo.connect, except with the + * implicit use of this widget as the target object. + * Events connected with this.connect are disconnected upon + * destruction. + * + * @param obj + * @param event + * @param method + */ + connect(obj: Object, event: Function, method: String): any; + /** + * Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead. + * + * Connects specified obj/event to specified method of this object + * and registers for disconnect() on widget destroy. + * + * Provide widget-specific analog to dojo.connect, except with the + * implicit use of this widget as the target object. + * Events connected with this.connect are disconnected upon + * destruction. + * + * @param obj + * @param event + * @param method + */ + connect(obj: any, event: Function, method: String): any; + /** + * Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead. + * + * Connects specified obj/event to specified method of this object + * and registers for disconnect() on widget destroy. + * + * Provide widget-specific analog to dojo.connect, except with the + * implicit use of this widget as the target object. + * Events connected with this.connect are disconnected upon + * destruction. + * + * @param obj + * @param event + * @param method + */ + connect(obj: Object, event: String, method: Function): any; + /** + * Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead. + * + * Connects specified obj/event to specified method of this object + * and registers for disconnect() on widget destroy. + * + * Provide widget-specific analog to dojo.connect, except with the + * implicit use of this widget as the target object. + * Events connected with this.connect are disconnected upon + * destruction. + * + * @param obj + * @param event + * @param method + */ + connect(obj: any, event: String, method: Function): any; + /** + * Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead. + * + * Connects specified obj/event to specified method of this object + * and registers for disconnect() on widget destroy. + * + * Provide widget-specific analog to dojo.connect, except with the + * implicit use of this widget as the target object. + * Events connected with this.connect are disconnected upon + * destruction. + * + * @param obj + * @param event + * @param method + */ + connect(obj: Object, event: Function, method: Function): any; + /** + * Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead. + * + * Connects specified obj/event to specified method of this object + * and registers for disconnect() on widget destroy. + * + * Provide widget-specific analog to dojo.connect, except with the + * implicit use of this widget as the target object. + * Events connected with this.connect are disconnected upon + * destruction. + * + * @param obj + * @param event + * @param method + */ + connect(obj: any, event: Function, method: Function): any; + /** + * You can call this function directly, ex. in the event that you + * programmatically add a widget to the form after the form has been + * initialized. + * + * @param inStartup + */ + connectChildren(inStartup: boolean): void; + /** + * + * @param params + * @param srcNodeRef + */ + create(params: any, srcNodeRef: any): void; + /** + * Wrapper to setTimeout to avoid deferred functions executing + * after the originating widget has been destroyed. + * Returns an object handle with a remove method (that returns null) (replaces clearTimeout). + * + * @param fcn Function reference. + * @param delay OptionalDelay, defaults to 0. + */ + defer(fcn: Function, delay: number): Object; + /** + * + */ + destroy(): void; + /** + * Destroy all the widgets inside the ContentPane and empty containerNode + * + * @param preserveDom + */ + destroyDescendants(preserveDom?: boolean): void; + /** + * Destroy the ContentPane and its contents + * + * @param preserveDom + */ + destroyRecursive(preserveDom?: boolean): void; + /** + * Destroys the DOM nodes associated with this widget. + * + * @param preserveDom OptionalIf true, this method will leave the original DOM structure aloneduring tear-down. Note: this will not work with _Templatedwidgets yet. + */ + destroyRendering(preserveDom?: boolean): void; + /** + * Deprecated, will be removed in 2.0, use handle.remove() instead. + * + * Disconnects handle created by connect. + * + * @param handle + */ + disconnect(handle: any): void; + /** + * Deprecated method. Applications no longer need to call this. Remove for 2.0. + * + */ + disconnectChildren(): void; + /** + * Used by widgets to signal that a synthetic event occurred, ex: + * + * myWidget.emit("attrmodified-selectedChildWidget", {}). + * Emits an event on this.domNode named type.toLowerCase(), based on eventObj. + * Also calls onType() method, if present, and returns value from that method. + * By default passes eventObj to callback, but will pass callbackArgs instead, if specified. + * Modifies eventObj by adding missing parameters (bubbles, cancelable, widget). + * + * @param type + * @param eventObj Optional + * @param callbackArgs Optional + */ + emit(type: String, eventObj: Object, callbackArgs: any[]): any; + /** + * Callback when the user hits the submit button. + * Override this method to handle Dialog execution. + * After the user has pressed the submit button, the Dialog + * first calls onExecute() to notify the container to hide the + * dialog and restore focus to wherever it used to be. + * + * Then this method is called. + * + * @param formContents + */ + execute(formContents: Object): void; + /** + * + */ + focus(): void; + /** + * Get a property from a widget. + * Get a named property from a widget. The property may + * potentially be retrieved via a getter method. If no getter is defined, this + * just retrieves the object's property. + * + * For example, if the widget has properties foo and bar + * and a method named _getFooAttr(), calling: + * myWidget.get("foo") would be equivalent to calling + * widget._getFooAttr() and myWidget.get("bar") + * would be equivalent to the expression + * widget.bar2 + * + * @param name The property to get. + */ + get(name: any): any; + /** + * Returns all direct children of this widget, i.e. all widgets underneath this.containerNode whose parent + * is this widget. Note that it does not return all descendants, but rather just direct children. + * Analogous to Node.childNodes, + * except containing widgets rather than DOMNodes. + * + * The result intentionally excludes internally created widgets (a.k.a. supporting widgets) + * outside of this.containerNode. + * + * Note that the array returned is a simple array. Application code should not assume + * existence of methods like forEach(). + * + */ + getChildren(): any[]; + /** + * Returns all the widgets contained by this, i.e., all widgets underneath this.containerNode. + * This method should generally be avoided as it returns widgets declared in templates, which are + * supposed to be internal/hidden, but it's left here for back-compat reasons. + * + */ + getDescendants(): any[]; + /** + * Gets the index of the child in this container or -1 if not found + * + * @param child + */ + getIndexOfChild(child: dijit._WidgetBase): any; + /** + * Returns the parent widget of this widget. + * + */ + getParent(): any; + /** + * + */ + getValues(): any; + /** + * Returns true if widget has child widgets, i.e. if this.containerNode contains widgets. + * + */ + hasChildren(): boolean; + /** + * Hide the dialog + * + */ + hide(): any; + /** + * Function that should grab the content specified via href. + * + * @param args An object with the following properties:handleAs (String, optional): Acceptable values are: text (default), json, json-comment-optional,json-comment-filtered, javascript, xml. See dojo/_base/xhr.contentHandlerssync (Boolean, optional): false is default. Indicates whether the request shouldbe a synchronous (blocking) request.headers (Object, optional): Additional HTTP headers to send in the request.failOk (Boolean, optional): false is default. Indicates whether a request should beallowed to fail (and therefore no console error message inthe event of a failure)contentType (String|Boolean): "application/x-www-form-urlencoded" is default. Set to false toprevent a Content-Type header from being sent, or to a stringto send a different Content-Type.load: This function will becalled on a successful HTTP response code.error: This function willbe called when the request fails due to a network or server error, the urlis invalid, etc. It will also be called if the load or handle callback throws anexception, unless djConfig.debugAtAllCosts is true. This allows deployed applicationsto continue to run even when a logic error happens in the callback, while makingit easier to troubleshoot while in debug mode.handle: This function willbe called at the end of every request, whether or not an error occurs.url (String): URL to server endpoint.content (Object, optional): Contains properties with string values. Theseproperties will be serialized as name1=value2 andpassed in the request.timeout (Integer, optional): Milliseconds to wait for the response. If this timepasses, the then error callbacks are called.form (DOMNode, optional): DOM node for a form. Used to extract the form valuesand send to the server.preventCache (Boolean, optional): Default is false. If true, then a"dojo.preventCache" parameter is sent in the requestwith a value that changes with each request(timestamp). Useful only with GET-type requests.rawBody (String, optional): Sets the raw body for an HTTP request. If this is used, then the contentproperty is ignored. This is mostly useful for HTTP methods that havea body to their requests, like PUT or POST. This property can be used insteadof postData and putData for dojo/_base/xhr.rawXhrPost and dojo/_base/xhr.rawXhrPut respectively.ioPublish (Boolean, optional): Set this explicitly to false to prevent publishing of topics related toIO operations. Otherwise, if djConfig.ioPublish is set to true, topicswill be published via dojo/topic.publish() for different phases of an IO operation.See dojo/main.__IoPublish for a list of topics that are published. + */ + ioMethod(args: Object): any; + /** + * Return true if this widget can currently be focused + * and false if not + * + */ + isFocusable(): any; + /** + * Return this widget's explicit or implicit orientation (true for LTR, false for RTL) + * + */ + isLeftToRight(): any; + /** + * Returns true if all of the widgets are valid. + * Deprecated, will be removed in 2.0. Use get("state") instead. + * + */ + isValid: {(): boolean}; + /** + * + * @param params + * @param node + * @param ctor + */ + markupFactory(params: any, node: any, ctor: any): any; + /** + * + * @param type protected + * @param func + */ + on(type: String, func: Function): any; + /** + * + * @param type protected + * @param func + */ + on(type: Function, func: Function): any; + /** + * Track specified handles and remove/destroy them when this instance is destroyed, unless they were + * already removed/destroyed manually. + * + */ + own(): any; + /** + * Place this widget somewhere in the DOM based + * on standard domConstruct.place() conventions. + * A convenience function provided in all _Widgets, providing a simple + * shorthand mechanism to put an existing (or newly created) Widget + * somewhere in the dom, and allow chaining. + * + * @param reference Widget, DOMNode, or id of widget or DOMNode + * @param position OptionalIf reference is a widget (or id of widget), and that widget has an ".addChild" method,it will be called passing this widget instance into that method, supplying the optionalposition index passed. In this case position (if specified) should be an integer.If reference is a DOMNode (or id matching a DOMNode but not a widget),the position argument can be a numeric index or a string"first", "last", "before", or "after", same as dojo/dom-construct::place(). + */ + placeAt(reference: String, position: String): any; + /** + * Place this widget somewhere in the DOM based + * on standard domConstruct.place() conventions. + * A convenience function provided in all _Widgets, providing a simple + * shorthand mechanism to put an existing (or newly created) Widget + * somewhere in the dom, and allow chaining. + * + * @param reference Widget, DOMNode, or id of widget or DOMNode + * @param position OptionalIf reference is a widget (or id of widget), and that widget has an ".addChild" method,it will be called passing this widget instance into that method, supplying the optionalposition index passed. In this case position (if specified) should be an integer.If reference is a DOMNode (or id matching a DOMNode but not a widget),the position argument can be a numeric index or a string"first", "last", "before", or "after", same as dojo/dom-construct::place(). + */ + placeAt(reference: HTMLElement, position: String): any; + /** + * Place this widget somewhere in the DOM based + * on standard domConstruct.place() conventions. + * A convenience function provided in all _Widgets, providing a simple + * shorthand mechanism to put an existing (or newly created) Widget + * somewhere in the dom, and allow chaining. + * + * @param reference Widget, DOMNode, or id of widget or DOMNode + * @param position OptionalIf reference is a widget (or id of widget), and that widget has an ".addChild" method,it will be called passing this widget instance into that method, supplying the optionalposition index passed. In this case position (if specified) should be an integer.If reference is a DOMNode (or id matching a DOMNode but not a widget),the position argument can be a numeric index or a string"first", "last", "before", or "after", same as dojo/dom-construct::place(). + */ + placeAt(reference: dijit._WidgetBase, position: String): any; + /** + * Place this widget somewhere in the DOM based + * on standard domConstruct.place() conventions. + * A convenience function provided in all _Widgets, providing a simple + * shorthand mechanism to put an existing (or newly created) Widget + * somewhere in the dom, and allow chaining. + * + * @param reference Widget, DOMNode, or id of widget or DOMNode + * @param position OptionalIf reference is a widget (or id of widget), and that widget has an ".addChild" method,it will be called passing this widget instance into that method, supplying the optionalposition index passed. In this case position (if specified) should be an integer.If reference is a DOMNode (or id matching a DOMNode but not a widget),the position argument can be a numeric index or a string"first", "last", "before", or "after", same as dojo/dom-construct::place(). + */ + placeAt(reference: String, position: number): any; + /** + * Place this widget somewhere in the DOM based + * on standard domConstruct.place() conventions. + * A convenience function provided in all _Widgets, providing a simple + * shorthand mechanism to put an existing (or newly created) Widget + * somewhere in the dom, and allow chaining. + * + * @param reference Widget, DOMNode, or id of widget or DOMNode + * @param position OptionalIf reference is a widget (or id of widget), and that widget has an ".addChild" method,it will be called passing this widget instance into that method, supplying the optionalposition index passed. In this case position (if specified) should be an integer.If reference is a DOMNode (or id matching a DOMNode but not a widget),the position argument can be a numeric index or a string"first", "last", "before", or "after", same as dojo/dom-construct::place(). + */ + placeAt(reference: HTMLElement, position: number): any; + /** + * Place this widget somewhere in the DOM based + * on standard domConstruct.place() conventions. + * A convenience function provided in all _Widgets, providing a simple + * shorthand mechanism to put an existing (or newly created) Widget + * somewhere in the dom, and allow chaining. + * + * @param reference Widget, DOMNode, or id of widget or DOMNode + * @param position OptionalIf reference is a widget (or id of widget), and that widget has an ".addChild" method,it will be called passing this widget instance into that method, supplying the optionalposition index passed. In this case position (if specified) should be an integer.If reference is a DOMNode (or id matching a DOMNode but not a widget),the position argument can be a numeric index or a string"first", "last", "before", or "after", same as dojo/dom-construct::place(). + */ + placeAt(reference: dijit._WidgetBase, position: number): any; + /** + * + */ + postCreate(): void; + /** + * + */ + postMixInProperties(): void; + /** + * [Re]download contents of href and display + * cancels any currently in-flight requests + * posts "loading..." message + * sends XHR to download new data + * + */ + refresh(): any; + /** + * Removes the passed widget instance from this widget but does + * not destroy it. You can also pass in an integer indicating + * the index within the container to remove (ie, removeChild(5) removes the sixth widget). + * + * @param widget + */ + removeChild(widget: dijit._WidgetBase): void; + /** + * Removes the passed widget instance from this widget but does + * not destroy it. You can also pass in an integer indicating + * the index within the container to remove (ie, removeChild(5) removes the sixth widget). + * + * @param widget + */ + removeChild(widget: number): void; + /** + * + */ + reset(): void; + /** + * See dijit/layout/_LayoutWidget.resize() for description. + * Although ContentPane doesn't extend _LayoutWidget, it does implement + * the same API. + * + * @param changeSize + * @param resultSize + */ + resize(changeSize: any, resultSize: any): void; + /** + * Set a property on a widget + * Sets named properties on a widget which may potentially be handled by a + * setter in the widget. + * + * For example, if the widget has properties foo and bar + * and a method named _setFooAttr(), calling + * myWidget.set("foo", "Howdy!") would be equivalent to calling + * widget._setFooAttr("Howdy!") and myWidget.set("bar", 3) + * would be equivalent to the statement widget.bar = 3; + * + * set() may also be called with a hash of name/value pairs, ex: + * + * myWidget.set({ + * foo: "Howdy", + * bar: 3 + * }); + * This is equivalent to calling set(foo, "Howdy") and set(bar, 3) + * + * @param name The property to set. + * @param value The value to set in the property. + */ + set(name: any, value: any): any; + /** + * Deprecated. Use set() instead. + * + * @param attr + * @param value + */ + setAttribute(attr: String, value: any): void; + /** + * Deprecated. Use set('content', ...) instead. + * + * @param data + */ + setContent(data: String): void; + /** + * Deprecated. Use set('content', ...) instead. + * + * @param data + */ + setContent(data: HTMLElement): void; + /** + * Deprecated. Use set('content', ...) instead. + * + * @param data + */ + setContent(data: NodeList): void; + /** + * Deprecated. Use set('href', ...) instead. + * + * @param href + */ + setHref(href: String): any; + /** + * Deprecated. Use set('href', ...) instead. + * + * @param href + */ + setHref(href: URL): any; + /** + * + * @param val + */ + setValues(val: any): any; + /** + * Display the dialog + * + */ + show(): any; + /** + * Call startup() on all children including non _Widget ones like dojo/dnd/Source objects + * + */ + startup(): void; + /** + * Deprecated, will be removed in 2.0, use this.own(topic.subscribe()) instead. + * + * Subscribes to the specified topic and calls the specified method + * of this object and registers for unsubscribe() on widget destroy. + * + * Provide widget-specific analog to dojo.subscribe, except with the + * implicit use of this widget as the target object. + * + * @param t The topic + * @param method The callback + */ + subscribe(t: String, method: Function): any; + /** + * Returns a string that represents the widget. + * When a widget is cast to a string, this method will be used to generate the + * output. Currently, it does not implement any sort of reversible + * serialization. + * + */ + toString(): String; + /** + * Deprecated. Override destroy() instead to implement custom widget tear-down + * behavior. + * + */ + uninitialize(): boolean; + /** + * Deprecated, will be removed in 2.0, use handle.remove() instead. + * + * Unsubscribes handle created by this.subscribe. + * Also removes handle from this widget's list of subscriptions + * + * @param handle + */ + unsubscribe(handle: Object): void; + /** + * returns if the form is valid - same as isValid - but + * provides a few additional (ui-specific) features: + * + * it will highlight any sub-widgets that are not valid + * it will call focus() on the first invalid sub-widget + * + */ + validate(): any; + /** + * Watches a property for changes + * + * @param name OptionalIndicates the property to watch. This is optional (the callback may be theonly parameter), and if omitted, all the properties will be watched + * @param callback The function to execute when the property changes. This will be called afterthe property has been changed. The callback will be called with the |this|set to the instance, the first argument as the name of the property, thesecond argument as the old value and the third argument as the new value. + */ + watch(property: string, callback:{(property?:string, oldValue?:any, newValue?: any):void}) :{unwatch():void}; + /** + * Static method to get a template based on the templatePath or + * templateString key + */ + getCachedTemplate(): any; + /** + * Called when the widget stops being "active" because + * focus moved to something outside of it, or the user + * clicked somewhere outside of it, or the widget was + * hidden. + * + */ + onBlur(): void; + /** + * Called when user has pressed the Dialog's cancel button, to notify container. + * Developer shouldn't override or connect to this method; + * it's a private communication device between the TooltipDialog + * and the thing that opened it (ex: dijit/form/DropDownButton) + * + */ + onCancel(): void; + /** + * Connect to this function to receive notifications of mouse click events. + * + * @param event mouse Event + */ + onClick(event: any): void; + /** + * Called when this widget is being displayed as a popup (ex: a Calendar popped + * up from a DateTextBox), and it is hidden. + * This is called from the dijit.popup code, and should not be called directly. + * + * Also used as a parameter for children of dijit/layout/StackContainer or subclasses. + * Callback if a user tries to close the child. Child will be closed if this function returns true. + * + */ + onClose(): boolean; + /** + * Called on DOM faults, require faults etc. in content. + * + * In order to display an error message in the pane, return + * the error message from this method, as an HTML string. + * + * By default (if this method is not overriden), it returns + * nothing, so the error message is just printed to the console. + * + * @param error + */ + onContentError(error: Error): void; + /** + * Connect to this function to receive notifications of mouse double click events. + * + * @param event mouse Event + */ + onDblClick(event: any): void; + /** + * Called when download is finished. + * + */ + onDownloadEnd(): void; + /** + * Called when download error occurs. + * + * In order to display an error message in the pane, return + * the error message from this method, as an HTML string. + * + * Default behavior (if this method is not overriden) is to display + * the error message inside the pane. + * + * @param error + */ + onDownloadError(error: Error): any; + /** + * Called before download starts. + * The string returned by this function will be the html + * that tells the user we are loading something. + * Override with your own function if you want to change text. + * + */ + onDownloadStart(): any; + /** + * Called when user has pressed the dialog's OK button, to notify container. + * Developer shouldn't override or connect to this method; + * it's a private communication device between the TooltipDialog + * and the thing that opened it (ex: dijit/form/DropDownButton) + * + */ + onExecute(): void; + /** + * Called when the widget becomes "active" because + * it or a widget inside of it either has focus, or has recently + * been clicked. + * + */ + onFocus(): void; + /** + * Called when another widget becomes the selected pane in a + * dijit/layout/TabContainer, dijit/layout/StackContainer, + * dijit/layout/AccordionContainer, etc. + * + * Also called to indicate hide of a dijit.Dialog, dijit.TooltipDialog, or dijit.TitlePane. + * + */ + onHide(): void; + /** + * Connect to this function to receive notifications of keys being pressed down. + * + * @param event key Event + */ + onKeyDown(event: any): void; + /** + * Connect to this function to receive notifications of printable keys being typed. + * + * @param event key Event + */ + onKeyPress(event: any): void; + /** + * Connect to this function to receive notifications of keys being released. + * + * @param event key Event + */ + onKeyUp(event: any): void; + /** + * Event hook, is called after everything is loaded and widgetified + * + * @param data + */ + onLoad(data: any): void; + /** + * Connect to this function to receive notifications of when the mouse button is pressed down. + * + * @param event mouse Event + */ + onMouseDown(event: any): void; + /** + * Connect to this function to receive notifications of when the mouse moves onto this widget. + * + * @param event mouse Event + */ + onMouseEnter(event: any): void; + /** + * Connect to this function to receive notifications of when the mouse moves off of this widget. + * + * @param event mouse Event + */ + onMouseLeave(event: any): void; + /** + * Connect to this function to receive notifications of when the mouse moves over nodes contained within this widget. + * + * @param event mouse Event + */ + onMouseMove(event: any): void; + /** + * Connect to this function to receive notifications of when the mouse moves off of nodes contained within this widget. + * + * @param event mouse Event + */ + onMouseOut(event: any): void; + /** + * Connect to this function to receive notifications of when the mouse moves onto nodes contained within this widget. + * + * @param event mouse Event + */ + onMouseOver(event: any): void; + /** + * Connect to this function to receive notifications of when the mouse button is released. + * + * @param event mouse Event + */ + onMouseUp(event: any): void; + /** + * Called when this widget becomes the selected pane in a + * dijit/layout/TabContainer, dijit/layout/StackContainer, + * dijit/layout/AccordionContainer, etc. + * + * Also called to indicate display of a dijit.Dialog, dijit.TooltipDialog, or dijit.TitlePane. + * + */ + onShow(): void; + /** + * Event hook, is called before old content is cleared + * + */ + onUnload(): void; + /** + * Stub function to connect to if you want to do something + * (like disable/enable a submit button) when the valid + * state changes on the form as a whole. + * + * Deprecated. Will be removed in 2.0. Use watch("state", ...) instead. + * + * @param isValid + */ + onValidStateChange(isValid: boolean): void; + } + module Dialog { + /** + * Permalink: http://dojotoolkit.org/api/1.9/dijit/Dialog._DialogBase.html + * + * + * @param params Hash of initialization parameters for widget, including scalar values (like title, duration etc.)and functions, typically callbacks like onClick.The hash can contain any of the widget's properties, excluding read-only properties. + * @param srcNodeRef OptionalIf a srcNodeRef (DOM node) is specified, replace srcNodeRef with my generated DOM tree. + */ + class _DialogBase extends dijit._TemplatedMixin implements dijit.form._FormMixin, dijit._DialogMixin, dijit._CssStateMixin { + constructor(params?: Object, srcNodeRef?: HTMLElement); + /** + * True if mouse was pressed while over this widget, and hasn't been released yet + * + */ + "active": boolean; + /** + * Object to which attach points and events will be scoped. Defaults + * to 'this'. + * + */ + "attachScope": Object; + /** + * A Toggle to modify the default focus behavior of a Dialog, which + * is to focus on the first dialog element after opening the dialog. + * False will disable autofocusing. Default: true + * + */ + "autofocus": boolean; + /** + * + */ + "baseClass": string; + /** + * Dialog show [x] icon to close itself, and ESC key will close the dialog. + * + */ + "closable": boolean; + /** + * + */ + "cssStateNodes": Object; + /** + * Don't change this parameter from the default value. + * This ContentPane parameter doesn't make sense for Dialog, since Dialog + * is never a child of a layout container, nor can you specify the size of + * Dialog in order to control the size of an inner widget. + * + */ + "doLayout": boolean; + /** + * Toggles the movable aspect of the Dialog. If true, Dialog + * can be dragged by it's title. If false it will remain centered + * in the viewport. + * + */ + "draggable": boolean; + /** + * The time in milliseconds it takes the dialog to fade in and out + * + */ + "duration": number; + /** + * True if cursor is over this widget + * + */ + "hovering": boolean; + /** + * Maximum size to allow the dialog to expand to, relative to viewport size + * + */ + "maxRatio": number; + /** + * True if Dialog is currently displayed on screen. + * + */ + "open": boolean; + /** + * A Toggle to modify the default focus behavior of a Dialog, which + * is to re-focus the element which had focus before being opened. + * False will disable refocusing. Default: true + * + */ + "refocus": boolean; + /** + * + */ + "searchContainerNode": boolean; + /** + * Will be "Error" if one or more of the child widgets has an invalid value, + * "Incomplete" if not all of the required child widgets are filled in. Otherwise, "", + * which indicates that the form is ready to be submitted. + * + */ + "state": string; + /** + * Path to template (HTML file) for this widget relative to dojo.baseUrl. + * Deprecated: use templateString with require([... "dojo/text!..."], ...) instead + * + */ + "templatePath": string; + /** + * + */ + "templateString": string; + /** + * Construct the UI for this widget from a template, setting this.domNode. + * + */ + buildRendering(): void; + /** + * You can call this function directly, ex. in the event that you + * programmatically add a widget to the form after the form has been + * initialized. + * + * @param inStartup + */ + connectChildren(inStartup: boolean): void; + /** + * + */ + destroy(): void; + /** + * + */ + destroyRendering(): void; + /** + * Deprecated method. Applications no longer need to call this. Remove for 2.0. + * + */ + disconnectChildren(): void; + /** + * Callback when the user hits the submit button. + * Override this method to handle Dialog execution. + * After the user has pressed the submit button, the Dialog + * first calls onExecute() to notify the container to hide the + * dialog and restore focus to wherever it used to be. + * + * Then this method is called. + * + * @param formContents + */ + execute(formContents: Object): void; + /** + * + */ + focus(): void; + /** + * + */ + getValues(): any; + /** + * Hide the dialog + * + */ + hide(): any; + /** + * Returns true if all of the widgets are valid. + * Deprecated, will be removed in 2.0. Use get("state") instead. + * + */ + isValid: {(): boolean}; + /** + * + */ + postCreate(): void; + /** + * + */ + postMixInProperties(): void; + /** + * + */ + reset(): void; + /** + * + * @param val + */ + setValues(val: any): any; + /** + * Display the dialog + * + */ + show(): any; + /** + * + */ + startup(): void; + /** + * returns if the form is valid - same as isValid - but + * provides a few additional (ui-specific) features: + * + * it will highlight any sub-widgets that are not valid + * it will call focus() on the first invalid sub-widget + * + */ + validate(): any; + /** + * Static method to get a template based on the templatePath or + * templateString key + */ + getCachedTemplate(): any; + /** + * Called when user has pressed the Dialog's cancel button, to notify container. + * Developer shouldn't override or connect to this method; + * it's a private communication device between the TooltipDialog + * and the thing that opened it (ex: dijit/form/DropDownButton) + * + */ + onCancel(): void; + /** + * Called when user has pressed the dialog's OK button, to notify container. + * Developer shouldn't override or connect to this method; + * it's a private communication device between the TooltipDialog + * and the thing that opened it (ex: dijit/form/DropDownButton) + * + */ + onExecute(): void; + /** + * Called when data has been loaded from an href. + * Unlike most other callbacks, this function can be connected to (via dojo.connect) + * but should not be overridden. + * + */ + onLoad(): void; + /** + * Stub function to connect to if you want to do something + * (like disable/enable a submit button) when the valid + * state changes on the form as a whole. + * + * Deprecated. Will be removed in 2.0. Use watch("state", ...) instead. + * + * @param isValid + */ + onValidStateChange(isValid: boolean): void; + } + /** + * Permalink: http://dojotoolkit.org/api/1.9/dijit/Dialog._DialogLevelManager.html + * + * Controls the various active "levels" on the page, starting with the + * stuff initially visible on the page (at z-index 0), and then having an entry for + * each Dialog shown. + * + */ + interface _DialogLevelManager { + /** + * Called when the specified dialog is hidden/destroyed, after the fade-out + * animation ends, in order to reset page focus, fix the underlay, etc. + * If the specified dialog isn't open then does nothing. + * + * Caller is responsible for either setting display:none on the dialog domNode, + * or calling dijit/popup.hide(), or removing it from the page DOM. + * + * @param dialog + */ + hide(dialog: dijit._WidgetBase): void; + /** + * Returns true if specified Dialog is the top in the task + * + * @param dialog + */ + isTop(dialog: dijit._WidgetBase): boolean; + /** + * Call right before fade-in animation for new dialog. + * Saves current focus, displays/adjusts underlay for new dialog, + * and sets the z-index of the dialog itself. + * + * New dialog will be displayed on top of all currently displayed dialogs. + * + * Caller is responsible for setting focus in new dialog after the fade-in + * animation completes. + * + * @param dialog + * @param underlayAttrs + */ + show(dialog: dijit._WidgetBase, underlayAttrs: Object): void; + } + } + + /** + * Permalink: http://dojotoolkit.org/api/1.9/dijit/ColorPalette.html + * + * A keyboard accessible color-picking widget + * Grid showing various colors, so the user can pick a certain color. + * Can be used standalone, or as a popup. + * + * @param params Hash of initialization parameters for widget, including scalar values (like title, duration etc.)and functions, typically callbacks like onClick.The hash can contain any of the widget's properties, excluding read-only properties. + * @param srcNodeRef OptionalIf a srcNodeRef (DOM node) is specified:use srcNodeRef.innerHTML as my contentsif this is a behavioral widget then apply behavior to that srcNodeRefotherwise, replace srcNodeRef with my generated DOM tree + */ + class ColorPalette extends dijit._Widget implements dijit._TemplatedMixin, dijit._PaletteMixin { + constructor(params?: Object, srcNodeRef?: HTMLElement); + /** + * True if mouse was pressed while over this widget, and hasn't been released yet + * + */ + "active": boolean; + set(property:"active", value: boolean): void; + get(property:"active"): boolean; + watch(property:"active", callback:{(property?:string, oldValue?:boolean, newValue?: boolean):void}) :{unwatch():void} + /** + * Object to which attach points and events will be scoped. Defaults + * to 'this'. + * + */ + "attachScope": Object; + set(property:"attachScope", value: Object): void; + get(property:"attachScope"): Object; + watch(property:"attachScope", callback:{(property?:string, oldValue?:Object, newValue?: Object):void}) :{unwatch():void} + /** + * Deprecated. Instead of attributeMap, widget should have a _setXXXAttr attribute + * for each XXX attribute to be mapped to the DOM. + * + * attributeMap sets up a "binding" between attributes (aka properties) + * of the widget and the widget's DOM. + * Changes to widget attributes listed in attributeMap will be + * reflected into the DOM. + * + * For example, calling set('title', 'hello') + * on a TitlePane will automatically cause the TitlePane's DOM to update + * with the new title. + * + * attributeMap is a hash where the key is an attribute of the widget, + * and the value reflects a binding to a: + * + * DOM node attribute + * focus: {node: "focusNode", type: "attribute"} + * Maps this.focus to this.focusNode.focus + * + * DOM node innerHTML + * title: { node: "titleNode", type: "innerHTML" } + * Maps this.title to this.titleNode.innerHTML + * + * DOM node innerText + * title: { node: "titleNode", type: "innerText" } + * Maps this.title to this.titleNode.innerText + * + * DOM node CSS class + * myClass: { node: "domNode", type: "class" } + * Maps this.myClass to this.domNode.className + * + * If the value is an array, then each element in the array matches one of the + * formats of the above list. + * + * There are also some shorthands for backwards compatibility: + * + * string --> { node: string, type: "attribute" }, for example: + * "focusNode" ---> { node: "focusNode", type: "attribute" } + * "" --> { node: "domNode", type: "attribute" } + * + */ + "attributeMap": Object; + set(property:"attributeMap", value: Object): void; + get(property:"attributeMap"): Object; + watch(property:"attributeMap", callback:{(property?:string, oldValue?:Object, newValue?: Object):void}) :{unwatch():void} + /** + * + */ + "baseClass": string; + set(property:"baseClass", value: string): void; + get(property:"baseClass"): string; + watch(property:"baseClass", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * CSS class applied to each cell in the palette + * + */ + "cellClass": string; + set(property:"cellClass", value: string): void; + get(property:"cellClass"): string; + watch(property:"cellClass", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * + */ + "class": string; + set(property:"class", value: string): void; + get(property:"class"): string; + watch(property:"class", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * Designates where children of the source DOM node will be placed. + * "Children" in this case refers to both DOM nodes and widgets. + * For example, for myWidget: + * + *
+ * here's a plain DOM node + * and a widget + * and another plain DOM node + *
+ * containerNode would point to: + * + * here's a plain DOM node + * and a widget + * and another plain DOM node + * In templated widgets, "containerNode" is set via a + * data-dojo-attach-point assignment. + * + * containerNode must be defined for any widget that accepts innerHTML + * (like ContentPane or BorderContainer or even Button), and conversely + * is null for widgets that don't, like TextBox. + * + */ + "containerNode": HTMLElement; + set(property:"containerNode", value: HTMLElement): void; + get(property:"containerNode"): HTMLElement; + watch(property:"containerNode", callback:{(property?:string, oldValue?:HTMLElement, newValue?: HTMLElement):void}) :{unwatch():void} + /** + * Subclasses may define a cssStateNodes property that lists sub-nodes within the widget that + * need CSS classes applied on mouse hover/press and focus. + * + * Each entry in this optional hash is a an attach-point name (like "upArrowButton") mapped to a CSS class name + * (like "dijitUpArrowButton"). Example: + * + * { + * "upArrowButton": "dijitUpArrowButton", + * "downArrowButton": "dijitDownArrowButton" + * } + * The above will set the CSS class dijitUpArrowButton to the this.upArrowButton DOMNode when it + * + * is hovered, etc. + * + */ + "cssStateNodes": Object; + set(property:"cssStateNodes", value: Object): void; + get(property:"cssStateNodes"): Object; + watch(property:"cssStateNodes", callback:{(property?:string, oldValue?:Object, newValue?: Object):void}) :{unwatch():void} + /** + * Number of milliseconds before a held key or button becomes typematic + * + */ + "defaultTimeout": number; + set(property:"defaultTimeout", value: number): void; + get(property:"defaultTimeout"): number; + watch(property:"defaultTimeout", callback:{(property?:string, oldValue?:number, newValue?: number):void}) :{unwatch():void} + /** + * Bi-directional support, as defined by the HTML DIR + * attribute. Either left-to-right "ltr" or right-to-left "rtl". If undefined, widgets renders in page's + * default direction. + * + */ + "dir": string; + set(property:"dir", value: string): void; + get(property:"dir"): string; + watch(property:"dir", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * This is our visible representation of the widget! Other DOM + * Nodes may by assigned to other properties, usually through the + * template system's data-dojo-attach-point syntax, but the domNode + * property is the canonical "top level" node in widget UI. + * + */ + "domNode": HTMLElement; + set(property:"domNode", value: HTMLElement): void; + get(property:"domNode"): HTMLElement; + watch(property:"domNode", callback:{(property?:string, oldValue?:HTMLElement, newValue?: HTMLElement):void}) :{unwatch():void} + /** + * Constructor for Object created for each cell of the palette. + * dyeClass should implement the dijit/_PaletteMixin.__Dye interface. + * + */ + "dyeClass": Function; + set(property:"dyeClass", value: Function): void; + get(property:"dyeClass"): Function; + watch(property:"dyeClass", callback:{(property?:string, oldValue?:Function, newValue?: Function):void}) :{unwatch():void} + /** + * This widget or a widget it contains has focus, or is "active" because + * it was recently clicked. + * + */ + "focused": boolean; + set(property:"focused", value: boolean): void; + get(property:"focused"): boolean; + watch(property:"focused", callback:{(property?:string, oldValue?:boolean, newValue?: boolean):void}) :{unwatch():void} + /** + * True if cursor is over this widget + * + */ + "hovering": boolean; + set(property:"hovering", value: boolean): void; + get(property:"hovering"): boolean; + watch(property:"hovering", callback:{(property?:string, oldValue?:boolean, newValue?: boolean):void}) :{unwatch():void} + /** + * A unique, opaque ID string that can be assigned by users or by the + * system. If the developer passes an ID which is known not to be + * unique, the specified ID is ignored and the system-generated ID is + * used instead. + * + */ + "id": string; + set(property:"id", value: string): void; + get(property:"id"): string; + watch(property:"id", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * Rarely used. Overrides the default Dojo locale used to render this widget, + * as defined by the HTML LANG attribute. + * Value must be among the list of locales specified during by the Dojo bootstrap, + * formatted according to RFC 3066 (like en-us). + * + */ + "lang": string; + set(property:"lang", value: string): void; + get(property:"lang"): string; + watch(property:"lang", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * The document this widget belongs to. If not specified to constructor, will default to + * srcNodeRef.ownerDocument, or if no sourceRef specified, then to the document global + * + */ + "ownerDocument": Object; + set(property:"ownerDocument", value: Object): void; + get(property:"ownerDocument"): Object; + watch(property:"ownerDocument", callback:{(property?:string, oldValue?:Object, newValue?: Object):void}) :{unwatch():void} + /** + * Size of grid, either "7x10" or "3x4". + * + */ + "palette": string; + set(property:"palette", value: string): void; + get(property:"palette"): string; + watch(property:"palette", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * + */ + "searchContainerNode": boolean; + set(property:"searchContainerNode", value: boolean): void; + get(property:"searchContainerNode"): boolean; + watch(property:"searchContainerNode", callback:{(property?:string, oldValue?:boolean, newValue?: boolean):void}) :{unwatch():void} + /** + * pointer to original DOM node + * + */ + "srcNodeRef": HTMLElement; + set(property:"srcNodeRef", value: HTMLElement): void; + get(property:"srcNodeRef"): HTMLElement; + watch(property:"srcNodeRef", callback:{(property?:string, oldValue?:HTMLElement, newValue?: HTMLElement):void}) :{unwatch():void} + /** + * HTML style attributes as cssText string or name/value hash + * + */ + "style": string; + set(property:"style", value: string): void; + get(property:"style"): string; + watch(property:"style", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * Widget tab index. + * + */ + "tabIndex": string; + set(property:"tabIndex", value: string): void; + get(property:"tabIndex"): string; + watch(property:"tabIndex", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * Path to template (HTML file) for this widget relative to dojo.baseUrl. + * Deprecated: use templateString with require([... "dojo/text!..."], ...) instead + * + */ + "templatePath": string; + set(property:"templatePath", value: string): void; + get(property:"templatePath"): string; + watch(property:"templatePath", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * The template of this widget. + * + */ + "templateString": string; + set(property:"templateString", value: string): void; + get(property:"templateString"): string; + watch(property:"templateString", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * Fraction of time used to change the typematic timer between events + * 1.0 means that each typematic event fires at defaultTimeout intervals + * Less than 1.0 means that each typematic event fires at an increasing faster rate + * + */ + "timeoutChangeRate": number; + set(property:"timeoutChangeRate", value: number): void; + get(property:"timeoutChangeRate"): number; + watch(property:"timeoutChangeRate", callback:{(property?:string, oldValue?:number, newValue?: number):void}) :{unwatch():void} + /** + * HTML title attribute. + * + * For form widgets this specifies a tooltip to display when hovering over + * the widget (just like the native HTML title attribute). + * + * For TitlePane or for when this widget is a child of a TabContainer, AccordionContainer, + * etc., it's used to specify the tab label, accordion pane title, etc. In this case it's + * interpreted as HTML. + * + */ + "title": string; + set(property:"title", value: string): void; + get(property:"title"): string; + watch(property:"title", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * When this widget's title attribute is used to for a tab label, accordion pane title, etc., + * this specifies the tooltip to appear when the mouse is hovered over that text. + * + */ + "tooltip": string; + set(property:"tooltip", value: string): void; + get(property:"tooltip"): string; + watch(property:"tooltip", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * Currently selected color/emoticon/etc. + * + */ + "value": string; + set(property:"value", value: string): void; + get(property:"value"): string; + watch(property:"value", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * This method is deprecated, use get() or set() directly. + * + * @param name The property to get or set. If an object is passed here and nota string, its keys are used as names of attributes to be setand the value of the object as values to set in the widget. + * @param value OptionalOptional. If provided, attr() operates as a setter. If omitted,the current value of the named property is returned. + */ + attr(name: String, value: Object): any; + /** + * This method is deprecated, use get() or set() directly. + * + * @param name The property to get or set. If an object is passed here and nota string, its keys are used as names of attributes to be setand the value of the object as values to set in the widget. + * @param value OptionalOptional. If provided, attr() operates as a setter. If omitted,the current value of the named property is returned. + */ + attr(name: Object, value: Object): any; + /** + * + */ + buildRendering(): void; + /** + * Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead. + * + * Connects specified obj/event to specified method of this object + * and registers for disconnect() on widget destroy. + * + * Provide widget-specific analog to dojo.connect, except with the + * implicit use of this widget as the target object. + * Events connected with this.connect are disconnected upon + * destruction. + * + * @param obj + * @param event + * @param method + */ + connect(obj: Object, event: String, method: String): any; + /** + * Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead. + * + * Connects specified obj/event to specified method of this object + * and registers for disconnect() on widget destroy. + * + * Provide widget-specific analog to dojo.connect, except with the + * implicit use of this widget as the target object. + * Events connected with this.connect are disconnected upon + * destruction. + * + * @param obj + * @param event + * @param method + */ + connect(obj: any, event: String, method: String): any; + /** + * Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead. + * + * Connects specified obj/event to specified method of this object + * and registers for disconnect() on widget destroy. + * + * Provide widget-specific analog to dojo.connect, except with the + * implicit use of this widget as the target object. + * Events connected with this.connect are disconnected upon + * destruction. + * + * @param obj + * @param event + * @param method + */ + connect(obj: Object, event: Function, method: String): any; + /** + * Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead. + * + * Connects specified obj/event to specified method of this object + * and registers for disconnect() on widget destroy. + * + * Provide widget-specific analog to dojo.connect, except with the + * implicit use of this widget as the target object. + * Events connected with this.connect are disconnected upon + * destruction. + * + * @param obj + * @param event + * @param method + */ + connect(obj: any, event: Function, method: String): any; + /** + * Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead. + * + * Connects specified obj/event to specified method of this object + * and registers for disconnect() on widget destroy. + * + * Provide widget-specific analog to dojo.connect, except with the + * implicit use of this widget as the target object. + * Events connected with this.connect are disconnected upon + * destruction. + * + * @param obj + * @param event + * @param method + */ + connect(obj: Object, event: String, method: Function): any; + /** + * Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead. + * + * Connects specified obj/event to specified method of this object + * and registers for disconnect() on widget destroy. + * + * Provide widget-specific analog to dojo.connect, except with the + * implicit use of this widget as the target object. + * Events connected with this.connect are disconnected upon + * destruction. + * + * @param obj + * @param event + * @param method + */ + connect(obj: any, event: String, method: Function): any; + /** + * Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead. + * + * Connects specified obj/event to specified method of this object + * and registers for disconnect() on widget destroy. + * + * Provide widget-specific analog to dojo.connect, except with the + * implicit use of this widget as the target object. + * Events connected with this.connect are disconnected upon + * destruction. + * + * @param obj + * @param event + * @param method + */ + connect(obj: Object, event: Function, method: Function): any; + /** + * Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead. + * + * Connects specified obj/event to specified method of this object + * and registers for disconnect() on widget destroy. + * + * Provide widget-specific analog to dojo.connect, except with the + * implicit use of this widget as the target object. + * Events connected with this.connect are disconnected upon + * destruction. + * + * @param obj + * @param event + * @param method + */ + connect(obj: any, event: Function, method: Function): any; + /** + * Wrapper to setTimeout to avoid deferred functions executing + * after the originating widget has been destroyed. + * Returns an object handle with a remove method (that returns null) (replaces clearTimeout). + * + * @param fcn Function reference. + * @param delay OptionalDelay, defaults to 0. + */ + defer(fcn: Function, delay: number): Object; + /** + * Destroy this widget, but not its descendants. Descendants means widgets inside of + * this.containerNode. Will also destroy any resources (including widgets) registered via this.own(). + * + * This method will also destroy internal widgets such as those created from a template, + * assuming those widgets exist inside of this.domNode but outside of this.containerNode. + * + * For 2.0 it's planned that this method will also destroy descendant widgets, so apps should not + * depend on the current ability to destroy a widget without destroying its descendants. Generally + * they should use destroyRecursive() for widgets with children. + * + * @param preserveDom If true, this method will leave the original DOM structure alone.Note: This will not yet work with _TemplatedMixin widgets + */ + destroy(preserveDom?: boolean): void; + /** + * Recursively destroy the children of this widget and their + * descendants. + * + * @param preserveDom OptionalIf true, the preserveDom attribute is passed to all descendantwidget's .destroy() method. Not for use with _Templatedwidgets. + */ + destroyDescendants(preserveDom?: boolean): void; + /** + * Destroy this widget and its descendants + * This is the generic "destructor" function that all widget users + * should call to cleanly discard with a widget. Once a widget is + * destroyed, it is removed from the manager object. + * + * @param preserveDom OptionalIf true, this method will leave the original DOM structurealone of descendant Widgets. Note: This will NOT work withdijit._TemplatedMixin widgets. + */ + destroyRecursive(preserveDom?: boolean): void; + /** + * Destroys the DOM nodes associated with this widget. + * + * @param preserveDom OptionalIf true, this method will leave the original DOM structure aloneduring tear-down. Note: this will not work with _Templatedwidgets yet. + */ + destroyRendering(preserveDom?: boolean): void; + /** + * Deprecated, will be removed in 2.0, use handle.remove() instead. + * + * Disconnects handle created by connect. + * + * @param handle + */ + disconnect(handle: any): void; + /** + * Used by widgets to signal that a synthetic event occurred, ex: + * + * myWidget.emit("attrmodified-selectedChildWidget", {}). + * Emits an event on this.domNode named type.toLowerCase(), based on eventObj. + * Also calls onType() method, if present, and returns value from that method. + * By default passes eventObj to callback, but will pass callbackArgs instead, if specified. + * Modifies eventObj by adding missing parameters (bubbles, cancelable, widget). + * + * @param type + * @param eventObj Optional + * @param callbackArgs Optional + */ + emit(type: String, eventObj: Object, callbackArgs: any[]): any; + /** + * Focus this widget. Puts focus on the most recently focused cell. + * + */ + focus(): void; + /** + * Get a property from a widget. + * Get a named property from a widget. The property may + * potentially be retrieved via a getter method. If no getter is defined, this + * just retrieves the object's property. + * + * For example, if the widget has properties foo and bar + * and a method named _getFooAttr(), calling: + * myWidget.get("foo") would be equivalent to calling + * widget._getFooAttr() and myWidget.get("bar") + * would be equivalent to the expression + * widget.bar2 + * + * @param name The property to get. + */ + get(name: any): any; + /** + * Returns all direct children of this widget, i.e. all widgets underneath this.containerNode whose parent + * is this widget. Note that it does not return all descendants, but rather just direct children. + * Analogous to Node.childNodes, + * except containing widgets rather than DOMNodes. + * + * The result intentionally excludes internally created widgets (a.k.a. supporting widgets) + * outside of this.containerNode. + * + * Note that the array returned is a simple array. Application code should not assume + * existence of methods like forEach(). + * + */ + getChildren(): any[]; + /** + * Returns all the widgets contained by this, i.e., all widgets underneath this.containerNode. + * This method should generally be avoided as it returns widgets declared in templates, which are + * supposed to be internal/hidden, but it's left here for back-compat reasons. + * + */ + getDescendants(): any[]; + /** + * Returns the parent widget of this widget. + * + */ + getParent(): any; + /** + * Return true if this widget can currently be focused + * and false if not + * + */ + isFocusable(): any; + /** + * Return this widget's explicit or implicit orientation (true for LTR, false for RTL) + * + */ + isLeftToRight(): any; + /** + * + * @param type protected + * @param func + */ + on(type: String, func: Function): any; + /** + * + * @param type protected + * @param func + */ + on(type: Function, func: Function): any; + /** + * Track specified handles and remove/destroy them when this instance is destroyed, unless they were + * already removed/destroyed manually. + * + */ + own(): any; + /** + * Place this widget somewhere in the DOM based + * on standard domConstruct.place() conventions. + * A convenience function provided in all _Widgets, providing a simple + * shorthand mechanism to put an existing (or newly created) Widget + * somewhere in the dom, and allow chaining. + * + * @param reference Widget, DOMNode, or id of widget or DOMNode + * @param position OptionalIf reference is a widget (or id of widget), and that widget has an ".addChild" method,it will be called passing this widget instance into that method, supplying the optionalposition index passed. In this case position (if specified) should be an integer.If reference is a DOMNode (or id matching a DOMNode but not a widget),the position argument can be a numeric index or a string"first", "last", "before", or "after", same as dojo/dom-construct::place(). + */ + placeAt(reference: String, position: String): any; + /** + * Place this widget somewhere in the DOM based + * on standard domConstruct.place() conventions. + * A convenience function provided in all _Widgets, providing a simple + * shorthand mechanism to put an existing (or newly created) Widget + * somewhere in the dom, and allow chaining. + * + * @param reference Widget, DOMNode, or id of widget or DOMNode + * @param position OptionalIf reference is a widget (or id of widget), and that widget has an ".addChild" method,it will be called passing this widget instance into that method, supplying the optionalposition index passed. In this case position (if specified) should be an integer.If reference is a DOMNode (or id matching a DOMNode but not a widget),the position argument can be a numeric index or a string"first", "last", "before", or "after", same as dojo/dom-construct::place(). + */ + placeAt(reference: HTMLElement, position: String): any; + /** + * Place this widget somewhere in the DOM based + * on standard domConstruct.place() conventions. + * A convenience function provided in all _Widgets, providing a simple + * shorthand mechanism to put an existing (or newly created) Widget + * somewhere in the dom, and allow chaining. + * + * @param reference Widget, DOMNode, or id of widget or DOMNode + * @param position OptionalIf reference is a widget (or id of widget), and that widget has an ".addChild" method,it will be called passing this widget instance into that method, supplying the optionalposition index passed. In this case position (if specified) should be an integer.If reference is a DOMNode (or id matching a DOMNode but not a widget),the position argument can be a numeric index or a string"first", "last", "before", or "after", same as dojo/dom-construct::place(). + */ + placeAt(reference: dijit._WidgetBase, position: String): any; + /** + * Place this widget somewhere in the DOM based + * on standard domConstruct.place() conventions. + * A convenience function provided in all _Widgets, providing a simple + * shorthand mechanism to put an existing (or newly created) Widget + * somewhere in the dom, and allow chaining. + * + * @param reference Widget, DOMNode, or id of widget or DOMNode + * @param position OptionalIf reference is a widget (or id of widget), and that widget has an ".addChild" method,it will be called passing this widget instance into that method, supplying the optionalposition index passed. In this case position (if specified) should be an integer.If reference is a DOMNode (or id matching a DOMNode but not a widget),the position argument can be a numeric index or a string"first", "last", "before", or "after", same as dojo/dom-construct::place(). + */ + placeAt(reference: String, position: number): any; + /** + * Place this widget somewhere in the DOM based + * on standard domConstruct.place() conventions. + * A convenience function provided in all _Widgets, providing a simple + * shorthand mechanism to put an existing (or newly created) Widget + * somewhere in the dom, and allow chaining. + * + * @param reference Widget, DOMNode, or id of widget or DOMNode + * @param position OptionalIf reference is a widget (or id of widget), and that widget has an ".addChild" method,it will be called passing this widget instance into that method, supplying the optionalposition index passed. In this case position (if specified) should be an integer.If reference is a DOMNode (or id matching a DOMNode but not a widget),the position argument can be a numeric index or a string"first", "last", "before", or "after", same as dojo/dom-construct::place(). + */ + placeAt(reference: HTMLElement, position: number): any; + /** + * Place this widget somewhere in the DOM based + * on standard domConstruct.place() conventions. + * A convenience function provided in all _Widgets, providing a simple + * shorthand mechanism to put an existing (or newly created) Widget + * somewhere in the dom, and allow chaining. + * + * @param reference Widget, DOMNode, or id of widget or DOMNode + * @param position OptionalIf reference is a widget (or id of widget), and that widget has an ".addChild" method,it will be called passing this widget instance into that method, supplying the optionalposition index passed. In this case position (if specified) should be an integer.If reference is a DOMNode (or id matching a DOMNode but not a widget),the position argument can be a numeric index or a string"first", "last", "before", or "after", same as dojo/dom-construct::place(). + */ + placeAt(reference: dijit._WidgetBase, position: number): any; + /** + * + */ + postCreate(): void; + /** + * Called after the parameters to the widget have been read-in, + * but before the widget template is instantiated. Especially + * useful to set properties that are referenced in the widget + * template. + * + */ + postMixInProperties(): void; + /** + * Set a property on a widget + * Sets named properties on a widget which may potentially be handled by a + * setter in the widget. + * + * For example, if the widget has properties foo and bar + * and a method named _setFooAttr(), calling + * myWidget.set("foo", "Howdy!") would be equivalent to calling + * widget._setFooAttr("Howdy!") and myWidget.set("bar", 3) + * would be equivalent to the statement widget.bar = 3; + * + * set() may also be called with a hash of name/value pairs, ex: + * + * myWidget.set({ + * foo: "Howdy", + * bar: 3 + * }); + * This is equivalent to calling set(foo, "Howdy") and set(bar, 3) + * + * @param name The property to set. + * @param value The value to set in the property. + */ + set(name: any, value: any): any; + /** + * Deprecated. Use set() instead. + * + * @param attr + * @param value + */ + setAttribute(attr: String, value: any): void; + /** + * Processing after the DOM fragment is added to the document + * Called after a widget and its children have been created and added to the page, + * and all related widgets have finished their create() cycle, up through postCreate(). + * + * Note that startup() may be called while the widget is still hidden, for example if the widget is + * inside a hidden dijit/Dialog or an unselected tab of a dijit/layout/TabContainer. + * For widgets that need to do layout, it's best to put that layout code inside resize(), and then + * extend dijit/layout/_LayoutWidget so that resize() is called when the widget is visible. + * + */ + startup(): void; + /** + * Deprecated, will be removed in 2.0, use this.own(topic.subscribe()) instead. + * + * Subscribes to the specified topic and calls the specified method + * of this object and registers for unsubscribe() on widget destroy. + * + * Provide widget-specific analog to dojo.subscribe, except with the + * implicit use of this widget as the target object. + * + * @param t The topic + * @param method The callback + */ + subscribe(t: String, method: Function): any; + /** + * Returns a string that represents the widget. + * When a widget is cast to a string, this method will be used to generate the + * output. Currently, it does not implement any sort of reversible + * serialization. + * + */ + toString(): String; + /** + * Deprecated. Override destroy() instead to implement custom widget tear-down + * behavior. + * + */ + uninitialize(): boolean; + /** + * Deprecated, will be removed in 2.0, use handle.remove() instead. + * + * Unsubscribes handle created by this.subscribe. + * Also removes handle from this widget's list of subscriptions + * + * @param handle + */ + unsubscribe(handle: Object): void; + /** + * Watches a property for changes + * + * @param name OptionalIndicates the property to watch. This is optional (the callback may be theonly parameter), and if omitted, all the properties will be watched + * @param callback The function to execute when the property changes. This will be called afterthe property has been changed. The callback will be called with the |this|set to the instance, the first argument as the name of the property, thesecond argument as the old value and the third argument as the new value. + */ + watch(property: string, callback:{(property?:string, oldValue?:any, newValue?: any):void}) :{unwatch():void}; + /** + * Static method to get a template based on the templatePath or + * templateString key + */ + getCachedTemplate(): any; + /** + * Called when the widget stops being "active" because + * focus moved to something outside of it, or the user + * clicked somewhere outside of it, or the widget was + * hidden. + * + */ + onBlur(): void; + /** + * Callback when a cell is selected. + * + * @param value Value corresponding to cell. + */ + onChange(value: String): void; + /** + * Connect to this function to receive notifications of mouse click events. + * + * @param event mouse Event + */ + onClick(event: any): void; + /** + * Called when this widget is being displayed as a popup (ex: a Calendar popped + * up from a DateTextBox), and it is hidden. + * This is called from the dijit.popup code, and should not be called directly. + * + * Also used as a parameter for children of dijit/layout/StackContainer or subclasses. + * Callback if a user tries to close the child. Child will be closed if this function returns true. + * + */ + onClose(): boolean; + /** + * Connect to this function to receive notifications of mouse double click events. + * + * @param event mouse Event + */ + onDblClick(event: any): void; + /** + * Called when the widget becomes "active" because + * it or a widget inside of it either has focus, or has recently + * been clicked. + * + */ + onFocus(): void; + /** + * Called when another widget becomes the selected pane in a + * dijit/layout/TabContainer, dijit/layout/StackContainer, + * dijit/layout/AccordionContainer, etc. + * + * Also called to indicate hide of a dijit.Dialog, dijit.TooltipDialog, or dijit.TitlePane. + * + */ + onHide(): void; + /** + * Connect to this function to receive notifications of keys being pressed down. + * + * @param event key Event + */ + onKeyDown(event: any): void; + /** + * Connect to this function to receive notifications of printable keys being typed. + * + * @param event key Event + */ + onKeyPress(event: any): void; + /** + * Connect to this function to receive notifications of keys being released. + * + * @param event key Event + */ + onKeyUp(event: any): void; + /** + * Connect to this function to receive notifications of when the mouse button is pressed down. + * + * @param event mouse Event + */ + onMouseDown(event: any): void; + /** + * Connect to this function to receive notifications of when the mouse moves onto this widget. + * + * @param event mouse Event + */ + onMouseEnter(event: any): void; + /** + * Connect to this function to receive notifications of when the mouse moves off of this widget. + * + * @param event mouse Event + */ + onMouseLeave(event: any): void; + /** + * Connect to this function to receive notifications of when the mouse moves over nodes contained within this widget. + * + * @param event mouse Event + */ + onMouseMove(event: any): void; + /** + * Connect to this function to receive notifications of when the mouse moves off of nodes contained within this widget. + * + * @param event mouse Event + */ + onMouseOut(event: any): void; + /** + * Connect to this function to receive notifications of when the mouse moves onto nodes contained within this widget. + * + * @param event mouse Event + */ + onMouseOver(event: any): void; + /** + * Connect to this function to receive notifications of when the mouse button is released. + * + * @param event mouse Event + */ + onMouseUp(event: any): void; + /** + * Called when this widget becomes the selected pane in a + * dijit/layout/TabContainer, dijit/layout/StackContainer, + * dijit/layout/AccordionContainer, etc. + * + * Also called to indicate display of a dijit.Dialog, dijit.TooltipDialog, or dijit.TitlePane. + * + */ + onShow(): void; + } + module ColorPalette { + /** + * Permalink: http://dojotoolkit.org/api/1.9/dijit/ColorPalette._Color.html + * + * Object associated with each cell in a ColorPalette palette. + * Implements dijit/Dye. + * + * @param alias English name of the color. + * @param row Vertical position in grid. + * @param col + * @param title Localized name of the color. + */ + class _Color extends dojo._base.Color { + constructor(alias: String, row: number, col: any, title: String); + /** + * + */ + "a": number; + /** + * + */ + "b": number; + /** + * + */ + "g": number; + /** + * + */ + "hcTemplate": string; + /** + * + */ + "r": number; + /** + * + */ + "template": string; + /** + * + * @param cell + * @param blankGif + */ + fillCell(cell: HTMLElement, blankGif: String): void; + /** + * Note that although dijit._Color is initialized with a value like "white" getValue() always + * returns a hex value + * + */ + getValue(): any; + /** + * makes sure that the object has correct attributes + * + */ + sanitize(): void; + /** + * Takes a named string, hex string, array of rgb or rgba values, + * an object with r, g, b, and a properties, or another Color object + * and sets this color instance to that value. + * + * @param color + */ + setColor(color: any[]): Function; + /** + * Takes a named string, hex string, array of rgb or rgba values, + * an object with r, g, b, and a properties, or another Color object + * and sets this color instance to that value. + * + * @param color + */ + setColor(color: String): Function; + /** + * Takes a named string, hex string, array of rgb or rgba values, + * an object with r, g, b, and a properties, or another Color object + * and sets this color instance to that value. + * + * @param color + */ + setColor(color: Object): Function; + /** + * Returns a css color string in rgb(a) representation + * + * @param includeAlpha Optional + */ + toCss(includeAlpha: boolean): String; + /** + * Returns a CSS color string in hexadecimal representation + * + */ + toHex(): String; + /** + * Returns 3 component array of rgb values + * + */ + toRgb(): any[]; + /** + * Returns a 4 component array of rgba values from the color + * represented by this object. + * + */ + toRgba(): any[]; + /** + * Returns a visual representation of the color + * + */ + toString(): any; + } + } + + /** + * Permalink: http://dojotoolkit.org/api/1.9/dijit/Fieldset.html + * + * An accessible fieldset that can be expanded or collapsed via + * its legend. Fieldset extends dijit.TitlePane. + * + * @param params Hash of initialization parameters for widget, including scalar values (like title, duration etc.)and functions, typically callbacks like onClick.The hash can contain any of the widget's properties, excluding read-only properties. + * @param srcNodeRef OptionalIf a srcNodeRef (DOM node) is specified:use srcNodeRef.innerHTML as my contentsif this is a behavioral widget then apply behavior to that srcNodeRefotherwise, replace srcNodeRef with my generated DOM tree + */ + class Fieldset extends dijit.TitlePane { + constructor(params?: Object, srcNodeRef?: HTMLElement); + /** + * True if mouse was pressed while over this widget, and hasn't been released yet + * + */ + "active": boolean; + set(property:"active", value: boolean): void; + get(property:"active"): boolean; + watch(property:"active", callback:{(property?:string, oldValue?:boolean, newValue?: boolean):void}) :{unwatch():void} + /** + * Object to which attach points and events will be scoped. Defaults + * to 'this'. + * + */ + "attachScope": Object; + set(property:"attachScope", value: Object): void; + get(property:"attachScope"): Object; + watch(property:"attachScope", callback:{(property?:string, oldValue?:Object, newValue?: Object):void}) :{unwatch():void} + /** + * Deprecated. Instead of attributeMap, widget should have a _setXXXAttr attribute + * for each XXX attribute to be mapped to the DOM. + * + * attributeMap sets up a "binding" between attributes (aka properties) + * of the widget and the widget's DOM. + * Changes to widget attributes listed in attributeMap will be + * reflected into the DOM. + * + * For example, calling set('title', 'hello') + * on a TitlePane will automatically cause the TitlePane's DOM to update + * with the new title. + * + * attributeMap is a hash where the key is an attribute of the widget, + * and the value reflects a binding to a: + * + * DOM node attribute + * focus: {node: "focusNode", type: "attribute"} + * Maps this.focus to this.focusNode.focus + * + * DOM node innerHTML + * title: { node: "titleNode", type: "innerHTML" } + * Maps this.title to this.titleNode.innerHTML + * + * DOM node innerText + * title: { node: "titleNode", type: "innerText" } + * Maps this.title to this.titleNode.innerText + * + * DOM node CSS class + * myClass: { node: "domNode", type: "class" } + * Maps this.myClass to this.domNode.className + * + * If the value is an array, then each element in the array matches one of the + * formats of the above list. + * + * There are also some shorthands for backwards compatibility: + * + * string --> { node: string, type: "attribute" }, for example: + * "focusNode" ---> { node: "focusNode", type: "attribute" } + * "" --> { node: "domNode", type: "attribute" } + * + */ + "attributeMap": Object; + set(property:"attributeMap", value: Object): void; + get(property:"attributeMap"): Object; + watch(property:"attributeMap", callback:{(property?:string, oldValue?:Object, newValue?: Object):void}) :{unwatch():void} + /** + * The root className to use for the various states of this widget + * + */ + "baseClass": string; + set(property:"baseClass", value: string): void; + get(property:"baseClass"): string; + watch(property:"baseClass", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * + */ + "class": string; + set(property:"class", value: string): void; + get(property:"class"): string; + watch(property:"class", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * Designates where children of the source DOM node will be placed. + * "Children" in this case refers to both DOM nodes and widgets. + * For example, for myWidget: + * + *
+ * here's a plain DOM node + * and a widget + * and another plain DOM node + *
+ * containerNode would point to: + * + * here's a plain DOM node + * and a widget + * and another plain DOM node + * In templated widgets, "containerNode" is set via a + * data-dojo-attach-point assignment. + * + * containerNode must be defined for any widget that accepts innerHTML + * (like ContentPane or BorderContainer or even Button), and conversely + * is null for widgets that don't, like TextBox. + * + */ + "containerNode": HTMLElement; + set(property:"containerNode", value: HTMLElement): void; + get(property:"containerNode"): HTMLElement; + watch(property:"containerNode", callback:{(property?:string, oldValue?:HTMLElement, newValue?: HTMLElement):void}) :{unwatch():void} + /** + * The innerHTML of the ContentPane. + * Note that the initialization parameter / argument to set("content", ...) + * can be a String, DomNode, Nodelist, or _Widget. + * + */ + "content": string; + set(property:"content", value: string): void; + get(property:"content"): string; + watch(property:"content", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * Subclasses may define a cssStateNodes property that lists sub-nodes within the widget that + * need CSS classes applied on mouse hover/press and focus. + * + * Each entry in this optional hash is a an attach-point name (like "upArrowButton") mapped to a CSS class name + * (like "dijitUpArrowButton"). Example: + * + * { + * "upArrowButton": "dijitUpArrowButton", + * "downArrowButton": "dijitDownArrowButton" + * } + * The above will set the CSS class dijitUpArrowButton to the this.upArrowButton DOMNode when it + * + * is hovered, etc. + * + */ + "cssStateNodes": Object; + set(property:"cssStateNodes", value: Object): void; + get(property:"cssStateNodes"): Object; + watch(property:"cssStateNodes", callback:{(property?:string, oldValue?:Object, newValue?: Object):void}) :{unwatch():void} + /** + * Bi-directional support, as defined by the HTML DIR + * attribute. Either left-to-right "ltr" or right-to-left "rtl". If undefined, widgets renders in page's + * default direction. + * + */ + "dir": string; + set(property:"dir", value: string): void; + get(property:"dir"): string; + watch(property:"dir", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * Don't change this parameter from the default value. + * This ContentPane parameter doesn't make sense for TitlePane, since TitlePane + * is never a child of a layout container, nor should TitlePane try to control + * the size of an inner widget. + * + */ + "doLayout": boolean; + set(property:"doLayout", value: boolean): void; + get(property:"doLayout"): boolean; + watch(property:"doLayout", callback:{(property?:string, oldValue?:boolean, newValue?: boolean):void}) :{unwatch():void} + /** + * This is our visible representation of the widget! Other DOM + * Nodes may by assigned to other properties, usually through the + * template system's data-dojo-attach-point syntax, but the domNode + * property is the canonical "top level" node in widget UI. + * + */ + "domNode": HTMLElement; + set(property:"domNode", value: HTMLElement): void; + get(property:"domNode"): HTMLElement; + watch(property:"domNode", callback:{(property?:string, oldValue?:HTMLElement, newValue?: HTMLElement):void}) :{unwatch():void} + /** + * Time in milliseconds to fade in/fade out + * + */ + "duration": number; + set(property:"duration", value: number): void; + get(property:"duration"): number; + watch(property:"duration", callback:{(property?:string, oldValue?:number, newValue?: number):void}) :{unwatch():void} + /** + * Message that shows if an error occurs + * + */ + "errorMessage": string; + set(property:"errorMessage", value: string): void; + get(property:"errorMessage"): string; + watch(property:"errorMessage", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * Extract visible content from inside of .... . + * I.e., strip and (and it's contents) from the href + * + */ + "extractContent": boolean; + set(property:"extractContent", value: boolean): void; + get(property:"extractContent"): boolean; + watch(property:"extractContent", callback:{(property?:string, oldValue?:boolean, newValue?: boolean):void}) :{unwatch():void} + /** + * This widget or a widget it contains has focus, or is "active" because + * it was recently clicked. + * + */ + "focused": boolean; + set(property:"focused", value: boolean): void; + get(property:"focused"): boolean; + watch(property:"focused", callback:{(property?:string, oldValue?:boolean, newValue?: boolean):void}) :{unwatch():void} + /** + * True if cursor is over this widget + * + */ + "hovering": boolean; + set(property:"hovering", value: boolean): void; + get(property:"hovering"): boolean; + watch(property:"hovering", callback:{(property?:string, oldValue?:boolean, newValue?: boolean):void}) :{unwatch():void} + /** + * The href of the content that displays now. + * Set this at construction if you want to load data externally when the + * pane is shown. (Set preload=true to load it immediately.) + * Changing href after creation doesn't have any effect; Use set('href', ...); + * + */ + "href": string; + set(property:"href", value: string): void; + get(property:"href"): string; + watch(property:"href", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * A unique, opaque ID string that can be assigned by users or by the + * system. If the developer passes an ID which is known not to be + * unique, the specified ID is ignored and the system-generated ID is + * used instead. + * + */ + "id": string; + set(property:"id", value: string): void; + get(property:"id"): string; + watch(property:"id", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * Parameters to pass to xhrGet() request, for example: + * + *
+ * + */ + "ioArgs": Object; + set(property:"ioArgs", value: Object): void; + get(property:"ioArgs"): Object; + watch(property:"ioArgs", callback:{(property?:string, oldValue?:Object, newValue?: Object):void}) :{unwatch():void} + /** + * Indicates that this widget will call resize() on it's child widgets + * when they become visible. + * + */ + "isLayoutContainer": boolean; + set(property:"isLayoutContainer", value: boolean): void; + get(property:"isLayoutContainer"): boolean; + watch(property:"isLayoutContainer", callback:{(property?:string, oldValue?:boolean, newValue?: boolean):void}) :{unwatch():void} + /** + * True if the ContentPane has data in it, either specified + * during initialization (via href or inline content), or set + * via set('content', ...) / set('href', ...) + * + * False if it doesn't have any content, or if ContentPane is + * still in the process of downloading href. + * + */ + "isLoaded": boolean; + set(property:"isLoaded", value: boolean): void; + get(property:"isLoaded"): boolean; + watch(property:"isLoaded", callback:{(property?:string, oldValue?:boolean, newValue?: boolean):void}) :{unwatch():void} + /** + * Rarely used. Overrides the default Dojo locale used to render this widget, + * as defined by the HTML LANG attribute. + * Value must be among the list of locales specified during by the Dojo bootstrap, + * formatted according to RFC 3066 (like en-us). + * + */ + "lang": string; + set(property:"lang", value: string): void; + get(property:"lang"): string; + watch(property:"lang", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * Message that shows while downloading + * + */ + "loadingMessage": string; + set(property:"loadingMessage", value: string): void; + get(property:"loadingMessage"): string; + watch(property:"loadingMessage", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * This is the dojo.Deferred returned by set('href', ...) and refresh(). + * Calling onLoadDeferred.then() registers your + * callback to be called only once, when the prior set('href', ...) call or + * the initial href parameter to the constructor finishes loading. + * + * This is different than an onLoad() handler which gets called any time any href + * or content is loaded. + * + */ + "onLoadDeferred": Object; + set(property:"onLoadDeferred", value: Object): void; + get(property:"onLoadDeferred"): Object; + watch(property:"onLoadDeferred", callback:{(property?:string, oldValue?:Object, newValue?: Object):void}) :{unwatch():void} + /** + * Whether fieldset is opened or closed. + * + */ + "open": boolean; + set(property:"open", value: boolean): void; + get(property:"open"): boolean; + watch(property:"open", callback:{(property?:string, oldValue?:boolean, newValue?: boolean):void}) :{unwatch():void} + /** + * The document this widget belongs to. If not specified to constructor, will default to + * srcNodeRef.ownerDocument, or if no sourceRef specified, then to the document global + * + */ + "ownerDocument": Object; + set(property:"ownerDocument", value: Object): void; + get(property:"ownerDocument"): Object; + watch(property:"ownerDocument", callback:{(property?:string, oldValue?:Object, newValue?: Object):void}) :{unwatch():void} + /** + * Parse content and create the widgets, if any. + * + */ + "parseOnLoad": boolean; + set(property:"parseOnLoad", value: boolean): void; + get(property:"parseOnLoad"): boolean; + watch(property:"parseOnLoad", callback:{(property?:string, oldValue?:boolean, newValue?: boolean):void}) :{unwatch():void} + /** + * Flag passed to parser. Root for attribute names to search for. If scopeName is dojo, + * will search for data-dojo-type (or dojoType). For backwards compatibility + * reasons defaults to dojo._scopeName (which is "dojo" except when + * multi-version support is used, when it will be something like dojo16, dojo20, etc.) + * + */ + "parserScope": string; + set(property:"parserScope", value: string): void; + get(property:"parserScope"): string; + watch(property:"parserScope", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * Force load of data on initialization even if pane is hidden. + * + */ + "preload": boolean; + set(property:"preload", value: boolean): void; + get(property:"preload"): boolean; + watch(property:"preload", callback:{(property?:string, oldValue?:boolean, newValue?: boolean):void}) :{unwatch():void} + /** + * Prevent caching of data from href's by appending a timestamp to the href. + * + */ + "preventCache": boolean; + set(property:"preventCache", value: boolean): void; + get(property:"preventCache"): boolean; + watch(property:"preventCache", callback:{(property?:string, oldValue?:boolean, newValue?: boolean):void}) :{unwatch():void} + /** + * Refresh (re-download) content when pane goes from hidden to shown + * + */ + "refreshOnShow": boolean; + set(property:"refreshOnShow", value: boolean): void; + get(property:"refreshOnShow"): boolean; + watch(property:"refreshOnShow", callback:{(property?:string, oldValue?:boolean, newValue?: boolean):void}) :{unwatch():void} + /** + * + */ + "searchContainerNode": boolean; + set(property:"searchContainerNode", value: boolean): void; + get(property:"searchContainerNode"): boolean; + watch(property:"searchContainerNode", callback:{(property?:string, oldValue?:boolean, newValue?: boolean):void}) :{unwatch():void} + /** + * pointer to original DOM node + * + */ + "srcNodeRef": HTMLElement; + set(property:"srcNodeRef", value: HTMLElement): void; + get(property:"srcNodeRef"): HTMLElement; + watch(property:"srcNodeRef", callback:{(property?:string, oldValue?:HTMLElement, newValue?: HTMLElement):void}) :{unwatch():void} + /** + * + */ + "stopParser": boolean; + set(property:"stopParser", value: boolean): void; + get(property:"stopParser"): boolean; + watch(property:"stopParser", callback:{(property?:string, oldValue?:boolean, newValue?: boolean):void}) :{unwatch():void} + /** + * HTML style attributes as cssText string or name/value hash + * + */ + "style": string; + set(property:"style", value: string): void; + get(property:"style"): string; + watch(property:"style", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * Tabindex setting for the title (so users can tab to the title then + * use space/enter to open/close the title pane) + * + */ + "tabIndex": string; + set(property:"tabIndex", value: string): void; + get(property:"tabIndex"): string; + watch(property:"tabIndex", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * Path to template (HTML file) for this widget relative to dojo.baseUrl. + * Deprecated: use templateString with require([... "dojo/text!..."], ...) instead + * + */ + "templatePath": string; + set(property:"templatePath", value: string): void; + get(property:"templatePath"): string; + watch(property:"templatePath", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * + */ + "templateString": string; + set(property:"templateString", value: string): void; + get(property:"templateString"): string; + watch(property:"templateString", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * Content of the legend tag. Overrides tag if not empty. + * + */ + "title": string; + set(property:"title", value: string): void; + get(property:"title"): string; + watch(property:"title", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * Whether pane can be opened or closed by clicking the title bar. + * + */ + "toggleable": boolean; + set(property:"toggleable", value: boolean): void; + get(property:"toggleable"): boolean; + watch(property:"toggleable", callback:{(property?:string, oldValue?:boolean, newValue?: boolean):void}) :{unwatch():void} + /** + * When this widget's title attribute is used to for a tab label, accordion pane title, etc., + * this specifies the tooltip to appear when the mouse is hovered over that text. + * + */ + "tooltip": string; + set(property:"tooltip", value: string): void; + get(property:"tooltip"): string; + watch(property:"tooltip", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * Makes the given widget a child of this widget. + * Inserts specified child widget's dom node as a child of this widget's + * container node, and possibly does other processing (such as layout). + * + * @param widget + * @param insertIndex Optional + */ + addChild(widget: dijit._WidgetBase, insertIndex: number): void; + /** + * This method is deprecated, use get() or set() directly. + * + * @param name The property to get or set. If an object is passed here and nota string, its keys are used as names of attributes to be setand the value of the object as values to set in the widget. + * @param value OptionalOptional. If provided, attr() operates as a setter. If omitted,the current value of the named property is returned. + */ + attr(name: String, value: Object): any; + /** + * This method is deprecated, use get() or set() directly. + * + * @param name The property to get or set. If an object is passed here and nota string, its keys are used as names of attributes to be setand the value of the object as values to set in the widget. + * @param value OptionalOptional. If provided, attr() operates as a setter. If omitted,the current value of the named property is returned. + */ + attr(name: Object, value: Object): any; + /** + * + */ + buildRendering(): void; + /** + * Cancels an in-flight download of content + * + */ + cancel(): void; + /** + * Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead. + * + * Connects specified obj/event to specified method of this object + * and registers for disconnect() on widget destroy. + * + * Provide widget-specific analog to dojo.connect, except with the + * implicit use of this widget as the target object. + * Events connected with this.connect are disconnected upon + * destruction. + * + * @param obj + * @param event + * @param method + */ + connect(obj: Object, event: String, method: String): any; + /** + * Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead. + * + * Connects specified obj/event to specified method of this object + * and registers for disconnect() on widget destroy. + * + * Provide widget-specific analog to dojo.connect, except with the + * implicit use of this widget as the target object. + * Events connected with this.connect are disconnected upon + * destruction. + * + * @param obj + * @param event + * @param method + */ + connect(obj: any, event: String, method: String): any; + /** + * Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead. + * + * Connects specified obj/event to specified method of this object + * and registers for disconnect() on widget destroy. + * + * Provide widget-specific analog to dojo.connect, except with the + * implicit use of this widget as the target object. + * Events connected with this.connect are disconnected upon + * destruction. + * + * @param obj + * @param event + * @param method + */ + connect(obj: Object, event: Function, method: String): any; + /** + * Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead. + * + * Connects specified obj/event to specified method of this object + * and registers for disconnect() on widget destroy. + * + * Provide widget-specific analog to dojo.connect, except with the + * implicit use of this widget as the target object. + * Events connected with this.connect are disconnected upon + * destruction. + * + * @param obj + * @param event + * @param method + */ + connect(obj: any, event: Function, method: String): any; + /** + * Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead. + * + * Connects specified obj/event to specified method of this object + * and registers for disconnect() on widget destroy. + * + * Provide widget-specific analog to dojo.connect, except with the + * implicit use of this widget as the target object. + * Events connected with this.connect are disconnected upon + * destruction. + * + * @param obj + * @param event + * @param method + */ + connect(obj: Object, event: String, method: Function): any; + /** + * Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead. + * + * Connects specified obj/event to specified method of this object + * and registers for disconnect() on widget destroy. + * + * Provide widget-specific analog to dojo.connect, except with the + * implicit use of this widget as the target object. + * Events connected with this.connect are disconnected upon + * destruction. + * + * @param obj + * @param event + * @param method + */ + connect(obj: any, event: String, method: Function): any; + /** + * Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead. + * + * Connects specified obj/event to specified method of this object + * and registers for disconnect() on widget destroy. + * + * Provide widget-specific analog to dojo.connect, except with the + * implicit use of this widget as the target object. + * Events connected with this.connect are disconnected upon + * destruction. + * + * @param obj + * @param event + * @param method + */ + connect(obj: Object, event: Function, method: Function): any; + /** + * Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead. + * + * Connects specified obj/event to specified method of this object + * and registers for disconnect() on widget destroy. + * + * Provide widget-specific analog to dojo.connect, except with the + * implicit use of this widget as the target object. + * Events connected with this.connect are disconnected upon + * destruction. + * + * @param obj + * @param event + * @param method + */ + connect(obj: any, event: Function, method: Function): any; + /** + * + * @param params + * @param srcNodeRef + */ + create(params: any, srcNodeRef: any): void; + /** + * Wrapper to setTimeout to avoid deferred functions executing + * after the originating widget has been destroyed. + * Returns an object handle with a remove method (that returns null) (replaces clearTimeout). + * + * @param fcn Function reference. + * @param delay OptionalDelay, defaults to 0. + */ + defer(fcn: Function, delay: number): Object; + /** + * + */ + destroy(): void; + /** + * Destroy all the widgets inside the ContentPane and empty containerNode + * + * @param preserveDom + */ + destroyDescendants(preserveDom?: boolean): void; + /** + * Destroy the ContentPane and its contents + * + * @param preserveDom + */ + destroyRecursive(preserveDom?: boolean): void; + /** + * Destroys the DOM nodes associated with this widget. + * + * @param preserveDom OptionalIf true, this method will leave the original DOM structure aloneduring tear-down. Note: this will not work with _Templatedwidgets yet. + */ + destroyRendering(preserveDom?: boolean): void; + /** + * Deprecated, will be removed in 2.0, use handle.remove() instead. + * + * Disconnects handle created by connect. + * + * @param handle + */ + disconnect(handle: any): void; + /** + * Used by widgets to signal that a synthetic event occurred, ex: + * + * myWidget.emit("attrmodified-selectedChildWidget", {}). + * Emits an event on this.domNode named type.toLowerCase(), based on eventObj. + * Also calls onType() method, if present, and returns value from that method. + * By default passes eventObj to callback, but will pass callbackArgs instead, if specified. + * Modifies eventObj by adding missing parameters (bubbles, cancelable, widget). + * + * @param type + * @param eventObj Optional + * @param callbackArgs Optional + */ + emit(type: String, eventObj: Object, callbackArgs: any[]): any; + /** + * Get a property from a widget. + * Get a named property from a widget. The property may + * potentially be retrieved via a getter method. If no getter is defined, this + * just retrieves the object's property. + * + * For example, if the widget has properties foo and bar + * and a method named _getFooAttr(), calling: + * myWidget.get("foo") would be equivalent to calling + * widget._getFooAttr() and myWidget.get("bar") + * would be equivalent to the expression + * widget.bar2 + * + * @param name The property to get. + */ + get(name: any): any; + /** + * Returns all direct children of this widget, i.e. all widgets underneath this.containerNode whose parent + * is this widget. Note that it does not return all descendants, but rather just direct children. + * Analogous to Node.childNodes, + * except containing widgets rather than DOMNodes. + * + * The result intentionally excludes internally created widgets (a.k.a. supporting widgets) + * outside of this.containerNode. + * + * Note that the array returned is a simple array. Application code should not assume + * existence of methods like forEach(). + * + */ + getChildren(): any[]; + /** + * Returns all the widgets contained by this, i.e., all widgets underneath this.containerNode. + * This method should generally be avoided as it returns widgets declared in templates, which are + * supposed to be internal/hidden, but it's left here for back-compat reasons. + * + */ + getDescendants(): any[]; + /** + * Gets the index of the child in this container or -1 if not found + * + * @param child + */ + getIndexOfChild(child: dijit._WidgetBase): any; + /** + * Returns the parent widget of this widget. + * + */ + getParent(): any; + /** + * Returns true if widget has child widgets, i.e. if this.containerNode contains widgets. + * + */ + hasChildren(): boolean; + /** + * Function that should grab the content specified via href. + * + * @param args An object with the following properties:handleAs (String, optional): Acceptable values are: text (default), json, json-comment-optional,json-comment-filtered, javascript, xml. See dojo/_base/xhr.contentHandlerssync (Boolean, optional): false is default. Indicates whether the request shouldbe a synchronous (blocking) request.headers (Object, optional): Additional HTTP headers to send in the request.failOk (Boolean, optional): false is default. Indicates whether a request should beallowed to fail (and therefore no console error message inthe event of a failure)contentType (String|Boolean): "application/x-www-form-urlencoded" is default. Set to false toprevent a Content-Type header from being sent, or to a stringto send a different Content-Type.load: This function will becalled on a successful HTTP response code.error: This function willbe called when the request fails due to a network or server error, the urlis invalid, etc. It will also be called if the load or handle callback throws anexception, unless djConfig.debugAtAllCosts is true. This allows deployed applicationsto continue to run even when a logic error happens in the callback, while makingit easier to troubleshoot while in debug mode.handle: This function willbe called at the end of every request, whether or not an error occurs.url (String): URL to server endpoint.content (Object, optional): Contains properties with string values. Theseproperties will be serialized as name1=value2 andpassed in the request.timeout (Integer, optional): Milliseconds to wait for the response. If this timepasses, the then error callbacks are called.form (DOMNode, optional): DOM node for a form. Used to extract the form valuesand send to the server.preventCache (Boolean, optional): Default is false. If true, then a"dojo.preventCache" parameter is sent in the requestwith a value that changes with each request(timestamp). Useful only with GET-type requests.rawBody (String, optional): Sets the raw body for an HTTP request. If this is used, then the contentproperty is ignored. This is mostly useful for HTTP methods that havea body to their requests, like PUT or POST. This property can be used insteadof postData and putData for dojo/_base/xhr.rawXhrPost and dojo/_base/xhr.rawXhrPut respectively.ioPublish (Boolean, optional): Set this explicitly to false to prevent publishing of topics related toIO operations. Otherwise, if djConfig.ioPublish is set to true, topicswill be published via dojo/topic.publish() for different phases of an IO operation.See dojo/main.__IoPublish for a list of topics that are published. + */ + ioMethod(args: Object): any; + /** + * Return true if this widget can currently be focused + * and false if not + * + */ + isFocusable(): any; + /** + * Return this widget's explicit or implicit orientation (true for LTR, false for RTL) + * + */ + isLeftToRight(): any; + /** + * + * @param params + * @param node + * @param ctor + */ + markupFactory(params: any, node: any, ctor: any): any; + /** + * + * @param type protected + * @param func + */ + on(type: String, func: Function): any; + /** + * + * @param type protected + * @param func + */ + on(type: Function, func: Function): any; + /** + * Track specified handles and remove/destroy them when this instance is destroyed, unless they were + * already removed/destroyed manually. + * + */ + own(): any; + /** + * Place this widget somewhere in the DOM based + * on standard domConstruct.place() conventions. + * A convenience function provided in all _Widgets, providing a simple + * shorthand mechanism to put an existing (or newly created) Widget + * somewhere in the dom, and allow chaining. + * + * @param reference Widget, DOMNode, or id of widget or DOMNode + * @param position OptionalIf reference is a widget (or id of widget), and that widget has an ".addChild" method,it will be called passing this widget instance into that method, supplying the optionalposition index passed. In this case position (if specified) should be an integer.If reference is a DOMNode (or id matching a DOMNode but not a widget),the position argument can be a numeric index or a string"first", "last", "before", or "after", same as dojo/dom-construct::place(). + */ + placeAt(reference: String, position: String): any; + /** + * Place this widget somewhere in the DOM based + * on standard domConstruct.place() conventions. + * A convenience function provided in all _Widgets, providing a simple + * shorthand mechanism to put an existing (or newly created) Widget + * somewhere in the dom, and allow chaining. + * + * @param reference Widget, DOMNode, or id of widget or DOMNode + * @param position OptionalIf reference is a widget (or id of widget), and that widget has an ".addChild" method,it will be called passing this widget instance into that method, supplying the optionalposition index passed. In this case position (if specified) should be an integer.If reference is a DOMNode (or id matching a DOMNode but not a widget),the position argument can be a numeric index or a string"first", "last", "before", or "after", same as dojo/dom-construct::place(). + */ + placeAt(reference: HTMLElement, position: String): any; + /** + * Place this widget somewhere in the DOM based + * on standard domConstruct.place() conventions. + * A convenience function provided in all _Widgets, providing a simple + * shorthand mechanism to put an existing (or newly created) Widget + * somewhere in the dom, and allow chaining. + * + * @param reference Widget, DOMNode, or id of widget or DOMNode + * @param position OptionalIf reference is a widget (or id of widget), and that widget has an ".addChild" method,it will be called passing this widget instance into that method, supplying the optionalposition index passed. In this case position (if specified) should be an integer.If reference is a DOMNode (or id matching a DOMNode but not a widget),the position argument can be a numeric index or a string"first", "last", "before", or "after", same as dojo/dom-construct::place(). + */ + placeAt(reference: dijit._WidgetBase, position: String): any; + /** + * Place this widget somewhere in the DOM based + * on standard domConstruct.place() conventions. + * A convenience function provided in all _Widgets, providing a simple + * shorthand mechanism to put an existing (or newly created) Widget + * somewhere in the dom, and allow chaining. + * + * @param reference Widget, DOMNode, or id of widget or DOMNode + * @param position OptionalIf reference is a widget (or id of widget), and that widget has an ".addChild" method,it will be called passing this widget instance into that method, supplying the optionalposition index passed. In this case position (if specified) should be an integer.If reference is a DOMNode (or id matching a DOMNode but not a widget),the position argument can be a numeric index or a string"first", "last", "before", or "after", same as dojo/dom-construct::place(). + */ + placeAt(reference: String, position: number): any; + /** + * Place this widget somewhere in the DOM based + * on standard domConstruct.place() conventions. + * A convenience function provided in all _Widgets, providing a simple + * shorthand mechanism to put an existing (or newly created) Widget + * somewhere in the dom, and allow chaining. + * + * @param reference Widget, DOMNode, or id of widget or DOMNode + * @param position OptionalIf reference is a widget (or id of widget), and that widget has an ".addChild" method,it will be called passing this widget instance into that method, supplying the optionalposition index passed. In this case position (if specified) should be an integer.If reference is a DOMNode (or id matching a DOMNode but not a widget),the position argument can be a numeric index or a string"first", "last", "before", or "after", same as dojo/dom-construct::place(). + */ + placeAt(reference: HTMLElement, position: number): any; + /** + * Place this widget somewhere in the DOM based + * on standard domConstruct.place() conventions. + * A convenience function provided in all _Widgets, providing a simple + * shorthand mechanism to put an existing (or newly created) Widget + * somewhere in the dom, and allow chaining. + * + * @param reference Widget, DOMNode, or id of widget or DOMNode + * @param position OptionalIf reference is a widget (or id of widget), and that widget has an ".addChild" method,it will be called passing this widget instance into that method, supplying the optionalposition index passed. In this case position (if specified) should be an integer.If reference is a DOMNode (or id matching a DOMNode but not a widget),the position argument can be a numeric index or a string"first", "last", "before", or "after", same as dojo/dom-construct::place(). + */ + placeAt(reference: dijit._WidgetBase, position: number): any; + /** + * + */ + postCreate(): void; + /** + * + */ + postMixInProperties(): void; + /** + * [Re]download contents of href and display + * cancels any currently in-flight requests + * posts "loading..." message + * sends XHR to download new data + * + */ + refresh(): any; + /** + * Removes the passed widget instance from this widget but does + * not destroy it. You can also pass in an integer indicating + * the index within the container to remove (ie, removeChild(5) removes the sixth widget). + * + * @param widget + */ + removeChild(widget: dijit._WidgetBase): void; + /** + * Removes the passed widget instance from this widget but does + * not destroy it. You can also pass in an integer indicating + * the index within the container to remove (ie, removeChild(5) removes the sixth widget). + * + * @param widget + */ + removeChild(widget: number): void; + /** + * See dijit/layout/_LayoutWidget.resize() for description. + * Although ContentPane doesn't extend _LayoutWidget, it does implement + * the same API. + * + * @param changeSize + * @param resultSize + */ + resize(changeSize: any, resultSize: any): void; + /** + * Set a property on a widget + * Sets named properties on a widget which may potentially be handled by a + * setter in the widget. + * + * For example, if the widget has properties foo and bar + * and a method named _setFooAttr(), calling + * myWidget.set("foo", "Howdy!") would be equivalent to calling + * widget._setFooAttr("Howdy!") and myWidget.set("bar", 3) + * would be equivalent to the statement widget.bar = 3; + * + * set() may also be called with a hash of name/value pairs, ex: + * + * myWidget.set({ + * foo: "Howdy", + * bar: 3 + * }); + * This is equivalent to calling set(foo, "Howdy") and set(bar, 3) + * + * @param name The property to set. + * @param value The value to set in the property. + */ + set(name: any, value: any): any; + /** + * Deprecated. Use set() instead. + * + * @param attr + * @param value + */ + setAttribute(attr: String, value: any): void; + /** + * Deprecated. Use set('content', ...) instead. + * + * @param data + */ + setContent(data: String): void; + /** + * Deprecated. Use set('content', ...) instead. + * + * @param data + */ + setContent(data: HTMLElement): void; + /** + * Deprecated. Use set('content', ...) instead. + * + * @param data + */ + setContent(data: NodeList): void; + /** + * Deprecated. Use set('href', ...) instead. + * + * @param href + */ + setHref(href: String): any; + /** + * Deprecated. Use set('href', ...) instead. + * + * @param href + */ + setHref(href: URL): any; + /** + * Deprecated. Use set('title', ...) instead. + * + * @param title + */ + setTitle(title: String): void; + /** + * Call startup() on all children including non _Widget ones like dojo/dnd/Source objects + * + */ + startup(): void; + /** + * Deprecated, will be removed in 2.0, use this.own(topic.subscribe()) instead. + * + * Subscribes to the specified topic and calls the specified method + * of this object and registers for unsubscribe() on widget destroy. + * + * Provide widget-specific analog to dojo.subscribe, except with the + * implicit use of this widget as the target object. + * + * @param t The topic + * @param method The callback + */ + subscribe(t: String, method: Function): any; + /** + * Returns a string that represents the widget. + * When a widget is cast to a string, this method will be used to generate the + * output. Currently, it does not implement any sort of reversible + * serialization. + * + */ + toString(): String; + /** + * Deprecated. Override destroy() instead to implement custom widget tear-down + * behavior. + * + */ + uninitialize(): boolean; + /** + * Deprecated, will be removed in 2.0, use handle.remove() instead. + * + * Unsubscribes handle created by this.subscribe. + * Also removes handle from this widget's list of subscriptions + * + * @param handle + */ + unsubscribe(handle: Object): void; + /** + * Watches a property for changes + * + * @param name OptionalIndicates the property to watch. This is optional (the callback may be theonly parameter), and if omitted, all the properties will be watched + * @param callback The function to execute when the property changes. This will be called afterthe property has been changed. The callback will be called with the |this|set to the instance, the first argument as the name of the property, thesecond argument as the old value and the third argument as the new value. + */ + watch(property: string, callback:{(property?:string, oldValue?:any, newValue?: any):void}) :{unwatch():void}; + /** + * Static method to get a template based on the templatePath or + * templateString key + */ + getCachedTemplate(): any; + /** + * Called when the widget stops being "active" because + * focus moved to something outside of it, or the user + * clicked somewhere outside of it, or the widget was + * hidden. + * + */ + onBlur(): void; + /** + * Connect to this function to receive notifications of mouse click events. + * + * @param event mouse Event + */ + onClick(event: any): void; + /** + * Called when this widget is being displayed as a popup (ex: a Calendar popped + * up from a DateTextBox), and it is hidden. + * This is called from the dijit.popup code, and should not be called directly. + * + * Also used as a parameter for children of dijit/layout/StackContainer or subclasses. + * Callback if a user tries to close the child. Child will be closed if this function returns true. + * + */ + onClose(): boolean; + /** + * Called on DOM faults, require faults etc. in content. + * + * In order to display an error message in the pane, return + * the error message from this method, as an HTML string. + * + * By default (if this method is not overriden), it returns + * nothing, so the error message is just printed to the console. + * + * @param error + */ + onContentError(error: Error): void; + /** + * Connect to this function to receive notifications of mouse double click events. + * + * @param event mouse Event + */ + onDblClick(event: any): void; + /** + * Called when download is finished. + * + */ + onDownloadEnd(): void; + /** + * Called when download error occurs. + * + * In order to display an error message in the pane, return + * the error message from this method, as an HTML string. + * + * Default behavior (if this method is not overriden) is to display + * the error message inside the pane. + * + * @param error + */ + onDownloadError(error: Error): any; + /** + * Called before download starts. + * The string returned by this function will be the html + * that tells the user we are loading something. + * Override with your own function if you want to change text. + * + */ + onDownloadStart(): any; + /** + * Called when the widget becomes "active" because + * it or a widget inside of it either has focus, or has recently + * been clicked. + * + */ + onFocus(): void; + /** + * Called when another widget becomes the selected pane in a + * dijit/layout/TabContainer, dijit/layout/StackContainer, + * dijit/layout/AccordionContainer, etc. + * + * Also called to indicate hide of a dijit.Dialog, dijit.TooltipDialog, or dijit.TitlePane. + * + */ + onHide(): void; + /** + * Connect to this function to receive notifications of keys being pressed down. + * + * @param event key Event + */ + onKeyDown(event: any): void; + /** + * Connect to this function to receive notifications of printable keys being typed. + * + * @param event key Event + */ + onKeyPress(event: any): void; + /** + * Connect to this function to receive notifications of keys being released. + * + * @param event key Event + */ + onKeyUp(event: any): void; + /** + * Event hook, is called after everything is loaded and widgetified + * + * @param data + */ + onLoad(data: any): void; + /** + * Connect to this function to receive notifications of when the mouse button is pressed down. + * + * @param event mouse Event + */ + onMouseDown(event: any): void; + /** + * Connect to this function to receive notifications of when the mouse moves onto this widget. + * + * @param event mouse Event + */ + onMouseEnter(event: any): void; + /** + * Connect to this function to receive notifications of when the mouse moves off of this widget. + * + * @param event mouse Event + */ + onMouseLeave(event: any): void; + /** + * Connect to this function to receive notifications of when the mouse moves over nodes contained within this widget. + * + * @param event mouse Event + */ + onMouseMove(event: any): void; + /** + * Connect to this function to receive notifications of when the mouse moves off of nodes contained within this widget. + * + * @param event mouse Event + */ + onMouseOut(event: any): void; + /** + * Connect to this function to receive notifications of when the mouse moves onto nodes contained within this widget. + * + * @param event mouse Event + */ + onMouseOver(event: any): void; + /** + * Connect to this function to receive notifications of when the mouse button is released. + * + * @param event mouse Event + */ + onMouseUp(event: any): void; + /** + * Called when this widget becomes the selected pane in a + * dijit/layout/TabContainer, dijit/layout/StackContainer, + * dijit/layout/AccordionContainer, etc. + * + * Also called to indicate display of a dijit.Dialog, dijit.TooltipDialog, or dijit.TitlePane. + * + */ + onShow(): void; + /** + * Event hook, is called before old content is cleared + * + */ + onUnload(): void; + } + /** + * Permalink: http://dojotoolkit.org/api/1.9/dijit/DropDownMenu.html + * + * A menu, without features for context menu (Meaning, drop down menu) + * + * @param params Hash of initialization parameters for widget, including scalar values (like title, duration etc.)and functions, typically callbacks like onClick.The hash can contain any of the widget's properties, excluding read-only properties. + * @param srcNodeRef OptionalIf a srcNodeRef (DOM node) is specified:use srcNodeRef.innerHTML as my contentsif this is a behavioral widget then apply behavior to that srcNodeRefotherwise, replace srcNodeRef with my generated DOM tree + */ + class DropDownMenu extends dijit._MenuBase implements dijit._OnDijitClickMixin { + constructor(params?: Object, srcNodeRef?: HTMLElement); + /** + * This Menu has been clicked (mouse or via space/arrow key) or opened as a submenu, + * so mere mouseover will open submenus. Focusing a menu via TAB does NOT automatically make it active + * since TAB is a navigation operation and not a selection one. + * For Windows apps, pressing the ALT key focuses the menubar menus (similar to TAB navigation) but the + * menu is not active (ie no dropdown) until an item is clicked. + * + */ + "activated": boolean; + set(property:"activated", value: boolean): void; + get(property:"activated"): boolean; + watch(property:"activated", callback:{(property?:string, oldValue?:boolean, newValue?: boolean):void}) :{unwatch():void} + /** + * True if mouse was pressed while over this widget, and hasn't been released yet + * + */ + "active": boolean; + set(property:"active", value: boolean): void; + get(property:"active"): boolean; + watch(property:"active", callback:{(property?:string, oldValue?:boolean, newValue?: boolean):void}) :{unwatch():void} + /** + * Object to which attach points and events will be scoped. Defaults + * to 'this'. + * + */ + "attachScope": Object; + set(property:"attachScope", value: Object): void; + get(property:"attachScope"): Object; + watch(property:"attachScope", callback:{(property?:string, oldValue?:Object, newValue?: Object):void}) :{unwatch():void} + /** + * Deprecated. Instead of attributeMap, widget should have a _setXXXAttr attribute + * for each XXX attribute to be mapped to the DOM. + * + * attributeMap sets up a "binding" between attributes (aka properties) + * of the widget and the widget's DOM. + * Changes to widget attributes listed in attributeMap will be + * reflected into the DOM. + * + * For example, calling set('title', 'hello') + * on a TitlePane will automatically cause the TitlePane's DOM to update + * with the new title. + * + * attributeMap is a hash where the key is an attribute of the widget, + * and the value reflects a binding to a: + * + * DOM node attribute + * focus: {node: "focusNode", type: "attribute"} + * Maps this.focus to this.focusNode.focus + * + * DOM node innerHTML + * title: { node: "titleNode", type: "innerHTML" } + * Maps this.title to this.titleNode.innerHTML + * + * DOM node innerText + * title: { node: "titleNode", type: "innerText" } + * Maps this.title to this.titleNode.innerText + * + * DOM node CSS class + * myClass: { node: "domNode", type: "class" } + * Maps this.myClass to this.domNode.className + * + * If the value is an array, then each element in the array matches one of the + * formats of the above list. + * + * There are also some shorthands for backwards compatibility: + * + * string --> { node: string, type: "attribute" }, for example: + * "focusNode" ---> { node: "focusNode", type: "attribute" } + * "" --> { node: "domNode", type: "attribute" } + * + */ + "attributeMap": Object; + set(property:"attributeMap", value: Object): void; + get(property:"attributeMap"): Object; + watch(property:"attributeMap", callback:{(property?:string, oldValue?:Object, newValue?: Object):void}) :{unwatch():void} + /** + * A toggle to control whether or not a Menu gets focused when opened as a drop down from a MenuBar + * or DropDownButton/ComboButton. Note though that it always get focused when opened via the keyboard. + * + */ + "autoFocus": boolean; + set(property:"autoFocus", value: boolean): void; + get(property:"autoFocus"): boolean; + watch(property:"autoFocus", callback:{(property?:string, oldValue?:boolean, newValue?: boolean):void}) :{unwatch():void} + /** + * + */ + "baseClass": string; + set(property:"baseClass", value: string): void; + get(property:"baseClass"): string; + watch(property:"baseClass", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * + */ + "class": string; + set(property:"class", value: string): void; + get(property:"class"): string; + watch(property:"class", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * Designates where children of the source DOM node will be placed. + * "Children" in this case refers to both DOM nodes and widgets. + * For example, for myWidget: + * + *
+ * here's a plain DOM node + * and a widget + * and another plain DOM node + *
+ * containerNode would point to: + * + * here's a plain DOM node + * and a widget + * and another plain DOM node + * In templated widgets, "containerNode" is set via a + * data-dojo-attach-point assignment. + * + * containerNode must be defined for any widget that accepts innerHTML + * (like ContentPane or BorderContainer or even Button), and conversely + * is null for widgets that don't, like TextBox. + * + */ + "containerNode": HTMLElement; + set(property:"containerNode", value: HTMLElement): void; + get(property:"containerNode"): HTMLElement; + watch(property:"containerNode", callback:{(property?:string, oldValue?:HTMLElement, newValue?: HTMLElement):void}) :{unwatch():void} + /** + * Subclasses may define a cssStateNodes property that lists sub-nodes within the widget that + * need CSS classes applied on mouse hover/press and focus. + * + * Each entry in this optional hash is a an attach-point name (like "upArrowButton") mapped to a CSS class name + * (like "dijitUpArrowButton"). Example: + * + * { + * "upArrowButton": "dijitUpArrowButton", + * "downArrowButton": "dijitDownArrowButton" + * } + * The above will set the CSS class dijitUpArrowButton to the this.upArrowButton DOMNode when it + * + * is hovered, etc. + * + */ + "cssStateNodes": Object; + set(property:"cssStateNodes", value: Object): void; + get(property:"cssStateNodes"): Object; + watch(property:"cssStateNodes", callback:{(property?:string, oldValue?:Object, newValue?: Object):void}) :{unwatch():void} + /** + * Bi-directional support, as defined by the HTML DIR + * attribute. Either left-to-right "ltr" or right-to-left "rtl". If undefined, widgets renders in page's + * default direction. + * + */ + "dir": string; + set(property:"dir", value: string): void; + get(property:"dir"): string; + watch(property:"dir", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * This is our visible representation of the widget! Other DOM + * Nodes may by assigned to other properties, usually through the + * template system's data-dojo-attach-point syntax, but the domNode + * property is the canonical "top level" node in widget UI. + * + */ + "domNode": HTMLElement; + set(property:"domNode", value: HTMLElement): void; + get(property:"domNode"): HTMLElement; + watch(property:"domNode", callback:{(property?:string, oldValue?:HTMLElement, newValue?: HTMLElement):void}) :{unwatch():void} + /** + * This widget or a widget it contains has focus, or is "active" because + * it was recently clicked. + * + */ + "focused": boolean; + set(property:"focused", value: boolean): void; + get(property:"focused"): boolean; + watch(property:"focused", callback:{(property?:string, oldValue?:boolean, newValue?: boolean):void}) :{unwatch():void} + /** + * The currently focused child widget, or null if there isn't one + * + */ + "focusedChild": Object; + set(property:"focusedChild", value: Object): void; + get(property:"focusedChild"): Object; + watch(property:"focusedChild", callback:{(property?:string, oldValue?:Object, newValue?: Object):void}) :{unwatch():void} + /** + * True if cursor is over this widget + * + */ + "hovering": boolean; + set(property:"hovering", value: boolean): void; + get(property:"hovering"): boolean; + watch(property:"hovering", callback:{(property?:string, oldValue?:boolean, newValue?: boolean):void}) :{unwatch():void} + /** + * A unique, opaque ID string that can be assigned by users or by the + * system. If the developer passes an ID which is known not to be + * unique, the specified ID is ignored and the system-generated ID is + * used instead. + * + */ + "id": string; + set(property:"id", value: string): void; + get(property:"id"): string; + watch(property:"id", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * Rarely used. Overrides the default Dojo locale used to render this widget, + * as defined by the HTML LANG attribute. + * Value must be among the list of locales specified during by the Dojo bootstrap, + * formatted according to RFC 3066 (like en-us). + * + */ + "lang": string; + set(property:"lang", value: string): void; + get(property:"lang"): string; + watch(property:"lang", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * If multiple characters are typed where each keystroke happens within + * multiCharSearchDuration of the previous keystroke, + * search for nodes matching all the keystrokes. + * + * For example, typing "ab" will search for entries starting with + * "ab" unless the delay between "a" and "b" is greater than multiCharSearchDuration. + * + */ + "multiCharSearchDuration": number; + set(property:"multiCharSearchDuration", value: number): void; + get(property:"multiCharSearchDuration"): number; + watch(property:"multiCharSearchDuration", callback:{(property?:string, oldValue?:number, newValue?: number):void}) :{unwatch():void} + /** + * The document this widget belongs to. If not specified to constructor, will default to + * srcNodeRef.ownerDocument, or if no sourceRef specified, then to the document global + * + */ + "ownerDocument": Object; + set(property:"ownerDocument", value: Object): void; + get(property:"ownerDocument"): Object; + watch(property:"ownerDocument", callback:{(property?:string, oldValue?:Object, newValue?: Object):void}) :{unwatch():void} + /** + * pointer to menu that displayed me + * + */ + "parentMenu": Object; + set(property:"parentMenu", value: Object): void; + get(property:"parentMenu"): Object; + watch(property:"parentMenu", callback:{(property?:string, oldValue?:Object, newValue?: Object):void}) :{unwatch():void} + /** + * For a passive (unclicked) Menu, number of milliseconds before hovering (without clicking) will cause + * the popup to open. Default is Infinity, meaning you need to click the menu to open it. + * + */ + "passivePopupDelay": number; + set(property:"passivePopupDelay", value: number): void; + get(property:"passivePopupDelay"): number; + watch(property:"passivePopupDelay", callback:{(property?:string, oldValue?:number, newValue?: number):void}) :{unwatch():void} + /** + * After a menu has been activated (by clicking on it etc.), number of milliseconds before hovering + * (without clicking) another MenuItem causes that MenuItem's popup to automatically open. + * + */ + "popupDelay": number; + set(property:"popupDelay", value: number): void; + get(property:"popupDelay"): number; + watch(property:"popupDelay", callback:{(property?:string, oldValue?:number, newValue?: number):void}) :{unwatch():void} + /** + * + */ + "searchContainerNode": boolean; + set(property:"searchContainerNode", value: boolean): void; + get(property:"searchContainerNode"): boolean; + watch(property:"searchContainerNode", callback:{(property?:string, oldValue?:boolean, newValue?: boolean):void}) :{unwatch():void} + /** + * Currently selected (a.k.a. highlighted) MenuItem, or null if no MenuItem is selected. + * If a submenu is open, will be set to MenuItem that displayed the submenu. OTOH, if + * this Menu is in passive mode (i.e. hasn't been clicked yet), will be null, because + * "selected" is not merely "hovered". + * + */ + "selected": Object; + set(property:"selected", value: Object): void; + get(property:"selected"): Object; + watch(property:"selected", callback:{(property?:string, oldValue?:Object, newValue?: Object):void}) :{unwatch():void} + /** + * pointer to original DOM node + * + */ + "srcNodeRef": HTMLElement; + set(property:"srcNodeRef", value: HTMLElement): void; + get(property:"srcNodeRef"): HTMLElement; + watch(property:"srcNodeRef", callback:{(property?:string, oldValue?:HTMLElement, newValue?: HTMLElement):void}) :{unwatch():void} + /** + * HTML style attributes as cssText string or name/value hash + * + */ + "style": string; + set(property:"style", value: string): void; + get(property:"style"): string; + watch(property:"style", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * Tab index of the container; same as HTML tabIndex attribute. + * Note then when user tabs into the container, focus is immediately + * moved to the first item in the container. + * + */ + "tabIndex": string; + set(property:"tabIndex", value: string): void; + get(property:"tabIndex"): string; + watch(property:"tabIndex", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * Path to template (HTML file) for this widget relative to dojo.baseUrl. + * Deprecated: use templateString with require([... "dojo/text!..."], ...) instead + * + */ + "templatePath": string; + set(property:"templatePath", value: string): void; + get(property:"templatePath"): string; + watch(property:"templatePath", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * + */ + "templateString": string; + set(property:"templateString", value: string): void; + get(property:"templateString"): string; + watch(property:"templateString", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * HTML title attribute. + * + * For form widgets this specifies a tooltip to display when hovering over + * the widget (just like the native HTML title attribute). + * + * For TitlePane or for when this widget is a child of a TabContainer, AccordionContainer, + * etc., it's used to specify the tab label, accordion pane title, etc. In this case it's + * interpreted as HTML. + * + */ + "title": string; + set(property:"title", value: string): void; + get(property:"title"): string; + watch(property:"title", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * When this widget's title attribute is used to for a tab label, accordion pane title, etc., + * this specifies the tooltip to appear when the mouse is hovered over that text. + * + */ + "tooltip": string; + set(property:"tooltip", value: string): void; + get(property:"tooltip"): string; + watch(property:"tooltip", callback:{(property?:string, oldValue?:string, newValue?: string):void}) :{unwatch():void} + /** + * + * @param widget + * @param insertIndex Optional + */ + addChild(widget: dijit._WidgetBase, insertIndex: number): void; + /** + * This method is deprecated, use get() or set() directly. + * + * @param name The property to get or set. If an object is passed here and nota string, its keys are used as names of attributes to be setand the value of the object as values to set in the widget. + * @param value OptionalOptional. If provided, attr() operates as a setter. If omitted,the current value of the named property is returned. + */ + attr(name: String, value: Object): any; + /** + * This method is deprecated, use get() or set() directly. + * + * @param name The property to get or set. If an object is passed here and nota string, its keys are used as names of attributes to be setand the value of the object as values to set in the widget. + * @param value OptionalOptional. If provided, attr() operates as a setter. If omitted,the current value of the named property is returned. + */ + attr(name: Object, value: Object): any; + /** + * Construct the UI for this widget, setting this.domNode. + * Most widgets will mixin dijit._TemplatedMixin, which implements this method. + * + */ + buildRendering(): void; + /** + * Selector (passed to on.selector()) used to identify MenuItem child widgets, but exclude inert children + * like MenuSeparator. If subclass overrides to a string (ex: "> *"), the subclass must require dojo/query. + * + * @param node + */ + childSelector(node: HTMLElement): any; + /** + * Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead. + * + * Connects specified obj/event to specified method of this object + * and registers for disconnect() on widget destroy. + * + * Provide widget-specific analog to dojo.connect, except with the + * implicit use of this widget as the target object. + * Events connected with this.connect are disconnected upon + * destruction. + * + * @param obj + * @param event + * @param method + */ + connect(obj: Object, event: String, method: String): any; + /** + * Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead. + * + * Connects specified obj/event to specified method of this object + * and registers for disconnect() on widget destroy. + * + * Provide widget-specific analog to dojo.connect, except with the + * implicit use of this widget as the target object. + * Events connected with this.connect are disconnected upon + * destruction. + * + * @param obj + * @param event + * @param method + */ + connect(obj: any, event: String, method: String): any; + /** + * Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead. + * + * Connects specified obj/event to specified method of this object + * and registers for disconnect() on widget destroy. + * + * Provide widget-specific analog to dojo.connect, except with the + * implicit use of this widget as the target object. + * Events connected with this.connect are disconnected upon + * destruction. + * + * @param obj + * @param event + * @param method + */ + connect(obj: Object, event: Function, method: String): any; + /** + * Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead. + * + * Connects specified obj/event to specified method of this object + * and registers for disconnect() on widget destroy. + * + * Provide widget-specific analog to dojo.connect, except with the + * implicit use of this widget as the target object. + * Events connected with this.connect are disconnected upon + * destruction. + * + * @param obj + * @param event + * @param method + */ + connect(obj: any, event: Function, method: String): any; + /** + * Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead. + * + * Connects specified obj/event to specified method of this object + * and registers for disconnect() on widget destroy. + * + * Provide widget-specific analog to dojo.connect, except with the + * implicit use of this widget as the target object. + * Events connected with this.connect are disconnected upon + * destruction. + * + * @param obj + * @param event + * @param method + */ + connect(obj: Object, event: String, method: Function): any; + /** + * Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead. + * + * Connects specified obj/event to specified method of this object + * and registers for disconnect() on widget destroy. + * + * Provide widget-specific analog to dojo.connect, except with the + * implicit use of this widget as the target object. + * Events connected with this.connect are disconnected upon + * destruction. + * + * @param obj + * @param event + * @param method + */ + connect(obj: any, event: String, method: Function): any; + /** + * Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead. + * + * Connects specified obj/event to specified method of this object + * and registers for disconnect() on widget destroy. + * + * Provide widget-specific analog to dojo.connect, except with the + * implicit use of this widget as the target object. + * Events connected with this.connect are disconnected upon + * destruction. + * + * @param obj + * @param event + * @param method + */ + connect(obj: Object, event: Function, method: Function): any; + /** + * Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead. + * + * Connects specified obj/event to specified method of this object + * and registers for disconnect() on widget destroy. + * + * Provide widget-specific analog to dojo.connect, except with the + * implicit use of this widget as the target object. + * Events connected with this.connect are disconnected upon + * destruction. + * + * @param obj + * @param event + * @param method + */ + connect(obj: any, event: Function, method: Function): any; + /** + * Deprecated. You can call this in postCreate() to attach the keyboard handlers to the container, + * but the preferred method is to override _onLeftArrow() and _onRightArrow(), or + * _onUpArrow() and _onDownArrow(), to call focusPrev() and focusNext(). + * + * @param prevKeyCodes Key codes for navigating to the previous child. + * @param nextKeyCodes Key codes for navigating to the next child. + */ + connectKeyNavHandlers(prevKeyCodes: dojo.keys, nextKeyCodes: dojo.keys): void; + /** + * Wrapper to setTimeout to avoid deferred functions executing + * after the originating widget has been destroyed. + * Returns an object handle with a remove method (that returns null) (replaces clearTimeout). + * + * @param fcn Function reference. + * @param delay OptionalDelay, defaults to 0. + */ + defer(fcn: Function, delay: number): Object; + /** + * Destroy this widget, but not its descendants. Descendants means widgets inside of + * this.containerNode. Will also destroy any resources (including widgets) registered via this.own(). + * + * This method will also destroy internal widgets such as those created from a template, + * assuming those widgets exist inside of this.domNode but outside of this.containerNode. + * + * For 2.0 it's planned that this method will also destroy descendant widgets, so apps should not + * depend on the current ability to destroy a widget without destroying its descendants. Generally + * they should use destroyRecursive() for widgets with children. + * + * @param preserveDom If true, this method will leave the original DOM structure alone.Note: This will not yet work with _TemplatedMixin widgets + */ + destroy(preserveDom?: boolean): void; + /** + * Recursively destroy the children of this widget and their + * descendants. + * + * @param preserveDom OptionalIf true, the preserveDom attribute is passed to all descendantwidget's .destroy() method. Not for use with _Templatedwidgets. + */ + destroyDescendants(preserveDom?: boolean): void; + /** + * Destroy this widget and its descendants + * This is the generic "destructor" function that all widget users + * should call to cleanly discard with a widget. Once a widget is + * destroyed, it is removed from the manager object. + * + * @param preserveDom OptionalIf true, this method will leave the original DOM structurealone of descendant Widgets. Note: This will NOT work withdijit._TemplatedMixin widgets. + */ + destroyRecursive(preserveDom?: boolean): void; + /** + * Destroys the DOM nodes associated with this widget. + * + * @param preserveDom OptionalIf true, this method will leave the original DOM structure aloneduring tear-down. Note: this will not work with _Templatedwidgets yet. + */ + destroyRendering(preserveDom?: boolean): void; + /** + * Deprecated, will be removed in 2.0, use handle.remove() instead. + * + * Disconnects handle created by connect. + * + * @param handle + */ + disconnect(handle: any): void; + /** + * Used by widgets to signal that a synthetic event occurred, ex: + * + * myWidget.emit("attrmodified-selectedChildWidget", {}). + * Emits an event on this.domNode named type.toLowerCase(), based on eventObj. + * Also calls onType() method, if present, and returns value from that method. + * By default passes eventObj to callback, but will pass callbackArgs instead, if specified. + * Modifies eventObj by adding missing parameters (bubbles, cancelable, widget). + * + * @param type + * @param eventObj Optional + * @param callbackArgs Optional + */ + emit(type: String, eventObj: Object, callbackArgs: any[]): any; + /** + * Default focus() implementation: focus the first child. + * + */ + focus(): void; + /** + * Focus specified child widget. + * + * @param widget Reference to container's child widget + * @param last If true and if widget has multiple focusable nodes, focus thelast one instead of the first one + */ + focusChild(widget: dijit._WidgetBase, last: boolean): void; + /** + * Focus the first focusable child in the container. + * + */ + focusFirstChild(): void; + /** + * Focus the last focusable child in the container. + * + */ + focusLastChild(): void; + /** + * Focus the next widget + * + */ + focusNext(): void; + /** + * Focus the last focusable node in the previous widget + * (ex: go to the ComboButton icon section rather than button section) + * + */ + focusPrev(): void; + /** + * Get a property from a widget. + * Get a named property from a widget. The property may + * potentially be retrieved via a getter method. If no getter is defined, this + * just retrieves the object's property. + * + * For example, if the widget has properties foo and bar + * and a method named _getFooAttr(), calling: + * myWidget.get("foo") would be equivalent to calling + * widget._getFooAttr() and myWidget.get("bar") + * would be equivalent to the expression + * widget.bar2 + * + * @param name The property to get. + */ + get(name: any): any; + /** + * Returns all direct children of this widget, i.e. all widgets underneath this.containerNode whose parent + * is this widget. Note that it does not return all descendants, but rather just direct children. + * Analogous to Node.childNodes, + * except containing widgets rather than DOMNodes. + * + * The result intentionally excludes internally created widgets (a.k.a. supporting widgets) + * outside of this.containerNode. + * + * Note that the array returned is a simple array. Application code should not assume + * existence of methods like forEach(). + * + */ + getChildren(): any[]; + /** + * Returns all the widgets contained by this, i.e., all widgets underneath this.containerNode. + * This method should generally be avoided as it returns widgets declared in templates, which are + * supposed to be internal/hidden, but it's left here for back-compat reasons. + * + */ + getDescendants(): any[]; + /** + * Gets the index of the child in this container or -1 if not found + * + * @param child + */ + getIndexOfChild(child: dijit._WidgetBase): any; + /** + * Returns the parent widget of this widget. + * + */ + getParent(): any; + /** + * Returns true if widget has child widgets, i.e. if this.containerNode contains widgets. + * + */ + hasChildren(): boolean; + /** + * Return true if this widget can currently be focused + * and false if not + * + */ + isFocusable(): any; + /** + * Return this widget's explicit or implicit orientation (true for LTR, false for RTL) + * + */ + isLeftToRight(): any; + /** + * + * @param type protected + * @param func + */ + on(type: String, func: Function): any; + /** + * + * @param type protected + * @param func + */ + on(type: Function, func: Function): any; + /** + * Track specified handles and remove/destroy them when this instance is destroyed, unless they were + * already removed/destroyed manually. + * + */ + own(): any; + /** + * Place this widget somewhere in the DOM based + * on standard domConstruct.place() conventions. + * A convenience function provided in all _Widgets, providing a simple + * shorthand mechanism to put an existing (or newly created) Widget + * somewhere in the dom, and allow chaining. + * + * @param reference Widget, DOMNode, or id of widget or DOMNode + * @param position OptionalIf reference is a widget (or id of widget), and that widget has an ".addChild" method,it will be called passing this widget instance into that method, supplying the optionalposition index passed. In this case position (if specified) should be an integer.If reference is a DOMNode (or id matching a DOMNode but not a widget),the position argument can be a numeric index or a string"first", "last", "before", or "after", same as dojo/dom-construct::place(). + */ + placeAt(reference: String, position: String): any; + /** + * Place this widget somewhere in the DOM based + * on standard domConstruct.place() conventions. + * A convenience function provided in all _Widgets, providing a simple + * shorthand mechanism to put an existing (or newly created) Widget + * somewhere in the dom, and allow chaining. + * + * @param reference Widget, DOMNode, or id of widget or DOMNode + * @param position OptionalIf reference is a widget (or id of widget), and that widget has an ".addChild" method,it will be called passing this widget instance into that method, supplying the optionalposition index passed. In this case position (if specified) should be an integer.If reference is a DOMNode (or id matching a DOMNode but not a widget),the position argument can be a numeric index or a string"first", "last", "before", or "after", same as dojo/dom-construct::place(). + */ + placeAt(reference: HTMLElement, position: String): any; + /** + * Place this widget somewhere in the DOM based + * on standard domConstruct.place() conventions. + * A convenience function provided in all _Widgets, providing a simple + * shorthand mechanism to put an existing (or newly created) Widget + * somewhere in the dom, and allow chaining. + * + * @param reference Widget, DOMNode, or id of widget or DOMNode + * @param position OptionalIf reference is a widget (or id of widget), and that widget has an ".addChild" method,it will be called passing this widget instance into that method, supplying the optionalposition index passed. In this case position (if specified) should be an integer.If reference is a DOMNode (or id matching a DOMNode but not a widget),the position argument can be a numeric index or a string"first", "last", "before", or "after", same as dojo/dom-construct::place(). + */ + placeAt(reference: dijit._WidgetBase, position: String): any; + /** + * Place this widget somewhere in the DOM based + * on standard domConstruct.place() conventions. + * A convenience function provided in all _Widgets, providing a simple + * shorthand mechanism to put an existing (or newly created) Widget + * somewhere in the dom, and allow chaining. + * + * @param reference Widget, DOMNode, or id of widget or DOMNode + * @param position OptionalIf reference is a widget (or id of widget), and that widget has an ".addChild" method,it will be called passing this widget instance into that method, supplying the optionalposition index passed. In this case position (if specified) should be an integer.If reference is a DOMNode (or id matching a DOMNode but not a widget),the position argument can be a numeric index or a string"first", "last", "before", or "after", same as dojo/dom-construct::place(). + */ + placeAt(reference: String, position: number): any; + /** + * Place this widget somewhere in the DOM based + * on standard domConstruct.place() conventions. + * A convenience function provided in all _Widgets, providing a simple + * shorthand mechanism to put an existing (or newly created) Widget + * somewhere in the dom, and allow chaining. + * + * @param reference Widget, DOMNode, or id of widget or DOMNode + * @param position OptionalIf reference is a widget (or id of widget), and that widget has an ".addChild" method,it will be called passing this widget instance into that method, supplying the optionalposition index passed. In this case position (if specified) should be an integer.If reference is a DOMNode (or id matching a DOMNode but not a widget),the position argument can be a numeric index or a string"first", "last", "before", or "after", same as dojo/dom-construct::place(). + */ + placeAt(reference: HTMLElement, position: number): any; + /** + * Place this widget somewhere in the DOM based + * on standard domConstruct.place() conventions. + * A convenience function provided in all _Widgets, providing a simple + * shorthand mechanism to put an existing (or newly created) Widget + * somewhere in the dom, and allow chaining. + * + * @param reference Widget, DOMNode, or id of widget or DOMNode + * @param position OptionalIf reference is a widget (or id of widget), and that widget has an ".addChild" method,it will be called passing this widget instance into that method, supplying the optionalposition index passed. In this case position (if specified) should be an integer.If reference is a DOMNode (or id matching a DOMNode but not a widget),the position argument can be a numeric index or a string"first", "last", "before", or "after", same as dojo/dom-construct::place(). + */ + placeAt(reference: dijit._WidgetBase, position: number): any; + /** + * + */ + postCreate(): void; + /** + * Called after the parameters to the widget have been read-in, + * but before the widget template is instantiated. Especially + * useful to set properties that are referenced in the widget + * template. + * + */ + postMixInProperties(): void; + /** + * Removes the passed widget instance from this widget but does + * not destroy it. You can also pass in an integer indicating + * the index within the container to remove (ie, removeChild(5) removes the sixth widget). + * + * @param widget + */ + removeChild(widget: dijit._WidgetBase): void; + /** + * Removes the passed widget instance from this widget but does + * not destroy it. You can also pass in an integer indicating + * the index within the container to remove (ie, removeChild(5) removes the sixth widget). + * + * @param widget + */ + removeChild(widget: number): void; + /** + * Set a property on a widget + * Sets named properties on a widget which may potentially be handled by a + * setter in the widget. + * + * For example, if the widget has properties foo and bar + * and a method named _setFooAttr(), calling + * myWidget.set("foo", "Howdy!") would be equivalent to calling + * widget._setFooAttr("Howdy!") and myWidget.set("bar", 3) + * would be equivalent to the statement widget.bar = 3; + * + * set() may also be called with a hash of name/value pairs, ex: + * + * myWidget.set({ + * foo: "Howdy", + * bar: 3 + * }); + * This is equivalent to calling set(foo, "Howdy") and set(bar, 3) + * + * @param name The property to set. + * @param value The value to set in the property. + */ + set(name: any, value: any): any; + /** + * Deprecated. Use set() instead. + * + * @param attr + * @param value + */ + setAttribute(attr: String, value: any): void; + /** + * Processing after the DOM fragment is added to the document + * Called after a widget and its children have been created and added to the page, + * and all related widgets have finished their create() cycle, up through postCreate(). + * + * Note that startup() may be called while the widget is still hidden, for example if the widget is + * inside a hidden dijit/Dialog or an unselected tab of a dijit/layout/TabContainer. + * For widgets that need to do layout, it's best to put that layout code inside resize(), and then + * extend dijit/layout/_LayoutWidget so that resize() is called when the widget is visible. + * + */ + startup(): void; + /** + * + */ + startupKeyNavChildren(): void; + /** + * Deprecated, will be removed in 2.0, use this.own(topic.subscribe()) instead. + * + * Subscribes to the specified topic and calls the specified method + * of this object and registers for unsubscribe() on widget destroy. + * + * Provide widget-specific analog to dojo.subscribe, except with the + * implicit use of this widget as the target object. + * + * @param t The topic + * @param method The callback + */ + subscribe(t: String, method: Function): any; + /** + * Returns a string that represents the widget. + * When a widget is cast to a string, this method will be used to generate the + * output. Currently, it does not implement any sort of reversible + * serialization. + * + */ + toString(): String; + /** + * Deprecated. Override destroy() instead to implement custom widget tear-down + * behavior. + * + */ + uninitialize(): boolean; + /** + * Deprecated, will be removed in 2.0, use handle.remove() instead. + * + * Unsubscribes handle created by this.subscribe. + * Also removes handle from this widget's list of subscriptions + * + * @param handle + */ + unsubscribe(handle: Object): void; + /** + * Watches a property for changes + * + * @param name OptionalIndicates the property to watch. This is optional (the callback may be theonly parameter), and if omitted, all the properties will be watched + * @param callback The function to execute when the property changes. This will be called afterthe property has been changed. The callback will be called with the |this|set to the instance, the first argument as the name of the property, thesecond argument as the old value and the third argument as the new value. + */ + watch(property: string, callback:{(property?:string, oldValue?:any, newValue?: any):void}) :{unwatch():void}; + /** + * Static method to get a template based on the templatePath or + * templateString key + */ + getCachedTemplate(): any; + /** + * Called when the widget stops being "active" because + * focus moved to something outside of it, or the user + * clicked somewhere outside of it, or the widget was + * hidden. + * + */ + onBlur(): void; + /** + * Attach point for notification about when the user cancels the current menu + * This is an internal mechanism used for Menus to signal to their parent to + * close them. In general developers should not attach to or override this method. + * + * @param closeAll + */ + onCancel(closeAll: boolean): void; + /** + * Connect to this function to receive notifications of mouse click events. + * + * @param event mouse Event + */ + onClick(event: any): void; + /** + * Connect to this function to receive notifications of mouse double click events. + * + * @param event mouse Event + */ + onDblClick(event: any): void; + /** + * Attach point for notification about when a menu item has been executed. + * This is an internal mechanism used for Menus to signal to their parent to + * close them, because they are about to execute the onClick handler. In + * general developers should not attach to or override this method. + * + */ + onExecute(): void; + /** + * Called when the widget becomes "active" because + * it or a widget inside of it either has focus, or has recently + * been clicked. + * + */ + onFocus(): void; + /** + * Called when another widget becomes the selected pane in a + * dijit/layout/TabContainer, dijit/layout/StackContainer, + * dijit/layout/AccordionContainer, etc. + * + * Also called to indicate hide of a dijit.Dialog, dijit.TooltipDialog, or dijit.TitlePane. + * + */ + onHide(): void; + /** + * Called when cursor is over a MenuItem. + * + * @param item + */ + onItemHover(item: dijit.MenuItem): void; + /** + * Callback fires when mouse exits a MenuItem + * + * @param item + */ + onItemUnhover(item: dijit.MenuItem): void; + /** + * Attach point for notification about when a menu item has been searched for + * via the keyboard search mechanism. + * + * @param item + * @param evt + * @param searchString + * @param numMatches + */ + onKeyboardSearch(item: dijit.MenuItem, evt: Event, searchString: String, numMatches: number): void; + /** + * Connect to this function to receive notifications of keys being pressed down. + * + * @param event key Event + */ + onKeyDown(event: any): void; + /** + * Connect to this function to receive notifications of printable keys being typed. + * + * @param event key Event + */ + onKeyPress(event: any): void; + /** + * Connect to this function to receive notifications of keys being released. + * + * @param event key Event + */ + onKeyUp(event: any): void; + /** + * Connect to this function to receive notifications of when the mouse button is pressed down. + * + * @param event mouse Event + */ + onMouseDown(event: any): void; + /** + * Connect to this function to receive notifications of when the mouse moves onto this widget. + * + * @param event mouse Event + */ + onMouseEnter(event: any): void; + /** + * Connect to this function to receive notifications of when the mouse moves off of this widget. + * + * @param event mouse Event + */ + onMouseLeave(event: any): void; + /** + * Connect to this function to receive notifications of when the mouse moves over nodes contained within this widget. + * + * @param event mouse Event + */ + onMouseMove(event: any): void; + /** + * Connect to this function to receive notifications of when the mouse moves off of nodes contained within this widget. + * + * @param event mouse Event + */ + onMouseOut(event: any): void; + /** + * Connect to this function to receive notifications of when the mouse moves onto nodes contained within this widget. + * + * @param event mouse Event + */ + onMouseOver(event: any): void; + /** + * Connect to this function to receive notifications of when the mouse button is released. + * + * @param event mouse Event + */ + onMouseUp(event: any): void; + /** + * Called when this widget becomes the selected pane in a + * dijit/layout/TabContainer, dijit/layout/StackContainer, + * dijit/layout/AccordionContainer, etc. + * + * Also called to indicate display of a dijit.Dialog, dijit.TooltipDialog, or dijit.TitlePane. + * + */ + onShow(): void; + } + /** + * Permalink: http://dojotoolkit.org/api/1.9/dijit/Editor.html + * + * A rich text Editing widget + * This widget provides basic WYSIWYG editing features, based on the browser's + * underlying rich text editing capability, accompanied by a toolbar (dijit.Toolbar). + * A plugin model is available to extend the editor's capabilities as well as the + * the options available in the toolbar. Content generation may vary across + * browsers, and clipboard operations may have different results, to name + * a few limitations. Note: this widget should not be used with the HTML + *