diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 000000000..c6b70b78d --- /dev/null +++ b/.gitattributes @@ -0,0 +1,22 @@ +# Auto detect text files and perform LF normalization +* text=none + +# Custom for Visual Studio +*.cs diff=csharp +*.sln merge=union +*.csproj merge=union +*.vbproj merge=union +*.fsproj merge=union +*.dbproj merge=union + +# Standard to msysgit +*.doc diff=astextplain +*.DOC diff=astextplain +*.docx diff=astextplain +*.DOCX diff=astextplain +*.dot diff=astextplain +*.DOT diff=astextplain +*.pdf diff=astextplain +*.PDF diff=astextplain +*.rtf diff=astextplain +*.RTF diff=astextplain diff --git a/FPSMeter/FPSMeter.d.ts b/FPSMeter/FPSMeter.d.ts new file mode 100644 index 000000000..ad46873b7 --- /dev/null +++ b/FPSMeter/FPSMeter.d.ts @@ -0,0 +1,43 @@ +// Type definitions for FPSmeter v0.3.0 +// Project: http://darsa.in/fpsmeter/ +// Definitions by: Aaron Lampros +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +interface FPSMeterOptions { + interval?: number; // Update interval in milliseconds. + smoothing?: number; // Spike smoothing strength. 1 means no smoothing. + show?: string; // Whether to show 'fps', or 'ms' = frame duration in milliseconds. + toggleOn?: string; // Toggle between show 'fps' and 'ms' on this event. + decimals?: number; // Number of decimals in FPS number. 1 = 59.9, 2 = 59.94, ... + maxFps?: number; // Max expected FPS value. + threshold?: number; // Minimal tick reporting interval in milliseconds. + position?: string; // Meter position. + zIndex?: number; // Meter Z index. + left?: string; // Meter left offset. + top?: string; // Meter top offset. + right?: string; // Meter right offset. + bottom?: string; // Meter bottom offset. + margin?: string; // Meter margin. Helps with centering the counter when left: 50%; + + theme?: string; // Meter theme. Build in: 'dark', 'light', 'transparent', 'colorful'. + heat?: number; // Allow themes to use coloring by FPS heat. 0 FPS = red, maxFps = green. + + graph?: number; // Whether to show history graph. + history?: number; // How many history states to show in a graph. +} + +declare class FPSMeter { + constructor(anchor?: HTMLElement, options?: FPSMeterOptions); + public tick(): void; + public tickStart(): void; + public pause(): FPSMeter; + public resume(): FPSMeter; + public set(name: string, value: any): FPSMeter; + public showDuration(): FPSMeter; + public showFps(): FPSMeter; + public toggle(): FPSMeter; + public hide(): FPSMeter; + public show(): FPSMeter; + public destroy() : void; +} + diff --git a/README.md b/README.md index 395547a6b..a1e5aee24 100644 --- a/README.md +++ b/README.md @@ -54,8 +54,10 @@ List of Definitions * [File API: Directories and System](http://www.w3.org/TR/file-system-api/) (by [Kon](http://phyzkit.net/)) * [File API: Writer](http://www.w3.org/TR/file-writer-api/) (by [Kon](http://phyzkit.net/)) * [Finite State Machine](https://github.com/jakesgordon/javascript-state-machine) (by [Boris Yankov](https://github.com/borisyankov)) +* [Firebase](https://www.firebase.com/docs/javascript/firebase) (by [Vincent Bortone](https://github.com/vbortone)) * [FlexSlider](http://www.woothemes.com/flexslider/) (by [Diullei Gomes](https://github.com/Diullei)) * [Foundation](http://foundation.zurb.com/) (by [Boris Yankov](https://github.com/borisyankov)) +* [FPSMeter](http://darsa.in/fpsmeter/) (by [Aaron Lampros](https://github.com/alampros)) * [Gamepad](http://www.w3.org/TR/gamepad/) (by [Kon](http://phyzkit.net/)) * [glDatePicker](http://glad.github.com/glDatePicker/) (by [D�niel Tar](https://github.com/qcz)) * [GreenSock Animation Platform (GSAP)](http://www.greensock.com/get-started-js/) (by [Robert S.](https://github.com/codeBelt)) @@ -79,6 +81,7 @@ List of Definitions * [jQuery.BBQ](http://benalman.com/projects/jquery-bbq-plugin/) (by [Adam R. Smith](https://github.com/sunetos)) * [jQuery.contextMenu](http://medialize.github.com/jQuery-contextMenu/) (by [Natan Vivo](https://github.com/nvivo/)) * [jQuery.clientSideLogging](https://github.com/remybach/jQuery.clientSideLogging/) (by [Diullei Gomes](https://github.com/diullei/)) +* [jQuery.Colorbox](http://www.jacklmoore.com/colorbox/) (by [Gidon Junge](https://github.com/gjunge)) * [jQuery.Cookie](https://github.com/carhartl/jquery-cookie) (by [Roy Goode](https://github.com/RoyGoode)) * [jQuery.Cycle](http://jquery.malsup.com/cycle/) (by [Fran�ois Guillot](http://fguillot.developpez.com/)) * [jQuery.dynatree](http://code.google.com/p/dynatree/) (by [Fran�ois de Campredon](https://github.com/fdecampredon)) @@ -86,6 +89,7 @@ List of Definitions * [jQuery.form](http://malsup.com/jquery/form/) (by [Fran�ois Guillot](http://fguillot.developpez.com/)) * [jQuery.Globalize](https://github.com/jquery/globalize) (by [Boris Yankov](https://github.com/borisyankov)) * [jQuery.jNotify](http://jnotify.codeplex.com) (by [James Curran](https://github.com/jamescurran/)) +* [jQuery.noty](http://needim.github.io/noty/) (by [Aaron King](https://github.com/kingdango/)) * [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.timeago](http://timeago.yarp.com/) (by [Fran�ois Guillot](http://fguillot.developpez.com/)) diff --git a/angularjs/angular.d.ts b/angularjs/angular.d.ts index a5e151c81..5182cfe9c 100644 --- a/angularjs/angular.d.ts +++ b/angularjs/angular.d.ts @@ -11,7 +11,7 @@ declare var angular: ng.IAngularStatic; /////////////////////////////////////////////////////////////////////////////// // ng module (angular.js) /////////////////////////////////////////////////////////////////////////////// -module ng { +declare module ng { // All service providers extend this interface interface IServiceProvider { diff --git a/backbone/backbone-tests.ts b/backbone/backbone-tests.ts index f89b73196..2a2bf3b41 100644 --- a/backbone/backbone-tests.ts +++ b/backbone/backbone-tests.ts @@ -1,4 +1,5 @@ /// +/// declare var _, $; @@ -82,7 +83,6 @@ class Employee extends Backbone.Model { } class EmployeeCollection extends Backbone.Collection { - url: string = "../api/employees"; findByName(key) { } } function test_collection() { @@ -111,4 +111,159 @@ function test_collection() { ////////// -Backbone.history.start(); \ No newline at end of file +Backbone.history.start(); + +module v1Changes { + module events { + function test_once() { + var model = new Employee; + model.once('invalid', () => { }, this); + model.once('invalid', () => { }); + } + + function test_listenTo() { + var model = new Employee; + var view = new Backbone.View; + view.listenTo(model, 'invalid', () => { }); + } + + function test_listenToOnce() { + var model = new Employee; + var view = new Backbone.View; + view.listenToOnce(model, 'invalid', () => { }); + } + + function test_stopListening() { + var model = new Employee; + var view = new Backbone.View; + view.stopListening(model, 'invalid', () => { }); + view.stopListening(model, 'invalid'); + view.stopListening(model); + } + } + + module modelandcollection { + function test_url() { + Employee.prototype.url = () => '/employees'; + EmployeeCollection.prototype.url = () => '/employees'; + } + + function test_parse() { + var model = new Employee(); + model.parse('{}', {}); + var collection = new EmployeeCollection; + collection.parse('{}', {}); + } + + function test_toJSON() { + var model = new Employee(); + model.toJSON({}); + var collection = new EmployeeCollection; + collection.toJSON({}); + } + + function test_sync() { + var model = new Employee(); + model.sync(); + var collection = new EmployeeCollection; + collection.sync(); + } + } + + module model { + function test_validationError() { + var model = new Employee; + if (model.validationError) { + console.log('has validation errors'); + } + } + + function test_fetch() { + var model = new Employee({ id: 1 }); + model.fetch({ + success: () => { }, + error: () => { } + }); + } + + function test_set() { + var model = new Employee; + model.set({ name: 'JoeDoe', age: 21 }, { validate: false }); + model.set('name', 'JoeDoes', { validate: false }); + } + + function test_destroy() { + var model = new Employee; + model.destroy({ + wait: true, + success: (m?, response?, options?) => { }, + error: (m?, jqxhr?: JQueryXHR, options?) => { } + }); + + model.destroy({ + success: (m?, response?, options?) => { }, + error: (m?, jqxhr?: JQueryXHR) => { } + }); + + model.destroy({ + success: () => { }, + error: (m?, jqxhr?: JQueryXHR) => { } + }); + } + + function test_save() { + var model = new Employee; + + model.save({ + name: 'Joe Doe', + age: 21 + }, + { + wait: true, + validate: false, + success: (m?, response?, options?) => { }, + error: (m?, jqxhr?: JQueryXHR, options?) => { } + }); + + model.save({ + name: 'Joe Doe', + age: 21 + }, + { + success: () => { }, + error: (m?, jqxhr?: JQueryXHR) => { } + }); + } + + function test_validate() { + var model = new Employee; + + model.validate({ name: 'JoeDoe', age: 21 }, { validateAge: false }) + } + } + + module collection { + function test_fetch() { + var collection = new EmployeeCollection; + collection.fetch({ reset: true }); + } + + function test_create() { + var collection = new EmployeeCollection; + var model = new Employee; + + collection.create(model, { + validate: false + }); + } + } + + module router { + function test_navigate() { + var router = new Backbone.Router; + + router.navigate('/employees', { trigger: true }); + router.navigate('/employees', true); + } + } +} \ No newline at end of file diff --git a/backbone/backbone.d.ts b/backbone/backbone.d.ts index 6ba1d15a6..caf6bfe00 100644 --- a/backbone/backbone.d.ts +++ b/backbone/backbone.d.ts @@ -12,10 +12,6 @@ declare module Backbone { at: number; } - export interface CreateOptions extends Silenceable { - wait: bool; - } - export interface HistoryOptions extends Silenceable { pushState?: bool; root?: string; @@ -33,27 +29,69 @@ declare module Backbone { silent?: bool; } + interface Validable { + validate?: bool; + } + + interface Waitable { + wait?: bool; + } + + interface Parseable { + parse?: any; + } + + export interface PersistenceOptions { + url?: string; + beforeSend?: (jqxhr: JQueryXHR) => void; + success?: (modelOrCollection?: any, response?: any, options?: any) => void; + error?: (modelOrCollection?: any, jqxhr?: JQueryXHR, options?: any) => void; + } + + export interface ModelSetOptions extends Silenceable extends Validable { + } + + export interface ModelFetchOptions extends PersistenceOptions extends ModelSetOptions extends Parseable { + } + + export interface ModelSaveOptions extends Silenceable extends Waitable extends Validable extends Parseable extends PersistenceOptions { + patch?: bool; + } + + export interface ModelDestroyOptions extends Waitable extends PersistenceOptions { + } + + export interface CollectionFetchOptions extends PersistenceOptions extends Parseable { + reset?: bool; + } + interface on { (eventName: string, callback: (...args: any[]) => void, context?: any): any; } interface off { (eventName?: string, callback?: (...args: any[]) => void, context?: any): any; } interface trigger { (eventName: string, ...args: any[]): any; } interface bind { (eventName: string, callback: (...args: any[]) => void, context?: any): any; } interface unbind { (eventName?: string, callback?: (...args: any[]) => void, context?: any): any; } - + declare class Events { on(eventName: string, callback: (...args:any[]) => void, context?: any): any; off(eventName?: string, callback?: (...args:any[]) => void, context?: any): any; trigger(eventName: string, ...args: any[]): any; bind(eventName: string, callback: (...args:any[]) => void, context?: any): any; unbind(eventName?: string, callback?: (...args:any[]) => void, context?: any): any; + + once(events: string, callback: (...args: any[]) => void , context?: any): any; + listenTo(object: any, events: string, callback: (...args: any[]) => void ): any; + listenToOnce(object: any, events: string, callback: (...args: any[]) => void ): any; + stopListening(object?: any, events?: string, callback?: (...args: any[]) => void ): any; } export class ModelBase extends Events { - fetch(options?: JQueryAjaxSettings); url: any; - parse(response); - toJSON(): any; + parse(response, options?: any); + toJSON(options?: any): any; + sync(...arg: any[]): JQueryXHR; } + export class Model extends ModelBase { static extend(properties: any, classProperties?: any): any; // do not use, prefer TypeScript's extend functionality @@ -63,31 +101,34 @@ declare module Backbone { cid: string; id: any; idAttribute: string; - urlRoot() : string; + validationError: any; + urlRoot(): string; constructor (attributes?: any, options?: any); initialize(attributes?: any); + fetch(options?: ModelFetchOptions): JQueryXHR; + get(attributeName: string): any; - set(attributeName: string, value: any, options?: Silenceable); - set(obj: any, options?: Silenceable); + set(attributeName: string, value: any, options?: ModelSetOptions); + set(obj: any, options?: ModelSetOptions); change(); changedAttributes(attributes?: any): any[]; clear(options?: Silenceable); clone(): Model; defaults(): any; - destroy(options?: JQueryAjaxSettings); + destroy(options?: ModelDestroyOptions); escape(attribute: string); has(attribute: string): bool; hasChanged(attribute?: string): bool; isNew(): bool; - isValid(): string; + isValid(): bool; previous(attribute: string): any; previousAttributes(): any[]; - save(attributes?: any, options?: JQueryAjaxSettings); + save(attributes?: any, options?: ModelSaveOptions); unset(attribute: string, options?: Silenceable); - validate(attributes: any): any; + validate(attributes: any, options?: any): any; } export class Collection extends ModelBase { @@ -101,6 +142,8 @@ declare module Backbone { constructor (models?: any, options?: any); + fetch(options?: CollectionFetchOptions): JQueryXHR; + comparator(element: Model): number; comparator(element: Model): string; comparator(compare: Model, to?: Model): number; @@ -109,7 +152,7 @@ declare module Backbone { add(models: Model[], options?: AddOptions); at(index: number): Model; get(id: any): Model; - create(attributes: any, options?: CreateOptions): Model; + create(attributes: any, options?: ModelSaveOptions): Model; pluck(attribute: string): any[]; push(model: Model, options?: AddOptions); pop(options?: Silenceable); @@ -124,6 +167,7 @@ declare module Backbone { all(iterator: (element: Model, index: number) => bool, context?: any): bool; any(iterator: (element: Model, index: number) => bool, context?: any): bool; collect(iterator: (element: Model, index: number, context?: any) => any[], context?: any): any[]; + chain(): any; compact(): Model[]; contains(value: any): bool; countBy(iterator: (element: Model, index: number) => any): any[]; @@ -189,6 +233,7 @@ declare module Backbone { initialize (options?: RouterOptions); route(route: string, name: string, callback?: (...parameter: any[]) => void); navigate(fragment: string, options?: NavigateOptions); + navigate(fragment: string, trigger?: bool); } export var history: History; @@ -204,7 +249,7 @@ declare module Backbone { export interface ViewOptions { model?: Backbone.Model; collection?: Backbone.Collection; - el?: Element; + el?: any; id?: string; className?: string; tagName?: string; @@ -217,20 +262,23 @@ declare module Backbone { constructor (options?: ViewOptions); - $(selector: string): any; + $(selector: string): JQuery; model: Model; + collection: Collection; make(tagName: string, attrs?, opts?): View; setElement(element: HTMLElement, delegate?: bool); + id: string; + className: string; tagName: string; events: any; - el: HTMLElement; - $el; + el: any; + $el: JQuery; setElement(element); attributes; - $(selector); - render(); - remove(); + $(selector): JQuery; + render(): View; + remove(): View; make(tagName, attributes?, content?); //delegateEvents: any; delegateEvents(events?: any): any; diff --git a/chai-jquery/chai-jquery-tests.ts b/chai-jquery/chai-jquery-tests.ts new file mode 100644 index 000000000..fbd05480e --- /dev/null +++ b/chai-jquery/chai-jquery-tests.ts @@ -0,0 +1,68 @@ +///  +///  + +declare var $; +var expect = chai.expect; + +function test_attr() { + expect($('#foo')).to.have.attr('id'); + expect($('#foo')).to.have.attr('class', 'container'); +} + +function test_css() { + expect($('#foo')).to.have.css('color'); + expect($('#foo')).to.have.css('font-family', 'serif'); +} + +function test_data() { + expect($('#foo')).to.have.data('toggle'); + expect($('#foo')).to.have.css('toggle', 'true'); +} + +function test_class() { + expect($('#foo')).to.have.class('container'); +} + +function test_id() { + expect($('#foo')).to.have.id('foo'); +} + +function test_html() { + expect($('#foo')).to.have.html('
bar
'); +} + +function test_text() { + expect($('#foo')).to.have.text('bar'); +} + +function test_value() { + expect($('#foo')).to.have.value('bar'); +} + +function test_visible() { + expect($('#foo')).to.be.visible; +} + +function test_hidden() { + expect($('#foo')).to.be.hidden; +} + +function test_selected() { + expect($('#foo')).to.be.selected; +} + +function test_checked() { + expect($('#foo')).to.be.checked; +} + +function test_disabled() { + expect($('#foo')).to.be.disabled; +} + +function test_be_selector() { + expect($('#foo')).to.be(':empty'); +} + +function test_have_selector() { + expect($('#foo')).to.have('div'); +} \ No newline at end of file diff --git a/chai-jquery/chai-jquery.d.ts b/chai-jquery/chai-jquery.d.ts new file mode 100644 index 000000000..d038c76ff --- /dev/null +++ b/chai-jquery/chai-jquery.d.ts @@ -0,0 +1,37 @@ +// Type definitions for chai-jquery 1.1.1 +// Project: https://github.com/chaijs/chai-jquery +// Definitions by: Kazi Manzur Rashid +// DefinitelyTyped: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module chai { + interface NameValueRegexMatcher { + match(value: RegExp): bool; + } + + interface NameValueMatcher { + (name: string, value?: string): bool; + } + + interface Have { + attr: NameValueMatcher; + css: NameValueMatcher; + data: NameValueMatcher; + class(className: string): bool; + id(id: string): bool; + html(html: string): bool; + text(text: string): bool; + value(text: string): bool; + (selector: string): bool; + } + + interface Be { + visible: bool; + hidden: bool; + selected: bool; + checked: bool; + disabled: bool; + (selector: string): bool; + } +} diff --git a/chai/chai-tests.ts b/chai/chai-tests.ts new file mode 100644 index 000000000..ab26aadbc --- /dev/null +++ b/chai/chai-tests.ts @@ -0,0 +1,90 @@ +/// + +var expect = chai.expect; + +function test_be() { + expect(true).to.be.ok; + expect(true).to.be.true; + expect(false).to.be.false; + expect(null).to.be.null; + expect(undefined).to.be.undefined; + expect([]).to.be.empty; + expect([]).to.be.arguments; + expect({}).to.be.an('object'); + expect({}).to.be.an.instanceof(Object); + expect(5).to.be.at.least(5); + expect(5).to.be.at.gte(5); + expect(5).to.be.at.most(5); + expect(5).to.be.at.lte(5); + expect('').to.be.a('string'); + expect(5).to.be.within(1, 6); + expect(5.001).to.be.closeTo(5, 0.5); +} + +function test_not() { + expect(5).to.not.be.a('string'); +} + +function test_deep() { + expect(5).to.deep.equal(5); + expect({ foo: 'bar' }).to.deep.property('foo', 'bar'); +} + +function test_have() { + expect({ foo: 'bar' }).to.have.property('foo', 'bar'); + expect([]).to.have.length(5); + expect({ foo: 'bar' }).to.have.ownProperty('foo'); + expect('foo-bar').to.have.string('bar'); + expect({ foo: 'bar', baz: 'qux' }).to.have.keys('foo', 'baz'); +} + +function test_exist() { + var obj = { foo: 'bar' }; + expect(obj.foo).to.exist; +} + +function test_equal() { + expect(5).to.equal(5); +} + +function test_include() { + expect('foo-bar').to.include('o-b'); + expect([1,2,3]).to.include(2); + expect({ foo: 'bar', baz: 'qux' }).to.include.keys('foo', 'baz'); + + expect('foo-bar').to.contain('o-b'); + expect([1,2,3]).to.contain(2); + expect({ foo: 'bar', baz: 'qux' }).to.contain.keys('foo', 'baz'); +} + +function test_throw() { + var foo = { + bar: () => { } + }; + + expect(foo.bar).to.throw(new Error); + expect(foo.bar).to.throw('An error'); + expect(foo.bar).to.throw(/error/); +} + +function test_eql() { + var foo = {} + expect(foo).to.eql({}); + expect(foo).to.eqls({}); +} + +function test_match() { + expect('foo-bar').to.match(/foo/); +} + +function test_respondTo() { + var foo = { + bar: () => { } + }; + + expect(foo).to.respondTo('bar'); +} + +function test_satisfy() { + expect(1).to.satisfy((n) => n > 0); +} \ No newline at end of file diff --git a/chai/chai.expect.d.ts b/chai/chai.d.ts similarity index 92% rename from chai/chai.expect.d.ts rename to chai/chai.d.ts index eccb443c4..df9e12382 100644 --- a/chai/chai.expect.d.ts +++ b/chai/chai.d.ts @@ -1,4 +1,9 @@ -declare module chai { +// Type definitions for chai 1.5.0 +// Project: http://chaijs.com/ +// Definitions by: Kazi Manzur Rashid +// DefinitelyTyped: https://github.com/borisyankov/DefinitelyTyped + +declare module chai { interface Equality { (expected: any, message?: string): bool; } diff --git a/d3/d3.d.ts b/d3/d3.d.ts index 6193cce86..eb1c5b2e2 100644 --- a/d3/d3.d.ts +++ b/d3/d3.d.ts @@ -989,6 +989,7 @@ declare module D3 { interface Layout { stack(): StackLayout; pie(): PieLayout; + force(): ForceLayout; } interface StackLayout { @@ -1357,6 +1358,105 @@ declare module D3 { */ irwinHall(count: number): () => number; } + + // force layout definitions + export interface twoDGraphPoint { + id: number; + index: number; + name: string; + px: number; + py: number; + size: number; + weight: number; + x: number; + y: number; + } + + export interface graphNode extends twoDGraphPoint { + fixed: bool; + children: graphNode[]; + _children: graphNode[]; + } + + export interface graphLink { + source: graphNode; + target: graphNode; + } + + + export interface ForceLayout { + (): ForceLayout; + size: { + (): number; + (mysize: number[]): ForceLayout; + (accessor: (d: any, index: number) => {}): ForceLayout; + + }; + + linkDistance: { + (): number; + (number): ForceLayout; + (accessor: (d: any, index: number) => number): ForceLayout; + }; + + linkStrength: + { + (): number; + (number): ForceLayout; + (accessor: (d: any, index: number) => number): ForceLayout; + }; + + friction: + { + (): number; + (number): ForceLayout; + (accessor: (d: any, index: number) => number): ForceLayout; + }; + + + alpha: { + (): number; + (number): ForceLayout; + (accessor: (d: any, index: number) => number): ForceLayout; + }; + charge: { + (): number; + (number): ForceLayout; + (accessor: (d: any, index: number) => number): ForceLayout; + }; + + theta: { + (): number; + (number): ForceLayout; + (accessor: (d: any, index: number) => number): ForceLayout; + }; + + gravity: { + (): number; + (number): ForceLayout; + (accessor: (d: any, index: number) => number): ForceLayout; + }; + + links: { + (): graphLink[]; + (arLinks: graphLink[]): ForceLayout; + + }; + nodes: + { + (): graphNode[]; + (arNodes: graphNode[]): ForceLayout; + + }; + start(): ForceLayout; + resume(): ForceLayout; + stop(): ForceLayout; + tick(): ForceLayout; + on(type: string, listener: () => void ): ForceLayout; + drag(): ForceLayout; + } + + } declare var d3: D3.Base; diff --git a/fabricjs/fabricjs.d.ts b/fabricjs/fabricjs.d.ts index 256e4cb41..e3f8da18b 100644 --- a/fabricjs/fabricjs.d.ts +++ b/fabricjs/fabricjs.d.ts @@ -526,6 +526,7 @@ declare module fabric { getContext(): CanvasRenderingContext2D; getElement(): HTMLCanvasElement; getHeight(): number; + getObjects(): IObject[]; getWidth(): number; insertAt(object: IObject, index: number, nonSplicing: bool): ICanvas; isEmpty(): bool; diff --git a/firebase/firebase-tests.ts b/firebase/firebase-tests.ts new file mode 100644 index 000000000..dfde8d560 --- /dev/null +++ b/firebase/firebase-tests.ts @@ -0,0 +1,74 @@ +/// +var AUTH_TOKEN: string = "12345"; +var dataRef:Firebase = new Firebase("https://SampleChat.firebaseio-demo.com/"); +//Log me in +dataRef.auth(AUTH_TOKEN, function(error, result) { + if(error) { + console.log("Login Failed!", error); + } else { + console.log('Authenticated successfully with payload:', result.auth); + console.log('Auth expires at:', new Date(result.expires * 1000)); + } +}); + +//Time to log out! +dataRef.unauth(); + +var usersRef:Firebase = new Firebase('https://SampleChat.firebaseIO-demo.com/users/'); +var fredRef:Firebase = usersRef.child('fred'); +var fredFirstNameRef:Firebase = fredRef.child('name/first'); +var x:string = fredFirstNameRef.toString(); +// x is now 'https://SampleChat.firebaseIO-demo.com/users/fred/name/first'. + +var usersRef2:Firebase = new Firebase('https://SampleChat.firebaseIO-demo.com/users/'); +var sampleChatRef:Firebase = usersRef2.parent(); +var x2:string = sampleChatRef.toString(); +// x is now 'https://SampleChat.firebaseIO-demo.com'. +var y:Firebase = sampleChatRef.parent(); +// y is now null, since sampleChatRef refers to the root of the Firebase. + +var fredRef2:Firebase = new Firebase('https://SampleChat.firebaseIO-demo.com/users/fred'); +var sampleChatRef2 :Firebase= fredRef2.root(); +var x3:string = sampleChatRef2.toString(); +// x is now 'https://SampleChat.firebaseIO-demo.com'. + +var fredRef3:Firebase = new Firebase('https://SampleChat.firebaseIO-demo.com/users/fred'); +var x4:string = fredRef3.name(); +// x is now 'fred'. + +// Increment Fred's rank by 1. +var fredRankRef:Firebase = new Firebase('https://SampleChat.firebaseIO-demo.com/users/fred/rank'); +fredRankRef.transaction(function(currentRank: number) { + return currentRank+1; +}); + +// Try to create a user for wilma, but only if the user id 'wilma' isn't already taken. +var wilmaRef: Firebase = new Firebase('https://SampleChat.firebaseIO-demo.com/users/wilma'); +wilmaRef.transaction(function(currentData) { + if (currentData === null) { + return {name: {first: 'Wilma', last: 'Flintstone'} }; + } else { + console.log('User wilma already exists.'); + return; // Abort the transaction. + } +}, function(error: any, committed: bool, snapshot: IFirebaseDataSnapshot) { + if (error) + console.log('Transaction failed abnormally!', error); + else if (!committed) + console.log('We aborted the transaction (because wilma already exists).'); + else + console.log('User wilma added!'); + console.log('Wilma\'s data: ', snapshot.val()); +}); + +var messageListRef: Firebase = new Firebase('https://SampleChat.firebaseIO-demo.com/message_list'); +var lastMessagesQuery:IFirebaseQuery = messageListRef.endAt().limit(500); +lastMessagesQuery.on('child_added', function(childSnapshot: IFirebaseDataSnapshot) { /* handle child add */ }); + +var messageListRef2:Firebase = new Firebase('https://SampleChat.firebaseIO-demo.com/message_list'); +var firstMessagesQuery:IFirebaseQuery = messageListRef2.startAt().limit(500); +firstMessagesQuery.on('child_added', function(childSnapshot: IFirebaseDataSnapshot) { /* handle child add */ }); + +var usersRef3: Firebase = new Firebase('https://SampleChat.firebaseIO-demo.com/users'); +var usersQuery: IFirebaseQuery = usersRef3.startAt(1000).limit(50); +usersQuery.on('child_added', function(userSnapshot: IFirebaseDataSnapshot) { /* handle user */ }); diff --git a/firebase/firebase.d.ts b/firebase/firebase.d.ts new file mode 100644 index 000000000..f50919134 --- /dev/null +++ b/firebase/firebase.d.ts @@ -0,0 +1,74 @@ +// Type definitions for Firebase API +// Project: https://www.firebase.com/docs/javascript/firebase/index.html +// Definitions by: Vincent Botone +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +interface IFirebaseAuthResult { + auth: any; + expires: number; +} + +interface IFirebaseDataSnapshot { + val(): any; + child(): IFirebaseDataSnapshot; + forEach(childAction: (childSnapshot: IFirebaseDataSnapshot) => bool): bool; + hasChild(childPath: string): bool; + hasChildren(): bool; + name(): string; + numChildren(): number; + ref(): Firebase; + getPriority(): string; + getPriority(): number; + exportVal(): Object; +} + +interface IFirebaseOnDisconnect { + set(value: any, onComplete?: (error: any) => void): void; + setWithPriority(value: any, priority: string, onComplete?: (error: any) => void): void; + setWithPriority(value: any, priority: number, onComplete?: (error: any) => void): void; + update(value: any, onComplete?: (error: any) => void): void; + remove(onComplete?: (error: any) => void): void; + cancel(onComplete?: (error: any) => void): void; +} + +interface IFirebaseQuery { + on(eventType: string, callback: (dataSnapshot: IFirebaseDataSnapshot, prevChildName?: string) => void, cancelCallback?: ()=> void, context?: Object): (dataSnapshot: IFirebaseDataSnapshot, prevChildName?: string) => void; + off(eventType?: string, callback?: (dataSnapshot: IFirebaseDataSnapshot, prevChildName?: string) => void, context?: Object): void; + once(eventType: string, successCallback: (dataSnapshot: IFirebaseDataSnapshot) => void, failureCallback?: () => void, context?: Object): void; + limit(limit: number): IFirebaseQuery; + startAt(priority?: string, name?: string): IFirebaseQuery; + startAt(priority?: number, name?: string): IFirebaseQuery; + endAt(priority?: string, name?: string): IFirebaseQuery; + endAt(priority?: number, name?: string): IFirebaseQuery; + ref(): Firebase; +} + +class Firebase implements IFirebaseQuery { + constructor(firebaseURL: string); + auth(authToken: string, onComplete?: (error: string, result: IFirebaseAuthResult) => void, onCancel?:(error: string) => void): void; + unauth(): void; + child(childPath: string): Firebase; + parent(): Firebase; + root(): Firebase; + name(): string; + toString(): string; + set(value: any, onComplete?: (error: any) => void): void; + update(value: any, onComplete?: (error: any) => void): void; + remove(onComplete?: (error: any) => void); + push(value: any, onComplete?: (error: any) => void): Firebase; + setWithPriority(value: any, priority: string, onComplete?: (error: any) => void): void; + setWithPriority(value: any, priority: number, onComplete?: (error: any) => void): void; + setPriority(priority: string, onComplete?: (error: any) => void): void; + setPriority(priority: number, onComplete?: (error: any) => void): void; + transaction(updateFunction: (currentData: any)=> any, onComplete?: (error: any, committed: bool, snapshot: IFirebaseDataSnapshot) => void, applyLocally?: bool): void; + onDisconnect(): IFirebaseOnDisconnect; + on(eventType: string, callback: (dataSnapshot: IFirebaseDataSnapshot, prevChildName?: string) => void, cancelCallback?: ()=> void, context?: Object): (dataSnapshot: IFirebaseDataSnapshot, prevChildName?: string) => void; + off(eventType?: string, callback?: (dataSnapshot: IFirebaseDataSnapshot, prevChildName?: string) => void, context?: Object): void; + once(eventType: string, successCallback: (dataSnapshot: IFirebaseDataSnapshot) => void, failureCallback?: () => void, context?: Object): void; + limit(limit: number): IFirebaseQuery; + startAt(priority?: string, name?: string): IFirebaseQuery; + startAt(priority?: number, name?: string): IFirebaseQuery; + endAt(priority?: string, name?: string): IFirebaseQuery; + endAt(priority?: number, name?: string): IFirebaseQuery; + ref(): Firebase; +} \ No newline at end of file diff --git a/googlemaps/google.maps.d.ts b/googlemaps/google.maps.d.ts index 1973c1580..44bf78223 100644 --- a/googlemaps/google.maps.d.ts +++ b/googlemaps/google.maps.d.ts @@ -91,6 +91,8 @@ declare module google.maps { mapMaker?: bool; mapTypeControl?: bool; mapTypeControlOptions?: MapTypeControlOptions; + navigationControl?: bool; + navigationControlOptions?: NavigationControlOptions; mapTypeId?: MapTypeId; maxZoom?: number; minZoom?: number; @@ -184,6 +186,18 @@ declare module google.maps { TOP_RIGHT } + export interface NavigationControlOptions { + position?: ControlPosition; + style?: NavigationControlStyle; + } + + export enum NavigationControlStyle { + DEFAULT, + SMALL, + ANDROID, + ZOOM_PAN + } + /***** Overlays *****/ export class Marker extends MVCObject { static MAX_ZINDEX: number; @@ -321,7 +335,7 @@ declare module google.maps { export interface PolylineOptions { clickable?: bool; - draggable: bool; + draggable?: bool; editable?: bool; geodesic?: bool; icons?: IconSequence[]; diff --git a/jasmine/jasmine.d.ts b/jasmine/jasmine.d.ts index 4562984d8..25581904f 100644 --- a/jasmine/jasmine.d.ts +++ b/jasmine/jasmine.d.ts @@ -31,7 +31,7 @@ declare module jasmine { function any(aclass: any); function createSpy(name: string): Spy; function createSpyObj(baseName: string, methodNames: any[]): any; - + function pp(value: any): string; function getEnv(): Env; interface Any { @@ -145,6 +145,12 @@ declare module jasmine { new (env: Env, actual, spec: Env, isNot?: bool); + env: Env; + actual: any; + spec: Env; + isNot?: bool; + message(): any; + toBe(expected): bool; toNotBe(expected): bool; toEqual(expected): bool; @@ -232,6 +238,8 @@ declare module jasmine { } interface Spy { + (...params: any[]): any; + identity: string; calls: any[]; mostRecentCall: { args: any[]; }; @@ -295,4 +303,4 @@ declare module jasmine { } export var HtmlReporter: any; -} \ No newline at end of file +} diff --git a/jquery.colorbox/jquery.colorbox-tests.ts b/jquery.colorbox/jquery.colorbox-tests.ts new file mode 100644 index 000000000..0a1da0bd7 --- /dev/null +++ b/jquery.colorbox/jquery.colorbox-tests.ts @@ -0,0 +1,30 @@ +/// +/// + +//Image gallery +var gallery : JQuery = $('a.gallery').colorbox({ rel: 'gal' }); + +// Ajax usage +var jQueryElement: JQuery = jQuery("a#login").colorbox(); + +// Programmatic use + +var result1: any = jQuery.colorbox({ href: "thankyou.html" }); +var result2: any = jQuery.colorbox({ html: "

Welcome

" }); +var result3: any = $("a.gallery").colorbox({ + rel: 'gal', title: function () { + var url = $(this).attr('href'); + return 'Open In New Window'; + } +}); + +// Helpers + +jQuery.colorbox.close(); +jQuery.colorbox.next(); +jQuery.colorbox.prev(); +var result4: JQuery = jQuery.colorbox.element(); +jQuery.colorbox.remove(); +jQuery.colorbox.resize(); +jQuery.colorbox.resize({ height: 500, width: 300 }); + diff --git a/jquery.colorbox/jquery.colorbox.d.ts b/jquery.colorbox/jquery.colorbox.d.ts new file mode 100644 index 000000000..76e215cdb --- /dev/null +++ b/jquery.colorbox/jquery.colorbox.d.ts @@ -0,0 +1,295 @@ +/// + +// Type definitions for jQuery.Colorbox 1.4.15 +// Project: http://www.jacklmoore.com/colorbox/ +// Definitions by: Gidon Junge <@gjunge> +// Definitions: https://github.com/borisyankov/DefinitelyTyped/ + +interface ColorboxResizeSettings { + height?: number; + innerHeight?: number; + width?: number; + innerWidth?: number; +} + +interface ColorboxSettings { + /** + * The transition type. Can be set to "elastic", "fade", or "none". + */ + transition?: string; + /** + * Sets the speed of the fade and elastic transitions, in milliseconds. + */ + speed?: number; + /** + * This can be used as an alternative anchor URL or to associate a URL for non-anchor elements such as images or form buttons. + */ + href?: any; + /** + * This can be used as an anchor title alternative for Colorbox. + */ + title?: any; + /** + * This can be used as an anchor rel alternative for Colorbox. + */ + rel?: any; + /** + * If true, and if maxWidth, maxHeight, innerWidth, innerHeight, width, or height have been defined, Colorbox will scale photos to fit within the those values. + */ + scalePhotos?: bool; + /** + * If false, Colorbox will hide scrollbars for overflowing content. + */ + scrolling?: bool; + /** + * The overlay opacity level. Range: 0 to 1. + */ + opacity?: number; + /** + * If true, Colorbox will immediately open. + */ + open?: bool; + /** + * If true, focus will be returned when Colorbox exits to the element it was launched from. + */ + returnFocus?: bool; + /** + * If false, the loading graphic removal and onComplete event will be delayed until iframe's content has completely loaded. + */ + fastIframe?: bool; + /** + * Allows for preloading of 'Next' and 'Previous' content in a group, after the current content has finished loading. Set to false to disable. + */ + preloading?: bool; + /** + * If false, disables closing Colorbox by clicking on the background overlay. + */ + overlayClose?: bool; + /** + * If false, will disable closing colorbox on 'esc' key press. + */ + escKey?: bool; + /** + * If false, will disable the left and right arrow keys from navigating between the items in a group. + */ + arrowKey?: bool; + /** + * If false, will disable the ability to loop back to the beginning of the group when on the last element. + */ + loop?: bool; + /** + * For submitting GET or POST values through an ajax request. The data property will act exactly like jQuery's .load() data argument, as Colorbox uses .load() for ajax handling. + */ + data?: any; + /** + * Adds a given class to colorbox and the overlay. + */ + className?: any; + /** + * Sets the fadeOut speed, in milliseconds, when closing Colorbox. + */ + fadeOut?: number; + /** + * Text or HTML for the group counter while viewing a group. {current} and {total} are detected and replaced with actual numbers while Colorbox runs. + */ + current?: string; + /** + * Text or HTML for the previous button while viewing a group. + */ + previous?: string; + /** + * Text or HTML for the next button while viewing a group. + */ + next?: string; + /** + * Text or HTML for the close button. The 'esc' key will also close Colorbox. + */ + close?: string; + /** + * Error message given when ajax content for a given URL cannot be loaded. + */ + xhrError?: string; + /** + * Error message given when a link to an image fails to load. + */ + imgError?: string; + /** + * If true, specifies that content should be displayed in an iFrame. + */ + iframe?: bool; + /** + * If true, content from the current document can be displayed by passing the href property a jQuery selector, or jQuery object. + */ + inline?: bool; + /** + * For displaying a string of HTML or text: $.colorbox({html:"

Hello

"}); + */ + html?: any; + /** + * If true, this setting forces Colorbox to display a link as a photo. Use this when automatic photo detection fails (such as using a url like 'photo.php' instead of 'photo.jpg') + */ + photo?: bool; + /** + * This property isn't actually used as Colorbox assumes all hrefs should be treated as either ajax or photos, unless one of the other content types were specified. + */ + ajax?: any; + /** + * Set a fixed total width. This includes borders and buttons. Example: "100%", "500px", or 500 + */ + width?: any; + /** + * Set a fixed total height. This includes borders and buttons. Example: "100%", "500px", or 500 + */ + height?: any; + /** + * This is an alternative to 'width' used to set a fixed inner width. This excludes borders and buttons. Example: "50%", "500px", or 500 + */ + innerWidth?: any; + /** + * This is an alternative to 'height' used to set a fixed inner height. This excludes borders and buttons. Example: "50%", "500px", or 500 + */ + innerHeight?: any; + /** + * Set the initial width, prior to any content being loaded. + */ + initialWidth?: number; + /** + * Set the initial height, prior to any content being loaded. + */ + initialHeight?: number; + /** + * Set a maximum width for loaded content. Example: "100%", 500, "500px" + */ + maxWidth?: any; + /** + * Set a maximum height for loaded content. Example: "100%", 500, "500px" + */ + maxHeight?: any; + /** + * If true, adds an automatic slideshow to a content group / gallery. + */ + slideshow?: bool; + /** + * Sets the speed of the slideshow, in milliseconds. + */ + slideshowSpeed?: number; + /** + * If true, the slideshow will automatically start to play. + */ + slideshowAuto?: bool; + /** + * Text for the slideshow start button. + */ + slideshowStart?: string; + /** + * Text for the slideshow stop button + */ + slideshowStop?: string; + /** + * If true, Colorbox will be displayed in a fixed position within the visitor's viewport. This is unlike the default absolute positioning relative to the document. + */ + fixed?: bool; + /** + * Accepts a pixel or percent value (50, "50px", "10%"). Controls Colorbox's vertical positioning instead of using the default position of being centered in the viewport. + */ + top?: any; + /** + * Accepts a pixel or percent value (50, "50px", "10%"). Controls Colorbox's vertical positioning instead of using the default position of being centered in the viewport. + */ + bottom?: any; + /** + * Accepts a pixel or percent value (50, "50px", "10%"). Controls Colorbox's horizontal positioning instead of using the default position of being centered in the viewport. + */ + left?: any; + /** + * Accepts a pixel or percent value (50, "50px", "10%"). Controls Colorbox's horizontal positioning instead of using the default position of being centered in the viewport. + */ + right?: any; + /** + * Repositions Colorbox if the window's resize event is fired. + */ + reposition?: bool; + /** + * If true, Colorbox will scale down the current photo to match the screen's pixel ratio + */ + retinaImage?: bool; + /** + * If true and the device has a high resolution display, Colorbox will replace the current photo's file extention with the retinaSuffix+extension + */ + retinaUrl?: bool; + /** + * If retinaUrl is true and the device has a high resolution display, the href value will have it's extention extended with this suffix. For example, the default value would change `my-photo.jpg` to `my-photo@2x.jpg` + */ + retinaSuffix?: string; + /** + * Callback that fires right before Colorbox begins to open. + */ + onOpen?: any; + /** + * Callback that fires right before attempting to load the target content. + */ + onLoad?: any; + /** + * Callback that fires right after loaded content is displayed. + */ + onComplete?: any; + /** + * Callback that fires at the start of the close process. + */ + onCleanup?: any; + /** + * Callback that fires once Colorbox is closed. + */ + onClosed?: any; +} + +interface ColorboxStatic { + + /** + * This method allows you to call Colorbox without having to assign it to an element. + */ + (settings: ColorboxSettings); + /** + * This method moves to the next item in a group and are the same as pressing the 'next' or 'previous' buttons. + */ + next(): void; + /** + * This method moves to the previous item in a group and are the same as pressing the 'next' or 'previous' buttons. + */ + prev(): void; + /** + * This method initiates the close sequence, which does not immediately complete. The lightbox will be completely closed only when the cbox_closed event / onClosed callback is fired. + */ + close(): void; + /** + * This method is used to fetch the current HTML element that Colorbox is associated with. + */ + element(): JQuery; + /** + * This allows Colorbox to be resized based on it's own auto-calculations, or to a specific size. This must be called manually after Colorbox's content has loaded. + */ + resize(): void; + /** + * This allows Colorbox to be resized based on it's own auto-calculations, or to a specific size. This must be called manually after Colorbox's content has loaded. + */ + resize(settings: ColorboxResizeSettings): void; + /** + * Removes all traces of Colorbox from the document. + */ + remove(): void; + +} + +interface Colorbox { + (): JQuery; + (settings: ColorboxSettings): JQuery; + +} + +interface JQueryStatic { + colorbox: ColorboxStatic; +} + +interface JQuery { + colorbox: Colorbox; +} \ No newline at end of file diff --git a/jquery.noty/jquery.noty.d.ts b/jquery.noty/jquery.noty.d.ts new file mode 100644 index 000000000..975bc39b1 --- /dev/null +++ b/jquery.noty/jquery.noty.d.ts @@ -0,0 +1,67 @@ +// Typescript type definitions for jQuery.noty v2.0 by Nedim Carter +// Project: http://needim.github.io/noty/ +// Definitions by: Aaron King +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +interface NotyOptions { + layout?: string; + theme?: string; + type?: string; + text?: string; + dismissQueue?: bool; + template?: string; + animation?: NotyAnimationOptions; + timeout?: number; + force?: bool; + modal?: bool; + closeWith?: Array; + callback?: NotyCallbackOptions; + buttons?: any; +} + +interface NotyAnimationOptions { + open?: any; + close?: any; + easing?: string; + speed?: number; +} + +interface NotyCallbackOptions { + onShow?: Function; + afterShow?: Function; + onClose?: Function; + afterClose?: Function; +} + +interface NotyStatic { + + (notyOptions: NotyOptions); + + get(id: any); + close(id: any); + clearQueue(); + closeAll(); + setText(id: any, text: string); + setType(id: any, type: string); + +} + +interface JQueryStatic { + noty: NotyStatic; +} + +declare var noty: { + + (notyOptions: NotyOptions); + + show(); + close(); + setText(text: string); + setType(type: string); + setTimeout(timeout: number); + + closed: bool; + shown: bool; +} \ No newline at end of file diff --git a/jquery/jquery-tests.ts b/jquery/jquery-tests.ts index 84ac9344e..d3e4b72bd 100644 --- a/jquery/jquery-tests.ts +++ b/jquery/jquery-tests.ts @@ -2279,4 +2279,12 @@ function test_parseHTML() { $( "
    " ) .append( nodeNames.join( "" ) ) .appendTo( $log ); +} + +function test_EventIsNewable() { + var ev = new jQuery.Event('click'); +} + +function test_EventIsCallable() { + var ev = jQuery.Event('click'); } \ No newline at end of file diff --git a/jquery/jquery.d.ts b/jquery/jquery.d.ts index 2b020a7be..bb7889a6b 100644 --- a/jquery/jquery.d.ts +++ b/jquery/jquery.d.ts @@ -89,7 +89,7 @@ interface JQueryPromise { state(): string; pipe(doneFilter?: (x: any) => any, failFilter?: (x: any) => any, progressFilter?: (x: any) => any): JQueryPromise; then(doneCallbacks: any, failCallbacks?: any, progressCallbacks?: any): JQueryPromise; - promise(target?): JQueryPromise; + promise(target?): JQueryPromise; } /* @@ -282,7 +282,10 @@ interface JQueryStatic { (fn?: (d: JQueryDeferred) => any): JQueryDeferred; new(fn?: (d: JQueryDeferred) => any): JQueryDeferred; }; - Event(name:string, eventProperties?:any): JQueryEventObject; + Event: { + (name:string, eventProperties?:any): JQueryEventObject; + new(name:string, eventProperties?:any): JQueryEventObject; + }; /********* INTERNALS diff --git a/jqueryui/jqueryui.d.ts b/jqueryui/jqueryui.d.ts index f3c9e7e42..7e5c4b55b 100644 --- a/jqueryui/jqueryui.d.ts +++ b/jqueryui/jqueryui.d.ts @@ -1,954 +1,954 @@ -// Type definitions for jQueryUI 1.9 -// Project: http://jqueryui.com/ -// Definitions by: Boris Yankov -// Definitions: https://github.com/borisyankov/DefinitelyTyped - - -/// - - -// Accordion ////////////////////////////////////////////////// - -interface AccordionOptions { - active?: any; // bool or number - animate?: any; // bool, number, string or object - collapsible?: bool; - disabled?: bool; - event?: string; - header?: string; - heightStyle?: string; - icons?: any; -} - -interface AccordionUIParams { - newHeader: JQuery; - oldHeader: JQuery; - newPanel: JQuery; - oldPanel: JQuery; -} - -interface AccordionEvent { - (event: Event, ui: AccordionUIParams): void; -} - -interface AccordionEvents { - activate?: AccordionEvent; - beforeActivate?: AccordionEvent; - create?: AccordionEvent; -} - -interface Accordion extends Widget, AccordionOptions, AccordionEvents { -} - - -// Autocomplete ////////////////////////////////////////////////// - -interface AutocompleteOptions { - appendTo?: any; //Selector; - autoFocus?: bool; - delay?: number; - disabled?: bool; - minLength?: number; - position?: string; - source?: any; // [], string or () -} - -interface AutocompleteUIParams { - -} - -interface AuotcompleteEvent { - (event: Event, ui: AutocompleteUIParams): void; -} - -interface AutocompleteEvents { - change?: AuotcompleteEvent; - close?: AuotcompleteEvent; - create?: AuotcompleteEvent; - focus?: AuotcompleteEvent; - open?: AuotcompleteEvent; - response?: AuotcompleteEvent; - search?: AuotcompleteEvent; - select?: AuotcompleteEvent; -} - -interface Autocomplete extends Widget, AutocompleteOptions, AutocompleteEvents { - escapeRegex: (string) => string; -} - - -// Button ////////////////////////////////////////////////// - -interface ButtonOptions { - disabled?: bool; - icons?: any; - label?: string; - text?: bool; -} - -interface Button extends Widget, ButtonOptions { -} - - -// Datepicker ////////////////////////////////////////////////// - -interface DatepickerOptions { - altFieldType?: any; // Selecotr, jQuery or Element - altFormat?: string; - appendText?: string; - autoSize?: bool; - beforeShow?: (input: Element, inst: any) => void; - beforeShowDay?: (date: Date) => void; - buttonImage?: string; - buttonImageOnly?: bool; - buttonText?: string; - calculateWeek?: () => any; - changeMonth?: bool; - changeYear?: bool; - closeText?: string; - constrainInput?: bool; - currentText?: string; - dateFormat?: string; - dayNames?: string[]; - dayNamesMin?: string[]; - dayNamesShort?: string[]; - defaultDateType?: any; // Date, number or string - duration?: string; - firstDay?: number; - gotoCurrent?: bool; - hideIfNoPrevNext?: bool; - isRTL?: bool; - maxDate?: any; // Date, number or string - minDate?: any; // Date, number or string - monthNames?: string[]; - monthNamesShort?: string[]; - navigationAsDateFormat?: bool; - nextText?: string; - numberOfMonths?: any; // number or [] - onChangeMonthYear?: (year: number, month: number, inst: any) => void; - onClose?: (dateText: string, inst: any) => void; - onSelect?: (dateText: string, inst: any) => void; - prevText?: string; - selectOtherMonths?: bool; - shortYearCutoff?: any; // number or string - showAnim?: string; - showButtonPanel?: bool; - showCurrentAtPos?: number; - showMonthAfterYear?: bool; - showOn?: string; - showOptions?: any; // TODO - showOtherMonths?: bool; - showWeek?: bool; - stepMonths?: number; - weekHeader?: string; - yearRange?: string; - yearSuffix?: string; -} - -interface DatepickerFormatDateOptions { - dayNamesShort?: string[]; - dayNames?: string[]; - monthNamesShort?: string[]; - monthNames?: string[]; -} - -interface Datepicker extends Widget, DatepickerOptions { - regional: { [languageCod3: string]: any; }; - setDefaults(defaults: DatepickerOptions); - formatDate(format: string, date: Date, settings?: DatepickerFormatDateOptions): string; - parseDate(format: string, date: string, settings?: DatepickerFormatDateOptions): Date; - iso8601Week(date: Date): void; - noWeekends(): void; -} - - -// Dialog ////////////////////////////////////////////////// - -interface DialogOptions { - autoOpen?: bool; - buttons?: any; // object or [] - closeOnEscape?: bool; - closeText?: string; - dialogClass?: string; - disabled?: bool; - draggable?: bool; - height?: any; // number or string - maxHeight?: number; - maxWidth?: number; - minHeight?: number; - minWidth?: number; - modal?: bool; - position?: any; // object, string or [] - resizable?: bool; - show?: any; // number, string or object - stack?: bool; - title?: string; - width?: any; // number or string - zIndex?: number; -} - -interface DialogUIParams { -} - -interface DialogEvent { - (event: Event, ui: DialogUIParams): void; -} - -interface DialogEvents { - beforeClose?: DialogEvent; - close?: DialogEvent; - create?: DialogEvent; - drag?: DialogEvent; - dragStart?: DialogEvent; - dragStop?: DialogEvent; - focus?: DialogEvent; - open?: DialogEvent; - resize?: DialogEvent; - resizeStart?: DialogEvent; - resizeStop?: DialogEvent; -} - -interface Dialog extends Widget, DialogOptions, DialogEvents { -} - - -// Draggable ////////////////////////////////////////////////// - -interface DraggableEventUIParams { - helper: JQuery; - position: { top: number; left: number; }; - offset: { top: number; left: number; }; -} - -interface DraggableEvent { - (event: Event, ui: DraggableEventUIParams): void; -} - -interface DraggableOptions { - disabled?: bool; - addClasses?: bool; - appendTo?: any; - axis?: string; - cancel?: string; - connectToSortable?: string; - containment?: any; - cursor?: string; - cursorAt?: any; - delay?: number; - distance?: number; - grid?: number[]; - handle?: any; - helper?: any; - iframeFix?: any; - opacity?: number; - refreshPositions?: bool; - revert?: any; - revertDuration?: number; - scope?: string; - scroll?: bool; - scrollSensitivity?: number; - scrollSpeed?: number; - snap?: any; - snapMode?: string; - snapTolerance?: number; - stack?: string; - zIndex?: number; -} - -interface DraggableEvents { - create?: DraggableEvent; - start?: DraggableEvent; - drag?: DraggableEvent; - stop?: DraggableEvent; -} - -interface Draggable extends Widget, DraggableOptions, DraggableEvent { -} - - -// Droppable ////////////////////////////////////////////////// - -interface DroppableEventUIParam { - draggable: JQuery; - helper: JQuery; - position: { top: number; left: number; }; - offset: { top: number; left: number; }; -} - -interface DroppableEvent { - (event: Event, ui: DroppableEventUIParam): void; -} - -interface DroppableOptions { - disabled?: bool; - accept?: any; - activeClass?: string; - greedy?: bool; - hoverClass?: string; - scope?: string; - tolerance?: string; -} - -interface DroppableEvents { - create?: DroppableEvent; - activate?: DroppableEvent; - deactivate?: DroppableEvent; - over?: DroppableEvent; - out?: DroppableEvent; - drop?: DroppableEvent; -} - -interface Droppable extends Widget, DroppableOptions, DroppableEvents { -} - -// Menu ////////////////////////////////////////////////// - -interface MenuOptions { - disabled?: bool; - icons?: any; - menus?: string; - position?: any; // TODO - role?: string; -} - -interface MenuUIParams { -} - -interface MenuEvent { - (event: Event, ui: MenuUIParams): void; -} - -interface MenuEvents { - blur?: MenuEvent; - create?: MenuEvent; - focus?: MenuEvent; - select?: MenuEvent; -} - -interface Menu extends Widget, MenuOptions, MenuEvents { -} - - -// Progressbar ////////////////////////////////////////////////// - -interface ProgressbarOptions { - disabled?: bool; - value?: number; -} - -interface ProgressbarUIParams { -} - -interface ProgressbarEvent { - (event: Event, ui: ProgressbarUIParams): void; -} - -interface ProgressbarEvents { - change?: ProgressbarEvent; - complete?: ProgressbarEvent; - create?: ProgressbarEvent; -} - -interface Progressbar extends Widget, ProgressbarOptions, ProgressbarEvents { -} - - -// Resizable ////////////////////////////////////////////////// - -interface ResizableOptions { - alsoResize?: any; // Selector, JQuery or Element - animate?: bool; - animateDuration?: any; // number or string - animateEasing?: string; - aspectRatio?: any; // bool or number - autoHide?: bool; - cancel?: string; - containment?: any; // Selector, Element or string - delay?: number; - disabled?: bool; - distance?: number; - ghost?: bool; - grid?: any; - handles?: any; // string or object - helper?: string; - maxHeight?: number; - maxWidth?: number; - minHeight?: number; - minWidth?: number; -} - -interface ResizableUIParams { - element: JQuery; - helper: JQuery; - originalElement: JQuery; - originalPosition: any; - originalSize: any; - position: any; - size: any; -} - -interface ResizableEvent { - (event: Event, ui: ResizableUIParams): void; -} - -interface ResizableEvents { - resize?: ResizableEvent; - start?: ResizableEvent; - stop?: ResizableEvent; -} - -interface Resizable extends Widget, ResizableOptions, ResizableEvents { -} - - -// Selectable ////////////////////////////////////////////////// - -interface SelectableOptions { - autoRefresh?: bool; - cancel?: string; - delay?: number; - disabled?: bool; - distance?: number; - filter?: string; - tolerance?: string; -} - -interface SelectableEvents { - selected? (event: Event, ui: { selected?: Element; }): void; - selecting? (event: Event, ui: { selecting?: Element; }): void; - start? (event: Event, ui: any): void; - stop? (event: Event, ui: any): void; - unselected? (event: Event, ui: { unselected: Element; }): void; - unselecting? (event: Event, ui: { unselecting: Element; }): void; -} - -interface Selectable extends Widget, SelectableOptions, SelectableEvents { -} - -// Slider ////////////////////////////////////////////////// - -interface SliderOptions { - animate?: any; // bool, string or number - disabled?: bool; - max?: number; - min?: number; - orientation?: string; - range?: any; // bool or string - step?: number; - // value?: number; - // values?: number[]; -} - -interface SliderUIParams { -} - -interface SliderEvent { - (event: Event, ui: SliderUIParams): void; -} - -interface SliderEvents { - change?: SliderEvent; - create?: SliderEvent; - slide?: SliderEvent; - start?: SliderEvent; - stop?: SliderEvent; -} - -interface Slider extends Widget, SliderOptions, SliderEvents { -} - - -// Sortable ////////////////////////////////////////////////// - -interface SortableOptions { - appendTo?: any; // jQuery, Element, Selector or string - axis?: string; - cancel?: string; - connectWith?: string; - containment?: any; // Element, Selector or string - cursor?: string; - cursorAt?: any; - delay?: number; - disabled?: bool; - distance?: number; - dropOnEmpty?: bool; - forceHelperSize?: bool; - forcePlaceholderSize?: bool; - grid?: number[]; - handle?: any; // Selector or Element - items?: any; // Selector - opacity?: number; - placeholder?: string; - revert?: any; // bool or number - scroll?: bool; - scrollSensitivity?: number; - scrollSpeed?: number; - tolerance?: string; - zIndex?: number; -} - -interface SortableUIParams { - helper: JQuery; - item: JQuery; - offset: any; - position: any; - originalPosition: any; - sender: JQuery; -} - -interface SortableEvent { - (event: Event, ui: SortableUIParams): void; -} - -interface SortableEvents { - activate?: SortableEvent; - beforeStop?: SortableEvent; - change?: SortableEvent; - deactivate?: SortableEvent; - out?: SortableEvent; - over?: SortableEvent; - receive?: SortableEvent; - remove?: SortableEvent; - sort?: SortableEvent; - start?: SortableEvent; - stop?: SortableEvent; - update?: SortableEvent; -} - -interface Sortable extends Widget, SortableOptions, SortableEvents { -} - - -// Spinner ////////////////////////////////////////////////// - -interface SpinnerOptions { - culture?: string; - disabled?: bool; - icons?: any; - incremental?: any; // bool or () - max?: any; // number or string - min?: any; // number or string - numberFormat?: string; - page?: number; - step?: any; // number or string -} - -interface SpinnerUIParams { -} - -interface SpinnerEvent { - (event: Event, ui: SpinnerUIParams): void; -} - -interface SpinnerEvents { - spin?: SpinnerEvent; - start?: SpinnerEvent; - stop?: SpinnerEvent; -} - -interface Spinner extends Widget, SpinnerOptions, SpinnerEvents { -} - - -// Tabs ////////////////////////////////////////////////// - -interface TabsOptions { - active?: any; // bool or number - collapsible?: bool; - disabled?: any; // bool or [] - event?: string; - heightStyle?: string; - hide?: any; // bool, number, string or object - show?: any; // bool, number, string or object -} - -interface TabsUIParams { -} - -interface TabsEvent { - (event: Event, ui: TabsUIParams): void; -} - -interface TabsEvents { - activate?: TabsEvent; - beforeActivate?: TabsEvent; - beforeLoad?: TabsEvent; - load?: TabsEvent; -} - -interface Tabs extends Widget, TabsOptions, TabsEvents { -} - - -// Tooltip ////////////////////////////////////////////////// - -interface TooltipOptions { - content?: any; // () or string - disabled?: bool; - hide?: any; // bool, number, string or object - items?: string; - position?: any; // TODO - show?: any; // bool, number, string or object - tooltipClass?: string; - track?: bool; -} - -interface TooltipUIParams { -} - -interface TooltipEvent { - (event: Event, ui: TooltipUIParams): void; -} - -interface TooltipEvents { - close?: TooltipEvent; - open?: TooltipEvent; -} - -interface Tooltip extends Widget, TooltipOptions, TooltipEvents { -} - - -// Effects ////////////////////////////////////////////////// - -interface EffectOptions { - effect: string; - easing?: string; - duration: any; - complete: Function; -} - -interface BlindEffect { - direction?: string; -} - -interface BounceEffect { - distance?: number; - times?: number; -} - -interface ClipEffect { - direction?: number; -} - -interface DropEffect { - direction?: number; -} - -interface ExplodeEffect { - pieces?: number; -} - -interface FadeEffect { } - -interface FoldEffect { - size?: any; - horizFirst?: bool; -} - -interface HighlightEffect { - color?: string; -} - -interface PuffEffect { - percent?: number; -} - -interface PulsateEffect { - times?: number; -} - -interface ScaleEffect { - direction?: string; - origin?: string[]; - percent?: number; - scale?: string; -} - -interface ShakeEffect { - direction?: string; - distance?: number; - times?: number; -} - -interface SizeEffect { - to?: any; - origin?: string[]; - scale?: string; -} - -interface SlideEffect { - direction?: string; - distance?: number; -} - -interface TransferEffect { - className?: string; - to?: string; -} - -interface JQueryPositionOptions { - my?: string; - at?: string; - of?: any; - collision?: string; - using?: Function; - within?: any; -} - - -// UI ////////////////////////////////////////////////// - -interface MouseOptions { - cancel?: string; - delay?: number; - distance?: number; -} - -interface keyCode { - BACKSPACE: number; - COMMA: number; - DELETE: number; - DOWN: number; - END: number; - ENTER: number; - ESCAPE: number; - HOME: number; - LEFT: number; - NUMPAD_ADD: number; - NUMPAD_DECIMAL: number; - NUMPAD_DIVIDE: number; - NUMPAD_ENTER: number; - NUMPAD_MULTIPLY: number; - NUMPAD_SUBTRACT: number; - PAGE_DOWN: number; - PAGE_UP: number; - PERIOD: number; - RIGHT: number; - SPACE: number; - TAB: number; - UP: number; -} - -interface UI { - mouse(method: string): JQuery; - mouse(options: MouseOptions): JQuery; - mouse(optionLiteral: string, optionName: string, optionValue: any): JQuery; - mouse(optionLiteral: string, optionValue: any): any; - - accordion: Accordion; - autocomplete: Autocomplete; - button: Button; - buttonset: Button; - datepicker: Datepicker; - dialog: Dialog; - keyCode: keyCode ; - menu: Menu; - progressbar: Progressbar; - slider: Slider; - spinner: Spinner; - tabs: Tabs; - tooltip: Tooltip; - version: string; -} - - -// Widget ////////////////////////////////////////////////// - -interface WidgetOptions { - disabled?: bool; - hide?: any; - show?: any; -} - -interface Widget { - (methodName: string): JQuery; - (options: WidgetOptions): JQuery; - (options: AccordionOptions): JQuery; - (optionLiteral: string, optionName: string): any; - (optionLiteral: string, options: WidgetOptions): any; - (optionLiteral: string, optionName: string, optionValue: any): JQuery; - - (name: string, prototype: any): JQuery; - (name: string, base: Function, prototype: any): JQuery; -} - -//////////////////////////////////////////////////////////////////////////////////////////////////// - -interface JQuery { - - accordion(): JQuery; - accordion(methodName: string): JQuery; - accordion(options: AccordionOptions): JQuery; - accordion(optionLiteral: string, optionName: string): any; - accordion(optionLiteral: string, options: AccordionOptions): any; - accordion(optionLiteral: string, optionName: string, optionValue: any): JQuery; - - autocomplete(): JQuery; - autocomplete(methodName: string): JQuery; - autocomplete(options: AutocompleteOptions): JQuery; - autocomplete(optionLiteral: string, optionName: string): any; - autocomplete(optionLiteral: string, options: AutocompleteOptions): any; - autocomplete(optionLiteral: string, optionName: string, optionValue: any): JQuery; - - button(): JQuery; - button(methodName: string): JQuery; - button(options: ButtonOptions): JQuery; - button(optionLiteral: string, optionName: string): any; - button(optionLiteral: string, options: ButtonOptions): any; - button(optionLiteral: string, optionName: string, optionValue: any): JQuery; - - buttonset(): JQuery; - buttonset(methodName: string): JQuery; - buttonset(options: ButtonOptions): JQuery; - buttonset(optionLiteral: string, optionName: string): any; - buttonset(optionLiteral: string, options: ButtonOptions): any; - buttonset(optionLiteral: string, optionName: string, optionValue: any): JQuery; - - datepicker(): JQuery; - datepicker(methodName: string): JQuery; - datepicker(options: DatepickerOptions): JQuery; - datepicker(optionLiteral: string, optionName: string): any; - datepicker(optionLiteral: string, options: DatepickerOptions): any; - datepicker(optionLiteral: string, optionName: string, optionValue: any): JQuery; - - dialog(): JQuery; - dialog(methodName: string): JQuery; - dialog(options: DialogOptions): JQuery; - dialog(optionLiteral: string, optionName: string): any; - dialog(optionLiteral: string, options: DialogOptions): any; - dialog(optionLiteral: string, optionName: string, optionValue: any): JQuery; - - draggable(): JQuery; - draggable(methodName: string): JQuery; - draggable(options: DraggableOptions): JQuery; - draggable(optionLiteral: string, optionName: string): any; - draggable(optionLiteral: string, options: DraggableOptions): any; - draggable(optionLiteral: string, optionName: string, optionValue: any): JQuery; - - droppable(): JQuery; - droppable(methodName: string): JQuery; - droppable(options: DroppableOptions): JQuery; - droppable(optionLiteral: string, optionName: string): any; - droppable(optionLiteral: string, options: DraggableOptions): any; - droppable(optionLiteral: string, optionName: string, optionValue: any): JQuery; - - menu(): JQuery; - menu(methodName: string): JQuery; - menu(options: MenuOptions): JQuery; - menu(optionLiteral: string, optionName: string): any; - menu(optionLiteral: string, options: MenuOptions): any; - menu(optionLiteral: string, optionName: string, optionValue: any): JQuery; - - progressbar(): JQuery; - progressbar(methodName: string): JQuery; - progressbar(options: ProgressbarOptions): JQuery; - progressbar(optionLiteral: string, optionName: string): any; - progressbar(optionLiteral: string, options: ProgressbarOptions): any; - progressbar(optionLiteral: string, optionName: string, optionValue: any): JQuery; - - resizable(): JQuery; - resizable(methodName: string): JQuery; - resizable(options: ResizableOptions): JQuery; - resizable(optionLiteral: string, optionName: string): any; - resizable(optionLiteral: string, options: ResizableOptions): any; - resizable(optionLiteral: string, optionName: string, optionValue: any): JQuery; - - selectable(): JQuery; - selectable(methodName: string): JQuery; - selectable(options: SelectableOptions): JQuery; - selectable(optionLiteral: string, optionName: string): any; - selectable(optionLiteral: string, options: SelectableOptions): any; - selectable(optionLiteral: string, optionName: string, optionValue: any): JQuery; - - slider(): JQuery; - slider(methodName: string): JQuery; - slider(options: SliderOptions): JQuery; - slider(optionLiteral: string, optionName: string): any; - slider(optionLiteral: string, options: SliderOptions): any; - slider(optionLiteral: string, optionName: string, optionValue: any): JQuery; - - sortable(): JQuery; - sortable(methodName: string): JQuery; - sortable(options: SortableOptions): JQuery; - sortable(optionLiteral: string, optionName: string): any; - sortable(optionLiteral: string, options: SortableOptions): any; - sortable(optionLiteral: string, optionName: string, optionValue: any): JQuery; - - spinner(): JQuery; - spinner(methodName: string): JQuery; - spinner(options: SpinnerOptions): JQuery; - spinner(optionLiteral: string, optionName: string): any; - spinner(optionLiteral: string, options: SpinnerOptions): any; - spinner(optionLiteral: string, optionName: string, optionValue: any): JQuery; - - tabs(): JQuery; - tabs(methodName: string): JQuery; - tabs(options: TabsOptions): JQuery; - tabs(optionLiteral: string, optionName: string): any; - tabs(optionLiteral: string, options: TabsOptions): any; - tabs(optionLiteral: string, optionName: string, optionValue: any): JQuery; - - tooltip(): JQuery; - tooltip(methodName: string): JQuery; - tooltip(options: TooltipOptions): JQuery; - tooltip(optionLiteral: string, optionName: string): any; - tooltip(optionLiteral: string, options: TooltipOptions): any; - tooltip(optionLiteral: string, optionName: string, optionValue: any): JQuery; - - - addClass(classNames: string, speed?: number, callback?: Function): JQuery; - addClass(classNames: string, speed?: string, callback?: Function): JQuery; - addClass(classNames: string, speed?: number, easing?: string, callback?: Function): JQuery; - addClass(classNames: string, speed?: string, easing?: string, callback?: Function): JQuery; - - removeClass(classNames: string, speed?: number, callback?: Function): JQuery; - removeClass(classNames: string, speed?: string, callback?: Function): JQuery; - removeClass(classNames: string, speed?: number, easing?: string, callback?: Function): JQuery; - removeClass(classNames: string, speed?: string, easing?: string, callback?: Function): JQuery; - - switchClass(removeClassName: string, addClassName: string, duration?: number, easing?: string, complete?: Function): JQuery; - switchClass(removeClassName: string, addClassName: string, duration?: string, easing?: string, complete?: Function): JQuery; - - toggleClass(className: string, duration?: number, easing?: string, complete?: Function): JQuery; - toggleClass(className: string, duration?: string, easing?: string, complete?: Function): JQuery; - toggleClass(className: string, aswitch?: bool, duration?: number, easing?: string, complete?: Function): JQuery; - toggleClass(className: string, aswitch?: bool, duration?: string, easing?: string, complete?: Function): JQuery; - - effect(options: any): JQuery; - effect(effect: string, options?: any, duration?: number, complete?: Function): JQuery; - effect(effect: string, options?: any, duration?: string, complete?: Function): JQuery; - - hide(options: any): JQuery; - hide(effect: string, options?: any, duration?: number, complete?: Function): JQuery; - hide(effect: string, options?: any, duration?: string, complete?: Function): JQuery; - - show(options: any): JQuery; - show(effect: string, options?: any, duration?: number, complete?: Function): JQuery; - show(effect: string, options?: any, duration?: string, complete?: Function): JQuery; - - toggle(options: any): JQuery; - toggle(effect: string, options?: any, duration?: number, complete?: Function): JQuery; - toggle(effect: string, options?: any, duration?: string, complete?: Function): JQuery; - - enableSelection(): JQuery; - disableSelection(): JQuery; - focus(delay: number, callback?: Function): JQuery; - uniqueId(): JQuery; - removeUniqueId(): JQuery; - scrollParent(): JQuery; - zIndex(): JQuery; - zIndex(zIndex: number): JQuery; - position(options: JQueryPositionOptions): JQuery; - - widget: Widget; - - jQuery: JQueryStatic; -} - -interface JQueryStatic { - ui: UI; - datepicker: Datepicker; - widget: Widget; - Widget: Widget; +// Type definitions for jQueryUI 1.9 +// Project: http://jqueryui.com/ +// Definitions by: Boris Yankov +// Definitions: https://github.com/borisyankov/DefinitelyTyped + + +/// + + +// Accordion ////////////////////////////////////////////////// + +interface AccordionOptions { + active?: any; // bool or number + animate?: any; // bool, number, string or object + collapsible?: bool; + disabled?: bool; + event?: string; + header?: string; + heightStyle?: string; + icons?: any; +} + +interface AccordionUIParams { + newHeader: JQuery; + oldHeader: JQuery; + newPanel: JQuery; + oldPanel: JQuery; +} + +interface AccordionEvent { + (event: Event, ui: AccordionUIParams): void; +} + +interface AccordionEvents { + activate?: AccordionEvent; + beforeActivate?: AccordionEvent; + create?: AccordionEvent; +} + +interface Accordion extends Widget, AccordionOptions, AccordionEvents { +} + + +// Autocomplete ////////////////////////////////////////////////// + +interface AutocompleteOptions { + appendTo?: any; //Selector; + autoFocus?: bool; + delay?: number; + disabled?: bool; + minLength?: number; + position?: string; + source?: any; // [], string or () +} + +interface AutocompleteUIParams { + +} + +interface AutocompleteEvent { + (event: Event, ui: AutocompleteUIParams): void; +} + +interface AutocompleteEvents { + change?: AutocompleteEvent; + close?: AutocompleteEvent; + create?: AutocompleteEvent; + focus?: AutocompleteEvent; + open?: AutocompleteEvent; + response?: AutocompleteEvent; + search?: AutocompleteEvent; + select?: AutocompleteEvent; +} + +interface Autocomplete extends Widget, AutocompleteOptions, AutocompleteEvents { + escapeRegex: (string) => string; +} + + +// Button ////////////////////////////////////////////////// + +interface ButtonOptions { + disabled?: bool; + icons?: any; + label?: string; + text?: bool; +} + +interface Button extends Widget, ButtonOptions { +} + + +// Datepicker ////////////////////////////////////////////////// + +interface DatepickerOptions { + altFieldType?: any; // Selecotr, jQuery or Element + altFormat?: string; + appendText?: string; + autoSize?: bool; + beforeShow?: (input: Element, inst: any) => void; + beforeShowDay?: (date: Date) => void; + buttonImage?: string; + buttonImageOnly?: bool; + buttonText?: string; + calculateWeek?: () => any; + changeMonth?: bool; + changeYear?: bool; + closeText?: string; + constrainInput?: bool; + currentText?: string; + dateFormat?: string; + dayNames?: string[]; + dayNamesMin?: string[]; + dayNamesShort?: string[]; + defaultDateType?: any; // Date, number or string + duration?: string; + firstDay?: number; + gotoCurrent?: bool; + hideIfNoPrevNext?: bool; + isRTL?: bool; + maxDate?: any; // Date, number or string + minDate?: any; // Date, number or string + monthNames?: string[]; + monthNamesShort?: string[]; + navigationAsDateFormat?: bool; + nextText?: string; + numberOfMonths?: any; // number or [] + onChangeMonthYear?: (year: number, month: number, inst: any) => void; + onClose?: (dateText: string, inst: any) => void; + onSelect?: (dateText: string, inst: any) => void; + prevText?: string; + selectOtherMonths?: bool; + shortYearCutoff?: any; // number or string + showAnim?: string; + showButtonPanel?: bool; + showCurrentAtPos?: number; + showMonthAfterYear?: bool; + showOn?: string; + showOptions?: any; // TODO + showOtherMonths?: bool; + showWeek?: bool; + stepMonths?: number; + weekHeader?: string; + yearRange?: string; + yearSuffix?: string; +} + +interface DatepickerFormatDateOptions { + dayNamesShort?: string[]; + dayNames?: string[]; + monthNamesShort?: string[]; + monthNames?: string[]; +} + +interface Datepicker extends Widget, DatepickerOptions { + regional: { [languageCod3: string]: any; }; + setDefaults(defaults: DatepickerOptions); + formatDate(format: string, date: Date, settings?: DatepickerFormatDateOptions): string; + parseDate(format: string, date: string, settings?: DatepickerFormatDateOptions): Date; + iso8601Week(date: Date): void; + noWeekends(): void; +} + + +// Dialog ////////////////////////////////////////////////// + +interface DialogOptions { + autoOpen?: bool; + buttons?: any; // object or [] + closeOnEscape?: bool; + closeText?: string; + dialogClass?: string; + disabled?: bool; + draggable?: bool; + height?: any; // number or string + maxHeight?: number; + maxWidth?: number; + minHeight?: number; + minWidth?: number; + modal?: bool; + position?: any; // object, string or [] + resizable?: bool; + show?: any; // number, string or object + stack?: bool; + title?: string; + width?: any; // number or string + zIndex?: number; +} + +interface DialogUIParams { +} + +interface DialogEvent { + (event: Event, ui: DialogUIParams): void; +} + +interface DialogEvents { + beforeClose?: DialogEvent; + close?: DialogEvent; + create?: DialogEvent; + drag?: DialogEvent; + dragStart?: DialogEvent; + dragStop?: DialogEvent; + focus?: DialogEvent; + open?: DialogEvent; + resize?: DialogEvent; + resizeStart?: DialogEvent; + resizeStop?: DialogEvent; +} + +interface Dialog extends Widget, DialogOptions, DialogEvents { +} + + +// Draggable ////////////////////////////////////////////////// + +interface DraggableEventUIParams { + helper: JQuery; + position: { top: number; left: number; }; + offset: { top: number; left: number; }; +} + +interface DraggableEvent { + (event: Event, ui: DraggableEventUIParams): void; +} + +interface DraggableOptions { + disabled?: bool; + addClasses?: bool; + appendTo?: any; + axis?: string; + cancel?: string; + connectToSortable?: string; + containment?: any; + cursor?: string; + cursorAt?: any; + delay?: number; + distance?: number; + grid?: number[]; + handle?: any; + helper?: any; + iframeFix?: any; + opacity?: number; + refreshPositions?: bool; + revert?: any; + revertDuration?: number; + scope?: string; + scroll?: bool; + scrollSensitivity?: number; + scrollSpeed?: number; + snap?: any; + snapMode?: string; + snapTolerance?: number; + stack?: string; + zIndex?: number; +} + +interface DraggableEvents { + create?: DraggableEvent; + start?: DraggableEvent; + drag?: DraggableEvent; + stop?: DraggableEvent; +} + +interface Draggable extends Widget, DraggableOptions, DraggableEvent { +} + + +// Droppable ////////////////////////////////////////////////// + +interface DroppableEventUIParam { + draggable: JQuery; + helper: JQuery; + position: { top: number; left: number; }; + offset: { top: number; left: number; }; +} + +interface DroppableEvent { + (event: Event, ui: DroppableEventUIParam): void; +} + +interface DroppableOptions { + disabled?: bool; + accept?: any; + activeClass?: string; + greedy?: bool; + hoverClass?: string; + scope?: string; + tolerance?: string; +} + +interface DroppableEvents { + create?: DroppableEvent; + activate?: DroppableEvent; + deactivate?: DroppableEvent; + over?: DroppableEvent; + out?: DroppableEvent; + drop?: DroppableEvent; +} + +interface Droppable extends Widget, DroppableOptions, DroppableEvents { +} + +// Menu ////////////////////////////////////////////////// + +interface MenuOptions { + disabled?: bool; + icons?: any; + menus?: string; + position?: any; // TODO + role?: string; +} + +interface MenuUIParams { +} + +interface MenuEvent { + (event: Event, ui: MenuUIParams): void; +} + +interface MenuEvents { + blur?: MenuEvent; + create?: MenuEvent; + focus?: MenuEvent; + select?: MenuEvent; +} + +interface Menu extends Widget, MenuOptions, MenuEvents { +} + + +// Progressbar ////////////////////////////////////////////////// + +interface ProgressbarOptions { + disabled?: bool; + value?: number; +} + +interface ProgressbarUIParams { +} + +interface ProgressbarEvent { + (event: Event, ui: ProgressbarUIParams): void; +} + +interface ProgressbarEvents { + change?: ProgressbarEvent; + complete?: ProgressbarEvent; + create?: ProgressbarEvent; +} + +interface Progressbar extends Widget, ProgressbarOptions, ProgressbarEvents { +} + + +// Resizable ////////////////////////////////////////////////// + +interface ResizableOptions { + alsoResize?: any; // Selector, JQuery or Element + animate?: bool; + animateDuration?: any; // number or string + animateEasing?: string; + aspectRatio?: any; // bool or number + autoHide?: bool; + cancel?: string; + containment?: any; // Selector, Element or string + delay?: number; + disabled?: bool; + distance?: number; + ghost?: bool; + grid?: any; + handles?: any; // string or object + helper?: string; + maxHeight?: number; + maxWidth?: number; + minHeight?: number; + minWidth?: number; +} + +interface ResizableUIParams { + element: JQuery; + helper: JQuery; + originalElement: JQuery; + originalPosition: any; + originalSize: any; + position: any; + size: any; +} + +interface ResizableEvent { + (event: Event, ui: ResizableUIParams): void; +} + +interface ResizableEvents { + resize?: ResizableEvent; + start?: ResizableEvent; + stop?: ResizableEvent; +} + +interface Resizable extends Widget, ResizableOptions, ResizableEvents { +} + + +// Selectable ////////////////////////////////////////////////// + +interface SelectableOptions { + autoRefresh?: bool; + cancel?: string; + delay?: number; + disabled?: bool; + distance?: number; + filter?: string; + tolerance?: string; +} + +interface SelectableEvents { + selected? (event: Event, ui: { selected?: Element; }): void; + selecting? (event: Event, ui: { selecting?: Element; }): void; + start? (event: Event, ui: any): void; + stop? (event: Event, ui: any): void; + unselected? (event: Event, ui: { unselected: Element; }): void; + unselecting? (event: Event, ui: { unselecting: Element; }): void; +} + +interface Selectable extends Widget, SelectableOptions, SelectableEvents { +} + +// Slider ////////////////////////////////////////////////// + +interface SliderOptions { + animate?: any; // bool, string or number + disabled?: bool; + max?: number; + min?: number; + orientation?: string; + range?: any; // bool or string + step?: number; + // value?: number; + // values?: number[]; +} + +interface SliderUIParams { +} + +interface SliderEvent { + (event: Event, ui: SliderUIParams): void; +} + +interface SliderEvents { + change?: SliderEvent; + create?: SliderEvent; + slide?: SliderEvent; + start?: SliderEvent; + stop?: SliderEvent; +} + +interface Slider extends Widget, SliderOptions, SliderEvents { +} + + +// Sortable ////////////////////////////////////////////////// + +interface SortableOptions { + appendTo?: any; // jQuery, Element, Selector or string + axis?: string; + cancel?: string; + connectWith?: string; + containment?: any; // Element, Selector or string + cursor?: string; + cursorAt?: any; + delay?: number; + disabled?: bool; + distance?: number; + dropOnEmpty?: bool; + forceHelperSize?: bool; + forcePlaceholderSize?: bool; + grid?: number[]; + handle?: any; // Selector or Element + items?: any; // Selector + opacity?: number; + placeholder?: string; + revert?: any; // bool or number + scroll?: bool; + scrollSensitivity?: number; + scrollSpeed?: number; + tolerance?: string; + zIndex?: number; +} + +interface SortableUIParams { + helper: JQuery; + item: JQuery; + offset: any; + position: any; + originalPosition: any; + sender: JQuery; +} + +interface SortableEvent { + (event: Event, ui: SortableUIParams): void; +} + +interface SortableEvents { + activate?: SortableEvent; + beforeStop?: SortableEvent; + change?: SortableEvent; + deactivate?: SortableEvent; + out?: SortableEvent; + over?: SortableEvent; + receive?: SortableEvent; + remove?: SortableEvent; + sort?: SortableEvent; + start?: SortableEvent; + stop?: SortableEvent; + update?: SortableEvent; +} + +interface Sortable extends Widget, SortableOptions, SortableEvents { +} + + +// Spinner ////////////////////////////////////////////////// + +interface SpinnerOptions { + culture?: string; + disabled?: bool; + icons?: any; + incremental?: any; // bool or () + max?: any; // number or string + min?: any; // number or string + numberFormat?: string; + page?: number; + step?: any; // number or string +} + +interface SpinnerUIParams { +} + +interface SpinnerEvent { + (event: Event, ui: SpinnerUIParams): void; +} + +interface SpinnerEvents { + spin?: SpinnerEvent; + start?: SpinnerEvent; + stop?: SpinnerEvent; +} + +interface Spinner extends Widget, SpinnerOptions, SpinnerEvents { +} + + +// Tabs ////////////////////////////////////////////////// + +interface TabsOptions { + active?: any; // bool or number + collapsible?: bool; + disabled?: any; // bool or [] + event?: string; + heightStyle?: string; + hide?: any; // bool, number, string or object + show?: any; // bool, number, string or object +} + +interface TabsUIParams { +} + +interface TabsEvent { + (event: Event, ui: TabsUIParams): void; +} + +interface TabsEvents { + activate?: TabsEvent; + beforeActivate?: TabsEvent; + beforeLoad?: TabsEvent; + load?: TabsEvent; +} + +interface Tabs extends Widget, TabsOptions, TabsEvents { +} + + +// Tooltip ////////////////////////////////////////////////// + +interface TooltipOptions { + content?: any; // () or string + disabled?: bool; + hide?: any; // bool, number, string or object + items?: string; + position?: any; // TODO + show?: any; // bool, number, string or object + tooltipClass?: string; + track?: bool; +} + +interface TooltipUIParams { +} + +interface TooltipEvent { + (event: Event, ui: TooltipUIParams): void; +} + +interface TooltipEvents { + close?: TooltipEvent; + open?: TooltipEvent; +} + +interface Tooltip extends Widget, TooltipOptions, TooltipEvents { +} + + +// Effects ////////////////////////////////////////////////// + +interface EffectOptions { + effect: string; + easing?: string; + duration: any; + complete: Function; +} + +interface BlindEffect { + direction?: string; +} + +interface BounceEffect { + distance?: number; + times?: number; +} + +interface ClipEffect { + direction?: number; +} + +interface DropEffect { + direction?: number; +} + +interface ExplodeEffect { + pieces?: number; +} + +interface FadeEffect { } + +interface FoldEffect { + size?: any; + horizFirst?: bool; +} + +interface HighlightEffect { + color?: string; +} + +interface PuffEffect { + percent?: number; +} + +interface PulsateEffect { + times?: number; +} + +interface ScaleEffect { + direction?: string; + origin?: string[]; + percent?: number; + scale?: string; +} + +interface ShakeEffect { + direction?: string; + distance?: number; + times?: number; +} + +interface SizeEffect { + to?: any; + origin?: string[]; + scale?: string; +} + +interface SlideEffect { + direction?: string; + distance?: number; +} + +interface TransferEffect { + className?: string; + to?: string; +} + +interface JQueryPositionOptions { + my?: string; + at?: string; + of?: any; + collision?: string; + using?: Function; + within?: any; +} + + +// UI ////////////////////////////////////////////////// + +interface MouseOptions { + cancel?: string; + delay?: number; + distance?: number; +} + +interface keyCode { + BACKSPACE: number; + COMMA: number; + DELETE: number; + DOWN: number; + END: number; + ENTER: number; + ESCAPE: number; + HOME: number; + LEFT: number; + NUMPAD_ADD: number; + NUMPAD_DECIMAL: number; + NUMPAD_DIVIDE: number; + NUMPAD_ENTER: number; + NUMPAD_MULTIPLY: number; + NUMPAD_SUBTRACT: number; + PAGE_DOWN: number; + PAGE_UP: number; + PERIOD: number; + RIGHT: number; + SPACE: number; + TAB: number; + UP: number; +} + +interface UI { + mouse(method: string): JQuery; + mouse(options: MouseOptions): JQuery; + mouse(optionLiteral: string, optionName: string, optionValue: any): JQuery; + mouse(optionLiteral: string, optionValue: any): any; + + accordion: Accordion; + autocomplete: Autocomplete; + button: Button; + buttonset: Button; + datepicker: Datepicker; + dialog: Dialog; + keyCode: keyCode ; + menu: Menu; + progressbar: Progressbar; + slider: Slider; + spinner: Spinner; + tabs: Tabs; + tooltip: Tooltip; + version: string; +} + + +// Widget ////////////////////////////////////////////////// + +interface WidgetOptions { + disabled?: bool; + hide?: any; + show?: any; +} + +interface Widget { + (methodName: string): JQuery; + (options: WidgetOptions): JQuery; + (options: AccordionOptions): JQuery; + (optionLiteral: string, optionName: string): any; + (optionLiteral: string, options: WidgetOptions): any; + (optionLiteral: string, optionName: string, optionValue: any): JQuery; + + (name: string, prototype: any): JQuery; + (name: string, base: Function, prototype: any): JQuery; +} + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +interface JQuery { + + accordion(): JQuery; + accordion(methodName: string): JQuery; + accordion(options: AccordionOptions): JQuery; + accordion(optionLiteral: string, optionName: string): any; + accordion(optionLiteral: string, options: AccordionOptions): any; + accordion(optionLiteral: string, optionName: string, optionValue: any): JQuery; + + autocomplete(): JQuery; + autocomplete(methodName: string): JQuery; + autocomplete(options: AutocompleteOptions): JQuery; + autocomplete(optionLiteral: string, optionName: string): any; + autocomplete(optionLiteral: string, options: AutocompleteOptions): any; + autocomplete(optionLiteral: string, optionName: string, optionValue: any): JQuery; + + button(): JQuery; + button(methodName: string): JQuery; + button(options: ButtonOptions): JQuery; + button(optionLiteral: string, optionName: string): any; + button(optionLiteral: string, options: ButtonOptions): any; + button(optionLiteral: string, optionName: string, optionValue: any): JQuery; + + buttonset(): JQuery; + buttonset(methodName: string): JQuery; + buttonset(options: ButtonOptions): JQuery; + buttonset(optionLiteral: string, optionName: string): any; + buttonset(optionLiteral: string, options: ButtonOptions): any; + buttonset(optionLiteral: string, optionName: string, optionValue: any): JQuery; + + datepicker(): JQuery; + datepicker(methodName: string): JQuery; + datepicker(options: DatepickerOptions): JQuery; + datepicker(optionLiteral: string, optionName: string): any; + datepicker(optionLiteral: string, options: DatepickerOptions): any; + datepicker(optionLiteral: string, optionName: string, optionValue: any): JQuery; + + dialog(): JQuery; + dialog(methodName: string): JQuery; + dialog(options: DialogOptions): JQuery; + dialog(optionLiteral: string, optionName: string): any; + dialog(optionLiteral: string, options: DialogOptions): any; + dialog(optionLiteral: string, optionName: string, optionValue: any): JQuery; + + draggable(): JQuery; + draggable(methodName: string): JQuery; + draggable(options: DraggableOptions): JQuery; + draggable(optionLiteral: string, optionName: string): any; + draggable(optionLiteral: string, options: DraggableOptions): any; + draggable(optionLiteral: string, optionName: string, optionValue: any): JQuery; + + droppable(): JQuery; + droppable(methodName: string): JQuery; + droppable(options: DroppableOptions): JQuery; + droppable(optionLiteral: string, optionName: string): any; + droppable(optionLiteral: string, options: DraggableOptions): any; + droppable(optionLiteral: string, optionName: string, optionValue: any): JQuery; + + menu(): JQuery; + menu(methodName: string): JQuery; + menu(options: MenuOptions): JQuery; + menu(optionLiteral: string, optionName: string): any; + menu(optionLiteral: string, options: MenuOptions): any; + menu(optionLiteral: string, optionName: string, optionValue: any): JQuery; + + progressbar(): JQuery; + progressbar(methodName: string): JQuery; + progressbar(options: ProgressbarOptions): JQuery; + progressbar(optionLiteral: string, optionName: string): any; + progressbar(optionLiteral: string, options: ProgressbarOptions): any; + progressbar(optionLiteral: string, optionName: string, optionValue: any): JQuery; + + resizable(): JQuery; + resizable(methodName: string): JQuery; + resizable(options: ResizableOptions): JQuery; + resizable(optionLiteral: string, optionName: string): any; + resizable(optionLiteral: string, options: ResizableOptions): any; + resizable(optionLiteral: string, optionName: string, optionValue: any): JQuery; + + selectable(): JQuery; + selectable(methodName: string): JQuery; + selectable(options: SelectableOptions): JQuery; + selectable(optionLiteral: string, optionName: string): any; + selectable(optionLiteral: string, options: SelectableOptions): any; + selectable(optionLiteral: string, optionName: string, optionValue: any): JQuery; + + slider(): JQuery; + slider(methodName: string): JQuery; + slider(options: SliderOptions): JQuery; + slider(optionLiteral: string, optionName: string): any; + slider(optionLiteral: string, options: SliderOptions): any; + slider(optionLiteral: string, optionName: string, optionValue: any): JQuery; + + sortable(): JQuery; + sortable(methodName: string): JQuery; + sortable(options: SortableOptions): JQuery; + sortable(optionLiteral: string, optionName: string): any; + sortable(optionLiteral: string, options: SortableOptions): any; + sortable(optionLiteral: string, optionName: string, optionValue: any): JQuery; + + spinner(): JQuery; + spinner(methodName: string): JQuery; + spinner(options: SpinnerOptions): JQuery; + spinner(optionLiteral: string, optionName: string): any; + spinner(optionLiteral: string, options: SpinnerOptions): any; + spinner(optionLiteral: string, optionName: string, optionValue: any): JQuery; + + tabs(): JQuery; + tabs(methodName: string): JQuery; + tabs(options: TabsOptions): JQuery; + tabs(optionLiteral: string, optionName: string): any; + tabs(optionLiteral: string, options: TabsOptions): any; + tabs(optionLiteral: string, optionName: string, optionValue: any): JQuery; + + tooltip(): JQuery; + tooltip(methodName: string): JQuery; + tooltip(options: TooltipOptions): JQuery; + tooltip(optionLiteral: string, optionName: string): any; + tooltip(optionLiteral: string, options: TooltipOptions): any; + tooltip(optionLiteral: string, optionName: string, optionValue: any): JQuery; + + + addClass(classNames: string, speed?: number, callback?: Function): JQuery; + addClass(classNames: string, speed?: string, callback?: Function): JQuery; + addClass(classNames: string, speed?: number, easing?: string, callback?: Function): JQuery; + addClass(classNames: string, speed?: string, easing?: string, callback?: Function): JQuery; + + removeClass(classNames: string, speed?: number, callback?: Function): JQuery; + removeClass(classNames: string, speed?: string, callback?: Function): JQuery; + removeClass(classNames: string, speed?: number, easing?: string, callback?: Function): JQuery; + removeClass(classNames: string, speed?: string, easing?: string, callback?: Function): JQuery; + + switchClass(removeClassName: string, addClassName: string, duration?: number, easing?: string, complete?: Function): JQuery; + switchClass(removeClassName: string, addClassName: string, duration?: string, easing?: string, complete?: Function): JQuery; + + toggleClass(className: string, duration?: number, easing?: string, complete?: Function): JQuery; + toggleClass(className: string, duration?: string, easing?: string, complete?: Function): JQuery; + toggleClass(className: string, aswitch?: bool, duration?: number, easing?: string, complete?: Function): JQuery; + toggleClass(className: string, aswitch?: bool, duration?: string, easing?: string, complete?: Function): JQuery; + + effect(options: any): JQuery; + effect(effect: string, options?: any, duration?: number, complete?: Function): JQuery; + effect(effect: string, options?: any, duration?: string, complete?: Function): JQuery; + + hide(options: any): JQuery; + hide(effect: string, options?: any, duration?: number, complete?: Function): JQuery; + hide(effect: string, options?: any, duration?: string, complete?: Function): JQuery; + + show(options: any): JQuery; + show(effect: string, options?: any, duration?: number, complete?: Function): JQuery; + show(effect: string, options?: any, duration?: string, complete?: Function): JQuery; + + toggle(options: any): JQuery; + toggle(effect: string, options?: any, duration?: number, complete?: Function): JQuery; + toggle(effect: string, options?: any, duration?: string, complete?: Function): JQuery; + + enableSelection(): JQuery; + disableSelection(): JQuery; + focus(delay: number, callback?: Function): JQuery; + uniqueId(): JQuery; + removeUniqueId(): JQuery; + scrollParent(): JQuery; + zIndex(): JQuery; + zIndex(zIndex: number): JQuery; + position(options: JQueryPositionOptions): JQuery; + + widget: Widget; + + jQuery: JQueryStatic; +} + +interface JQueryStatic { + ui: UI; + datepicker: Datepicker; + widget: Widget; + Widget: Widget; } \ No newline at end of file diff --git a/js-fixtures/fixtures-tests.ts b/js-fixtures/fixtures-tests.ts new file mode 100644 index 000000000..96c15e5d8 --- /dev/null +++ b/js-fixtures/fixtures-tests.ts @@ -0,0 +1,53 @@ +/// + +function test_path() { + fixtures.path = "/fixtures"; +} + +function test_containerId() { + fixtures.containerId = "fixtures"; +} + +function test_body() { + if (!fixtures.body()) { + console.log('body is empty'); + } +} + +function test_window() { + if (!fixtures.window) { + console.log('window is not set'); + } +} + +function test_set() { + fixtures.set('
    '); +} + +function test_appendSet() { + fixtures.appendSet('
    '); +} + +function test_preload() { + fixtures.preload('/dummy-fixtures.html'); +} + +function test_load() { + fixtures.load('/dummy-fixtures1.html', '/dummy-fixtures2.html'); +} + +function test_appendLoad() { + fixtures.appendLoad('/dummy-fixtures1.html', '/dummy-fixtures2.html'); +} + +function test_read() { + fixtures.read('/dummy-fixtures1.html', '/dummy-fixtures2.html'); +} + +function test_clearCache() { + fixtures.clearCache(); +} + +function test_clearCleanup() { + fixtures.cleanUp(); +} \ No newline at end of file diff --git a/js-fixtures/fixtures.d.ts b/js-fixtures/fixtures.d.ts index dfce88eb7..912bc693c 100644 --- a/js-fixtures/fixtures.d.ts +++ b/js-fixtures/fixtures.d.ts @@ -1,3 +1,8 @@ +// Type definitions for js-fixtures 1.2.0 +// Project: https://github.com/badunk/js-fixtures +// Definitions by: Kazi Manzur Rashid +// DefinitelyTyped: https://github.com/borisyankov/DefinitelyTyped + declare interface Fixtures { path: string; containerId: string; diff --git a/jsplumb/jquery.jsPlumb.d.ts b/jsplumb/jquery.jsPlumb.d.ts index ead127e72..8a9a2422e 100644 --- a/jsplumb/jquery.jsPlumb.d.ts +++ b/jsplumb/jquery.jsPlumb.d.ts @@ -12,7 +12,8 @@ interface jsPlumb { bind(event: string, callback: (e) => void ): void; unbind(event?: string): void; ready(callback: () => void): void; - importDefaults(defaults: Defaults): void;// + importDefaults(defaults: Defaults): void; + Defaults: Defaults; restoreDefaults(): void; addClass(el: any, clazz: string): void; addEndpoint(ep: string): any; @@ -27,10 +28,12 @@ interface jsPlumb { detachAllConnections(el: string): void; removeAllEndpoints(el: any): void; select(params: SelectParams): Connections; + getConnections(options?: any, flat?: any): any[]; } interface Defaults { Endpoint?: any[]; + PaintStyle?: PaintStyle; HoverPaintStyle?: PaintStyle; ConnectionsDetachable?: bool; ReattachConnections?: bool; diff --git a/knockout.mapping/knockout.mapping.d.ts b/knockout.mapping/knockout.mapping.d.ts index f1489a1e8..69b6ccaff 100644 --- a/knockout.mapping/knockout.mapping.d.ts +++ b/knockout.mapping/knockout.mapping.d.ts @@ -33,6 +33,8 @@ interface KnockoutMapping { fromJS(jsObject: any, targetOrOptions: any): any; fromJS(jsObject: any, inputOptions: any, target: any): any; fromJSON(jsonString: string): any; + fromJSON(jsonString: string, targetOrOptions: any): any; + fromJSON(jsonString: string, inputOptions: any, target: any): any; toJS(rootObject: any, options?: KnockoutMappingOptions): any; toJSON(rootObject: any, options?: KnockoutMappingOptions): any; defaultOptions(): KnockoutMappingOptions; diff --git a/mocha/mocha-tests.ts b/mocha/mocha-tests.ts new file mode 100644 index 000000000..53c8e5720 --- /dev/null +++ b/mocha/mocha-tests.ts @@ -0,0 +1,52 @@ +/// + +function test_describe() { + describe('something', () => { }); + + describe.only('something', () => { }); + + describe.skip('something', () => { }); + + describe('something', function() { + this.timeout(2000); + }); +} + +function test_it() { + + it('does something', () => { }); + + it('does something', (done) => { done(); }); + + it.only('does something', () => { }); + + it.skip('does something', () => { }); + + it('does something', function () { + this.timeout(2000); + }); +} + +function test_before() { + before(() => { }); + + before((done) => { done(); }); +} + +function test_after() { + after(() => { }); + + after((done) => { done(); }); +} + +function test_beforeEach() { + beforeEach(() => { }); + + beforeEach((done) => { done(); }); +} + +function test_afterEach() { + afterEach(() => { }); + + afterEach((done) => { done(); }); +} \ No newline at end of file diff --git a/mocha/mocha.d.ts b/mocha/mocha.d.ts index b722277c3..93b894ed6 100644 --- a/mocha/mocha.d.ts +++ b/mocha/mocha.d.ts @@ -1,3 +1,8 @@ +// Type definitions for mocha 1.9.0 +// Project: http://visionmedia.github.io/mocha/ +// Definitions by: Kazi Manzur Rashid +// DefinitelyTyped: https://github.com/borisyankov/DefinitelyTyped + declare var describe : { (description: string, spec: () => void): void; only(description: string, spec: () => void): void; diff --git a/modernizr/modernizr.d.ts b/modernizr/modernizr.d.ts index 202d5d727..25ccb889e 100644 --- a/modernizr/modernizr.d.ts +++ b/modernizr/modernizr.d.ts @@ -17,6 +17,35 @@ interface VideoBool { webm: bool; } +interface InputBool { + autocomplete: bool; + autofocus: bool; + list: bool; + placeholder: bool; + max: bool; + min: bool; + multiple: bool; + pattern: bool; + required: bool; + step: bool; +} + +interface InputTypesBool { + search: bool; + tel: bool; + url: bool; + email: bool; + datetime: bool; + date: bool; + month: bool; + week: bool; + time: bool; + datetimelocal: bool; + number: bool; + range: bool; + color: bool; +} + interface ModernizrStatic { fontface: bool; backgroundsize: bool; @@ -46,6 +75,8 @@ interface ModernizrStatic { audio: AudioBool; video: VideoBool; indexeddb: bool; + input: InputBool; + inputtypes: InputTypesBool; localstorage: bool; postmessage: bool; sessionstorage: bool; @@ -60,6 +91,10 @@ interface ModernizrStatic { touch: bool; webgl: bool; + load(resources: Array); + load(resourceObject: any); + load(resourceString: string); + prefixed(): bool; prefixed(property: string): bool; prefixed(property: string, obj: any, element?: any): bool; diff --git a/node/node.d.ts b/node/node.d.ts index d2cd41104..9434764e4 100644 --- a/node/node.d.ts +++ b/node/node.d.ts @@ -33,7 +33,7 @@ declare function clearInterval(intervalId: any); declare var require: { (id: string): any; - resolve(): string; + resolve(id:string): string; cache: any; extensions: any; } diff --git a/nodemailer/nodemailer-tests.ts b/nodemailer/nodemailer-tests.ts index d4458199c..94a955e67 100644 --- a/nodemailer/nodemailer-tests.ts +++ b/nodemailer/nodemailer-tests.ts @@ -80,4 +80,26 @@ transport.sendMail(message, function (error) { return; } console.log('Message sent successfully!'); -}); \ No newline at end of file +}); + + +// From the SMTP section of https://npmjs.org/package/nodemailer README + +var smptTransport1: Transport = nodemailer.createTransport("SMTP", { + service: "Gmail", // sets automatically host, port and connection security settings + auth: { + user: "gmail.user@gmail.com", + pass: "userpass" + } +}); + +var smtpTransport2: Transport = nodemailer.createTransport("SMTP", { + host: "smtp.gmail.com", // hostname + secureConnection: true, // use SSL + port: 465, // port for secure SMTP + auth: { + user: "gmail.user@gmail.com", + pass: "userpass" + } +}); + diff --git a/nodemailer/nodemailer.d.ts b/nodemailer/nodemailer.d.ts index 7d84ef447..681dd089b 100644 --- a/nodemailer/nodemailer.d.ts +++ b/nodemailer/nodemailer.d.ts @@ -69,21 +69,37 @@ interface XOAuth2Options { interface NodemailerTransportOptions { service?: string; - auth?: { - user?: string; - pass?: string; - XOAuthToken?: XOAuthGenerator; - XOAuth2?: XOAuth2Options; - }; + auth?: NodemailerAuthInterface; debug?: bool; AWSAccessKeyID?: string; AWSSecretKey: string; ServiceUrl: string; } +interface NodemailerAuthInterface { + user?: string; + pass?: string; + XOAuthToken?: XOAuthGenerator; + XOAuth2?: XOAuth2Options; +} + +interface NodemailerSMTPTransportOptions { + service?: string; + host?: string; + port?: number; + secureConnection?: bool; + name?: string; + auth: NodemailerAuthInterface; + ignoreTLS?: bool; + debug?: bool; + maxConnections?: number; +} + + interface Nodemailer { createTransport(type: string): Transport; createTransport(type: string, options: NodemailerTransportOptions): Transport; + createTransport(type: string, options: NodemailerSMTPTransportOptions): Transport; createTransport(type: string, path: string): Transport; createXOAuthGenerator(options: XOAuthGeneratorOptions): XOAuthGenerator; -} \ No newline at end of file +} diff --git a/requirejs/require.d.ts b/requirejs/require.d.ts index 8faf0ce24..ed9fbad28 100644 --- a/requirejs/require.d.ts +++ b/requirejs/require.d.ts @@ -199,10 +199,17 @@ interface RequireDefine { * @return module definition **/ (name: string, deps: string[], ready: (...deps: any[]) => any): void; + + /** + * Defines whether require js supports multiple versions of jQuery being loaded + **/ + amd: { + jQuery: bool; + }; } // Ambient declarations for 'require' and 'define' declare var require: Require; declare var requirejs: Require; declare var req: Require; -declare var define: RequireDefine; \ No newline at end of file +declare var define: RequireDefine; diff --git a/rx.js/rx.js.aggregates.d.ts b/rx.js/rx.js.aggregates.d.ts new file mode 100644 index 000000000..92ab49989 --- /dev/null +++ b/rx.js/rx.js.aggregates.d.ts @@ -0,0 +1,16 @@ +// Type definitions for RxJS "Aggregates" +// Project: http://rx.codeplex.com/ +// Definitions by: Carl de Billy +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module Rx { + export module Observable { + function all(predicate?: (any) => bool): IObservable; + function min(predicate?: (any) => bool): IObservable; + function max(predicate?: (any) => bool): IObservable; + function count(predicate?: (any) => bool): IObservable; + function sum(keySelector?: (any) => any): IObservable; + } +} \ No newline at end of file diff --git a/rx.js/rx.js.d.ts b/rx.js/rx.js.d.ts index 9ed1cced8..51c57d712 100644 --- a/rx.js/rx.js.d.ts +++ b/rx.js/rx.js.d.ts @@ -1,453 +1,463 @@ -// Type definitions for RxJS -// Project: http://rx.codeplex.com/ -// Definitions by: gsino -// Definitions: https://github.com/borisyankov/DefinitelyTyped - - -declare module Rx { - export module Internals { - function inherits(child: Function, parent: Function): Function; - function addProperties(obj: Object, ...sourcces: Object[]): void; - function addRef(xs: IObservable, r: { getDisposable(): _IDisposable; }): IObservable; - } - - //Collections - interface IIndexedItem { - id: number; - value: IScheduledItem; - - compareTo(other: IIndexedItem): number; - } - - // Priority Queue for Scheduling - interface IPriorityQueue { - items: IIndexedItem[]; - length: number; - - isHigherPriority(left: number, right: number): bool; - percolate(index: number): void; - heapify(index: number): void; - peek(): IIndexedItem; - removeAt(index: number): void; - dequeue(): IIndexedItem; - enqueue(item: IIndexedItem): void; - remove(item: IIndexedItem): bool; - } - - interface _IDisposable { - dispose(): void; - } - - interface ICompositeDisposable { - disposables: _IDisposable[]; - isDisposed: bool; - length: number; - - dispose(): void; - add(item: _IDisposable): void; - remove(item: _IDisposable): bool; - clear(): void; - contains(item: _IDisposable): bool; - toArray(): _IDisposable[]; - } - export module CompositeDisposable { - function new (...disposables: _IDisposable[]): ICompositeDisposable; - } - - // Main disposable class - interface IDisposable { - isDisposed: bool; - action: () =>void; - - dispose(): void; - } - export module Disposable { - function new (action: () =>void ): IDisposable; - - function create(action: () =>void ): _IDisposable; - var empty: _IDisposable; - } - - // Single assignment - interface ISingleAssignmentDisposable { - isDisposed: bool; - current: _IDisposable; - - dispose(): void; - disposable(value?: _IDisposable): _IDisposable; - getDisposable(): _IDisposable; - setDisposable(value: _IDisposable): void; - } - export module SingleAssignmentDisposable { - function new (): ISingleAssignmentDisposable; - } - - // Multiple assignment disposable - interface ISerialDisposable { - isDisposed: bool; - current: _IDisposable; - - dispose(): void; - getDisposable(): _IDisposable; - setDisposable(value: _IDisposable): void; - disposable(value?: _IDisposable): _IDisposable; - } - export module SerialDisposable { - function new (): ISerialDisposable; - } - - interface IRefCountDisposable { - underlyingDisposable: _IDisposable; - isDisposed: bool; - isPrimaryDisposed: bool; - count: number; - - dispose(): void; - getDisposable(): _IDisposable; - } - export module RefCountDisposable { - function new (disposable: _IDisposable): IRefCountDisposable; - } - - interface IScheduledItem { - scheduler: IScheduler; - state: any; - action: (scheduler: IScheduler, state) => _IDisposable; - dueTime: number; - comparer: (x: number, y: number) =>number; - disposable: ISingleAssignmentDisposable; - - invoke(): void; - compareTo(other: IScheduledItem): number; - isCancelled(): bool; - invokeCore(): _IDisposable; - } - - interface IScheduler { - _schedule: (state: any, action: (scheduler: IScheduler, state: any) =>_IDisposable) => _IDisposable; - _scheduleRelative: (state: any, dueTime: number, action: (scheduler: IScheduler, state: any) =>_IDisposable) =>_IDisposable; - _scheduleAbsolute: (state: any, dueTime: number, action: (scheduler: IScheduler, state: any) =>_IDisposable) =>_IDisposable; - - now(): number; - scheduleWithState(state: any, action: (scheduler: IScheduler, state: any) =>_IDisposable): _IDisposable; - scheduleWithAbsoluteAndState(state: any, dueTime: number, action: (scheduler: IScheduler, state: any) =>_IDisposable): _IDisposable; - scheduleWithRelativeAndState(state: any, dueTime: number, action: (scheduler: IScheduler, state: any) =>_IDisposable): _IDisposable; - - catchException(handler: (exception: any) =>bool): ICatchScheduler; - schedulePeriodic(period: number, action: () =>void ): _IDisposable; - schedulePeriodicWithState(state: any, period: number, action: (state: any) =>any): _IDisposable;//returns {Disposable|SingleAssignmentDisposable} - schedule(action: () =>void ): _IDisposable; - scheduleWithRelative(dueTime: number, action: () =>void ): _IDisposable; - scheduleWithAbsolute(dueTime: number, action: () =>void ): _IDisposable; - scheduleRecursive(action: (action: () =>void ) =>void ): _IDisposable; - scheduleRecursiveWithState(state: any, action: (state: any, action: (state: any) =>void ) =>void ): _IDisposable; - scheduleRecursiveWithRelative(dueTime: number, action: (action: (dueTime: number) =>void ) =>void ): _IDisposable; - scheduleRecursiveWithRelativeAndState(state: any, dueTime: number, action: (state: any, action: (state: any, dueTime: number) =>void ) =>void ): _IDisposable; - scheduleRecursiveWithAbsolute(dueTime: number, action: (action: (dueTime: number) =>void ) =>void ): _IDisposable; - scheduleRecursiveWithAbsoluteAndState(state: any, dueTime: number, action: (state: any, action: (state: any, dueTime: number) =>void ) =>void ): _IDisposable; - } - export module Scheduler { - function new (now: () =>number, - schedule: (state: any, action: (scheduler: IScheduler, state: any) =>_IDisposable) => _IDisposable, - scheduleRelative: (state: any, dueTime: number, action: (scheduler: IScheduler, state: any) =>_IDisposable) =>_IDisposable, - scheduleAbsolute: (state: any, dueTime: number, action: (scheduler: IScheduler, state: any) =>_IDisposable) =>_IDisposable - ): IScheduler; - - function now(): number; - function normalize(timeSpan: number): number; - - var immediate: IScheduler; - var currentThread: ICurrentScheduler;//IScheduler; - var timeout: IScheduler; - } - - // Current Thread IScheduler - interface ICurrentScheduler extends IScheduler { - scheduleRequired(): bool; - ensureTrampoline(action: () =>_IDisposable): _IDisposable; - } - - // Virtual IScheduler - interface IVirtualTimeScheduler extends IScheduler { - toRelative(duetime): number; - toDateTimeOffset(duetime: number): number; - - clock: number; - comparer: (x: number, y: number) =>number; - isEnabled: bool; - queue: IPriorityQueue; - scheduleRelativeWithState(state: any, dueTime: number, action: (scheduler: IScheduler, state: any) =>_IDisposable): _IDisposable; - scheduleRelative(dueTime: number, action: () =>void ): _IDisposable; - start(): _IDisposable; - stop(): void; - advanceTo(time: number); - advanceBy(time: number); - sleep(time: number); - getNext(): IScheduledItem; - scheduleAbsolute(dueTime: number, action: () =>void ); - scheduleAbsoluteWithState(state: any, dueTime: number, action: (scheduler: IScheduler, state: any) =>_IDisposable): _IDisposable; - } - //export module VirtualTimeScheduler { - // //absract - // function new (initialClock: number, comparer: (x: number, y: number) =>number): IVirtualTimeScheduler; - //} - - - // CatchScheduler - interface ICatchScheduler extends IScheduler { } - - // Notifications - interface INotification { - accept(observer: IObserver): void; - accept(onNext: (value: any) =>void , onError?: (exception: any) =>void , onCompleted?: () =>void ): void; - toObservable(scheduler?: IScheduler): IObservable; - hasValue: bool; - equals(other: INotification): bool; - } - export module Notification { - //absctract - //function new (): INotification; - - function createOnNext(value: any): INotification;//ON - function createOnError(exception): INotification;//OE - function createOnCompleted(): INotification;//OC - } - - export module Internals { - // Enumerator - interface IEnumerator { - moveNext(): bool; - getCurrent(): any; - dispose(): void; - } - export module Enumerator { - function new (moveNext: () =>bool, getCurrent: () => any, dispose: () =>void ): IEnumerator; - - function create(moveNext: () =>bool, getCurrent: () =>any, dispose?: () =>void ): IEnumerator; - } - - // Enumerable - interface IEnumerable { - getEnumerator(): IEnumerator; - - concat(): IObservable; - catchException(): IObservable; - } - export module Enumerable { - function new (getEnumerator: () =>IEnumerator): IEnumerable; - - function repeat(value: any, repeatCount?: number): IEnumerable; - function forEach(source: any[], selector?: (element: any, index: number) =>any): IEnumerable; - function forEach(source: { length: number;[index: number]: any; }, selector?: (element: any, index: number) =>any): IEnumerable; - } - } - - // Observer - interface IObserver { - onNext(value: any): void; - onError(exception: any): void; - onCompleted(): void; - - toNotifier(): (notification: INotification) =>void; - asObserver(): IObserver; - checked(): ICheckedObserver; - } - export module Observer { - //abstract - //function new (): IObserver; - - function create(onNext: (value: any) =>void , onError?: (exception: any) =>void , onCompleted?: () =>void ): IObserver; - function fromNotifier(handler: (notification: INotification) =>void ): IObserver; - } - - export module Internals { - // Abstract Observer - interface IAbstractObserver extends IObserver { - isStopped: bool; - - dispose(): void; - next(value: any): void; - error(exception: any): void; - completed(): void; - fail(): bool; - } - //export module AbstractObserver { - // //abstract - // function new (): IAbstractObserver; - //} - } - - interface IAnonymousObserver extends Internals.IAbstractObserver { - _onNext: (value: any) =>void; - _onError: (exception: any) =>void; - _onCompleted: () =>void; - } - export module AnonymousObserver { - function new (onNext: (value: any) =>void , onError: (exception: any) =>void , onCompleted: () =>void ): IAnonymousObserver; - } - - interface ICheckedObserver extends IObserver { - _observer: IObserver; - _state: number; // 0 - idle, 1 - busy, 2 - done - checkAccess(): void; - } - - export module Internals { - interface IScheduledObserver extends IAbstractObserver { - scheduler: IScheduler; - observer: IObserver; - isAcquired: bool; - hasFaulted: bool; - queue: { (value: any): void; (exception: any): void; (): void; }[]; - disposable: ISerialDisposable; - - ensureActive(): void; - } - export module ScheduledObserver { - function new (scheduler: IScheduler, observer: IObserver): IScheduledObserver; - } - } - - - interface IObservable { - _subscribe: (observer: IObserver) =>_IDisposable; - - subscribe(observer: IObserver): _IDisposable; - - finalValue(): IObservable; - subscribe(onNext?: (value: any) =>void , onError?: (exception: any) =>void , onCompleted?: () =>void ): _IDisposable; - toArray(): IObservable; - - observeOn(scheduler: IScheduler): IObservable; - subscribeOn(scheduler: IScheduler): IObservable; - amb(rightSource: IObservable): IObservable; - catchException(handler: (exception: any) =>IObservable): IObservable; - catchException(second: IObservable): IObservable; - combineLatest(second: IObservable, resultSelector: (v1: any, v2: any) =>any): IObservable; - combineLatest(second: IObservable, third: IObservable, resultSelector: (v1: any, v2: any, v3: any) =>any): IObservable; - combineLatest(second: IObservable, third: IObservable, fourth: IObservable, resultSelector: (v1: any, v2: any, v3: any, v4: any) =>any): IObservable; - combineLatest(second: IObservable, third: IObservable, fourth: IObservable, fifth, IObservable, resultSelector: (v1: any, v2: any, v3: any, v4: any, v5: any) =>any): IObservable; - combineLatest(...soucesAndResultSelector: any[]): IObservable; - concat(...sources: IObservable[]): IObservable; - concat(sources: IObservable[]): IObservable; - concatIObservable(): IObservable; - merge(maxConcurrent: number): IObservable; - merge(other: IObservable): IObservable; - mergeIObservable(): IObservable; - onErrorResumeNext(second: IObservable): IObservable; - skipUntil(other: IObservable): IObservable; - switchLatest(): IObservable; - takeUntil(other: IObservable): IObservable; - zip(second: IObservable, resultSelector: (v1: any, v2: any) =>any): IObservable; - zip(second: IObservable, third: IObservable, resultSelector: (v1: any, v2: any, v3: any) =>any): IObservable; - zip(second: IObservable, third: IObservable, fourth: IObservable, resultSelector: (v1: any, v2: any, v3: any, v4: any) =>any): IObservable; - zip(second: IObservable, third: IObservable, fourth: IObservable, fifth, IObservable, resultSelector: (v1: any, v2: any, v3: any, v4: any, v5: any) =>any): IObservable; - zip(...soucesAndResultSelector: any[]): IObservable; - zip(second: any[], resultSelector: (left: any, right: any) =>any): IObservable; - asIObservable(): IObservable; - bufferWithCount(count: number, skip?: number): IObservable; - dematerialize(): IObservable; - distinctUntilChanged(keySelector?: (value: any) =>any, comparer?: (x: any, y: any) =>bool): IObservable; - doAction(observer: IObserver): IObservable; - doAction(onNext: (value: any) => void , onError?: (exception: any) =>void , onCompleted?: () =>void ): IObservable; - finallyAction(action: () =>void ): IObservable; - ignoreElements(): IObservable; - materialize(): IObservable; - repeat(repeatCount?: number): IObservable; - retry(retryCount?: number): IObservable; - scan(seed: number, accumulator: (acc: any, value: any) =>any): IObservable; - scan(accumulator: (acc: any, value: any) =>any): IObservable; - skipLast(count: number): IObservable; - startWith(...values: any[]): IObservable; - startWith(scheduler: IScheduler, ...values: any[]): IObservable; - takeLast(count: number, scheduler?: IScheduler): IObservable; - takeLastBuffer(count: number): IObservable; - windowWithCount(count: number, skip?: number): IObservable; - defaultIfEmpty(defaultValue?: any): IObservable; - distinct(keySelector?: (value: any) =>any, keySerializer?: (key: any) =>string): IObservable; - groupBy(keySelector: (value: any) =>any, elementSelector?: (value: any) =>any, keySerializer?: (key: any) =>string): IGroupedObservable; - groupByUntil(keySelector: (value: any) =>any, elementSelector: (value: any) =>any, durationSelector: (gloup: IGroupedObservable) =>IObservable, keySerializer?: (key: any) =>string): IGroupedObservable; - select(selector: (value: any, index: number) =>any): IObservable; - selectMany(selector: (value: any) =>IObservable, resultSelector?: (x: any, y: any) =>any): IObservable; - selectMany(other: IObservable): IObservable; - skip(count: number): IObservable; - skipWhile(predicate: (value: any, index?: number) =>bool): IObservable; - take(count: number, scheduler?: IScheduler): IObservable; - takeWhile(predicate: (value: any, index?: number) =>bool): IObservable; - where(predicate: (value: any, index?: number) =>bool): IObservable; - } - export module Observable { - function new (subscribe: (observer: IObserver) =>_IDisposable): IObservable; - - function start(func: () =>any, scheduler?: IScheduler, context?: any): IObservable; - function toAsync(func: Function, scheduler?: IScheduler, context?: any): (...arguments: any[]) => IObservable; - function create(subscribe: (Observer) =>() =>void ): IObservable; - function createWithDisposable(subscribe: (Observer) =>_IDisposable): IObservable; - function defer(observableFactory: () =>IObservable): IObservable; - function empty(scheduler?: IScheduler): IObservable; - function fromArray(array: any[], scheduler?: IScheduler): IObservable; - function fromArray(array: { length: number;[index: number]: any; }, scheduler?: IScheduler): IObservable; - function generate(initialState: any, condition: (state: any) =>bool, iterate: (state: any) =>any, resultSelector: (state: any) =>any, scheduler?: IScheduler): IObservable; - function never(): IObservable; - function range(start: number, count: number, scheduler?: IScheduler): IObservable; - function repeat(value: any, repeatCount?: number, scheduler?: IScheduler): IObservable; - function returnValue(value: any, scheduler?: IScheduler): IObservable; - function throwException(exception: any, scheduler?: IScheduler): IObservable; - function using(resourceFactory: () =>any, observableFactory: (resource: any) =>IObservable): IObservable; - function amb(...sources: IObservable[]): IObservable; - function catchException(sources: IObservable[]): IObservable; - function catchException(...sources: IObservable[]): IObservable; - function concat(...sources: IObservable[]): IObservable; - function concat(sources: IObservable[]): IObservable; - function merge(...sources: IObservable[]): IObservable; - function merge(sources: IObservable[]): IObservable; - function merge(scheduler: IScheduler, ...sources: IObservable[]): IObservable; - function merge(scheduler: IScheduler, sources: IObservable[]): IObservable; - function onErrorResumeNext(...sources: IObservable[]): IObservable; - function onErrorResumeNext(sources: IObservable[]): IObservable; - } - - export module Internals { - interface IAnonymousObservable extends IObservable { } - export module AnonymousObservable { - function new (subscribe: (observer: IObserver) =>_IDisposable): IAnonymousObservable; - } - } - - interface IGroupedObservable extends IObservable { - key: any; - underlyingObservable: IObservable; - } - - interface ISubject extends IObservable, IObserver { - isDisposed: bool; - isStopped: bool; - observers: IObserver[]; - - dispose(): void; - } - export module Subject { - function new (): ISubject; - - function create(observer: IObserver, observable: IObservable): ISubject; - } - - interface IAsyncSubject extends IObservable, IObserver { - isDisposed: bool; - value: any; - hasValue: bool; - observers: IObserver[]; - exception: any; - - dispose(): void; - } - export module AsyncSubject { - function new (): IAsyncSubject; - } - - interface IAnonymousSubject extends IObservable { - onNext(value: any): void; - onError(exception: any): void; - onCompleted(): void; - } +// Type definitions for RxJS +// Project: http://rx.codeplex.com/ +// Definitions by: gsino +// Definitions: https://github.com/borisyankov/DefinitelyTyped + + +declare module Rx { + export module Internals { + function inherits(child: Function, parent: Function): Function; + function addProperties(obj: Object, ...sourcces: Object[]): void; + function addRef(xs: IObservable, r: { getDisposable(): _IDisposable; }): IObservable; + } + + //Collections + interface IIndexedItem { + id: number; + value: IScheduledItem; + + compareTo(other: IIndexedItem): number; + } + + // Priority Queue for Scheduling + interface IPriorityQueue { + items: IIndexedItem[]; + length: number; + + isHigherPriority(left: number, right: number): bool; + percolate(index: number): void; + heapify(index: number): void; + peek(): IIndexedItem; + removeAt(index: number): void; + dequeue(): IIndexedItem; + enqueue(item: IIndexedItem): void; + remove(item: IIndexedItem): bool; + } + + interface _IDisposable { + dispose(): void; + } + + interface ICompositeDisposable { + disposables: _IDisposable[]; + isDisposed: bool; + length: number; + + dispose(): void; + add(item: _IDisposable): void; + remove(item: _IDisposable): bool; + clear(): void; + contains(item: _IDisposable): bool; + toArray(): _IDisposable[]; + } + export module CompositeDisposable { + function new (...disposables: _IDisposable[]): ICompositeDisposable; + } + + // Main disposable class + interface IDisposable { + isDisposed: bool; + action: () =>void; + + dispose(): void; + } + export module Disposable { + function new (action: () =>void ): IDisposable; + + function create(action: () =>void ): _IDisposable; + var empty: _IDisposable; + } + + // Single assignment + interface ISingleAssignmentDisposable { + isDisposed: bool; + current: _IDisposable; + + dispose(): void; + disposable(value?: _IDisposable): _IDisposable; + getDisposable(): _IDisposable; + setDisposable(value: _IDisposable): void; + } + export module SingleAssignmentDisposable { + function new (): ISingleAssignmentDisposable; + } + + // Multiple assignment disposable + interface ISerialDisposable { + isDisposed: bool; + current: _IDisposable; + + dispose(): void; + getDisposable(): _IDisposable; + setDisposable(value: _IDisposable): void; + disposable(value?: _IDisposable): _IDisposable; + } + export module SerialDisposable { + function new (): ISerialDisposable; + } + + interface IRefCountDisposable { + underlyingDisposable: _IDisposable; + isDisposed: bool; + isPrimaryDisposed: bool; + count: number; + + dispose(): void; + getDisposable(): _IDisposable; + } + export module RefCountDisposable { + function new (disposable: _IDisposable): IRefCountDisposable; + } + + interface IScheduledItem { + scheduler: IScheduler; + state: any; + action: (scheduler: IScheduler, state) => _IDisposable; + dueTime: number; + comparer: (x: number, y: number) =>number; + disposable: ISingleAssignmentDisposable; + + invoke(): void; + compareTo(other: IScheduledItem): number; + isCancelled(): bool; + invokeCore(): _IDisposable; + } + + interface IScheduler { + _schedule: (state: any, action: (scheduler: IScheduler, state: any) =>_IDisposable) => _IDisposable; + _scheduleRelative: (state: any, dueTime: number, action: (scheduler: IScheduler, state: any) =>_IDisposable) =>_IDisposable; + _scheduleAbsolute: (state: any, dueTime: number, action: (scheduler: IScheduler, state: any) =>_IDisposable) =>_IDisposable; + + now(): number; + scheduleWithState(state: any, action: (scheduler: IScheduler, state: any) =>_IDisposable): _IDisposable; + scheduleWithAbsoluteAndState(state: any, dueTime: number, action: (scheduler: IScheduler, state: any) =>_IDisposable): _IDisposable; + scheduleWithRelativeAndState(state: any, dueTime: number, action: (scheduler: IScheduler, state: any) =>_IDisposable): _IDisposable; + + catchException(handler: (exception: any) =>bool): ICatchScheduler; + schedulePeriodic(period: number, action: () =>void ): _IDisposable; + schedulePeriodicWithState(state: any, period: number, action: (state: any) =>any): _IDisposable;//returns {Disposable|SingleAssignmentDisposable} + schedule(action: () =>void ): _IDisposable; + scheduleWithRelative(dueTime: number, action: () =>void ): _IDisposable; + scheduleWithAbsolute(dueTime: number, action: () =>void ): _IDisposable; + scheduleRecursive(action: (action: () =>void ) =>void ): _IDisposable; + scheduleRecursiveWithState(state: any, action: (state: any, action: (state: any) =>void ) =>void ): _IDisposable; + scheduleRecursiveWithRelative(dueTime: number, action: (action: (dueTime: number) =>void ) =>void ): _IDisposable; + scheduleRecursiveWithRelativeAndState(state: any, dueTime: number, action: (state: any, action: (state: any, dueTime: number) =>void ) =>void ): _IDisposable; + scheduleRecursiveWithAbsolute(dueTime: number, action: (action: (dueTime: number) =>void ) =>void ): _IDisposable; + scheduleRecursiveWithAbsoluteAndState(state: any, dueTime: number, action: (state: any, action: (state: any, dueTime: number) =>void ) =>void ): _IDisposable; + } + export module Scheduler { + function new (now: () =>number, + schedule: (state: any, action: (scheduler: IScheduler, state: any) =>_IDisposable) => _IDisposable, + scheduleRelative: (state: any, dueTime: number, action: (scheduler: IScheduler, state: any) =>_IDisposable) =>_IDisposable, + scheduleAbsolute: (state: any, dueTime: number, action: (scheduler: IScheduler, state: any) =>_IDisposable) =>_IDisposable + ): IScheduler; + + function now(): number; + function normalize(timeSpan: number): number; + + var immediate: IScheduler; + var currentThread: ICurrentScheduler;//IScheduler; + var timeout: IScheduler; + } + + // Current Thread IScheduler + interface ICurrentScheduler extends IScheduler { + scheduleRequired(): bool; + ensureTrampoline(action: () =>_IDisposable): _IDisposable; + } + + // Virtual IScheduler + interface IVirtualTimeScheduler extends IScheduler { + toRelative(duetime): number; + toDateTimeOffset(duetime: number): number; + + clock: number; + comparer: (x: number, y: number) =>number; + isEnabled: bool; + queue: IPriorityQueue; + scheduleRelativeWithState(state: any, dueTime: number, action: (scheduler: IScheduler, state: any) =>_IDisposable): _IDisposable; + scheduleRelative(dueTime: number, action: () =>void ): _IDisposable; + start(): _IDisposable; + stop(): void; + advanceTo(time: number); + advanceBy(time: number); + sleep(time: number); + getNext(): IScheduledItem; + scheduleAbsolute(dueTime: number, action: () =>void ); + scheduleAbsoluteWithState(state: any, dueTime: number, action: (scheduler: IScheduler, state: any) =>_IDisposable): _IDisposable; + } + //export module VirtualTimeScheduler { + // //absract + // function new (initialClock: number, comparer: (x: number, y: number) =>number): IVirtualTimeScheduler; + //} + + + // CatchScheduler + interface ICatchScheduler extends IScheduler { } + + // Notifications + interface INotification { + accept(observer: IObserver): void; + accept(onNext: (value: any) =>void , onError?: (exception: any) =>void , onCompleted?: () =>void ): void; + toObservable(scheduler?: IScheduler): IObservable; + hasValue: bool; + equals(other: INotification): bool; + } + export module Notification { + //absctract + //function new (): INotification; + + function createOnNext(value: any): INotification;//ON + function createOnError(exception): INotification;//OE + function createOnCompleted(): INotification;//OC + } + + export module Internals { + // Enumerator + interface IEnumerator { + moveNext(): bool; + getCurrent(): any; + dispose(): void; + } + export module Enumerator { + function new (moveNext: () =>bool, getCurrent: () => any, dispose: () =>void ): IEnumerator; + + function create(moveNext: () =>bool, getCurrent: () =>any, dispose?: () =>void ): IEnumerator; + } + + // Enumerable + interface IEnumerable { + getEnumerator(): IEnumerator; + + concat(): IObservable; + catchException(): IObservable; + } + export module Enumerable { + function new (getEnumerator: () =>IEnumerator): IEnumerable; + + function repeat(value: any, repeatCount?: number): IEnumerable; + function forEach(source: any[], selector?: (element: any, index: number) =>any): IEnumerable; + function forEach(source: { length: number;[index: number]: any; }, selector?: (element: any, index: number) =>any): IEnumerable; + } + } + + // Observer + interface IObserver { + onNext(value: any): void; + onError(exception: any): void; + onCompleted(): void; + + toNotifier(): (notification: INotification) =>void; + asObserver(): IObserver; + checked(): ICheckedObserver; + } + export module Observer { + //abstract + //function new (): IObserver; + + function create(onNext: (value: any) =>void , onError?: (exception: any) =>void , onCompleted?: () =>void ): IObserver; + function fromNotifier(handler: (notification: INotification) =>void ): IObserver; + } + + export module Internals { + // Abstract Observer + interface IAbstractObserver extends IObserver { + isStopped: bool; + + dispose(): void; + next(value: any): void; + error(exception: any): void; + completed(): void; + fail(): bool; + } + //export module AbstractObserver { + // //abstract + // function new (): IAbstractObserver; + //} + } + + interface IAnonymousObserver extends Internals.IAbstractObserver { + _onNext: (value: any) =>void; + _onError: (exception: any) =>void; + _onCompleted: () =>void; + } + export module AnonymousObserver { + function new (onNext: (value: any) =>void , onError: (exception: any) =>void , onCompleted: () =>void ): IAnonymousObserver; + } + + interface ICheckedObserver extends IObserver { + _observer: IObserver; + _state: number; // 0 - idle, 1 - busy, 2 - done + checkAccess(): void; + } + + export module Internals { + interface IScheduledObserver extends IAbstractObserver { + scheduler: IScheduler; + observer: IObserver; + isAcquired: bool; + hasFaulted: bool; + //queue: { (value: any): void; (exception: any): void; (): void; }[]; + disposable: ISerialDisposable; + + ensureActive(): void; + } + export module ScheduledObserver { + function new (scheduler: IScheduler, observer: IObserver): IScheduledObserver; + } + } + + + interface IObservable { + _subscribe: (observer: IObserver) =>_IDisposable; + + subscribe(observer: IObserver): _IDisposable; + + finalValue(): IObservable; + subscribe(onNext?: (value: any) =>void , onError?: (exception: any) =>void , onCompleted?: () =>void ): _IDisposable; + toArray(): IObservable; + + observeOn(scheduler: IScheduler): IObservable; + subscribeOn(scheduler: IScheduler): IObservable; + amb(rightSource: IObservable): IObservable; + catchException(handler: (exception: any) =>IObservable): IObservable; + catchException(second: IObservable): IObservable; + combineLatest(second: IObservable, resultSelector: (v1: any, v2: any) =>any): IObservable; + combineLatest(second: IObservable, third: IObservable, resultSelector: (v1: any, v2: any, v3: any) =>any): IObservable; + combineLatest(second: IObservable, third: IObservable, fourth: IObservable, resultSelector: (v1: any, v2: any, v3: any, v4: any) =>any): IObservable; + combineLatest(second: IObservable, third: IObservable, fourth: IObservable, fifth, IObservable, resultSelector: (v1: any, v2: any, v3: any, v4: any, v5: any) =>any): IObservable; + combineLatest(...soucesAndResultSelector: any[]): IObservable; + concat(...sources: IObservable[]): IObservable; + concat(sources: IObservable[]): IObservable; + concatIObservable(): IObservable; + merge(maxConcurrent: number): IObservable; + merge(other: IObservable): IObservable; + mergeIObservable(): IObservable; + onErrorResumeNext(second: IObservable): IObservable; + skipUntil(other: IObservable): IObservable; + switchLatest(): IObservable; + takeUntil(other: IObservable): IObservable; + zip(second: IObservable, resultSelector: (v1: any, v2: any) =>any): IObservable; + zip(second: IObservable, third: IObservable, resultSelector: (v1: any, v2: any, v3: any) =>any): IObservable; + zip(second: IObservable, third: IObservable, fourth: IObservable, resultSelector: (v1: any, v2: any, v3: any, v4: any) =>any): IObservable; + zip(second: IObservable, third: IObservable, fourth: IObservable, fifth, IObservable, resultSelector: (v1: any, v2: any, v3: any, v4: any, v5: any) =>any): IObservable; + zip(...soucesAndResultSelector: any[]): IObservable; + zip(second: any[], resultSelector: (left: any, right: any) =>any): IObservable; + asIObservable(): IObservable; + bufferWithCount(count: number, skip?: number): IObservable; + dematerialize(): IObservable; + distinctUntilChanged(keySelector?: (value: any) =>any, comparer?: (x: any, y: any) =>bool): IObservable; + doAction(observer: IObserver): IObservable; + doAction(onNext: (value: any) => void , onError?: (exception: any) =>void , onCompleted?: () =>void ): IObservable; + finallyAction(action: () =>void ): IObservable; + ignoreElements(): IObservable; + materialize(): IObservable; + repeat(repeatCount?: number): IObservable; + retry(retryCount?: number): IObservable; + scan(seed: any, accumulator: (acc: any, value: any) =>any): IObservable; + scan(accumulator: (acc: any, value: any) =>any): IObservable; + skipLast(count: number): IObservable; + startWith(...values: any[]): IObservable; + startWith(scheduler: IScheduler, ...values: any[]): IObservable; + takeLast(count: number, scheduler?: IScheduler): IObservable; + takeLastBuffer(count: number): IObservable; + windowWithCount(count: number, skip?: number): IObservable; + defaultIfEmpty(defaultValue?: any): IObservable; + distinct(keySelector?: (value: any) =>any, keySerializer?: (key: any) =>string): IObservable; + groupBy(keySelector: (value: any) =>any, elementSelector?: (value: any) =>any, keySerializer?: (key: any) =>string): IGroupedObservable; + groupByUntil(keySelector: (value: any) =>any, elementSelector: (value: any) =>any, durationSelector: (gloup: IGroupedObservable) =>IObservable, keySerializer?: (key: any) =>string): IGroupedObservable; + select(selector: (value: any, index: number) =>any): IObservable; + selectMany(selector: (value: any) =>IObservable, resultSelector?: (x: any, y: any) =>any): IObservable; + selectMany(other: IObservable): IObservable; + skip(count: number): IObservable; + skipWhile(predicate: (value: any, index?: number) =>bool): IObservable; + take(count: number, scheduler?: IScheduler): IObservable; + takeWhile(predicate: (value: any, index?: number) =>bool): IObservable; + where(predicate: (value: any, index?: number) => bool): IObservable; + + // time + delay(dueTime: number, scheduler?: IScheduler): IObservable; + throttle(dueTime: number, scheduler?: IScheduler): IObservable; + windowWithTime(dueTime: number, timeShiftOrScheduler?: any, scheduler?: IScheduler): IObservable; + timeInterval(scheduler: IScheduler): IObservable; + sample(interval: number, scheduler?: IScheduler): IObservable; + sample(sampler: IObservable, scheduler?: IScheduler): IObservable; + timeout(dueTime: number, other?: IObservable, scheduler?: IScheduler): IObservable; + delaySubscription(dueTime: number, scheduler?: IScheduler): IObservable; + } + export module Observable { + function new (subscribe: (observer: IObserver) =>_IDisposable): IObservable; + + function start(func: () =>any, scheduler?: IScheduler, context?: any): IObservable; + function toAsync(func: Function, scheduler?: IScheduler, context?: any): (...arguments: any[]) => IObservable; + function create(subscribe: (Observer) =>() =>void ): IObservable; + function createWithDisposable(subscribe: (Observer) =>_IDisposable): IObservable; + function defer(observableFactory: () =>IObservable): IObservable; + function empty(scheduler?: IScheduler): IObservable; + function fromArray(array: any[], scheduler?: IScheduler): IObservable; + function fromArray(array: { length: number;[index: number]: any; }, scheduler?: IScheduler): IObservable; + function generate(initialState: any, condition: (state: any) =>bool, iterate: (state: any) =>any, resultSelector: (state: any) =>any, scheduler?: IScheduler): IObservable; + function never(): IObservable; + function range(start: number, count: number, scheduler?: IScheduler): IObservable; + function repeat(value: any, repeatCount?: number, scheduler?: IScheduler): IObservable; + function returnValue(value: any, scheduler?: IScheduler): IObservable; + function throwException(exception: any, scheduler?: IScheduler): IObservable; + function using(resourceFactory: () =>any, observableFactory: (resource: any) =>IObservable): IObservable; + function amb(...sources: IObservable[]): IObservable; + function catchException(sources: IObservable[]): IObservable; + function catchException(...sources: IObservable[]): IObservable; + function concat(...sources: IObservable[]): IObservable; + function concat(sources: IObservable[]): IObservable; + function merge(...sources: IObservable[]): IObservable; + function merge(sources: IObservable[]): IObservable; + function merge(scheduler: IScheduler, ...sources: IObservable[]): IObservable; + function merge(scheduler: IScheduler, sources: IObservable[]): IObservable; + function onErrorResumeNext(...sources: IObservable[]): IObservable; + function onErrorResumeNext(sources: IObservable[]): IObservable; + } + + export module Internals { + interface IAnonymousObservable extends IObservable { } + export module AnonymousObservable { + function new (subscribe: (observer: IObserver) =>_IDisposable): IAnonymousObservable; + } + } + + interface IGroupedObservable extends IObservable { + key: any; + underlyingObservable: IObservable; + } + + interface ISubject extends IObservable, IObserver { + isDisposed: bool; + isStopped: bool; + observers: IObserver[]; + + dispose(): void; + } + export module Subject { + function new (): ISubject; + + function create(observer: IObserver, observable: IObservable): ISubject; + } + + interface IAsyncSubject extends IObservable, IObserver { + isDisposed: bool; + value: any; + hasValue: bool; + observers: IObserver[]; + exception: any; + + dispose(): void; + } + export module AsyncSubject { + function new (): IAsyncSubject; + } + + interface IAnonymousSubject extends IObservable { + onNext(value: any): void; + onError(exception: any): void; + onCompleted(): void; + } } \ No newline at end of file diff --git a/rx.js/rx.js.html.d.ts b/rx.js/rx.js.html.d.ts new file mode 100644 index 000000000..384ebad1a --- /dev/null +++ b/rx.js/rx.js.html.d.ts @@ -0,0 +1,6 @@ +declare module Rx { + export module Observable { + function fromEvent(element: HTMLElement, eventName: string) : IObservable; + function fromEvent(document: HTMLDocument, eventName: string): IObservable; + } +} \ No newline at end of file diff --git a/rx.js/rx.js.time.d.ts b/rx.js/rx.js.time.d.ts new file mode 100644 index 000000000..f1bd2a584 --- /dev/null +++ b/rx.js/rx.js.time.d.ts @@ -0,0 +1,10 @@ +/// + +declare module Rx { + export module Observable { + function ifThen(condition: () => bool, thenSource: IObservable): IObservable; + function ifThen(condition: () => bool, thenSource: IObservable, elseSource: IObservable): IObservable; + function ifThen(condition: () => bool, thenSource: IObservable, scheduler: IScheduler): IObservable; + function interval(period: number, scheduler?: IScheduler): IObservable; + } +} \ No newline at end of file diff --git a/sinon-chai/sinon-chai-tests.ts b/sinon-chai/sinon-chai-tests.ts new file mode 100644 index 000000000..1ada034de --- /dev/null +++ b/sinon-chai/sinon-chai-tests.ts @@ -0,0 +1,30 @@ +///  +///  + +var expect = chai.expect; + +function test() { + var spy; + var anotherSpy; + var context; + var match; + + expect(spy).to.have.been.called; + expect(spy).to.have.been.calledOnce; + expect(spy).to.have.been.calledTwice; + expect(spy).to.have.been.calledThrice; + expect(spy).to.have.been.calledBefore(anotherSpy); + expect(spy).to.have.been.calledAfter(anotherSpy); + expect(spy).to.have.been.calledOn(context); + expect(spy).to.have.been.alwaysCalledOn(context); + expect(spy).to.have.been.calledWith('foo', 'bar'); + expect(spy).to.have.been.alwaysCalledWith('foo', 'bar'); + expect(spy).to.have.been.calledWithExactly('foo', 'bar'); + expect(spy).to.have.been.alwaysCalledWithExactly('foo', 'bar'); + expect(spy).to.have.been.calledWithMatch(match); + expect(spy).to.have.been.alwaysCalledWithMatch(match); + expect(spy).to.have.been.returned(1); + expect(spy).to.have.been.alwaysReturned(1); + expect(spy).to.have.been.threw('an error'); + expect(spy).to.have.been.alwaysThrew('an error'); +} \ No newline at end of file diff --git a/sinon-chai/sinon-chai.d.ts b/sinon-chai/sinon-chai.d.ts new file mode 100644 index 000000000..93e264ac2 --- /dev/null +++ b/sinon-chai/sinon-chai.d.ts @@ -0,0 +1,33 @@ +// Type definitions for sinon-chai 2.4.0 +// Project: https://github.com/domenic/sinon-chai +// Definitions by: Kazi Manzur Rashid +// DefinitelyTyped: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module chai { + interface Been { + called: bool; + calledOnce: bool; + calledTwice: bool; + calledThrice: bool; + calledBefore(spy: any): bool; + calledAfter(spy: any): bool; + calledOn(context: any): bool; + alwaysCalledOn(context: any): bool; + calledWith(...args: any[]): bool; + alwaysCalledWith(...args: any[]): bool; + calledWithExactly(...args: any[]): bool; + alwaysCalledWithExactly(...args: any[]): bool; + calledWithMatch(...args: any[]): bool; + alwaysCalledWithMatch(...args: any[]): bool; + returned(returnVal: any): bool; + alwaysReturned(returnVal: any): bool; + threw(errorObjOrErrorTypeStringOrNothing: any): bool; + alwaysThrew(errorObjOrErrorTypeStringOrNothing: any): bool; + } + + interface Have { + been: Been; + } +}