mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-09 11:13:57 +08:00
Merge remote-tracking branch 'upstream/master'
This commit is contained in:
@@ -34,4 +34,7 @@ Properties
|
||||
*.iml
|
||||
*.js.map
|
||||
|
||||
#rx.js
|
||||
!rx.js
|
||||
|
||||
node_modules
|
||||
|
||||
@@ -37,6 +37,8 @@ List of Definitions
|
||||
* [Angular UI Bootstrap](http://angular-ui.github.io/bootstrap) (by [Brian Surowiec](https://github.com/xt0rted))
|
||||
* [AppFramework](http://app-framework-software.intel.com/) (by [Kyo Ago](https://github.com/kyo-ago))
|
||||
* [Arbiter](http://arbiterjs.com/) (by [Arash Shakery](https://github.com/arash16))
|
||||
* [asciify](https://github.com/olizilla/asciify) (by [Alan](http://alan.norbauer.com))
|
||||
* [assert](https://github.com/Jxck/assert) (by [vvakame](https://github.com/vvakame))
|
||||
* [async](https://github.com/caolan/async) (by [Boris Yankov](https://github.com/borisyankov))
|
||||
* [Backbone.js](http://backbonejs.org/) (by [Boris Yankov](https://github.com/borisyankov))
|
||||
* [Backbone Relational](http://backbonerelational.org/) (by [Eirik Hoem](https://github.com/eirikhm))
|
||||
@@ -52,16 +54,19 @@ List of Definitions
|
||||
* [CasperJS](http://casperjs.org) (by [Jed Hunsaker](https://github.com/jedhunsaker))
|
||||
* [Cheerio](https://github.com/MatthewMueller/cheerio) (by [Bret Little](https://github.com/blittle))
|
||||
* [Chosen](http://harvesthq.github.com/chosen/) (by [Boris Yankov](https://github.com/borisyankov))
|
||||
* [Chrome](http://developer.chrome.com/extensions/) (by [Matthew Kimber](https://github.com/matthewkimber))
|
||||
* [Chrome](http://developer.chrome.com/extensions/) (by [Matthew Kimber](https://github.com/matthewkimber) and [otiai10](https://github.com/otiai10))
|
||||
* [Chrome App](http://developer.chrome.com/apps/) (by [Adam Lay](https://github.com/AdamLay))
|
||||
* [CKEditor](https://github.com/ckeditor/ckeditor-dev) (by [Ondrej Sevcik](https://github.com/ondrejsevcik))
|
||||
* [CodeMirror](http://codemirror.net) (by [François de Campredon](https://github.com/fdecampredon))
|
||||
* [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))
|
||||
* [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)
|
||||
* [d3.js](http://d3js.org/) (from TypeScript samples)
|
||||
* [dhtmlxGantt](http://dhtmlx.com/docs/products/dhtmlxGantt) (by [Maksim Kozhukh](http://github.com/mkozhukh))
|
||||
* [dhtmlxScheduler](http://dhtmlx.com/docs/products/dhtmlxScheduler) (by [Maksim Kozhukh](http://github.com/mkozhukh))
|
||||
* [Dock Spawn](http://dockspawn.com) (by [Drew Noakes](https://drewnoakes.com))
|
||||
* [docCookies](https://developer.mozilla.org/en-US/docs/Web/API/document.cookie) (by [Jon Egerton](https://github.com/jonegerton))
|
||||
* [domo](http://domo-js.com/) (by [Steve Fenton](https://github.com/Steve-Fenton))
|
||||
* [doT](https://github.com/olado/doT) (by [ZombieHunter](https://github.com/ZombieHunter))
|
||||
@@ -137,6 +142,7 @@ List of Definitions
|
||||
* [jQuery.Cycle](http://jquery.malsup.com/cycle/) (by [François Guillot](http://fguillot.developpez.com/))
|
||||
* [jQuery.Cycle2](http://jquery.malsup.com/cycle2/) (by [Donny Nadolny](https://github.com/dnadolny))
|
||||
* [jQuery.dataTables](http://www.datatables.net) (by [Armin Sander](https://github.com/pragmatrix))
|
||||
* [jQuery.datetimepicker](http://trentrichardson.com/examples/timepicker/) (by [Doug McDonald](https://github.com/dougajmcdonald))
|
||||
* [jQuery.dynatree](http://code.google.com/p/dynatree/) (by [François de Campredon](https://github.com/fdecampredon))
|
||||
* [jQuery.Flot](http://www.flotcharts.org/) (by [Matt Burland](https://github.com/burlandm))
|
||||
* [jQuery.form](http://malsup.com/jquery/form/) (by [François Guillot](http://fguillot.developpez.com/))
|
||||
@@ -148,6 +154,7 @@ List of Definitions
|
||||
* [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.pnotify](http://sciactive.github.io/pnotify/ (by [David Sichau](https://github.com/DavidSichau/))
|
||||
* [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))
|
||||
@@ -162,12 +169,16 @@ List of Definitions
|
||||
* [jQuery.Watermark](http://jquery-watermark.googlecode.com) (by [Anwar Javed](https://github.com/anwarjaved))
|
||||
* [jQuery.base64](https://github.com/yatt/jquery.base64) (by [Shinya Mochizuki](https://github.com/enrapt-mochizuki))
|
||||
* [js-git](https://github.com/creationix/js-git) (by [Bart van der Schoor](https://github.com/Bartvds))
|
||||
* [js-yaml](https://github.com/nodeca/js-yaml) (by [Bart van der Schoor](https://github.com/Bartvds/))
|
||||
* [jScrollPane](http://jscrollpane.kelvinluck.com) (by [Dániel Tar](https://github.com/qcz))
|
||||
* [JSDeferred](http://cho45.stfuawsc.com/jsdeferred/) (by [Daisuke Mino](https://github.com/minodisk))
|
||||
* [JSONEditorOnline](https://github.com/josdejong/jsoneditoronline) (by [Vincent Bortone](https://github.com/vbortone/))
|
||||
* [JSON-Pointer](https://www.npmjs.org/package/json-pointer) (by [Bart van der Schoor](https://github.com/Bartvds))
|
||||
* [JsRender](http://www.jsviews.com/#jsrender) (by [Kensuke MATSUZAKI](https://github.com/zakki))
|
||||
* [jStorage](http://www.jstorage.info/) (by [Danil Flores](https://github.com/dflor003/))
|
||||
* [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/))
|
||||
* [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.DeferredUpdates](https://github.com/mbest/knockout-deferred-updates) (by [Sebastián Galiano](https://github.com/sgaliano))
|
||||
@@ -195,6 +206,7 @@ List of Definitions
|
||||
* [Meteor](https://www.meteor.com) (by [Dave Allen](https://github.com/fullflavedave))
|
||||
* [Microsoft Ajax] (http://msdn.microsoft.com/en-us/library/bb397536(v=vs.100).aspx) (by [Patrick Magee] (https://github.com/pjmagee))
|
||||
* [Microsoft Live Connect](http://msdn.microsoft.com/en-us/library/live/hh243643.aspx) (by [John Vilk](https://github.com/jvilk))
|
||||
* [minimist](https://github.com/substack/minimist) (by [Bart van der Schoor](https://github.com/Bartvds))
|
||||
* [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))
|
||||
* [MongoDB](http://mongodb.github.io/node-mongodb-native/) (from TypeScript samples, updated by [Niklas Mollenhauer](https://github.com/nikeee))
|
||||
@@ -210,8 +222,11 @@ List of Definitions
|
||||
* [NProgress](https://github.com/rstacruz/nprogress) (by [Judah Gabriel Himango](https://github.com/judahgabriel))
|
||||
* [Numeral.js](https://github.com/adamwdraper/Numeral-js) (by [Vincent Bortone](https://github.com/vbortone/))
|
||||
* [OpenLayers](https://github.com/openlayers/openlayers) (by [Ilya Bolkhovsky](https://github.com/bolhovsky/))
|
||||
* [Passport](http://passportjs.org/) (by [Hiroki Horiuchi](https://github.com/horiuchi/))
|
||||
* [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))
|
||||
* [PDF.js](https://github.com/mozilla/pdf.js) (by [Josh Baldwin](https://github.com/jbaldwin))
|
||||
* [PEG.js](http://pegjs.majda.cz/) (by [vvakame](https://github.com/vvakame))
|
||||
* [Persona](http://www.mozilla.org/en-US/persona) (by [James Frasca](https://github.com/Nycto))
|
||||
* [PhantomJS](http://phantomjs.org) (by [Jed Hunsaker](https://github.com/jedhunsaker))
|
||||
* [PhoneGap](http://phonegap.com) (by [Boris Yankov](https://github.com/borisyankov))
|
||||
@@ -241,7 +256,7 @@ List of Definitions
|
||||
* [simple-cw-node](https://github.com/astronaughts/simple-cw-node) (by [vvakame](https://github.com/vvakame))
|
||||
* [Sinon](http://sinonjs.org/) (by [William Sears](https://github.com/mrbigdog2u))
|
||||
* [SlickGrid](https://github.com/mleibman/SlickGrid) (by [Josh Baldwin](https://github.com/jbaldwin))
|
||||
* [smoothie](https://github.com/joewalnes/smoothie) (by [Mike H. Hawley](https://github.com/mikehhawley))
|
||||
* [smoothie](https://github.com/joewalnes/smoothie) (by [Mike H. Hawley](https://github.com/mikehhawley) and [Drew Noakes](https://drewnoakes.com))
|
||||
* [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))
|
||||
@@ -267,6 +282,9 @@ List of Definitions
|
||||
* [Underscore.js (Typed)](http://underscorejs.org/) (by [Josh Baldwin](https://github.com/jbaldwin/))
|
||||
* [Underscore-ko.js](https://github.com/kamranayub/UnderscoreKO) (by [Maurits Elbers](https://github.com/MagicMau))
|
||||
* [universal-analytics](https://github.com/peaksandpies/universal-analytics) (by [Bart van der Schoor](https://github.com/Bartvds))
|
||||
* [update-notifier](https://github.com/yeoman/update-notifier) (by [vvakame](https://github.com/vvakame))
|
||||
* [uri-templates](https://github.com/geraintluff/uri-templates) (by [Bart van der Schoor](https://github.com/Bartvds))
|
||||
* [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))
|
||||
* [Viewporter](https://github.com/zynga/viewporter) (by [Boris Yankov](https://github.com/borisyankov))
|
||||
@@ -276,6 +294,7 @@ List of Definitions
|
||||
* [WinJS](http://msdn.microsoft.com/en-us/library/windows/apps/br229773.aspx) (from TypeScript samples)
|
||||
* [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))
|
||||
* [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))
|
||||
* [YouTube Data API](https://developers.google.com/youtube/v3/) (by [Frank M](https://github.com/sgtfrankieboy/))
|
||||
|
||||
@@ -1 +1 @@
|
||||
tsc runner.ts --target ES5 --out runner.js --module commonjs
|
||||
tsc runner.ts --target ES5 --out runner.js --module commonjs --sourcemap
|
||||
|
||||
@@ -850,7 +850,7 @@ var DT;
|
||||
|
||||
var Promise = require('bluebird');
|
||||
|
||||
var endDts = /\w\.ts$/i;
|
||||
var endDts = /\w\.d\.ts$/i;
|
||||
|
||||
/////////////////////////////////
|
||||
// .d.ts syntax inspection
|
||||
@@ -1035,9 +1035,6 @@ var DT;
|
||||
|
||||
// add a closure to queue
|
||||
this.queue.push(function () {
|
||||
// when activate, add test to active list
|
||||
_this.active.push(test);
|
||||
|
||||
// run it
|
||||
var p = test.run();
|
||||
p.then(defer.resolve.bind(defer), defer.reject.bind(defer));
|
||||
@@ -1048,6 +1045,9 @@ var DT;
|
||||
}
|
||||
_this.step();
|
||||
});
|
||||
|
||||
// return it
|
||||
return test;
|
||||
});
|
||||
this.step();
|
||||
|
||||
@@ -1056,13 +1056,9 @@ var DT;
|
||||
};
|
||||
|
||||
TestQueue.prototype.step = function () {
|
||||
var _this = this;
|
||||
// setTimeout to make it flush
|
||||
setTimeout(function () {
|
||||
while (_this.queue.length > 0 && _this.active.length < _this.concurrent) {
|
||||
_this.queue.pop().call(null);
|
||||
}
|
||||
}, 1);
|
||||
while (this.queue.length > 0 && this.active.length < this.concurrent) {
|
||||
this.active.push(this.queue.pop().call(null));
|
||||
}
|
||||
};
|
||||
return TestQueue;
|
||||
})();
|
||||
@@ -1294,13 +1290,21 @@ var DT;
|
||||
|
||||
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(cpuCores, 2),
|
||||
concurrent: argv['single-thread'] ? 1 : Math.max(Math.min(24, cpuCores), 2),
|
||||
tscVersion: argv['tsc-version'],
|
||||
testChanges: argv['test-changes'],
|
||||
testChanges: testFull ? false : argv['test-changes'],
|
||||
skipTests: argv['skip-tests'],
|
||||
printFiles: argv['print-files'],
|
||||
printRefMap: argv['print-refmap'],
|
||||
|
||||
@@ -34,6 +34,10 @@ module DT {
|
||||
|
||||
export var DEFAULT_TSC_VERSION = '0.9.7';
|
||||
|
||||
interface PackageJSON {
|
||||
scripts: {[key:string]: string};
|
||||
}
|
||||
|
||||
/////////////////////////////////
|
||||
// Single test
|
||||
/////////////////////////////////
|
||||
@@ -75,8 +79,6 @@ module DT {
|
||||
var defer = Promise.defer();
|
||||
// add a closure to queue
|
||||
this.queue.push(() => {
|
||||
// when activate, add test to active list
|
||||
this.active.push(test);
|
||||
// run it
|
||||
var p = test.run();
|
||||
p.then(defer.resolve.bind(defer), defer.reject.bind(defer));
|
||||
@@ -87,6 +89,8 @@ module DT {
|
||||
}
|
||||
this.step();
|
||||
});
|
||||
// return it
|
||||
return test;
|
||||
});
|
||||
this.step();
|
||||
// defer it
|
||||
@@ -94,12 +98,9 @@ module DT {
|
||||
}
|
||||
|
||||
private step(): void {
|
||||
// setTimeout to make it flush
|
||||
setTimeout(() => {
|
||||
while (this.queue.length > 0 && this.active.length < this.concurrent) {
|
||||
this.queue.pop().call(null);
|
||||
}
|
||||
}, 1);
|
||||
while (this.queue.length > 0 && this.active.length < this.concurrent) {
|
||||
this.active.push(this.queue.pop().call(null));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -336,13 +337,21 @@ module DT {
|
||||
|
||||
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(cpuCores, 2),
|
||||
concurrent: argv['single-thread'] ? 1 : Math.max(Math.min(24, cpuCores), 2),
|
||||
tscVersion: argv['tsc-version'],
|
||||
testChanges: argv['test-changes'],
|
||||
testChanges: testFull ? false : argv['test-changes'], // allow magic branch
|
||||
skipTests: argv['skip-tests'],
|
||||
printFiles: argv['print-files'],
|
||||
printRefMap: argv['print-refmap'],
|
||||
|
||||
@@ -6,7 +6,7 @@ module DT {
|
||||
|
||||
var Promise: typeof Promise = require('bluebird');
|
||||
|
||||
var endDts = /\w\.ts$/i;
|
||||
var endDts = /\w\.d\.ts$/i;
|
||||
|
||||
/////////////////////////////////
|
||||
// .d.ts syntax inspection
|
||||
|
||||
+14958
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,2 @@
|
||||
#!/usr/bin/env node
|
||||
require('./tsc.js')
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Vendored
+5
-3
@@ -885,7 +885,9 @@ If you do not set properties such as dashLength, lineAlpha, lineColor, etc - val
|
||||
|
||||
/** AmChart is a base class of all charts. It can not be instantiated explicitly. AmCoordinateChart, AmPieChart and AmMap extend AmChart class. */
|
||||
class AmChart {
|
||||
/** Background color. You should set backgroundAlpha to >0 value in order background to be visible. We recommend setting background color directly on a chart's DIV instead of using this property. #FFFFFF */
|
||||
/** used when constructing a chart with a theme */
|
||||
constructor(theme: any);
|
||||
/** Background color. You should set backgroundAlpha to >0 value in order background to be visible. We recommend setting background color directly on a chart's DIV instead of using this property. #FFFFFF */
|
||||
backgroundColor: string;
|
||||
/** The chart creates AmBalloon class itself. If you want to customize balloon, get balloon instance using this property, and then change balloon's properties. AmBalloon */
|
||||
balloon: AmBalloon;
|
||||
@@ -943,7 +945,7 @@ If you do not set properties such as dashLength, lineAlpha, lineColor, etc - val
|
||||
@param legend
|
||||
@param legendDivId - Id of the legend div (optional).
|
||||
*/
|
||||
addLegend(legend: AmLegend, legendDivId: string);
|
||||
addLegend(legend: AmLegend, legendDivId?: string);
|
||||
/** Adds a legend to the chart.
|
||||
By default, you don't need to create div for your legend, however if you want it to be positioned in some different way, you can create div anywhere you want and pass id or reference to your div as a second parameter.
|
||||
(NOTE: This method will not work on StockPanel.)
|
||||
@@ -1437,7 +1439,7 @@ If you do not set properties such as dashLength, lineAlpha, lineColor, etc - val
|
||||
chart.write("chartdiv");
|
||||
*/
|
||||
class AmSerialChart extends AmRectangularChart {
|
||||
/** Read-only. Chart creates category axis itself. If you want to change some properties, you should get this axis from the chart and set properties to this object. */
|
||||
/** Read-only. Chart creates category axis itself. If you want to change some properties, you should get this axis from the chart and set properties to this object. */
|
||||
categoryAxis: CategoryAxis;
|
||||
/** Category field name tells the chart the name of the field in your dataProvider object which will be used for category axis values. */
|
||||
categoryField: string;
|
||||
|
||||
@@ -167,7 +167,7 @@ function TestProtractor() {
|
||||
|
||||
var webElement: webdriver.WebElement = ptor.wrapWebElement(new webdriver.WebElement(driver, 'id'));
|
||||
|
||||
var locationAbsUrl: string = ptor.getLocationAbsUrl();
|
||||
var locationAbsUrl: webdriver.promise.Promise = ptor.getLocationAbsUrl();
|
||||
}
|
||||
|
||||
function TestElement() {
|
||||
@@ -239,4 +239,4 @@ function TestWebElements() {
|
||||
webElement = webElement.findElement(by.id('id')).$('.class');
|
||||
promise = webElement.findElement(by.id('id')).$$('.class');
|
||||
promise = webElement.findElement(by.id('id')).evaluate('something');
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -772,7 +772,7 @@ declare module protractor {
|
||||
/**
|
||||
* Returns the current absolute url from AngularJS.
|
||||
*/
|
||||
getLocationAbsUrl(): string;
|
||||
getLocationAbsUrl(): webdriver.promise.Promise;
|
||||
|
||||
/**
|
||||
* Pauses the test and injects some helper functions into the browser, so that
|
||||
@@ -865,4 +865,4 @@ declare var element: protractor.Element;
|
||||
|
||||
declare module 'protractor' {
|
||||
export = protractor;
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+2
-1
@@ -26,6 +26,7 @@ declare module ng.ui {
|
||||
|
||||
interface IStateProvider extends IServiceProvider {
|
||||
state(name:string, config:IState): IStateProvider;
|
||||
state(config:IState): IStateProvider;
|
||||
decorator(name?: string, decorator?: (state: IState, parent: Function) => any): any;
|
||||
}
|
||||
|
||||
@@ -73,7 +74,7 @@ declare module ng.ui {
|
||||
}
|
||||
|
||||
interface IStateService {
|
||||
go(to: string, params?: {}, options?: IStateOptions): void;
|
||||
go(to: string, params?: {}, options?: IStateOptions): IPromise<any>;
|
||||
transitionTo(state: string, params?: {}, updateLocation?: boolean): void;
|
||||
transitionTo(state: string, params?: {}, options?: IStateOptions): void;
|
||||
includes(state: string, params?: {}): boolean;
|
||||
|
||||
Vendored
+1
@@ -51,6 +51,7 @@ declare module ng.resource {
|
||||
// to be considered as parameters to the request.
|
||||
// https://github.com/angular/angular.js/blob/v1.2.0/src/ngResource/resource.js#L461-L465
|
||||
interface IResourceClass<T> {
|
||||
new(dataOrParams? : any) : T;
|
||||
get(): T;
|
||||
get(dataOrParams: any): T;
|
||||
get(dataOrParams: any, success: Function): T;
|
||||
|
||||
Vendored
+1
@@ -41,6 +41,7 @@ declare module ng.route {
|
||||
resolve?: any;
|
||||
redirectTo?: any;
|
||||
reloadOnSearch?: boolean;
|
||||
caseInsensitiveMatch?: boolean;
|
||||
}
|
||||
|
||||
// see http://docs.angularjs.org/api/ng.$route#current
|
||||
|
||||
@@ -94,6 +94,7 @@ module HttpAndRegularPromiseTests {
|
||||
person: Person;
|
||||
theAnswer: number;
|
||||
letters: string[];
|
||||
snack: string;
|
||||
}
|
||||
|
||||
var someController: Function = ($scope: SomeControllerScope, $http: ng.IHttpService, $q: ng.IQService) => {
|
||||
@@ -132,6 +133,12 @@ module HttpAndRegularPromiseTests {
|
||||
cPromise.then((letters: string[]) => {
|
||||
$scope.letters = letters;
|
||||
});
|
||||
|
||||
// When $q.when is passed an IPromise<T>, it returns an IPromise<T>
|
||||
var dPromise: ng.IPromise<string> = $q.when($q.when("ALBATROSS!"));
|
||||
dPromise.then((snack: string) => {
|
||||
$scope.snack = snack;
|
||||
});
|
||||
}
|
||||
|
||||
// Test that we can pass around a type-checked success/error Promise Callback
|
||||
|
||||
Vendored
+2
-1
@@ -430,7 +430,7 @@ declare module ng {
|
||||
// DocumentService
|
||||
// see http://docs.angularjs.org/api/ng.$document
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
interface IDocumentService extends Document {}
|
||||
interface IDocumentService extends IAugmentedJQuery {}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// ExceptionHandlerService
|
||||
@@ -455,6 +455,7 @@ declare module ng {
|
||||
all(promises: {[id: string]: IPromise<any>;}): IPromise<{[id: string]: any}>;
|
||||
defer<T>(): IDeferred<T>;
|
||||
reject(reason?: any): IPromise<void>;
|
||||
when<T>(value: IPromise<T>): IPromise<T>;
|
||||
when<T>(value: T): IPromise<T>;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
/// <reference path="./asciify.d.ts" />
|
||||
|
||||
import asciify = require('asciify');
|
||||
|
||||
asciify('Whoa', function(err, result){console.log(result)});
|
||||
asciify('Whoa', '3-d', function(err, result){console.log(result)});
|
||||
asciify('Whoa', {font:'3-d'}, function(err, result){console.log(result)});
|
||||
|
||||
asciify.getFonts(function(err, fonts) { fonts.slice(0); });
|
||||
Vendored
+29
@@ -0,0 +1,29 @@
|
||||
// Type definitions for asciify 1.3.5
|
||||
// Project: https://www.npmjs.org/package/asciify
|
||||
// Definitions by: Alan Norbauer http://alan.norbauer.com
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
interface AsciifyOptions {
|
||||
font?: string;
|
||||
maxWidth?: number;
|
||||
color?: string;
|
||||
}
|
||||
|
||||
interface AsciifyCallback {
|
||||
// err is sometimes a string and sometimes an Error
|
||||
(err: any, asciifiedText: string): void
|
||||
}
|
||||
|
||||
declare module "asciify" {
|
||||
function asciify(text: string, callback: AsciifyCallback): void;
|
||||
function asciify(text: string, options: string, callback: AsciifyCallback): void;
|
||||
function asciify(text: string, options: AsciifyOptions, callback: AsciifyCallback): void;
|
||||
|
||||
module asciify {
|
||||
function getFonts(callback: (err: Error, fonts: string[]) => void): void;
|
||||
}
|
||||
|
||||
export = asciify
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
"--noImplicitAny --module commonjs"
|
||||
@@ -0,0 +1,19 @@
|
||||
/// <reference path="./assert.d.ts" />
|
||||
|
||||
assert(1 + 1 - 2 === 0, "The universe isn't how it should.");
|
||||
|
||||
assert.deepEqual({ x: { y: 3 } }, { x: { y: 3 } }, "DEEP WENT DERP");
|
||||
|
||||
assert.equal(3, "3", "uses == comparator");
|
||||
|
||||
assert.notStrictEqual(2, "2", "uses === comparator");
|
||||
|
||||
assert.throws(() => {
|
||||
throw "a hammer at your face";
|
||||
}, undefined, "DODGED IT");
|
||||
|
||||
assert.doesNotThrow(() => {
|
||||
if (false) {
|
||||
throw "a hammer at your face";
|
||||
}
|
||||
}, undefined, "What the...*crunch*");
|
||||
Vendored
+62
@@ -0,0 +1,62 @@
|
||||
// Type definitions for assert and power-assert
|
||||
// Project: https://github.com/Jxck/assert
|
||||
// Project: https://github.com/twada/power-assert
|
||||
// Definitions by: vvakame <https://github.com/vvakame>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
// copy from assert external module in node.d.ts
|
||||
|
||||
declare function assert(value:any, message?:string):void;
|
||||
declare module assert {
|
||||
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;
|
||||
}
|
||||
|
||||
// duplicate to node.d.ts
|
||||
// declare module "assert" {
|
||||
// export = assert;
|
||||
// }
|
||||
|
||||
declare module "power-assert" {
|
||||
export = assert;
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
/// <reference path="assertion-error.d.ts" />
|
||||
|
||||
import AssertionError = require('assertion-error');
|
||||
|
||||
var e: AssertionError;
|
||||
var str: string;
|
||||
|
||||
function foo () {
|
||||
|
||||
}
|
||||
|
||||
e = new AssertionError(str);
|
||||
e = new AssertionError(str, {a:1, b:2});
|
||||
e = new AssertionError(str, {a:1, b:2}, foo);
|
||||
|
||||
Vendored
+15
@@ -0,0 +1,15 @@
|
||||
// Type definitions for assertion-error 1.0 0
|
||||
// Project: https://github.com/chaijs/assertion-error
|
||||
// Definitions by: Bart van der Schoor <https://github.com/Bartvds>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module 'assertion-error' {
|
||||
class AssertionError implements Error {
|
||||
constructor(message: string, props?: any, ssf?: Function);
|
||||
name: string;
|
||||
message: string;
|
||||
showDiff: boolean;
|
||||
stack: string;
|
||||
}
|
||||
export = AssertionError;
|
||||
}
|
||||
Vendored
+33
-29
@@ -4,10 +4,12 @@
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
interface AsyncMultipleResultsCallback<T> { (err: string, results: T[]): any; }
|
||||
interface AsyncSingleResultCallback<T> { (err: string, result: T): any; }
|
||||
interface AsyncSingleResultCallback<T> { (err: string, result: T): void; }
|
||||
interface AsyncTimesCallback<T> { (n: number, callback: AsyncMultipleResultsCallback<T>): void; }
|
||||
interface AsyncIterator<T> { (item: T, callback: AsyncMultipleResultsCallback<T>): void; }
|
||||
interface AsyncMemoIterator<T> { (memo: T, item: T, callback: AsyncSingleResultCallback<T>): void; }
|
||||
|
||||
interface AsyncIterator<T, R> { (item: T, callback: AsyncSingleResultCallback<R>): void; }
|
||||
interface AsyncMemoIterator<T, R> { (memo: R, item: T, callback: AsyncSingleResultCallback<R>): void; }
|
||||
|
||||
interface AsyncWorker<T> { (task: T, callback: Function): void; }
|
||||
|
||||
interface AsyncQueue<T> {
|
||||
@@ -22,37 +24,39 @@ interface AsyncQueue<T> {
|
||||
interface Async {
|
||||
|
||||
// Collections
|
||||
forEach<T>(arr: T[], iterator: AsyncIterator<T>, callback: AsyncMultipleResultsCallback<T>): void;
|
||||
forEachSeries<T>(arr: T[], iterator: AsyncIterator<T>, callback: AsyncMultipleResultsCallback<T>): void;
|
||||
forEachLimit<T>(arr: T[], limit: number, iterator: AsyncIterator<T>, callback: AsyncMultipleResultsCallback<T>): void;
|
||||
map<T>(arr: T[], iterator: AsyncIterator<T>, callback: AsyncMultipleResultsCallback<T>);
|
||||
mapSeries<T>(arr: T[], iterator: AsyncIterator<T>, callback: AsyncMultipleResultsCallback<T>);
|
||||
filter<T>(arr: T[], iterator: AsyncIterator<T>, callback: AsyncMultipleResultsCallback<T>);
|
||||
select<T>(arr: T[], iterator: AsyncIterator<T>, callback: AsyncMultipleResultsCallback<T>);
|
||||
filterSeries<T>(arr: T[], iterator: AsyncIterator<T>, callback: AsyncMultipleResultsCallback<T>);
|
||||
selectSeries<T>(arr: T[], iterator: AsyncIterator<T>, callback: AsyncMultipleResultsCallback<T>);
|
||||
reject<T>(arr: T[], iterator: AsyncIterator<T>, callback: AsyncMultipleResultsCallback<T>);
|
||||
rejectSeries<T>(arr: T[], iterator: AsyncIterator<T>, callback: AsyncMultipleResultsCallback<T>);
|
||||
reduce<T>(arr: T[], memo: T, iterator: AsyncMemoIterator<T>, callback: AsyncSingleResultCallback<T>);
|
||||
inject<T>(arr: T[], memo: T, iterator: AsyncMemoIterator<T>, callback: AsyncSingleResultCallback<T>);
|
||||
foldl<T>(arr: T[], memo: T, iterator: AsyncMemoIterator<T>, callback: AsyncSingleResultCallback<T>);
|
||||
reduceRight<T>(arr: T[], memo: T, iterator: AsyncMemoIterator<T>, callback: AsyncSingleResultCallback<T>);
|
||||
foldr<T, U>(arr: T[], memo: T, iterator: AsyncMemoIterator<T>, callback: AsyncSingleResultCallback<T>);
|
||||
detect<T>(arr: T[], iterator: AsyncIterator<T>, callback: AsyncMultipleResultsCallback<T>);
|
||||
detectSeries<T>(arr: T[], iterator: AsyncIterator<T>, callback: AsyncMultipleResultsCallback<T>);
|
||||
sortBy<T>(arr: T[], iterator: AsyncIterator<T>, callback: AsyncMultipleResultsCallback<T>);
|
||||
some<T>(arr: T[], iterator: AsyncIterator<T>, callback: AsyncMultipleResultsCallback<T>);
|
||||
any<T>(arr: T[], iterator: AsyncIterator<T>, callback: AsyncMultipleResultsCallback<T>);
|
||||
every<T>(arr: T[], iterator: AsyncIterator<T>, callback: (result: boolean) => any);
|
||||
all<T>(arr: T[], iterator: AsyncIterator<T>, callback: (result: boolean) => any);
|
||||
concat<T>(arr: T[], iterator: AsyncIterator<T>, callback: AsyncMultipleResultsCallback<T>);
|
||||
concatSeries<T>(arr: T[], iterator: AsyncIterator<T>, callback: AsyncMultipleResultsCallback<T>);
|
||||
forEach<T,R>(arr: T[], iterator: AsyncIterator<T, R>, callback: AsyncMultipleResultsCallback<R>): void;
|
||||
forEachSeries<T, R>(arr: T[], iterator: AsyncIterator<T, R>, callback: AsyncMultipleResultsCallback<R>): void;
|
||||
forEachLimit<T, R>(arr: T[], limit: number, iterator: AsyncIterator<T, R>, callback: AsyncMultipleResultsCallback<R>): void;
|
||||
map<T, R>(arr: T[], iterator: AsyncIterator<T, R>, callback: AsyncMultipleResultsCallback<R>);
|
||||
mapSeries<T, R>(arr: T[], iterator: AsyncIterator<T, R>, callback: AsyncMultipleResultsCallback<R>);
|
||||
filter<T>(arr: T[], iterator: AsyncIterator<T, boolean>, callback: AsyncMultipleResultsCallback<T>);
|
||||
select<T, R>(arr: T[], iterator: AsyncIterator<T, boolean>, callback: AsyncMultipleResultsCallback<T>);
|
||||
filterSeries<T, R>(arr: T[], iterator: AsyncIterator<T, boolean>, callback: AsyncMultipleResultsCallback<T>);
|
||||
selectSeries<T, R>(arr: T[], iterator: AsyncIterator<T, boolean>, callback: AsyncMultipleResultsCallback<T>);
|
||||
reject<T>(arr: T[], iterator: AsyncIterator<T, boolean>, callback: AsyncMultipleResultsCallback<T>);
|
||||
rejectSeries<T>(arr: T[], iterator: AsyncIterator<T, boolean>, callback: AsyncMultipleResultsCallback<T>);
|
||||
reduce<T, R>(arr: T[], memo: R, iterator: AsyncMemoIterator<T, R>, callback: AsyncSingleResultCallback<R>);
|
||||
inject<T, R>(arr: T[], memo: R, iterator: AsyncMemoIterator<T, R>, callback: AsyncSingleResultCallback<R>);
|
||||
foldl<T, R>(arr: T[], memo: R, iterator: AsyncMemoIterator<T, R>, callback: AsyncSingleResultCallback<R>);
|
||||
reduceRight<T, R>(arr: T[], memo: R, iterator: AsyncMemoIterator<T, R>, callback: AsyncSingleResultCallback<R>);
|
||||
foldr<T, R>(arr: T[], memo: R, iterator: AsyncMemoIterator<T, R>, callback: AsyncSingleResultCallback<R>);
|
||||
detect<T>(arr: T[], iterator: AsyncIterator<T, boolean>, callback: AsyncMultipleResultsCallback<T>);
|
||||
detectSeries<T>(arr: T[], iterator: AsyncIterator<T, boolean>, callback: AsyncMultipleResultsCallback<T>);
|
||||
sortBy<T, V>(arr: T[], iterator: AsyncIterator<T, V>, callback: AsyncMultipleResultsCallback<T>);
|
||||
some<T>(arr: T[], iterator: AsyncIterator<T, boolean>, callback: AsyncMultipleResultsCallback<T>);
|
||||
any<T>(arr: T[], iterator: AsyncIterator<T, boolean>, callback: AsyncMultipleResultsCallback<T>);
|
||||
every<T>(arr: T[], iterator: AsyncIterator<T, boolean>, callback: (result: boolean) => any);
|
||||
all<T>(arr: T[], iterator: AsyncIterator<T, boolean>, callback: (result: boolean) => any);
|
||||
concat<T, R>(arr: T[], iterator: AsyncIterator<T, R[]>, callback: AsyncMultipleResultsCallback<R>);
|
||||
concatSeries<T, R>(arr: T[], iterator: AsyncIterator<T, R[]>, callback: AsyncMultipleResultsCallback<R>);
|
||||
|
||||
// Control Flow
|
||||
series<T>(tasks: T[], callback?: AsyncMultipleResultsCallback<T>): void;
|
||||
series<T>(tasks: T, callback?: AsyncMultipleResultsCallback<T>): void;
|
||||
parallel<T>(tasks: T[], callback?: AsyncMultipleResultsCallback<T>): void;
|
||||
parallel<T>(tasks: T, callback?: AsyncMultipleResultsCallback<T>): void;
|
||||
parallelLimit<T>(tasks: T[], limit: number, callback?: AsyncMultipleResultsCallback<T>): void;
|
||||
parallelLimit<T>(tasks: T, limit: number, callback?: AsyncMultipleResultsCallback<T>): void;
|
||||
whilst(test: Function, fn: Function, callback: Function): void;
|
||||
until(test: Function, fn: Function, callback: Function): void;
|
||||
waterfall<T>(tasks: T[], callback?: AsyncMultipleResultsCallback<T>): void;
|
||||
@@ -78,5 +82,5 @@ interface Async {
|
||||
declare var async: Async;
|
||||
|
||||
declare module "async" {
|
||||
export = async;
|
||||
export = async;
|
||||
}
|
||||
|
||||
+772
-209
File diff suppressed because it is too large
Load Diff
Vendored
+417
-248
@@ -3,27 +3,44 @@
|
||||
// Definitions by: Bart van der Schoor <https://github.com/Bartvds>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
// Note: these are preliminary non-generic typings using `any`: the generic versions are ready but need (tsc >= v1.0.0) due to issues in the compiler
|
||||
// - https://github.com/borisyankov/DefinitelyTyped/issues/1563
|
||||
// - https://github.com/borisyankov/DefinitelyTyped/tree/def/bluebird/bluebird
|
||||
// ES6 model with generics overload was sourced and trans-multiplied from es6-promises.d.ts
|
||||
// By: Campredon <https://github.com/fdecampredon/>
|
||||
|
||||
declare class Promise {
|
||||
// Warning: recommended to use `tsc > v0.9.7` (critical bugs in earlier generic code):
|
||||
// - https://github.com/borisyankov/DefinitelyTyped/issues/1563
|
||||
|
||||
// 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<void> (more overloads?)
|
||||
|
||||
declare class Promise<R> implements Promise.Thenable<R> {
|
||||
/**
|
||||
* 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(resolver: (resolve: (value: any) => void, reject: (reason: any) => any) => void);
|
||||
constructor(callback: (resolve: (thenable: Promise.Thenable<R>) => 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(fulfilledHandler?: (value: any) => any, rejectedHandler?: (reason: any) => any, progressHandler?: (note: any) => any):Promise;
|
||||
then<U>(onFulfill: (value: R) => Promise.Thenable<U>, onReject: (error: any) => Promise.Thenable<U>, onProgress?: (note: any) => any): Promise<U>;
|
||||
then<U>(onFulfill: (value: R) => Promise.Thenable<U>, onReject?: (error: any) => U, onProgress?: (note: any) => any): Promise<U>;
|
||||
then<U>(onFulfill: (value: R) => U, onReject: (error: any) => Promise.Thenable<U>, onProgress?: (note: any) => any): Promise<U>;
|
||||
then<U>(onFulfill?: (value: R) => U, onReject?: (error: any) => U, onProgress?: (note: any) => any): Promise<U>;
|
||||
|
||||
/**
|
||||
* 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(handler: (reason: any) => any):Promise;
|
||||
caught(handler: (reason: any) => any):Promise;
|
||||
catch<U>(onReject?: (error: any) => Promise.Thenable<U>): Promise<U>;
|
||||
caught<U>(onReject?: (error: any) => Promise.Thenable<U>): Promise<U>;
|
||||
|
||||
catch<U>(onReject?: (error: any) => U): Promise<U>;
|
||||
caught<U>(onReject?: (error: any) => U): Promise<U>;
|
||||
|
||||
/**
|
||||
* 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.
|
||||
@@ -32,64 +49,78 @@ declare class Promise {
|
||||
*
|
||||
* Alias `.caught();` for compatibility with earlier ECMAScript version.
|
||||
*/
|
||||
//TODO expand this complex overload (weird)
|
||||
catch(predicate: (reason: any) => boolean, handler: (reason: any) => any): Promise;
|
||||
caught(predicate: (reason: any) => boolean, handler: (reason: any) => any): Promise;
|
||||
catch<U>(predicate: (error: any) => boolean, onReject: (error: any) => Promise.Thenable<U>): Promise<U>;
|
||||
caught<U>(predicate: (error: any) => boolean, onReject: (error: any) => Promise.Thenable<U>): Promise<U>;
|
||||
|
||||
catch(ErrorClass: Function, handler: (reason: any) => any): Promise;
|
||||
caught(ErrorClass: Function, handler: (reason: any) => any): Promise;
|
||||
catch<U>(predicate: (error: any) => boolean, onReject: (error: any) => U): Promise<U>;
|
||||
caught<U>(predicate: (error: any) => boolean, onReject: (error: any) => U): Promise<U>;
|
||||
|
||||
catch<U>(ErrorClass: Function, onReject: (error: any) => Promise.Thenable<U>): Promise<U>;
|
||||
caught<U>(ErrorClass: Function, onReject: (error: any) => Promise.Thenable<U>): Promise<U>;
|
||||
|
||||
catch<U>(ErrorClass: Function, onReject: (error: any) => U): Promise<U>;
|
||||
caught<U>(ErrorClass: Function, onReject: (error: any) => U): Promise<U>;
|
||||
|
||||
/**
|
||||
* 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(rejectedHandler: (reason: any) => any): Promise;
|
||||
error<U>(onReject: (reason: any) => Promise.Thenable<U>): Promise<U>;
|
||||
error<U>(onReject: (reason: any) => U): Promise<U>;
|
||||
|
||||
/**
|
||||
* 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: any) => any): Promise;
|
||||
lastly(handler: (value: any) => any): Promise;
|
||||
finally(handler: (value: R) => Promise.Thenable<R>): Promise<R>;
|
||||
finally(handler: (value: R) => R): Promise<R>;
|
||||
finally(handler: (value: R) => void): Promise<R>;
|
||||
|
||||
lastly(handler: (value: R) => Promise.Thenable<R>): Promise<R>;
|
||||
lastly(handler: (value: R) => R): Promise<R>;
|
||||
lastly(handler: (value: R) => void): Promise<R>;
|
||||
|
||||
/**
|
||||
* 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;
|
||||
bind(thisArg: any): Promise<R>;
|
||||
|
||||
/**
|
||||
* Like `.then()`, but any unhandled rejection that ends up here will be thrown as an error.
|
||||
*/
|
||||
done(fulfilledHandler?: (value: any) => any, rejectedHandler?: (reason: any) => any, progressHandler?: (note: any) => any): Promise;
|
||||
done<U>(onFulfilled: (value: R) => Promise.Thenable<U>, onRejected: (error: any) => Promise.Thenable<U>, onProgress?: (note: any) => any): Promise<U>;
|
||||
done<U>(onFulfilled: (value: R) => Promise.Thenable<U>, onRejected?: (error: any) => U, onProgress?: (note: any) => any): Promise<U>;
|
||||
done<U>(onFulfilled: (value: R) => U, onRejected: (error: any) => Promise.Thenable<U>, onProgress?: (note: any) => any): Promise<U>;
|
||||
done<U>(onFulfilled?: (value: R) => U, onRejected?: (error: any) => U, onProgress?: (note: any) => any): Promise<U>;
|
||||
|
||||
/**
|
||||
* 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;
|
||||
progressed(handler: (note: any) => any): Promise<R>;
|
||||
|
||||
/**
|
||||
* 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;
|
||||
delay(ms: number): Promise<R>;
|
||||
|
||||
/**
|
||||
* 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;
|
||||
timeout(ms: number, message?: string): Promise<R>;
|
||||
|
||||
/**
|
||||
* 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?: Function): Promise;
|
||||
nodeify(callback: (err: any, value?: R) => void): Promise<R>;
|
||||
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;
|
||||
cancellable(): Promise<R>;
|
||||
|
||||
/**
|
||||
* Cancel this promise. The cancellation will propagate to farthest cancellable ancestor promise which is still pending.
|
||||
@@ -100,17 +131,21 @@ declare class Promise {
|
||||
*
|
||||
* Promises are by default not cancellable. Use `.cancellable()` to mark a promise as cancellable.
|
||||
*/
|
||||
cancel(): Promise;
|
||||
// TODO what to do with this?
|
||||
cancel<U>(): Promise<U>;
|
||||
|
||||
/**
|
||||
* 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(fulfilledHandler?: (value: any) => any, rejectedHandler?: (reason: any) => any, progressHandler?: (note: any) => any): Promise;
|
||||
fork<U>(onFulfilled: (value: R) => Promise.Thenable<U>, onRejected: (error: any) => Promise.Thenable<U>, onProgress?: (note: any) => any): Promise<U>;
|
||||
fork<U>(onFulfilled: (value: R) => Promise.Thenable<U>, onRejected?: (error: any) => U, onProgress?: (note: any) => any): Promise<U>;
|
||||
fork<U>(onFulfilled: (value: R) => U, onRejected: (error: any) => Promise.Thenable<U>, onProgress?: (note: any) => any): Promise<U>;
|
||||
fork<U>(onFulfilled?: (value: R) => U, onRejected?: (error: any) => U, onProgress?: (note: any) => any): Promise<U>;
|
||||
|
||||
/**
|
||||
* Create an uncancellable promise based on this promise.
|
||||
*/
|
||||
uncancellable(): Promise;
|
||||
uncancellable(): Promise<R>;
|
||||
|
||||
/**
|
||||
* See if this promise can be cancelled.
|
||||
@@ -138,62 +173,65 @@ declare class Promise {
|
||||
isResolved(): boolean;
|
||||
|
||||
/**
|
||||
* Synchronously inspect the state of this `promise`. The `Promise.Inspection` will represent the state of the promise as snapshotted at the time of calling `.inspect()`.
|
||||
* 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;
|
||||
inspect(): Promise.Inspection<R>;
|
||||
|
||||
/**
|
||||
* This is a convenience method for doing:
|
||||
*
|
||||
* <code>
|
||||
* promise.then(function(obj){
|
||||
* return obj[propertyName].call(obj, arg...);
|
||||
* });
|
||||
* return obj[propertyName].call(obj, arg...);
|
||||
* });
|
||||
* </code>
|
||||
*/
|
||||
call(propertyName: string, ...args: any[]): Promise;
|
||||
call(propertyName: string, ...args: any[]): Promise<any>;
|
||||
|
||||
/**
|
||||
* This is a convenience method for doing:
|
||||
*
|
||||
* <code>
|
||||
* promise.then(function(obj){
|
||||
* return obj[propertyName];
|
||||
* });
|
||||
* return obj[propertyName];
|
||||
* });
|
||||
* </code>
|
||||
*/
|
||||
get(propertyName: string): Promise;
|
||||
// TODO find way to fix get()
|
||||
// get<U>(propertyName: string): Promise<U>;
|
||||
|
||||
/**
|
||||
* Convenience method for:
|
||||
*
|
||||
* <code>
|
||||
* .then(function() {
|
||||
* return value;
|
||||
* });
|
||||
* return value;
|
||||
* });
|
||||
* </code>
|
||||
*
|
||||
* 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: any): Promise;
|
||||
thenReturn(): Promise;
|
||||
return(): Promise<any>;
|
||||
thenReturn(): Promise<any>;
|
||||
return<U>(value: U): Promise<U>;
|
||||
thenReturn<U>(value: U): Promise<U>;
|
||||
|
||||
/**
|
||||
* Convenience method for:
|
||||
*
|
||||
* <code>
|
||||
* .then(function() {
|
||||
* throw reason;
|
||||
* });
|
||||
* throw reason;
|
||||
* });
|
||||
* </code>
|
||||
* Same limitations apply as with `.return()`.
|
||||
*
|
||||
* Alias `.thenThrow();` for compatibility with earlier ECMAScript version.
|
||||
*/
|
||||
throw(reason: any): Promise;
|
||||
thenThrow(): Promise;
|
||||
throw(reason: Error): Promise<R>;
|
||||
thenThrow(reason: Error): Promise<R>;
|
||||
|
||||
/**
|
||||
* Convert to String.
|
||||
@@ -205,64 +243,376 @@ declare class 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<U>(onFulfill: Function, onReject?: (reason: any) => Promise.Thenable<U>): Promise<U>;
|
||||
spread<U>(onFulfill: Function, onReject?: (reason: any) => U): Promise<U>;
|
||||
/*
|
||||
// TODO or something like this?
|
||||
spread<U, W>(onFulfill: (...values: W[]) => Promise.Thenable<U>, onReject?: (reason: any) => Promise.Thenable<U>): Promise<U>;
|
||||
spread<U, W>(onFulfill: (...values: W[]) => Promise.Thenable<U>, onReject?: (reason: any) => U): Promise<U>;
|
||||
spread<U, W>(onFulfill: (...values: W[]) => U, onReject?: (reason: any) => Promise.Thenable<U>): Promise<U>;
|
||||
spread<U, W>(onFulfill: (...values: W[]) => U, onReject?: (reason: any) => U): Promise<U>;
|
||||
*/
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
all(): Promise;
|
||||
// TODO type inference from array-resolving promise?
|
||||
all<U>(): Promise<U[]>;
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
props(): Promise;
|
||||
// TODO how to model instance.props()?
|
||||
props(): Promise<Object>;
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
settle(): Promise;
|
||||
// TODO type inference from array-resolving promise?
|
||||
settle<U>(): Promise<Promise.Inspection<U>[]>;
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
any(): Promise;
|
||||
// TODO type inference from array-resolving promise?
|
||||
any<U>(): Promise<U>;
|
||||
|
||||
/**
|
||||
* Same as calling `Promise.race(thisPromise)`. With the exception that if this promise is bound to a value, the returned promise is bound to that value too.
|
||||
* 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.
|
||||
*/
|
||||
some(count: number): Promise;
|
||||
// TODO type inference from array-resolving promise?
|
||||
some<U>(count: number): Promise<U[]>;
|
||||
|
||||
/**
|
||||
* Same as calling `Promise.some(thisPromise, count)`. With the exception that if this promise is bound to a value, the returned promise is bound to that value too.
|
||||
* 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.
|
||||
*/
|
||||
race(): Promise;
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
spread(fulfilledHandler?: (value: any) => any, rejectedHandler?: (reason: any) => any): Promise;
|
||||
// TODO type inference from array-resolving promise?
|
||||
race<U>(): Promise<U>;
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
map(mapper: (item: any, index: number, arrayLength: number) => any): Promise;
|
||||
// TODO type inference from array-resolving promise?
|
||||
map<Q, U>(mapper: (item: Q, index: number, arrayLength: number) => Promise.Thenable<U>): Promise<U>;
|
||||
map<Q, U>(mapper: (item: Q, index: number, arrayLength: number) => U): Promise<U>;
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
reduce(reducer: (total: number, current: any, index: number, arrayLength: number) => any, initialValue?: any): Promise;
|
||||
// TODO type inference from array-resolving promise?
|
||||
reduce<Q, U>(reducer: (memo: U, item: Q, index: number, arrayLength: number) => Promise.Thenable<U>, initialValue?: U): Promise<U>;
|
||||
reduce<Q, U>(reducer: (memo: U, item: Q, index: number, arrayLength: number) => U, initialValue?: U): Promise<U>;
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
filter(filterer: (item: any, index: number, arrayLength: number) => any): Promise;
|
||||
// TODO type inference from array-resolving promise?
|
||||
filter<U>(filterer: (item: U, index: number, arrayLength: number) => Promise.Thenable<boolean>): Promise<U>;
|
||||
filter<U>(filterer: (item: U, index: number, arrayLength: number) => boolean): Promise<U>;
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
static try<R>(fn: () => Promise.Thenable<R>, args?: any[], ctx?: any): Promise<R>;
|
||||
static try<R>(fn: () => R, args?: any[], ctx?: any): Promise<R>;
|
||||
|
||||
static attempt<R>(fn: () => Promise.Thenable<R>, args?: any[], ctx?: any): Promise<R>;
|
||||
static attempt<R>(fn: () => R, args?: any[], ctx?: any): Promise<R>;
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
static 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.
|
||||
*/
|
||||
static resolve(): Promise<void>;
|
||||
static resolve<R>(value: Promise.Thenable<R>): Promise<R>;
|
||||
static resolve<R>(value: R): Promise<R>;
|
||||
|
||||
/**
|
||||
* Create a promise that is rejected with the given `reason`.
|
||||
*/
|
||||
static reject(reason: any): Promise<any>;
|
||||
static reject<R>(reason: any): Promise<R>;
|
||||
|
||||
/**
|
||||
* Create a promise with undecided fate and return a `PromiseResolver` to control it. See resolution?: Promise(#promise-resolution).
|
||||
*/
|
||||
static defer<R>(): Promise.Resolver<R>;
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
static cast<R>(value: Promise.Thenable<R>): Promise<R>;
|
||||
static cast<R>(value: R): Promise<R>;
|
||||
|
||||
/**
|
||||
* Sugar for `Promise.resolve(undefined).bind(thisArg);`. See `.bind()`.
|
||||
*/
|
||||
static bind(thisArg: any): Promise<void>;
|
||||
|
||||
/**
|
||||
* See if `value` is a trusted Promise.
|
||||
*/
|
||||
static 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.
|
||||
*/
|
||||
static 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
|
||||
static delay<R>(value: Promise.Thenable<R>, ms: number): Promise<R>;
|
||||
static delay<R>(value: R, ms: number): Promise<R>;
|
||||
static delay(ms: number): Promise<void>;
|
||||
|
||||
/**
|
||||
* 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?
|
||||
static 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?
|
||||
static 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
|
||||
static coroutine<R>(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
|
||||
static spawn<R>(generatorFunction: Function): Promise<R>;
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
static 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.
|
||||
*/
|
||||
static 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
|
||||
static all<R>(values: Promise.Thenable<Promise.Thenable<R>[]>): Promise<R[]>;
|
||||
// promise of array with values
|
||||
static all<R>(values: Promise.Thenable<R[]>): Promise<R[]>;
|
||||
// array with promises of value
|
||||
static all<R>(values: Promise.Thenable<R>[]): Promise<R[]>;
|
||||
// array with values
|
||||
static all<R>(values: R[]): Promise<R[]>;
|
||||
|
||||
/**
|
||||
* 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
|
||||
static props(object: Promise<Object>): Promise<Object>;
|
||||
// object
|
||||
static props(object: Object): Promise<Object>;
|
||||
|
||||
/**
|
||||
* 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
|
||||
static settle<R>(values: Promise.Thenable<Promise.Thenable<R>[]>): Promise<Promise.Inspection<R>[]>;
|
||||
// promise of array with values
|
||||
static settle<R>(values: Promise.Thenable<R[]>): Promise<Promise.Inspection<R>[]>;
|
||||
// array with promises of value
|
||||
static settle<R>(values: Promise.Thenable<R>[]): Promise<Promise.Inspection<R>[]>;
|
||||
// array with values
|
||||
static settle<R>(values: R[]): Promise<Promise.Inspection<R>[]>;
|
||||
|
||||
/**
|
||||
* 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
|
||||
static any<R>(values: Promise.Thenable<Promise.Thenable<R>[]>): Promise<R>;
|
||||
// promise of array with values
|
||||
static any<R>(values: Promise.Thenable<R[]>): Promise<R>;
|
||||
// array with promises of value
|
||||
static any<R>(values: Promise.Thenable<R>[]): Promise<R>;
|
||||
// array with values
|
||||
static any<R>(values: R[]): Promise<R>;
|
||||
|
||||
/**
|
||||
* 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
|
||||
static race<R>(values: Promise.Thenable<Promise.Thenable<R>[]>): Promise<R>;
|
||||
// promise of array with values
|
||||
static race<R>(values: Promise.Thenable<R[]>): Promise<R>;
|
||||
// array with promises of value
|
||||
static race<R>(values: Promise.Thenable<R>[]): Promise<R>;
|
||||
// array with values
|
||||
static race<R>(values: R[]): Promise<R>;
|
||||
|
||||
/**
|
||||
* 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
|
||||
static some<R>(values: Promise.Thenable<Promise.Thenable<R>[]>, count: number): Promise<R[]>;
|
||||
// promise of array with values
|
||||
static some<R>(values: Promise.Thenable<R[]>, count: number): Promise<R[]>;
|
||||
// array with promises of value
|
||||
static some<R>(values: Promise.Thenable<R>[], count: number): Promise<R[]>;
|
||||
// array with values
|
||||
static some<R>(values: R[], count: number): Promise<R[]>;
|
||||
|
||||
/**
|
||||
* 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
|
||||
static join<R>(...values: Promise.Thenable<R>[]): Promise<R[]>;
|
||||
// variadic array with values
|
||||
static join<R>(...values: R[]): Promise<R[]>;
|
||||
|
||||
/**
|
||||
* 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
|
||||
static map<R, U>(values: Promise.Thenable<Promise.Thenable<R>[]>, mapper: (item: R, index: number, arrayLength: number) => Promise.Thenable<U>): Promise<U[]>;
|
||||
static map<R, U>(values: Promise.Thenable<Promise.Thenable<R>[]>, mapper: (item: R, index: number, arrayLength: number) => U): Promise<U[]>;
|
||||
|
||||
// promise of array with values
|
||||
static map<R, U>(values: Promise.Thenable<R[]>, mapper: (item: R, index: number, arrayLength: number) => Promise.Thenable<U>): Promise<U[]>;
|
||||
static map<R, U>(values: Promise.Thenable<R[]>, mapper: (item: R, index: number, arrayLength: number) => U): Promise<U[]>;
|
||||
|
||||
// array with promises of value
|
||||
static map<R, U>(values: Promise.Thenable<R>[], mapper: (item: R, index: number, arrayLength: number) => Promise.Thenable<U>): Promise<U[]>;
|
||||
static map<R, U>(values: Promise.Thenable<R>[], mapper: (item: R, index: number, arrayLength: number) => U): Promise<U[]>;
|
||||
|
||||
// array with values
|
||||
static map<R, U>(values: R[], mapper: (item: R, index: number, arrayLength: number) => Promise.Thenable<U>): Promise<U[]>;
|
||||
static map<R, U>(values: R[], mapper: (item: R, index: number, arrayLength: number) => U): Promise<U[]>;
|
||||
|
||||
/**
|
||||
* 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
|
||||
static reduce<R, U>(values: Promise.Thenable<Promise.Thenable<R>[]>, reducer: (total: U, current: R, index: number, arrayLength: number) => Promise.Thenable<U>, initialValue?: U): Promise<U>;
|
||||
static reduce<R, U>(values: Promise.Thenable<Promise.Thenable<R>[]>, reducer: (total: U, current: R, index: number, arrayLength: number) => U, initialValue?: U): Promise<U>;
|
||||
|
||||
// promise of array with values
|
||||
static reduce<R, U>(values: Promise.Thenable<R[]>, reducer: (total: U, current: R, index: number, arrayLength: number) => Promise.Thenable<U>, initialValue?: U): Promise<U>;
|
||||
static reduce<R, U>(values: Promise.Thenable<R[]>, reducer: (total: U, current: R, index: number, arrayLength: number) => U, initialValue?: U): Promise<U>;
|
||||
|
||||
// array with promises of value
|
||||
static reduce<R, U>(values: Promise.Thenable<R>[], reducer: (total: U, current: R, index: number, arrayLength: number) => Promise.Thenable<U>, initialValue?: U): Promise<U>;
|
||||
static reduce<R, U>(values: Promise.Thenable<R>[], reducer: (total: U, current: R, index: number, arrayLength: number) => U, initialValue?: U): Promise<U>;
|
||||
|
||||
// array with values
|
||||
static reduce<R, U>(values: R[], reducer: (total: U, current: R, index: number, arrayLength: number) => Promise.Thenable<U>, initialValue?: U): Promise<U>;
|
||||
static reduce<R, U>(values: R[], reducer: (total: U, current: R, index: number, arrayLength: number) => U, initialValue?: U): Promise<U>;
|
||||
|
||||
/**
|
||||
* 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
|
||||
static filter<R>(values: Promise.Thenable<Promise.Thenable<R>[]>, filterer: (item: R, index: number, arrayLength: number) => Promise.Thenable<boolean>): Promise<R[]>;
|
||||
static filter<R>(values: Promise.Thenable<Promise.Thenable<R>[]>, filterer: (item: R, index: number, arrayLength: number) => boolean): Promise<R[]>;
|
||||
|
||||
// promise of array with values
|
||||
static filter<R>(values: Promise.Thenable<R[]>, filterer: (item: R, index: number, arrayLength: number) => Promise.Thenable<boolean>): Promise<R[]>;
|
||||
static filter<R>(values: Promise.Thenable<R[]>, filterer: (item: R, index: number, arrayLength: number) => boolean): Promise<R[]>;
|
||||
|
||||
// array with promises of value
|
||||
static filter<R>(values: Promise.Thenable<R>[], filterer: (item: R, index: number, arrayLength: number) => Promise.Thenable<boolean>): Promise<R[]>;
|
||||
static filter<R>(values: Promise.Thenable<R>[], filterer: (item: R, index: number, arrayLength: number) => boolean): Promise<R[]>;
|
||||
|
||||
// array with values
|
||||
static filter<R>(values: R[], filterer: (item: R, index: number, arrayLength: number) => Promise.Thenable<boolean>): Promise<R[]>;
|
||||
static filter<R>(values: R[], filterer: (item: R, index: number, arrayLength: number) => boolean): Promise<R[]>;
|
||||
}
|
||||
|
||||
declare module Promise {
|
||||
export interface RangeError extends Error {
|
||||
}
|
||||
export interface CancellationError extends Error {
|
||||
}
|
||||
export interface TimeoutError extends Error {
|
||||
}
|
||||
export interface TypeError extends Error {
|
||||
}
|
||||
export interface RejectionError extends Error {
|
||||
}
|
||||
|
||||
export interface Thenable<R> {
|
||||
then<U>(onFulfilled: (value: R) => Thenable<U>, onRejected: (error: any) => Thenable<U>): Thenable<U>;
|
||||
then<U>(onFulfilled: (value: R) => Thenable<U>, onRejected?: (error: any) => U): Thenable<U>;
|
||||
then<U>(onFulfilled: (value: R) => U, onRejected: (error: any) => Thenable<U>): Thenable<U>;
|
||||
then<U>(onFulfilled?: (value: R) => U, onRejected?: (error: any) => U): Thenable<U>;
|
||||
}
|
||||
|
||||
export interface Resolver<R> {
|
||||
/**
|
||||
* Returns a reference to the controlled promise that can be passed to clients.
|
||||
*/
|
||||
promise: Promise<R>;
|
||||
|
||||
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: any): void;
|
||||
resolve(value: R): void;
|
||||
resolve(): void;
|
||||
|
||||
/**
|
||||
* Reject the underlying promise with `reason` as the rejection reason.
|
||||
@@ -275,14 +625,15 @@ declare module Promise {
|
||||
progress(value: any): void;
|
||||
|
||||
/**
|
||||
* Gives you a callback representation of the `Promise.Resolver`. 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.
|
||||
* 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.
|
||||
*/
|
||||
callback:Function;
|
||||
// TODO specify resolver callback
|
||||
callback: (err: any, value: R, ...values: R[]) => void;
|
||||
}
|
||||
|
||||
interface Inspection {
|
||||
export interface Inspection<R> {
|
||||
/**
|
||||
* See if the underlying promise was fulfilled at the creation time of this inspection object.
|
||||
*/
|
||||
@@ -303,7 +654,7 @@ declare module Promise {
|
||||
*
|
||||
* throws `TypeError`
|
||||
*/
|
||||
value(): any;
|
||||
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.
|
||||
@@ -312,190 +663,8 @@ declare module Promise {
|
||||
*/
|
||||
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.
|
||||
*/
|
||||
// function try(fn: () => any, args?: any[], ctx?: any): Promise;
|
||||
|
||||
function attempt(fn: () => any, 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.
|
||||
*/
|
||||
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.
|
||||
*/
|
||||
function resolve(value: any): Promise;
|
||||
|
||||
/**
|
||||
* Create a promise that is rejected with the given `reason`.
|
||||
*/
|
||||
function reject(reason: any): Promise;
|
||||
|
||||
/**
|
||||
* Create a promise with undecided fate and return a `Promise.Resolver` to control it. See resolution?:Promise(#promise-resolution).
|
||||
*/
|
||||
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.
|
||||
*/
|
||||
function cast(value: any): Promise;
|
||||
|
||||
/**
|
||||
* Sugar for `Promise.resolve(undefined).bind(thisArg);`. See `.bind()`.
|
||||
*/
|
||||
function bind(thisArg: any): Promise;
|
||||
|
||||
/**
|
||||
* See if `value` is a trusted Promise.
|
||||
*/
|
||||
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.
|
||||
*/
|
||||
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.
|
||||
*/
|
||||
function delay(value: Promise, ms: number): Promise;
|
||||
|
||||
function delay(value: any, ms: number): Promise;
|
||||
|
||||
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`.
|
||||
*/
|
||||
function promisify(nodeFunction: Function, receiver?: any): Function;
|
||||
|
||||
/**
|
||||
* This overload has been **deprecated**. The overload will continue working for now. The recommended method for promisifying multiple methods at once is ``Promise.promisifyAll(Object target)``
|
||||
*/
|
||||
function promisify(target: Object): Object;
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
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.
|
||||
*/
|
||||
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.
|
||||
*/
|
||||
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.
|
||||
*/
|
||||
function noConflict(): Object;
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
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.
|
||||
*/
|
||||
function all(values: any[]): 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.*
|
||||
*/
|
||||
function props(object: Promise): Promise;
|
||||
|
||||
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 ``Promise.Inspection`` 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.*
|
||||
*/
|
||||
function settle(values: any[]): 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.
|
||||
*/
|
||||
function any(values: any[]): 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.
|
||||
*/
|
||||
function race(values: any[]): 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.*
|
||||
*/
|
||||
function some(values: any[], count: number): Promise;
|
||||
|
||||
/**
|
||||
* Like `Promise.all()` but instead of having to pass an array, the array is generated from the passed variadic arguments.
|
||||
*/
|
||||
function join(...values: any[]): 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.*
|
||||
*/
|
||||
function map(values: any[], mapper: (item: any, index: number, arrayLength: number) => any): 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.*
|
||||
*/
|
||||
function reduce(values: any[], reducer: (total: number, current: any, index: number, arrayLength: number) => any, initialValue?: any): 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.
|
||||
*/
|
||||
function filter(values: any[], filterer: (item: any, index?: number, arrayLength?: number) => any): Promise;
|
||||
}
|
||||
|
||||
declare module 'bluebird' {
|
||||
export = Promise;
|
||||
export = Promise;
|
||||
}
|
||||
|
||||
+3
-3
@@ -8,11 +8,11 @@
|
||||
interface DatepickerOptions {
|
||||
format?: string;
|
||||
weekStart?: number;
|
||||
startDate?: Date;
|
||||
endDate?: Date;
|
||||
startDate?: any;
|
||||
endDate?: any;
|
||||
autoclose?: boolean;
|
||||
startView?: number;
|
||||
todayBtn?: boolean;
|
||||
todayBtn?: any;
|
||||
todayHighlight?: boolean;
|
||||
keyboardNavigation?: boolean;
|
||||
language?: string;
|
||||
|
||||
+2
-1
@@ -14,10 +14,11 @@ interface PaginatorOptions{
|
||||
totalPages?: number;
|
||||
pageUrl?: (type, page, current) => string;
|
||||
shouldShowPage?: boolean;
|
||||
itemText?: (type, page, current) => any;
|
||||
itemTexts?: (type:string, page:number, current:number) => string;
|
||||
tooltipTitles?: (type, page, current) => string;
|
||||
useBootstrapTooltip?: boolean;
|
||||
bootstrapTooltipOptions?: {};
|
||||
bootstrapMajorVersion?: number;
|
||||
onPageClicked?: (event, originalEvent, type, page) => void;
|
||||
onPageChanged?: (event, originalEvent, type, page) => void;
|
||||
}
|
||||
|
||||
Vendored
+1
@@ -502,6 +502,7 @@ declare module breeze {
|
||||
static fromEntityKey(entityKey: EntityKey): EntityQuery;
|
||||
static fromEntityNavigation(entity: Entity, navigationProperty: NavigationProperty): EntityQuery;
|
||||
inlineCount(enabled?: boolean): EntityQuery;
|
||||
noTracking(enabled: boolean): EntityQuery;
|
||||
orderBy(propertyPaths: string): EntityQuery;
|
||||
orderBy(propertyPaths: string[]): EntityQuery;
|
||||
orderByDesc(propertyPaths: string): EntityQuery;
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
/// <reference path="buffer-equal.d.ts" />
|
||||
|
||||
import bufferEqual = require('buffer-equal');
|
||||
|
||||
var bool: boolean;
|
||||
var buf: NodeBuffer;
|
||||
|
||||
bool = bufferEqual(buf, buf);
|
||||
Vendored
+11
@@ -0,0 +1,11 @@
|
||||
// Type definitions for buffer-equal 1.0 0
|
||||
// Project: https://github.com/chaijs/assertion-error
|
||||
// Definitions by: Bart van der Schoor <https://github.com/Bartvds>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
declare module 'buffer-equal' {
|
||||
function bufferEqual(actual:NodeBuffer, expected:NodeBuffer): boolean;
|
||||
export = bufferEqual;
|
||||
}
|
||||
Vendored
+9
-1
@@ -1,6 +1,6 @@
|
||||
// Type definitions for Chrome extension development.
|
||||
// Project: http://developer.chrome.com/extensions/
|
||||
// Definitions by: Matthew Kimber <https://github.com/matthewkimber>
|
||||
// Definitions by: Matthew Kimber <https://github.com/matthewkimber> and otiai10 <https://github.com/otiai10>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
////////////////////
|
||||
@@ -775,6 +775,14 @@ declare module chrome.downloads {
|
||||
export function resume(downloadId: number, callback?: Function): void;
|
||||
export function cancel(downloadId: number, callback?: Function): void;
|
||||
export function download(options: DownloadOptions, callback?: (downloadId: number) => void): void;
|
||||
export function open(downloadId: number): void;
|
||||
export function show(downloadId: number): void;
|
||||
export function showDefaultFolder(): void;
|
||||
export function erase(query: DownloadQuery, callback: (results: DownloadItem[]) => void): void;
|
||||
export function removeFile(downloadId: number, callback: () => void): void;
|
||||
export function acceptDanger(downloadId: number, callback: () => void): void;
|
||||
export function drag(downloadId: number): void;
|
||||
export function setShelfEnabled(enabled: boolean): void;
|
||||
|
||||
var onChanged: DownloadChangedEvent;
|
||||
var onCreated: DownloadCreatedEvent;
|
||||
|
||||
@@ -0,0 +1,254 @@
|
||||
/// <reference path="ckeditor.d.ts" />
|
||||
|
||||
function test_CKEDITOR() {
|
||||
CKEDITOR.basePath = 'test';
|
||||
CKEDITOR.replaceClass = 'rich_editor';
|
||||
CKEDITOR.skinName = 'moono';
|
||||
CKEDITOR.skinName = 'myskin,/customstuff/myskin/';
|
||||
var editor = new CKEDITOR.editor();
|
||||
if (editor.getSelection().getType() == CKEDITOR.SELECTION_ELEMENT)
|
||||
if (editor.getSelection().getType() == CKEDITOR.SELECTION_NONE)
|
||||
if (editor.getSelection().getType() == CKEDITOR.SELECTION_TEXT)
|
||||
alert(CKEDITOR.basePath);
|
||||
if (CKEDITOR.currentInstance)
|
||||
alert(CKEDITOR.currentInstance.name);
|
||||
alert(CKEDITOR.document.getBody().getName());
|
||||
alert(CKEDITOR.instances[0].name);
|
||||
CKEDITOR.loadFullCoreTimeout = 5;
|
||||
alert(CKEDITOR.revision);
|
||||
alert(CKEDITOR.rnd);
|
||||
if (CKEDITOR.status == 'loaded') {
|
||||
CKEDITOR.loadFullCore();
|
||||
}
|
||||
alert(CKEDITOR.timestamp);
|
||||
CKEDITOR.addCss('.cke_editable h1,.cke_editable h2,.cke_editable h3 { border-bottom: 1px dotted red }');
|
||||
CKEDITOR.appendTo('editorSpace');
|
||||
alert(CKEDITOR.getUrl('skins/default/editor.css'));
|
||||
alert(CKEDITOR.getUrl('/skins/default/editor.css'));
|
||||
alert(CKEDITOR.getUrl('http://www.somesite.com/skins/default/editor.css'));
|
||||
CKEDITOR.inline('content');
|
||||
if (CKEDITOR.loadFullCore)
|
||||
CKEDITOR.loadFullCore();
|
||||
CKEDITOR.replace('myfield');
|
||||
var textarea = document.createElement('textarea');
|
||||
CKEDITOR.replace(textarea);
|
||||
CKEDITOR.replaceAll();
|
||||
CKEDITOR.replaceAll('myClassName');
|
||||
CKEDITOR.replaceAll((textarea, config) => false);
|
||||
}
|
||||
|
||||
function test_dom_comment() {
|
||||
var type = CKEDITOR.NODE_COMMENT;
|
||||
var nativeNode = document.createComment('Example');
|
||||
var comment = new CKEDITOR.dom.comment(nativeNode);
|
||||
var comment2 = new CKEDITOR.dom.comment('Example');
|
||||
}
|
||||
|
||||
function test_dom_document() {
|
||||
var document = new CKEDITOR.dom.document(window.document);
|
||||
var type = CKEDITOR.NODE_DOCUMENT;
|
||||
CKEDITOR.document.appendStyleSheet('/mystyles.css');
|
||||
var element = CKEDITOR.document.getBody();
|
||||
alert(element.getName());
|
||||
var element2 = CKEDITOR.document.getById('myElement');
|
||||
alert(element.getId());
|
||||
var element3 = CKEDITOR.document.getHead();
|
||||
alert(element.getName());
|
||||
var selection = CKEDITOR.instances[0].document.getSelection();
|
||||
alert(selection.getType());
|
||||
document.write(
|
||||
'<html>' +
|
||||
'<head><title>Sample Doc</title></head>' +
|
||||
'<body>Document contents created by code</body>' +
|
||||
'</html>'
|
||||
);
|
||||
}
|
||||
|
||||
function test_dom_documentFragment() {
|
||||
var type = CKEDITOR.NODE_DOCUMENT_FRAGMENT;
|
||||
}
|
||||
|
||||
function test_dom_domObject() {
|
||||
var element = new CKEDITOR.dom.element('span');
|
||||
alert(element.$.nodeType);
|
||||
var nativeElement = element.$;
|
||||
var doc = new CKEDITOR.dom.document(document);
|
||||
alert(doc.equals(CKEDITOR.document));
|
||||
alert(doc == CKEDITOR.document);
|
||||
var element2 = new CKEDITOR.dom.element('span');
|
||||
alert(element.getCustomData('hasCustomData'));
|
||||
alert(element.getCustomData('nonExistingKey'));
|
||||
var elementA = new CKEDITOR.dom.element(nativeElement);
|
||||
elementA.getPrivate().value = 1;
|
||||
var elementB = new CKEDITOR.dom.element(nativeElement).getPrivate().value;
|
||||
var element3 = new CKEDITOR.dom.element('span');
|
||||
element.setCustomData('hasCustomData', true);
|
||||
}
|
||||
|
||||
function test_dom_element() {
|
||||
var element = new CKEDITOR.dom.element('span');
|
||||
alert(element.$.nodeType);
|
||||
element.addClass('classA');
|
||||
element.addClass('classB');
|
||||
element.addClass('classA');
|
||||
var p = new CKEDITOR.dom.element('p');
|
||||
var strong = new CKEDITOR.dom.element('strong');
|
||||
p.append(strong);
|
||||
var em = p.append('em');
|
||||
var p = new CKEDITOR.dom.element('p');
|
||||
p.appendText('This is');
|
||||
p.appendText(' some text');
|
||||
element.breakParent(strong);
|
||||
element.data('extra-info', 'test');
|
||||
alert(element.data('extra-info'));
|
||||
element.data('extra-info', false);
|
||||
var element5 = CKEDITOR.document.getById('myTextarea');
|
||||
element.focus();
|
||||
element.focusNext();
|
||||
element.focusPrevious();
|
||||
element.forEach(node=> {
|
||||
console.log(node);
|
||||
});
|
||||
var element2 = CKEDITOR.dom.element.createFromHtml('<input type="text" />');
|
||||
alert(element.getAttribute('type'));
|
||||
alert(element.getComputedStyle('display'));
|
||||
element.appendTo(CKEDITOR.document.getBody());
|
||||
alert(element.getEditor().name);
|
||||
var first = element.getFirst();
|
||||
alert(element.getHtml());
|
||||
alert(element.getId());
|
||||
alert(element.getName());
|
||||
alert('<b>' + element.getNameAtt() + '</b>');
|
||||
alert(element.getOuterHtml());
|
||||
alert(element.getTabIndex());
|
||||
alert(element.getText());
|
||||
alert(element.hasAttributes());
|
||||
alert(element.hasAttributes());
|
||||
element.hide();
|
||||
alert(element.is('span'));
|
||||
alert(element.is('p', 'span'));
|
||||
alert(element.is('p'));
|
||||
alert(element.is('p', 'div'));
|
||||
alert(element.is({ p: 1, span: 1 }));
|
||||
element.removeAttribute('class');
|
||||
element.addClass('classA');
|
||||
element.addClass('classB');
|
||||
element.removeClass('classA');
|
||||
element.removeClass('classB');
|
||||
element.removeStyle('display');
|
||||
element.setAttribute('class', 'myClass');
|
||||
element.setAttribute('title', 'This is an example');
|
||||
element.setAttributes({
|
||||
'class': 'myClass',
|
||||
title: 'This is an example'
|
||||
});
|
||||
p.setHtml('<b>Inner</b> HTML');
|
||||
element.setOpacity(0.75);
|
||||
element.setStyle('background-color', '#ff0000');
|
||||
element.setStyle('margin-top', '10px');
|
||||
element.setStyle('float', 'right');
|
||||
element.setStyles({
|
||||
position: 'absolute',
|
||||
float: 'right'
|
||||
});
|
||||
element.setText('A > B & C < D');
|
||||
element.show();
|
||||
element.unselectable();
|
||||
alert(element.getName());
|
||||
alert(element == CKEDITOR.dom.element.get(element));
|
||||
var htmlElement = document.getElementById('myElement');
|
||||
alert(CKEDITOR.dom.element.get(htmlElement).getName());
|
||||
}
|
||||
|
||||
function test_dom_event() {
|
||||
var event = new CKEDITOR.dom.event(new Event());
|
||||
alert(event.getKey());
|
||||
alert(event.getKeystroke() == 65);
|
||||
alert(event.getKeystroke() == CKEDITOR.CTRL + 65);
|
||||
alert(event.getKeystroke() == CKEDITOR.CTRL + CKEDITOR.SHIFT + 65);
|
||||
var element = new CKEDITOR.dom.element('div');
|
||||
element.on('mousemouse', ev=> {
|
||||
var pageOffset = ev.data.getPageOffset();
|
||||
alert(pageOffset.x);
|
||||
alert(pageOffset.y);
|
||||
});
|
||||
element.on('click', ev=> {
|
||||
var domEvent = ev.data;
|
||||
domEvent.getTarget().addClass('clicked');
|
||||
});
|
||||
element.on('click', ev=> {
|
||||
var domEvent = ev.data;
|
||||
domEvent.preventDefault();
|
||||
});
|
||||
}
|
||||
|
||||
function test_dom_iterator() {
|
||||
var range = new CKEDITOR.dom.range(new CKEDITOR.dom.element('div'));
|
||||
var iterator = range.createIterator();
|
||||
iterator.getNextParagraph();
|
||||
iterator.getNextParagraph();
|
||||
}
|
||||
|
||||
function test_dom_node() {
|
||||
var p = new CKEDITOR.dom.element('p');
|
||||
var strong = new CKEDITOR.dom.element('strong');
|
||||
strong.appendTo(p);
|
||||
var node = new CKEDITOR.dom.node(new Node());
|
||||
node = node.getAscendant('b');
|
||||
node = node.getAscendant('b', true);
|
||||
var element = CKEDITOR.document.getById('example');
|
||||
alert(element.getDocument().equals(CKEDITOR.document));
|
||||
element.getIndex();
|
||||
element.getIndex(true);
|
||||
var last = element.getFirst().getNext();
|
||||
var parent = node.getParent();
|
||||
alert(parent.getName());
|
||||
var parents = node.getParents();
|
||||
var em = new CKEDITOR.dom.element('em');
|
||||
strong.insertAfter(em);
|
||||
strong.insertBefore(em);
|
||||
strong.insertBeforeMe(em);
|
||||
element.isReadOnly();
|
||||
}
|
||||
|
||||
function test_dom_nodeList() {
|
||||
var nodeList = CKEDITOR.document.getBody().getChildren();
|
||||
alert(nodeList.count());
|
||||
}
|
||||
|
||||
function test_dom_range() {
|
||||
var editor = new CKEDITOR.editor();
|
||||
var range = new CKEDITOR.dom.range(editor.document);
|
||||
range.selectNodeContents(editor.document.getBody());
|
||||
range.deleteContents();
|
||||
range.selectNodeContents(editor.document.getBody());
|
||||
alert(range.collapsed);
|
||||
range.collapse();
|
||||
alert(range.collapsed);
|
||||
range.selectNodeContents(range.document.getBody());
|
||||
range.selectNodeContents(editor.document.getBody());
|
||||
alert(range.endContainer.getName());
|
||||
range.selectNodeContents(editor.document.getBody());
|
||||
alert(range.endOffset);
|
||||
range.selectNodeContents(editor.document.getBody());
|
||||
alert(range.startContainer.getName());
|
||||
range.selectNodeContents(editor.document.getBody());
|
||||
alert(range.startOffset);
|
||||
}
|
||||
|
||||
function test_dom_text() {
|
||||
var nativeNode = document.createTextNode('Example');
|
||||
var text = new CKEDITOR.dom.text(nativeNode);
|
||||
var text2 = new CKEDITOR.dom.text('Example');
|
||||
}
|
||||
|
||||
function test_dom_window() {
|
||||
var document = new CKEDITOR.dom.window(window);
|
||||
var win = new CKEDITOR.dom.window(window);
|
||||
var pos = win.getScrollPosition();
|
||||
alert(pos.x);
|
||||
alert(pos.y);
|
||||
var size = win.getViewPaneSize();
|
||||
alert(size.width);
|
||||
alert(size.height);
|
||||
}
|
||||
Vendored
+954
@@ -0,0 +1,954 @@
|
||||
// Type definitions for CKEditor
|
||||
// Project: http://ckeditor.com/
|
||||
// Definitions by: Ondrej Sevcik <https://github.com/ondrejsevcik/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
// WORK-IN-PROGRESS: Any contribution support welcomed.
|
||||
// See https://github.com/borisyankov/DefinitelyTyped/issues/1827 for more informations.
|
||||
declare module CKEDITOR {
|
||||
|
||||
// Config options
|
||||
var disableAutoInline: boolean;
|
||||
var replaceClass: string;
|
||||
var skinName: string;
|
||||
|
||||
// Properties
|
||||
var ALT: number;
|
||||
var CTRL: number;
|
||||
var DIALOG_RESIZE_BOTH: number;
|
||||
var DIALOG_RESIZE_HEIGHT: number;
|
||||
var DIALOG_RESIZE_NONE: number;
|
||||
var DIALOG_RESIZE_WIDTH: number;
|
||||
var ELEMENT_MODE_APPENDTO: number;
|
||||
var ELEMENT_MODE_INLINE: number;
|
||||
var ELEMENT_MODE_NONE: number;
|
||||
var ELEMENT_MODE_REPLACE: number;
|
||||
var END: number;
|
||||
var ENTER_BR: number;
|
||||
var ENTER_P: number;
|
||||
var EVENT_PHASE_AT_TARGET: number;
|
||||
var EVENT_PHASE_BUBBLING: number;
|
||||
var EVENT_PHASE_CAPTURING: number;
|
||||
var LINEUTILS_AFTER: number;
|
||||
var LINEUTILS_BEFORE: number;
|
||||
var LINEUTIS_INSIDE: number;
|
||||
var NODE_COMMENT: number;
|
||||
var NODE_DOCUMENT: number;
|
||||
var NODE_DOCUMENT_FRAGMENT: number;
|
||||
var NODE_ELEMENT: number;
|
||||
var NODE_TEXT: number;
|
||||
var SELECTION_ELEMENT: number;
|
||||
var SELECTION_NONE: number;
|
||||
var SELECTION_TEXT: number;
|
||||
var SHIFT: number;
|
||||
var SHRINK_ELEMENT: number;
|
||||
var SHRINK_TEXT: number;
|
||||
var START: number;
|
||||
var TRISTATE_DISABLED: number;
|
||||
var TRISTATE_OFF: number;
|
||||
var TRISTATE_ON: number;
|
||||
var UI_BUTTON: string;
|
||||
var UI_MENUBUTTON: string;
|
||||
var UI_PANEL: string;
|
||||
var UI_PANELBUTTON: string;
|
||||
var UI_RICHCOMBO: string;
|
||||
var UI_SEPARATOR: string;
|
||||
var basePath: string;
|
||||
var currentInstance: editor;
|
||||
var document: dom.document;
|
||||
var instances: editor[];
|
||||
var loadFullCoreTimeout: number;
|
||||
var revision: string;
|
||||
var rnd: number;
|
||||
var status: string;
|
||||
var timestamp: string;
|
||||
var version: string;
|
||||
|
||||
|
||||
// Methods
|
||||
function add(editor: editor): void;
|
||||
function addCss(css: string): void;
|
||||
function addTemplate(name: string, source: string): template;
|
||||
function appendTo(element: string, config?: config, data?: string): editor;
|
||||
function appendTo(element: HTMLTextAreaElement, config?: config, data?: string): editor;
|
||||
function domReady(): void;
|
||||
function editorConfig(config: config): void;
|
||||
function getCss(): string;
|
||||
function getTemplate(name: string): template;
|
||||
function getUrl(resource: string): string;
|
||||
function inline(element: string, instanceConfig?: config): editor;
|
||||
function inline(element: HTMLTextAreaElement, instanceConfig?: config): editor;
|
||||
function inlineAll(): void;
|
||||
function loadFullCore(): void;
|
||||
function replace(element: string, config?: config): editor;
|
||||
function replace(element: HTMLTextAreaElement, config?: config): editor;
|
||||
function replaceAll(className?: string): void;
|
||||
function replaceAll(assertionFunction: (textarea: HTMLTextAreaElement, config: config) => boolean): void;
|
||||
|
||||
|
||||
module dom {
|
||||
|
||||
class comment {
|
||||
|
||||
// Properties
|
||||
type: number;
|
||||
|
||||
// Methods
|
||||
constructor(comment: string, ownerDocument?: document);
|
||||
constructor(comment: Object, ownerDocument?: document);
|
||||
getOuterHtml(): string;
|
||||
|
||||
}
|
||||
|
||||
|
||||
class document extends domObject {
|
||||
|
||||
// Properties
|
||||
type: number;
|
||||
|
||||
// Methods
|
||||
constructor(domDocument: Object);
|
||||
appendStyleSheet(cssFileUrl: string): void;
|
||||
appendStyleText(cssStyleText: string): Object;
|
||||
createElement(name: string, attribsAndStyles?: { attributes: Object; styles: Object; }): element;
|
||||
createText(text: string): element;
|
||||
find(selector: string): nodeList;
|
||||
findOne(selector: string): element;
|
||||
focus(): void;
|
||||
getActive(): element;
|
||||
getBody(): element;
|
||||
getByAddress(address: any[], normalized?: boolean): node;
|
||||
getById(elementId: string): element;
|
||||
getDocumentElement(): element;
|
||||
getElementsByTag(tagName: string): nodeList;
|
||||
getHead(): element;
|
||||
getSelection(): selection;
|
||||
getWindow(): window;
|
||||
write(html: string): void;
|
||||
|
||||
}
|
||||
|
||||
|
||||
class documentFragment {
|
||||
|
||||
// Properties
|
||||
type: number;
|
||||
|
||||
// Methods
|
||||
constructor(nodeOrDoc: Object);
|
||||
insertAfterNode(node: node): void;
|
||||
|
||||
}
|
||||
|
||||
|
||||
class domObject extends event {
|
||||
|
||||
// Properties
|
||||
$: HTMLElement;
|
||||
|
||||
// Methods
|
||||
constructor(nativeDomObject: Object);
|
||||
clearCustomData(): void;
|
||||
equals(object: any): boolean;
|
||||
getCustomData(key: string): any;
|
||||
getPrivate(): any;
|
||||
getUniqueId(): number;
|
||||
removeAllListeners(): void;
|
||||
removeCustomData(key: string): Object;
|
||||
setCustomData(key: string, value: Object): domObject;
|
||||
|
||||
}
|
||||
|
||||
|
||||
class element extends node {
|
||||
|
||||
// Properties
|
||||
type: number;
|
||||
|
||||
// Methods
|
||||
constructor(element: string, ownerDocument?: document);
|
||||
constructor(element: HTMLElement, ownerDocument?: document);
|
||||
addClass(className: string): void;
|
||||
append(node: node, toStart?: boolean): node;
|
||||
append(node: string, toStart?: boolean): node;
|
||||
appendBogus(force: boolean): void;
|
||||
appendHtml(html: string): void;
|
||||
appendText(text: string): node;
|
||||
breakParent(parent: element): void;
|
||||
contains(node: node): boolean;
|
||||
copyAttributes(dest: element, skipAttributes: Object): void;
|
||||
data(name: string): string;
|
||||
data(name: string, value: string): void;
|
||||
data(name: string, value: boolean): void;
|
||||
disableContextMenu(): void;
|
||||
find(selector: string): nodeList;
|
||||
findOne(selector: string): element;
|
||||
focus(defer?: boolean): void;
|
||||
focusNext(ignoreChildren?: boolean, indexToUse?: number): void;
|
||||
focusPrevious(ignoreChildren?: boolean, indexToUse?: number): void;
|
||||
forEach(callback: (node: node) => void, type?: number, skipRoot?: boolean): void;
|
||||
getAttribute(name: string): string;
|
||||
getBogus(): Object;
|
||||
getChild(indices: number): node;
|
||||
getChild(indices: number[]): node;
|
||||
getChildCount(): number;
|
||||
getChildren(): nodeList;
|
||||
getClientRect(): any;
|
||||
getComputedStyle(propertyName: string): string;
|
||||
getDirection(useComputed: boolean): string;
|
||||
getDocumentPosition(refDocument: document): position;
|
||||
getDtd(): any;
|
||||
getEditor(): editor;
|
||||
getElementsByTag(tagName: string): nodeList;
|
||||
getFirst(evaluator?: Function): node;
|
||||
getFrameDocument(): document;
|
||||
getHtml(): string;
|
||||
getId(): string;
|
||||
getLast(evaluator?: Function): node;
|
||||
getName(): string;
|
||||
getNameAtt(): string;
|
||||
getOuterHtml(): string;
|
||||
getPositionedAncestor(): element;
|
||||
getSize(type: string, isBorderBox: boolean): void;
|
||||
getStyle(name: string): string;
|
||||
getTabIndex(): number;
|
||||
getText(): string;
|
||||
getValue(): string;
|
||||
getWindow(): window;
|
||||
hasAttributes(): boolean;
|
||||
hasAttribute(name: string): boolean;
|
||||
hasClass(className: string): boolean;
|
||||
hide(): void;
|
||||
is(...name: string[]): boolean;
|
||||
is(name: any): boolean;
|
||||
isBlockBoundary(customNodeNames: Object): boolean;
|
||||
isEditable(textCursor?: boolean): boolean;
|
||||
isEmptyInlineRemoveable(): boolean;
|
||||
isIdentical(otherElement: element): boolean;
|
||||
isVisible(): boolean;
|
||||
mergeSiblings(inlineOnly?: boolean): void;
|
||||
moveChildren(target: element, toStart?: boolean): void;
|
||||
removeAttribute(name: string): void;
|
||||
removeAttributes(attributes?: string[]): void;
|
||||
removeClass(className: string): void;
|
||||
removeStyle(name: string): void;
|
||||
renameNode(newTag: string): void;
|
||||
scrollIntoParent(parent: element, alignToTop: boolean, hscroll: boolean): void;
|
||||
scrollIntoParent(parent: window, alignToTop: boolean, hscroll: boolean): void;
|
||||
scrollIntoView(alignToTop?: boolean): void;
|
||||
setAttribute(name: string, value: string): element;
|
||||
setAttributes(attributesPairs: Object): element;
|
||||
setHtml(html: string): string;
|
||||
setOpacity(opacity: number): void;
|
||||
setSize(type: string, size: number, isBorderBox: boolean): void;
|
||||
setState(state: number, base?: Object, useAria?: Object): void;
|
||||
setStyle(name: string, value: string): element;
|
||||
setStyles(stylesPair: Object): element;
|
||||
setText(text: string): string;
|
||||
setValue(value: string): element;
|
||||
show(): void;
|
||||
unselectable(): void;
|
||||
|
||||
//static method
|
||||
static clearAllMarkers(database: Object): Object;
|
||||
static clearMarkers(database: Object, element: Object, removeFromDatabase: Object): void;
|
||||
static createFromHtml(html: string): element;
|
||||
static get(element: string): element;
|
||||
static get(element: any): element;
|
||||
static setMarker(database: Object, element: Object, name: Object, value: Object): domObject;
|
||||
|
||||
}
|
||||
|
||||
|
||||
class elementPath {
|
||||
constructor(startNode: element, root: element);
|
||||
block: element;
|
||||
blockLimit: element;
|
||||
root: element;
|
||||
elements: element[];
|
||||
compare(otherPath: elementPath): boolean;
|
||||
contains(query: string, excludeRoot: boolean, fromTop: boolean): element;
|
||||
contains(query: string[], excludeRoot: boolean, fromTop: boolean): element;
|
||||
contains(query: (element: element) => boolean, excludeRoot: boolean, fromTop: boolean): element;
|
||||
contains(query: Object, excludeRoot: boolean, fromTop: boolean): element;
|
||||
contains(query: element, excludeRoot: boolean, fromTop: boolean): element;
|
||||
isContextFor(tag: string): boolean;
|
||||
direction(): string;
|
||||
}
|
||||
|
||||
|
||||
class range {
|
||||
constructor(root: element);
|
||||
constructor(root: document);
|
||||
startContainer: any;
|
||||
startOffset: number;
|
||||
endContainer: any;
|
||||
endOffset: number;
|
||||
collapsed: boolean;
|
||||
isDocRoot: boolean;
|
||||
document: document;
|
||||
root: element;
|
||||
clone(): range;
|
||||
collapse(toStart?: boolean): Boolean;
|
||||
cloneContents(): documentFragment;
|
||||
deleteContents(mergeThen?: boolean): void;
|
||||
extractContents(mergeThen?: boolean): documentFragment;
|
||||
createBookmark(serializable: boolean): Object;
|
||||
createBookmark2(normalized: boolean): Object;
|
||||
createIterator(): iterator;
|
||||
moveToBookmark(bookmark: Object): void;
|
||||
getBoundaryNodes(): { startNode: node; endNode: node; };
|
||||
getCommonAncestor(includeSelf: boolean, ignoreTextNode: boolean): element;
|
||||
optimize(): void;
|
||||
optimizeBookmark(): void;
|
||||
trim(ignoreStart?: boolean, ignoreEnd?: boolean): void;
|
||||
enlarge(unit: number, excludeBrs?: boolean): void;
|
||||
shrink(mode: number, selectContents: boolean): void;
|
||||
insertNode(node: node): void;
|
||||
moveToPosition(node: node, position: Object): void;
|
||||
moveToRange(range: range): void;
|
||||
selectNodeContents(node: node): void;
|
||||
setStart(startNode: node, startOffset: number): void;
|
||||
setEnd(endNode: node, endOffset: number): void;
|
||||
setStartAfter(node: node): void;
|
||||
setStartBefore(node: node): void;
|
||||
setStartAt(node: node, position: number): void;
|
||||
setEndAt(node: node, position: number): void;
|
||||
fixBlock(isStart: boolean, blockTag: Object): Object;
|
||||
splitBlock(blockTag: Object): Object;
|
||||
splitElement(toSplit: element): element;
|
||||
removeEmptyBlocksAtEnd(atEnd: boolean): void;
|
||||
startPath(): elementPath;
|
||||
endPath(): elementPath;
|
||||
checkBoundaryOfElement(element: element, checkType: number): boolean;
|
||||
checkStartOfBlock(): boolean;
|
||||
checkEndOfBlock(): boolean;
|
||||
getPreviousNode(evaluator: Function, guard: Function, boundary: element): element;
|
||||
getNextNode(evaluator: Function, guard: Function, boundary: element): element;
|
||||
checkReadOnly(): boolean;
|
||||
moveToElementEditablePosition(element: element, isMoveToEnd: boolean): boolean;
|
||||
movetoClosestEditablePosition(element: element, isMoveToEnd: boolean): boolean;
|
||||
moveToElementEditStart(target: Object): boolean;
|
||||
moveToElementEditEnd(target: Object): boolean;
|
||||
getEnclosedNode(): node;
|
||||
getTouchedStartNode(): node;
|
||||
getTouchedEndNode(): node;
|
||||
getNextEditableNode(): Object;
|
||||
getPreviousEditableNode(): Object;
|
||||
scrollIntoView(): void;
|
||||
}
|
||||
|
||||
|
||||
interface rangeListIterator {
|
||||
|
||||
}
|
||||
|
||||
class selection {
|
||||
document: document;
|
||||
isFake: boolean;
|
||||
isLocked: boolean;
|
||||
rev: number;
|
||||
root: element;
|
||||
constructor(target: document);
|
||||
constructor(target: element);
|
||||
constructor(target: selection);
|
||||
createBookmarks(serializable: Object): any[];
|
||||
createBookmarks2(normalized?: Object): any[];
|
||||
fake(element: element): void;
|
||||
getCommonAncestor(): element;
|
||||
getNative(): Object;
|
||||
getRanges(onlyEditables?: boolean): any[];
|
||||
getSelectedElement(): element;
|
||||
getSelectedText(): string;
|
||||
getStartElement(): element;
|
||||
getType(): number;
|
||||
isHidden(): boolean;
|
||||
lock(): void;
|
||||
removeAllRanges(): void;
|
||||
reset(): void;
|
||||
scrollIntoView(): void;
|
||||
selectBookmarks(bookmarks: any[]): selection;
|
||||
selectElement(element: element): void;
|
||||
selectRanges(ranges: any[]): void;
|
||||
unlock(restore: Object): void;
|
||||
}
|
||||
|
||||
|
||||
class rangeList {
|
||||
constructor(ranges: range[]);
|
||||
constructor(range: range);
|
||||
createIterator(): rangeListIterator;
|
||||
createBokmark(serializable: boolean): Object[];
|
||||
createBookmark2(normalized: boolean): Object[];
|
||||
moveToBookmark(bookmarks: Object[]): void;
|
||||
}
|
||||
|
||||
|
||||
class iterator {
|
||||
constructor(range: range);
|
||||
getNextParagraph(blockTag?: string): element;
|
||||
activeFilter: filter;
|
||||
enforceRealBlocks: Boolean;
|
||||
enlargeBr: Boolean;
|
||||
filter: filter;
|
||||
}
|
||||
|
||||
|
||||
class node extends domObject {
|
||||
constructor(domNode: Node);
|
||||
appendTo(element: element): element;
|
||||
clone(includeChildren: boolean, cloneId: boolean): node;
|
||||
hasPrevious(): boolean;
|
||||
hasNext(): boolean;
|
||||
insertAfter(node: node): node;
|
||||
insertBefore(node: node): node;
|
||||
insertBeforeMe(node: node): node;
|
||||
getAddress(normalized: boolean): Object[];
|
||||
getDocument(): document;
|
||||
getIndex(normalized?: boolean): number;
|
||||
getNextSourceNode(startFromSibling: Object, nodeType: Object, guard: Object): void;
|
||||
getPreviousSourceNode(startFromSibling: Object, nodeType: Object, guard: Object): void;
|
||||
getPrevious(evaluator?: Function): node;
|
||||
getNext(evaluator?: Function): node;
|
||||
getParent(allowFragmentParent?: boolean): element;
|
||||
getParents(closerFirst?: boolean): node[];
|
||||
getCommonAncestor(node: Object): void;
|
||||
getPosition(otherNode: Object): void;
|
||||
getAscendant(reference: string, includeSelf?: boolean): node;
|
||||
hasAscendant(name: Object, includeSelf: any): boolean;
|
||||
move(preserveChildren?: boolean): node;
|
||||
replace(nodeToReplace: node): void;
|
||||
trim(): void;
|
||||
ltrim(): void;
|
||||
rtrim(): void;
|
||||
isReadOnly(): boolean;
|
||||
}
|
||||
|
||||
|
||||
class nodeList {
|
||||
constructor(nativeList: Object);
|
||||
count(): number;
|
||||
getItem(index: number): node;
|
||||
}
|
||||
|
||||
|
||||
class event {
|
||||
constructor(domEvent: Event);
|
||||
getKey(): number;
|
||||
getKeystroke(): number;
|
||||
preventDefault(stopPropagation: boolean): void;
|
||||
stopPropagation(): void;
|
||||
getTarget(): node;
|
||||
getPhase(): number;
|
||||
getPhaseOffset(): position;
|
||||
on(eventName: string, listenerFunction: (eventInfo: eventInfo) => void, scopeObj?: Object, listenerData?: Object, priority?: number): Object;
|
||||
}
|
||||
|
||||
|
||||
interface position {
|
||||
x: number;
|
||||
y: number;
|
||||
}
|
||||
|
||||
|
||||
interface widthAndHeight {
|
||||
width: number;
|
||||
height: number;
|
||||
}
|
||||
|
||||
|
||||
class text extends node {
|
||||
constructor(text: Text, ownerDocument?: document);
|
||||
constructor(text: string, ownerDocument?: document);
|
||||
type: number;
|
||||
getLength(): number;
|
||||
getText(): string;
|
||||
setText(text: string): void;
|
||||
split(offset: number): text;
|
||||
substring(indexA: number, indexB: number): void;
|
||||
}
|
||||
|
||||
|
||||
class window extends domObject {
|
||||
constructor(domWindow: Object);
|
||||
focus(): void;
|
||||
getViewPaneSize(): widthAndHeight;
|
||||
getScrollPosition(): position;
|
||||
getFrame(): element;
|
||||
}
|
||||
|
||||
|
||||
class walker {
|
||||
constructor(range: range);
|
||||
end(): void;
|
||||
next(): node;
|
||||
previous(): node;
|
||||
checkForward(): boolean;
|
||||
checkBackward(): boolean;
|
||||
lastForward(): node;
|
||||
lastBackward(): node;
|
||||
reset(): void;
|
||||
//static methods till the end
|
||||
blockBoundary(customNodeNames: Object): Function;
|
||||
listItemBoundary(): Function;
|
||||
bookmark(contentOnly?: boolean, isReject?: boolean): Function;
|
||||
whitespaces(isReject?: boolean): Function;
|
||||
invisible(isReject?: boolean): Function;
|
||||
nodeType(type: number, isReject?: boolean): Function;
|
||||
bogus(isReject?: boolean): Function;
|
||||
temp(isReject?: boolean): Function;
|
||||
ignored(isReject?: boolean): Function;
|
||||
editable(isReject?: boolean): Function;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
module ajax {
|
||||
|
||||
// Methods
|
||||
function load(url: string, callback?: Function): string;
|
||||
function loadXml(url: string, callback?: Function): xml;
|
||||
|
||||
}
|
||||
|
||||
|
||||
interface xml {
|
||||
|
||||
}
|
||||
|
||||
|
||||
class command extends event {
|
||||
|
||||
// Properties
|
||||
contextSensitive: boolean;
|
||||
editorFocus: boolean;
|
||||
modes: any;
|
||||
previousState: number;
|
||||
state: number;
|
||||
uiItems: any[];
|
||||
|
||||
// Methods
|
||||
constructor(editor: editor, commandDefinition: commandDefinition);
|
||||
checkAllowed(noCache: boolean): boolean;
|
||||
disable(): void;
|
||||
enable(): void;
|
||||
exec(data?: Object): boolean;
|
||||
refresh(editor: editor, path: dom.elementPath): void;
|
||||
setState(newState: number): boolean;
|
||||
toggleState(): void;
|
||||
|
||||
}
|
||||
|
||||
|
||||
interface focusManager {
|
||||
|
||||
}
|
||||
|
||||
interface keystrokeHandler {
|
||||
|
||||
}
|
||||
|
||||
|
||||
interface config {
|
||||
startupMode: string;
|
||||
removeButtons: string;
|
||||
toolbar?: any;
|
||||
}
|
||||
|
||||
|
||||
interface feature {
|
||||
|
||||
}
|
||||
|
||||
|
||||
interface style {
|
||||
|
||||
}
|
||||
|
||||
|
||||
interface editable {
|
||||
|
||||
}
|
||||
|
||||
|
||||
class menu {
|
||||
constructor();
|
||||
add(item: any): void;
|
||||
addListener(listenerFn: (startElement: dom.element, selection: dom.selection, path: dom.elementPath) => any): void;
|
||||
hide(returnFocus?: boolean): void;
|
||||
removeAll(): void;
|
||||
show(offsetParent: dom.element, corner?: number, offsetX?: number, offsetY?: number): void;
|
||||
}
|
||||
|
||||
|
||||
module plugins {
|
||||
|
||||
class contextMenu extends menu {
|
||||
constructor(editor: editor);
|
||||
addTarget(element: dom.element, nativeContextMenuOnCtrl?: boolean): void;
|
||||
open(offsetParent: dom.element, corner?: number, offsetX?: number, offsetY?: number): void;
|
||||
}
|
||||
|
||||
|
||||
module link {
|
||||
var emptyAnchorFix: boolean;
|
||||
var fakeAnchor: boolean;
|
||||
var synAnchorSelector: boolean;
|
||||
function getEditorAnchors(editor: editor): dom.element[];
|
||||
function getSelectedLink(editor: editor): dom.elementPath;
|
||||
function tryRestoreFakeAnchor(editor: editor, element: dom.element): dom.element;
|
||||
}
|
||||
|
||||
|
||||
module widget {
|
||||
class repository {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
class editor extends event {
|
||||
activeEnterMode: number;
|
||||
activeFilter: filter;
|
||||
activeShiftEnterMode: number;
|
||||
blockless: boolean;
|
||||
config: config;
|
||||
container: dom.element;
|
||||
contextMenu: plugins.contextMenu;
|
||||
dataProcessor: dataProcessor;
|
||||
document: dom.document;
|
||||
element: dom.element;
|
||||
elementMode: number;
|
||||
enterMode: number;
|
||||
filter: filter;
|
||||
focusManager: focusManager;
|
||||
id: string;
|
||||
keystrokeHandler: keystrokeHandler;
|
||||
lang: any;
|
||||
langCode: string;
|
||||
mode: string;
|
||||
name: string;
|
||||
plugins: Object;
|
||||
readOnly: boolean;
|
||||
shiftEnterMode: number;
|
||||
status: string;
|
||||
tabIndex: number;
|
||||
templates: Object;
|
||||
title: any;
|
||||
toolbar: Object;
|
||||
ui: ui;
|
||||
widgets: plugins.widget.repository;
|
||||
window: dom.window;
|
||||
constructor(instanceConfig?: Object, element?: dom.element, mode?: number);
|
||||
addCommand(commandName: string, commandDefinition: commandDefinition): void;
|
||||
addFeature(feature: feature): boolean;
|
||||
addMenuGroup(name: string, order?: number): void;
|
||||
addMenuItem(name: string, definition?: any): void;
|
||||
addMenuItems(definitions: any[]): void;
|
||||
addMode(mode: string, exec: () => void): void;
|
||||
addRemoveFormatFilter(func: Function): void;
|
||||
applyStyle(style: style): void;
|
||||
attachStyleStateChange(style: style, callback: Function): void;
|
||||
checkDirty(): boolean;
|
||||
createFakeElement(realElement: Object, className: Object, realElementType: Object, isResizable: Object): void;
|
||||
createFakeParserElement(realElement: Object, className: Object, realElementType: Object, isResizable: Object): void;
|
||||
createRange(): dom.range;
|
||||
destroy(noUpdate?: boolean): void;
|
||||
editable(elementOrEditable: dom.element): void;
|
||||
editable(elementOrEditable: editable): void;
|
||||
elementPath(startNode?: dom.node): dom.elementPath;
|
||||
execCommand(commandName: string, data?: Object): boolean;
|
||||
focus(): void;
|
||||
forceNextSelectionCheck(): void;
|
||||
getClipboardData(options: Object, callback: Function): void;
|
||||
getColorFromDialog(callback: Function, scope?: Object): void;
|
||||
getCommand(commandName: string): command;
|
||||
getData(noEvents: Object): string;
|
||||
getMenuItem(name: string): Object;
|
||||
getResizable(forContents: boolean): dom.element;
|
||||
getSelection(forceRealSelection?: boolean): dom.selection;
|
||||
getSnapshot(): string;
|
||||
getStylesSet(callback: Function): void;
|
||||
getUiColor(): string;
|
||||
insertElement(element: dom.element): void;
|
||||
insertHtml(html: string, mode?: string): void;
|
||||
insertText(text: string): void;
|
||||
loadSnapshot(snapshot: Object): void;
|
||||
lockSelection(sel?: dom.selection): boolean;
|
||||
openDialog(dialogName: string, callback: Function): dialog;
|
||||
popup(url: string, width?: number, height?: number, options?: string): void;
|
||||
popup(url: string, width?: string, height?: number, options?: string): void;
|
||||
popup(url: string, width?: number, height?: string, options?: string): void;
|
||||
popup(url: string, width?: string, height?: string, options?: string): void;
|
||||
removeMenuItem(name: string): void;
|
||||
removeStyle(style: style): void;
|
||||
resetDirty(): void;
|
||||
resetUndo(): void;
|
||||
resize(width: number, height: number, isContentHeight?: boolean, resizeInner?: boolean): void;
|
||||
resize(width: string, height: number, isContentHeight?: boolean, resizeInner?: boolean): void;
|
||||
resize(width: number, height: string, isContentHeight?: boolean, resizeInner?: boolean): void;
|
||||
resize(width: string, height: string, isContentHeight?: boolean, resizeInner?: boolean): void;
|
||||
restoreRealElement(fakeElement: Object): dom.element;
|
||||
selectionChange(checkNow?: boolean): void;
|
||||
setActiveEnterMode(enterMode: number, shiftEnterMode: number): void;
|
||||
setActiveFilter(filter: filter): void;
|
||||
setData(data: string, callback: Function, internal: boolean): void;
|
||||
setKeystroke(keystroke: number, behavior?: string): void;
|
||||
setKeystroke(keystroke: any[], behavior?: string): void;
|
||||
setKeystroke(keystroke: number, behavior?: boolean): void;
|
||||
setKeystroke(keystroke: any[], behavior?: boolean): void;
|
||||
setMode(newMode: string, callback: Function): void;
|
||||
setReadOnly(isReadOnly?: boolean): void;
|
||||
setUiColor(color: string): void;
|
||||
unlockSelection(restore?: boolean): void;
|
||||
updateElement(): void;
|
||||
}
|
||||
|
||||
|
||||
interface eventInfo {
|
||||
data: any;
|
||||
editor: editor;
|
||||
listenerData: any;
|
||||
name: string;
|
||||
sender: any;
|
||||
cancel(): void;
|
||||
removeListener(): void;
|
||||
stop(): void;
|
||||
}
|
||||
|
||||
|
||||
class filter {
|
||||
|
||||
}
|
||||
|
||||
|
||||
interface template {
|
||||
|
||||
}
|
||||
|
||||
|
||||
interface dataProcessor {
|
||||
toDataFormat(html: string, fixForBody: string): void;
|
||||
toHtml(data: string, fixForBody?: string): void;
|
||||
}
|
||||
|
||||
|
||||
class event {
|
||||
constructor();
|
||||
useCapture: boolean;
|
||||
capture(): void;
|
||||
define(name: string, meta: Object): void;
|
||||
fire(eventName: string, data?: Object, editor?: editor): any;
|
||||
fireOnce(eventName: string, data?: Object, editor?: editor): any;
|
||||
hasListeners(eventName: string): boolean;
|
||||
on(eventName: string, listenerFunction: (eventInfo: eventInfo) => void, scopeObj?: Object, listenerData?: Object, priority?: number): void;
|
||||
once(eventName: string, listenerFunction: (eventInfo: eventInfo) => void, scopeObj?: Object, listenerData?: Object, priority?: number): void;
|
||||
removeAllListeners(): void;
|
||||
removeListener(eventName: string, listenerFunction: (eventInfo: eventInfo) => void): void;
|
||||
static implementOn(targetObject: Object): void;
|
||||
}
|
||||
|
||||
|
||||
interface commandDefinition {
|
||||
async?: boolean;
|
||||
canUndo?: boolean;
|
||||
context?: boolean;
|
||||
contextSensitive?: boolean;
|
||||
editorFocus?: boolean;
|
||||
modes?: Object;
|
||||
startDisabled?: boolean;
|
||||
exec(editor: editor, data?: Object): boolean;
|
||||
refresh? (editor: editor, path: dom.elementPath): void;
|
||||
}
|
||||
|
||||
|
||||
class dtd {
|
||||
|
||||
}
|
||||
|
||||
|
||||
class ui extends event {
|
||||
constructor(editor: editor);
|
||||
add(name: string, type: Object, definition: Object): void;
|
||||
addButton(name: string, definition: dialog.definition.button): void;
|
||||
addHandler(type: Object, handler: Object): void;
|
||||
}
|
||||
|
||||
|
||||
module dialog {
|
||||
|
||||
module definition {
|
||||
|
||||
interface button extends uiElement {
|
||||
disabled?: boolean;
|
||||
label?: string;
|
||||
}
|
||||
|
||||
|
||||
interface uiElement {
|
||||
align?: string;
|
||||
className?: string;
|
||||
commit?: Function;
|
||||
id?: string;
|
||||
onHide?: Function;
|
||||
onLoad?: Function;
|
||||
requiredcontent?: any;
|
||||
setup?: Function;
|
||||
style?: string;
|
||||
title?: string;
|
||||
type?: string;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
module htmlParser {
|
||||
|
||||
class basicWriter {
|
||||
constructor();
|
||||
openTag(tagName: string, attributes: Object): void;
|
||||
openTagClose(tagName: string, isSelfClose: boolean): void;
|
||||
attribute(attName: string, attValue: string): void;
|
||||
closeTag(tagName: string): void;
|
||||
text(text: string): void;
|
||||
comment(comment: string): void;
|
||||
write(data: string): void;
|
||||
reset(): void;
|
||||
getHtml(reset: boolean): string;
|
||||
}
|
||||
|
||||
|
||||
class node {
|
||||
constructor();
|
||||
remove(preserveChildren?: boolean): node;
|
||||
replaceWith(node: node): void;
|
||||
insertAfter(node: node): void;
|
||||
insertBefore(node: node): void;
|
||||
getAscendant(condition: string): element;
|
||||
getAscendant(condition: Object): element;
|
||||
getAscendant(condition: Function): element;
|
||||
wrapWith(wrapper: element): element;
|
||||
getIndex(): number;
|
||||
}
|
||||
|
||||
|
||||
class filter {
|
||||
constructor(rules?: filterRulesDefinition);
|
||||
id: number;
|
||||
elementNameRules: filterRulesGroup;
|
||||
attributeNameRules: filterRulesGroup;
|
||||
elementsRules: Object;
|
||||
attributesRules: Object;
|
||||
textRules: filterRulesGroup;
|
||||
commentRules: filterRulesGroup;
|
||||
rootRules: filterRulesGroup;
|
||||
addRules(rules: filterRulesDefinition, options?: number): void;
|
||||
addRules(rules: filterRulesDefinition, options?: { priority?: number; applyToAll?: boolean; }): void;
|
||||
applyTo(node: node): void;
|
||||
}
|
||||
|
||||
|
||||
interface filterRulesDefinition {
|
||||
|
||||
}
|
||||
|
||||
|
||||
class filterRulesGroup {
|
||||
rules: Object[];
|
||||
add(rule: Function, priority: number, options: Object): void;
|
||||
add(rule: Object[], priority: number, options: Object): void;
|
||||
addMany(rules: Object[], priority: number, options: Object): void;
|
||||
findIndex(priority: number): number;
|
||||
exec(currentValue: Object): Object;
|
||||
execOnName(currentName: string): string;
|
||||
}
|
||||
|
||||
|
||||
class cdata extends node {
|
||||
constructor(value: string);
|
||||
type: number;
|
||||
writeHtml(writer: basicWriter): void;
|
||||
}
|
||||
|
||||
|
||||
class comment extends node {
|
||||
constructor(value: string);
|
||||
type: number;
|
||||
filter(filter: filter): boolean;
|
||||
writeHtml(writer: basicWriter, filter: filter): void;
|
||||
}
|
||||
|
||||
|
||||
class element extends node {
|
||||
constructor(name: string, attributes: Object);
|
||||
name: string;
|
||||
attributes: Object;
|
||||
children: Object[];
|
||||
type: number;
|
||||
add(node: node): number;
|
||||
clone(): element;
|
||||
filter(filter: filter): boolean;
|
||||
filterChildren(filter: filter): void;
|
||||
writeHtml(writer: basicWriter, filter: filter): void;
|
||||
writeChildrenHtml(writer: basicWriter, filter: filter): void;
|
||||
replaceWithChildren(): void;
|
||||
forEach(callback: (node: node, type?: number) => boolean): void;
|
||||
getFirst(condition: string): node;
|
||||
getFirst(condition: Object): node;
|
||||
getFirst(condition: Function): node;
|
||||
getHtml(): string;
|
||||
setHtml(html: string): void;
|
||||
getOuterHtml(): string;
|
||||
split(index: number): element;
|
||||
removeClass(className: string): void;
|
||||
hasClass(className: string): boolean;
|
||||
}
|
||||
|
||||
|
||||
class fragment {
|
||||
constructor();
|
||||
children: Object[];
|
||||
parent: Object;
|
||||
type: number;
|
||||
fromHtml(fragmentHtml: string, parent?: element, fixingBlock?: string): void;
|
||||
fromHtml(fragmentHtml: string, parent?: string, fixingBlock?: string): void;
|
||||
fromHtml(fragmentHtml: string, parent?: element, fixingBlock?: boolean): void;
|
||||
fromHtml(fragmentHtml: string, parent?: string, fixingBlock?: boolean): void;
|
||||
add(node: node, index?: number): void;
|
||||
filter(filter: filter): void;
|
||||
filterChildren(filter: filter, filterRoot?: boolean): void;
|
||||
writeHtml(writer: basicWriter, filter?: filter): void;
|
||||
writeChildrenHtml(writer: basicWriter, filter?: filter, filterRoot?: boolean): void;
|
||||
forEach(callback: (node: node, type?: number) => boolean, type?: number, skipRoot?: boolean): void;
|
||||
}
|
||||
|
||||
|
||||
class cssStyle {
|
||||
constructor(element: element);
|
||||
constructor(styleText: string);
|
||||
populate(obj: element): void;
|
||||
populate(obj: dom.element): void;
|
||||
populate(obj: Object): void;
|
||||
}
|
||||
|
||||
|
||||
class text extends node {
|
||||
constructor(value: string);
|
||||
type: number;
|
||||
filter(filter: filter): boolean;
|
||||
writeHtml(writer: basicWriter, filter?: filter): void;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
interface dialog {
|
||||
addFocusable(element: CKEDITOR.dom.element, index: number): void;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
/// <reference path="configstore.d.ts" />
|
||||
|
||||
import cs = require('configstore');
|
||||
|
||||
var value: any;
|
||||
var key: string;
|
||||
var num: number;
|
||||
var bool: any;
|
||||
var object:Object;
|
||||
|
||||
cs.set(key, value);
|
||||
value = cs.get(key);
|
||||
cs.del(key);
|
||||
|
||||
object = cs.all;
|
||||
cs.all = object;
|
||||
num = cs.size;
|
||||
key = cs.path;
|
||||
Vendored
+38
@@ -0,0 +1,38 @@
|
||||
// Type definitions for configstore 0.3.0
|
||||
// Project: https://github.com/yeoman/configstore
|
||||
// Definitions by: Bart van der Schoor <https://github.com/Bartvds>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module 'configstore' {
|
||||
/*
|
||||
Set an item
|
||||
*/
|
||||
export function set(key: string, val: any): void;
|
||||
|
||||
/*
|
||||
Get an item
|
||||
*/
|
||||
export function get(key: string): any;
|
||||
|
||||
/*
|
||||
Delete an item
|
||||
*/
|
||||
export function del(key: string): void;
|
||||
|
||||
/*
|
||||
Get all items as an object or replace the current config with an object:
|
||||
|
||||
conf.all = {
|
||||
hello: 'world'
|
||||
};
|
||||
*/
|
||||
export var all: Object;
|
||||
/*
|
||||
Get the item count
|
||||
*/
|
||||
export var size: number;
|
||||
/*
|
||||
Get the path to the config file. Can be used to show the user where the config file is located or even better open it for them.
|
||||
*/
|
||||
export var path: string;
|
||||
}
|
||||
+121
-2
@@ -1160,7 +1160,7 @@ function azimuthalEquidistant() {
|
||||
}
|
||||
|
||||
//Example from http://bl.ocks.org/mbostock/4060366
|
||||
function voroniTesselation() {
|
||||
function voronoiTesselation() {
|
||||
var width = 960,
|
||||
height = 500;
|
||||
|
||||
@@ -1168,6 +1168,9 @@ function voroniTesselation() {
|
||||
return [Math.random() * width, Math.random() * height];
|
||||
} );
|
||||
|
||||
var voronoi = d3.geom.voronoi()
|
||||
.clipExtent([[0, 0], [width, height]]);
|
||||
|
||||
var svg = d3.select("body").append("svg")
|
||||
.attr("width", width)
|
||||
.attr("height", height)
|
||||
@@ -1185,13 +1188,129 @@ function voroniTesselation() {
|
||||
redraw();
|
||||
|
||||
function redraw() {
|
||||
path = path.data(d3.geom.voronoi(vertices).map(function (d) { return "M" + d.join("L") + "Z"; } ), String);
|
||||
path = path.data(voronoi(vertices).map(function (d) { return "M" + d.join("L") + "Z"; } ), String);
|
||||
path.exit().remove();
|
||||
path.enter().append("path").attr("class", function (d, i) { return "q" + (i % 9) + "-9"; } ).attr("d", String);
|
||||
path.order();
|
||||
}
|
||||
}
|
||||
|
||||
// Example from https://gist.github.com/christophermanning/1734663
|
||||
function forceDirectedVoronoi() {
|
||||
var w = window.innerWidth > 960 ? 960 : (window.innerWidth || 960),
|
||||
h = window.innerHeight > 500 ? 500 : (window.innerHeight || 500),
|
||||
radius = 5.25,
|
||||
links = [],
|
||||
simulate = true,
|
||||
zoomToAdd = true,
|
||||
color = d3.scale.quantize().domain([10000, 7250]).range(["#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"])
|
||||
|
||||
var numVertices = (w*h) / 3000;
|
||||
var vertices = d3.range(numVertices).map(function(i) {
|
||||
var angle = radius * (i+10);
|
||||
return <D3.Layout.GraphNode>{x: angle*Math.cos(angle)+(w/2), y: angle*Math.sin(angle)+(h/2)};
|
||||
});
|
||||
var d3_geom_voronoi = d3.geom.voronoi<D3.Layout.GraphNode>()
|
||||
.x(function(d) { return d.x; })
|
||||
.y(function(d) { return d.y; })
|
||||
var prevEventScale = 1;
|
||||
var zoom = d3.behavior.zoom().on("zoom", function(d,i) {
|
||||
if (zoomToAdd){
|
||||
if (d3.event.scale > prevEventScale) {
|
||||
var angle = radius * vertices.length;
|
||||
vertices.push(<D3.Layout.GraphNode>{x: angle*Math.cos(angle)+(w/2), y: angle*Math.sin(angle)+(h/2)})
|
||||
} else if (vertices.length > 2 && d3.event.scale != prevEventScale) {
|
||||
vertices.pop();
|
||||
}
|
||||
force.nodes(vertices).start()
|
||||
} else {
|
||||
if (d3.event.scale > prevEventScale) {
|
||||
radius+= .01
|
||||
} else {
|
||||
radius -= .01
|
||||
}
|
||||
vertices.forEach(function(d, i) {
|
||||
var angle = radius * (i+10);
|
||||
vertices[i] = <D3.Layout.GraphNode>{x: angle*Math.cos(angle)+(w/2), y: angle*Math.sin(angle)+(h/2)};
|
||||
});
|
||||
force.nodes(vertices).start()
|
||||
}
|
||||
prevEventScale = d3.event.scale;
|
||||
});
|
||||
|
||||
d3.select(window)
|
||||
.on("keydown", function() {
|
||||
// shift
|
||||
if(d3.event.keyCode == 16) {
|
||||
zoomToAdd = false
|
||||
}
|
||||
|
||||
// s
|
||||
if(d3.event.keyCode == 83) {
|
||||
simulate = !simulate
|
||||
if(simulate) {
|
||||
force.start()
|
||||
} else {
|
||||
force.stop()
|
||||
}
|
||||
}
|
||||
})
|
||||
.on("keyup", function() {
|
||||
zoomToAdd = true
|
||||
})
|
||||
|
||||
var svg = d3.select("#chart")
|
||||
.append("svg")
|
||||
.attr("width", w)
|
||||
.attr("height", h)
|
||||
.call(zoom)
|
||||
|
||||
var force = d3.layout.force()
|
||||
.charge(-300)
|
||||
.size([w, h])
|
||||
.on("tick", update);
|
||||
|
||||
force.nodes(vertices).start();
|
||||
|
||||
var circle = <D3.UpdateSelection>svg.selectAll("circle");
|
||||
var path = <D3.UpdateSelection>svg.selectAll("path");
|
||||
var link = <D3.UpdateSelection>svg.selectAll("line");
|
||||
|
||||
function update() {
|
||||
path = path.data(d3_geom_voronoi(vertices));
|
||||
path.enter().append("path")
|
||||
// drag node by dragging cell
|
||||
.call(d3.behavior.drag()
|
||||
.on("drag", function(d, i) {
|
||||
vertices[i] = <D3.Layout.GraphNode>{x: vertices[i].x + d3.event.dx, y: vertices[i].y + d3.event.dy}
|
||||
})
|
||||
)
|
||||
.style("fill", function(d, i) { return color(0) })
|
||||
path.attr("d", function(d) { return "M" + d.join("L") + "Z"; })
|
||||
.transition().duration(150).style("fill", function(d, i) { return color(d3.geom.polygon(d).area()) })
|
||||
path.exit().remove();
|
||||
|
||||
circle = circle.data(vertices)
|
||||
circle.enter().append("circle")
|
||||
.attr("r", 0)
|
||||
.transition().duration(1000).attr("r", 5);
|
||||
circle.attr("cx", function(d) { return d.x; })
|
||||
.attr("cy", function(d) { return d.y; });
|
||||
circle.exit().transition().attr("r", 0).remove();
|
||||
|
||||
link = link.data(d3_geom_voronoi.links(vertices))
|
||||
link.enter().append("line")
|
||||
link.attr("x1", function(d) { return d.source.x; })
|
||||
.attr("y1", function(d) { return d.source.y; })
|
||||
.attr("x2", function(d) { return d.target.x; })
|
||||
.attr("y2", function(d) { return d.target.y; })
|
||||
|
||||
link.exit().remove()
|
||||
|
||||
if(!simulate) force.stop()
|
||||
}
|
||||
}
|
||||
|
||||
//Example from http://bl.ocks.org/mbostock/4341156
|
||||
function delaunayTesselation() {
|
||||
var width = 960,
|
||||
|
||||
Vendored
+175
-61
@@ -528,7 +528,7 @@ declare module D3 {
|
||||
/**
|
||||
* gets the touch positions relative to a specified container.
|
||||
*/
|
||||
touches(container: any): Array<number>;
|
||||
touches(container: any): Array<Array<number>>;
|
||||
|
||||
/**
|
||||
* If the specified value is a function, returns the specified value.
|
||||
@@ -812,6 +812,8 @@ declare module D3 {
|
||||
select: (selector: string) => Selection;
|
||||
empty: () => boolean;
|
||||
node: () => Element;
|
||||
call: (callback: (selection: EnterSelection) => void) => EnterSelection;
|
||||
size: () => number;
|
||||
}
|
||||
|
||||
export interface UpdateSelection extends Selection {
|
||||
@@ -1029,7 +1031,7 @@ declare module D3 {
|
||||
ceil: (date: Date) => Date;
|
||||
range: Range;
|
||||
offset: (date: Date, step: number) => Date;
|
||||
utc: Interval;
|
||||
utc?: Interval;
|
||||
}
|
||||
|
||||
export interface TimeFormat {
|
||||
@@ -1064,7 +1066,7 @@ declare module D3 {
|
||||
histogram(): HistogramLayout;
|
||||
pack(): PackLayout;
|
||||
partition(): PartitionLayout;
|
||||
treeMap(): TreeMapLayout;
|
||||
treemap(): TreeMapLayout;
|
||||
}
|
||||
|
||||
export interface StackLayout {
|
||||
@@ -1148,17 +1150,17 @@ declare module D3 {
|
||||
};
|
||||
startAngle: {
|
||||
(): number;
|
||||
(angle: number): D3.Svg.Arc;
|
||||
(angle: () => number): D3.Svg.Arc;
|
||||
(angle: (d : any) => number): D3.Svg.Arc;
|
||||
(angle: (d : any, i: number) => number): D3.Svg.Arc;
|
||||
(angle: number): PieLayout;
|
||||
(angle: () => number): PieLayout;
|
||||
(angle: (d : any) => number): PieLayout;
|
||||
(angle: (d : any, i: number) => number): PieLayout;
|
||||
};
|
||||
endAngle: {
|
||||
(): number;
|
||||
(angle: number): D3.Svg.Arc;
|
||||
(angle: () => number): D3.Svg.Arc;
|
||||
(angle: (d : any) => number): D3.Svg.Arc;
|
||||
(angle: (d : any, i: number) => number): D3.Svg.Arc;
|
||||
(angle: number): PieLayout;
|
||||
(angle: () => number): PieLayout;
|
||||
(angle: (d : any) => number): PieLayout
|
||||
(angle: (d : any, i: number) => number): PieLayout;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1264,7 +1266,7 @@ declare module D3 {
|
||||
}
|
||||
|
||||
export interface BundleLayout{
|
||||
(links: Array<GraphLink>): Array<GraphNode>;
|
||||
(links: Array<GraphLink>): Array<Array<GraphNode>>;
|
||||
}
|
||||
|
||||
export interface ChordLayout {
|
||||
@@ -1277,15 +1279,15 @@ declare module D3 {
|
||||
(padding: number): ChordLayout;
|
||||
}
|
||||
sortGroups: {
|
||||
(): Array<number>;
|
||||
(): (a: number, b: number) => number;
|
||||
(comparator: (a: number, b: number) => number): ChordLayout;
|
||||
}
|
||||
sortSubgroups: {
|
||||
(): Array<number>;
|
||||
(): (a: number, b: number) => number;
|
||||
(comparator: (a: number, b: number) => number): ChordLayout;
|
||||
}
|
||||
sortChords: {
|
||||
(): Array<GraphLink>;
|
||||
(): (a: number, b: number) => number;
|
||||
(comparator: (a: number, b: number) => number): ChordLayout;
|
||||
}
|
||||
chords(): Array<GraphLink>;
|
||||
@@ -2478,7 +2480,7 @@ declare module D3 {
|
||||
(values: any[]): Scale;
|
||||
(): any[];
|
||||
};
|
||||
invertExtent(y: any): any[];
|
||||
invertExtent?(y: any): any[];
|
||||
copy(): Scale;
|
||||
}
|
||||
|
||||
@@ -2577,13 +2579,31 @@ declare module D3 {
|
||||
(value: number): number;
|
||||
}
|
||||
|
||||
export interface IdentityScale extends QuantitiveScale {
|
||||
export interface IdentityScale extends Scale {
|
||||
/**
|
||||
* Get the range value corresponding to a given domain value.
|
||||
*
|
||||
* @param value Domain Value
|
||||
*/
|
||||
(value: number): number;
|
||||
/**
|
||||
* Get the domain value corresponding to a given range value.
|
||||
*
|
||||
* @param value Range Value
|
||||
*/
|
||||
invert(value: number): number;
|
||||
/**
|
||||
* get representative values from the input domain.
|
||||
*
|
||||
* @param count Aproximate representative values to return.
|
||||
*/
|
||||
ticks(count: number): any[];
|
||||
/**
|
||||
* get a formatter for displaying tick values
|
||||
*
|
||||
* @param count Aproximate representative values to return
|
||||
*/
|
||||
tickFormat(count: number): (n: number) => string;
|
||||
}
|
||||
|
||||
export interface SqrtScale extends QuantitiveScale {
|
||||
@@ -2908,11 +2928,11 @@ declare module D3 {
|
||||
/**
|
||||
* create a standard projection from a raw projection.
|
||||
*/
|
||||
projection(raw: (lambda: any, phi: any) => any): Projection;
|
||||
projection(raw: RawProjection): Projection;
|
||||
/**
|
||||
* create a standard projection from a mutable raw projection.
|
||||
*/
|
||||
projectionMutator(rawFactory: (lambda: number, phi: number) => Array<number>): Projection;
|
||||
projectionMutator(rawFactory: RawProjection): ProjectionMutator;
|
||||
/**
|
||||
* the Albers equal-area conic projection.
|
||||
*/
|
||||
@@ -2926,82 +2946,82 @@ declare module D3 {
|
||||
*/
|
||||
azimuthalEqualArea: {
|
||||
(): Projection;
|
||||
raw(): Projection;
|
||||
raw: RawProjection;
|
||||
}
|
||||
/**
|
||||
* the azimuthal equidistant projection.
|
||||
*/
|
||||
azimuthalEquidistant: {
|
||||
(): Projection;
|
||||
raw(): Projection;
|
||||
raw: RawProjection;
|
||||
}
|
||||
/**
|
||||
* the conic conformal projection.
|
||||
*/
|
||||
conicConformal: {
|
||||
(): Projection;
|
||||
raw(): Projection;
|
||||
raw(phi1:number, phi2:number): RawProjection;
|
||||
}
|
||||
/**
|
||||
* the conic equidistant projection.
|
||||
*/
|
||||
conicEquidistant: {
|
||||
(): Projection;
|
||||
raw(): Projection;
|
||||
raw(phi1:number, phi2:number): RawProjection;
|
||||
}
|
||||
/**
|
||||
* the conic equal-area (a.k.a. Albers) projection.
|
||||
*/
|
||||
conicEqualArea: {
|
||||
(): Projection;
|
||||
raw(): Projection;
|
||||
raw(phi1:number, phi2:number): RawProjection;
|
||||
}
|
||||
/**
|
||||
* the equirectangular (plate carreé) projection.
|
||||
*/
|
||||
equirectangular: {
|
||||
(): Projection;
|
||||
raw(): Projection;
|
||||
raw: RawProjection;
|
||||
}
|
||||
/**
|
||||
* the gnomonic projection.
|
||||
*/
|
||||
gnomonic: {
|
||||
(): Projection;
|
||||
raw(): Projection;
|
||||
raw: RawProjection;
|
||||
}
|
||||
/**
|
||||
* the spherical Mercator projection.
|
||||
*/
|
||||
mercator: {
|
||||
(): Projection;
|
||||
raw(): Projection;
|
||||
raw: RawProjection;
|
||||
}
|
||||
/**
|
||||
* the azimuthal orthographic projection.
|
||||
*/
|
||||
othographic: {
|
||||
orthographic: {
|
||||
(): Projection;
|
||||
raw(): Projection;
|
||||
raw: RawProjection;
|
||||
}
|
||||
/**
|
||||
* the azimuthal stereographic projection.
|
||||
*/
|
||||
stereographic: {
|
||||
(): Projection;
|
||||
raw(): Projection;
|
||||
raw: RawProjection;
|
||||
}
|
||||
/**
|
||||
* the transverse Mercator projection.
|
||||
*/
|
||||
transverseMercator: {
|
||||
(): Projection;
|
||||
raw(): Projection;
|
||||
raw: RawProjection;
|
||||
}
|
||||
/**
|
||||
* convert a GeoJSON object to a geometry stream.
|
||||
*/
|
||||
stream(object: GeoJSON, listener: any): Stream;
|
||||
stream(object: GeoJSON, listener: Stream): void;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@@ -3009,7 +3029,7 @@ declare module D3 {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
greatArc: GreatArc;
|
||||
greatArc(): GreatArc;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@@ -3105,7 +3125,7 @@ declare module D3 {
|
||||
|
||||
export interface Graticule{
|
||||
(): GeoJSON;
|
||||
lines(): GeoJSON;
|
||||
lines(): Array<GeoJSON>;
|
||||
outline(): GeoJSON;
|
||||
extent: {
|
||||
(): Array<Array<number>>;
|
||||
@@ -3159,9 +3179,14 @@ declare module D3 {
|
||||
type: string;
|
||||
}
|
||||
|
||||
export interface RawProjection {
|
||||
(lambda: number, phi: number): Array<number>;
|
||||
invert?(x: number, y: number): Array<number>;
|
||||
}
|
||||
|
||||
export interface Projection {
|
||||
(coordinates: Array<number>): Array<number>;
|
||||
invert(point: Array<number>): Array<number>;
|
||||
invert?(point: Array<number>): Array<number>;
|
||||
rotate: {
|
||||
(): Array<number>;
|
||||
(rotation: Array<number>): Projection;
|
||||
@@ -3170,6 +3195,10 @@ declare module D3 {
|
||||
(): Array<number>;
|
||||
(location: Array<number>): Projection;
|
||||
};
|
||||
parallels: {
|
||||
(): Array<number>;
|
||||
(location: Array<number>): Projection;
|
||||
};
|
||||
translate: {
|
||||
(): Array<number>;
|
||||
(point: Array<number>): Projection;
|
||||
@@ -3190,7 +3219,7 @@ declare module D3 {
|
||||
(): number;
|
||||
(precision: number): Projection;
|
||||
};
|
||||
stream(listener?: any): Stream;
|
||||
stream(listener?: Stream): Stream;
|
||||
}
|
||||
|
||||
export interface Stream {
|
||||
@@ -3206,15 +3235,20 @@ declare module D3 {
|
||||
(location: Array<number>): Rotation;
|
||||
invert(location: Array<number>): Rotation;
|
||||
}
|
||||
|
||||
export interface ProjectionMutator {
|
||||
(lambda: number, phi: number): Projection;
|
||||
}
|
||||
}
|
||||
|
||||
// Geometry
|
||||
export module Geom {
|
||||
export interface Geom {
|
||||
voronoi<T>(): Voronoi<T>;
|
||||
/**
|
||||
* compute the Voronoi diagram for the specified points.
|
||||
*/
|
||||
voronoi: Voronoi
|
||||
voronoi(vertices: Array<Vertice>): Array<Polygon>;
|
||||
/**
|
||||
* compute the Delaunay triangulation for the specified points.
|
||||
*/
|
||||
@@ -3222,15 +3256,25 @@ declare module D3 {
|
||||
/**
|
||||
* constructs a quadtree for an array of points.
|
||||
*/
|
||||
quadtree: Quadtree;
|
||||
quadtree(): QuadtreeFactory;
|
||||
/**
|
||||
* constructs a polygon
|
||||
* Constructs a new quadtree for the specified array of points.
|
||||
*/
|
||||
polygon: Polygon;
|
||||
quadtree(points: Array<Point>, x1: number, y1: number, x2: number, y2: number): Quadtree;
|
||||
/**
|
||||
* Constructs a new quadtree for the specified array of points.
|
||||
*/
|
||||
quadtree(points: Array<Point>, width: number, height: number): Quadtree;
|
||||
/**
|
||||
* Returns the input array of vertices with additional methods attached
|
||||
*/
|
||||
polygon(vertices:Array<Vertice>): Polygon;
|
||||
/**
|
||||
* creates a new hull layout with the default settings.
|
||||
*/
|
||||
hull: Hull;
|
||||
hull(): Hull;
|
||||
|
||||
hull(vertices:Array<Vertice>): Array<Vertice>;
|
||||
}
|
||||
|
||||
export interface Vertice extends Array<number> {
|
||||
@@ -3241,10 +3285,6 @@ declare module D3 {
|
||||
}
|
||||
|
||||
export interface Polygon extends Array<Vertice> {
|
||||
/**
|
||||
* Returns the input array of vertices with additional methods attached
|
||||
*/
|
||||
(vertices: Array<Vertice>): Polygon;
|
||||
/**
|
||||
* Returns the signed area of this polygon
|
||||
*/
|
||||
@@ -3259,7 +3299,7 @@ declare module D3 {
|
||||
clip(subject: Polygon): Polygon;
|
||||
}
|
||||
|
||||
export interface Quadtree {
|
||||
export interface QuadtreeFactory {
|
||||
/**
|
||||
* Constructs a new quadtree for the specified array of points.
|
||||
*/
|
||||
@@ -3272,22 +3312,29 @@ declare module D3 {
|
||||
* Constructs a new quadtree for the specified array of points.
|
||||
*/
|
||||
(points: Array<Point>, width: number, height: number): Quadtree;
|
||||
/**
|
||||
* Adds a new point to the quadtree.
|
||||
*/
|
||||
add(point: Point): Quadtree;
|
||||
visit(callback: any): Quadtree;
|
||||
|
||||
x: {
|
||||
(): (d: any) => any;
|
||||
(accesor: (d: any) => any): Quadtree;
|
||||
(accesor: (d: any) => any): QuadtreeFactory;
|
||||
|
||||
}
|
||||
y: {
|
||||
(): (d: any) => any;
|
||||
(accesor: (d: any) => any): Quadtree;
|
||||
(accesor: (d: any) => any): QuadtreeFactory;
|
||||
|
||||
}
|
||||
size(size: Array<number>): Quadtree;
|
||||
size(): Array<number>;
|
||||
size(size: Array<number>): QuadtreeFactory;
|
||||
extent(): Array<Array<number>>;
|
||||
extent(points: Array<Array<number>>): QuadtreeFactory;
|
||||
}
|
||||
|
||||
export interface Quadtree {
|
||||
/**
|
||||
* Adds a new point to the quadtree.
|
||||
*/
|
||||
add(point: Point): void;
|
||||
visit(callback: any): void;
|
||||
}
|
||||
|
||||
export interface Point {
|
||||
@@ -3295,20 +3342,87 @@ declare module D3 {
|
||||
y: number;
|
||||
}
|
||||
|
||||
export interface Voronoi {
|
||||
(vertices?: Array<Vertice>): Array<Polygon>;
|
||||
export interface Voronoi<T> {
|
||||
/**
|
||||
* Compute the Voronoi diagram for the specified data.
|
||||
*/
|
||||
(data: Array<T>): Array<Polygon>;
|
||||
/**
|
||||
* Compute the graph links for the Voronoi diagram for the specified data.
|
||||
*/
|
||||
links(data: Array<T>): Array<Layout.GraphLink>;
|
||||
/**
|
||||
* Compute the triangles for the Voronoi diagram for the specified data.
|
||||
*/
|
||||
triangles(data: Array<T>): Array<Array<number>>;
|
||||
x: {
|
||||
(): (d: any) => any;
|
||||
(accesor: (d: any) => any): any;
|
||||
/**
|
||||
* Get the x-coordinate accessor.
|
||||
*/
|
||||
(): (data: T, index ?: number) => number;
|
||||
|
||||
/**
|
||||
* Set the x-coordinate accessor.
|
||||
*
|
||||
* @param accessor The new accessor function
|
||||
*/
|
||||
(accessor: (data: T, index: number) => number): Voronoi<T>;
|
||||
|
||||
/**
|
||||
* Set the x-coordinate to a constant.
|
||||
*
|
||||
* @param constant The new constant value.
|
||||
*/
|
||||
(constant: number): Voronoi<T>;
|
||||
}
|
||||
y: {
|
||||
(): (d: any) => any;
|
||||
(accesor: (d: any) => any): any;
|
||||
/**
|
||||
* Get the y-coordinate accessor.
|
||||
*/
|
||||
(): (data: T, index ?: number) => number;
|
||||
|
||||
/**
|
||||
* Set the y-coordinate accessor.
|
||||
*
|
||||
* @param accessor The new accessor function
|
||||
*/
|
||||
(accessor: (data: T, index: number) => number): Voronoi<T>;
|
||||
|
||||
/**
|
||||
* Set the y-coordinate to a constant.
|
||||
*
|
||||
* @param constant The new constant value.
|
||||
*/
|
||||
(constant: number): Voronoi<T>;
|
||||
}
|
||||
clipExtent: {
|
||||
/**
|
||||
* Get the clip extent.
|
||||
*/
|
||||
(): Array<Array<number>>;
|
||||
/**
|
||||
* Set the clip extent.
|
||||
*
|
||||
* @param extent The new clip extent.
|
||||
*/
|
||||
(extent: Array<Array<number>>): Voronoi<T>;
|
||||
}
|
||||
size: {
|
||||
/**
|
||||
* Get the size.
|
||||
*/
|
||||
(): Array<number>;
|
||||
/**
|
||||
* Set the size, equivalent to a clip extent starting from (0,0).
|
||||
*
|
||||
* @param size The new size.
|
||||
*/
|
||||
(size: Array<number>): Voronoi<T>;
|
||||
}
|
||||
}
|
||||
|
||||
export interface Hull {
|
||||
(vertices: Array<Vertice>): Hull;
|
||||
(vertices: Array<Vertice>): Array<Vertice>;
|
||||
x: {
|
||||
(): (d: any) => any;
|
||||
(accesor: (d: any) => any): any;
|
||||
|
||||
Vendored
+3
-3
@@ -10,7 +10,7 @@ declare module D3 {
|
||||
|
||||
interface SuperformulaType
|
||||
{
|
||||
(any): any;//hans
|
||||
(any: any): any;//hans
|
||||
m: number;
|
||||
n1: number;
|
||||
n2: number;
|
||||
@@ -22,7 +22,7 @@ declare module D3 {
|
||||
interface Superformula
|
||||
{
|
||||
(): any;
|
||||
type(any): any;
|
||||
type(any: any): any;
|
||||
param(name: string, value: number): Superformula;
|
||||
size(x: number): Superformula;
|
||||
segments(x: number): Superformula;
|
||||
@@ -35,4 +35,4 @@ declare module D3 {
|
||||
superformulaPath: SuperformulaPath;
|
||||
superformulaTypes: SuperformulaType[];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,242 @@
|
||||
///<reference path="../d3/d3.d.ts" />
|
||||
///<reference path="../crossfilter/crossfilter.d.ts" />
|
||||
///<reference path="dc.d.ts" />
|
||||
|
||||
interface IYelpData {
|
||||
city: string;
|
||||
review_count: number;
|
||||
name: string;
|
||||
neighborhoods: string[];
|
||||
type: string;
|
||||
business_id: string;
|
||||
full_address: string;
|
||||
state: string;
|
||||
longitude: number;
|
||||
stars: number;
|
||||
latitude: number;
|
||||
open: boolean;
|
||||
categories: string[]
|
||||
}
|
||||
|
||||
interface IYelpDataExtended {
|
||||
count: number;
|
||||
review_sum: number;
|
||||
star_sum: number;
|
||||
review_avg: number;
|
||||
star_avg: number;
|
||||
}
|
||||
|
||||
|
||||
/********************************************************
|
||||
* *
|
||||
* dj.js example using Yelp Kaggle Test Dataset *
|
||||
* Eamonn O'Loughlin 9th May 2013 *
|
||||
* *
|
||||
********************************************************/
|
||||
|
||||
/********************************************************
|
||||
* *
|
||||
* Step0: Load data from json file *
|
||||
* *
|
||||
********************************************************/
|
||||
d3.json("data/yelp_test_set_business.json", function (yelp_data:IYelpData[]) {
|
||||
|
||||
/********************************************************
|
||||
* *
|
||||
* Step1: Create the dc.js chart objects & ling to div *
|
||||
* *
|
||||
********************************************************/
|
||||
var bubbleChart = dc.bubbleChart("#dc-bubble-graph");
|
||||
var pieChart = dc.pieChart("#dc-pie-graph");
|
||||
var volumeChart = dc.barChart("#dc-volume-chart");
|
||||
var lineChart = dc.lineChart("#dc-line-chart");
|
||||
var dataTable = dc.dataTable("#dc-table-graph");
|
||||
var rowChart = dc.rowChart("#dc-row-graph");
|
||||
|
||||
/********************************************************
|
||||
* *
|
||||
* Step2: Run data through crossfilter *
|
||||
* *
|
||||
********************************************************/
|
||||
var ndx = crossfilter(yelp_data);
|
||||
|
||||
/********************************************************
|
||||
* *
|
||||
* Step3: Create Dimension that we'll need *
|
||||
* *
|
||||
********************************************************/
|
||||
|
||||
// for volumechart
|
||||
var cityDimension = ndx.dimension(function (d) { return d.city; });
|
||||
var cityGroup = cityDimension.group();
|
||||
var cityDimensionGroup = cityDimension.group().reduce(
|
||||
//add
|
||||
function(p: IYelpDataExtended,v:IYelpData){
|
||||
++p.count;
|
||||
p.review_sum += v.review_count;
|
||||
p.star_sum += v.stars;
|
||||
p.review_avg = p.review_sum / p.count;
|
||||
p.star_avg = p.star_sum / p.count;
|
||||
return p;
|
||||
},
|
||||
//remove
|
||||
function(p: IYelpDataExtended,v:IYelpData){
|
||||
--p.count;
|
||||
p.review_sum -= v.review_count;
|
||||
p.star_sum -= v.stars;
|
||||
p.review_avg = p.review_sum / p.count;
|
||||
p.star_avg = p.star_sum / p.count;
|
||||
return p;
|
||||
},
|
||||
//init
|
||||
function(){
|
||||
return {count:0, review_sum: 0, star_sum: 0, review_avg: 0, star_avg: 0};
|
||||
}
|
||||
);
|
||||
|
||||
// for pieChart
|
||||
var startValue = ndx.dimension(function (d) {
|
||||
return d.stars*1.0;
|
||||
});
|
||||
var startValueGroup = startValue.group();
|
||||
|
||||
// For datatable
|
||||
var businessDimension = ndx.dimension(function (d) { return d.business_id; });
|
||||
/********************************************************
|
||||
* *
|
||||
* Step4: Create the Visualisations *
|
||||
* *
|
||||
********************************************************/
|
||||
|
||||
bubbleChart.width(650)
|
||||
.height(300)
|
||||
.dimension(cityDimension)
|
||||
.group(cityDimensionGroup)
|
||||
.transitionDuration(1500)
|
||||
.colors(["#a60000","#ff0000", "#ff4040","#ff7373","#67e667","#39e639","#00cc00"])
|
||||
.colorDomain([-12000, 12000])
|
||||
|
||||
.x(d3.scale.linear().domain([0, 5.5]))
|
||||
.y(d3.scale.linear().domain([0, 5.5]))
|
||||
.r(d3.scale.linear().domain([0, 2500]))
|
||||
.keyAccessor(function (p) {
|
||||
return p.value.star_avg;
|
||||
})
|
||||
.valueAccessor(function (p) {
|
||||
return p.value.review_avg;
|
||||
})
|
||||
.radiusValueAccessor(function (p) {
|
||||
return p.value.count;
|
||||
})
|
||||
.transitionDuration(1500)
|
||||
.elasticY(true)
|
||||
.yAxisPadding(1)
|
||||
.xAxisPadding(1)
|
||||
.label(function (p) {
|
||||
return p.key;
|
||||
})
|
||||
.renderLabel(true)
|
||||
.renderlet(function (chart) {
|
||||
rowChart.filter(chart.filter());
|
||||
})
|
||||
.on("postRedraw", function (chart) {
|
||||
dc.events.trigger(function () {
|
||||
rowChart.filter(chart.filter());
|
||||
});
|
||||
});
|
||||
;
|
||||
|
||||
|
||||
pieChart.width(200)
|
||||
.height(200)
|
||||
.transitionDuration(1500)
|
||||
.dimension(startValue)
|
||||
.group(startValueGroup)
|
||||
.radius(90)
|
||||
.minAngleForLabel(0)
|
||||
.label(function(d) { return d.data.key; })
|
||||
.on("filtered", function (chart) {
|
||||
dc.events.trigger(function () {
|
||||
if(chart.filter()) {
|
||||
console.log(chart.filter());
|
||||
volumeChart.filter([chart.filter()-.25,chart.filter()-(-0.25)]);
|
||||
}
|
||||
else volumeChart.filterAll();
|
||||
});
|
||||
});
|
||||
|
||||
volumeChart.width(230)
|
||||
.height(200)
|
||||
.dimension(startValue)
|
||||
.group(startValueGroup)
|
||||
.transitionDuration(1500)
|
||||
.centerBar(true)
|
||||
.gap(17)
|
||||
.x(d3.scale.linear().domain([0.5, 5.5]))
|
||||
.elasticY(true)
|
||||
.on("filtered", function (chart) {
|
||||
dc.events.trigger(function () {
|
||||
if(chart.filter()) {
|
||||
console.log(chart.filter());
|
||||
lineChart.filter(chart.filter());
|
||||
}
|
||||
else
|
||||
{lineChart.filterAll()}
|
||||
});
|
||||
})
|
||||
.xAxis().tickFormat(function(v) {return v;});
|
||||
|
||||
console.log(startValueGroup.top(1)[0].value);
|
||||
|
||||
lineChart.width(230)
|
||||
.height(200)
|
||||
.dimension(startValue)
|
||||
.group(startValueGroup)
|
||||
.x(d3.scale.linear().domain([0.5, 5.5]))
|
||||
.valueAccessor(function(d) {
|
||||
return d.value;
|
||||
})
|
||||
.renderHorizontalGridLines(true)
|
||||
.elasticY(true)
|
||||
.xAxis().tickFormat(function(v) {return v;}); ;
|
||||
|
||||
rowChart.width(340)
|
||||
.height(850)
|
||||
.dimension(cityDimension)
|
||||
.group(cityGroup)
|
||||
.renderLabel(true)
|
||||
.colors(["#a60000","#ff0000", "#ff4040","#ff7373","#67e667","#39e639","#00cc00"])
|
||||
.colorDomain([0, 0])
|
||||
.renderlet(function (chart) {
|
||||
bubbleChart.filter(chart.filter());
|
||||
})
|
||||
.on("filtered", function (chart) {
|
||||
dc.events.trigger(function () {
|
||||
bubbleChart.filter(chart.filter());
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
dataTable.width(800).height(800)
|
||||
.dimension(businessDimension)
|
||||
.group(function(d:Object) { return "List of all Selected Businesses"
|
||||
})
|
||||
.size(100)
|
||||
.columns([
|
||||
function(d) { return d.name; },
|
||||
function(d) { return d.city; },
|
||||
function(d) { return d.stars; },
|
||||
function(d) { return d.review_count; },
|
||||
function(d) { return '<a href=\"http://maps.google.com/maps?z=12&t=m&q=loc:' + d.latitude + '+' + d.longitude +"\" target=\"_blank\">Map</a>"}
|
||||
])
|
||||
.sortBy(function(d){ return d.stars; })
|
||||
// (optional) sort order, :default ascending
|
||||
.order(d3.ascending);
|
||||
/********************************************************
|
||||
* *
|
||||
* Step6: Render the Charts *
|
||||
* *
|
||||
********************************************************/
|
||||
|
||||
dc.renderAll();
|
||||
});
|
||||
Vendored
+198
@@ -0,0 +1,198 @@
|
||||
// Type definitions for DCJS
|
||||
// Project: https://github.com/dc-js
|
||||
// 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
|
||||
|
||||
///<reference path="../d3/d3.d.ts" />
|
||||
///<reference path="../crossfilter/crossfilter.d.ts" />
|
||||
|
||||
|
||||
|
||||
declare module dc {
|
||||
|
||||
// helper for get/set situation
|
||||
interface IGetSet<T, V> {
|
||||
(): T;
|
||||
(t:T): V;
|
||||
}
|
||||
export interface ILegendwidget {
|
||||
x: IGetSet<number, number>;
|
||||
y: IGetSet<number, number>;
|
||||
gap: IGetSet<number, number>;
|
||||
itemHeight: IGetSet<number, number>;
|
||||
horizontal: IGetSet<boolean, boolean>;
|
||||
legendWidth: IGetSet<number, number>;
|
||||
itemWidth: IGetSet<number, number>;
|
||||
}
|
||||
export interface IBaseChart<T> {
|
||||
width: IGetSet<number, T>;
|
||||
height: IGetSet<number, T>;
|
||||
minWidth: IGetSet<number, T>;
|
||||
minHeight: IGetSet<number, T>;
|
||||
dimension: IGetSet<any, T>;
|
||||
group: IGetSet<any, T>; // not sure here
|
||||
transitionDuration: IGetSet<number, T>;
|
||||
colors: IGetSet<string[], T>;
|
||||
keyAccessor: IGetSet<(d:any) => number, T>;
|
||||
valueAccessor: IGetSet<(d:any) => number, T>;
|
||||
label: IGetSet<(l:any) => string, T>;
|
||||
renderLabel: IGetSet<boolean, T>;
|
||||
renderlet: (fnctn: (t:T) => void) => T;
|
||||
title: IGetSet<(t:string) => string, T>;
|
||||
filter: IGetSet<any, T>;
|
||||
filterAll: () => void;
|
||||
expireCache: () => void;
|
||||
legend: (l:ILegendwidget) => T;
|
||||
chartID: () => number;
|
||||
options: (o:Object)=>void ;
|
||||
select: (selector: D3.Selection) => D3.Selection;
|
||||
selectAll: (selector: D3.Selection) => D3.Selection;
|
||||
}
|
||||
|
||||
export interface IEvents {
|
||||
trigger(fnctn: () => void, delay?: number):void;
|
||||
}
|
||||
|
||||
export var events: IEvents;
|
||||
|
||||
export interface IListener<T> {
|
||||
on: (eventName: string, fnctn: (c:T) => void) => T;
|
||||
}
|
||||
|
||||
export interface ImarginObj {
|
||||
top: number;
|
||||
right: number;
|
||||
bottom: number;
|
||||
left: number;
|
||||
|
||||
}
|
||||
|
||||
export interface IMarginable<T> {
|
||||
margins: IGetSet<ImarginObj, T>;
|
||||
}
|
||||
|
||||
// abstract interfaces
|
||||
export interface IAbstractColorChart<T> {
|
||||
colorDomain: IGetSet<number[], T>;
|
||||
}
|
||||
export interface IAbstractStackableChart<T> {
|
||||
stack: (group: IChartGroup, name?:string, retriever?: (d:Object)=>number) => T;
|
||||
}
|
||||
|
||||
export interface IAbstractCoordinateGridChart<T> {
|
||||
x: IGetSet<any, T>;
|
||||
y: IGetSet<any, T>;
|
||||
elasticY: IGetSet<boolean, T>;
|
||||
xAxis: IGetSet<D3.Svg.Axis, T>;
|
||||
yAxis: IGetSet<D3.Svg.Axis, T>;
|
||||
yAxisPadding: IGetSet<number, T>;
|
||||
xAxisPadding: IGetSet<number, T>;
|
||||
renderHorizontalGridLines: IGetSet<boolean, T>;
|
||||
|
||||
}
|
||||
|
||||
export interface IAbstractBubblechart<T> {
|
||||
r: IGetSet<any, T>;
|
||||
radiusValueAccessor: IGetSet<(d:any) => number, T>;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// function interfaces
|
||||
export interface columnFunction {
|
||||
(rowinfo:any): string;
|
||||
}
|
||||
export interface sortbyFunction {
|
||||
(rowinfo:any): any;
|
||||
}
|
||||
export interface orderFunction {
|
||||
<T>(a: T, b: T): number;
|
||||
}
|
||||
|
||||
|
||||
// chart interfaces
|
||||
|
||||
|
||||
export interface IBubblechart extends
|
||||
IBaseChart<IBubblechart>,
|
||||
IAbstractColorChart<IBubblechart>,
|
||||
IAbstractBubblechart<IBubblechart>,
|
||||
IAbstractCoordinateGridChart<IBubblechart>,
|
||||
IMarginable<IBubblechart>,
|
||||
IListener<IBubblechart> {
|
||||
}
|
||||
|
||||
export interface IPiechart extends
|
||||
IBaseChart<IPiechart>,
|
||||
IAbstractColorChart<IPiechart>,
|
||||
IAbstractBubblechart<IPiechart>,
|
||||
IAbstractCoordinateGridChart<IPiechart>,
|
||||
IMarginable<IPiechart>,
|
||||
IListener<IPiechart> {
|
||||
radius: IGetSet<number, IPiechart>;
|
||||
minAngleForLabel: IGetSet<number, IPiechart>;
|
||||
|
||||
}
|
||||
|
||||
export interface IBarchart extends
|
||||
IBaseChart<IBarchart>,
|
||||
IAbstractStackableChart<IBarchart>,
|
||||
IAbstractCoordinateGridChart<IBarchart>,
|
||||
IMarginable<IBarchart>,
|
||||
IListener<IBarchart> {
|
||||
centerBar: (b:boolean) => IBarchart;
|
||||
gap: (gapBetweenBars: number) => IBarchart;
|
||||
}
|
||||
|
||||
export interface ILinechart extends
|
||||
IBaseChart<ILinechart>,
|
||||
IAbstractStackableChart<ILinechart>,
|
||||
IAbstractCoordinateGridChart<ILinechart>,
|
||||
IMarginable<ILinechart>,
|
||||
IListener<ILinechart> {
|
||||
}
|
||||
|
||||
|
||||
export interface IDatachart extends
|
||||
IBaseChart<IDatachart>,
|
||||
IAbstractStackableChart<IDatachart>,
|
||||
IAbstractCoordinateGridChart<IDatachart>,
|
||||
IMarginable<IDatachart>,
|
||||
IListener<IDatachart> {
|
||||
size: IGetSet<number, IDatachart>;
|
||||
columns: IGetSet<columnFunction[], IDatachart>;
|
||||
sortBy: IGetSet<sortbyFunction, IDatachart>;
|
||||
order: IGetSet<orderFunction, IDatachart>;
|
||||
}
|
||||
|
||||
|
||||
export interface IRowchart extends
|
||||
IBaseChart<IRowchart>,
|
||||
IAbstractColorChart<IRowchart>,
|
||||
IAbstractStackableChart<IRowchart>,
|
||||
IAbstractCoordinateGridChart<IRowchart>,
|
||||
IMarginable<IRowchart>,
|
||||
IListener<IRowchart> {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// utilities
|
||||
export interface IChartGroup { }
|
||||
|
||||
export function filterAll(chartGroup?: IChartGroup): void;
|
||||
export function renderAll(chartGroup?: IChartGroup): void;
|
||||
export function redrawAll(chartGroup?: IChartGroup): void;
|
||||
|
||||
|
||||
export function bubbleChart(cssSel: string): IBubblechart;
|
||||
export function pieChart(cssSel: string): IPiechart;
|
||||
export function barChart(cssSel: string): IBarchart;
|
||||
export function lineChart(cssSel: string): ILinechart;
|
||||
export function dataTable(cssSel: string): IDatachart;
|
||||
export function rowChart(cssSel: string): IRowchart;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
/// <reference path="detect-indent.d.ts" />
|
||||
|
||||
import di = require('detect-indent');
|
||||
|
||||
var str: string;
|
||||
|
||||
str = di(str);
|
||||
str = di(str, str);
|
||||
Vendored
+9
@@ -0,0 +1,9 @@
|
||||
// Type definitions for detect-indent 0.1.3
|
||||
// Project: https://github.com/sindresorhus/detect-indent
|
||||
// Definitions by: Bart van der Schoor <https://github.com/Bartvds>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module 'detect-indent' {
|
||||
function DetectIndent (dir: string, alt?: string): string;
|
||||
export = DetectIndent;
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
/// <reference path="dock-spawn.d.ts" />
|
||||
|
||||
var dockManagerDiv = document.createElement('div'),
|
||||
panelDiv1 = document.createElement('div'),
|
||||
panelDiv2 = document.createElement('div'),
|
||||
panelDiv3 = document.createElement('div');
|
||||
|
||||
document.body.appendChild(dockManagerDiv);
|
||||
|
||||
var dockManager = new dockspawn.DockManager(dockManagerDiv);
|
||||
dockManager.initialize();
|
||||
|
||||
var panelContainer1 = new dockspawn.PanelContainer(panelDiv1, dockManager),
|
||||
panelContainer2 = new dockspawn.PanelContainer(panelDiv2, dockManager),
|
||||
panelContainer3 = new dockspawn.PanelContainer(panelDiv3, dockManager);
|
||||
|
||||
var documentNode = dockManager.context.model.documentManagerNode;
|
||||
|
||||
var panelNode1 = dockManager.dockLeft(documentNode, panelContainer1, 0.33),
|
||||
panelNode2 = dockManager.dockRight(documentNode, panelContainer2, 0.33),
|
||||
panelNode3 = dockManager.dockFill(documentNode, panelContainer3);
|
||||
|
||||
Vendored
+180
@@ -0,0 +1,180 @@
|
||||
// Type definitions for Dock Spawn
|
||||
// Project: http://dockspawn.com
|
||||
// https://github.com/coderespawn/dock-spawn
|
||||
// Definitions by: Drew Noakes <https://drewnoakes.com>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped/dock-spawn
|
||||
|
||||
declare module dockspawn
|
||||
{
|
||||
/**
|
||||
* Dock manager manages all the dock panels in a hierarchy, similar to Visual Studio.
|
||||
* It owns an HTMLDivElement inside which all panels are docked.
|
||||
* Initially the document manager takes up the central space and acts as the root node.
|
||||
*/
|
||||
class DockManager
|
||||
{
|
||||
context: DockManagerContext;
|
||||
|
||||
constructor(element: HTMLDivElement);
|
||||
|
||||
initialize(): void;
|
||||
|
||||
rebuildLayout(node: DockNode): void;
|
||||
|
||||
invalidate(): void;
|
||||
|
||||
resize(width: number, height: number): void;
|
||||
|
||||
/**
|
||||
* Reset the dock model. This happens when state is loaded from JSON.
|
||||
*/
|
||||
setModel(model: DockModel): void;
|
||||
|
||||
setRootNode(node: DockNode): void;
|
||||
|
||||
|
||||
/** Dock the [dialog] to the left of the [referenceNode] node */
|
||||
|
||||
dockDialogLeft(referenceNode: DockNode, dialog: Dialog): DockNode;
|
||||
/** Dock the [dialog] to the right of the [referenceNode] node */
|
||||
dockDialogRight(referenceNode: DockNode, dialog: Dialog): DockNode;
|
||||
/** Dock the [dialog] above the [referenceNode] node */
|
||||
dockDialogUp(referenceNode: DockNode, dialog: Dialog): DockNode;
|
||||
/** Dock the [dialog] below the [referenceNode] node */
|
||||
dockDialogDown(referenceNode: DockNode, dialog: Dialog): DockNode;
|
||||
/** Dock the [dialog] as a tab inside the [referenceNode] node */
|
||||
dockDialogFill(referenceNode: DockNode, container: PanelContainer): DockNode;
|
||||
|
||||
/** Dock the [container] to the left of the [referenceNode] node */
|
||||
dockLeft(referenceNode: DockNode, container: PanelContainer, ratio: number): DockNode;
|
||||
/** Dock the [container] to the right of the [referenceNode] node */
|
||||
dockRight(referenceNode: DockNode, container: PanelContainer, ratio: number): DockNode;
|
||||
/** Dock the [container] above the [referenceNode] node */
|
||||
dockUp(referenceNode: DockNode, container: PanelContainer, ratio: number): DockNode;
|
||||
/** Dock the [container] below the [referenceNode] node */
|
||||
dockDown(referenceNode: DockNode, container: PanelContainer, ratio: number): DockNode;
|
||||
/** Dock the [container] as a tab inside the [referenceNode] node */
|
||||
dockFill(referenceNode: DockNode, container: PanelContainer): DockNode;
|
||||
|
||||
suspendLayout(): void;
|
||||
|
||||
resumeLayout(): void;
|
||||
|
||||
saveState(): string;
|
||||
loadState(state: string): void;
|
||||
}
|
||||
|
||||
class DockManagerContext
|
||||
{
|
||||
dockManager: DockManager;
|
||||
model: DockModel;
|
||||
documentManagerView: DocumentManagerContainer;
|
||||
|
||||
constructor(dockManager: DockManager);
|
||||
}
|
||||
|
||||
class DockModel
|
||||
{
|
||||
rootNode: DockNode;
|
||||
documentManagerNode: DockNode;
|
||||
}
|
||||
|
||||
class DockNode
|
||||
{
|
||||
constructor(container: PanelContainer);
|
||||
|
||||
detachFromParent(): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tab Host control contains tabs known as TabPages.
|
||||
* The tab strip can be aligned in different orientations
|
||||
*/
|
||||
class TabHost
|
||||
{
|
||||
tabStripDirection: TabStripDirection;
|
||||
displayCloseButton: boolean;
|
||||
pages: TabPage[];
|
||||
hostElement: HTMLDivElement;
|
||||
tabListElement: HTMLDivElement;
|
||||
separatorElement: HTMLDivElement;
|
||||
contentElement: HTMLDivElement;
|
||||
|
||||
constructor(tabStripDirection?: TabStripDirection, displayCloseButton?: boolean)
|
||||
|
||||
setActiveTab(container: PanelContainer): void;
|
||||
|
||||
/** Set the selected TabPage. */
|
||||
onTabPageSelected(page: TabPage): void;
|
||||
|
||||
resize(width: number, height: number): void;
|
||||
}
|
||||
|
||||
class TabPage
|
||||
{
|
||||
constructor(host: TabHost, container: PanelContainer);
|
||||
}
|
||||
|
||||
enum TabStripDirection
|
||||
{
|
||||
DIRECTION_TOP = 0,
|
||||
DIRECTION_BOTTOM = 1,
|
||||
DIRECTION_LEFT = 2,
|
||||
DIRECTION_RIGHT = 3
|
||||
}
|
||||
|
||||
class FillDockContainer
|
||||
{
|
||||
tabOrientation: TabStripDirection;
|
||||
element: HTMLDivElement;
|
||||
tabHost: TabHost;
|
||||
dockManager: DockManager;
|
||||
name: string;
|
||||
containerType: string;
|
||||
minimumAllowedChildNodes: number;
|
||||
|
||||
constructor(dockManager: DockManager, tabStripDirection?: TabStripDirection)
|
||||
}
|
||||
|
||||
/**
|
||||
* The document manager is then central area of the dock layout hierarchy.
|
||||
* This is where more important panels are placed (e.g. the text editor in an IDE,
|
||||
* 3D view in a modelling package etc
|
||||
*/
|
||||
class DocumentManagerContainer extends FillDockContainer
|
||||
{
|
||||
selectedTab: TabPage;
|
||||
|
||||
constructor(dockManager: DockManager);
|
||||
|
||||
saveState(state: string): void;
|
||||
}
|
||||
|
||||
class PanelContainer
|
||||
{
|
||||
width: number;
|
||||
height: number;
|
||||
|
||||
constructor(element: HTMLElement, dockManager: DockManager, title?: string);
|
||||
|
||||
setTitle(title: string): void;
|
||||
setTitleIcon(iconName: string): void;
|
||||
}
|
||||
|
||||
class Dialog
|
||||
{
|
||||
static fromElement(id: string, dockManager: DockManager): Dialog;
|
||||
|
||||
constructor(panel: PanelContainer, dockManager: DockManager);
|
||||
|
||||
setPosition(x: number, y: number): void;
|
||||
|
||||
resize(width: number, height: number): void;
|
||||
|
||||
setTitle(title: string): void;
|
||||
|
||||
setTitleIcon(iconName: string): void;
|
||||
|
||||
bringToFront(): void;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
/// <reference path="exit.d.ts" />
|
||||
|
||||
import exit = require('exit');
|
||||
|
||||
exit(42);
|
||||
Vendored
+9
@@ -0,0 +1,9 @@
|
||||
// Type definitions for exit 0.1.2
|
||||
// Project: https://github.com/cowboy/node-exit
|
||||
// Definitions by: Bart van der Schoor <https://github.com/Bartvds>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module 'exit' {
|
||||
function exit(code: number): void;
|
||||
export = exit;
|
||||
}
|
||||
@@ -1489,3 +1489,10 @@ function test_middleware() {
|
||||
app.use(express.static('public'));
|
||||
app.use(router.middleware);
|
||||
}
|
||||
|
||||
////////////////////
|
||||
|
||||
// make sure server can be shut down
|
||||
var testShutdownServer = app.listen(0);
|
||||
console.log('listening on port ' + testShutdownServer.address().port);
|
||||
testShutdownServer.close();
|
||||
|
||||
Vendored
+6
-6
@@ -258,7 +258,7 @@ declare module "express" {
|
||||
|
||||
header(name: string): string;
|
||||
|
||||
headers: string[];
|
||||
headers: { [key: string]: string; };
|
||||
|
||||
/**
|
||||
* Check if the given `type(s)` is acceptable, returning
|
||||
@@ -1112,15 +1112,15 @@ declare module "express" {
|
||||
* http.createServer(app).listen(80);
|
||||
* https.createServer({ ... }, app).listen(443);
|
||||
*/
|
||||
listen(port: number, hostname: string, backlog: number, callback?: Function): void;
|
||||
listen(port: number, hostname: string, backlog: number, callback?: Function): http.Server;
|
||||
|
||||
listen(port: number, hostname: string, callback?: Function): void;
|
||||
listen(port: number, hostname: string, callback?: Function): http.Server;
|
||||
|
||||
listen(port: number, callback?: Function): void;
|
||||
listen(port: number, callback?: Function): http.Server;
|
||||
|
||||
listen(path: string, callback?: Function): void;
|
||||
listen(path: string, callback?: Function): http.Server;
|
||||
|
||||
listen(handle: any, listeningListener?: Function): void;
|
||||
listen(handle: any, listeningListener?: Function): http.Server;
|
||||
|
||||
route: IRoute;
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -110,7 +110,7 @@ interface FileSystem{
|
||||
* The root directory of the file system.
|
||||
* @readonly
|
||||
*/
|
||||
root:any;
|
||||
root: DirectoryEntry;
|
||||
}
|
||||
|
||||
interface Entry {
|
||||
|
||||
@@ -0,0 +1,86 @@
|
||||
/// <reference path="./firebase-simplelogin.d.ts" />
|
||||
|
||||
var chatRef: Firebase = new Firebase('https://<YOUR-FIREBASE>.firebaseio.com');
|
||||
var auth: FirebaseSimpleLogin = new FirebaseSimpleLogin(chatRef, function(error, user) {
|
||||
if (error) {
|
||||
// an error occurred while attempting login
|
||||
switch(error.code) {
|
||||
case 'INVALID_EMAIL':
|
||||
case 'INVALID_PASSWORD':
|
||||
default:
|
||||
}
|
||||
} else if (user) {
|
||||
// user authenticated with Firebase
|
||||
console.log('User ID: ' + user.id + ', Provider: ' + user.provider);
|
||||
} else {
|
||||
// user is logged out
|
||||
}
|
||||
});
|
||||
|
||||
var email = 'my@email.com';
|
||||
var password = 'secret';
|
||||
var oldPassword = 'secret';
|
||||
var newPassword = 'secret';
|
||||
|
||||
auth.login('password', {
|
||||
email: '<email@domain.com>',
|
||||
password: '<password>',
|
||||
rememberMe: true
|
||||
});
|
||||
|
||||
auth.login('facebook', {
|
||||
rememberMe: true,
|
||||
scope: 'email,user_likes'
|
||||
});
|
||||
|
||||
auth.login('github', {
|
||||
rememberMe: true,
|
||||
scope: 'user,gist'
|
||||
});
|
||||
|
||||
auth.login('google', {
|
||||
rememberMe: true,
|
||||
scope: 'https://www.googleapis.com/auth/plus.login'
|
||||
});
|
||||
|
||||
auth.login('persona', {
|
||||
rememberMe: true
|
||||
});
|
||||
|
||||
auth.login('twitter', {
|
||||
rememberMe: true
|
||||
});
|
||||
|
||||
auth.login('anonymous');
|
||||
|
||||
auth.createUser(email, password, function(error, user) {
|
||||
if (!error) {
|
||||
console.log('User Id: ' + user.id + ', Email: ' + user.email);
|
||||
}
|
||||
});
|
||||
|
||||
auth.createUser(email, password);
|
||||
|
||||
auth.changePassword(email, oldPassword, newPassword, function(error, success) {
|
||||
if (!error) {
|
||||
console.log('Password changed successfully');
|
||||
}
|
||||
});
|
||||
|
||||
auth.changePassword(email, oldPassword, newPassword);
|
||||
|
||||
auth.sendPasswordResetEmail(email, function(error, success) {
|
||||
if (!error) {
|
||||
console.log('Password reset email sent successfully');
|
||||
}
|
||||
});
|
||||
|
||||
auth.sendPasswordResetEmail(email);
|
||||
|
||||
auth.removeUser(email, password, function(error, success) {
|
||||
if (!error) {
|
||||
console.log('User deleted successfully');
|
||||
}
|
||||
});
|
||||
|
||||
auth.removeUser(email, password);
|
||||
Vendored
+94
@@ -0,0 +1,94 @@
|
||||
// Type definitions for Firebase Simple Login
|
||||
// Project: https://www.firebase.com/docs/security/simple-login-overview.html
|
||||
// Definitions by: Wilker Lucio <http://github.com/wilkerlucio>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="./firebase.d.ts" />
|
||||
|
||||
interface IFirebaseSimpleLoginError {
|
||||
code: string;
|
||||
message: string;
|
||||
}
|
||||
|
||||
interface IFirebaseSimpleLoginOptions {
|
||||
// general options
|
||||
debug?: boolean
|
||||
rememberMe?: boolean
|
||||
|
||||
// email
|
||||
email?: string
|
||||
password?: string
|
||||
|
||||
// facebook / github / google / twitter
|
||||
preferRedirect?: boolean
|
||||
|
||||
// facebook / github / google
|
||||
scope?: string
|
||||
|
||||
// facebook
|
||||
access_token?: string
|
||||
|
||||
// twitter
|
||||
oauth_token?: string
|
||||
|
||||
// persona
|
||||
backgroundColor?: string
|
||||
privacyPolicy?: string
|
||||
siteLogo?: string
|
||||
siteName?: string
|
||||
termsOfService?: string
|
||||
}
|
||||
|
||||
interface IFirebaseSimpleLoginUser {
|
||||
// general data
|
||||
firebaseAuthToken: string;
|
||||
id: string;
|
||||
provider: string;
|
||||
uid: string;
|
||||
|
||||
// email / persona
|
||||
md5_hash?: string;
|
||||
|
||||
// email
|
||||
email?: string;
|
||||
|
||||
// facebook / github / google / twitter
|
||||
accessToken?: string
|
||||
displayName?: string
|
||||
thirdPartyUserData?: Object
|
||||
|
||||
// github / twitter
|
||||
username?: string
|
||||
|
||||
// twitter
|
||||
accessTokenSecret?: string
|
||||
}
|
||||
|
||||
declare class FirebaseSimpleLogin {
|
||||
email: string;
|
||||
id: string;
|
||||
provider: string;
|
||||
uid: string;
|
||||
username: string;
|
||||
|
||||
constructor(firebase: Firebase, callback: (err: IFirebaseSimpleLoginError, user: IFirebaseSimpleLoginUser) => any);
|
||||
|
||||
login(loginType: string, options?: IFirebaseSimpleLoginOptions): void;
|
||||
logout(): void;
|
||||
|
||||
createUser(email: string,
|
||||
password: string,
|
||||
callback?: (err: IFirebaseSimpleLoginError, user: IFirebaseSimpleLoginUser) => any): void;
|
||||
|
||||
changePassword(email: string,
|
||||
oldPassword: string,
|
||||
newPassword: string,
|
||||
callback?: (err: IFirebaseSimpleLoginError, success: boolean) => any): void;
|
||||
|
||||
sendPasswordResetEmail(email: string,
|
||||
callback?: (err: IFirebaseSimpleLoginError, success: boolean) => any): void;
|
||||
|
||||
removeUser(email: string,
|
||||
password: string,
|
||||
callback?: (err: IFirebaseSimpleLoginError, success: boolean) => any): void;
|
||||
}
|
||||
@@ -26,8 +26,11 @@ function test_bubble() {
|
||||
var map: google.maps.Map;
|
||||
var marker: google.maps.Marker;
|
||||
var bubble: google.maps.infobubble.InfoBubble;
|
||||
var position: google.maps.LatLng;
|
||||
|
||||
bubble.open(map, marker);
|
||||
var isOpen = bubble.isOpen();
|
||||
bubble.close();
|
||||
|
||||
position = bubble.getPosition();
|
||||
}
|
||||
@@ -57,6 +57,11 @@ declare module google.maps.infobubble {
|
||||
* @marker The marker used for anchoring the infobubble to
|
||||
*/
|
||||
open(map: google.maps.Map, marker: google.maps.Marker) : void;
|
||||
|
||||
/**
|
||||
* Returns the position of the InfoBubble
|
||||
*/
|
||||
getPosition(): google.maps.LatLng;
|
||||
}
|
||||
|
||||
export interface InfoBubbleOptions {
|
||||
|
||||
Vendored
+1
-1
@@ -367,7 +367,7 @@ declare module google.maps {
|
||||
getEditable(): boolean;
|
||||
getMap(): Map;
|
||||
getPath(): MVCArray;
|
||||
getPaths(): MVCArray[];
|
||||
getPaths(): MVCArray;
|
||||
getVisible(): boolean;
|
||||
setDraggable(draggable: boolean): void;
|
||||
setEditable(editable: boolean): void;
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
/// <reference path="graceful-fs.d.ts" />
|
||||
|
||||
import fs = require('graceful-fs');
|
||||
|
||||
var str: string;
|
||||
var buf: NodeBuffer;
|
||||
|
||||
fs.renameSync(str, str);
|
||||
Vendored
+11
@@ -0,0 +1,11 @@
|
||||
// Type definitions for graceful-fs 2.0.0
|
||||
// Project: https://github.com/cowboy/graceful-fs
|
||||
// Definitions by: Bart van der Schoor <https://github.com/Bartvds>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
declare module 'graceful-fs' {
|
||||
import fs = require('fs');
|
||||
export = fs;
|
||||
}
|
||||
Vendored
+1
@@ -129,6 +129,7 @@ declare class TimelineLite extends SimpleTimeline {
|
||||
progress(value:number):any;
|
||||
remove(value:any):any;
|
||||
removeLabel(label:string):any;
|
||||
set(target: Object, vars: Object, position?:any):any;
|
||||
seek(position:any, suppressEvents?:boolean):any;
|
||||
shiftChildren(amount:number, adjustLabels?:boolean, ignoreBeforeTime?:number):any;
|
||||
staggerFrom(targets:any[], duration:number, vars:Object, stagger?:number, position?:any, onCompleteAll?:Function, onCompleteAllParams?:any[], onCompleteScope?:any):any;
|
||||
|
||||
Vendored
+8
-8
@@ -393,7 +393,8 @@ declare module grunt {
|
||||
* @param contents If `contents` is a Buffer, encoding is ignored.
|
||||
* @param options If an encoding is not specified, default to grunt.file.defaultEncoding.
|
||||
*/
|
||||
write(filepath: string, contents: NodeBuffer, options?: IFileEncodedOption): void
|
||||
write(filepath: string, contents: string, options?: IFileEncodedOption): void
|
||||
write(filepath: string, contents: NodeBuffer): void
|
||||
|
||||
/**
|
||||
* Copy a source file to a destination path, creating intermediate directories if necessary.
|
||||
@@ -809,6 +810,12 @@ declare module grunt {
|
||||
* This method is used internally by the multi task system this.files / grunt.task.current.files property.
|
||||
*/
|
||||
normalizeMultiTaskFiles(data: grunt.config.IProjectConfig, targetname?: string): Array<grunt.file.IFileMap>
|
||||
|
||||
/**
|
||||
* The currently running task or multitask.
|
||||
* @see http://gruntjs.com/api/inside-tasks
|
||||
*/
|
||||
current: grunt.task.IMultiTask<any>
|
||||
}
|
||||
|
||||
interface AsyncResultCatcher {
|
||||
@@ -1232,13 +1239,6 @@ declare module grunt {
|
||||
}
|
||||
|
||||
interface ITaskComponents extends grunt.task.CommonTaskModule {
|
||||
|
||||
/**
|
||||
* The currently running task or multitask.
|
||||
* @see IMultiTask for when to cast
|
||||
*/
|
||||
current: grunt.task.ITask
|
||||
|
||||
/**
|
||||
* Load task-related files from the specified directory, relative to the Gruntfile.
|
||||
* This method can be used to load task-related files from a local Grunt plugin by
|
||||
|
||||
+32
-15
@@ -1,32 +1,49 @@
|
||||
/// <reference path="../jquery/jquery.d.ts"/>
|
||||
/// <reference path="hammerjs.d.ts" />
|
||||
|
||||
var hammer = new Hammer(document.getElementById("container"));
|
||||
hammer.ondragstart = function (ev) { };
|
||||
hammer.ondrag = function (ev) { };
|
||||
hammer.ondragend = function (ev) { };
|
||||
hammer.onswipe = function (ev) { };
|
||||
// plugin check
|
||||
if (!Hammer.HAS_TOUCHEVENTS && !Hammer.HAS_POINTEREVENTS) {
|
||||
Hammer.plugins.fakeMultitouch();
|
||||
Hammer.plugins.showTouches();
|
||||
}
|
||||
|
||||
hammer.ontap = function (ev) { };
|
||||
hammer.ondoubletap = function (ev) { };
|
||||
hammer.onhold = function (ev) { };
|
||||
// instance method check
|
||||
var el = document.getElementById("container");
|
||||
|
||||
hammer.ontransformstart = function (ev) { };
|
||||
hammer.ontransform = function (ev) { };
|
||||
hammer.ontransformend = function (ev) { };
|
||||
Hammer(el).on("doubletap", function () {
|
||||
alert('you doubletapped me!');
|
||||
});
|
||||
|
||||
hammer.onrelease = function (ev) { };
|
||||
var hammertime = Hammer(el, {
|
||||
drag: false,
|
||||
transform: false
|
||||
}).off("tap", function (event:HammerEvent) {
|
||||
alert('hello!');
|
||||
});
|
||||
|
||||
hammertime.enable(false);
|
||||
|
||||
hammertime.on("touch drag transform", function (ev: HammerEvent) {
|
||||
if (!ev.gesture) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (ev.gesture.deltaX >= 20) {
|
||||
hammertime.trigger("swipe", ev.gesture);
|
||||
}
|
||||
});
|
||||
|
||||
// jQuery check
|
||||
$("#element")
|
||||
.hammer({
|
||||
// Options
|
||||
})
|
||||
.bind("tap", function (ev) {
|
||||
.on("tap", function (ev) {
|
||||
console.log(ev);
|
||||
});
|
||||
|
||||
$("#container").hammer({
|
||||
prevent_default: false,
|
||||
drag_vertical: false
|
||||
}).bind("hold tap doubletap transformstart transform transformend dragstart drag dragend release swipe", function (ev) {
|
||||
drag_block_vertical: false
|
||||
}).on("hold tap doubletap transformstart transform transformend dragstart drag dragend release swipe", function (ev) {
|
||||
});
|
||||
Vendored
+79
-31
@@ -1,4 +1,4 @@
|
||||
// Type definitions for Hammer.js 1.0.5
|
||||
// Type definitions for Hammer.js 1.0.10
|
||||
// Project: http://eightmedia.github.com/hammer.js/
|
||||
// Definitions by: Boris Yankov <https://github.com/borisyankov/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
@@ -6,6 +6,46 @@
|
||||
|
||||
/// <reference path="../jquery/jquery.d.ts"/>
|
||||
|
||||
declare var Hammer: HammerStatic;
|
||||
|
||||
interface HammerStatic {
|
||||
(element: any, options?: HammerOptions): HammerInstance;
|
||||
|
||||
VERSION: number;
|
||||
HAS_POINTEREVENTS: boolean;
|
||||
HAS_TOUCHEVENTS: boolean;
|
||||
UPDATE_VELOCITY_INTERVAL: number;
|
||||
POINTER_MOUSE: HammerPointerType;
|
||||
POINTER_TOUCH: HammerPointerType;
|
||||
POINTER_PEN: HammerPointerType;
|
||||
|
||||
DIRECTION_UP: HammerDirectionType;
|
||||
DIRECTION_DOWN: HammerDirectionType;
|
||||
DIRECTION_LEFT: HammerDirectionType;
|
||||
DIRECTION_RIGH: HammerDirectionType;
|
||||
|
||||
EVENT_START: HammerTouchEventState;
|
||||
EVENT_MOVE: HammerTouchEventState;
|
||||
EVENT_END: HammerTouchEventState;
|
||||
|
||||
plugins: any;
|
||||
gestures: any;
|
||||
READY: boolean;
|
||||
|
||||
|
||||
}
|
||||
|
||||
declare class HammerInstance {
|
||||
constructor(element: any, options?: HammerOptions);
|
||||
|
||||
on(gesture: string, handler: (event: HammerEvent) => void): HammerInstance;
|
||||
off(gesture: string, handler: (event: HammerEvent) => void): HammerInstance;
|
||||
enable(toggle: boolean): HammerInstance;
|
||||
|
||||
// You shouldn't use this, this is an internally method use by the gestures. Only use it when you know what you're doing! You can read the sourcecode about how to use this.
|
||||
trigger(gesture: string, eventData: HammerGestureEventData): HammerInstance;
|
||||
}
|
||||
|
||||
// Gesture Options : https://github.com/EightMedia/hammer.js/wiki/Getting-Started#gesture-options
|
||||
interface HammerOptions {
|
||||
drag?: boolean;
|
||||
@@ -38,44 +78,52 @@ interface HammerOptions {
|
||||
transform_min_scale?: number;
|
||||
}
|
||||
|
||||
interface HammerGestureEventData {
|
||||
timestamp: number;
|
||||
target: HTMLElement;
|
||||
touches: HammerPoint[];
|
||||
pointerType: HammerPointerType;
|
||||
center: HammerPoint;
|
||||
deltaTime: number;
|
||||
deltaX: number;
|
||||
deltaY: number;
|
||||
velocityX: number;
|
||||
velocityY: number;
|
||||
angle: number;
|
||||
interimAngle: number;
|
||||
direction: HammerDirectionType;
|
||||
interimDirection: HammerDirectionType;
|
||||
distance: number;
|
||||
scale: number;
|
||||
rotation: number;
|
||||
eventType: HammerTouchEventState;
|
||||
srcEvent: any;
|
||||
startEvent: any;
|
||||
|
||||
stopPropagation(): void;
|
||||
preventDefault(): void;
|
||||
stopDetect(): void;
|
||||
}
|
||||
|
||||
interface HammerPoint {
|
||||
x: number;
|
||||
y: number;
|
||||
pageX: number;
|
||||
pageY: number;
|
||||
}
|
||||
|
||||
interface HammerEvent {
|
||||
originalEvent: Event;
|
||||
position: HammerPoint;
|
||||
touches: HammerPoint[];
|
||||
type: string;
|
||||
gesture: HammerGestureEventData;
|
||||
|
||||
stopPropagation(): void;
|
||||
preventDefault(): void;
|
||||
|
||||
}
|
||||
|
||||
interface HammertTransformEvent extends HammerEvent {
|
||||
scale: number;
|
||||
rotation: number;
|
||||
declare enum HammerPointerType {
|
||||
}
|
||||
|
||||
interface HammerDirectionEvent extends HammerEvent {
|
||||
angle: number;
|
||||
direction: string;
|
||||
distance: number;
|
||||
distanceX: number;
|
||||
distanceY: number;
|
||||
declare enum HammerDirectionType {
|
||||
}
|
||||
|
||||
declare class Hammer {
|
||||
constructor (element: any, options?: HammerOptions);
|
||||
|
||||
ondragstart: (event: HammerDirectionEvent) => void;
|
||||
ondrag: (event: HammerDirectionEvent) => void;
|
||||
ondragend: (event: HammerDirectionEvent) => void;
|
||||
onswipe: (event: HammerDirectionEvent) => void;
|
||||
ontap: (event: HammerEvent) => void;
|
||||
ondoubletap: (event: HammerEvent) => void;
|
||||
onhold: (event: HammerEvent) => void;
|
||||
ontransformstart: (event: HammertTransformEvent) => void;
|
||||
ontransform: (event: HammertTransformEvent) => void;
|
||||
ontransformend: (event: HammertTransformEvent) => void;
|
||||
onrelease: (event: HammerEvent) => void;
|
||||
declare enum HammerTouchEventState {
|
||||
}
|
||||
|
||||
interface JQuery {
|
||||
|
||||
+20
-11
@@ -73,15 +73,15 @@ var barArr: Bar[];
|
||||
var fooStream: Highland.Stream<Foo>;
|
||||
var barStream: Highland.Stream<Bar>;
|
||||
|
||||
var fooStreamStream: Highland.Stream<Highland.Stream<Foo>>;
|
||||
var barStreamStream: Highland.Stream<Highland.Stream<Bar>>;
|
||||
|
||||
var fooArrStream: Highland.Stream<Foo[]>;
|
||||
var barArrStream: Highland.Stream<Bar[]>;
|
||||
|
||||
var fooStreamArr: Highland.Stream<Foo>[];
|
||||
var barStreamArr: Highland.Stream<Bar>[];
|
||||
|
||||
var fooStreamArr: Highland.Stream<Foo>[];
|
||||
var barStreamArr: Highland.Stream<Bar>[];
|
||||
|
||||
var strFooArrMapStream: Highland.Stream<StrFooArrMap>;
|
||||
var strBarArrMapStream: Highland.Stream<StrBarArrMap>;
|
||||
|
||||
@@ -184,13 +184,13 @@ strStream = _.keys(obj);
|
||||
anyArrStream = _.pairs(obj);
|
||||
anyArrStream = _.pairs(fooArr);
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
obj = _.extend(obj, obj);
|
||||
|
||||
objCurObj = _.extend(obj);
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
x = _.get(str, obj);
|
||||
|
||||
@@ -200,26 +200,26 @@ obj = _.set(str, foo, obj);
|
||||
|
||||
objCurAny = _.set(str, foo);
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
_.log(str);
|
||||
_.log(str, num, foo);
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
f = _.wrapCallback(func);
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
num = _.add(num, num);
|
||||
|
||||
numCurNum = _.add(num);
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
// instance methods
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
fooStream.pause();
|
||||
fooStream.resume();
|
||||
@@ -323,6 +323,10 @@ fooStream = fooStream.flatFilter((x: Foo) => {
|
||||
return boolStream;
|
||||
});
|
||||
|
||||
fooStream = fooStream.reject((x: Foo) => {
|
||||
return bool;
|
||||
});
|
||||
|
||||
fooStream = fooStream.find((x: Foo) => {
|
||||
return bool;
|
||||
});
|
||||
@@ -343,6 +347,7 @@ fooStream = fooStream.where(obj);
|
||||
fooStream = fooStream.zip(fooStream);
|
||||
fooStream = fooStream.zip([foo, foo]);
|
||||
|
||||
fooStream = fooStream.head();
|
||||
fooStream = fooStream.take(num);
|
||||
|
||||
fooStream = fooStream.last();
|
||||
@@ -383,6 +388,10 @@ fooStream = fooStream.concat(fooArr);
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
fooStream = fooStream.merge(fooStreamStream);
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
barStream = fooStream.invoke<Bar>(str, anyArr);
|
||||
|
||||
fooStream = fooStream.throttle(num);
|
||||
@@ -393,4 +402,4 @@ fooStream = fooStream.debounce(num);
|
||||
|
||||
fooStream = fooStream.latest();
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
Vendored
+67
-2
@@ -8,6 +8,7 @@
|
||||
// TODO export the top-level functions
|
||||
|
||||
// TODO figure out curry arguments
|
||||
// TODO create more overloads for nested data, like streams-of-streams or streams-of-array-of-streams etc
|
||||
// TODO use externalised Thenable
|
||||
// TODO use externalised Readable/Writable (not node's)
|
||||
|
||||
@@ -19,7 +20,6 @@
|
||||
* Copyright (c) Caolan McMahon
|
||||
*
|
||||
*/
|
||||
|
||||
interface HighlandStatic {
|
||||
/**
|
||||
* The Stream constructor, accepts an array of values or a generator function
|
||||
@@ -320,8 +320,9 @@ interface HighlandStatic {
|
||||
* @api public
|
||||
*/
|
||||
add(a: number, b: number): number;
|
||||
|
||||
add(a: number): (b: number) => number;
|
||||
|
||||
not<R>(a: any): boolean;
|
||||
}
|
||||
|
||||
declare module Highland {
|
||||
@@ -660,6 +661,21 @@ declare module Highland {
|
||||
*/
|
||||
flatFilter(f: (x: R) => Stream<boolean>): Stream<R>;
|
||||
|
||||
/**
|
||||
* The inverse of [filter](#filter).
|
||||
*
|
||||
* @id reject
|
||||
* @section Streams
|
||||
* @name Stream.reject(f)
|
||||
* @param {Function} f - the truth test function
|
||||
* @api public
|
||||
*
|
||||
* var odds = _([1, 2, 3, 4]).reject(function (x) {
|
||||
* return x % 2 === 0;
|
||||
* });
|
||||
*/
|
||||
reject(f: (x: R) => boolean): Stream<R>;
|
||||
|
||||
/**
|
||||
* A convenient form of filter, which returns the first object from a
|
||||
* Stream that passes the provided truth test
|
||||
@@ -733,6 +749,18 @@ declare module Highland {
|
||||
*/
|
||||
take(n: number): Stream<R>;
|
||||
|
||||
/**
|
||||
* Creates a new Stream with only the first value from the source.
|
||||
*
|
||||
* @id head
|
||||
* @section Streams
|
||||
* @name Stream.head()
|
||||
* @api public
|
||||
*
|
||||
* _([1, 2, 3, 4]).head() // => 1
|
||||
*/
|
||||
head(): Stream<R>;
|
||||
|
||||
/**
|
||||
* Drops all values from the Stream apart from the last one (if any).
|
||||
*
|
||||
@@ -871,6 +899,20 @@ declare module Highland {
|
||||
*/
|
||||
scan<U>(memo: U, x: (memo: U, x: R) => U): Stream<U>;
|
||||
|
||||
/**
|
||||
* Same as [scan](#scan), but uses the first element as the initial
|
||||
* state instead of passing in a `memo` value.
|
||||
*
|
||||
* @id scan1
|
||||
* @section Streams
|
||||
* @name Stream.scan1(iterator)
|
||||
* @param {Function} iterator - the function which reduces the values
|
||||
* @api public
|
||||
*
|
||||
* _([1, 2, 3, 4]).scan1(add) // => 1, 3, 6, 10
|
||||
*/
|
||||
scan1<U>(memo: U, x: (memo: U, x: R) => U): Stream<U>;
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
/**
|
||||
@@ -889,6 +931,29 @@ declare module Highland {
|
||||
concat(ys: Stream<R>): Stream<R>;
|
||||
concat(ys: R[]): Stream<R>;
|
||||
|
||||
/**
|
||||
* Takes a Stream of Streams and merges their values and errors into a
|
||||
* single new Stream. The merged stream ends when all source streams have
|
||||
* ended.
|
||||
*
|
||||
* Note that no guarantee is made with respect to the order in which
|
||||
* values for each stream end up in the merged stream. Values in the
|
||||
* merged stream will, however, respect the order they were emitted from
|
||||
* their respective streams.
|
||||
*
|
||||
* @id merge
|
||||
* @section Streams
|
||||
* @name Stream.merge()
|
||||
* @api public
|
||||
*
|
||||
* var txt = _(['foo.txt', 'bar.txt']).map(readFile)
|
||||
* var md = _(['baz.md']).map(readFile)
|
||||
*
|
||||
* _([txt, md]).merge();
|
||||
* // => contents of foo.txt, bar.txt and baz.txt in the order they were read
|
||||
*/
|
||||
merge (ys: Stream<Stream<R>>): Stream<R>;
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
/**
|
||||
|
||||
Vendored
+12
-2
@@ -7,8 +7,9 @@
|
||||
|
||||
/**
|
||||
* Complets an asynchronous task, allowing Jake's execution to proceed to the next task
|
||||
* @param value A value to return from the task.
|
||||
*/
|
||||
declare function complete(): void;
|
||||
declare function complete(value?: any): void;
|
||||
|
||||
/**
|
||||
* Creates a description for a Jake Task (or FileTask, DirectoryTask). When invoked, the description that iscreated will be associated with whatever Task is created next.
|
||||
@@ -22,7 +23,6 @@ declare function desc(description:string): void;
|
||||
*/
|
||||
declare function directory(name:string): jake.DirectoryTask;
|
||||
|
||||
|
||||
/**
|
||||
* Causes Jake execution to abort with an error. Allows passing an optional error code, which will be used to set the exit-code of exiting process.
|
||||
* @param err The error to thow when aborting execution. If this argument is an Error object, it will simply be thrown. If a String, it will be used as the error-message. (If it is a multi-line String, the first line will be used as the Error message, and the remaining lines will be used as the error-stack.)
|
||||
@@ -57,6 +57,15 @@ declare function task(name:string, prereqs?:string[], action?:(...params:any[])=
|
||||
declare function task(name:string, action?:(...params:any[])=>any, opts?:jake.TaskOptions): jake.Task;
|
||||
declare function task(name:string, opts?:jake.TaskOptions, action?:(...params:any[])=>any): jake.Task;
|
||||
|
||||
/**
|
||||
* @param name The name of the NpmPublishTask
|
||||
* @param packageFiles The files to include in the package
|
||||
* @param definition A function that creates the package definition
|
||||
*/
|
||||
declare function npmPublishTask(name:string, packageFiles:string[]): jake.NpmPublishTask;
|
||||
declare function npmPublishTask(name:string, definition?:()=>void): jake.NpmPublishTask;
|
||||
|
||||
|
||||
declare module jake{
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -368,6 +377,7 @@ declare module jake{
|
||||
|
||||
export class NpmPublishTask{
|
||||
constructor(name:string, packageFiles:string[]);
|
||||
constructor(name:string, definition?:()=>void);
|
||||
}
|
||||
|
||||
export function addListener(event: string, listener: Function): NodeEventEmitter;
|
||||
|
||||
@@ -16,7 +16,9 @@ describe("Jasmine jQuery extension", () => {
|
||||
expect($('<span></span>').addClass('js-something')).toBeMatchedBy('.js-something');
|
||||
expect($('<span></span>')).toExist();
|
||||
expect($('<div id="some-id"></div>')).toHaveAttr('id', 'some-id');
|
||||
expect($('<input type="checkbox" checked="checked"/>')).toHaveAttr('type');
|
||||
expect($('<div id="some-id"></div>')).toHaveProp('id', 'some-id');
|
||||
expect($('<input type="checkbox" checked="checked"/>')).toHaveProp('checked');
|
||||
expect($('')).toHaveBeenTriggered();
|
||||
expect($('')).toHaveBeenTriggeredOn('#some-id');
|
||||
expect($('')).toHaveBeenTriggeredOnAndWith('#some-id', 'eventParam');
|
||||
@@ -132,4 +134,4 @@ describe("Jasmine jQuery extension", () => {
|
||||
expect(spyEvent).toHaveBeenStopped();
|
||||
});
|
||||
});
|
||||
})
|
||||
});
|
||||
|
||||
Vendored
+109
-109
@@ -3,142 +3,142 @@
|
||||
// Definitions by: Gregor Stamac <https://github.com/gstamac/>
|
||||
// DefinitelyTyped: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../jasmine/jasmine.d.ts"/>
|
||||
/// <reference path="../jquery/jquery.d.ts"/>
|
||||
|
||||
declare function sandbox(attributes?: any): string;
|
||||
|
||||
declare function readFixtures(...uls: string[]): string;
|
||||
declare function preloadFixtures(...uls: string[]);
|
||||
declare function loadFixtures(...uls: string[]);
|
||||
declare function appendLoadFixtures(...uls: string[]);
|
||||
declare function setFixtures(html: string): string;
|
||||
declare function appendSetFixtures(html: string);
|
||||
|
||||
declare function preloadStyleFixtures(...uls: string[]);
|
||||
declare function loadStyleFixtures(...uls: string[]);
|
||||
declare function appendLoadStyleFixtures(...uls: string[]);
|
||||
declare function setStyleFixtures(html: string);
|
||||
declare function appendSetStyleFixtures(html: string);
|
||||
|
||||
declare function loadJSONFixtures(...uls: string[]): jasmine.JSONFixtures;
|
||||
declare function getJSONFixture(url: string): any;
|
||||
/// <reference path="../jasmine/jasmine.d.ts"/>
|
||||
/// <reference path="../jquery/jquery.d.ts"/>
|
||||
|
||||
declare function sandbox(attributes?: any): string;
|
||||
|
||||
declare function readFixtures(...uls: string[]): string;
|
||||
declare function preloadFixtures(...uls: string[]);
|
||||
declare function loadFixtures(...uls: string[]);
|
||||
declare function appendLoadFixtures(...uls: string[]);
|
||||
declare function setFixtures(html: string): string;
|
||||
declare function appendSetFixtures(html: string);
|
||||
|
||||
declare function preloadStyleFixtures(...uls: string[]);
|
||||
declare function loadStyleFixtures(...uls: string[]);
|
||||
declare function appendLoadStyleFixtures(...uls: string[]);
|
||||
declare function setStyleFixtures(html: string);
|
||||
declare function appendSetStyleFixtures(html: string);
|
||||
|
||||
declare function loadJSONFixtures(...uls: string[]): jasmine.JSONFixtures;
|
||||
declare function getJSONFixture(url: string): any;
|
||||
|
||||
declare function spyOnEvent(selector: string, eventName: string): jasmine.JQueryEventSpy;
|
||||
|
||||
declare function spyOnEvent(selector: string, eventName: string): jasmine.JQueryEventSpy;
|
||||
|
||||
declare module jasmine {
|
||||
function spiedEventsKey(selector: JQuery, eventName: string): string;
|
||||
function spiedEventsKey(selector: JQuery, eventName: string): string;
|
||||
|
||||
function getFixtures(): Fixtures;
|
||||
function getStyleFixtures(): StyleFixtures;
|
||||
function getJSONFixtures(): JSONFixtures;
|
||||
function getFixtures(): Fixtures;
|
||||
function getStyleFixtures(): StyleFixtures;
|
||||
function getJSONFixtures(): JSONFixtures;
|
||||
|
||||
interface Fixtures {
|
||||
fixturesPath: string;
|
||||
containerId: string;
|
||||
set(html: string): string;
|
||||
appendSet(html: string);
|
||||
preload(...uls: string[]);
|
||||
load(...uls: string[]);
|
||||
appendLoad(...uls: string[]);
|
||||
read(...uls: string[]): string;
|
||||
clearCache();
|
||||
cleanUp();
|
||||
sandbox(attributes?: any): string;
|
||||
createContainer_(html: string);
|
||||
addToContainer_(html: string);
|
||||
getFixtureHtml_(url: string): string;
|
||||
loadFixtureIntoCache_(relativeUrl: string);
|
||||
makeFixtureUrl_(relativeUrl: string): string;
|
||||
proxyCallTo_(methodName: string, passedArguments): any;
|
||||
set(html: string): string;
|
||||
appendSet(html: string);
|
||||
preload(...uls: string[]);
|
||||
load(...uls: string[]);
|
||||
appendLoad(...uls: string[]);
|
||||
read(...uls: string[]): string;
|
||||
clearCache();
|
||||
cleanUp();
|
||||
sandbox(attributes?: any): string;
|
||||
createContainer_(html: string);
|
||||
addToContainer_(html: string);
|
||||
getFixtureHtml_(url: string): string;
|
||||
loadFixtureIntoCache_(relativeUrl: string);
|
||||
makeFixtureUrl_(relativeUrl: string): string;
|
||||
proxyCallTo_(methodName: string, passedArguments): any;
|
||||
}
|
||||
|
||||
interface StyleFixtures {
|
||||
fixturesPath: string;
|
||||
set(html: string): string;
|
||||
appendSet(html: string);
|
||||
preload(...uls: string[]);
|
||||
load(...uls: string[]);
|
||||
appendLoad(...uls: string[]);
|
||||
read_(...uls: string[]): string;
|
||||
clearCache();
|
||||
cleanUp();
|
||||
createStyle_(html: string);
|
||||
getFixtureHtml_(url: string): string;
|
||||
loadFixtureIntoCache_(relativeUrl: string);
|
||||
makeFixtureUrl_(relativeUrl: string): string;
|
||||
proxyCallTo_(methodName: string, passedArguments): any;
|
||||
set(html: string): string;
|
||||
appendSet(html: string);
|
||||
preload(...uls: string[]);
|
||||
load(...uls: string[]);
|
||||
appendLoad(...uls: string[]);
|
||||
read_(...uls: string[]): string;
|
||||
clearCache();
|
||||
cleanUp();
|
||||
createStyle_(html: string);
|
||||
getFixtureHtml_(url: string): string;
|
||||
loadFixtureIntoCache_(relativeUrl: string);
|
||||
makeFixtureUrl_(relativeUrl: string): string;
|
||||
proxyCallTo_(methodName: string, passedArguments): any;
|
||||
}
|
||||
|
||||
interface JSONFixtures {
|
||||
fixturesPath: string;
|
||||
load(...uls: string[]);
|
||||
read(...uls: string[]): string;
|
||||
clearCache();
|
||||
getFixtureData_(url: string): any;
|
||||
loadFixtureIntoCache_(relativeUrl: string);
|
||||
load(...uls: string[]);
|
||||
read(...uls: string[]): string;
|
||||
clearCache();
|
||||
getFixtureData_(url: string): any;
|
||||
loadFixtureIntoCache_(relativeUrl: string);
|
||||
proxyCallTo_(methodName: string, passedArguments): any;
|
||||
}
|
||||
|
||||
interface Matchers {
|
||||
toHaveClass(className: string): boolean;
|
||||
toHaveCss(css): boolean;
|
||||
toBeVisible(): boolean;
|
||||
toBeHidden(): boolean;
|
||||
toBeSelected(): boolean;
|
||||
toBeChecked(): boolean;
|
||||
toBeEmpty(): boolean;
|
||||
toExist(): boolean;
|
||||
toHaveLength(length: number): boolean;
|
||||
toHaveAttr(attributeName: string, expectedAttributeValue): boolean;
|
||||
toHaveProp(propertyName: string, expectedPropertyValue): boolean;
|
||||
toHaveId(id: string): boolean;
|
||||
toHaveHtml(html: string): boolean;
|
||||
//toContainHtml(html: string): boolean;
|
||||
toHaveText(text: string): boolean;
|
||||
//toContainText(text: string): boolean;
|
||||
toHaveValue(value): boolean;
|
||||
toHaveData(key, expectedValue): boolean;
|
||||
toBe(selector: JQuery): boolean;
|
||||
toContain(selector: JQuery): boolean;
|
||||
toBeMatchedBy(selector: string): boolean;
|
||||
toBeDisabled(): boolean;
|
||||
toBeFocused(): boolean;
|
||||
toHandle(event): boolean;
|
||||
toHandleWith(eventName: string, eventHandler): boolean;
|
||||
|
||||
toHaveBeenTriggered(): boolean;
|
||||
toHaveBeenTriggeredOn(selector: string): boolean;
|
||||
toHaveBeenTriggeredOnAndWith(selector: string, ...args: any[]): boolean;
|
||||
toHaveBeenPrevented(): boolean;
|
||||
toHaveBeenPreventedOn(selector: string): boolean;
|
||||
toHaveBeenStopped(): boolean;
|
||||
toHaveBeenStoppedOn(selector: string): boolean;
|
||||
toHaveCss(css): boolean;
|
||||
toBeVisible(): boolean;
|
||||
toBeHidden(): boolean;
|
||||
toBeSelected(): boolean;
|
||||
toBeChecked(): boolean;
|
||||
toBeEmpty(): boolean;
|
||||
toExist(): boolean;
|
||||
toHaveLength(length: number): boolean;
|
||||
toHaveAttr(attributeName: string, expectedAttributeValue?): boolean;
|
||||
toHaveProp(propertyName: string, expectedPropertyValue?): boolean;
|
||||
toHaveId(id: string): boolean;
|
||||
toHaveHtml(html: string): boolean;
|
||||
//toContainHtml(html: string): boolean;
|
||||
toHaveText(text: string): boolean;
|
||||
//toContainText(text: string): boolean;
|
||||
toHaveValue(value): boolean;
|
||||
toHaveData(key, expectedValue): boolean;
|
||||
toBe(selector: JQuery): boolean;
|
||||
toContain(selector: JQuery): boolean;
|
||||
toBeMatchedBy(selector: string): boolean;
|
||||
toBeDisabled(): boolean;
|
||||
toBeFocused(): boolean;
|
||||
toHandle(event): boolean;
|
||||
toHandleWith(eventName: string, eventHandler): boolean;
|
||||
|
||||
toHaveBeenTriggered(): boolean;
|
||||
toHaveBeenTriggeredOn(selector: string): boolean;
|
||||
toHaveBeenTriggeredOnAndWith(selector: string, ...args: any[]): boolean;
|
||||
toHaveBeenPrevented(): boolean;
|
||||
toHaveBeenPreventedOn(selector: string): boolean;
|
||||
toHaveBeenStopped(): boolean;
|
||||
toHaveBeenStoppedOn(selector: string): boolean;
|
||||
}
|
||||
|
||||
interface JQueryEventSpy {
|
||||
selector: string;
|
||||
eventName: string;
|
||||
handler(eventObject: JQueryEventObject): any;
|
||||
selector: string;
|
||||
eventName: string;
|
||||
handler(eventObject: JQueryEventObject): any;
|
||||
reset(): any;
|
||||
}
|
||||
|
||||
interface JasmineJQuery {
|
||||
browserTagCaseIndependentHtml(html: string): string;
|
||||
elementToString(element: JQuery): string;
|
||||
matchersClass: any;
|
||||
events: JasmineJQueryEvents;
|
||||
}
|
||||
|
||||
interface JasmineJQueryEvents {
|
||||
spyOn(selector: string, eventName: string): JQueryEventSpy;
|
||||
args(selector: string, eventName: string): any;
|
||||
wasTriggered(selector: string, eventName: string): boolean;
|
||||
wasTriggeredWith(selector: string, eventName: string, expectedArgs: any, env: jasmine.Env): boolean;
|
||||
wasPrevented(selector: string, eventName: string): boolean;
|
||||
wasStopped(selector: string, eventName: string): boolean;
|
||||
cleanUp();
|
||||
}
|
||||
browserTagCaseIndependentHtml(html: string): string;
|
||||
elementToString(element: JQuery): string;
|
||||
matchersClass: any;
|
||||
events: JasmineJQueryEvents;
|
||||
}
|
||||
|
||||
interface JasmineJQueryEvents {
|
||||
spyOn(selector: string, eventName: string): JQueryEventSpy;
|
||||
args(selector: string, eventName: string): any;
|
||||
wasTriggered(selector: string, eventName: string): boolean;
|
||||
wasTriggeredWith(selector: string, eventName: string, expectedArgs: any, env: jasmine.Env): boolean;
|
||||
wasPrevented(selector: string, eventName: string): boolean;
|
||||
wasStopped(selector: string, eventName: string): boolean;
|
||||
cleanUp();
|
||||
}
|
||||
|
||||
var JQuery: JasmineJQuery;
|
||||
}
|
||||
|
||||
Vendored
+7
-2
@@ -5,10 +5,13 @@
|
||||
|
||||
|
||||
declare function describe(description: string, specDefinitions: () => void): void;
|
||||
declare function ddescribe(description: string, specDefinitions: () => void): void;
|
||||
declare function xdescribe(description: string, specDefinitions: () => void): void;
|
||||
|
||||
declare function it(expectation: string, assertion?: () => void): void;
|
||||
declare function it(expectation: string, assertion?: (done: () => void) => void): void;
|
||||
declare function iit(expectation: string, assertion?: () => void): void;
|
||||
declare function iit(expectation: string, assertion?: (done: () => void) => void): void;
|
||||
declare function xit(expectation: string, assertion?: () => void): void;
|
||||
declare function xit(expectation: string, assertion?: (done: () => void) => void): void;
|
||||
|
||||
@@ -95,11 +98,13 @@ declare module jasmine {
|
||||
addReporter(reporter: Reporter): void;
|
||||
execute(): void;
|
||||
describe(description: string, specDefinitions: () => void): Suite;
|
||||
ddescribe(description: string, specDefinitions: () => void): Suite;
|
||||
beforeEach(beforeEachFunction: () => void): void;
|
||||
currentRunner(): Runner;
|
||||
afterEach(afterEachFunction: () => void): void;
|
||||
xdescribe(desc: string, specDefinitions: () => void): XSuite;
|
||||
it(description: string, func: () => void): Spec;
|
||||
iit(description: string, func: () => void): Spec;
|
||||
xit(desc: string, func: () => void): XSpec;
|
||||
compareRegExps_(a: RegExp, b: RegExp, mismatchKeys: string[], mismatchValues: string[]): boolean;
|
||||
compareObjects_(a: any, b: any, mismatchKeys: string[], mismatchValues: string[]): boolean;
|
||||
@@ -349,7 +354,7 @@ declare module jasmine {
|
||||
|
||||
identity: string;
|
||||
and: SpyAnd;
|
||||
calls: any[];
|
||||
calls: any;
|
||||
mostRecentCall: { args: any[]; };
|
||||
argsForCall: any[];
|
||||
wasCalled: boolean;
|
||||
@@ -362,7 +367,7 @@ declare module jasmine {
|
||||
/** By chaining the spy with and.returnValue, all calls to the function will return a specific value. */
|
||||
returnValue(val: any): void;
|
||||
/** By chaining the spy with and.callFake, all calls to the spy will delegate to the supplied function. */
|
||||
callFake(fn: () => any): void;
|
||||
callFake(fn: Function): void;
|
||||
/** By chaining the spy with and.throwError, all calls to the spy will throw the specified value. */
|
||||
throwError(msg: string): void;
|
||||
/** When a calling strategy is used for a spy, the original stubbing behavior can be returned at any time with and.stub. */
|
||||
|
||||
Vendored
+7
@@ -10,6 +10,13 @@ interface JQueryAddressStatic {
|
||||
change(callback: any): void;
|
||||
value(url: any): void;
|
||||
update(): void;
|
||||
path(): string;
|
||||
path(value: string): void;
|
||||
internalChange(eventhandler: Function): void;
|
||||
externalChange(eventhandler: Function): void;
|
||||
parameter(name: string, value?: string): string;
|
||||
value(): string;
|
||||
history(value: boolean): void;
|
||||
}
|
||||
|
||||
interface JQueryAddress {
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
""
|
||||
@@ -1 +0,0 @@
|
||||
""
|
||||
@@ -0,0 +1,4 @@
|
||||
/// <reference path="../jquery/jquery.d.ts"/>
|
||||
/// <reference path="jquery.placeholder.d.ts"/>
|
||||
|
||||
$('input').placeholder();
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
// Type definitions for jquery.placeholder.js 2.0.7
|
||||
// Project: https://github.com/mathiasbynens/jquery-placeholder
|
||||
// Definitions by: Peter Gill <https://github.com/majorsilence>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../jquery/jquery.d.ts"/>
|
||||
|
||||
interface JQuery {
|
||||
|
||||
placeholder() : void;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,242 @@
|
||||
/// <reference path="../jquery/jquery.d.ts"/>
|
||||
/// <reference path="jquery.pnotify.d.ts" />
|
||||
|
||||
function test_pnotify() {
|
||||
|
||||
|
||||
$.pnotify({
|
||||
title: 'Regular Notice',
|
||||
text: 'Check me out! I\'m a notice.'
|
||||
});
|
||||
|
||||
$.pnotify({
|
||||
title: 'Sticky Notice',
|
||||
text: 'Check me out! I\'m a sticky notice. You\'ll have to close me yourself.',
|
||||
hide: false
|
||||
});
|
||||
$.pnotify({
|
||||
title: 'See Through Notice',
|
||||
text: 'No one ever pays attention to me. Why should they? I\'m practically invisible.',
|
||||
opacity: .8
|
||||
});
|
||||
$.pnotify({
|
||||
title: 'No Shadow Notice',
|
||||
text: 'I don\'t have a shadow. (It\'s cause I\'m a vampire or something. Or is that reflections...)',
|
||||
shadow: false
|
||||
});
|
||||
$.pnotify('Check me out! I\'m a notice.');
|
||||
|
||||
$.pnotify(Math.round(Math.random() * 9999));
|
||||
|
||||
$.pnotify({
|
||||
title: 'PIcon Notice',
|
||||
text: 'I have an icon that uses the PIcon styles.',
|
||||
icon: 'picon picon-mail-unread-new'
|
||||
});
|
||||
|
||||
$.pnotify({
|
||||
title: 'jQuery UI Icon Notice',
|
||||
text: 'I have an icon that uses the jQuery UI icon styles.',
|
||||
icon: 'ui-icon ui-icon-mail-closed'
|
||||
});
|
||||
|
||||
$.pnotify({
|
||||
title: 'Bootstrap Icon Notice',
|
||||
text: 'I have an icon that uses the Bootstrap icon styles.',
|
||||
icon: 'glyphicon glyphicon-envelope'
|
||||
});
|
||||
|
||||
$.pnotify({
|
||||
title: 'No Icon Notice',
|
||||
text: 'I have no icon.',
|
||||
icon: false
|
||||
});
|
||||
|
||||
$.pnotify({
|
||||
title: 'Bootstrap Notice',
|
||||
text: 'Look at my beautiful styling! ^_^',
|
||||
styling: 'bootstrap3'
|
||||
});
|
||||
$.pnotify({
|
||||
title: 'Bootstrap Info',
|
||||
text: 'Look at my beautiful styling! ^_^',
|
||||
type: 'info',
|
||||
styling: 'bootstrap3'
|
||||
});
|
||||
$.pnotify({
|
||||
title: 'Bootstrap Success',
|
||||
text: 'Look at my beautiful styling! ^_^',
|
||||
type: 'success',
|
||||
styling: 'bootstrap3'
|
||||
});
|
||||
$.pnotify({
|
||||
title: 'Bootstrap Error',
|
||||
text: 'Look at my beautiful styling! ^_^',
|
||||
type: 'error',
|
||||
styling: 'bootstrap3'
|
||||
});
|
||||
$.pnotify({
|
||||
title: 'jQuery UI Notice',
|
||||
text: 'Look at my beautiful styling! ^_^',
|
||||
styling: 'jqueryui'
|
||||
});
|
||||
$.pnotify({
|
||||
title: 'jQuery UI Info',
|
||||
text: 'Look at my beautiful styling! ^_^',
|
||||
type: 'info',
|
||||
styling: 'jqueryui'
|
||||
});
|
||||
$.pnotify({
|
||||
title: 'jQuery UI Success',
|
||||
text: 'Look at my beautiful styling! ^_^',
|
||||
type: 'success',
|
||||
styling: 'jqueryui'
|
||||
});
|
||||
$.pnotify({
|
||||
title: 'jQuery UI Error',
|
||||
text: 'Look at my beautiful styling! ^_^',
|
||||
type: 'error',
|
||||
styling: 'jqueryui'
|
||||
});
|
||||
$.pnotify({
|
||||
title: 'Font Awesome Notice',
|
||||
text: 'Look at my beautiful styling! ^_^',
|
||||
styling: 'fontawesome'
|
||||
});
|
||||
$.pnotify({
|
||||
title: 'Font Awesome Info',
|
||||
text: 'Look at my beautiful styling! ^_^',
|
||||
type: 'info',
|
||||
styling: 'fontawesome'
|
||||
});
|
||||
$.pnotify({
|
||||
title: 'Font Awesome Success',
|
||||
text: 'Look at my beautiful styling! ^_^',
|
||||
type: 'success',
|
||||
styling: 'fontawesome'
|
||||
});
|
||||
$.pnotify({
|
||||
title: 'Font Awesome Error',
|
||||
text: 'Look at my beautiful styling! ^_^',
|
||||
type: 'error',
|
||||
styling: 'fontawesome'
|
||||
});
|
||||
|
||||
$.pnotify({
|
||||
title: 'New Thing',
|
||||
text: 'Just to let you know, something happened.',
|
||||
type: 'info'
|
||||
});
|
||||
|
||||
$.pnotify({
|
||||
title: 'Sticky Info',
|
||||
text: 'Sticky info, you know, like a newspaper covered in honey.',
|
||||
type: 'info',
|
||||
hide: false
|
||||
});
|
||||
|
||||
$.pnotify({
|
||||
title: 'See Through Info',
|
||||
text: 'Not only does it not matter, but I don\'t even care if you see this info.',
|
||||
type: 'info',
|
||||
opacity: .8
|
||||
});
|
||||
|
||||
$.pnotify({
|
||||
title: 'No Shadow Success',
|
||||
text: 'I don\'t have a shadow. (It\'s cause I\'m a vampire or something. Or is that reflections...)',
|
||||
type: 'success',
|
||||
shadow: false
|
||||
});
|
||||
|
||||
$.pnotify({
|
||||
title: 'PIcon Success',
|
||||
text: 'We reached the moon first! See, we planted a flag.',
|
||||
type: 'success',
|
||||
icon: 'picon picon-flag-green'
|
||||
});
|
||||
|
||||
$.pnotify({
|
||||
title: 'Oh No!',
|
||||
text: 'Something terrible happened.',
|
||||
type: 'error'
|
||||
});
|
||||
|
||||
$.pnotify({
|
||||
title: 'No Icon Error',
|
||||
text: 'I have no icon.',
|
||||
type: 'error',
|
||||
icon: false
|
||||
});
|
||||
|
||||
$.pnotify({
|
||||
title: 'No Sticky Button Notice',
|
||||
text: 'Check me out! I\'m a sticky notice with no unsticky button. You\'ll have to close me yourself.',
|
||||
hide: false,
|
||||
sticker: false
|
||||
});
|
||||
|
||||
$.pnotify({
|
||||
title: 'No Mouse Reset Notice',
|
||||
text: 'I don\'t care if you move your mouse over me, I\'ll disappear when I want.',
|
||||
mouse_reset: false
|
||||
});
|
||||
|
||||
$.pnotify({
|
||||
title: '<em>Escaped Notice</em>',
|
||||
title_escape: true,
|
||||
text: $('#evil_html').html(),
|
||||
text_escape: true
|
||||
});
|
||||
|
||||
$.pnotify({
|
||||
title: 'Non-Blocking Notice',
|
||||
text: 'I\'m a special kind of notice called "non-blocking". When you hover over me I\'ll fade to show the elements underneath. Feel free to click any of them just like I wasn\'t even here.\n\nNote: HTML links don\'t trigger in some browsers, due to security settings.',
|
||||
nonblock: true,
|
||||
nonblock_opacity: .2
|
||||
});
|
||||
|
||||
$.pnotify({
|
||||
title: 'Custom Styling',
|
||||
text: 'I have an additional class that\'s used to give me special styling. I always wanted to be pretty.',
|
||||
addclass: 'custom',
|
||||
icon: 'picon picon-32 picon-fill-color',
|
||||
opacity: .8,
|
||||
nonblock: true,
|
||||
nonblock_opacity: .2
|
||||
});
|
||||
|
||||
$.pnotify({
|
||||
title: "PNotify Stacks",
|
||||
text: "Stacks are used to position notices and determine where new notices will go when they're created. Each notice that's placed into a stack will be positioned related to the other notices in that stack. There is no limit to the number of stacks, and no limit to the number of notices in each stack.",
|
||||
type: "info",
|
||||
icon: "fa fa-bars",
|
||||
delay: 20000,
|
||||
history: false,
|
||||
stack: false
|
||||
});
|
||||
|
||||
var type = "error";
|
||||
var stack_bottomright = {"dir1": "up", "dir2": "left", "firstpos1": 25, "firstpos2": 25};
|
||||
|
||||
var opts = {
|
||||
title: "Over Here",
|
||||
text: "Check me out. I'm in a different stack.",
|
||||
addclass: "stack-bar-top",
|
||||
cornerclass: "",
|
||||
width: "100%",
|
||||
stack: stack_bottomright,
|
||||
type: "error"
|
||||
|
||||
};
|
||||
$.pnotify(opts);
|
||||
|
||||
$.pnotify({
|
||||
title: 'Show Effect',
|
||||
text: 'I use a different effect.',
|
||||
animation: 'show'
|
||||
});
|
||||
|
||||
$.pnotify_remove_all();
|
||||
|
||||
}
|
||||
Vendored
+173
@@ -0,0 +1,173 @@
|
||||
// Type definitions for jquery.pnotify 1.3.1
|
||||
// Project: https://github.com/sciactive/pnotify
|
||||
// Definitions by: https://github.com/DavidSichau
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
|
||||
/// <reference path="../jquery/jquery.d.ts"/>
|
||||
|
||||
interface pnotifyStack {
|
||||
dir1?: string;
|
||||
dir2?: string;
|
||||
push?: string;
|
||||
spacing1?: number;
|
||||
spacing2?: number;
|
||||
context?: JQuery
|
||||
}
|
||||
|
||||
interface pnotifyLabel {
|
||||
redisplay?: string;
|
||||
all?: string;
|
||||
last?: string;
|
||||
close?: string;
|
||||
stick?: string;
|
||||
}
|
||||
|
||||
interface pnotifyDefaults {
|
||||
/**
|
||||
* The notice's title. Either boolean false or string
|
||||
*/
|
||||
title?: any;
|
||||
/**
|
||||
* Whether to escape the content of the title. (Not allow HTML.)
|
||||
*/
|
||||
title_escape?: boolean;
|
||||
/**
|
||||
* The notice's text. Either boolean false or string
|
||||
*/
|
||||
text?: any;
|
||||
/**
|
||||
* Whether to escape the content of the text. (Not allow HTML.)
|
||||
*/
|
||||
text_escape?: boolean;
|
||||
/**
|
||||
* What styling classes to use. (Can be either jqueryui or bootstrap.)
|
||||
*/
|
||||
styling?: string;
|
||||
/**
|
||||
* Additional classes to be added to the notice. (For custom styling.)
|
||||
*/
|
||||
addclass?: string;
|
||||
/**
|
||||
* Class to be added to the notice for corner styling.
|
||||
*/
|
||||
cornerclass?: string;
|
||||
/**
|
||||
* Create a non-blocking notice. It lets the user click elements underneath it.
|
||||
*/
|
||||
nonblock?: boolean;
|
||||
/**
|
||||
* The opacity of the notice (if it's non-blocking) when the mouse is over it.
|
||||
*/
|
||||
nonblock_opacity?: number;
|
||||
/**
|
||||
* Display a pull down menu to redisplay previous notices, and place the notice in the history.
|
||||
*/
|
||||
history?: boolean;
|
||||
/**
|
||||
* Maximum number of notifications to have onscreen.
|
||||
*/
|
||||
maxonscreen?: number;
|
||||
/**
|
||||
* Display the notice when it is created. Turn this off to add notifications to the history without displaying them.
|
||||
*/
|
||||
auto_display?: boolean;
|
||||
/**
|
||||
* Width of the notice.
|
||||
*/
|
||||
width?: string;
|
||||
/**
|
||||
* Minimum height of the notice. It will expand to fit content.
|
||||
*/
|
||||
min_height?: string;
|
||||
/**
|
||||
* Type of the notice. "notice", "info", "success", or "error".
|
||||
*/
|
||||
type?: string;
|
||||
/**
|
||||
* Set icon to true to use the default icon for the selected style/type, false for no icon, or a string for your own icon class.
|
||||
*/
|
||||
icon?: any;
|
||||
/**
|
||||
* The animation to use when displaying and hiding the notice. "none", "show", "fade", and "slide" are built in to jQuery. Others require jQuery UI. Use an object with effect_in and effect_out to use different effects.
|
||||
*/
|
||||
animation?: any;
|
||||
/**
|
||||
* Speed at which the notice animates in and out. "slow", "def" or "normal", "fast" or number of milliseconds.
|
||||
*/
|
||||
animate_speed?: string;
|
||||
/**
|
||||
* Specify a specific duration of position animation
|
||||
*/
|
||||
position_animate_speed?: number;
|
||||
/**
|
||||
* Opacity of the notice.
|
||||
*/
|
||||
opacity?: number;
|
||||
/**
|
||||
* Display a drop shadow.
|
||||
*/
|
||||
shadow?: boolean;
|
||||
/**
|
||||
* Provide a button for the user to manually close the notice.
|
||||
*/
|
||||
closer?: boolean;
|
||||
/**
|
||||
* Only show the closer button on hover.
|
||||
*/
|
||||
closer_hover?: boolean;
|
||||
/**
|
||||
* Provide a button for the user to manually stick the notice.
|
||||
*/
|
||||
sticker?: boolean;
|
||||
/**
|
||||
* Only show the sticker button on hover.
|
||||
*/
|
||||
sticker_hover?: boolean;
|
||||
/**
|
||||
* After a delay, remove the notice.
|
||||
*/
|
||||
hide?: boolean;
|
||||
/**
|
||||
* Delay in milliseconds before the notice is removed.
|
||||
*/
|
||||
delay?: number;
|
||||
/**
|
||||
* Reset the hide timer if the mouse moves over the notice.
|
||||
*/
|
||||
mouse_reset?: boolean;
|
||||
/**
|
||||
* Remove the notice's elements from the DOM after it is removed.
|
||||
*/
|
||||
remove?: boolean;
|
||||
/**
|
||||
* Change new lines to br tags.
|
||||
*/
|
||||
insert_brs?: boolean;
|
||||
/**
|
||||
* The stack on which the notices will be placed. Also controls the direction the notices stack.
|
||||
*/
|
||||
stack?: pnotifyStack;
|
||||
/**
|
||||
* The various displayed text, helps facilitating internationalization.
|
||||
*/
|
||||
labels?: pnotifyLabel;
|
||||
}
|
||||
|
||||
|
||||
interface pnotifyInterface {
|
||||
defaults?: pnotifyDefaults
|
||||
(options: pnotifyDefaults): any;
|
||||
}
|
||||
|
||||
interface JQueryStatic {
|
||||
/**
|
||||
* The pnotify object
|
||||
*/
|
||||
pnotify: pnotifyInterface;
|
||||
/**
|
||||
* Removes all notifications
|
||||
*/
|
||||
pnotify_remove_all(): void;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
/// <reference path="../jquery/jquery.d.ts"/>
|
||||
/// <reference path="jquery.ui.datetimepicker.d.ts" />
|
||||
|
||||
// basic no options
|
||||
$('#datetimepicker').datetimepicker({
|
||||
|
||||
});
|
||||
|
||||
// basic with some options
|
||||
$('#datetimepicker').datetimepicker({
|
||||
dateFormat: "yy-mm-dd",
|
||||
timeFormat: 'HH:mm',
|
||||
nextText: "",
|
||||
prevText: ""
|
||||
});
|
||||
|
||||
// function within the plugin
|
||||
$('#datetimepicker').datetimepicker('formatTime', {
|
||||
format: "HH:mm",
|
||||
time: { hours: 1, minutes: 1, seconds: 1 }
|
||||
});
|
||||
|
||||
@@ -0,0 +1,132 @@
|
||||
// Type definitions for jQuery UI DateTimePicker 0.3 Addon
|
||||
//
|
||||
// Project: http://trentrichardson.com/examples/timepicker/
|
||||
// Definitions by: https://github.com/dougajmcdonald
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../jquery/jquery.d.ts"/>
|
||||
/// <reference path="../jqueryui/jqueryui.d.ts"/>
|
||||
|
||||
interface DateTimePickerOptions extends JQueryUI.DatepickerOptions {
|
||||
|
||||
// Control options
|
||||
showButtonPanel?: boolean; //Default: true - Whether to show the button panel at the bottom.This is generally needed.
|
||||
timeOnly?: boolean; //Default: false - Hide the datepicker and only provide a time interface.
|
||||
onSelect?: () => any; //Default: null - Function to be called when a date is chosen or time has changed(parameters: datetimeText, datepickerInstance).
|
||||
alwaysSetTime?: boolean; //Default: true - Always have a time set internally, even before user has chosen one.
|
||||
separator?: string; //Default: " " - When formatting the time this string is placed between the formatted date and formatted time.
|
||||
pickerTimeFormat?: string; //Default: (timeFormat option) - How to format the time displayed within the timepicker.
|
||||
pickerTimeSuffix?: string; //Default: (timeSuffix option) - String to place after the formatted time within the timepicker.
|
||||
showTimepicker?: boolean; //Default: true - Whether to show the timepicker within the datepicker.
|
||||
addSliderAccess?: boolean; //Default: false - Adds the sliderAccess plugin to sliders within timepicker
|
||||
sliderAccessArgs?: any; //Default: null - Object to pass to sliderAccess when used.
|
||||
defaultValue?: string; //Default: null - String of the default time value placed in the input on focus when the input is empty.
|
||||
minDateTime?: Date; //Default: null - Date object of the minimum datetime allowed.Also available as minDate.
|
||||
maxDateTime?: Date; //Default: null - Date object of the maximum datetime allowed.Also Available as maxDate.
|
||||
parse?: string; //Default: 'strict' - How to parse the time string. Two methods are provided: 'strict' which must match the timeFormat exactly, and 'loose' which uses javascript's new Date(timeString) to guess the time. You may also pass in a function(timeFormat, timeString, options) to handle the parsing yourself, returning a simple object:
|
||||
|
||||
// Alt field options
|
||||
altFieldTimeOnly?: boolean; //Default: true - When altField is used from datepicker altField will only receive the formatted time and the original field only receives date.
|
||||
altSeparator?: string; //Default: (separator option) - String placed between formatted date and formatted time in the altField.
|
||||
altTimeSuffix?: string; //Default: (timeSuffix option) - String always placed after the formatted time in the altField.
|
||||
altTimeFormat?: string; //Default: (timeFormat option) - The time format to use with the altField.
|
||||
|
||||
// Localization options
|
||||
currentText?: string; //Default: "Now", A Localization Setting - Text for the Now button.
|
||||
closeText?: string; //Default: "Done", A Localization Setting - Text for the Close button.
|
||||
amNames?: string; //Default: ['AM', 'A'], A Localization Setting - Array of strings to try and parse against to determine AM.
|
||||
pmNames?: string; //Default: ['PM', 'P'], A Localization Setting - Array of strings to try and parse against to determine PM.
|
||||
timeFormat?: string; //Default: "HH:mm", A Localization Setting - String of format tokens to be replaced with the time.See Formatting.
|
||||
timeSuffix?: string; //Default: "", A Localization Setting - String to place after the formatted time.
|
||||
timeOnlyTitle?: string; //Default: "Choose Time", A Localization Setting - Title of the wigit when using only timepicker.
|
||||
timeText?: string; //Default: "Time", A Localization Setting - Label used within timepicker for the formatted time.
|
||||
hourText?: string; //Default: "Hour", A Localization Setting - Label used to identify the hour slider.
|
||||
minuteText?: string; //Default: "Minute", A Localization Setting - Label used to identify the minute slider.
|
||||
secondText?: string; //Default: "Second", A Localization Setting - Label used to identify the second slider.
|
||||
millisecText?: string; //Default: "Millisecond", A Localization Setting - Label used to identify the millisecond slider.
|
||||
microsecText?: string; //Default: "Microsecond", A Localization Setting - Label used to identify the microsecond slider.
|
||||
timezoneText?: string; //Default: "Timezone", A Localization Setting - Label used to identify the timezone slider.
|
||||
isRTL?: boolean; //Default: false, A Localization Setting - Right to Left support.
|
||||
|
||||
// Timefield options
|
||||
controlType?: string; //Default: 'slider' - Whether to use 'slider' or 'select'.If 'slider' is unavailable through jQueryUI, 'select' will be used.For advanced usage you may pass an object which implements "create", "options", "value" methods to use controls other than sliders or selects.See the _controls property in the source code for more details.
|
||||
showHour?: boolean; //Default: null - Whether to show the hour control. The default of null will use detection from timeFormat.
|
||||
showMinute?: boolean; //Default: null - Whether to show the minute control. The default of null will use detection from timeFormat.
|
||||
showSecond?: boolean; //Default: null - Whether to show the second control. The default of null will use detection from timeFormat.
|
||||
showMillisec?: boolean; //Default: null - Whether to show the millisecond control. The default of null will use detection from timeFormat.
|
||||
showMicrosec?: boolean; //Default: null - Whether to show the microsecond control. The default of null will use detection from timeFormat.
|
||||
showTimezone?: boolean; //Default: null - Whether to show the timezone select.
|
||||
showTime?: boolean; //Default: true - Whether to show the time selected within the datetimepicker.
|
||||
stepHour?: number; //Default: 1 - Hours per step the slider makes.
|
||||
stepMinute?: number; //Default: 1 - Minutes per step the slider makes.
|
||||
stepSecond?: number; //Default: 1 - Seconds per step the slider makes.
|
||||
stepMillisec?: number; //Default: 1 - Milliseconds per step the slider makes.
|
||||
stepMicrosec?: number; //Default: 1 - Microseconds per step the slider makes.
|
||||
hour?: number; //Default: 0 - Initial hour set.
|
||||
minute?: number; //Default: 0 - Initial minute set.
|
||||
second?: number; //Default: 0 - Initial second set.
|
||||
millisec?: number; //Default: 0 - Initial millisecond set.
|
||||
microsec?: number; //Default: 0 - Initial microsecond set. Note: Javascript's native Date object does not natively support microseconds. Timepicker adds ability to simply Date.setMicroseconds(m) and Date.getMicroseconds(). Date comparisons will not acknowledge microseconds. Use this only for display purposes.
|
||||
timezone?: number; //Default: null - Initial timezone set.This is the offset in minutes.If null the browser's local timezone will be used. If you're timezone is "-0400" you would use - 240. For backwards compatibility you may pass "-0400", however the timezone is stored in minutes and more reliable.
|
||||
hourMin?: number; //Default: 0 - The minimum hour allowed for all dates.
|
||||
minuteMin?: number; //Default: 0 - The minimum minute allowed for all dates.
|
||||
secondMin?: number; //Default: 0 - The minimum second allowed for all dates.
|
||||
millisecMin?: number; //Default: 0 - The minimum millisecond allowed for all dates.
|
||||
microsecMin?: number; //Default: 0 - The minimum microsecond allowed for all dates.
|
||||
hourMax?: number; //Default: 23 - The maximum hour allowed for all dates.
|
||||
minuteMax?: number; //Default: 59 - The maximum minute allowed for all dates.
|
||||
secondMax?: number; //Default: 59 - The maximum second allowed for all dates.
|
||||
millisecMax?: number; //Default: 999 - The maximum millisecond allowed for all dates.
|
||||
microsecMax?: number; //Default: 999 - The maximum microsecond allowed for all dates.
|
||||
hourGrid?: number; //Default: 0 - When greater than 0 a label grid will be generated under the slider.This number represents the units (in hours) between labels.
|
||||
minuteGrid?: number; //Default: 0 - When greater than 0 a label grid will be generated under the slider.This number represents the units (in minutes) between labels.
|
||||
secondGrid?: number; //Default: 0 - When greater than 0 a label grid will be genereated under the slider.This number represents the units (in seconds) between labels.
|
||||
millisecGrid?: number; //Default: 0 - When greater than 0 a label grid will be genereated under the slider.This number represents the units (in milliseconds) between labels.
|
||||
microsecGrid?: number; //Default: 0 - When greater than 0 a label grid will be genereated under the slider.This number represents the units (in microseconds) between labels.
|
||||
|
||||
// Timezone options
|
||||
timezoneList?: Array<TimezoneOptions> //Default: [generated timezones] - An array of timezones used to populate the timezone select.Can be an array of values or an array of objects: { label: "EDT", value: -240 }. The value should be the offset number in minutes.So "-0400" which is the format "-hhmm", would equate to - 240 minutes.
|
||||
}
|
||||
|
||||
interface TimezoneOptions {
|
||||
label: string;
|
||||
value: number;
|
||||
}
|
||||
|
||||
interface Time {
|
||||
hour?: number;
|
||||
minute?: number;
|
||||
second?: number;
|
||||
millisecond?: number;
|
||||
timezone?: string;
|
||||
}
|
||||
|
||||
interface formatTimeOptions {
|
||||
format: string;
|
||||
time: Time;
|
||||
options?: DateTimePickerOptions;
|
||||
}
|
||||
|
||||
interface parseTimeOptions {
|
||||
format: string;
|
||||
time: string;
|
||||
options?: DateTimePickerOptions;
|
||||
}
|
||||
|
||||
interface parseDateTimeOptions {
|
||||
dateFormat: string;
|
||||
timeFormat: string;
|
||||
dateTimeString: string;
|
||||
dateSettings: string;
|
||||
timeSettings: string;
|
||||
}
|
||||
|
||||
interface JQuery {
|
||||
datetimepicker(): JQuery;
|
||||
datetimepicker(options?: DateTimePickerOptions): JQuery;
|
||||
datetimepicker(method: string, methodParameter: any): any;
|
||||
datetimepicker(method: 'formatTime', methodParameter: formatTimeOptions): string;
|
||||
datetimepicker(method: 'parseTime', methodParameter: parseTimeOptions): Time;
|
||||
datetimepicker(method: 'parseDateTime', methodParameter: parseDateTimeOptions): Date;
|
||||
}
|
||||
|
||||
+214
-12
@@ -1,6 +1,6 @@
|
||||
// Type definitions for jquery.validation 1.11.1
|
||||
// Project: http://bassistance.de/jquery-plugins/jquery-plugin-validation/
|
||||
// Definitions by: https://github.com/fdecampredon
|
||||
// Definitions by: https://github.com/fdecampredon , https://github.com/johnnyreilly
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
|
||||
@@ -8,31 +8,143 @@
|
||||
|
||||
interface ValidationOptions
|
||||
{
|
||||
/**
|
||||
* Enables debug mode. If true, the form is not submitted and certain errors are displayed on the console (will check if a window.console property exists). Try to enable when a form is just submitted instead of validation stopping the submit.
|
||||
*
|
||||
* default: false
|
||||
*/
|
||||
debug?: boolean;
|
||||
/**
|
||||
* Use this class to create error labels, to look for existing error labels and to add it to invalid elements.
|
||||
*
|
||||
* default: "error"
|
||||
*/
|
||||
errorClass?: string;
|
||||
/**
|
||||
* Hide and show this container when validating.
|
||||
*/
|
||||
errorContainer?: string;
|
||||
/**
|
||||
* Use this element type to create error messages and to look for existing error messages. The default, "label", has the advantage of creating a meaningful link between error message and invalid field using the for attribute (which is always used, regardless of element type).
|
||||
*
|
||||
* default: "label"
|
||||
*/
|
||||
errorElement?: string;
|
||||
/**
|
||||
* Hide and show this container when validating. (eg "#messageBox")
|
||||
*/
|
||||
errorLabelContainer?: string;
|
||||
/**
|
||||
* Customize placement of created error labels. First argument: The created error label as a jQuery object. Second argument: The invalid element as a jQuery object.
|
||||
*
|
||||
* default: Places the error label after the invalid element
|
||||
*/
|
||||
errorPlacement?: (error: JQuery, element: JQuery) => void;
|
||||
/**
|
||||
* If enabled, removes the errorClass from the invalid elements and hides all error messages whenever the element is focused. Avoid combination with focusInvalid.
|
||||
*
|
||||
* default: false
|
||||
*/
|
||||
focusCleanup?: boolean;
|
||||
/**
|
||||
* Focus the last active or first invalid element on submit via validator.focusInvalid(). The last active element is the one that had focus when the form was submitted, avoiding stealing its focus. If there was no element focused, the first one in the form gets it, unless this option is turned off.
|
||||
*
|
||||
* default: true
|
||||
*/
|
||||
focusInvalid?: boolean;
|
||||
/**
|
||||
* Specify grouping of error messages. A group consists of an arbitrary group name as the key and a space separated list of element names as the value. Use errorPlacement to control where the group message is placed.
|
||||
*/
|
||||
groups?: Object;
|
||||
/**
|
||||
* How to highlight invalid fields. Override to decide which fields and how to highlight.
|
||||
*
|
||||
* default: Adds errorClass (see the option) to the element
|
||||
*/
|
||||
highlight?: (element: HTMLElement, errorClass: string, validClass: string) => void;
|
||||
/**
|
||||
* Elements to ignore when validating, simply filtering them out. jQuery's not-method is used, therefore everything that is accepted by not() can be passed as this option. Inputs of type submit and reset are always ignored, so are disabled elements.
|
||||
*/
|
||||
ignore?: string;
|
||||
/**
|
||||
* Set to skip reading messages from the title attribute, helps to avoid issues with Google Toolbar; default is false for compability, the message-from-title is likely to be completely removed in a future release.
|
||||
*
|
||||
* default: false
|
||||
*/
|
||||
ignoreTitle?: boolean;
|
||||
/**
|
||||
* Callback for custom code when an invalid form is submitted. Called with an event object as the first argument, and the validator as the second.
|
||||
*/
|
||||
invalidHandler?: (event: JQueryEventObject, validator: Validator) => void;
|
||||
/**
|
||||
* Key/value pairs defining custom messages. Key is the name of an element, value the message to display for that element. Instead of a plain message, another map with specific messages for each rule can be used. Overrides the title attribute of an element or the default message for the method (in that order). Each message can be a String or a Callback. The callback is called in the scope of the validator, with the rule's parameters as the first argument and the element as the second, and must return a String to display as the message.
|
||||
*
|
||||
* default: the default message for the method used
|
||||
*/
|
||||
messages?: Object;
|
||||
meta?: string;
|
||||
onclick?: boolean;
|
||||
onfocusout?: boolean;
|
||||
onkeyup?: boolean;
|
||||
/**
|
||||
* Boolean or Function. Validate checkboxes and radio buttons on click. Set to false to disable.
|
||||
*
|
||||
* Set to a Function to decide for yourself when to run validation.
|
||||
* A boolean true is not a valid value.
|
||||
*/
|
||||
onclick?: any;
|
||||
/**
|
||||
* Boolean or Function. Validate elements (except checkboxes/radio buttons) on blur. If nothing is entered, all rules are skipped, except when the field was already marked as invalid.
|
||||
*
|
||||
* Set to a Function to decide for yourself when to run validation.
|
||||
* A boolean true is not a valid value.
|
||||
*/
|
||||
onfocusout?: any;
|
||||
/**
|
||||
* Boolean or Function. Validate elements on keyup. As long as the field is not marked as invalid, nothing happens. Otherwise, all rules are checked on each key up event. Set to false to disable.
|
||||
*
|
||||
* Set to a Function to decide for yourself when to run validation.
|
||||
* A boolean true is not a valid value.
|
||||
*/
|
||||
onkeyup?: any;
|
||||
/**
|
||||
* Validate the form on submit. Set to false to use only other events for validation.
|
||||
* Set to a Function to decide for yourself when to run validation.
|
||||
* A boolean true is not a valid value.
|
||||
*
|
||||
* default: true
|
||||
*/
|
||||
onsubmit?: boolean;
|
||||
/**
|
||||
* A custom message display handler. Gets the map of errors as the first argument and an array of errors as the second, called in the context of the validator object. The arguments contain only those elements currently validated, which can be a single element when doing validation onblur/keyup. You can trigger (in addition to your own messages) the default behaviour by calling this.defaultShowErrors().
|
||||
*/
|
||||
rules?: Object;
|
||||
/**
|
||||
* A custom message display handler. Gets the map of errors as the first argument and an array of errors as the second, called in the context of the validator object. The arguments contain only those elements currently validated, which can be a single element when doing validation onblur/keyup. You can trigger (in addition to your own messages) the default behaviour by calling this.defaultShowErrors().
|
||||
*/
|
||||
showErrors?: (errorMap: ErrorDictionary, errorList: ErrorListItem[]) => void;
|
||||
/**
|
||||
* Callback for handling the actual submit when the form is valid. Gets the form as the only argument. Replaces the default submit. The right place to submit a form via Ajax after it is validated.
|
||||
*/
|
||||
submitHandler?: (form: HTMLFormElement) => void;
|
||||
/**
|
||||
* String or Function. If specified, the error label is displayed to show a valid element. If a String is given, it is added as a class to the label. If a Function is given, it is called with the label (as a jQuery object) and the validated input (as a DOM element). The label can be used to add a text like "ok!".
|
||||
*/
|
||||
success?: any;
|
||||
/**
|
||||
* Called to revert changes made by option highlight, same arguments as highlight.
|
||||
*
|
||||
* default: Removes the errorClass
|
||||
*/
|
||||
unhighlight?: (element: HTMLElement, errorClass: string, validClass: string) => void;
|
||||
/**
|
||||
* This class is added to an element after it was validated and considered valid.
|
||||
*
|
||||
* default: "valid"
|
||||
*/
|
||||
validClass?: string;
|
||||
/**
|
||||
* Wrap error labels with the specified element. Useful in combination with errorLabelContainer to create a list of error messages.
|
||||
*
|
||||
* default: window
|
||||
*/
|
||||
wrapper?: string;
|
||||
}
|
||||
|
||||
@@ -49,16 +161,62 @@ interface ErrorListItem
|
||||
|
||||
interface Validator
|
||||
{
|
||||
addClassRules(name: string, rules: any): void;
|
||||
addClassRules(rules: any): void;
|
||||
addMethod(name: string, method: (value: any, element: any, ...params: any[]) => any, message?: any): void;
|
||||
/**
|
||||
* Add a compound class method - useful to refactor common combinations of rules into a single class.
|
||||
*
|
||||
* @param name The name of the class rule to add
|
||||
* @param rules The compound rules
|
||||
*/
|
||||
addClassRules(name: string, rules: Object): void;
|
||||
/**
|
||||
* Add a compound class method - useful to refactor common combinations of rules into a single class.
|
||||
*
|
||||
* @param rules A map of className-rules pairs
|
||||
*/
|
||||
addClassRules(rules: Object): void;
|
||||
/**
|
||||
* Add a custom validation method. It must consist of a name (must be a legal javascript identifier), a javascript based function and a default string message.
|
||||
*
|
||||
* @param name The name of the method used to identify it and referencing it; this must be a valid JavaScript identifier
|
||||
* @param method The actual method implementation, returning true if an element is valid. First argument: Current value. Second argument: Validated element. Third argument: Parameters.
|
||||
*/
|
||||
addMethod(name: string, method: (value: any, element: any, params: any) => any, message?: any): void;
|
||||
/**
|
||||
* Validates a single element, returns true if it is valid, false otherwise.
|
||||
*
|
||||
* @param element An element to validate, must be inside the validated form. eg "#myselect"
|
||||
*/
|
||||
element(element: any): boolean;
|
||||
/**
|
||||
* Validates the form, returns true if it is valid, false otherwise.
|
||||
*/
|
||||
form(): boolean;
|
||||
/**
|
||||
* Replaces {n} placeholders with arguments.
|
||||
*
|
||||
* @param template The string to format.
|
||||
*/
|
||||
format(template: string, ...arguments: string[]): string;
|
||||
/**
|
||||
* Returns the number of invalid fields.
|
||||
*/
|
||||
numberOfInvalids(): number;
|
||||
/**
|
||||
* Resets the controlled form.
|
||||
*/
|
||||
resetForm(): void;
|
||||
/**
|
||||
* Modify default settings for validation.
|
||||
*
|
||||
* @param options Options to set as default.
|
||||
*/
|
||||
setDefaults(defaults: ValidationOptions): void;
|
||||
settings: ValidationOptions;
|
||||
/**
|
||||
* Show the specified messages.
|
||||
*
|
||||
* @param errors One or more key/value pairs of input names and messages.
|
||||
*/
|
||||
showErrors(errors: any): void;
|
||||
hideErrors(): void;
|
||||
valid(): boolean;
|
||||
@@ -70,16 +228,60 @@ interface Validator
|
||||
|
||||
interface JQuery
|
||||
{
|
||||
removeAttrs(attributes: string): any;
|
||||
/**
|
||||
* Remove the specified attributes from the first matched element and return them.
|
||||
*
|
||||
* @param attributes A space-seperated list of attribute names to remove.
|
||||
*/
|
||||
removeAttrs(attributes: string): any;
|
||||
|
||||
/**
|
||||
* Returns the validations rules for the first selected element
|
||||
*/
|
||||
rules(): any;
|
||||
rules(methodName: string): any;
|
||||
rules(methodName: string, rules: any): any;
|
||||
valid(): boolean;
|
||||
|
||||
/**
|
||||
* Removes the specified rules and returns all rules for the first matched element.
|
||||
*
|
||||
* @param command "remove"
|
||||
* @param rules Removes and returns all rules. Manipulates only rules specified via rules-option or via rules("add").
|
||||
*/
|
||||
rules(command: string): any;
|
||||
/**
|
||||
* Removes the specified rules and returns all rules for the first matched element.
|
||||
*
|
||||
* @param command "remove"
|
||||
* @param rules The space-separated names of rules to remove and return. Manipulates only rules specified via rules-option or via rules("add").
|
||||
*/
|
||||
rules(command: string, rules: string): any;
|
||||
/**
|
||||
* Adds the specified rules and returns all rules for the first matched element. Requires that the parent form is validated, that is, $("form").validate() is called first
|
||||
*
|
||||
* @param command "add"
|
||||
* @param rules The rules to add. Accepts the same format as the rules-option of the validate-method.
|
||||
*/
|
||||
rules(command: string, rules: Object): any;
|
||||
|
||||
/**
|
||||
* Checks whether the selected form is valid or whether all selected elements are valid.
|
||||
*/
|
||||
valid(): boolean;
|
||||
|
||||
/**
|
||||
* Validates the selected form.
|
||||
*
|
||||
* @param options options for validation
|
||||
*/
|
||||
validate(options?: ValidationOptions): Validator;
|
||||
}
|
||||
|
||||
interface JQueryStatic
|
||||
{
|
||||
/**
|
||||
* Replaces {n} placeholders with arguments.
|
||||
*
|
||||
* @param template The string to format.
|
||||
*/
|
||||
format(template: string, ...arguments: string[]): string;
|
||||
validator: Validator;
|
||||
}
|
||||
}
|
||||
|
||||
+263
-89
@@ -763,7 +763,7 @@ function test_children() {
|
||||
var $kids = $(e.target).children();
|
||||
var len = $kids.addClass("hilite").length;
|
||||
|
||||
$("#results span:first").text(len.toString());
|
||||
$("#results span:first").text(len);
|
||||
//$("#results span:last").text(e.target.tagName);
|
||||
|
||||
e.preventDefault();
|
||||
@@ -887,6 +887,12 @@ function test_clone() {
|
||||
.clone());
|
||||
}
|
||||
|
||||
function test_prependTo() {
|
||||
$("<p>Test</p>").prependTo(".inner");
|
||||
$("h2").prependTo($(".container"));
|
||||
$("span").prependTo("#foo");
|
||||
}
|
||||
|
||||
function test_closest() {
|
||||
$('li.item-a').closest('ul')
|
||||
.css('background-color', 'red');
|
||||
@@ -1091,90 +1097,6 @@ function test_dblclick() {
|
||||
$('#target').dblclick();
|
||||
}
|
||||
|
||||
function test_deferred() {
|
||||
|
||||
function returnPromise(): JQueryPromise<(data: { MyString: string; MyNumber: number; }, textStatus: string, jqXHR: JQueryXHR) => any> {
|
||||
return $.ajax("test.php");
|
||||
}
|
||||
var x = returnPromise();
|
||||
x.done((data, textStatus, jqXHR) => {
|
||||
var myNumber: number = data.MyNumber;
|
||||
var myString: string = data.MyString;
|
||||
var theTextStatus: string = textStatus;
|
||||
var thejqXHR: JQueryXHR = jqXHR;
|
||||
});
|
||||
|
||||
$.get("test.php").always(function () {
|
||||
alert("$.get completed with success or error callback arguments");
|
||||
});
|
||||
$.get("test.php").done(function () {
|
||||
alert("$.get succeeded");
|
||||
});
|
||||
function fn1() {
|
||||
$("p").append(" 1 ");
|
||||
}
|
||||
function fn2() {
|
||||
$("p").append(" 2 ");
|
||||
}
|
||||
function fn3(n) {
|
||||
$("p").append(n + " 3 " + n);
|
||||
}
|
||||
var dfd = $.Deferred();
|
||||
dfd
|
||||
.done([fn1, fn2], fn3, [fn2, fn1])
|
||||
.done(function (n) {
|
||||
$("p").append(n + " we're done.");
|
||||
});
|
||||
$("button").bind("click", function () {
|
||||
dfd.resolve("and");
|
||||
});
|
||||
$.get("test.php")
|
||||
.done(function () { alert("$.get succeeded"); })
|
||||
.fail(function () { alert("$.get failed!"); });
|
||||
dfd.state();
|
||||
var defer = $.Deferred(),
|
||||
filtered = defer.pipe(function (value) {
|
||||
return value * 2;
|
||||
});
|
||||
defer.resolve(5);
|
||||
filtered.done(function (value) {
|
||||
alert("Value is ( 2*5 = ) 10: " + value);
|
||||
});
|
||||
filtered.fail(function (value) {
|
||||
alert("Value is ( 3*6 = ) 18: " + value);
|
||||
});
|
||||
filtered.done(function (data) { });
|
||||
|
||||
function asyncEvent() {
|
||||
var dfd: JQueryDeferred<string> = $.Deferred<string>();
|
||||
setTimeout(function () {
|
||||
dfd.resolve("hurray");
|
||||
}, Math.floor(400 + Math.random() * 2000));
|
||||
setTimeout(function () {
|
||||
dfd.reject("sorry");
|
||||
}, Math.floor(400 + Math.random() * 2000));
|
||||
setTimeout(function working() {
|
||||
if (dfd.state() === "pending") {
|
||||
dfd.notify("working... ");
|
||||
setTimeout(null, 500);
|
||||
}
|
||||
}, 1);
|
||||
return dfd.promise();
|
||||
}
|
||||
var obj = {
|
||||
hello: function (name) {
|
||||
alert("Hello " + name);
|
||||
}
|
||||
},
|
||||
defer = $.Deferred();
|
||||
defer.promise(obj);
|
||||
defer.resolve("John");
|
||||
$.get("test.php").then(
|
||||
function () { alert("$.get succeeded"); },
|
||||
function () { alert("$.get failed!"); }
|
||||
);
|
||||
}
|
||||
|
||||
function test_delay() {
|
||||
$('#foo').slideUp(300).delay(800).fadeIn(400);
|
||||
$("button").click(function () {
|
||||
@@ -1851,6 +1773,26 @@ function test_getScript() {
|
||||
});
|
||||
}
|
||||
|
||||
function test_jQueryget() {
|
||||
console.log($("li").get(0));
|
||||
console.log($("li")[0]);
|
||||
console.log($("li").get(-1));
|
||||
$("*", document.body).click(function (event) {
|
||||
event.stopPropagation();
|
||||
var domElement = $(this).get(0);
|
||||
$("span:first").text("Clicked on - " + domElement.nodeName);
|
||||
});
|
||||
|
||||
function display(divs) {
|
||||
var a = [];
|
||||
for (var i = 0; i < divs.length; i++) {
|
||||
a.push(divs[i].innerHTML);
|
||||
}
|
||||
$("span").text(a.join(" "));
|
||||
}
|
||||
display($("div").get().reverse());
|
||||
}
|
||||
|
||||
function test_globalEval() {
|
||||
jQuery.globalEval("var newVar = true;");
|
||||
}
|
||||
@@ -2015,6 +1957,38 @@ function test_height() {
|
||||
});
|
||||
}
|
||||
|
||||
function test_wrap() {
|
||||
$(".inner").wrap("<div class='new'></div>");
|
||||
$(".inner").wrap(function () {
|
||||
return "<div class='" + $(this).text() + "'></div>";
|
||||
});
|
||||
$("span").wrap("<div><div><p><em><b></b></em></p></div></div>");
|
||||
$("p").wrap(document.createElement("div"));
|
||||
$("p").wrap($(".doublediv"));
|
||||
}
|
||||
|
||||
function test_wrapAll() {
|
||||
$(".inner").wrapAll("<div class='new' />");
|
||||
$("p").wrapAll("<div></div>");
|
||||
$("span").wrapAll("<div><div><p><em><b></b></em></p></div></div>");
|
||||
$("p").wrapAll(document.createElement("div"));
|
||||
$("p").wrapAll($(".doublediv"));
|
||||
}
|
||||
|
||||
function test_wrapInner() {
|
||||
$(".inner").wrapInner("<div class='new'></div>");
|
||||
$(".inner").wrapInner(function () {
|
||||
return "<div class='" + this.nodeValue + "'></div>";
|
||||
});
|
||||
var elem: Element;
|
||||
$(elem).wrapInner("<div class='test'></div>");
|
||||
$(elem).wrapInner("<div class=\"test\"></div>");
|
||||
$("p").wrapInner("<b></b>");
|
||||
$("body").wrapInner("<div><div><p><em><b></b></em></p></div></div>");
|
||||
$("p").wrapInner(document.createElement("b"));
|
||||
$("p").wrapInner($("<span class='red'></span>"));
|
||||
}
|
||||
|
||||
function test_width() {
|
||||
// Returns width of browser viewport
|
||||
$(window).width();
|
||||
@@ -2175,6 +2149,7 @@ function test_innerWidth() {
|
||||
var p = $("p:first");
|
||||
$("p:last").text("innerWidth:" + p.innerWidth());
|
||||
|
||||
|
||||
p.innerWidth(123);
|
||||
p.innerWidth('123px');
|
||||
}
|
||||
@@ -2213,6 +2188,37 @@ function test_scrollTop() {
|
||||
$("div.demo").scrollTop(300);
|
||||
}
|
||||
|
||||
function test_parent() {
|
||||
$("*", document.body).each(function () {
|
||||
var parentTag = $(this).parent().get(0).tagName;
|
||||
$(this).prepend(document.createTextNode(parentTag + " > "));
|
||||
});
|
||||
$("p").parent(".selected").css("background", "yellow");
|
||||
}
|
||||
|
||||
function test_parents() {
|
||||
var parentEls = $("b").parents()
|
||||
.map(function () {
|
||||
return this.tagName;
|
||||
})
|
||||
.get()
|
||||
.join(", ");
|
||||
$("b").append("<strong>" + parentEls + "</strong>");
|
||||
|
||||
function showParents() {
|
||||
$("div").css("border-color", "white");
|
||||
var len = $("span.selected")
|
||||
.parents("div")
|
||||
.css("border", "2px red solid")
|
||||
.length;
|
||||
$("b").text("Unique div parents: " + len);
|
||||
}
|
||||
$("span").click(function () {
|
||||
$(this).toggleClass("selected");
|
||||
showParents();
|
||||
});
|
||||
}
|
||||
|
||||
function test_param() {
|
||||
|
||||
function test1() {
|
||||
@@ -2876,6 +2882,36 @@ function test_makeArray() {
|
||||
jQuery.isArray(arr) === true;
|
||||
}
|
||||
|
||||
function test_replaceAll() {
|
||||
$("<h2>New heading</h2>").replaceAll(".inner");
|
||||
$(".first").replaceAll(".third");
|
||||
$("<b>Paragraph. </b>").replaceAll("p");
|
||||
}
|
||||
|
||||
function test_replaceWith() {
|
||||
$("div.second").replaceWith("<h2>New heading</h2>");
|
||||
$("div.inner").replaceWith("<h2>New heading</h2>");
|
||||
$("div.third").replaceWith($(".first"));
|
||||
|
||||
$("button").click(function () {
|
||||
$(this).replaceWith("<div>" + $(this).text() + "</div>");
|
||||
});
|
||||
|
||||
$("p").replaceWith("<b>Paragraph. </b>");
|
||||
|
||||
$("p").click(function () {
|
||||
$(this).replaceWith($("div"));
|
||||
});
|
||||
|
||||
$("button").on("click", function () {
|
||||
var $container = $("div.container").replaceWith(function () {
|
||||
return $(this).contents();
|
||||
});
|
||||
|
||||
$("p").append($container.attr("class"));
|
||||
});
|
||||
}
|
||||
|
||||
function test_map() {
|
||||
$(':checkbox').map(function () {
|
||||
return this.id;
|
||||
@@ -2884,16 +2920,25 @@ function test_map() {
|
||||
return $(this).val();
|
||||
}).get().join(", "));
|
||||
var mappedItems = $("li").map(function (index) {
|
||||
var replacement = $("<li>").text($(this).text()).get(0);
|
||||
if (index == 0) {
|
||||
var replacement:any = $("<li>").text($(this).text()).get(0);
|
||||
if (index === 0) {
|
||||
|
||||
// Make the first item all caps
|
||||
$(replacement).text($(replacement).text().toUpperCase());
|
||||
} else if (index == 1 || index == 3) {
|
||||
} else if (index === 1 || index === 3) {
|
||||
|
||||
// Delete the second and fourth items
|
||||
replacement = null;
|
||||
} else if (index == 2) {
|
||||
} else if (index === 2) {
|
||||
|
||||
// Make two of the third item and add some text
|
||||
replacement = [replacement, $("<li>").get(0)];
|
||||
$(replacement[0]).append("<b> - A</b>");
|
||||
$(replacement[1]).append("Extra <b> - B</b>");
|
||||
}
|
||||
|
||||
// Replacement will be a dom element, null,
|
||||
// or an array of dom elements
|
||||
return replacement;
|
||||
});
|
||||
$("#results").append(mappedItems);
|
||||
@@ -3071,6 +3116,22 @@ function test_parseHTML() {
|
||||
.appendTo( $log );
|
||||
}
|
||||
|
||||
function test_not() {
|
||||
$("li").not(":even").css("background-color", "red");
|
||||
|
||||
$("li").not(document.getElementById("notli"))
|
||||
.css("background-color", "red");
|
||||
|
||||
$("div").not(".green, #blueone")
|
||||
.css("border-color", "red");
|
||||
|
||||
$("p").not($("#selected")[0]);
|
||||
|
||||
$("p").not("#selected");
|
||||
|
||||
$("p").not($("div p.selected"));
|
||||
}
|
||||
|
||||
function test_EventIsNewable() {
|
||||
var ev = new jQuery.Event('click');
|
||||
}
|
||||
@@ -3100,3 +3161,116 @@ $.ajax({
|
||||
alert(data);
|
||||
}
|
||||
});
|
||||
|
||||
function test_deferred() {
|
||||
|
||||
function returnPromise(): JQueryPromise<{ MyString: string; MyNumber: number; }> {
|
||||
return $.Deferred<{ MyString: string; MyNumber: number; }>().resolve({
|
||||
MyString: "MyString",
|
||||
MyNumber: 5
|
||||
}, "failed", null);
|
||||
}
|
||||
var x = returnPromise();
|
||||
x.done((data, textStatus, jqXHR) => {
|
||||
var myNumber: number = data.MyNumber;
|
||||
var myString: string = data.MyString;
|
||||
var theTextStatus: string = textStatus;
|
||||
var thejqXHR: JQueryXHR = jqXHR;
|
||||
});
|
||||
|
||||
$.get("test.php").always(function () {
|
||||
alert("$.get completed with success or error callback arguments");
|
||||
});
|
||||
$.get("test.php").done(function () {
|
||||
alert("$.get succeeded");
|
||||
});
|
||||
function fn1() {
|
||||
$("p").append(" 1 ");
|
||||
}
|
||||
function fn2() {
|
||||
$("p").append(" 2 ");
|
||||
}
|
||||
function fn3(n) {
|
||||
$("p").append(n + " 3 " + n);
|
||||
}
|
||||
var dfd = $.Deferred<string>();
|
||||
dfd
|
||||
.done([fn1, fn2], fn3, [fn2, fn1])
|
||||
.done(function (n) {
|
||||
$("p").append(n + " we're done.");
|
||||
});
|
||||
$("button").bind("click", function () {
|
||||
dfd.resolve("and");
|
||||
});
|
||||
$.get("test.php")
|
||||
.done(function () { alert("$.get succeeded"); })
|
||||
.fail(function () { alert("$.get failed!"); });
|
||||
dfd.state();
|
||||
var defer = $.Deferred(),
|
||||
filtered = defer.pipe(function (value) {
|
||||
return value * 2;
|
||||
});
|
||||
defer.resolve(5);
|
||||
filtered.done(function (value) {
|
||||
alert("Value is ( 2*5 = ) 10: " + value);
|
||||
});
|
||||
filtered.fail(function (value) {
|
||||
alert("Value is ( 3*6 = ) 18: " + value);
|
||||
});
|
||||
filtered.done(function (data) { });
|
||||
|
||||
var obj = {
|
||||
hello: function (name) {
|
||||
alert("Hello " + name);
|
||||
}
|
||||
},
|
||||
defer = $.Deferred();
|
||||
defer.promise(obj);
|
||||
defer.resolve("John");
|
||||
$.get("test.php").then(
|
||||
function () { alert("$.get succeeded"); },
|
||||
function () { alert("$.get failed!"); }
|
||||
);
|
||||
}
|
||||
|
||||
function test_deferred_promise() {
|
||||
|
||||
function asyncEvent() {
|
||||
var dfd = $.Deferred<string>();
|
||||
|
||||
// Resolve after a random interval
|
||||
setTimeout(function () {
|
||||
dfd.resolve("hurray");
|
||||
}, Math.floor(400 + Math.random() * 2000));
|
||||
|
||||
// Reject after a random interval
|
||||
setTimeout(function () {
|
||||
dfd.reject("sorry");
|
||||
}, Math.floor(400 + Math.random() * 2000));
|
||||
|
||||
// Show a "working..." message every half-second
|
||||
setTimeout(function working() {
|
||||
if (dfd.state() === "pending") {
|
||||
dfd.notify("working... ");
|
||||
setTimeout(working, 500);
|
||||
}
|
||||
}, 1);
|
||||
|
||||
// Return the Promise so caller can't change the Deferred
|
||||
return dfd.promise();
|
||||
}
|
||||
|
||||
// Attach a done, fail, and progress handler for the asyncEvent
|
||||
$.when(asyncEvent()).then(
|
||||
function (status) {
|
||||
alert(status + ", things are going well");
|
||||
},
|
||||
function (status) {
|
||||
alert(status + ", you fail this time");
|
||||
},
|
||||
function (status) {
|
||||
$("body").append(status);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Vendored
+941
-95
File diff suppressed because it is too large
Load Diff
Vendored
+1
@@ -976,6 +976,7 @@ interface JQuery {
|
||||
sortable(methodName: 'disable'): void;
|
||||
sortable(methodName: 'enable'): void;
|
||||
sortable(methodName: 'widget'): JQuery;
|
||||
sortable(methodName: 'toArray'): string[];
|
||||
sortable(methodName: string): JQuery;
|
||||
sortable(options: JQueryUI.SortableOptions): JQuery;
|
||||
sortable(optionLiteral: string, optionName: string): any;
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
/// <reference path="js-yaml.d.ts" />
|
||||
|
||||
import yaml = require('js-yaml');
|
||||
import LoadOptions = yaml.LoadOptions;
|
||||
import DumpOptions = yaml.DumpOptions;
|
||||
|
||||
var bool: boolean;
|
||||
var num: number;
|
||||
var str: string;
|
||||
var obj: Object;
|
||||
var value: any;
|
||||
|
||||
var loadOpts: LoadOptions;
|
||||
var dumpOpts: DumpOptions;
|
||||
|
||||
// -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
|
||||
|
||||
yaml.FAILSAFE_SCHEMA;
|
||||
yaml.JSON_SCHEMA;
|
||||
yaml.CORE_SCHEMA;
|
||||
yaml.DEFAULT_SAFE_SCHEMA;
|
||||
yaml.DEFAULT_FULL_SCHEMA;
|
||||
|
||||
// -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
|
||||
|
||||
loadOpts = {
|
||||
filename: str
|
||||
};
|
||||
loadOpts = {
|
||||
strict: bool
|
||||
};
|
||||
loadOpts = {
|
||||
schema: bool
|
||||
};
|
||||
|
||||
// -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
|
||||
|
||||
dumpOpts = {
|
||||
indent: num
|
||||
};
|
||||
dumpOpts = {
|
||||
skipInvalid: bool
|
||||
};
|
||||
dumpOpts = {
|
||||
flowLevel: num
|
||||
};
|
||||
dumpOpts = {
|
||||
styles: obj
|
||||
};
|
||||
dumpOpts = {
|
||||
schema: value
|
||||
};
|
||||
|
||||
// -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
|
||||
|
||||
value = yaml.safeLoad(str);
|
||||
value = yaml.safeLoad(str, loadOpts);
|
||||
|
||||
value = yaml.load(str);
|
||||
value = yaml.load(str, loadOpts);
|
||||
|
||||
// -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
|
||||
|
||||
value = yaml.safeLoadAll(str, (doc) => {
|
||||
value = doc;
|
||||
});
|
||||
value = yaml.safeLoadAll(str, (doc) => {
|
||||
value = doc;
|
||||
}, loadOpts);
|
||||
|
||||
value = yaml.loadAll(str, (doc) => {
|
||||
value = doc;
|
||||
});
|
||||
value = yaml.loadAll(str, (doc) => {
|
||||
value = doc;
|
||||
}, loadOpts);
|
||||
|
||||
// -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
|
||||
|
||||
value = yaml.safeDump(str);
|
||||
value = yaml.safeDump(str, dumpOpts);
|
||||
|
||||
value = yaml.dump(str);
|
||||
value = yaml.dump(str, dumpOpts);
|
||||
Vendored
+48
@@ -0,0 +1,48 @@
|
||||
// Type definitions for js-yaml 3.0.2
|
||||
// Project: https://github.com/nodeca/js-yaml
|
||||
// Definitions by: Bart van der Schoor <https://github.com/Bartvds>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module 'js-yaml' {
|
||||
export function safeLoad(str: string, opts?: LoadOptions): any;
|
||||
export function load(str: string, opts?: LoadOptions): any;
|
||||
|
||||
export function safeLoadAll(str: string, iterator: (doc: any) => void, opts?: LoadOptions): any;
|
||||
export function loadAll(str: string, iterator: (doc: any) => void, opts?: LoadOptions): any;
|
||||
|
||||
export function safeDump(obj: any, opts?: DumpOptions): string;
|
||||
export function dump(obj: any, opts?: DumpOptions): string
|
||||
|
||||
export interface LoadOptions {
|
||||
// string to be used as a file path in error/warning messages.
|
||||
filename?: string;
|
||||
// makes the loader to throw errors instead of warnings.
|
||||
strict?: boolean;
|
||||
// specifies a schema to use.
|
||||
schema?: any;
|
||||
}
|
||||
|
||||
export interface DumpOptions {
|
||||
// indentation width to use (in spaces).
|
||||
indent?: number;
|
||||
// do not throw on invalid types (like function in the safe schema) and skip pairs and single values with such types.
|
||||
skipInvalid?: boolean;
|
||||
// specifies level of nesting, when to switch from block to flow style for collections. -1 means block style everwhere
|
||||
flowLevel?: number;
|
||||
// Each tag may have own set of styles. - "tag" => "style" map.
|
||||
styles?: Object;
|
||||
// specifies a schema to use.
|
||||
schema?: any;
|
||||
}
|
||||
|
||||
// only strings, arrays and plain objects: http://www.yaml.org/spec/1.2/spec.html#id2802346
|
||||
export var FAILSAFE_SCHEMA: any;
|
||||
// only strings, arrays and plain objects: http://www.yaml.org/spec/1.2/spec.html#id2802346
|
||||
export var JSON_SCHEMA: any;
|
||||
// same as JSON_SCHEMA: http://www.yaml.org/spec/1.2/spec.html#id2804923
|
||||
export var CORE_SCHEMA: any;
|
||||
// all supported YAML types, without unsafe ones (!!js/undefined, !!js/regexp and !!js/function): http://yaml.org/type/
|
||||
export var DEFAULT_SAFE_SCHEMA: any;
|
||||
// all supported YAML types.
|
||||
export var DEFAULT_FULL_SCHEMA: any;
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
/// <reference path="jsesc.d.ts" />
|
||||
|
||||
import jsesc = require('jsesc');
|
||||
import Opts = jsesc.Opts;
|
||||
|
||||
// ---- ---- ---- ---- ---- ---- ----
|
||||
|
||||
var num: number;
|
||||
var str: string;
|
||||
var bool: boolean;
|
||||
var opts: Opts;
|
||||
var opts: Opts;
|
||||
|
||||
// ---- ---- ---- ---- ---- ---- ----
|
||||
|
||||
str = jsesc.version;
|
||||
|
||||
// ---- ---- ---- ---- ---- ---- ----
|
||||
|
||||
opts = {
|
||||
quotes: str
|
||||
};
|
||||
opts = {
|
||||
wrap: bool
|
||||
};
|
||||
opts = {
|
||||
es6: bool
|
||||
};
|
||||
opts = {
|
||||
escapeEverything: bool
|
||||
};
|
||||
opts = {
|
||||
compact: bool
|
||||
};
|
||||
opts = {
|
||||
indent: str
|
||||
};
|
||||
opts = {
|
||||
json: bool
|
||||
};
|
||||
|
||||
// ---- ---- ---- ---- ---- ---- ----
|
||||
|
||||
str = jsesc(str);
|
||||
str = jsesc(str, opts);
|
||||
Vendored
+25
@@ -0,0 +1,25 @@
|
||||
// Type definitions for jsesc 0.4.3
|
||||
// Project: https://github.com/mathiasbynens/jsesc
|
||||
// Definitions by: Bart van der Schoor <https://github.com/Bartvds>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module 'jsesc' {
|
||||
|
||||
function jsesc(str: string, opts?: any): string;
|
||||
|
||||
module jsesc {
|
||||
var version: string;
|
||||
|
||||
interface Opts {
|
||||
quotes?: string;
|
||||
wrap?: boolean;
|
||||
es6?: boolean;
|
||||
escapeEverything?: boolean;
|
||||
compact?: boolean;
|
||||
indent?: string;
|
||||
json?: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
export = jsesc;
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
/// <reference path="json-pointer.d.ts" />
|
||||
|
||||
import JsonPointer = require('json-pointer');
|
||||
|
||||
var value: any;
|
||||
var str: string;
|
||||
var strArr: string[];
|
||||
var pointer: string;
|
||||
var bool: any;
|
||||
var object:Object;
|
||||
|
||||
bool = JsonPointer.has(object, pointer);
|
||||
value = JsonPointer.get(object, pointer);
|
||||
JsonPointer.set(object, pointer, value);
|
||||
JsonPointer.remove(object, pointer);
|
||||
|
||||
object = JsonPointer.dict(object);
|
||||
|
||||
JsonPointer.walk(object, (elem) => {
|
||||
|
||||
});
|
||||
|
||||
str = JsonPointer.escape(str);
|
||||
str = JsonPointer.unescape(str);
|
||||
|
||||
strArr = JsonPointer.parse(str);
|
||||
str = JsonPointer.compile(strArr);
|
||||
|
||||
var wrap = JsonPointer(object);
|
||||
|
||||
bool = wrap.has(pointer);
|
||||
value = wrap.get(pointer);
|
||||
wrap.set(pointer, value);
|
||||
wrap.remove(pointer);
|
||||
|
||||
object = wrap.dict();
|
||||
|
||||
wrap.walk((elem, key) => {
|
||||
value = elem;
|
||||
str = key;
|
||||
});
|
||||
Vendored
+83
@@ -0,0 +1,83 @@
|
||||
// Type definitions for json-pointer 1.0 l
|
||||
// Project: https://www.npmjs.org/package/json-pointer
|
||||
// Definitions by: Bart van der Schoor <https://github.com/Bartvds>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module "json-pointer" {
|
||||
function JSON_Pointer(object: Object): JSON_Pointer.JSON_PointerWrap;
|
||||
|
||||
module JSON_Pointer {
|
||||
/**
|
||||
* Wrap an object with accessors
|
||||
*/
|
||||
/**
|
||||
* Looks up a JSON pointer in an object.
|
||||
*/
|
||||
function get(object: Object, pointer: string): any;
|
||||
/**
|
||||
* Set a value for a JSON pointer on object.
|
||||
*/
|
||||
function set(object: Object, pointer: string, value: any): void;
|
||||
/**
|
||||
* Removes an attribute of object referenced by pointer
|
||||
*/
|
||||
function remove(object: Object, pointer: string): void;
|
||||
/**
|
||||
* Creates a dictionary object (pointer -> value).
|
||||
*/
|
||||
function dict(object: Object): Object;
|
||||
/**
|
||||
* Just like: each(pointer.dict(obj), iterator);
|
||||
*/
|
||||
function walk(object: Object, iterator: (value: any, key: string) => void): void;
|
||||
/**
|
||||
* Tests if an object has a value for a JSON pointer.
|
||||
*/
|
||||
function has(object: Object, pointer: string): boolean;
|
||||
/**
|
||||
* Escapes a reference token.
|
||||
*/
|
||||
function escape(str: string): string;
|
||||
/**
|
||||
* Unescape a reference token.
|
||||
*/
|
||||
function unescape(str: string): string;
|
||||
/**
|
||||
* Converts a JSON pointer into an array of reference tokens.
|
||||
*/
|
||||
function parse(str: string): string[];
|
||||
/**
|
||||
* Builds a json pointer from an array of reference tokens.
|
||||
*/
|
||||
function compile(str: string[]): string;
|
||||
|
||||
interface JSON_PointerWrap {
|
||||
/**
|
||||
* Looks up a JSON pointer in an object.
|
||||
*/
|
||||
get(pointer: string): any;
|
||||
/**
|
||||
* Set a value for a JSON pointer on object.
|
||||
*/
|
||||
set(pointer: string, value: any): void;
|
||||
/**
|
||||
* Removes an attribute of object referenced by pointer
|
||||
*/
|
||||
remove(pointer: string): void;
|
||||
/**
|
||||
* Creates a dictionary object (pointer -> value).
|
||||
*/
|
||||
dict(): Object;
|
||||
/**
|
||||
* Just like: each(pointer.dict(obj), iterator);
|
||||
*/
|
||||
walk(iterator: (value: any, key: string) => void): void;
|
||||
/**
|
||||
* Tests if an object has a value for a JSON pointer.
|
||||
*/
|
||||
has(pointer: string): boolean;
|
||||
}
|
||||
}
|
||||
|
||||
export = JSON_Pointer;
|
||||
}
|
||||
Vendored
+32
-9
@@ -5,7 +5,9 @@
|
||||
|
||||
/// <reference path="../jquery/jquery.d.ts"/>
|
||||
|
||||
interface jsPlumb {
|
||||
declare var jsPlumb: jsPlumbInstance;
|
||||
|
||||
interface jsPlumbInstance {
|
||||
setRenderMode(renderMode: string): string;
|
||||
bind(event: string, callback: (e) => void ): void;
|
||||
unbind(event?: string): void;
|
||||
@@ -17,16 +19,26 @@ interface jsPlumb {
|
||||
addEndpoint(ep: string): any;
|
||||
removeClass(el: any, clazz: string): void;
|
||||
hasClass(el: any, clazz: string): void;
|
||||
draggable(el: any, container?: DragContainer): void;
|
||||
connect(connection: ConnectParams): void;
|
||||
draggable(el: string, options?: DragOptions): jsPlumbInstance;
|
||||
draggable(ids: string[], options?: DragOptions): jsPlumbInstance;
|
||||
connect(connection: ConnectParams, referenceParams?: ConnectParams): Connection;
|
||||
makeSource(el: string, options: SourceOptions): void;
|
||||
makeTarget(el: string, options: TargetOptions): void;
|
||||
repaintEverything(): void;
|
||||
detachEveryConnection(): void;
|
||||
detachAllConnections(el: string): void;
|
||||
removeAllEndpoints(el: any): void;
|
||||
removeAllEndpoints(el: string, recurse?: boolean): jsPlumbInstance;
|
||||
removeAllEndpoints(el: Element, recurse?: boolean): jsPlumbInstance;
|
||||
select(params: SelectParams): Connections;
|
||||
getConnections(options?: any, flat?: any): any[];
|
||||
getConnections(options?: any, flat?: any): any[];
|
||||
deleteEndpoint(uuid: string, doNotRepaintAfterwards?: boolean): jsPlumbInstance;
|
||||
deleteEndpoint(endpoint: Endpoint, doNotRepaintAfterwards?: boolean): jsPlumbInstance;
|
||||
repaint(el: string): jsPlumbInstance;
|
||||
repaint(el: Element): jsPlumbInstance;
|
||||
|
||||
SVG: string;
|
||||
CANVAS: string;
|
||||
VML: string;
|
||||
}
|
||||
|
||||
interface Defaults {
|
||||
@@ -36,6 +48,8 @@ interface Defaults {
|
||||
ConnectionsDetachable?: boolean;
|
||||
ReattachConnections?: boolean;
|
||||
ConnectionOverlays?: any[][];
|
||||
Container?: any; // string(selector or id) or element
|
||||
DragOptions?: DragOptions;
|
||||
}
|
||||
|
||||
interface PaintStyle {
|
||||
@@ -62,8 +76,8 @@ interface Connections {
|
||||
}
|
||||
|
||||
interface ConnectParams {
|
||||
source: string;
|
||||
target: string;
|
||||
source?: any; // string, element or endpoint
|
||||
target?: any; // string, element or endpoint
|
||||
detachable?: boolean;
|
||||
deleteEndpointsOnDetach?: boolean;
|
||||
endPoint?: string;
|
||||
@@ -72,8 +86,8 @@ interface ConnectParams {
|
||||
label?: string;
|
||||
}
|
||||
|
||||
interface DragContainer {
|
||||
containment: string;
|
||||
interface DragOptions {
|
||||
containment?: string;
|
||||
}
|
||||
|
||||
interface SourceOptions {
|
||||
@@ -103,3 +117,12 @@ interface SelectParams {
|
||||
source: string;
|
||||
target: string;
|
||||
}
|
||||
|
||||
interface Connection {
|
||||
setDetachable(detachable: boolean): void;
|
||||
setParameter<T>(name: string, value: T): void;
|
||||
endpoints: Endpoint[];
|
||||
}
|
||||
|
||||
interface Endpoint {
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
/// <reference path="../jquery/jquery.d.ts"/>
|
||||
/// <reference path="jsrender.d.ts"/>
|
||||
|
||||
$.views.converters("upper", function(val) {
|
||||
return val.toUpperCase();
|
||||
});
|
||||
|
||||
$.views.converters({
|
||||
upper: (val: string) => val.toUpperCase(),
|
||||
lower: (val: string) => val.toLowerCase()
|
||||
});
|
||||
|
||||
$.views.converters.html("< > ' \" &");
|
||||
$.views.converters.attr( "< > ' \" &");
|
||||
$.views.converters.url("<_>_\"_ ");
|
||||
|
||||
function renderBoldP(value: any): string {
|
||||
return "<p><b>" + value + "</b></p>";
|
||||
}
|
||||
|
||||
$.views.tags("boldp", renderBoldP);
|
||||
$.views.tags("boldp", {
|
||||
template: "<p><b>{{:~tag.tagCtx.args[0]}}</b></p>"
|
||||
});
|
||||
|
||||
function myFormatFunction(value: string, upper: string): string {
|
||||
return upper ? value.toUpperCase() : value.toLowerCase();
|
||||
}
|
||||
$.views.helpers("format", myFormatFunction);
|
||||
$.views.helpers({format: myFormatFunction});
|
||||
|
||||
var person = {
|
||||
name: "Adriana"
|
||||
};
|
||||
|
||||
$.templates("personTmpl", "<label>Name:</label> {{:name}}");
|
||||
var html = $.render["personTmpl"](person);
|
||||
console.log(html);
|
||||
|
||||
var myTmpl = $.templates("<label>Name:</label> {{:name}}");
|
||||
var html = myTmpl.render(person);
|
||||
console.log(html);
|
||||
|
||||
$.templates({
|
||||
personTmpl: "#personTemplate",
|
||||
labelTmpl: "Name:"
|
||||
});
|
||||
|
||||
var html = $("#personTemplate").render(person);
|
||||
console.log(html);
|
||||
Vendored
+56
@@ -0,0 +1,56 @@
|
||||
// Type definitions for JsRender
|
||||
// Project: http://www.jsviews.com/#jsrender
|
||||
// Definitions by: https://github.com/zakki
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../jquery/jquery.d.ts"/>
|
||||
|
||||
declare module JsRender {
|
||||
interface Converters {
|
||||
(name: string, converterFn: (value: any) => any): any;
|
||||
(namedConverters: any, parentTemplate?: any): any;
|
||||
|
||||
html(valueToEncode: string): string;
|
||||
attr(valueToEncode: string): string;
|
||||
url(valueToEncode: string): string;
|
||||
}
|
||||
|
||||
interface Views {
|
||||
converters: Converters;
|
||||
|
||||
tags(name: string, tagFn: (value: any) => any): any;
|
||||
tags(name: string, tagOptions: any): any;
|
||||
tags(namedTags: any): any;
|
||||
|
||||
helpers(name: string, helper: any): any;
|
||||
helpers(namedHelpers: any, parentTemplate?: any): any;
|
||||
}
|
||||
|
||||
interface Template {
|
||||
render(data?: any): string;
|
||||
}
|
||||
|
||||
interface NamedTemplate {
|
||||
(data?: any): string;
|
||||
}
|
||||
|
||||
interface Render {
|
||||
(data?: any, helpersOrContext?: any): string;
|
||||
}
|
||||
|
||||
interface RenderStatic {
|
||||
[index: string]: NamedTemplate;
|
||||
}
|
||||
}
|
||||
|
||||
interface JQuery {
|
||||
render: JsRender.Render;
|
||||
}
|
||||
|
||||
interface JQueryStatic {
|
||||
render: JsRender.RenderStatic;
|
||||
views: JsRender.Views;
|
||||
templates(markupOrSelector: string): JsRender.Template;
|
||||
templates(name: string, markupOrSelector: string): JsRender.Template;
|
||||
templates(namedTemplates: any): any;
|
||||
}
|
||||
Vendored
+2
@@ -17,6 +17,7 @@ interface JWPlayer {
|
||||
getFullscreen(): boolean;
|
||||
getMute(): boolean;
|
||||
getPlaylist(): any[];
|
||||
getPlaylistIndex(): number;
|
||||
getPlaylistItem(index: number): any;
|
||||
getPosition(): number;
|
||||
getQualityLevels(): any[];
|
||||
@@ -54,6 +55,7 @@ interface JWPlayer {
|
||||
pause(): void;
|
||||
play(): void;
|
||||
playlistItem(index: number): void;
|
||||
registerPlugin(id: string, target: string, jsPlugin: () => void, swfURL?: string): void;
|
||||
remove(): void;
|
||||
removeButton(id: string): void;
|
||||
resize(width: number, height: number): void;
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
/// <reference path="kineticjs.d.ts"/>
|
||||
|
||||
// http://www.html5canvastutorials.com/kineticjs/html5-canvas-kineticjs-rect-tutorial/
|
||||
module RectTutorial {
|
||||
var stage = new Kinetic.Stage({
|
||||
container: 'container',
|
||||
width: 578,
|
||||
height: 200
|
||||
});
|
||||
|
||||
var layer = new Kinetic.Layer();
|
||||
|
||||
var rect = new Kinetic.Rect({
|
||||
x: 239,
|
||||
y: 75,
|
||||
width: 100,
|
||||
height: 50,
|
||||
fill: 'green',
|
||||
stroke: 'black',
|
||||
strokeWidth: 4
|
||||
});
|
||||
|
||||
// add the shape to the layer
|
||||
layer.add(rect);
|
||||
|
||||
// add the layer to the stage
|
||||
stage.add(layer);
|
||||
}
|
||||
|
||||
// http://www.html5canvastutorials.com/kineticjs/html5-canvas-kineticjs-circle-tutorial/
|
||||
module CircleTutorial {
|
||||
var stage = new Kinetic.Stage({
|
||||
container: 'container',
|
||||
width: 578,
|
||||
height: 200
|
||||
});
|
||||
|
||||
var layer = new Kinetic.Layer();
|
||||
|
||||
var circle = new Kinetic.Circle({
|
||||
x: stage.getWidth() / 2,
|
||||
y: stage.getHeight() / 2,
|
||||
radius: 70,
|
||||
fill: 'red',
|
||||
stroke: 'black',
|
||||
strokeWidth: 4
|
||||
});
|
||||
|
||||
// add the shape to the layer
|
||||
layer.add(circle);
|
||||
|
||||
// add the layer to the stage
|
||||
stage.add(layer);
|
||||
}
|
||||
Vendored
+547
@@ -0,0 +1,547 @@
|
||||
// Type definitions for KineticJS
|
||||
// Project: http://kineticjs.com/
|
||||
// Definitions by: Basarat Ali Syed <http://www.github.com/basarat>, Ralph de Ruijter <http://www.superdopey.nl/techblog/>
|
||||
// DefinitelyTyped: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module Kinetic {
|
||||
|
||||
var Node: {
|
||||
new (config: ObjectOptionsConfig): INode;
|
||||
}
|
||||
|
||||
interface INode {
|
||||
cache(cacheConfig?: any): INode;
|
||||
clone(attrs: any): INode;
|
||||
destroy(): void;
|
||||
draw(): INode;
|
||||
drawBuffer(): any;
|
||||
drawScene(): any;
|
||||
getAbsoluteOpacity(): number;
|
||||
getAbsolutePosition(): Vector2d;
|
||||
getAbsoluteTransform(): any;
|
||||
getAbsoluteZIndex(): number;
|
||||
getAttrs(): any;
|
||||
getDragBounds(): any;
|
||||
getDragConstraint(): any;
|
||||
getDraggable(): boolean;
|
||||
getLayer(): any;
|
||||
getLevel(): number;
|
||||
getListening(): any;
|
||||
getName(): string;
|
||||
getOffset(): Vector2d;
|
||||
getOpacity(): number;
|
||||
getParent(): any;
|
||||
getPosition(): Vector2d;
|
||||
getRotation(): number;
|
||||
getRotationDeg(): number;
|
||||
getScale(): Vector2d;
|
||||
getScaleX(): number;
|
||||
getScaleY(): number;
|
||||
getSize(): ISize;
|
||||
getStage(): IStage;
|
||||
getTransform(): any;
|
||||
getZIndex(): number;
|
||||
hide(): void;
|
||||
isDraggable(): boolean;
|
||||
isDragging(): boolean;
|
||||
isListening(): boolean;
|
||||
move(x: number, y: number): void;
|
||||
moveDown(): void;
|
||||
moveTo(newContainer: IContainer): void;
|
||||
moveToBottom(): void;
|
||||
moveToTop(): void;
|
||||
moveUp(): void;
|
||||
name(): string;
|
||||
name(name: string): void;
|
||||
rotate(theta: number): void;
|
||||
rotateDeg(deg: number): void;
|
||||
|
||||
// Events
|
||||
on(typesStr: string, handler: (data: any) => any): void;
|
||||
off(typesStr: string): void;
|
||||
fire(typeStr: string, event?: any, bubble?: boolean): any;
|
||||
|
||||
setAbsolutePosition(pos: Vector2d): void;
|
||||
setAttrs(config: any): void;
|
||||
setDefaultAttrs(config: any): void;
|
||||
setDragBounds(bounds: any): void;
|
||||
|
||||
setDragConstraint(constraint: string): void;
|
||||
setDraggable(draggable: boolean): void;
|
||||
setListening(listening: boolean): void;
|
||||
setOffset(offset: Vector2d): any;
|
||||
setOpacity(opacity: any): void;
|
||||
setPosition(position: Vector2d): void;
|
||||
setRotation(theta: number): void;
|
||||
setRotationDeg(rotDeg: number): void;
|
||||
setScale(scale: Vector2d): void;
|
||||
setScaleX(scale: number): void;
|
||||
setScaleY(scale: number): void;
|
||||
setSize(size: ISize): any;
|
||||
setZIndex(zIndex: number): void;
|
||||
show(): void;
|
||||
simulate(eventType: string): void;
|
||||
toDataURL(config: any): void;
|
||||
transitionTo(config: any): void;
|
||||
|
||||
// Width / Height
|
||||
width(): number;
|
||||
width(width: number): void;
|
||||
getWidth(): any;
|
||||
setWidth(width: number): void;
|
||||
height(): number;
|
||||
height(height: number): void;
|
||||
getHeight(): any;
|
||||
setHeight(height: number): any;
|
||||
|
||||
// id
|
||||
id(): string;
|
||||
id(id: string): void;
|
||||
getId(): string;
|
||||
setId(id: string): void;
|
||||
|
||||
// Position
|
||||
x(): number;
|
||||
x(x: number): void;
|
||||
y(): number;
|
||||
y(y: number): void;
|
||||
getX(): number;
|
||||
setX(x: number): void;
|
||||
getY(): number;
|
||||
setY(y: number): void;
|
||||
}
|
||||
|
||||
var Container: {
|
||||
new (config: any): IContainer;
|
||||
}
|
||||
|
||||
interface IContainer extends INode {
|
||||
add(child: INode): any;
|
||||
clone(attrs: any): IContainer;
|
||||
destroyChildren(): IContainer;
|
||||
find(selector: string): any;
|
||||
get(selector: any): any;
|
||||
getChildren(): INode[];
|
||||
getIntersections(point: any): any;
|
||||
isAncestorOf(node: any): any;
|
||||
remove(child: any): any;
|
||||
removeChildren(): any;
|
||||
}
|
||||
|
||||
var Stage: {
|
||||
new (config: StageConfig): IStage;
|
||||
}
|
||||
|
||||
interface IStage extends IContainer {
|
||||
add(layer: ILayer): any;
|
||||
clear(): any;
|
||||
getContainer(): HTMLElement;
|
||||
getDOM(): HTMLElement;
|
||||
getHeight(): number;
|
||||
getIntersection(pos: any): any;
|
||||
getMousePosition(evt?: Event): any;
|
||||
getPointerPosition(): Vector2d;
|
||||
getStage(): IStage;
|
||||
getTouchPosition(evt?: Event): any;
|
||||
getUserPosition(evt?: Event): any;
|
||||
getWidth(): number;
|
||||
load(JSON: any): any;
|
||||
reset(): any;
|
||||
setHeight(height: number): any;
|
||||
setWidth(width: number): any;
|
||||
toDataURL(config: any): any;
|
||||
toImage(config: any, callback: () => any): any;
|
||||
toJSON(): any;
|
||||
}
|
||||
|
||||
var Layer: {
|
||||
new (config?: LayerConfig): ILayer;
|
||||
}
|
||||
|
||||
interface ILayer extends IContainer {
|
||||
afterDraw(handler: () => any): any;
|
||||
beforeDraw(handler: () => any): any;
|
||||
clear(): any;
|
||||
getCanvas(): ICanvas;
|
||||
getClearBeforeDraw(): any;
|
||||
getContext(): CanvasRenderingContext2D;
|
||||
remove(): any;
|
||||
setClearBeforeDraw(clearBeforeDraw: boolean): any;
|
||||
toDataURL(config: any): any;
|
||||
}
|
||||
|
||||
interface ICanvas {
|
||||
_canvas: HTMLCanvasElement;
|
||||
|
||||
getPixelRatio(): number;
|
||||
|
||||
height: number;
|
||||
setPixelRatio(pixelRatio: number): any;
|
||||
width: number;
|
||||
}
|
||||
|
||||
var Shape: {
|
||||
new (config: any): IShape;
|
||||
}
|
||||
|
||||
interface IShape extends INode {
|
||||
applyLineJoin(): void;
|
||||
drawImage(): void;
|
||||
fill(): void;
|
||||
fillText(text: string): void;
|
||||
getCanvas(): ICanvas;
|
||||
getContext(): any;
|
||||
getDrawFunc(): any;
|
||||
getFill(): string;
|
||||
getLineJoin(): any;
|
||||
getShadow(): any;
|
||||
getStroke(): any;
|
||||
getStrokeWidth(): number;
|
||||
intersects(point: any): boolean;
|
||||
setDrawFunc(drawFunc: () => any): any;
|
||||
setFill(fill: string): any;
|
||||
setLineJoin(): any;
|
||||
setShadow(config: any): any;
|
||||
setSize(size: ISize): any;
|
||||
setStroke(stroke: string): any;
|
||||
setStrokeWidth(strokeWidth: number): any;
|
||||
stroke(): any;
|
||||
strokeText(text: string): any;
|
||||
}
|
||||
|
||||
var Rect: {
|
||||
new (config: RectConfig): IRect;
|
||||
}
|
||||
|
||||
interface IRect extends IShape {
|
||||
getCornerRadius(): number;
|
||||
getHeight(): number;
|
||||
getWidth(): number;
|
||||
setCornerRadius(radius: number): any;
|
||||
setHeight(height: number): any;
|
||||
setWidth(width: number): any;
|
||||
}
|
||||
|
||||
var Circle: {
|
||||
new (config: CircleConfig): ICircle;
|
||||
|
||||
}
|
||||
|
||||
interface ICircle extends IShape {
|
||||
getRadius(): number;
|
||||
setRadius(radius: number): any;
|
||||
}
|
||||
|
||||
var Ellipse: {
|
||||
new (config: CircleConfig): IEllipse;
|
||||
}
|
||||
|
||||
interface IEllipse extends IShape {
|
||||
getRadius(): number;
|
||||
setRadius(radius: number): any;
|
||||
}
|
||||
|
||||
var Group: {
|
||||
new (config?: ObjectOptionsConfig): IGroup;
|
||||
}
|
||||
|
||||
interface IGroup extends IContainer {
|
||||
}
|
||||
|
||||
var Collection: {
|
||||
new (): ICollection;
|
||||
}
|
||||
|
||||
interface ICollection {
|
||||
apply(method: Function, val: any): any;
|
||||
each(func: () => any): any;
|
||||
}
|
||||
|
||||
var Image: {
|
||||
new (config?: ImageConfig): IImage;
|
||||
}
|
||||
|
||||
interface IImage extends IShape {
|
||||
applyFilter(config: any): any;
|
||||
clearImageBuffer(): any;
|
||||
createImageBuffer(callback: () => any): any;
|
||||
getCrop(): any;
|
||||
getFilter(): any;
|
||||
getHeight(): number;
|
||||
getImage(): IImage;
|
||||
getWidth(): number;
|
||||
setCrop(config: CropConfig): any;
|
||||
setFilter(config: any): any;
|
||||
setHeight(height: number): any;
|
||||
setImage(image: IImage): any;
|
||||
setWidth(width: number): any;
|
||||
}
|
||||
|
||||
var Line: {
|
||||
new (config: LineConfig): ILine;
|
||||
}
|
||||
|
||||
interface ILine extends IShape {
|
||||
getDashArray(): any;
|
||||
getLineCap(): any;
|
||||
getPoints(): any;
|
||||
setDashArray(dashArray: any): any;
|
||||
setLineCap(lineCap: string): any;
|
||||
setPoints(can: any[]): any;
|
||||
}
|
||||
|
||||
var Path: {
|
||||
new (config: PathConfig): IPath;
|
||||
parsePathData(data: string): any;
|
||||
}
|
||||
interface IPath extends IShape {
|
||||
getData(): string;
|
||||
setData(SVG: string): any;
|
||||
}
|
||||
|
||||
var Polygon: {
|
||||
new (config: PolygonConfig): IPolygon;
|
||||
}
|
||||
|
||||
interface IPolygon extends IShape {
|
||||
getPoints(): any;
|
||||
setPoints(points: any): any;
|
||||
}
|
||||
|
||||
var RegularPolygon: {
|
||||
new (config: RegularPolygonConfig): IRegularPolygon;
|
||||
}
|
||||
|
||||
interface IRegularPolygon extends IShape {
|
||||
getRadius(): number;
|
||||
getSides(): number;
|
||||
setRadius(radius: number): any;
|
||||
setSides(sides: number): any;
|
||||
}
|
||||
|
||||
var Sprite: {
|
||||
new (config: SpriteConfig): ISprite;
|
||||
}
|
||||
interface ISprite extends IShape {
|
||||
afterFrame(index: number, func: () => any): any;
|
||||
getAnimation(): string;
|
||||
getAnimations(): any;
|
||||
getIndex(): number;
|
||||
setAnimation(anim: string): any;
|
||||
setAnimations(animations: any): any;
|
||||
setIndex(index: number): any;
|
||||
start(): any;
|
||||
stop(): any;
|
||||
}
|
||||
|
||||
var Star: {
|
||||
new (config: StarConfig): IStar;
|
||||
}
|
||||
interface IStar extends IShape {
|
||||
getInnerRadius(): number;
|
||||
getNumPoints(): number;
|
||||
getOuterRadius(): number;
|
||||
setInnerRadius(radius: number): any;
|
||||
setNumPoints(points: number): any;
|
||||
setOuterRadius(radius: number): any;
|
||||
}
|
||||
|
||||
var Text: {
|
||||
new (config: TextConfig): IText;
|
||||
}
|
||||
interface IText extends IShape {
|
||||
getAlign(): string;
|
||||
getBoxHeight(): number;
|
||||
getBoxWidth(): number;
|
||||
getFontFamily(): string;
|
||||
getFontSize(): number;
|
||||
getFontStyle(): string;
|
||||
getHeight(): number;
|
||||
getLineHeight(): number;
|
||||
getPadding(): number;
|
||||
getShadow(): any;
|
||||
getText(): string;
|
||||
getTextFill(): any;
|
||||
getTextHeight(): number;
|
||||
getTextStroke(): any;
|
||||
getTextStrokeWidth(): number;
|
||||
getTextWidth(): number;
|
||||
getWidth(): number;
|
||||
setAlign(align: string): any;
|
||||
setFontFamily(fontFamily: string): any;
|
||||
setFontSize(fontSize: number): any;
|
||||
setFontStroke(textStroke: any): any;
|
||||
setFontStyle(fontStyle: string): any;
|
||||
setHeight(height: number): any;
|
||||
setLineHeight(lineHeight: number): any;
|
||||
setPadding(padding: number): any;
|
||||
setShadow(config: any): any;
|
||||
setText(text: string): any;
|
||||
setTextFill(textFill: any): any;
|
||||
setTextStrokeWidth(textStrokeWidth: number): any;
|
||||
setWidth(width: number): any;
|
||||
}
|
||||
|
||||
var TextPath: {
|
||||
new (config: any): ITextPath;
|
||||
}
|
||||
interface ITextPath extends IShape {
|
||||
getFontFamily(): string;
|
||||
getFontSize(): number;
|
||||
getFontStyle(): string;
|
||||
getText(): string;
|
||||
getTextFill(): any;
|
||||
getTextHeight(): number;
|
||||
getTextStroke(): any;
|
||||
getTextStrokeWidth(): number;
|
||||
getTextWidth(): number;
|
||||
setFontFamily(fontFamily: string): any;
|
||||
setFontSize(fontSize: number): any;
|
||||
setFontStroke(textStroke: any): any;
|
||||
setFontStyle(fontStyle: string): any;
|
||||
setText(text: string): any;
|
||||
setTextFill(textFill: any): any;
|
||||
setTextStrokeWidth(textStrokeWidth: number): any;
|
||||
}
|
||||
|
||||
var Transition: {
|
||||
new (node: Node, config: any): ITransition;
|
||||
}
|
||||
interface ITransition {
|
||||
start(): any;
|
||||
stop(): any;
|
||||
}
|
||||
|
||||
var Animation: {
|
||||
new (...args: any[]): IAnimation;
|
||||
}
|
||||
interface IAnimation extends IContainer {
|
||||
start(): any;
|
||||
stop(): any;
|
||||
}
|
||||
|
||||
interface CropConfig {
|
||||
x: number;
|
||||
y: number;
|
||||
width: number;
|
||||
height: number;
|
||||
}
|
||||
|
||||
interface StageConfig extends ObjectOptionsConfig {
|
||||
container: string;
|
||||
width: number;
|
||||
height: number;
|
||||
}
|
||||
|
||||
interface LayerConfig extends ObjectOptionsConfig {
|
||||
clearBeforeDraw?: boolean;
|
||||
}
|
||||
|
||||
//shape configs class
|
||||
interface RectConfig extends DrawOptionsConfig, ObjectOptionsConfig {
|
||||
width?: number;
|
||||
height?: number;
|
||||
cornerRadius?: number;
|
||||
}
|
||||
|
||||
interface CircleConfig extends DrawOptionsConfig, ObjectOptionsConfig {
|
||||
radius: number;
|
||||
}
|
||||
|
||||
interface ImageConfig extends DrawOptionsConfig, ObjectOptionsConfig {
|
||||
image: any;
|
||||
width?: number;
|
||||
height?: number;
|
||||
crop?: any;
|
||||
}
|
||||
|
||||
interface SpriteConfig extends DrawOptionsConfig, ObjectOptionsConfig {
|
||||
image: any;
|
||||
animations?: any;
|
||||
animation?: any;
|
||||
frameRate?: number;
|
||||
}
|
||||
|
||||
interface TextConfig extends DrawOptionsConfig, ObjectOptionsConfig {
|
||||
text: string;
|
||||
fontSize?: number;
|
||||
fontFamily?: string;
|
||||
fontStyle?: string;
|
||||
textFill?: any;
|
||||
textStroke?: any;
|
||||
textStrokeWidth?: number;
|
||||
align?: string;
|
||||
padding?: string;
|
||||
width?: number;
|
||||
height?: number;
|
||||
lineHeight?: number;
|
||||
cornerRadius?: number;
|
||||
}
|
||||
|
||||
interface LineConfig extends DrawOptionsConfig, ObjectOptionsConfig {
|
||||
points: any;
|
||||
lineCap?: string;
|
||||
dashArray?: any;
|
||||
}
|
||||
|
||||
interface PolygonConfig extends DrawOptionsConfig, ObjectOptionsConfig {
|
||||
points: any;
|
||||
}
|
||||
|
||||
interface RegularPolygonConfig extends DrawOptionsConfig, ObjectOptionsConfig {
|
||||
sides: number;
|
||||
radius: number;
|
||||
}
|
||||
|
||||
interface PathConfig extends DrawOptionsConfig, ObjectOptionsConfig {
|
||||
data: string;
|
||||
}
|
||||
|
||||
interface StarConfig extends DrawOptionsConfig, ObjectOptionsConfig {
|
||||
numPoints: number;
|
||||
outerRadius: number;
|
||||
innerRadius: number;
|
||||
}
|
||||
|
||||
interface CustomConfig extends DrawOptionsConfig, ObjectOptionsConfig {
|
||||
drawFunc: () => any;
|
||||
}
|
||||
|
||||
interface DrawOptionsConfig {
|
||||
fill?: string;
|
||||
stroke?: string;
|
||||
strokeWidth?: number;
|
||||
lineJoin?: string;
|
||||
shadow?: any;
|
||||
}
|
||||
|
||||
interface Vector2d {
|
||||
x: number;
|
||||
y: number;
|
||||
}
|
||||
|
||||
interface ObjectOptionsConfig {
|
||||
x?: number;
|
||||
y?: number;
|
||||
visible?: boolean;
|
||||
listening?: boolean;
|
||||
id?: string;
|
||||
name?: string;
|
||||
opacity?: any;
|
||||
scale?: Vector2d;
|
||||
rotation?: number;
|
||||
rotationDeg?: number;
|
||||
offset?: Vector2d;
|
||||
draggable?: boolean;
|
||||
dragConstraint?: string;
|
||||
dragBounds?: any;
|
||||
dragBoundFunc?: (pos: Vector2d) => Vector2d;
|
||||
width?: number;
|
||||
height?: number;
|
||||
}
|
||||
|
||||
interface ISize {
|
||||
width: number;
|
||||
height: number;
|
||||
}
|
||||
}
|
||||
+5
@@ -46,3 +46,8 @@ interface KnockoutMapping {
|
||||
interface KnockoutStatic {
|
||||
mapping: KnockoutMapping;
|
||||
}
|
||||
|
||||
declare module "knockout.mapping" {
|
||||
export = mapping;
|
||||
}
|
||||
declare var mapping: KnockoutMapping;
|
||||
|
||||
@@ -144,3 +144,8 @@ interface KnockoutSubscribableFunctions<T> {
|
||||
rules: KnockoutObservableArray<KnockoutValidationRule>;
|
||||
}
|
||||
|
||||
declare module "knockout.validation" {
|
||||
export = validation;
|
||||
}
|
||||
|
||||
declare var validation: KnockoutValidationStatic
|
||||
|
||||
Vendored
+1
-1
@@ -310,7 +310,7 @@ interface KnockoutUtils {
|
||||
|
||||
parseJson(jsonString: string): any;
|
||||
|
||||
stringifyJson(data: any, replacer: Function, space: string): string;
|
||||
stringifyJson(data: any, replacer?: Function, space?: string): string;
|
||||
|
||||
postJson(urlOrForm: any, data: any, options: any): void;
|
||||
|
||||
|
||||
+129
-104
@@ -1,9 +1,33 @@
|
||||
/// <reference path="lazy.js.d.ts" />
|
||||
|
||||
var sequence: LazyJS.Sequence;
|
||||
var arraySeq: LazyJS.ArrayLikeSequence;
|
||||
var objectSeq: LazyJS.ObjectLikeSequence;
|
||||
var asyncSeq: LazyJS.AsyncSequence;
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
interface Foo {
|
||||
foo(): string;
|
||||
}
|
||||
interface Bar {
|
||||
bar(): string;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
var foo: Foo;
|
||||
var bar: Bar;
|
||||
|
||||
var fooArr: Foo[];
|
||||
var barArr: Bar[];
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
var fooSequence: LazyJS.Sequence<Foo>;
|
||||
var barSequence: LazyJS.Sequence<Bar>;
|
||||
var fooArraySeq: LazyJS.ArrayLikeSequence<Foo>;
|
||||
var barArraySeq: LazyJS.ArrayLikeSequence<Bar>;
|
||||
var fooObjectSeq: LazyJS.ObjectLikeSequence<Foo>;
|
||||
var anyObjectSeq: LazyJS.ObjectLikeSequence<any>;
|
||||
var fooAsyncSeq: LazyJS.AsyncSequence<Foo>;
|
||||
|
||||
var strSequence: LazyJS.Sequence<string>;
|
||||
var stringSeq: LazyJS.StringLikeSequence;
|
||||
|
||||
var obj: Object;
|
||||
@@ -23,141 +47,142 @@ function fnErrorCallback(error: any): void {
|
||||
|
||||
}
|
||||
|
||||
function fnValueCallback(value: any): void {
|
||||
function fnValueCallback(value: Foo): void {
|
||||
}
|
||||
|
||||
function fnGetKeyCallback(value: any): string {
|
||||
return '';
|
||||
function fnGetKeyCallback(value: Foo): string {
|
||||
return str;
|
||||
}
|
||||
|
||||
function fnTestCallback(value: any): boolean {
|
||||
return false;
|
||||
function fnTestCallback(value: Foo): boolean {
|
||||
return bool;
|
||||
}
|
||||
|
||||
function fnMapCallback(value: any): any {
|
||||
return null;
|
||||
function fnMapCallback(value: Foo): Bar {
|
||||
return bar;
|
||||
}
|
||||
|
||||
function fnMapStringCallback(value: string): string {
|
||||
return '';
|
||||
return str;
|
||||
}
|
||||
|
||||
function fnNumberCallback(value: any): number {
|
||||
return 0;
|
||||
function fnNumberCallback(value: Foo): number {
|
||||
return num;
|
||||
}
|
||||
|
||||
function fnMemoCallback(memo: any, value: any): any {
|
||||
return null;
|
||||
function fnMemoCallback(memo: Bar, value: Foo): Bar {
|
||||
return bar;
|
||||
}
|
||||
|
||||
function fnGeneratorCallback(index: number): any {
|
||||
return null;
|
||||
function fnGeneratorCallback(index: number): Foo {
|
||||
return foo;
|
||||
}
|
||||
|
||||
// Lazy
|
||||
|
||||
arraySeq = Lazy([]);
|
||||
objectSeq = Lazy({});
|
||||
stringSeq = Lazy('');
|
||||
fooArraySeq = Lazy(fooArr);
|
||||
fooObjectSeq = Lazy<Foo>({a:foo, b:foo});
|
||||
anyObjectSeq = Lazy<any>({a:num, b:str});
|
||||
stringSeq = Lazy(str);
|
||||
|
||||
// Strict
|
||||
|
||||
var Strict = Lazy.strict();
|
||||
arraySeq = Strict([1, 2, num]).pop();
|
||||
fooArraySeq = Strict([foo, foo]).pop();
|
||||
|
||||
// Sequence
|
||||
|
||||
asyncSeq = sequence.async(num);
|
||||
sequence = sequence.chunk(num);
|
||||
sequence = sequence.compact();
|
||||
sequence = sequence.concat(arr);
|
||||
sequence = sequence.consecutive(num);
|
||||
bool = sequence.contains(x);
|
||||
sequence = sequence.countBy(str);
|
||||
sequence = sequence.countBy(fnGetKeyCallback);
|
||||
sequence = sequence.dropWhile(fnTestCallback);
|
||||
sequence = sequence.each(fnValueCallback);
|
||||
bool = sequence.every(fnTestCallback);
|
||||
sequence = sequence.filter(fnTestCallback);
|
||||
sequence = sequence.find(fnTestCallback);
|
||||
sequence = sequence.findWhere(obj);
|
||||
fooAsyncSeq = fooSequence.async(num);
|
||||
fooSequence = fooSequence.chunk(num);
|
||||
fooSequence = fooSequence.compact();
|
||||
fooSequence = fooSequence.concat(arr);
|
||||
fooSequence = fooSequence.consecutive(num);
|
||||
bool = fooSequence.contains(foo);
|
||||
fooSequence = fooSequence.countBy(str);
|
||||
fooObjectSeq = fooSequence.countBy(fnGetKeyCallback);
|
||||
fooSequence = fooSequence.dropWhile(fnTestCallback);
|
||||
fooSequence = fooSequence.each(fnValueCallback);
|
||||
bool = fooSequence.every(fnTestCallback);
|
||||
fooSequence = fooSequence.filter(fnTestCallback);
|
||||
fooSequence = fooSequence.find(fnTestCallback);
|
||||
fooSequence = fooSequence.findWhere(obj);
|
||||
|
||||
x = sequence.first();
|
||||
sequence = sequence.first(num);
|
||||
x = fooSequence.first();
|
||||
fooSequence = fooSequence.first(num);
|
||||
|
||||
sequence = sequence.flatten();
|
||||
objectSeq = sequence.groupBy(fnGetKeyCallback);
|
||||
sequence = sequence.indexOf(x);
|
||||
sequence = sequence.initial();
|
||||
sequence = sequence.initial(num);
|
||||
sequence = sequence.intersection(arr);
|
||||
sequence = sequence.invoke(str);
|
||||
bool = sequence.isEmpty();
|
||||
str = sequence.join();
|
||||
str = sequence.join(str);
|
||||
fooSequence = fooSequence.flatten();
|
||||
fooObjectSeq = fooSequence.groupBy(fnGetKeyCallback);
|
||||
fooSequence = fooSequence.indexOf(x);
|
||||
fooSequence = fooSequence.initial();
|
||||
fooSequence = fooSequence.initial(num);
|
||||
fooSequence = fooSequence.intersection(arr);
|
||||
fooSequence = fooSequence.invoke(str);
|
||||
bool = fooSequence.isEmpty();
|
||||
str = fooSequence.join();
|
||||
str = fooSequence.join(str);
|
||||
|
||||
x = sequence.last();
|
||||
sequence = sequence.last(num);
|
||||
foo = fooSequence.last();
|
||||
fooSequence = fooSequence.last(num);
|
||||
|
||||
sequence = sequence.lastIndexOf(x);
|
||||
sequence = sequence.map(fnMapCallback);
|
||||
x = sequence.max();
|
||||
x = sequence.max(fnNumberCallback);
|
||||
x = sequence.min();
|
||||
x = sequence.min(fnNumberCallback);
|
||||
sequence = sequence.pluck(str);
|
||||
x = sequence.reduce(fnMemoCallback);
|
||||
x = sequence.reduce(fnMemoCallback, x);
|
||||
x = sequence.reduceRight(fnMemoCallback, x);
|
||||
sequence = sequence.reject(fnTestCallback);
|
||||
sequence = sequence.rest(num);
|
||||
sequence = sequence.reverse();
|
||||
sequence = sequence.shuffle();
|
||||
bool = sequence.some();
|
||||
bool = sequence.some(fnTestCallback);
|
||||
sequence = sequence.sortBy(fnNumberCallback);
|
||||
sequence = sequence.sortedIndex(x);
|
||||
sequence = sequence.sum();
|
||||
sequence = sequence.sum(fnNumberCallback);
|
||||
sequence = sequence.takeWhile(fnTestCallback);
|
||||
sequence = sequence.union(arr);
|
||||
sequence = sequence.uniq();
|
||||
sequence = sequence.where(obj);
|
||||
sequence = sequence.without(arr);
|
||||
sequence = sequence.zip(arr);
|
||||
fooSequence = fooSequence.lastIndexOf(foo);
|
||||
barSequence = fooSequence.map(fnMapCallback);
|
||||
foo = fooSequence.max();
|
||||
foo = fooSequence.max(fnNumberCallback);
|
||||
foo = fooSequence.min();
|
||||
foo = fooSequence.min(fnNumberCallback);
|
||||
fooSequence = fooSequence.pluck(str);
|
||||
bar = fooSequence.reduce(fnMemoCallback);
|
||||
bar = fooSequence.reduce(fnMemoCallback, bar);
|
||||
bar = fooSequence.reduceRight(fnMemoCallback, bar);
|
||||
fooSequence = fooSequence.reject(fnTestCallback);
|
||||
fooSequence = fooSequence.rest(num);
|
||||
fooSequence = fooSequence.reverse();
|
||||
fooSequence = fooSequence.shuffle();
|
||||
bool = fooSequence.some();
|
||||
bool = fooSequence.some(fnTestCallback);
|
||||
fooSequence = fooSequence.sortBy(fnNumberCallback);
|
||||
fooSequence = fooSequence.sortedIndex(foo);
|
||||
fooSequence = fooSequence.sum();
|
||||
fooSequence = fooSequence.sum(fnNumberCallback);
|
||||
fooSequence = fooSequence.takeWhile(fnTestCallback);
|
||||
fooSequence = fooSequence.union(fooArr);
|
||||
fooSequence = fooSequence.uniq();
|
||||
fooSequence = fooSequence.where(obj);
|
||||
fooSequence = fooSequence.without(fooArr);
|
||||
fooSequence = fooSequence.zip(arr);
|
||||
|
||||
arr = sequence.toArray();
|
||||
obj = sequence.toObject();
|
||||
fooArr = fooSequence.toArray();
|
||||
obj = fooSequence.toObject();
|
||||
|
||||
// ArrayLikeSequence
|
||||
|
||||
arraySeq = arraySeq.concat();
|
||||
arraySeq = arraySeq.first();
|
||||
arraySeq = arraySeq.first(num);
|
||||
x = arraySeq.get(num);
|
||||
num = arraySeq.length();
|
||||
arraySeq = arraySeq.map(fnMapCallback);
|
||||
arraySeq = arraySeq.pop();
|
||||
arraySeq = arraySeq.rest();
|
||||
arraySeq = arraySeq.rest(num);
|
||||
arraySeq = arraySeq.reverse();
|
||||
arraySeq = arraySeq.shift();
|
||||
arraySeq = arraySeq.slice(num);
|
||||
arraySeq = arraySeq.slice(num, num);
|
||||
fooArraySeq = fooArraySeq.concat();
|
||||
fooArraySeq = fooArraySeq.first();
|
||||
fooArraySeq = fooArraySeq.first(num);
|
||||
foo = fooArraySeq.get(num);
|
||||
num = fooArraySeq.length();
|
||||
barArraySeq = fooArraySeq.map(fnMapCallback);
|
||||
fooArraySeq = fooArraySeq.pop();
|
||||
fooArraySeq = fooArraySeq.rest();
|
||||
fooArraySeq = fooArraySeq.rest(num);
|
||||
fooArraySeq = fooArraySeq.reverse();
|
||||
fooArraySeq = fooArraySeq.shift();
|
||||
fooArraySeq = fooArraySeq.slice(num);
|
||||
fooArraySeq = fooArraySeq.slice(num, num);
|
||||
|
||||
// ObjectLikeSequence
|
||||
|
||||
objectSeq = objectSeq.defaults(obj);
|
||||
sequence = objectSeq.functions();
|
||||
objectSeq = objectSeq.get(str);
|
||||
objectSeq = objectSeq.invert();
|
||||
sequence = objectSeq.keys();
|
||||
objectSeq = objectSeq.omit(strArr);
|
||||
sequence = objectSeq.pairs();
|
||||
objectSeq = objectSeq.pick(strArr);
|
||||
arr = objectSeq.toArray();
|
||||
obj = objectSeq.toObject();
|
||||
sequence = objectSeq.values();
|
||||
fooObjectSeq = fooObjectSeq.defaults(obj);
|
||||
fooSequence = fooObjectSeq.functions();
|
||||
fooObjectSeq = fooObjectSeq.get(str);
|
||||
fooObjectSeq = fooObjectSeq.invert();
|
||||
strSequence = fooObjectSeq.keys();
|
||||
fooObjectSeq = fooObjectSeq.omit(strArr);
|
||||
fooSequence = fooObjectSeq.pairs();
|
||||
fooObjectSeq = fooObjectSeq.pick(strArr);
|
||||
arr = fooObjectSeq.toArray();
|
||||
obj = fooObjectSeq.toObject();
|
||||
fooSequence = fooObjectSeq.values();
|
||||
|
||||
// StringLikeSequence
|
||||
|
||||
@@ -181,8 +206,8 @@ stringSeq = stringSeq.mapString(fnMapStringCallback);
|
||||
stringSeq = stringSeq.match(exp);
|
||||
stringSeq = stringSeq.reverse();
|
||||
|
||||
sequence = stringSeq.split(str);
|
||||
sequence = stringSeq.split(exp);
|
||||
stringSeq = stringSeq.split(str);
|
||||
stringSeq = stringSeq.split(exp);
|
||||
|
||||
bool = stringSeq.startsWith(str);
|
||||
stringSeq = stringSeq.substring(num);
|
||||
|
||||
Vendored
+142
-138
@@ -6,28 +6,31 @@
|
||||
declare module LazyJS {
|
||||
|
||||
interface LazyStatic {
|
||||
(value:string):StringLikeSequence;
|
||||
(value:any[]):ArrayLikeSequence;
|
||||
(value:Object):ObjectLikeSequence;
|
||||
(value:ArrayLike):ArrayLikeSequence;
|
||||
|
||||
(value: string):StringLikeSequence;
|
||||
<T>(value: T[]):ArrayLikeSequence<T>;
|
||||
(value: any[]):ArrayLikeSequence<any>;
|
||||
<T>(value: Object):ObjectLikeSequence<T>;
|
||||
(value: Object):ObjectLikeSequence<any>;
|
||||
|
||||
strict():LazyStatic;
|
||||
|
||||
generate(generatorFn:GeneratorCallback, length?:number):GeneratedSequence;
|
||||
generate<T>(generatorFn: GeneratorCallback<T>, length?: number):GeneratedSequence<T>;
|
||||
|
||||
range(to:number):GeneratedSequence;
|
||||
range(from:number, to:number, step?:number):GeneratedSequence;
|
||||
range(to: number):GeneratedSequence<number>;
|
||||
range(from: number, to: number, step?: number):GeneratedSequence<number>;
|
||||
|
||||
repeat(value:any, count?:number):GeneratedSequence;
|
||||
repeat<T>(value: T, count?: number):GeneratedSequence<T>;
|
||||
|
||||
on(eventType:string):Sequence;
|
||||
on<T>(eventType: string):Sequence<T>;
|
||||
|
||||
readFile(path:string):StringLikeSequence;
|
||||
makeHttpRequest(path:string):StringLikeSequence;
|
||||
readFile(path: string):StringLikeSequence;
|
||||
makeHttpRequest(path: string):StringLikeSequence;
|
||||
}
|
||||
|
||||
interface ArrayLike {
|
||||
interface ArrayLike<T> {
|
||||
length:number;
|
||||
[index:number]:T;
|
||||
}
|
||||
|
||||
interface Callback {
|
||||
@@ -35,212 +38,213 @@ declare module LazyJS {
|
||||
}
|
||||
|
||||
interface ErrorCallback {
|
||||
(error:any):void;
|
||||
(error: any):void;
|
||||
}
|
||||
|
||||
interface ValueCallback {
|
||||
(value:any):void;
|
||||
interface ValueCallback<T> {
|
||||
(value: T):void;
|
||||
}
|
||||
|
||||
interface GetKeyCallback {
|
||||
(value:any):string;
|
||||
interface GetKeyCallback<T> {
|
||||
(value: T):string;
|
||||
}
|
||||
|
||||
interface TestCallback {
|
||||
(value:any):boolean;
|
||||
interface TestCallback<T> {
|
||||
(value: T):boolean;
|
||||
}
|
||||
|
||||
interface MapCallback {
|
||||
(value:any):any;
|
||||
interface MapCallback<T, U> {
|
||||
(value: T):U;
|
||||
}
|
||||
|
||||
interface MapStringCallback {
|
||||
(value:string):string;
|
||||
(value: string):string;
|
||||
}
|
||||
|
||||
interface NumberCallback {
|
||||
(value:any):number;
|
||||
interface NumberCallback<T> {
|
||||
(value: T):number;
|
||||
}
|
||||
|
||||
interface MemoCallback {
|
||||
(memo:any, value:any):any;
|
||||
interface MemoCallback<T, U> {
|
||||
(memo: U, value: T):U;
|
||||
}
|
||||
|
||||
interface GeneratorCallback {
|
||||
(index:number):any;
|
||||
interface GeneratorCallback<T> {
|
||||
(index: number):T;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
interface Iterator {
|
||||
new(sequence:Sequence):Iterator;
|
||||
current():any;
|
||||
interface Iterator<T> {
|
||||
new (sequence: Sequence<T>):Iterator<T>;
|
||||
current():T;
|
||||
moveNext():boolean;
|
||||
}
|
||||
|
||||
interface GeneratedSequence extends Sequence {
|
||||
new(generatorFn:GeneratorCallback, length:number):GeneratedSequence;
|
||||
interface GeneratedSequence<T> extends Sequence<T> {
|
||||
new(generatorFn: GeneratorCallback<T>, length: number):GeneratedSequence<T>;
|
||||
length():number;
|
||||
}
|
||||
|
||||
interface AsyncSequence extends SequenceBase {
|
||||
each(callback:ValueCallback):AsyncHandle;
|
||||
interface AsyncSequence<T> extends SequenceBase<T> {
|
||||
each(callback: ValueCallback<T>):AsyncHandle<T>;
|
||||
}
|
||||
|
||||
interface AsyncHandle {
|
||||
interface AsyncHandle<T> {
|
||||
cancel():void;
|
||||
onComplete(callback:Callback):void;
|
||||
onError(callback:ErrorCallback):void;
|
||||
onComplete(callback: Callback):void;
|
||||
onError(callback: ErrorCallback):void;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
module Sequence {
|
||||
function define(methodName:string[], overrides:Object):Function;
|
||||
function define(methodName: string[], overrides: Object): Function;
|
||||
}
|
||||
|
||||
interface Sequence extends SequenceBase {
|
||||
each(eachFn:ValueCallback):Sequence;
|
||||
interface Sequence<T> extends SequenceBase<T> {
|
||||
each(eachFn: ValueCallback<T>):Sequence<T>;
|
||||
}
|
||||
|
||||
interface SequenceBase extends SequenceBaser {
|
||||
interface SequenceBase<T> extends SequenceBaser<T> {
|
||||
first():any;
|
||||
first(count:number):Sequence;
|
||||
indexOf(value:any, startIndex?:number):Sequence;
|
||||
first(count: number):Sequence<T>;
|
||||
indexOf(value: any, startIndex?: number):Sequence<T>;
|
||||
|
||||
last():any;
|
||||
last(count:number):Sequence;
|
||||
lastIndexOf(value:any):Sequence;
|
||||
last(count: number):Sequence<T>;
|
||||
lastIndexOf(value: any):Sequence<T>;
|
||||
|
||||
reverse():Sequence;
|
||||
reverse():Sequence<T>;
|
||||
}
|
||||
|
||||
interface SequenceBaser {
|
||||
interface SequenceBaser<T> {
|
||||
// TODO improve define() (needs ugly overload)
|
||||
async(interval:number):AsyncSequence;
|
||||
chunk(size:number):Sequence;
|
||||
compact():Sequence;
|
||||
concat(var_args:any[]):Sequence;
|
||||
consecutive(length:number):Sequence;
|
||||
contains(value:any):boolean;
|
||||
countBy(propertyName:string):Sequence;
|
||||
countBy(keyFn:GetKeyCallback):Sequence;
|
||||
dropWhile(predicateFn:TestCallback):Sequence;
|
||||
every(predicateFn:TestCallback):boolean;
|
||||
filter(predicateFn:TestCallback):Sequence;
|
||||
find(predicateFn:TestCallback):Sequence;
|
||||
findWhere(properties:Object):Sequence;
|
||||
async(interval: number):AsyncSequence<T>;
|
||||
chunk(size: number):Sequence<T>;
|
||||
compact():Sequence<T>;
|
||||
concat(var_args: T[]):Sequence<T>;
|
||||
consecutive(length: number):Sequence<T>;
|
||||
contains(value: T):boolean;
|
||||
countBy(keyFn: GetKeyCallback<T>): ObjectLikeSequence<T>;
|
||||
countBy(propertyName: string): ObjectLikeSequence<T>;
|
||||
dropWhile(predicateFn: TestCallback<T>): Sequence<T>;
|
||||
every(predicateFn: TestCallback<T>): boolean;
|
||||
filter(predicateFn: TestCallback<T>): Sequence<T>;
|
||||
find(predicateFn: TestCallback<T>): Sequence<T>;
|
||||
findWhere(properties: Object): Sequence<T>;
|
||||
|
||||
flatten():Sequence;
|
||||
groupBy(keyFn:GetKeyCallback):ObjectLikeSequence;
|
||||
initial(count?:number):Sequence;
|
||||
intersection(var_args:any[]):Sequence;
|
||||
invoke(methodName:string):Sequence;
|
||||
isEmpty():boolean;
|
||||
join(delimiter?:string):string;
|
||||
map(mapFn:MapCallback):Sequence;
|
||||
max(valueFn?:NumberCallback):any;
|
||||
min(valueFn?:NumberCallback):any;
|
||||
pluck(propertyName:string):Sequence;
|
||||
reduce(aggregatorFn:MemoCallback, memo?:any):any;
|
||||
reduceRight(aggregatorFn:MemoCallback, memo:any):any;
|
||||
reject(predicateFn:TestCallback):Sequence;
|
||||
rest(count?:number):Sequence;
|
||||
shuffle():Sequence;
|
||||
some(predicateFn?:TestCallback):boolean;
|
||||
sortBy(sortFn:NumberCallback):Sequence;
|
||||
sortedIndex(value:any):Sequence;
|
||||
sum(valueFn?:NumberCallback):Sequence;
|
||||
takeWhile(predicateFn:TestCallback):Sequence;
|
||||
union(var_args:any[]):Sequence;
|
||||
uniq():Sequence;
|
||||
where(properties:Object):Sequence;
|
||||
without(var_args:any[]):Sequence;
|
||||
zip(var_args:any[]):Sequence;
|
||||
flatten(): Sequence<T>;
|
||||
groupBy(keyFn: GetKeyCallback<T>): ObjectLikeSequence<T>;
|
||||
initial(count?: number): Sequence<T>;
|
||||
intersection(var_args: T[]): Sequence<T>;
|
||||
invoke(methodName: string): Sequence<T>;
|
||||
isEmpty(): boolean;
|
||||
join(delimiter?: string): string;
|
||||
map<U>(mapFn: MapCallback<T, U>): Sequence<U>;
|
||||
|
||||
toArray():any[];
|
||||
toObject():Object;
|
||||
max(valueFn?: NumberCallback<T>): T;
|
||||
min(valueFn?: NumberCallback<T>): T;
|
||||
pluck(propertyName: string): Sequence<T>;
|
||||
reduce<U>(aggregatorFn: MemoCallback<T, U>, memo?: U): U;
|
||||
reduceRight<U>(aggregatorFn: MemoCallback<T, U>, memo: U): U;
|
||||
reject(predicateFn: TestCallback<T>): Sequence<T>;
|
||||
rest(count?: number): Sequence<T>;
|
||||
shuffle(): Sequence<T>;
|
||||
some(predicateFn?: TestCallback<T>): boolean;
|
||||
sortBy(sortFn: NumberCallback<T>): Sequence<T>;
|
||||
sortedIndex(value: T): Sequence<T>;
|
||||
sum(valueFn?: NumberCallback<T>): Sequence<T>;
|
||||
takeWhile(predicateFn: TestCallback<T>): Sequence<T>;
|
||||
union(var_args: T[]): Sequence<T>;
|
||||
uniq(): Sequence<T>;
|
||||
where(properties: Object): Sequence<T>;
|
||||
without(var_args: T[]): Sequence<T>;
|
||||
zip(var_args: T[]): Sequence<T>;
|
||||
|
||||
toArray(): T[];
|
||||
toObject(): Object;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
module ArrayLikeSequence {
|
||||
function define(methodName:string[], overrides:Object):Function;
|
||||
function define(methodName: string[], overrides: Object): Function;
|
||||
}
|
||||
|
||||
interface ArrayLikeSequence extends Sequence {
|
||||
interface ArrayLikeSequence<T> extends Sequence<T> {
|
||||
// define()X;
|
||||
concat():ArrayLikeSequence;
|
||||
first(count?:number):ArrayLikeSequence;
|
||||
get(index:number):any;
|
||||
length():number;
|
||||
map(mapFn:MapCallback):ArrayLikeSequence;
|
||||
pop():ArrayLikeSequence;
|
||||
rest(count?:number):ArrayLikeSequence;
|
||||
reverse():ArrayLikeSequence;
|
||||
shift():ArrayLikeSequence;
|
||||
slice(begin:number, end?:number):ArrayLikeSequence;
|
||||
concat(): ArrayLikeSequence<T>;
|
||||
first(count?: number): ArrayLikeSequence<T>;
|
||||
get(index: number): T;
|
||||
length(): number;
|
||||
map<U>(mapFn: MapCallback<T, U>): ArrayLikeSequence<U>;
|
||||
pop(): ArrayLikeSequence<T>;
|
||||
rest(count?: number): ArrayLikeSequence<T>;
|
||||
reverse(): ArrayLikeSequence<T>;
|
||||
shift(): ArrayLikeSequence<T>;
|
||||
slice(begin: number, end?: number): ArrayLikeSequence<T>;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
module ObjectLikeSequence {
|
||||
function define(methodName:string[], overrides:Object):Function;
|
||||
function define(methodName: string[], overrides: Object): Function;
|
||||
}
|
||||
|
||||
interface ObjectLikeSequence extends Sequence {
|
||||
assign(other:Object):ObjectLikeSequence;
|
||||
interface ObjectLikeSequence<T> extends Sequence<T> {
|
||||
assign(other: Object): ObjectLikeSequence<T>;
|
||||
// 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():any[];
|
||||
toObject():Object;
|
||||
values():Sequence;
|
||||
//async(): X;
|
||||
defaults(defaults: Object): ObjectLikeSequence<T>;
|
||||
functions(): Sequence<T>;
|
||||
get(property: string): ObjectLikeSequence<T>;
|
||||
invert(): ObjectLikeSequence<T>;
|
||||
keys(): Sequence<string>;
|
||||
omit(properties: string[]): ObjectLikeSequence<T>;
|
||||
pairs(): Sequence<T>;
|
||||
pick(properties: string[]): ObjectLikeSequence<T>;
|
||||
toArray(): T[];
|
||||
toObject(): Object;
|
||||
values(): Sequence<T>;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
module StringLikeSequence {
|
||||
function define(methodName:string[], overrides:Object):Function;
|
||||
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;
|
||||
interface StringLikeSequence extends SequenceBaser<string> {
|
||||
charAt(index: number): string;
|
||||
charCodeAt(index: number): number;
|
||||
contains(value: string): boolean;
|
||||
endsWith(suffix: string): boolean;
|
||||
|
||||
first():string;
|
||||
first(count:number):StringLikeSequence;
|
||||
first(): string;
|
||||
first(count: number): StringLikeSequence;
|
||||
|
||||
indexOf(substring:string, startIndex?:number):number;
|
||||
indexOf(substring: string, startIndex?: number): number;
|
||||
|
||||
last():string;
|
||||
last(count:number):StringLikeSequence;
|
||||
last(): string;
|
||||
last(count: number): StringLikeSequence;
|
||||
|
||||
lastIndexOf(substring:string, startIndex?:number):number;
|
||||
mapString(mapFn:MapStringCallback):StringLikeSequence;
|
||||
match(pattern:RegExp):StringLikeSequence;
|
||||
reverse():StringLikeSequence;
|
||||
lastIndexOf(substring: string, startIndex?: number): number;
|
||||
mapString(mapFn: MapStringCallback): StringLikeSequence;
|
||||
match(pattern: RegExp): StringLikeSequence;
|
||||
reverse(): StringLikeSequence;
|
||||
|
||||
split(delimiter:string):Sequence;
|
||||
split(delimiter:RegExp):Sequence;
|
||||
split(delimiter: string): StringLikeSequence;
|
||||
split(delimiter: RegExp): StringLikeSequence;
|
||||
|
||||
startsWith(prefix:string):boolean;
|
||||
substring(start:number, stop?:number):StringLikeSequence;
|
||||
toLowerCase():StringLikeSequence;
|
||||
toUpperCase():StringLikeSequence;
|
||||
startsWith(prefix: string): boolean;
|
||||
substring(start: number, stop?: number): StringLikeSequence;
|
||||
toLowerCase(): StringLikeSequence;
|
||||
toUpperCase(): StringLikeSequence;
|
||||
}
|
||||
}
|
||||
|
||||
declare var Lazy:LazyJS.LazyStatic;
|
||||
declare var Lazy: LazyJS.LazyStatic;
|
||||
|
||||
declare module 'lazy.js' {
|
||||
export = Lazy;
|
||||
|
||||
Vendored
+24
@@ -3457,6 +3457,30 @@ declare module _ {
|
||||
keys(object: any): string[];
|
||||
}
|
||||
|
||||
//_.mapValues
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
* Creates an object with the same keys as object and values generated by running each own
|
||||
* enumerable property of object through the callback. The callback is bound to thisArg and
|
||||
* invoked with three arguments; (value, key, object).
|
||||
*
|
||||
* If a property name is provided for callback the created "_.pluck" style callback will return
|
||||
* the property value of the given element.
|
||||
*
|
||||
* If an object is provided for callback the created "_.where" style callback will return true
|
||||
* for elements that have the properties of the given object, else false.
|
||||
*
|
||||
* @param object The object to iterate over.
|
||||
* @param callback The function called per iteration.
|
||||
* @param thisArg `this` object in `iterator`, optional.
|
||||
* @return Returns a new object with values of the results of each callback execution.
|
||||
*/
|
||||
mapValues<T, TResult>(obj: Dictionary<T>, callback: ObjectIterator<T, TResult>, thisArg?: any): Dictionary<TResult>;
|
||||
mapValues<T>(obj: Dictionary<T>, where: Dictionary<T>): Dictionary<boolean>;
|
||||
mapValues<T, TMapped>(obj: T, pluck: string): TMapped;
|
||||
mapValues<T>(obj: T, callback: ObjectIterator<any, any>, thisArg?: any): T;
|
||||
}
|
||||
|
||||
//_.merge
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user